From 13c542b52067fa425aae54775c1e40a640306c46 Mon Sep 17 00:00:00 2001 From: Parth Bansal Date: Thu, 2 Apr 2026 15:21:44 +0000 Subject: [PATCH 1/2] update --- packages/features/src/v1/model.ts | 224 ++++---------- .../oauthcustomappintegration/src/v1/model.ts | 82 ++--- packages/postgres/src/v1/model.ts | 292 ++++++++---------- packages/sdk/src/model.ts | 94 +----- 4 files changed, 234 insertions(+), 458 deletions(-) diff --git a/packages/features/src/v1/model.ts b/packages/features/src/v1/model.ts index 9fdf8b0c..93804452 100644 --- a/packages/features/src/v1/model.ts +++ b/packages/features/src/v1/model.ts @@ -3,25 +3,6 @@ import {Temporal} from '@js-temporal/polyfill'; import {z} from 'zod'; -/** - * Scalar data types for request-time field definitions. - * Only flat (non-nested) types are supported. - */ -export enum ScalarDataType { - SCALAR_DATA_TYPE_UNSPECIFIED = 'SCALAR_DATA_TYPE_UNSPECIFIED', - INTEGER = 'INTEGER', - FLOAT = 'FLOAT', - BOOLEAN = 'BOOLEAN', - STRING = 'STRING', - DOUBLE = 'DOUBLE', - LONG = 'LONG', - TIMESTAMP = 'TIMESTAMP', - DATE = 'DATE', - SHORT = 'SHORT', - BINARY = 'BINARY', - DECIMAL = 'DECIMAL', -} - /** Deprecated: Use the function-specific messages in AggregationFunction.function_type oneof instead. Kept for backwards compatibility. */ // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name. export enum Function_FunctionType { @@ -170,14 +151,9 @@ export interface CreateMaterializedFeatureRequest { materializedFeature?: MaterializedFeature | undefined; } -/** Specifies the data source backing a feature. Exactly one source type must be set. */ export interface DataSource { - /** A Delta table data source. */ deltaTableSource?: DeltaTableSource | undefined; - /** A Kafka stream data source. */ kafkaSource?: KafkaSource | undefined; - /** A request-time data source. */ - requestSource?: RequestSource | undefined; } export interface DeleteFeatureRequest { @@ -274,32 +250,12 @@ export interface Feature { timeseriesColumn?: TimeseriesColumn | undefined; } -/** - * A single field definition within a FlatSchema, specifying the field name and its scalar data type. - * Does not support nested or complex types (arrays, maps, structs). - */ -export interface FieldDefinition { - /** The name of the field. */ - name?: string | undefined; - /** The scalar data type of the field. */ - dataType?: ScalarDataType | undefined; -} - /** Returns the first value. */ export interface FirstFunction { /** The input column from which the first value is returned. */ input?: string | undefined; } -/** - * A flat (non-nested) schema for request-time fields, defined as an ordered list of field definitions. - * This schema only supports scalar types. - */ -export interface FlatSchema { - /** The list of fields in this schema. */ - fields?: FieldDefinition[] | undefined; -} - export interface Function { /** * Deprecated: Use the function oneof with AggregationFunction instead. Kept for backwards compatibility. @@ -525,12 +481,6 @@ export interface OnlineStoreConfig { onlineStoreName?: string | undefined; } -/** A request-time data source whose value is provided at inference time: offline batch scoring or online serving endpoint */ -export interface RequestSource { - /** A flat schema with scalar-typed fields only. */ - flatSchema?: FlatSchema | undefined; -} - export interface SchemaConfig { /** Schema of the JSON object in standard IETF JSON schema format (https://json-schema.org/) */ jsonSchema?: string | undefined; @@ -828,12 +778,10 @@ export const unmarshalDataSourceSchema: z.ZodType = z .lazy(() => unmarshalDeltaTableSourceSchema) .optional(), kafka_source: z.lazy(() => unmarshalKafkaSourceSchema).optional(), - request_source: z.lazy(() => unmarshalRequestSourceSchema).optional(), }) .transform(d => ({ deltaTableSource: d.delta_table_source, kafkaSource: d.kafka_source, - requestSource: d.request_source, })); export const unmarshalDeleteFeatureRequestSchema: z.ZodType = @@ -915,16 +863,6 @@ export const unmarshalFeatureSchema: z.ZodType = z timeseriesColumn: d.timeseries_column, })); -export const unmarshalFieldDefinitionSchema: z.ZodType = z - .object({ - name: z.string().optional(), - data_type: z.enum(ScalarDataType).optional(), - }) - .transform(d => ({ - name: d.name, - dataType: d.data_type, - })); - export const unmarshalFirstFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), @@ -933,14 +871,6 @@ export const unmarshalFirstFunctionSchema: z.ZodType = z input: d.input, })); -export const unmarshalFlatSchemaSchema: z.ZodType = z - .object({ - fields: z.array(z.lazy(() => unmarshalFieldDefinitionSchema)).optional(), - }) - .transform(d => ({ - fields: d.fields, - })); - export const unmarshalFunctionSchema: z.ZodType = z .object({ function_type: z.enum(Function_FunctionType).optional(), @@ -1224,14 +1154,6 @@ export const unmarshalOnlineStoreConfigSchema: z.ZodType = z onlineStoreName: d.online_store_name, })); -export const unmarshalRequestSourceSchema: z.ZodType = z - .object({ - flat_schema: z.lazy(() => unmarshalFlatSchemaSchema).optional(), - }) - .transform(d => ({ - flatSchema: d.flat_schema, - })); - export const unmarshalSchemaConfigSchema: z.ZodType = z .object({ json_schema: z.string().optional(), @@ -1375,7 +1297,7 @@ export const unmarshalVarSampFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalAggregationFunctionSchema: z.ZodType = z +export const marshalAggregationFunctionSchema = z .object({ avg: z.lazy(() => marshalAvgFunctionSchema).optional(), countFunction: z.lazy(() => marshalCountFunctionSchema).optional(), @@ -1413,7 +1335,7 @@ export const marshalAggregationFunctionSchema: z.ZodType = z time_window: d.timeWindow, })); -export const marshalApproxCountDistinctFunctionSchema: z.ZodType = z +export const marshalApproxCountDistinctFunctionSchema = z .object({ input: z.string().optional(), relativeSd: z.number().optional(), @@ -1423,7 +1345,7 @@ export const marshalApproxCountDistinctFunctionSchema: z.ZodType = z relative_sd: d.relativeSd, })); -export const marshalApproxPercentileFunctionSchema: z.ZodType = z +export const marshalApproxPercentileFunctionSchema = z .object({ input: z.string().optional(), percentile: z.number().optional(), @@ -1435,7 +1357,7 @@ export const marshalApproxPercentileFunctionSchema: z.ZodType = z accuracy: d.accuracy, })); -export const marshalAuthConfigSchema: z.ZodType = z +export const marshalAuthConfigSchema = z .object({ ucServiceCredentialName: z.string().optional(), }) @@ -1443,7 +1365,7 @@ export const marshalAuthConfigSchema: z.ZodType = z uc_service_credential_name: d.ucServiceCredentialName, })); -export const marshalAvgFunctionSchema: z.ZodType = z +export const marshalAvgFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1451,7 +1373,7 @@ export const marshalAvgFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalBackfillSourceSchema: z.ZodType = z +export const marshalBackfillSourceSchema = z .object({ deltaTableSource: z.lazy(() => marshalDeltaTableSourceSchema).optional(), }) @@ -1459,7 +1381,7 @@ export const marshalBackfillSourceSchema: z.ZodType = z delta_table_source: d.deltaTableSource, })); -export const marshalBatchCreateMaterializedFeaturesRequestSchema: z.ZodType = z +export const marshalBatchCreateMaterializedFeaturesRequestSchema = z .object({ requests: z .array(z.lazy(() => marshalCreateMaterializedFeatureRequestSchema)) @@ -1469,7 +1391,7 @@ export const marshalBatchCreateMaterializedFeaturesRequestSchema: z.ZodType = z requests: d.requests, })); -export const marshalBatchCreateMaterializedFeaturesResponseSchema: z.ZodType = z +export const marshalBatchCreateMaterializedFeaturesResponseSchema = z .object({ materializedFeatures: z .array(z.lazy(() => marshalMaterializedFeatureSchema)) @@ -1479,7 +1401,7 @@ export const marshalBatchCreateMaterializedFeaturesResponseSchema: z.ZodType = z materialized_features: d.materializedFeatures, })); -export const marshalColumnIdentifierSchema: z.ZodType = z +export const marshalColumnIdentifierSchema = z .object({ variantExprPath: z.string().optional(), }) @@ -1487,7 +1409,7 @@ export const marshalColumnIdentifierSchema: z.ZodType = z variant_expr_path: d.variantExprPath, })); -export const marshalColumnSelectionSchema: z.ZodType = z +export const marshalColumnSelectionSchema = z .object({ column: z.string().optional(), }) @@ -1495,7 +1417,7 @@ export const marshalColumnSelectionSchema: z.ZodType = z column: d.column, })); -export const marshalContinuousWindowSchema: z.ZodType = z +export const marshalContinuousWindowSchema = z .object({ windowDuration: z .any() @@ -1511,7 +1433,7 @@ export const marshalContinuousWindowSchema: z.ZodType = z offset: d.offset, })); -export const marshalCountFunctionSchema: z.ZodType = z +export const marshalCountFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1519,7 +1441,7 @@ export const marshalCountFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalCreateFeatureRequestSchema: z.ZodType = z +export const marshalCreateFeatureRequestSchema = z .object({ feature: z.lazy(() => marshalFeatureSchema).optional(), }) @@ -1527,7 +1449,7 @@ export const marshalCreateFeatureRequestSchema: z.ZodType = z feature: d.feature, })); -export const marshalCreateKafkaConfigRequestSchema: z.ZodType = z +export const marshalCreateKafkaConfigRequestSchema = z .object({ kafkaConfig: z.lazy(() => marshalKafkaConfigSchema).optional(), }) @@ -1535,7 +1457,7 @@ export const marshalCreateKafkaConfigRequestSchema: z.ZodType = z kafka_config: d.kafkaConfig, })); -export const marshalCreateMaterializedFeatureRequestSchema: z.ZodType = z +export const marshalCreateMaterializedFeatureRequestSchema = z .object({ materializedFeature: z .lazy(() => marshalMaterializedFeatureSchema) @@ -1545,19 +1467,17 @@ export const marshalCreateMaterializedFeatureRequestSchema: z.ZodType = z materialized_feature: d.materializedFeature, })); -export const marshalDataSourceSchema: z.ZodType = z +export const marshalDataSourceSchema = z .object({ deltaTableSource: z.lazy(() => marshalDeltaTableSourceSchema).optional(), kafkaSource: z.lazy(() => marshalKafkaSourceSchema).optional(), - requestSource: z.lazy(() => marshalRequestSourceSchema).optional(), }) .transform(d => ({ delta_table_source: d.deltaTableSource, kafka_source: d.kafkaSource, - request_source: d.requestSource, })); -export const marshalDeleteFeatureRequestSchema: z.ZodType = z +export const marshalDeleteFeatureRequestSchema = z .object({ fullName: z.string().optional(), }) @@ -1565,7 +1485,7 @@ export const marshalDeleteFeatureRequestSchema: z.ZodType = z full_name: d.fullName, })); -export const marshalDeleteKafkaConfigRequestSchema: z.ZodType = z +export const marshalDeleteKafkaConfigRequestSchema = z .object({ name: z.string().optional(), }) @@ -1573,7 +1493,7 @@ export const marshalDeleteKafkaConfigRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeleteMaterializedFeatureRequestSchema: z.ZodType = z +export const marshalDeleteMaterializedFeatureRequestSchema = z .object({ materializedFeatureId: z.string().optional(), }) @@ -1581,7 +1501,7 @@ export const marshalDeleteMaterializedFeatureRequestSchema: z.ZodType = z materialized_feature_id: d.materializedFeatureId, })); -export const marshalDeltaTableSourceSchema: z.ZodType = z +export const marshalDeltaTableSourceSchema = z .object({ fullName: z.string().optional(), entityColumns: z.array(z.string()).optional(), @@ -1599,7 +1519,7 @@ export const marshalDeltaTableSourceSchema: z.ZodType = z dataframe_schema: d.dataframeSchema, })); -export const marshalEntityColumnSchema: z.ZodType = z +export const marshalEntityColumnSchema = z .object({ name: z.string().optional(), }) @@ -1607,7 +1527,7 @@ export const marshalEntityColumnSchema: z.ZodType = z name: d.name, })); -export const marshalFeatureSchema: z.ZodType = z +export const marshalFeatureSchema = z .object({ fullName: z.string().optional(), source: z.lazy(() => marshalDataSourceSchema).optional(), @@ -1633,17 +1553,7 @@ export const marshalFeatureSchema: z.ZodType = z timeseries_column: d.timeseriesColumn, })); -export const marshalFieldDefinitionSchema: z.ZodType = z - .object({ - name: z.string().optional(), - dataType: z.enum(ScalarDataType).optional(), - }) - .transform(d => ({ - name: d.name, - data_type: d.dataType, - })); - -export const marshalFirstFunctionSchema: z.ZodType = z +export const marshalFirstFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1651,15 +1561,7 @@ export const marshalFirstFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalFlatSchemaSchema: z.ZodType = z - .object({ - fields: z.array(z.lazy(() => marshalFieldDefinitionSchema)).optional(), - }) - .transform(d => ({ - fields: d.fields, - })); - -export const marshalFunctionSchema: z.ZodType = z +export const marshalFunctionSchema = z .object({ functionType: z.enum(Function_FunctionType).optional(), extraParameters: z @@ -1678,7 +1580,7 @@ export const marshalFunctionSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalFunction_ExtraParameterSchema: z.ZodType = z +export const marshalFunction_ExtraParameterSchema = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -1688,7 +1590,7 @@ export const marshalFunction_ExtraParameterSchema: z.ZodType = z value: d.value, })); -export const marshalGetFeatureRequestSchema: z.ZodType = z +export const marshalGetFeatureRequestSchema = z .object({ fullName: z.string().optional(), }) @@ -1696,7 +1598,7 @@ export const marshalGetFeatureRequestSchema: z.ZodType = z full_name: d.fullName, })); -export const marshalGetKafkaConfigRequestSchema: z.ZodType = z +export const marshalGetKafkaConfigRequestSchema = z .object({ name: z.string().optional(), }) @@ -1704,7 +1606,7 @@ export const marshalGetKafkaConfigRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetMaterializedFeatureRequestSchema: z.ZodType = z +export const marshalGetMaterializedFeatureRequestSchema = z .object({ materializedFeatureId: z.string().optional(), }) @@ -1712,7 +1614,7 @@ export const marshalGetMaterializedFeatureRequestSchema: z.ZodType = z materialized_feature_id: d.materializedFeatureId, })); -export const marshalJobContextSchema: z.ZodType = z +export const marshalJobContextSchema = z .object({ jobId: z.number().optional(), jobRunId: z.number().optional(), @@ -1722,7 +1624,7 @@ export const marshalJobContextSchema: z.ZodType = z job_run_id: d.jobRunId, })); -export const marshalKafkaConfigSchema: z.ZodType = z +export const marshalKafkaConfigSchema = z .object({ name: z.string().optional(), bootstrapServers: z.string().optional(), @@ -1745,7 +1647,7 @@ export const marshalKafkaConfigSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalKafkaConfig_ExtraOptionsEntrySchema: z.ZodType = z +export const marshalKafkaConfig_ExtraOptionsEntrySchema = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -1755,7 +1657,7 @@ export const marshalKafkaConfig_ExtraOptionsEntrySchema: z.ZodType = z value: d.value, })); -export const marshalKafkaSourceSchema: z.ZodType = z +export const marshalKafkaSourceSchema = z .object({ name: z.string().optional(), entityColumnIdentifiers: z @@ -1773,7 +1675,7 @@ export const marshalKafkaSourceSchema: z.ZodType = z filter_condition: d.filterCondition, })); -export const marshalLastFunctionSchema: z.ZodType = z +export const marshalLastFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1781,7 +1683,7 @@ export const marshalLastFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalLineageContextSchema: z.ZodType = z +export const marshalLineageContextSchema = z .object({ notebookId: z.number().optional(), jobContext: z.lazy(() => marshalJobContextSchema).optional(), @@ -1791,7 +1693,7 @@ export const marshalLineageContextSchema: z.ZodType = z job_context: d.jobContext, })); -export const marshalListFeaturesRequestSchema: z.ZodType = z +export const marshalListFeaturesRequestSchema = z .object({ pageToken: z.string().optional(), pageSize: z.number().optional(), @@ -1801,7 +1703,7 @@ export const marshalListFeaturesRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListFeaturesResponseSchema: z.ZodType = z +export const marshalListFeaturesResponseSchema = z .object({ features: z.array(z.lazy(() => marshalFeatureSchema)).optional(), nextPageToken: z.string().optional(), @@ -1811,7 +1713,7 @@ export const marshalListFeaturesResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListKafkaConfigsRequestSchema: z.ZodType = z +export const marshalListKafkaConfigsRequestSchema = z .object({ pageToken: z.string().optional(), pageSize: z.number().optional(), @@ -1821,7 +1723,7 @@ export const marshalListKafkaConfigsRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListKafkaConfigsResponseSchema: z.ZodType = z +export const marshalListKafkaConfigsResponseSchema = z .object({ kafkaConfigs: z.array(z.lazy(() => marshalKafkaConfigSchema)).optional(), nextPageToken: z.string().optional(), @@ -1831,7 +1733,7 @@ export const marshalListKafkaConfigsResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListMaterializedFeaturesRequestSchema: z.ZodType = z +export const marshalListMaterializedFeaturesRequestSchema = z .object({ featureName: z.string().optional(), pageToken: z.string().optional(), @@ -1843,7 +1745,7 @@ export const marshalListMaterializedFeaturesRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListMaterializedFeaturesResponseSchema: z.ZodType = z +export const marshalListMaterializedFeaturesResponseSchema = z .object({ materializedFeatures: z .array(z.lazy(() => marshalMaterializedFeatureSchema)) @@ -1855,7 +1757,7 @@ export const marshalListMaterializedFeaturesResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalMaterializedFeatureSchema: z.ZodType = z +export const marshalMaterializedFeatureSchema = z .object({ materializedFeatureId: z.string().optional(), featureName: z.string().optional(), @@ -1884,7 +1786,7 @@ export const marshalMaterializedFeatureSchema: z.ZodType = z cron_schedule: d.cronSchedule, })); -export const marshalMaxFunctionSchema: z.ZodType = z +export const marshalMaxFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1892,7 +1794,7 @@ export const marshalMaxFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalMinFunctionSchema: z.ZodType = z +export const marshalMinFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1900,7 +1802,7 @@ export const marshalMinFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalOfflineStoreConfigSchema: z.ZodType = z +export const marshalOfflineStoreConfigSchema = z .object({ catalogName: z.string().optional(), schemaName: z.string().optional(), @@ -1912,7 +1814,7 @@ export const marshalOfflineStoreConfigSchema: z.ZodType = z table_name_prefix: d.tableNamePrefix, })); -export const marshalOnlineStoreConfigSchema: z.ZodType = z +export const marshalOnlineStoreConfigSchema = z .object({ catalogName: z.string().optional(), schemaName: z.string().optional(), @@ -1926,15 +1828,7 @@ export const marshalOnlineStoreConfigSchema: z.ZodType = z online_store_name: d.onlineStoreName, })); -export const marshalRequestSourceSchema: z.ZodType = z - .object({ - flatSchema: z.lazy(() => marshalFlatSchemaSchema).optional(), - }) - .transform(d => ({ - flat_schema: d.flatSchema, - })); - -export const marshalSchemaConfigSchema: z.ZodType = z +export const marshalSchemaConfigSchema = z .object({ jsonSchema: z.string().optional(), }) @@ -1942,7 +1836,7 @@ export const marshalSchemaConfigSchema: z.ZodType = z json_schema: d.jsonSchema, })); -export const marshalSlidingWindowSchema: z.ZodType = z +export const marshalSlidingWindowSchema = z .object({ windowDuration: z .any() @@ -1958,7 +1852,7 @@ export const marshalSlidingWindowSchema: z.ZodType = z slide_duration: d.slideDuration, })); -export const marshalStddevPopFunctionSchema: z.ZodType = z +export const marshalStddevPopFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1966,7 +1860,7 @@ export const marshalStddevPopFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalStddevSampFunctionSchema: z.ZodType = z +export const marshalStddevSampFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1974,7 +1868,7 @@ export const marshalStddevSampFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalSubscriptionModeSchema: z.ZodType = z +export const marshalSubscriptionModeSchema = z .object({ assign: z.string().optional(), subscribe: z.string().optional(), @@ -1986,7 +1880,7 @@ export const marshalSubscriptionModeSchema: z.ZodType = z subscribe_pattern: d.subscribePattern, })); -export const marshalSumFunctionSchema: z.ZodType = z +export const marshalSumFunctionSchema = z .object({ input: z.string().optional(), }) @@ -1994,7 +1888,7 @@ export const marshalSumFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalTimeWindowSchema: z.ZodType = z +export const marshalTimeWindowSchema = z .object({ continuous: z.lazy(() => marshalContinuousWindowSchema).optional(), tumbling: z.lazy(() => marshalTumblingWindowSchema).optional(), @@ -2006,7 +1900,7 @@ export const marshalTimeWindowSchema: z.ZodType = z sliding: d.sliding, })); -export const marshalTimeseriesColumnSchema: z.ZodType = z +export const marshalTimeseriesColumnSchema = z .object({ name: z.string().optional(), }) @@ -2014,7 +1908,7 @@ export const marshalTimeseriesColumnSchema: z.ZodType = z name: d.name, })); -export const marshalTumblingWindowSchema: z.ZodType = z +export const marshalTumblingWindowSchema = z .object({ windowDuration: z .any() @@ -2025,7 +1919,7 @@ export const marshalTumblingWindowSchema: z.ZodType = z window_duration: d.windowDuration, })); -export const marshalUpdateFeatureRequestSchema: z.ZodType = z +export const marshalUpdateFeatureRequestSchema = z .object({ feature: z.lazy(() => marshalFeatureSchema).optional(), updateMask: z.string().optional(), @@ -2035,7 +1929,7 @@ export const marshalUpdateFeatureRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalUpdateKafkaConfigRequestSchema: z.ZodType = z +export const marshalUpdateKafkaConfigRequestSchema = z .object({ kafkaConfig: z.lazy(() => marshalKafkaConfigSchema).optional(), updateMask: z.string().optional(), @@ -2045,7 +1939,7 @@ export const marshalUpdateKafkaConfigRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalUpdateMaterializedFeatureRequestSchema: z.ZodType = z +export const marshalUpdateMaterializedFeatureRequestSchema = z .object({ materializedFeature: z .lazy(() => marshalMaterializedFeatureSchema) @@ -2057,7 +1951,7 @@ export const marshalUpdateMaterializedFeatureRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalVarPopFunctionSchema: z.ZodType = z +export const marshalVarPopFunctionSchema = z .object({ input: z.string().optional(), }) @@ -2065,7 +1959,7 @@ export const marshalVarPopFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalVarSampFunctionSchema: z.ZodType = z +export const marshalVarSampFunctionSchema = z .object({ input: z.string().optional(), }) diff --git a/packages/oauthcustomappintegration/src/v1/model.ts b/packages/oauthcustomappintegration/src/v1/model.ts index 8896912a..2132cede 100644 --- a/packages/oauthcustomappintegration/src/v1/model.ts +++ b/packages/oauthcustomappintegration/src/v1/model.ts @@ -503,7 +503,7 @@ export const unmarshalUpdatePublishedOAuthAppIntegrationSchema: z.ZodType = z.object({}); -export const marshalCreateCustomOAuthAppIntegrationSchema: z.ZodType = z +export const marshalCreateCustomOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), redirectUrls: z.array(z.string()).optional(), @@ -523,7 +523,7 @@ export const marshalCreateCustomOAuthAppIntegrationSchema: z.ZodType = z user_authorized_scopes: d.userAuthorizedScopes, })); -export const marshalCreatePublishedOAuthAppIntegrationSchema: z.ZodType = z +export const marshalCreatePublishedOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), appId: z.string().optional(), @@ -536,16 +536,15 @@ export const marshalCreatePublishedOAuthAppIntegrationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalCreatePublishedOAuthAppIntegration_ResponseSchema: z.ZodType = - z - .object({ - integrationId: z.string().optional(), - }) - .transform(d => ({ - integration_id: d.integrationId, - })); +export const marshalCreatePublishedOAuthAppIntegration_ResponseSchema = z + .object({ + integrationId: z.string().optional(), + }) + .transform(d => ({ + integration_id: d.integrationId, + })); -export const marshalCustomOAuthAppIntegrationSchema: z.ZodType = z +export const marshalCustomOAuthAppIntegrationSchema = z .object({ integrationId: z.string().optional(), clientId: z.string().optional(), @@ -575,7 +574,7 @@ export const marshalCustomOAuthAppIntegrationSchema: z.ZodType = z principal_id: d.principalId, })); -export const marshalCustomOAuthAppIntegrationSecretSchema: z.ZodType = z +export const marshalCustomOAuthAppIntegrationSecretSchema = z .object({ integrationId: z.string().optional(), clientId: z.string().optional(), @@ -594,7 +593,7 @@ export const marshalCustomOAuthAppIntegrationSecretSchema: z.ZodType = z client_secret_expire_time: d.clientSecretExpireTime, })); -export const marshalDeleteCustomOAuthAppIntegrationSchema: z.ZodType = z +export const marshalDeleteCustomOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -605,10 +604,11 @@ export const marshalDeleteCustomOAuthAppIntegrationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDeleteCustomOAuthAppIntegration_ResponseSchema: z.ZodType = - z.object({}); +export const marshalDeleteCustomOAuthAppIntegration_ResponseSchema = z.object( + {} +); -export const marshalDeletePublishedOAuthAppIntegrationSchema: z.ZodType = z +export const marshalDeletePublishedOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -619,10 +619,10 @@ export const marshalDeletePublishedOAuthAppIntegrationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDeletePublishedOAuthAppIntegration_ResponseSchema: z.ZodType = +export const marshalDeletePublishedOAuthAppIntegration_ResponseSchema = z.object({}); -export const marshalGetCustomOAuthAppIntegrationSchema: z.ZodType = z +export const marshalGetCustomOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -632,7 +632,7 @@ export const marshalGetCustomOAuthAppIntegrationSchema: z.ZodType = z integration_id: d.integrationId, })); -export const marshalGetPublishedOAuthAppIntegrationSchema: z.ZodType = z +export const marshalGetPublishedOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -642,7 +642,7 @@ export const marshalGetPublishedOAuthAppIntegrationSchema: z.ZodType = z integration_id: d.integrationId, })); -export const marshalListCustomOAuthAppIntegrationsSchema: z.ZodType = z +export const marshalListCustomOAuthAppIntegrationsSchema = z .object({ accountId: z.string().optional(), pageToken: z.string().optional(), @@ -657,7 +657,7 @@ export const marshalListCustomOAuthAppIntegrationsSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalListCustomOAuthAppIntegrations_ResponseSchema: z.ZodType = z +export const marshalListCustomOAuthAppIntegrations_ResponseSchema = z .object({ apps: z .array(z.lazy(() => marshalCustomOAuthAppIntegrationSchema)) @@ -669,7 +669,7 @@ export const marshalListCustomOAuthAppIntegrations_ResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListPublishedOAuthAppIntegrationsSchema: z.ZodType = z +export const marshalListPublishedOAuthAppIntegrationsSchema = z .object({ accountId: z.string().optional(), pageToken: z.string().optional(), @@ -682,20 +682,19 @@ export const marshalListPublishedOAuthAppIntegrationsSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalListPublishedOAuthAppIntegrations_ResponseSchema: z.ZodType = - z - .object({ - apps: z - .array(z.lazy(() => marshalPublishedOAuthAppIntegrationSchema)) - .optional(), - nextPageToken: z.string().optional(), - }) - .transform(d => ({ - apps: d.apps, - next_page_token: d.nextPageToken, - })); +export const marshalListPublishedOAuthAppIntegrations_ResponseSchema = z + .object({ + apps: z + .array(z.lazy(() => marshalPublishedOAuthAppIntegrationSchema)) + .optional(), + nextPageToken: z.string().optional(), + }) + .transform(d => ({ + apps: d.apps, + next_page_token: d.nextPageToken, + })); -export const marshalPublishedOAuthAppIntegrationSchema: z.ZodType = z +export const marshalPublishedOAuthAppIntegrationSchema = z .object({ appId: z.string().optional(), integrationId: z.string().optional(), @@ -713,7 +712,7 @@ export const marshalPublishedOAuthAppIntegrationSchema: z.ZodType = z create_time: d.createTime, })); -export const marshalTokenAccessPolicySchema: z.ZodType = z +export const marshalTokenAccessPolicySchema = z .object({ accessTokenTtlInMinutes: z.number().optional(), refreshTokenTtlInMinutes: z.number().optional(), @@ -727,7 +726,7 @@ export const marshalTokenAccessPolicySchema: z.ZodType = z absolute_session_lifetime_in_minutes: d.absoluteSessionLifetimeInMinutes, })); -export const marshalUpdateCustomOAuthAppIntegrationSchema: z.ZodType = z +export const marshalUpdateCustomOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -746,10 +745,11 @@ export const marshalUpdateCustomOAuthAppIntegrationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalUpdateCustomOAuthAppIntegration_ResponseSchema: z.ZodType = - z.object({}); +export const marshalUpdateCustomOAuthAppIntegration_ResponseSchema = z.object( + {} +); -export const marshalUpdatePublishedOAuthAppIntegrationSchema: z.ZodType = z +export const marshalUpdatePublishedOAuthAppIntegrationSchema = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -762,5 +762,5 @@ export const marshalUpdatePublishedOAuthAppIntegrationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalUpdatePublishedOAuthAppIntegration_ResponseSchema: z.ZodType = +export const marshalUpdatePublishedOAuthAppIntegration_ResponseSchema = z.object({}); diff --git a/packages/postgres/src/v1/model.ts b/packages/postgres/src/v1/model.ts index 5a79cae6..3a2083fc 100644 --- a/packages/postgres/src/v1/model.ts +++ b/packages/postgres/src/v1/model.ts @@ -1685,12 +1685,6 @@ export interface ListProjectsRequest { pageToken?: string | undefined; /** Upper bound for items returned. Cannot be negative. The maximum value is 100. */ pageSize?: number | undefined; - /** - * Whether to include soft-deleted projects in the response. - * When true, soft-deleted projects are included alongside active projects. - * Hard-deleted and already-purged projects are never returned. - */ - showDeleted?: boolean | undefined; } export interface ListProjectsResponse { @@ -1786,16 +1780,6 @@ export interface Project { * spec.default_endpoint_settings to configure default settings for endpoints created after project creation. */ initialEndpointSpec?: InitialEndpointSpec | undefined; - /** - * A timestamp indicating when the project was soft-deleted. - * Empty if the project is not deleted, otherwise set to a timestamp in the past. - */ - deleteTime?: Temporal.Instant | undefined; - /** - * A timestamp indicating when the project is scheduled for permanent deletion. - * Empty if the project is not deleted, otherwise set to a timestamp in the future. - */ - purgeTime?: Temporal.Instant | undefined; } export interface ProjectCustomTag { @@ -3219,12 +3203,10 @@ export const unmarshalListProjectsRequestSchema: z.ZodType .object({ page_token: z.string().optional(), page_size: z.number().optional(), - show_deleted: z.boolean().optional(), }) .transform(d => ({ pageToken: d.page_token, pageSize: d.page_size, - showDeleted: d.show_deleted, })); export const unmarshalListProjectsResponseSchema: z.ZodType = @@ -3307,14 +3289,6 @@ export const unmarshalProjectSchema: z.ZodType = z initial_endpoint_spec: z .lazy(() => unmarshalInitialEndpointSpecSchema) .optional(), - delete_time: z - .string() - .transform(s => Temporal.Instant.from(s)) - .optional(), - purge_time: z - .string() - .transform(s => Temporal.Instant.from(s)) - .optional(), }) .transform(d => ({ name: d.name, @@ -3324,8 +3298,6 @@ export const unmarshalProjectSchema: z.ZodType = z spec: d.spec, status: d.status, initialEndpointSpec: d.initial_endpoint_spec, - deleteTime: d.delete_time, - purgeTime: d.purge_time, })); export const unmarshalProjectCustomTagSchema: z.ZodType = z @@ -3746,7 +3718,7 @@ export const unmarshalUpdateRoleRequestSchema: z.ZodType = z updateMask: d.update_mask, })); -export const marshalBranchSchema: z.ZodType = z +export const marshalBranchSchema = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -3772,9 +3744,9 @@ export const marshalBranchSchema: z.ZodType = z status: d.status, })); -export const marshalBranchOperationMetadataSchema: z.ZodType = z.object({}); +export const marshalBranchOperationMetadataSchema = z.object({}); -export const marshalBranchSpecSchema: z.ZodType = z +export const marshalBranchSpecSchema = z .object({ sourceBranch: z.string().optional(), sourceBranchLsn: z.string().optional(), @@ -3803,7 +3775,7 @@ export const marshalBranchSpecSchema: z.ZodType = z no_expiry: d.noExpiry, })); -export const marshalBranchStatusSchema: z.ZodType = z +export const marshalBranchStatusSchema = z .object({ sourceBranch: z.string().optional(), sourceBranchLsn: z.string().optional(), @@ -3840,7 +3812,7 @@ export const marshalBranchStatusSchema: z.ZodType = z branch_id: d.branchId, })); -export const marshalCatalogSchema: z.ZodType = z +export const marshalCatalogSchema = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -3865,7 +3837,7 @@ export const marshalCatalogSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalCatalog_CatalogSpecSchema: z.ZodType = z +export const marshalCatalog_CatalogSpecSchema = z .object({ postgresDatabase: z.string().optional(), createDatabaseIfMissing: z.boolean().optional(), @@ -3878,7 +3850,7 @@ export const marshalCatalog_CatalogSpecSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalCatalog_CatalogStatusSchema: z.ZodType = z +export const marshalCatalog_CatalogStatusSchema = z .object({ postgresDatabase: z.string().optional(), project: z.string().optional(), @@ -3892,9 +3864,9 @@ export const marshalCatalog_CatalogStatusSchema: z.ZodType = z catalog_id: d.catalogId, })); -export const marshalCatalogOperationMetadataSchema: z.ZodType = z.object({}); +export const marshalCatalogOperationMetadataSchema = z.object({}); -export const marshalComputeInstanceSchema: z.ZodType = z +export const marshalComputeInstanceSchema = z .object({ name: z.string().optional(), computeInstanceId: z.string().optional(), @@ -3922,7 +3894,7 @@ export const marshalComputeInstanceSchema: z.ZodType = z suspend_time: d.suspendTime, })); -export const marshalCreateBranchRequestSchema: z.ZodType = z +export const marshalCreateBranchRequestSchema = z .object({ parent: z.string().optional(), branchId: z.string().optional(), @@ -3934,7 +3906,7 @@ export const marshalCreateBranchRequestSchema: z.ZodType = z branch: d.branch, })); -export const marshalCreateCatalogRequestSchema: z.ZodType = z +export const marshalCreateCatalogRequestSchema = z .object({ catalogId: z.string().optional(), catalog: z.lazy(() => marshalCatalogSchema).optional(), @@ -3944,7 +3916,7 @@ export const marshalCreateCatalogRequestSchema: z.ZodType = z catalog: d.catalog, })); -export const marshalCreateDatabaseRequestSchema: z.ZodType = z +export const marshalCreateDatabaseRequestSchema = z .object({ parent: z.string().optional(), databaseId: z.string().optional(), @@ -3956,7 +3928,7 @@ export const marshalCreateDatabaseRequestSchema: z.ZodType = z database: d.database, })); -export const marshalCreateEndpointRequestSchema: z.ZodType = z +export const marshalCreateEndpointRequestSchema = z .object({ parent: z.string().optional(), endpointId: z.string().optional(), @@ -3968,7 +3940,7 @@ export const marshalCreateEndpointRequestSchema: z.ZodType = z endpoint: d.endpoint, })); -export const marshalCreateProjectRequestSchema: z.ZodType = z +export const marshalCreateProjectRequestSchema = z .object({ projectId: z.string().optional(), project: z.lazy(() => marshalProjectSchema).optional(), @@ -3978,7 +3950,7 @@ export const marshalCreateProjectRequestSchema: z.ZodType = z project: d.project, })); -export const marshalCreateRoleRequestSchema: z.ZodType = z +export const marshalCreateRoleRequestSchema = z .object({ parent: z.string().optional(), roleId: z.string().optional(), @@ -3990,7 +3962,7 @@ export const marshalCreateRoleRequestSchema: z.ZodType = z role: d.role, })); -export const marshalCreateSyncedTableRequestSchema: z.ZodType = z +export const marshalCreateSyncedTableRequestSchema = z .object({ syncedTableId: z.string().optional(), syncedTable: z.lazy(() => marshalSyncedTableSchema).optional(), @@ -4000,7 +3972,7 @@ export const marshalCreateSyncedTableRequestSchema: z.ZodType = z synced_table: d.syncedTable, })); -export const marshalCreateTableRequestSchema: z.ZodType = z +export const marshalCreateTableRequestSchema = z .object({ table: z.lazy(() => marshalTableSchema).optional(), }) @@ -4008,7 +3980,7 @@ export const marshalCreateTableRequestSchema: z.ZodType = z table: d.table, })); -export const marshalDatabaseSchema: z.ZodType = z +export const marshalDatabaseSchema = z .object({ name: z.string().optional(), parent: z.string().optional(), @@ -4033,7 +4005,7 @@ export const marshalDatabaseSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDatabase_DatabaseSpecSchema: z.ZodType = z +export const marshalDatabase_DatabaseSpecSchema = z .object({ role: z.string().optional(), postgresDatabase: z.string().optional(), @@ -4044,7 +4016,7 @@ export const marshalDatabase_DatabaseSpecSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDatabase_DatabaseStatusSchema: z.ZodType = z +export const marshalDatabase_DatabaseStatusSchema = z .object({ role: z.string().optional(), postgresDatabase: z.string().optional(), @@ -4056,7 +4028,7 @@ export const marshalDatabase_DatabaseStatusSchema: z.ZodType = z database_id: d.databaseId, })); -export const marshalDatabaseCredentialSchema: z.ZodType = z +export const marshalDatabaseCredentialSchema = z .object({ token: z.string().optional(), expireTime: z @@ -4069,24 +4041,23 @@ export const marshalDatabaseCredentialSchema: z.ZodType = z expire_time: d.expireTime, })); -export const marshalDatabaseOperationMetadataSchema: z.ZodType = z.object({}); +export const marshalDatabaseOperationMetadataSchema = z.object({}); -export const marshalDatabricksServiceExceptionWithDetailsProtoSchema: z.ZodType = - z - .object({ - errorCode: z.enum(ErrorCode).optional(), - message: z.string().optional(), - stackTrace: z.string().optional(), - details: z.array(z.record(z.string(), z.unknown())).optional(), - }) - .transform(d => ({ - error_code: d.errorCode, - message: d.message, - stack_trace: d.stackTrace, - details: d.details, - })); +export const marshalDatabricksServiceExceptionWithDetailsProtoSchema = z + .object({ + errorCode: z.enum(ErrorCode).optional(), + message: z.string().optional(), + stackTrace: z.string().optional(), + details: z.array(z.record(z.string(), z.unknown())).optional(), + }) + .transform(d => ({ + error_code: d.errorCode, + message: d.message, + stack_trace: d.stackTrace, + details: d.details, + })); -export const marshalDeleteBranchRequestSchema: z.ZodType = z +export const marshalDeleteBranchRequestSchema = z .object({ name: z.string().optional(), purge: z.boolean().optional(), @@ -4096,7 +4067,7 @@ export const marshalDeleteBranchRequestSchema: z.ZodType = z purge: d.purge, })); -export const marshalDeleteCatalogRequestSchema: z.ZodType = z +export const marshalDeleteCatalogRequestSchema = z .object({ name: z.string().optional(), }) @@ -4104,7 +4075,7 @@ export const marshalDeleteCatalogRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeleteDatabaseRequestSchema: z.ZodType = z +export const marshalDeleteDatabaseRequestSchema = z .object({ name: z.string().optional(), }) @@ -4112,7 +4083,7 @@ export const marshalDeleteDatabaseRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeleteEndpointRequestSchema: z.ZodType = z +export const marshalDeleteEndpointRequestSchema = z .object({ name: z.string().optional(), }) @@ -4120,7 +4091,7 @@ export const marshalDeleteEndpointRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeleteProjectRequestSchema: z.ZodType = z +export const marshalDeleteProjectRequestSchema = z .object({ name: z.string().optional(), }) @@ -4128,7 +4099,7 @@ export const marshalDeleteProjectRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeleteRoleRequestSchema: z.ZodType = z +export const marshalDeleteRoleRequestSchema = z .object({ name: z.string().optional(), reassignOwnedTo: z.string().optional(), @@ -4138,7 +4109,7 @@ export const marshalDeleteRoleRequestSchema: z.ZodType = z reassign_owned_to: d.reassignOwnedTo, })); -export const marshalDeleteSyncedTableRequestSchema: z.ZodType = z +export const marshalDeleteSyncedTableRequestSchema = z .object({ name: z.string().optional(), }) @@ -4146,7 +4117,7 @@ export const marshalDeleteSyncedTableRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeleteTableRequestSchema: z.ZodType = z +export const marshalDeleteTableRequestSchema = z .object({ name: z.string().optional(), }) @@ -4154,7 +4125,7 @@ export const marshalDeleteTableRequestSchema: z.ZodType = z name: d.name, })); -export const marshalDeltaTableSyncInfoSchema: z.ZodType = z +export const marshalDeltaTableSyncInfoSchema = z .object({ deltaCommitVersion: z.number().optional(), deltaCommitTime: z @@ -4167,7 +4138,7 @@ export const marshalDeltaTableSyncInfoSchema: z.ZodType = z delta_commit_time: d.deltaCommitTime, })); -export const marshalDisableForwardEtlRequestSchema: z.ZodType = z +export const marshalDisableForwardEtlRequestSchema = z .object({ parent: z.string().optional(), tenantId: z.string().optional(), @@ -4183,7 +4154,7 @@ export const marshalDisableForwardEtlRequestSchema: z.ZodType = z pg_schema_oid: d.pgSchemaOid, })); -export const marshalDisableForwardEtlResponseSchema: z.ZodType = z +export const marshalDisableForwardEtlResponseSchema = z .object({ disabled: z.boolean().optional(), }) @@ -4191,7 +4162,7 @@ export const marshalDisableForwardEtlResponseSchema: z.ZodType = z disabled: d.disabled, })); -export const marshalEndpointSchema: z.ZodType = z +export const marshalEndpointSchema = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -4217,7 +4188,7 @@ export const marshalEndpointSchema: z.ZodType = z status: d.status, })); -export const marshalEndpointGroupSpecSchema: z.ZodType = z +export const marshalEndpointGroupSpecSchema = z .object({ min: z.number().optional(), max: z.number().optional(), @@ -4229,7 +4200,7 @@ export const marshalEndpointGroupSpecSchema: z.ZodType = z enable_readable_secondaries: d.enableReadableSecondaries, })); -export const marshalEndpointGroupStatusSchema: z.ZodType = z +export const marshalEndpointGroupStatusSchema = z .object({ min: z.number().optional(), max: z.number().optional(), @@ -4241,7 +4212,7 @@ export const marshalEndpointGroupStatusSchema: z.ZodType = z enable_readable_secondaries: d.enableReadableSecondaries, })); -export const marshalEndpointHostsSchema: z.ZodType = z +export const marshalEndpointHostsSchema = z .object({ host: z.string().optional(), readOnlyHost: z.string().optional(), @@ -4255,9 +4226,9 @@ export const marshalEndpointHostsSchema: z.ZodType = z read_only_pooled_host: d.readOnlyPooledHost, })); -export const marshalEndpointOperationMetadataSchema: z.ZodType = z.object({}); +export const marshalEndpointOperationMetadataSchema = z.object({}); -export const marshalEndpointSettingsSchema: z.ZodType = z +export const marshalEndpointSettingsSchema = z .object({ pgSettings: z.record(z.string(), z.string()).optional(), }) @@ -4266,7 +4237,7 @@ export const marshalEndpointSettingsSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalEndpointSettings_PgSettingsEntrySchema: z.ZodType = z +export const marshalEndpointSettings_PgSettingsEntrySchema = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -4276,7 +4247,7 @@ export const marshalEndpointSettings_PgSettingsEntrySchema: z.ZodType = z value: d.value, })); -export const marshalEndpointSpecSchema: z.ZodType = z +export const marshalEndpointSpecSchema = z .object({ endpointType: z.enum(EndpointType).optional(), autoscalingLimitMinCu: z.number().optional(), @@ -4301,7 +4272,7 @@ export const marshalEndpointSpecSchema: z.ZodType = z group: d.group, })); -export const marshalEndpointStatusSchema: z.ZodType = z +export const marshalEndpointStatusSchema = z .object({ endpointType: z.enum(EndpointType).optional(), hosts: z.lazy(() => marshalEndpointHostsSchema).optional(), @@ -4337,7 +4308,7 @@ export const marshalEndpointStatusSchema: z.ZodType = z endpoint_id: d.endpointId, })); -export const marshalForwardEtlConfigSchema: z.ZodType = z +export const marshalForwardEtlConfigSchema = z .object({ workspaceId: z.number().optional(), tenantId: z.string().optional(), @@ -4363,7 +4334,7 @@ export const marshalForwardEtlConfigSchema: z.ZodType = z update_time_millis: d.updateTimeMillis, })); -export const marshalForwardEtlDatabaseSchema: z.ZodType = z +export const marshalForwardEtlDatabaseSchema = z .object({ name: z.string().optional(), oid: z.number().optional(), @@ -4373,7 +4344,7 @@ export const marshalForwardEtlDatabaseSchema: z.ZodType = z oid: d.oid, })); -export const marshalForwardEtlMetadataSchema: z.ZodType = z +export const marshalForwardEtlMetadataSchema = z .object({ databases: z .array(z.lazy(() => marshalForwardEtlDatabaseSchema)) @@ -4385,7 +4356,7 @@ export const marshalForwardEtlMetadataSchema: z.ZodType = z schemas: d.schemas, })); -export const marshalForwardEtlSchemaSchema: z.ZodType = z +export const marshalForwardEtlSchemaSchema = z .object({ name: z.string().optional(), oid: z.number().optional(), @@ -4395,7 +4366,7 @@ export const marshalForwardEtlSchemaSchema: z.ZodType = z oid: d.oid, })); -export const marshalForwardEtlStatusSchema: z.ZodType = z +export const marshalForwardEtlStatusSchema = z .object({ configurations: z .array(z.lazy(() => marshalForwardEtlConfigSchema)) @@ -4409,7 +4380,7 @@ export const marshalForwardEtlStatusSchema: z.ZodType = z table_mappings: d.tableMappings, })); -export const marshalForwardEtlTableMappingSchema: z.ZodType = z +export const marshalForwardEtlTableMappingSchema = z .object({ pgTableOid: z.number().optional(), ucTableId: z.string().optional(), @@ -4427,7 +4398,7 @@ export const marshalForwardEtlTableMappingSchema: z.ZodType = z enabled: d.enabled, })); -export const marshalGenerateDatabaseCredentialRequestSchema: z.ZodType = z +export const marshalGenerateDatabaseCredentialRequestSchema = z .object({ claims: z.array(z.lazy(() => marshalRequestedClaimsSchema)).optional(), endpoint: z.string().optional(), @@ -4449,7 +4420,7 @@ export const marshalGenerateDatabaseCredentialRequestSchema: z.ZodType = z expire_time: d.expireTime, })); -export const marshalGetBranchRequestSchema: z.ZodType = z +export const marshalGetBranchRequestSchema = z .object({ name: z.string().optional(), }) @@ -4457,7 +4428,7 @@ export const marshalGetBranchRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetCatalogRequestSchema: z.ZodType = z +export const marshalGetCatalogRequestSchema = z .object({ name: z.string().optional(), }) @@ -4465,7 +4436,7 @@ export const marshalGetCatalogRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetComputeInstanceRequestSchema: z.ZodType = z +export const marshalGetComputeInstanceRequestSchema = z .object({ name: z.string().optional(), }) @@ -4473,7 +4444,7 @@ export const marshalGetComputeInstanceRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetDatabaseRequestSchema: z.ZodType = z +export const marshalGetDatabaseRequestSchema = z .object({ name: z.string().optional(), }) @@ -4481,7 +4452,7 @@ export const marshalGetDatabaseRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetEndpointRequestSchema: z.ZodType = z +export const marshalGetEndpointRequestSchema = z .object({ name: z.string().optional(), }) @@ -4489,7 +4460,7 @@ export const marshalGetEndpointRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetForwardEtlMetadataRequestSchema: z.ZodType = z +export const marshalGetForwardEtlMetadataRequestSchema = z .object({ parent: z.string().optional(), tenantId: z.string().optional(), @@ -4501,7 +4472,7 @@ export const marshalGetForwardEtlMetadataRequestSchema: z.ZodType = z timeline_id: d.timelineId, })); -export const marshalGetForwardEtlStatusRequestSchema: z.ZodType = z +export const marshalGetForwardEtlStatusRequestSchema = z .object({ parent: z.string().optional(), tenantId: z.string().optional(), @@ -4513,7 +4484,7 @@ export const marshalGetForwardEtlStatusRequestSchema: z.ZodType = z timeline_id: d.timelineId, })); -export const marshalGetOperationRequestSchema: z.ZodType = z +export const marshalGetOperationRequestSchema = z .object({ name: z.string().optional(), }) @@ -4521,7 +4492,7 @@ export const marshalGetOperationRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetProjectRequestSchema: z.ZodType = z +export const marshalGetProjectRequestSchema = z .object({ name: z.string().optional(), }) @@ -4529,7 +4500,7 @@ export const marshalGetProjectRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetRoleRequestSchema: z.ZodType = z +export const marshalGetRoleRequestSchema = z .object({ name: z.string().optional(), }) @@ -4537,7 +4508,7 @@ export const marshalGetRoleRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetSyncedTableRequestSchema: z.ZodType = z +export const marshalGetSyncedTableRequestSchema = z .object({ name: z.string().optional(), }) @@ -4545,7 +4516,7 @@ export const marshalGetSyncedTableRequestSchema: z.ZodType = z name: d.name, })); -export const marshalGetTableRequestSchema: z.ZodType = z +export const marshalGetTableRequestSchema = z .object({ name: z.string().optional(), }) @@ -4553,7 +4524,7 @@ export const marshalGetTableRequestSchema: z.ZodType = z name: d.name, })); -export const marshalInitialEndpointSpecSchema: z.ZodType = z +export const marshalInitialEndpointSpecSchema = z .object({ group: z.lazy(() => marshalEndpointGroupSpecSchema).optional(), }) @@ -4561,7 +4532,7 @@ export const marshalInitialEndpointSpecSchema: z.ZodType = z group: d.group, })); -export const marshalListBranchesRequestSchema: z.ZodType = z +export const marshalListBranchesRequestSchema = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4573,7 +4544,7 @@ export const marshalListBranchesRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListBranchesResponseSchema: z.ZodType = z +export const marshalListBranchesResponseSchema = z .object({ branches: z.array(z.lazy(() => marshalBranchSchema)).optional(), nextPageToken: z.string().optional(), @@ -4583,7 +4554,7 @@ export const marshalListBranchesResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListComputeInstancesRequestSchema: z.ZodType = z +export const marshalListComputeInstancesRequestSchema = z .object({ parent: z.string().optional(), pageSize: z.number().optional(), @@ -4595,7 +4566,7 @@ export const marshalListComputeInstancesRequestSchema: z.ZodType = z page_token: d.pageToken, })); -export const marshalListComputeInstancesResponseSchema: z.ZodType = z +export const marshalListComputeInstancesResponseSchema = z .object({ computeInstances: z .array(z.lazy(() => marshalComputeInstanceSchema)) @@ -4607,7 +4578,7 @@ export const marshalListComputeInstancesResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListDatabasesRequestSchema: z.ZodType = z +export const marshalListDatabasesRequestSchema = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4619,7 +4590,7 @@ export const marshalListDatabasesRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListDatabasesResponseSchema: z.ZodType = z +export const marshalListDatabasesResponseSchema = z .object({ databases: z.array(z.lazy(() => marshalDatabaseSchema)).optional(), nextPageToken: z.string().optional(), @@ -4629,7 +4600,7 @@ export const marshalListDatabasesResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListEndpointsRequestSchema: z.ZodType = z +export const marshalListEndpointsRequestSchema = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4641,7 +4612,7 @@ export const marshalListEndpointsRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListEndpointsResponseSchema: z.ZodType = z +export const marshalListEndpointsResponseSchema = z .object({ endpoints: z.array(z.lazy(() => marshalEndpointSchema)).optional(), nextPageToken: z.string().optional(), @@ -4651,19 +4622,17 @@ export const marshalListEndpointsResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListProjectsRequestSchema: z.ZodType = z +export const marshalListProjectsRequestSchema = z .object({ pageToken: z.string().optional(), pageSize: z.number().optional(), - showDeleted: z.boolean().optional(), }) .transform(d => ({ page_token: d.pageToken, page_size: d.pageSize, - show_deleted: d.showDeleted, })); -export const marshalListProjectsResponseSchema: z.ZodType = z +export const marshalListProjectsResponseSchema = z .object({ projects: z.array(z.lazy(() => marshalProjectSchema)).optional(), nextPageToken: z.string().optional(), @@ -4673,7 +4642,7 @@ export const marshalListProjectsResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalListRolesRequestSchema: z.ZodType = z +export const marshalListRolesRequestSchema = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4685,7 +4654,7 @@ export const marshalListRolesRequestSchema: z.ZodType = z page_size: d.pageSize, })); -export const marshalListRolesResponseSchema: z.ZodType = z +export const marshalListRolesResponseSchema = z .object({ roles: z.array(z.lazy(() => marshalRoleSchema)).optional(), nextPageToken: z.string().optional(), @@ -4695,7 +4664,7 @@ export const marshalListRolesResponseSchema: z.ZodType = z next_page_token: d.nextPageToken, })); -export const marshalNewPipelineSpecSchema: z.ZodType = z +export const marshalNewPipelineSpecSchema = z .object({ storageCatalog: z.string().optional(), storageSchema: z.string().optional(), @@ -4707,7 +4676,7 @@ export const marshalNewPipelineSpecSchema: z.ZodType = z budget_policy_id: d.budgetPolicyId, })); -export const marshalOperationSchema: z.ZodType = z +export const marshalOperationSchema = z .object({ name: z.string().optional(), metadata: z.record(z.string(), z.unknown()).optional(), @@ -4725,7 +4694,7 @@ export const marshalOperationSchema: z.ZodType = z response: d.response, })); -export const marshalProjectSchema: z.ZodType = z +export const marshalProjectSchema = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -4742,14 +4711,6 @@ export const marshalProjectSchema: z.ZodType = z initialEndpointSpec: z .lazy(() => marshalInitialEndpointSpecSchema) .optional(), - deleteTime: z - .any() - .transform((d: Temporal.Instant) => d.toString()) - .optional(), - purgeTime: z - .any() - .transform((d: Temporal.Instant) => d.toString()) - .optional(), }) .transform(d => ({ name: d.name, @@ -4759,11 +4720,9 @@ export const marshalProjectSchema: z.ZodType = z spec: d.spec, status: d.status, initial_endpoint_spec: d.initialEndpointSpec, - delete_time: d.deleteTime, - purge_time: d.purgeTime, })); -export const marshalProjectCustomTagSchema: z.ZodType = z +export const marshalProjectCustomTagSchema = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -4773,7 +4732,7 @@ export const marshalProjectCustomTagSchema: z.ZodType = z value: d.value, })); -export const marshalProjectDefaultEndpointSettingsSchema: z.ZodType = z +export const marshalProjectDefaultEndpointSettingsSchema = z .object({ autoscalingLimitMinCu: z.number().optional(), autoscalingLimitMaxCu: z.number().optional(), @@ -4793,20 +4752,19 @@ export const marshalProjectDefaultEndpointSettingsSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalProjectDefaultEndpointSettings_PgSettingsEntrySchema: z.ZodType = - z - .object({ - key: z.string().optional(), - value: z.string().optional(), - }) - .transform(d => ({ - key: d.key, - value: d.value, - })); +export const marshalProjectDefaultEndpointSettings_PgSettingsEntrySchema = z + .object({ + key: z.string().optional(), + value: z.string().optional(), + }) + .transform(d => ({ + key: d.key, + value: d.value, + })); -export const marshalProjectOperationMetadataSchema: z.ZodType = z.object({}); +export const marshalProjectOperationMetadataSchema = z.object({}); -export const marshalProjectSpecSchema: z.ZodType = z +export const marshalProjectSpecSchema = z .object({ displayName: z.string().optional(), pgVersion: z.number().optional(), @@ -4835,7 +4793,7 @@ export const marshalProjectSpecSchema: z.ZodType = z default_branch: d.defaultBranch, })); -export const marshalProjectStatusSchema: z.ZodType = z +export const marshalProjectStatusSchema = z .object({ displayName: z.string().optional(), pgVersion: z.number().optional(), @@ -4875,9 +4833,9 @@ export const marshalProjectStatusSchema: z.ZodType = z project_id: d.projectId, })); -export const marshalProvisioningInfoSchema: z.ZodType = z.object({}); +export const marshalProvisioningInfoSchema = z.object({}); -export const marshalRequestedClaimsSchema: z.ZodType = z +export const marshalRequestedClaimsSchema = z .object({ permissionSet: z.enum(RequestedClaims_PermissionSet).optional(), resources: z.array(z.lazy(() => marshalRequestedResourceSchema)).optional(), @@ -4887,7 +4845,7 @@ export const marshalRequestedClaimsSchema: z.ZodType = z resources: d.resources, })); -export const marshalRequestedResourceSchema: z.ZodType = z +export const marshalRequestedResourceSchema = z .object({ unspecifiedResourceName: z.string().optional(), tableName: z.string().optional(), @@ -4897,7 +4855,7 @@ export const marshalRequestedResourceSchema: z.ZodType = z table_name: d.tableName, })); -export const marshalRoleSchema: z.ZodType = z +export const marshalRoleSchema = z .object({ name: z.string().optional(), parent: z.string().optional(), @@ -4922,7 +4880,7 @@ export const marshalRoleSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalRole_AttributesSchema: z.ZodType = z +export const marshalRole_AttributesSchema = z .object({ createdb: z.boolean().optional(), createrole: z.boolean().optional(), @@ -4935,7 +4893,7 @@ export const marshalRole_AttributesSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalRole_RoleSpecSchema: z.ZodType = z +export const marshalRole_RoleSpecSchema = z .object({ membershipRoles: z.array(z.enum(Role_MembershipRole)).optional(), identityType: z.enum(Role_IdentityType).optional(), @@ -4952,7 +4910,7 @@ export const marshalRole_RoleSpecSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalRole_RoleStatusSchema: z.ZodType = z +export const marshalRole_RoleStatusSchema = z .object({ membershipRoles: z.array(z.enum(Role_MembershipRole)).optional(), identityType: z.enum(Role_IdentityType).optional(), @@ -4970,9 +4928,9 @@ export const marshalRole_RoleStatusSchema: z.ZodType = z role_id: d.roleId, })); -export const marshalRoleOperationMetadataSchema: z.ZodType = z.object({}); +export const marshalRoleOperationMetadataSchema = z.object({}); -export const marshalSyncedTableSchema: z.ZodType = z +export const marshalSyncedTableSchema = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -4992,7 +4950,7 @@ export const marshalSyncedTableSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalSyncedTable_SyncedTableSpecSchema: z.ZodType = z +export const marshalSyncedTable_SyncedTableSpecSchema = z .object({ postgresDatabase: z.string().optional(), branch: z.string().optional(), @@ -5021,7 +4979,7 @@ export const marshalSyncedTable_SyncedTableSpecSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalSyncedTable_SyncedTableStatusSchema: z.ZodType = z +export const marshalSyncedTable_SyncedTableStatusSchema = z .object({ message: z.string().optional(), detailedState: z.enum(SyncedTableState).optional(), @@ -5052,11 +5010,9 @@ export const marshalSyncedTable_SyncedTableStatusSchema: z.ZodType = z project: d.project, })); -export const marshalSyncedTableOperationMetadataSchema: z.ZodType = z.object( - {} -); +export const marshalSyncedTableOperationMetadataSchema = z.object({}); -export const marshalSyncedTablePipelineProgressSchema: z.ZodType = z +export const marshalSyncedTablePipelineProgressSchema = z .object({ latestVersionCurrentlyProcessing: z.number().optional(), syncedRowCount: z.number().optional(), @@ -5072,7 +5028,7 @@ export const marshalSyncedTablePipelineProgressSchema: z.ZodType = z estimated_completion_time_seconds: d.estimatedCompletionTimeSeconds, })); -export const marshalSyncedTablePositionSchema: z.ZodType = z +export const marshalSyncedTablePositionSchema = z .object({ syncStartTime: z .any() @@ -5092,7 +5048,7 @@ export const marshalSyncedTablePositionSchema: z.ZodType = z delta_table_sync_info: d.deltaTableSyncInfo, })); -export const marshalTableSchema: z.ZodType = z +export const marshalTableSchema = z .object({ name: z.string().optional(), database: z.string().optional(), @@ -5108,7 +5064,7 @@ export const marshalTableSchema: z.ZodType = z table_serving_url: d.tableServingUrl, })); -export const marshalUpdateBranchRequestSchema: z.ZodType = z +export const marshalUpdateBranchRequestSchema = z .object({ branch: z.lazy(() => marshalBranchSchema).optional(), updateMask: z.string().optional(), @@ -5118,7 +5074,7 @@ export const marshalUpdateBranchRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalUpdateDatabaseRequestSchema: z.ZodType = z +export const marshalUpdateDatabaseRequestSchema = z .object({ database: z.lazy(() => marshalDatabaseSchema).optional(), updateMask: z.string().optional(), @@ -5128,7 +5084,7 @@ export const marshalUpdateDatabaseRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalUpdateEndpointRequestSchema: z.ZodType = z +export const marshalUpdateEndpointRequestSchema = z .object({ endpoint: z.lazy(() => marshalEndpointSchema).optional(), updateMask: z.string().optional(), @@ -5138,7 +5094,7 @@ export const marshalUpdateEndpointRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalUpdateProjectRequestSchema: z.ZodType = z +export const marshalUpdateProjectRequestSchema = z .object({ project: z.lazy(() => marshalProjectSchema).optional(), updateMask: z.string().optional(), @@ -5148,7 +5104,7 @@ export const marshalUpdateProjectRequestSchema: z.ZodType = z update_mask: d.updateMask, })); -export const marshalUpdateRoleRequestSchema: z.ZodType = z +export const marshalUpdateRoleRequestSchema = z .object({ role: z.lazy(() => marshalRoleSchema).optional(), updateMask: z.string().optional(), diff --git a/packages/sdk/src/model.ts b/packages/sdk/src/model.ts index e21d935b..d484b973 100644 --- a/packages/sdk/src/model.ts +++ b/packages/sdk/src/model.ts @@ -66,21 +66,6 @@ export enum LaunchStage { GA = 'GA', } -/** - * SDK generation hints for a proto field. - * - * These annotations guide SDK code generators in producing correct - * client code. They do not affect wire format or server behavior. - */ -export interface FieldMetadata { - /** - * When true, the field value may contain path separators (e.g., "/a/b/c") - * and should be treated as a multi-segment path parameter rather than a - * single path segment. - */ - isMultiSegment?: boolean | undefined; -} - /** * Long-Running Operation (LRO) configuration for API methods. * @@ -187,29 +172,6 @@ export interface LongRunningOperation_OperationMethods { cancel?: string | undefined; } -/** - * SDK generation hints for an RPC method. - * - * These annotations guide SDK code generators in producing correct - * client code. They do not affect wire format or server behavior. - */ -export interface MethodMetadata { - /** - * Fields in the response message that are populated from HTTP response - * headers rather than the JSON response body. Each entry is the proto - * field name in the response message; the field's json_name gives the - * corresponding HTTP header name. - */ - responseHeaders?: string[] | undefined; - /** - * Fields in the request message that are sent as HTTP request headers - * rather than in the request body or query string. Each entry is the - * proto field name in the request message; the field's json_name gives - * the corresponding HTTP header name. - */ - requestHeaders?: string[] | undefined; -} - /** * Indicates that an API method returns paginated results. * @@ -410,14 +372,6 @@ export interface WaitForState_StateInfo { messagePath?: string[] | undefined; } -export const unmarshalFieldMetadataSchema: z.ZodType = z - .object({ - is_multi_segment: z.boolean().optional(), - }) - .transform(d => ({ - isMultiSegment: d.is_multi_segment, - })); - export const unmarshalLongRunningOperationSchema: z.ZodType = z .object({ @@ -463,16 +417,6 @@ export const unmarshalLongRunningOperation_OperationMethodsSchema: z.ZodType = z - .object({ - response_headers: z.array(z.string()).optional(), - request_headers: z.array(z.string()).optional(), - }) - .transform(d => ({ - responseHeaders: d.response_headers, - requestHeaders: d.request_headers, - })); - export const unmarshalPaginationSchema: z.ZodType = z .object({ offset_info: z.lazy(() => unmarshalPagination_OffsetInfoSchema).optional(), @@ -571,15 +515,7 @@ export const unmarshalWaitForState_StateInfoSchema: z.ZodType ({ - is_multi_segment: d.isMultiSegment, - })); - -export const marshalLongRunningOperationSchema: z.ZodType = z +export const marshalLongRunningOperationSchema = z .object({ operationInfo: z .lazy(() => marshalLongRunningOperation_OperationInfoSchema) @@ -594,7 +530,7 @@ export const marshalLongRunningOperationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalLongRunningOperation_OperationInfoSchema: z.ZodType = z +export const marshalLongRunningOperation_OperationInfoSchema = z .object({ responseType: z.string().optional(), metadataType: z.string().optional(), @@ -605,7 +541,7 @@ export const marshalLongRunningOperation_OperationInfoSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalLongRunningOperation_OperationMethodsSchema: z.ZodType = z +export const marshalLongRunningOperation_OperationMethodsSchema = z .object({ get: z.string().optional(), list: z.string().optional(), @@ -621,17 +557,7 @@ export const marshalLongRunningOperation_OperationMethodsSchema: z.ZodType = z cancel: d.cancel, })); -export const marshalMethodMetadataSchema: z.ZodType = z - .object({ - responseHeaders: z.array(z.string()).optional(), - requestHeaders: z.array(z.string()).optional(), - }) - .transform(d => ({ - response_headers: d.responseHeaders, - request_headers: d.requestHeaders, - })); - -export const marshalPaginationSchema: z.ZodType = z +export const marshalPaginationSchema = z .object({ offsetInfo: z.lazy(() => marshalPagination_OffsetInfoSchema).optional(), tokenInfo: z.lazy(() => marshalPagination_PageTokenInfoSchema).optional(), @@ -644,7 +570,7 @@ export const marshalPaginationSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalPagination_OffsetInfoSchema: z.ZodType = z +export const marshalPagination_OffsetInfoSchema = z .object({ offset: z.string().optional(), maxResults: z.string().optional(), @@ -657,7 +583,7 @@ export const marshalPagination_OffsetInfoSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalPagination_PageTokenInfoSchema: z.ZodType = z +export const marshalPagination_PageTokenInfoSchema = z .object({ request: z.string().optional(), response: z.string().optional(), @@ -671,7 +597,7 @@ export const marshalPagination_PageTokenInfoSchema: z.ZodType = z default_max_results: d.defaultMaxResults, })); -export const marshalWaitForStateSchema: z.ZodType = z +export const marshalWaitForStateSchema = z .object({ methodToPoll: z.string().optional(), binding: z.lazy(() => marshalWaitForState_BindingSchema).optional(), @@ -684,7 +610,7 @@ export const marshalWaitForStateSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalWaitForState_BindingSchema: z.ZodType = z +export const marshalWaitForState_BindingSchema = z .object({ pairs: z .array(z.lazy(() => marshalWaitForState_Binding_BindingPairSchema)) @@ -695,7 +621,7 @@ export const marshalWaitForState_BindingSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalWaitForState_Binding_BindingPairSchema: z.ZodType = z +export const marshalWaitForState_Binding_BindingPairSchema = z .object({ pollMethodField: z.string().optional(), requestField: z.string().optional(), @@ -708,7 +634,7 @@ export const marshalWaitForState_Binding_BindingPairSchema: z.ZodType = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalWaitForState_StateInfoSchema: z.ZodType = z +export const marshalWaitForState_StateInfoSchema = z .object({ statePath: z.array(z.string()).optional(), successStates: z.array(z.string()).optional(), From b4ce632b10c51e329769afe6273f8f36a35db2ab Mon Sep 17 00:00:00 2001 From: Parth Bansal Date: Mon, 13 Apr 2026 21:30:59 +0000 Subject: [PATCH 2/2] update --- package-lock.json | 146 +-- packages/abacpolicies/src/v1/index.ts | 3 + packages/abacpolicies/src/v1/model.ts | 95 ++ packages/features/src/v1/model.ts | 230 ++-- packages/files/package.json | 24 +- packages/files/src/v2/client.ts | 723 +++++++++++++ packages/files/src/v2/index.ts | 46 + packages/files/src/v2/model.ts | 981 ++++++++++++++++++ packages/files/src/v2/utils.ts | 165 +++ .../oauthcustomappintegration/src/v1/model.ts | 82 +- packages/postgres/src/v1/client.ts | 131 +++ packages/postgres/src/v1/index.ts | 2 + packages/postgres/src/v1/model.ts | 368 ++++--- packages/sdk/src/model.ts | 105 +- packages/tables/src/v1/model.ts | 2 +- 15 files changed, 2714 insertions(+), 389 deletions(-) create mode 100644 packages/files/src/v2/client.ts create mode 100644 packages/files/src/v2/index.ts create mode 100644 packages/files/src/v2/model.ts create mode 100644 packages/files/src/v2/utils.ts diff --git a/package-lock.json b/package-lock.json index bd40f1fe..9c640d5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "eslint-config-prettier": "^9.1.0", "playwright": "^1.48.0", "prettier": "^3.2.0", - "turbo": "2.8.20", "typescript": "^5.7.0", "vite": "^6.4.0", "vitest": "^3.2.4" @@ -165,10 +164,6 @@ "resolved": "packages/connections", "link": true }, - "node_modules/@databricks/sdk-core": { - "resolved": "packages/core", - "link": true - }, "node_modules/@databricks/sdk-credentials": { "resolved": "packages/credentials", "link": true @@ -647,7 +642,6 @@ "os": [ "netbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -682,7 +676,6 @@ "os": [ "openbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -717,7 +710,6 @@ "os": [ "openharmony" ], - "peer": true, "engines": { "node": ">=18" } @@ -1567,90 +1559,6 @@ "@testing-library/dom": ">=7.21.4" } }, - "node_modules/@turbo/darwin-64": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/@turbo/darwin-64/-/darwin-64-2.8.20.tgz", - "integrity": "sha512-FQ9EX1xMU5nbwjxXxM3yU88AQQ6Sqc6S44exPRroMcx9XZHqqppl5ymJF0Ig/z3nvQNwDmz1Gsnvxubo+nXWjQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@turbo/darwin-arm64": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/@turbo/darwin-arm64/-/darwin-arm64-2.8.20.tgz", - "integrity": "sha512-Gpyh9ATFGThD6/s9L95YWY54cizg/VRWl2B67h0yofG8BpHf67DFAh9nuJVKG7bY0+SBJDAo5cMur+wOl9YOYw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@turbo/linux-64": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/@turbo/linux-64/-/linux-64-2.8.20.tgz", - "integrity": "sha512-p2QxWUYyYUgUFG0b0kR+pPi8t7c9uaVlRtjTTI1AbCvVqkpjUfCcReBn6DgG/Hu8xrWdKLuyQFaLYFzQskZbcA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@turbo/linux-arm64": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/@turbo/linux-arm64/-/linux-arm64-2.8.20.tgz", - "integrity": "sha512-Gn5yjlZGLRZWarLWqdQzv0wMqyBNIdq1QLi48F1oY5Lo9kiohuf7BPQWtWxeNVS2NgJ1+nb/DzK1JduYC4AWOA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@turbo/windows-64": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/@turbo/windows-64/-/windows-64-2.8.20.tgz", - "integrity": "sha512-vyaDpYk/8T6Qz5V/X+ihKvKFEZFUoC0oxYpC1sZanK6gaESJlmV3cMRT3Qhcg4D2VxvtC2Jjs9IRkrZGL+exLw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@turbo/windows-arm64": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/@turbo/windows-arm64/-/windows-arm64-2.8.20.tgz", - "integrity": "sha512-voicVULvUV5yaGXo0Iue13BcHGYW3u0VgqSbfQwBaHbpj1zLjYV4KIe+7fYIo6DO8FVUJzxFps3ODCQG/Wy2Qw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", @@ -4263,7 +4171,6 @@ "os": [ "aix" ], - "peer": true, "engines": { "node": ">=18" } @@ -4281,7 +4188,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=18" } @@ -4299,7 +4205,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=18" } @@ -4317,7 +4222,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=18" } @@ -4335,7 +4239,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=18" } @@ -4353,7 +4256,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=18" } @@ -4371,7 +4273,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -4389,7 +4290,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -4407,7 +4307,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4425,7 +4324,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4443,7 +4341,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4461,7 +4358,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4479,7 +4375,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4497,7 +4392,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4515,7 +4409,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4533,7 +4426,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4551,7 +4443,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -4569,7 +4460,6 @@ "os": [ "netbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -4587,7 +4477,6 @@ "os": [ "openbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -4605,7 +4494,6 @@ "os": [ "sunos" ], - "peer": true, "engines": { "node": ">=18" } @@ -4623,7 +4511,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=18" } @@ -4641,7 +4528,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=18" } @@ -4659,7 +4545,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=18" } @@ -4717,29 +4602,10 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/turbo": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/turbo/-/turbo-2.8.20.tgz", - "integrity": "sha512-Rb4qk5YT8RUwwdXtkLpkVhNEe/lor6+WV7S5tTlLpxSz6MjV5Qi8jGNn4gS6NAvrYGA/rNrE6YUQM85sCZUDbQ==", - "dev": true, - "license": "MIT", - "bin": { - "turbo": "bin/turbo" - }, - "optionalDependencies": { - "@turbo/darwin-64": "2.8.20", - "@turbo/darwin-arm64": "2.8.20", - "@turbo/linux-64": "2.8.20", - "@turbo/linux-arm64": "2.8.20", - "@turbo/windows-64": "2.8.20", - "@turbo/windows-arm64": "2.8.20" - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -5208,14 +5074,6 @@ "node": ">=22.0.0" } }, - "packages/core": { - "name": "@databricks/sdk-core", - "version": "0.1.0", - "license": "Apache-2.0", - "engines": { - "node": ">=22.0.0" - } - }, "packages/credentials": { "name": "@databricks/sdk-credentials", "version": "0.1.0", @@ -5348,7 +5206,9 @@ "version": "0.1.0", "license": "Apache-2.0", "dependencies": { - "@databricks/sdk-databricks": "*" + "@databricks/sdk-databricks": "*", + "@js-temporal/polyfill": "^0.5.0", + "zod": "^4.3.6" }, "engines": { "node": ">=22.0.0" diff --git a/packages/abacpolicies/src/v1/index.ts b/packages/abacpolicies/src/v1/index.ts index eedb19be..a21aad7b 100644 --- a/packages/abacpolicies/src/v1/index.ts +++ b/packages/abacpolicies/src/v1/index.ts @@ -6,6 +6,7 @@ export {PolicyType, SecurableType} from './model'; export type { ColumnMaskOptions, + ColumnTagValueExtraction, CreatePolicy, DeletePolicy, DeletePolicy_Response, @@ -16,7 +17,9 @@ export type { ListPolicies, ListPolicies_Response, MatchColumn, + MetadataExtractionExpression, PolicyInfo, RowFilterOptions, + TagValueExtraction, UpdatePolicy, } from './model'; diff --git a/packages/abacpolicies/src/v1/model.ts b/packages/abacpolicies/src/v1/model.ts index ea141069..383bd2bc 100644 --- a/packages/abacpolicies/src/v1/model.ts +++ b/packages/abacpolicies/src/v1/model.ts @@ -54,6 +54,14 @@ export interface ColumnMaskOptions { using?: FunctionArgument[] | undefined; } +/** Extracts the value of a column-level tag: get_column_tag_value(col, "tagKey"). */ +export interface ColumnTagValueExtraction { + /** The alias from MATCH COLUMNS that identifies the column. */ + columnAlias?: string | undefined; + /** 1024 matches the max_length on FunctionArgument.constant above. */ + tagKey?: string | undefined; +} + export interface CreatePolicy { /** Required. The policy to create. */ policyInfo?: PolicyInfo | undefined; @@ -86,6 +94,8 @@ export interface FunctionArgument { alias?: string | undefined; /** A constant literal. */ constant?: string | undefined; + /** A metadata extraction expression resolved at query time. */ + metadataExtraction?: MetadataExtractionExpression | undefined; } export interface GetPolicy { @@ -145,6 +155,14 @@ export interface MatchColumn { alias?: string | undefined; } +/** An expression that extracts metadata at query time. */ +export interface MetadataExtractionExpression { + /** Extracts the value of a securable-level tag. */ + tagValue?: TagValueExtraction | undefined; + /** Extracts the value of a column-level tag. */ + columnTagValue?: ColumnTagValueExtraction | undefined; +} + export interface PolicyInfo { /** Unique identifier of the policy. This field is output only and is generated by the system. */ id?: string | undefined; @@ -247,6 +265,12 @@ export interface RowFilterOptions { using?: FunctionArgument[] | undefined; } +/** Extracts the value of a securable-level tag: get_tag_value("tagKey"). */ +export interface TagValueExtraction { + /** 1024 matches the max_length on FunctionArgument.constant above. */ + tagKey?: string | undefined; +} + export interface UpdatePolicy { /** Required. The type of the securable to update the policy for. */ onSecurableType?: string | undefined; @@ -283,6 +307,17 @@ export const unmarshalColumnMaskOptionsSchema: z.ZodType = z using: d.using, })); +export const unmarshalColumnTagValueExtractionSchema: z.ZodType = + z + .object({ + column_alias: z.string().optional(), + tag_key: z.string().optional(), + }) + .transform(d => ({ + columnAlias: d.column_alias, + tagKey: d.tag_key, + })); + export const unmarshalCreatePolicySchema: z.ZodType = z .object({ policy_info: z.lazy(() => unmarshalPolicyInfoSchema).optional(), @@ -319,10 +354,14 @@ export const unmarshalFunctionArgumentSchema: z.ZodType = z .object({ alias: z.string().optional(), constant: z.string().optional(), + metadata_extraction: z + .lazy(() => unmarshalMetadataExtractionExpressionSchema) + .optional(), }) .transform(d => ({ alias: d.alias, constant: d.constant, + metadataExtraction: d.metadata_extraction, })); export const unmarshalGetPolicySchema: z.ZodType = z @@ -383,6 +422,19 @@ export const unmarshalMatchColumnSchema: z.ZodType = z alias: d.alias, })); +export const unmarshalMetadataExtractionExpressionSchema: z.ZodType = + z + .object({ + tag_value: z.lazy(() => unmarshalTagValueExtractionSchema).optional(), + column_tag_value: z + .lazy(() => unmarshalColumnTagValueExtractionSchema) + .optional(), + }) + .transform(d => ({ + tagValue: d.tag_value, + columnTagValue: d.column_tag_value, + })); + export const unmarshalPolicyInfoSchema: z.ZodType = z .object({ id: z.string().optional(), @@ -439,6 +491,15 @@ export const unmarshalRowFilterOptionsSchema: z.ZodType = z using: d.using, })); +export const unmarshalTagValueExtractionSchema: z.ZodType = + z + .object({ + tag_key: z.string().optional(), + }) + .transform(d => ({ + tagKey: d.tag_key, + })); + export const unmarshalUpdatePolicySchema: z.ZodType = z .object({ on_securable_type: z.string().optional(), @@ -467,6 +528,16 @@ export const marshalColumnMaskOptionsSchema: z.ZodType = z using: d.using, })); +export const marshalColumnTagValueExtractionSchema: z.ZodType = z + .object({ + columnAlias: z.string().optional(), + tagKey: z.string().optional(), + }) + .transform(d => ({ + column_alias: d.columnAlias, + tag_key: d.tagKey, + })); + export const marshalCreatePolicySchema: z.ZodType = z .object({ policyInfo: z.lazy(() => marshalPolicyInfoSchema).optional(), @@ -502,10 +573,14 @@ export const marshalFunctionArgumentSchema: z.ZodType = z .object({ alias: z.string().optional(), constant: z.string().optional(), + metadataExtraction: z + .lazy(() => marshalMetadataExtractionExpressionSchema) + .optional(), }) .transform(d => ({ alias: d.alias, constant: d.constant, + metadata_extraction: d.metadataExtraction, })); export const marshalGetPolicySchema: z.ZodType = z @@ -565,6 +640,18 @@ export const marshalMatchColumnSchema: z.ZodType = z alias: d.alias, })); +export const marshalMetadataExtractionExpressionSchema: z.ZodType = z + .object({ + tagValue: z.lazy(() => marshalTagValueExtractionSchema).optional(), + columnTagValue: z + .lazy(() => marshalColumnTagValueExtractionSchema) + .optional(), + }) + .transform(d => ({ + tag_value: d.tagValue, + column_tag_value: d.columnTagValue, + })); + export const marshalPolicyInfoSchema: z.ZodType = z .object({ id: z.string().optional(), @@ -621,6 +708,14 @@ export const marshalRowFilterOptionsSchema: z.ZodType = z using: d.using, })); +export const marshalTagValueExtractionSchema: z.ZodType = z + .object({ + tagKey: z.string().optional(), + }) + .transform(d => ({ + tag_key: d.tagKey, + })); + export const marshalUpdatePolicySchema: z.ZodType = z .object({ onSecurableType: z.string().optional(), diff --git a/packages/features/src/v1/model.ts b/packages/features/src/v1/model.ts index 93804452..45cee41b 100644 --- a/packages/features/src/v1/model.ts +++ b/packages/features/src/v1/model.ts @@ -3,6 +3,25 @@ import {Temporal} from '@js-temporal/polyfill'; import {z} from 'zod'; +/** + * Scalar data types for request-time field definitions. + * Only flat (non-nested) types are supported. + */ +export enum ScalarDataType { + SCALAR_DATA_TYPE_UNSPECIFIED = 'SCALAR_DATA_TYPE_UNSPECIFIED', + INTEGER = 'INTEGER', + FLOAT = 'FLOAT', + BOOLEAN = 'BOOLEAN', + STRING = 'STRING', + DOUBLE = 'DOUBLE', + LONG = 'LONG', + TIMESTAMP = 'TIMESTAMP', + DATE = 'DATE', + SHORT = 'SHORT', + BINARY = 'BINARY', + DECIMAL = 'DECIMAL', +} + /** Deprecated: Use the function-specific messages in AggregationFunction.function_type oneof instead. Kept for backwards compatibility. */ // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name. export enum Function_FunctionType { @@ -151,9 +170,14 @@ export interface CreateMaterializedFeatureRequest { materializedFeature?: MaterializedFeature | undefined; } +/** Specifies the data source backing a feature. Exactly one source type must be set. */ export interface DataSource { + /** A Delta table data source. */ deltaTableSource?: DeltaTableSource | undefined; + /** A Kafka stream data source. */ kafkaSource?: KafkaSource | undefined; + /** A request-time data source. */ + requestSource?: RequestSource | undefined; } export interface DeleteFeatureRequest { @@ -250,12 +274,32 @@ export interface Feature { timeseriesColumn?: TimeseriesColumn | undefined; } +/** + * A single field definition within a FlatSchema, specifying the field name and its scalar data type. + * Does not support nested or complex types (arrays, maps, structs). + */ +export interface FieldDefinition { + /** The name of the field. */ + name?: string | undefined; + /** The scalar data type of the field. */ + dataType?: ScalarDataType | undefined; +} + /** Returns the first value. */ export interface FirstFunction { /** The input column from which the first value is returned. */ input?: string | undefined; } +/** + * A flat (non-nested) schema for request-time fields, defined as an ordered list of field definitions. + * This schema only supports scalar types. + */ +export interface FlatSchema { + /** The list of fields in this schema. */ + fields?: FieldDefinition[] | undefined; +} + export interface Function { /** * Deprecated: Use the function oneof with AggregationFunction instead. Kept for backwards compatibility. @@ -433,6 +477,8 @@ export interface MaterializedFeature { lastMaterializationTime?: Temporal.Instant | undefined; /** The quartz cron expression that defines the schedule of the materialization pipeline. The schedule is evaluated in the UTC timezone. */ cronSchedule?: string | undefined; + /** True if this is an online materialized feature. False if it is an offline materialized feature. */ + isOnline?: boolean | undefined; } /** Computes the maximum value. */ @@ -481,6 +527,12 @@ export interface OnlineStoreConfig { onlineStoreName?: string | undefined; } +/** A request-time data source whose value is provided at inference time: offline batch scoring or online serving endpoint */ +export interface RequestSource { + /** A flat schema with scalar-typed fields only. */ + flatSchema?: FlatSchema | undefined; +} + export interface SchemaConfig { /** Schema of the JSON object in standard IETF JSON schema format (https://json-schema.org/) */ jsonSchema?: string | undefined; @@ -778,10 +830,12 @@ export const unmarshalDataSourceSchema: z.ZodType = z .lazy(() => unmarshalDeltaTableSourceSchema) .optional(), kafka_source: z.lazy(() => unmarshalKafkaSourceSchema).optional(), + request_source: z.lazy(() => unmarshalRequestSourceSchema).optional(), }) .transform(d => ({ deltaTableSource: d.delta_table_source, kafkaSource: d.kafka_source, + requestSource: d.request_source, })); export const unmarshalDeleteFeatureRequestSchema: z.ZodType = @@ -863,6 +917,16 @@ export const unmarshalFeatureSchema: z.ZodType = z timeseriesColumn: d.timeseries_column, })); +export const unmarshalFieldDefinitionSchema: z.ZodType = z + .object({ + name: z.string().optional(), + data_type: z.enum(ScalarDataType).optional(), + }) + .transform(d => ({ + name: d.name, + dataType: d.data_type, + })); + export const unmarshalFirstFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), @@ -871,6 +935,14 @@ export const unmarshalFirstFunctionSchema: z.ZodType = z input: d.input, })); +export const unmarshalFlatSchemaSchema: z.ZodType = z + .object({ + fields: z.array(z.lazy(() => unmarshalFieldDefinitionSchema)).optional(), + }) + .transform(d => ({ + fields: d.fields, + })); + export const unmarshalFunctionSchema: z.ZodType = z .object({ function_type: z.enum(Function_FunctionType).optional(), @@ -1099,6 +1171,7 @@ export const unmarshalMaterializedFeatureSchema: z.ZodType .transform(s => Temporal.Instant.from(s)) .optional(), cron_schedule: z.string().optional(), + is_online: z.boolean().optional(), }) .transform(d => ({ materializedFeatureId: d.materialized_feature_id, @@ -1109,6 +1182,7 @@ export const unmarshalMaterializedFeatureSchema: z.ZodType pipelineScheduleState: d.pipeline_schedule_state, lastMaterializationTime: d.last_materialization_time, cronSchedule: d.cron_schedule, + isOnline: d.is_online, })); export const unmarshalMaxFunctionSchema: z.ZodType = z @@ -1154,6 +1228,14 @@ export const unmarshalOnlineStoreConfigSchema: z.ZodType = z onlineStoreName: d.online_store_name, })); +export const unmarshalRequestSourceSchema: z.ZodType = z + .object({ + flat_schema: z.lazy(() => unmarshalFlatSchemaSchema).optional(), + }) + .transform(d => ({ + flatSchema: d.flat_schema, + })); + export const unmarshalSchemaConfigSchema: z.ZodType = z .object({ json_schema: z.string().optional(), @@ -1297,7 +1379,7 @@ export const unmarshalVarSampFunctionSchema: z.ZodType = z input: d.input, })); -export const marshalAggregationFunctionSchema = z +export const marshalAggregationFunctionSchema: z.ZodType = z .object({ avg: z.lazy(() => marshalAvgFunctionSchema).optional(), countFunction: z.lazy(() => marshalCountFunctionSchema).optional(), @@ -1335,7 +1417,7 @@ export const marshalAggregationFunctionSchema = z time_window: d.timeWindow, })); -export const marshalApproxCountDistinctFunctionSchema = z +export const marshalApproxCountDistinctFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), relativeSd: z.number().optional(), @@ -1345,7 +1427,7 @@ export const marshalApproxCountDistinctFunctionSchema = z relative_sd: d.relativeSd, })); -export const marshalApproxPercentileFunctionSchema = z +export const marshalApproxPercentileFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), percentile: z.number().optional(), @@ -1357,7 +1439,7 @@ export const marshalApproxPercentileFunctionSchema = z accuracy: d.accuracy, })); -export const marshalAuthConfigSchema = z +export const marshalAuthConfigSchema: z.ZodType = z .object({ ucServiceCredentialName: z.string().optional(), }) @@ -1365,7 +1447,7 @@ export const marshalAuthConfigSchema = z uc_service_credential_name: d.ucServiceCredentialName, })); -export const marshalAvgFunctionSchema = z +export const marshalAvgFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1373,7 +1455,7 @@ export const marshalAvgFunctionSchema = z input: d.input, })); -export const marshalBackfillSourceSchema = z +export const marshalBackfillSourceSchema: z.ZodType = z .object({ deltaTableSource: z.lazy(() => marshalDeltaTableSourceSchema).optional(), }) @@ -1381,7 +1463,7 @@ export const marshalBackfillSourceSchema = z delta_table_source: d.deltaTableSource, })); -export const marshalBatchCreateMaterializedFeaturesRequestSchema = z +export const marshalBatchCreateMaterializedFeaturesRequestSchema: z.ZodType = z .object({ requests: z .array(z.lazy(() => marshalCreateMaterializedFeatureRequestSchema)) @@ -1391,7 +1473,7 @@ export const marshalBatchCreateMaterializedFeaturesRequestSchema = z requests: d.requests, })); -export const marshalBatchCreateMaterializedFeaturesResponseSchema = z +export const marshalBatchCreateMaterializedFeaturesResponseSchema: z.ZodType = z .object({ materializedFeatures: z .array(z.lazy(() => marshalMaterializedFeatureSchema)) @@ -1401,7 +1483,7 @@ export const marshalBatchCreateMaterializedFeaturesResponseSchema = z materialized_features: d.materializedFeatures, })); -export const marshalColumnIdentifierSchema = z +export const marshalColumnIdentifierSchema: z.ZodType = z .object({ variantExprPath: z.string().optional(), }) @@ -1409,7 +1491,7 @@ export const marshalColumnIdentifierSchema = z variant_expr_path: d.variantExprPath, })); -export const marshalColumnSelectionSchema = z +export const marshalColumnSelectionSchema: z.ZodType = z .object({ column: z.string().optional(), }) @@ -1417,7 +1499,7 @@ export const marshalColumnSelectionSchema = z column: d.column, })); -export const marshalContinuousWindowSchema = z +export const marshalContinuousWindowSchema: z.ZodType = z .object({ windowDuration: z .any() @@ -1433,7 +1515,7 @@ export const marshalContinuousWindowSchema = z offset: d.offset, })); -export const marshalCountFunctionSchema = z +export const marshalCountFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1441,7 +1523,7 @@ export const marshalCountFunctionSchema = z input: d.input, })); -export const marshalCreateFeatureRequestSchema = z +export const marshalCreateFeatureRequestSchema: z.ZodType = z .object({ feature: z.lazy(() => marshalFeatureSchema).optional(), }) @@ -1449,7 +1531,7 @@ export const marshalCreateFeatureRequestSchema = z feature: d.feature, })); -export const marshalCreateKafkaConfigRequestSchema = z +export const marshalCreateKafkaConfigRequestSchema: z.ZodType = z .object({ kafkaConfig: z.lazy(() => marshalKafkaConfigSchema).optional(), }) @@ -1457,7 +1539,7 @@ export const marshalCreateKafkaConfigRequestSchema = z kafka_config: d.kafkaConfig, })); -export const marshalCreateMaterializedFeatureRequestSchema = z +export const marshalCreateMaterializedFeatureRequestSchema: z.ZodType = z .object({ materializedFeature: z .lazy(() => marshalMaterializedFeatureSchema) @@ -1467,17 +1549,19 @@ export const marshalCreateMaterializedFeatureRequestSchema = z materialized_feature: d.materializedFeature, })); -export const marshalDataSourceSchema = z +export const marshalDataSourceSchema: z.ZodType = z .object({ deltaTableSource: z.lazy(() => marshalDeltaTableSourceSchema).optional(), kafkaSource: z.lazy(() => marshalKafkaSourceSchema).optional(), + requestSource: z.lazy(() => marshalRequestSourceSchema).optional(), }) .transform(d => ({ delta_table_source: d.deltaTableSource, kafka_source: d.kafkaSource, + request_source: d.requestSource, })); -export const marshalDeleteFeatureRequestSchema = z +export const marshalDeleteFeatureRequestSchema: z.ZodType = z .object({ fullName: z.string().optional(), }) @@ -1485,7 +1569,7 @@ export const marshalDeleteFeatureRequestSchema = z full_name: d.fullName, })); -export const marshalDeleteKafkaConfigRequestSchema = z +export const marshalDeleteKafkaConfigRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -1493,7 +1577,7 @@ export const marshalDeleteKafkaConfigRequestSchema = z name: d.name, })); -export const marshalDeleteMaterializedFeatureRequestSchema = z +export const marshalDeleteMaterializedFeatureRequestSchema: z.ZodType = z .object({ materializedFeatureId: z.string().optional(), }) @@ -1501,7 +1585,7 @@ export const marshalDeleteMaterializedFeatureRequestSchema = z materialized_feature_id: d.materializedFeatureId, })); -export const marshalDeltaTableSourceSchema = z +export const marshalDeltaTableSourceSchema: z.ZodType = z .object({ fullName: z.string().optional(), entityColumns: z.array(z.string()).optional(), @@ -1519,7 +1603,7 @@ export const marshalDeltaTableSourceSchema = z dataframe_schema: d.dataframeSchema, })); -export const marshalEntityColumnSchema = z +export const marshalEntityColumnSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -1527,7 +1611,7 @@ export const marshalEntityColumnSchema = z name: d.name, })); -export const marshalFeatureSchema = z +export const marshalFeatureSchema: z.ZodType = z .object({ fullName: z.string().optional(), source: z.lazy(() => marshalDataSourceSchema).optional(), @@ -1553,7 +1637,17 @@ export const marshalFeatureSchema = z timeseries_column: d.timeseriesColumn, })); -export const marshalFirstFunctionSchema = z +export const marshalFieldDefinitionSchema: z.ZodType = z + .object({ + name: z.string().optional(), + dataType: z.enum(ScalarDataType).optional(), + }) + .transform(d => ({ + name: d.name, + data_type: d.dataType, + })); + +export const marshalFirstFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1561,7 +1655,15 @@ export const marshalFirstFunctionSchema = z input: d.input, })); -export const marshalFunctionSchema = z +export const marshalFlatSchemaSchema: z.ZodType = z + .object({ + fields: z.array(z.lazy(() => marshalFieldDefinitionSchema)).optional(), + }) + .transform(d => ({ + fields: d.fields, + })); + +export const marshalFunctionSchema: z.ZodType = z .object({ functionType: z.enum(Function_FunctionType).optional(), extraParameters: z @@ -1580,7 +1682,7 @@ export const marshalFunctionSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalFunction_ExtraParameterSchema = z +export const marshalFunction_ExtraParameterSchema: z.ZodType = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -1590,7 +1692,7 @@ export const marshalFunction_ExtraParameterSchema = z value: d.value, })); -export const marshalGetFeatureRequestSchema = z +export const marshalGetFeatureRequestSchema: z.ZodType = z .object({ fullName: z.string().optional(), }) @@ -1598,7 +1700,7 @@ export const marshalGetFeatureRequestSchema = z full_name: d.fullName, })); -export const marshalGetKafkaConfigRequestSchema = z +export const marshalGetKafkaConfigRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -1606,7 +1708,7 @@ export const marshalGetKafkaConfigRequestSchema = z name: d.name, })); -export const marshalGetMaterializedFeatureRequestSchema = z +export const marshalGetMaterializedFeatureRequestSchema: z.ZodType = z .object({ materializedFeatureId: z.string().optional(), }) @@ -1614,7 +1716,7 @@ export const marshalGetMaterializedFeatureRequestSchema = z materialized_feature_id: d.materializedFeatureId, })); -export const marshalJobContextSchema = z +export const marshalJobContextSchema: z.ZodType = z .object({ jobId: z.number().optional(), jobRunId: z.number().optional(), @@ -1624,7 +1726,7 @@ export const marshalJobContextSchema = z job_run_id: d.jobRunId, })); -export const marshalKafkaConfigSchema = z +export const marshalKafkaConfigSchema: z.ZodType = z .object({ name: z.string().optional(), bootstrapServers: z.string().optional(), @@ -1647,7 +1749,7 @@ export const marshalKafkaConfigSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalKafkaConfig_ExtraOptionsEntrySchema = z +export const marshalKafkaConfig_ExtraOptionsEntrySchema: z.ZodType = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -1657,7 +1759,7 @@ export const marshalKafkaConfig_ExtraOptionsEntrySchema = z value: d.value, })); -export const marshalKafkaSourceSchema = z +export const marshalKafkaSourceSchema: z.ZodType = z .object({ name: z.string().optional(), entityColumnIdentifiers: z @@ -1675,7 +1777,7 @@ export const marshalKafkaSourceSchema = z filter_condition: d.filterCondition, })); -export const marshalLastFunctionSchema = z +export const marshalLastFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1683,7 +1785,7 @@ export const marshalLastFunctionSchema = z input: d.input, })); -export const marshalLineageContextSchema = z +export const marshalLineageContextSchema: z.ZodType = z .object({ notebookId: z.number().optional(), jobContext: z.lazy(() => marshalJobContextSchema).optional(), @@ -1693,7 +1795,7 @@ export const marshalLineageContextSchema = z job_context: d.jobContext, })); -export const marshalListFeaturesRequestSchema = z +export const marshalListFeaturesRequestSchema: z.ZodType = z .object({ pageToken: z.string().optional(), pageSize: z.number().optional(), @@ -1703,7 +1805,7 @@ export const marshalListFeaturesRequestSchema = z page_size: d.pageSize, })); -export const marshalListFeaturesResponseSchema = z +export const marshalListFeaturesResponseSchema: z.ZodType = z .object({ features: z.array(z.lazy(() => marshalFeatureSchema)).optional(), nextPageToken: z.string().optional(), @@ -1713,7 +1815,7 @@ export const marshalListFeaturesResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListKafkaConfigsRequestSchema = z +export const marshalListKafkaConfigsRequestSchema: z.ZodType = z .object({ pageToken: z.string().optional(), pageSize: z.number().optional(), @@ -1723,7 +1825,7 @@ export const marshalListKafkaConfigsRequestSchema = z page_size: d.pageSize, })); -export const marshalListKafkaConfigsResponseSchema = z +export const marshalListKafkaConfigsResponseSchema: z.ZodType = z .object({ kafkaConfigs: z.array(z.lazy(() => marshalKafkaConfigSchema)).optional(), nextPageToken: z.string().optional(), @@ -1733,7 +1835,7 @@ export const marshalListKafkaConfigsResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListMaterializedFeaturesRequestSchema = z +export const marshalListMaterializedFeaturesRequestSchema: z.ZodType = z .object({ featureName: z.string().optional(), pageToken: z.string().optional(), @@ -1745,7 +1847,7 @@ export const marshalListMaterializedFeaturesRequestSchema = z page_size: d.pageSize, })); -export const marshalListMaterializedFeaturesResponseSchema = z +export const marshalListMaterializedFeaturesResponseSchema: z.ZodType = z .object({ materializedFeatures: z .array(z.lazy(() => marshalMaterializedFeatureSchema)) @@ -1757,7 +1859,7 @@ export const marshalListMaterializedFeaturesResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalMaterializedFeatureSchema = z +export const marshalMaterializedFeatureSchema: z.ZodType = z .object({ materializedFeatureId: z.string().optional(), featureName: z.string().optional(), @@ -1774,6 +1876,7 @@ export const marshalMaterializedFeatureSchema = z .transform((d: Temporal.Instant) => d.toString()) .optional(), cronSchedule: z.string().optional(), + isOnline: z.boolean().optional(), }) .transform(d => ({ materialized_feature_id: d.materializedFeatureId, @@ -1784,9 +1887,10 @@ export const marshalMaterializedFeatureSchema = z pipeline_schedule_state: d.pipelineScheduleState, last_materialization_time: d.lastMaterializationTime, cron_schedule: d.cronSchedule, + is_online: d.isOnline, })); -export const marshalMaxFunctionSchema = z +export const marshalMaxFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1794,7 +1898,7 @@ export const marshalMaxFunctionSchema = z input: d.input, })); -export const marshalMinFunctionSchema = z +export const marshalMinFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1802,7 +1906,7 @@ export const marshalMinFunctionSchema = z input: d.input, })); -export const marshalOfflineStoreConfigSchema = z +export const marshalOfflineStoreConfigSchema: z.ZodType = z .object({ catalogName: z.string().optional(), schemaName: z.string().optional(), @@ -1814,7 +1918,7 @@ export const marshalOfflineStoreConfigSchema = z table_name_prefix: d.tableNamePrefix, })); -export const marshalOnlineStoreConfigSchema = z +export const marshalOnlineStoreConfigSchema: z.ZodType = z .object({ catalogName: z.string().optional(), schemaName: z.string().optional(), @@ -1828,7 +1932,15 @@ export const marshalOnlineStoreConfigSchema = z online_store_name: d.onlineStoreName, })); -export const marshalSchemaConfigSchema = z +export const marshalRequestSourceSchema: z.ZodType = z + .object({ + flatSchema: z.lazy(() => marshalFlatSchemaSchema).optional(), + }) + .transform(d => ({ + flat_schema: d.flatSchema, + })); + +export const marshalSchemaConfigSchema: z.ZodType = z .object({ jsonSchema: z.string().optional(), }) @@ -1836,7 +1948,7 @@ export const marshalSchemaConfigSchema = z json_schema: d.jsonSchema, })); -export const marshalSlidingWindowSchema = z +export const marshalSlidingWindowSchema: z.ZodType = z .object({ windowDuration: z .any() @@ -1852,7 +1964,7 @@ export const marshalSlidingWindowSchema = z slide_duration: d.slideDuration, })); -export const marshalStddevPopFunctionSchema = z +export const marshalStddevPopFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1860,7 +1972,7 @@ export const marshalStddevPopFunctionSchema = z input: d.input, })); -export const marshalStddevSampFunctionSchema = z +export const marshalStddevSampFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1868,7 +1980,7 @@ export const marshalStddevSampFunctionSchema = z input: d.input, })); -export const marshalSubscriptionModeSchema = z +export const marshalSubscriptionModeSchema: z.ZodType = z .object({ assign: z.string().optional(), subscribe: z.string().optional(), @@ -1880,7 +1992,7 @@ export const marshalSubscriptionModeSchema = z subscribe_pattern: d.subscribePattern, })); -export const marshalSumFunctionSchema = z +export const marshalSumFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1888,7 +2000,7 @@ export const marshalSumFunctionSchema = z input: d.input, })); -export const marshalTimeWindowSchema = z +export const marshalTimeWindowSchema: z.ZodType = z .object({ continuous: z.lazy(() => marshalContinuousWindowSchema).optional(), tumbling: z.lazy(() => marshalTumblingWindowSchema).optional(), @@ -1900,7 +2012,7 @@ export const marshalTimeWindowSchema = z sliding: d.sliding, })); -export const marshalTimeseriesColumnSchema = z +export const marshalTimeseriesColumnSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -1908,7 +2020,7 @@ export const marshalTimeseriesColumnSchema = z name: d.name, })); -export const marshalTumblingWindowSchema = z +export const marshalTumblingWindowSchema: z.ZodType = z .object({ windowDuration: z .any() @@ -1919,7 +2031,7 @@ export const marshalTumblingWindowSchema = z window_duration: d.windowDuration, })); -export const marshalUpdateFeatureRequestSchema = z +export const marshalUpdateFeatureRequestSchema: z.ZodType = z .object({ feature: z.lazy(() => marshalFeatureSchema).optional(), updateMask: z.string().optional(), @@ -1929,7 +2041,7 @@ export const marshalUpdateFeatureRequestSchema = z update_mask: d.updateMask, })); -export const marshalUpdateKafkaConfigRequestSchema = z +export const marshalUpdateKafkaConfigRequestSchema: z.ZodType = z .object({ kafkaConfig: z.lazy(() => marshalKafkaConfigSchema).optional(), updateMask: z.string().optional(), @@ -1939,7 +2051,7 @@ export const marshalUpdateKafkaConfigRequestSchema = z update_mask: d.updateMask, })); -export const marshalUpdateMaterializedFeatureRequestSchema = z +export const marshalUpdateMaterializedFeatureRequestSchema: z.ZodType = z .object({ materializedFeature: z .lazy(() => marshalMaterializedFeatureSchema) @@ -1951,7 +2063,7 @@ export const marshalUpdateMaterializedFeatureRequestSchema = z update_mask: d.updateMask, })); -export const marshalVarPopFunctionSchema = z +export const marshalVarPopFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) @@ -1959,7 +2071,7 @@ export const marshalVarPopFunctionSchema = z input: d.input, })); -export const marshalVarSampFunctionSchema = z +export const marshalVarSampFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), }) diff --git a/packages/files/package.json b/packages/files/package.json index eef0d8b5..7d1ae448 100644 --- a/packages/files/package.json +++ b/packages/files/package.json @@ -1,12 +1,12 @@ { "name": "@databricks/sdk-files", "version": "0.1.0", - "description": "Databricks Files service client", + "description": "", "type": "module", "exports": { - "./v1": { - "types": "./dist/v1/index.d.ts", - "import": "./dist/v1/index.js" + "./v2": { + "types": "./dist/v2/index.d.ts", + "import": "./dist/v2/index.js" } }, "files": [ @@ -15,19 +15,21 @@ ], "scripts": { "build": "tsc -b", - "lint": "eslint src tests --ext .ts", - "lint:fix": "eslint src tests --ext .ts --fix", - "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"", - "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"", + "lint": "eslint src --ext .ts", + "lint:fix": "eslint src --ext .ts --fix", + "format": "prettier --write \"src/**/*.ts\"", + "format:check": "prettier --check \"src/**/*.ts\"", "typecheck": "tsc --noEmit", "clean": "rm -rf dist tsconfig.tsbuildinfo", - "test": "vitest run", - "test:browser": "vitest run --config vitest.config.browser.ts" + "test": "echo 'no tests'", + "test:browser": "echo 'no tests'" }, "author": "Databricks", "license": "Apache-2.0", "dependencies": { - "@databricks/sdk-databricks": "*" + "@databricks/sdk-databricks": "*", + "@js-temporal/polyfill": "^0.5.0", + "zod": "^4.3.6" }, "engines": { "node": ">=22.0.0" diff --git a/packages/files/src/v2/client.ts b/packages/files/src/v2/client.ts new file mode 100644 index 00000000..ae565c13 --- /dev/null +++ b/packages/files/src/v2/client.ts @@ -0,0 +1,723 @@ +// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT. + +import type {Call, Options} from '@databricks/sdk-databricks/api'; +import {execute} from '@databricks/sdk-databricks/api'; +import type {Logger} from '@databricks/sdk-databricks/logger'; +import {NoOpLogger} from '@databricks/sdk-databricks/logger'; +import type {ClientOptions} from '@databricks/sdk-databricks/options'; +import type { + HttpClient, + HttpRequest, +} from '@databricks/sdk-databricks/transport'; +import {newHttpClient} from '@databricks/sdk-databricks/transport'; +import { + buildHttpRequest, + executeHttpCall, + marshalRequest, + parseResponse, + sendAndCheckError, +} from './utils'; +import type { + AddBlock, + AddBlock_Response, + Close, + Close_Response, + Create, + CreateDirectoryRequest, + CreateDirectoryResponse, + Create_Response, + Delete, + DeleteDirectoryRequest, + DeleteDirectoryResponse, + DeleteFileRequest, + DeleteFileResponse, + Delete_Response, + DirectoryEntry, + DownloadFileRequest, + DownloadFileResponse, + GetDirectoryMetadataRequest, + GetDirectoryMetadataResponse, + GetFileMetadataRequest, + GetFileMetadataResponse, + GetStatus, + GetStatus_Response, + ListDirectoryContentsRequest, + ListDirectoryResponse, + ListStatus, + ListStatus_Response, + MkDirs, + MkDirs_Response, + Move, + Move_Response, + Put, + Put_Response, + Read, + Read_Response, + UploadFileRequest, + UploadFileResponse, +} from './model'; +import { + marshalAddBlockSchema, + marshalCloseSchema, + marshalCreateSchema, + marshalDeleteSchema, + marshalMkDirsSchema, + marshalMoveSchema, + marshalPutSchema, + unmarshalAddBlock_ResponseSchema, + unmarshalClose_ResponseSchema, + unmarshalCreateDirectoryResponseSchema, + unmarshalCreate_ResponseSchema, + unmarshalDeleteDirectoryResponseSchema, + unmarshalDeleteFileResponseSchema, + unmarshalDelete_ResponseSchema, + unmarshalGetDirectoryMetadataResponseSchema, + unmarshalGetFileMetadataResponseSchema, + unmarshalGetStatus_ResponseSchema, + unmarshalListDirectoryResponseSchema, + unmarshalListStatus_ResponseSchema, + unmarshalMkDirs_ResponseSchema, + unmarshalMove_ResponseSchema, + unmarshalPut_ResponseSchema, + unmarshalRead_ResponseSchema, + unmarshalUploadFileResponseSchema, +} from './model'; + +export class Client { + private readonly host: string; + private readonly httpClient: HttpClient; + private readonly logger: Logger; + + constructor(options: ClientOptions) { + if (options.host === undefined) { + throw new Error('Host is required.'); + } + this.host = options.host.replace(/\/$/, ''); + this.logger = options.logger ?? new NoOpLogger(); + this.httpClient = newHttpClient(options); + } + + /** + * Appends a block of data to the stream specified by the input handle. If the handle does not + * exist, this call will throw an exception with ``RESOURCE_DOES_NOT_EXIST``. + * + * If the block of data exceeds 1 MB, this call will throw an exception with ``MAX_BLOCK_SIZE_EXCEEDED``. + */ + async addBlock( + signal: AbortSignal | undefined, + req: AddBlock, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/add-block`; + const body = marshalRequest(req, marshalAddBlockSchema); + let resp: AddBlock_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalAddBlock_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Closes the stream specified by the input handle. If the handle does not exist, this call + * throws an exception with ``RESOURCE_DOES_NOT_EXIST``. + */ + async close( + signal: AbortSignal | undefined, + req: Close, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/close`; + const body = marshalRequest(req, marshalCloseSchema); + let resp: Close_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalClose_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Opens a stream to write to a file and returns a handle to this stream. + * There is a 10 minute idle timeout on this handle. If a file or directory already exists on the given path + * and __overwrite__ is set to false, this call will throw an exception with ``RESOURCE_ALREADY_EXISTS``. + * + * A typical workflow for file upload would be: + * + * 1. Issue a ``create`` call and get a handle. + * 2. Issue one or more ``add-block`` calls with the handle you have. + * 3. Issue a ``close`` call with the handle you have. + */ + async create( + signal: AbortSignal | undefined, + req: Create, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/create`; + const body = marshalRequest(req, marshalCreateSchema); + let resp: Create_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalCreate_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Delete the file or directory (optionally recursively delete all files in the directory). + * This call throws an exception with `IO_ERROR` if the path is a non-empty directory and `recursive` is set to + * `false` or on other similar errors. + * + * When you delete a large number of files, the delete operation is done in increments. The call returns + * a response after approximately 45 seconds with an error message (503 Service Unavailable) asking you to + * re-invoke the delete operation until the directory structure is fully deleted. + * + * For operations that delete more than 10K files, we discourage using the DBFS REST API, but advise you to + * perform such operations in the context of a cluster, using + * the [File system utility (dbutils.fs)](/dev-tools/databricks-utils.html#dbutils-fs). `dbutils.fs` + * covers the functional scope of the DBFS REST API, but from notebooks. Running such operations using notebooks + * provides better control and manageability, such as selective deletes, and the possibility to automate periodic + * delete jobs. + */ + async delete( + signal: AbortSignal | undefined, + req: Delete, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/delete`; + const body = marshalRequest(req, marshalDeleteSchema); + let resp: Delete_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalDelete_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Gets the file information for a file or directory. + * If the file or directory does not exist, this call throws an exception with `RESOURCE_DOES_NOT_EXIST`. + */ + async getStatus( + signal: AbortSignal | undefined, + req: GetStatus, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/get-status`; + const params = new URLSearchParams(); + if (req.path !== undefined) { + params.append('path', req.path); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + let resp: GetStatus_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('GET', fullUrl, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalGetStatus_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * List the contents of a directory, or details of the file. If the file or directory does not exist, this call + * throws an exception with `RESOURCE_DOES_NOT_EXIST`. + * + * When calling list on a large directory, the list operation will time out after approximately 60 seconds. + * We strongly recommend using list only on directories containing less than 10K files and discourage using + * the DBFS REST API for operations that list more than 10K files. Instead, we recommend that you perform such + * operations in the context of a cluster, using + * the [File system utility (dbutils.fs)](/dev-tools/databricks-utils.html#dbutils-fs), which provides the same + * functionality without timing out. + */ + async list( + signal: AbortSignal | undefined, + req: ListStatus, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/list`; + const params = new URLSearchParams(); + if (req.path !== undefined) { + params.append('path', req.path); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + let resp: ListStatus_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('GET', fullUrl, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalListStatus_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Creates the given directory and necessary parent directories if they do not exist. + * If a file (not a directory) exists at any prefix of the input path, this call throws an exception with `RESOURCE_ALREADY_EXISTS`. + * **Note**: If this operation fails, it might have succeeded in creating some of the necessary parent directories. + */ + async mkdirs( + signal: AbortSignal | undefined, + req: MkDirs, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/mkdirs`; + const body = marshalRequest(req, marshalMkDirsSchema); + let resp: MkDirs_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalMkDirs_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Moves a file from one location to another location within DBFS. + * If the source file does not exist, this call throws an exception with `RESOURCE_DOES_NOT_EXIST`. + * If a file already exists in the destination path, this call throws an exception with `RESOURCE_ALREADY_EXISTS`. + * If the given source path is a directory, this call always recursively moves all files. + */ + async move( + signal: AbortSignal | undefined, + req: Move, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/move`; + const body = marshalRequest(req, marshalMoveSchema); + let resp: Move_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalMove_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Uploads a file through the use of multipart form post. + * It is mainly used for streaming uploads, but can also be used as a convenient single call for data upload. + * + * Alternatively you can pass contents as base64 string. + * + * The amount of data that can be passed (when not streaming) using the __contents__ parameter is limited to 1 MB. + * `MAX_BLOCK_SIZE_EXCEEDED` will be thrown if this limit is exceeded. + * + * If you want to upload large files, use the streaming upload. For details, see :method:dbfs/create, + * :method:dbfs/addBlock, :method:dbfs/close. + */ + async put( + signal: AbortSignal | undefined, + req: Put, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/put`; + const body = marshalRequest(req, marshalPutSchema); + let resp: Put_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalPut_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Returns the contents of a file. If the file does not exist, this call throws an exception with `RESOURCE_DOES_NOT_EXIST`. + * If the path is a directory, the read length is negative, or if the offset is negative, this call throws an exception with + * `INVALID_PARAMETER_VALUE`. If the read length exceeds 1 MB, this call throws an + * exception with `MAX_READ_SIZE_EXCEEDED`. + * + * If `offset + length` exceeds the number of bytes in a file, it reads the contents until the end of file. + */ + async read( + signal: AbortSignal | undefined, + req: Read, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/dbfs/read`; + const params = new URLSearchParams(); + if (req.path !== undefined) { + params.append('path', req.path); + } + if (req.offset !== undefined) { + params.append('offset', String(req.offset)); + } + if (req.length !== undefined) { + params.append('length', String(req.length)); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + let resp: Read_Response | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('GET', fullUrl, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalRead_ResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Creates an empty directory. If necessary, also creates any parent directories of the + * new, empty directory (like the shell command `mkdir -p`). If called on an existing + * directory, returns a success response; this method is idempotent (it will succeed if the directory already + * exists). + */ + async createDirectory( + signal: AbortSignal | undefined, + req: CreateDirectoryRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/fs/directories${(req.directoryPath ?? '').split('/').map(encodeURIComponent).join('/')}`; + let resp: CreateDirectoryResponse | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('PUT', url, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalCreateDirectoryResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Deletes an empty directory. + * + * To delete a non-empty directory, first delete all of its contents. This can be done + * by listing the directory contents and deleting each file and subdirectory recursively. + */ + async deleteDirectory( + signal: AbortSignal | undefined, + req: DeleteDirectoryRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/fs/directories${(req.directoryPath ?? '').split('/').map(encodeURIComponent).join('/')}`; + let resp: DeleteDirectoryResponse | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('DELETE', url, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalDeleteDirectoryResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** Deletes a file. If the request is successful, there is no response body. */ + async deleteFile( + signal: AbortSignal | undefined, + req: DeleteFileRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/fs/files${(req.filePath ?? '').split('/').map(encodeURIComponent).join('/')}`; + let resp: DeleteFileResponse | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('DELETE', url, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalDeleteFileResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Downloads a file. The file contents are the response body. This is a + * standard HTTP file download, not a JSON RPC. It supports the + * Range and If-Unmodified-Since HTTP headers. + */ + async downloadFile( + signal: AbortSignal | undefined, + req: DownloadFileRequest + ): Promise { + const url = `${this.host}/api/2.0/fs/files${(req.filePath ?? '').split('/').map(encodeURIComponent).join('/')}`; + const params = new URLSearchParams(); + if (req.range !== undefined) { + params.append('Range', req.range); + } + if (req.ifUnmodifiedSince !== undefined) { + params.append('If-Unmodified-Since', req.ifUnmodifiedSince); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + const headers = new Headers(); + const httpReq: HttpRequest = { + url: fullUrl, + method: 'GET', + headers, + ...(signal !== undefined && {signal}), + }; + const resp = await sendAndCheckError({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + return { + contentLength: resp.headers.get('content-length') ?? undefined, + contentType: resp.headers.get('content-type') ?? undefined, + lastModified: resp.headers.get('last-modified') ?? undefined, + contents: resp.body ?? undefined, + }; + } + + /** + * Get the metadata of a directory. The response HTTP headers contain the metadata. + * There is no response body. + * + * This method is useful to check if a directory exists and the caller has access to it. + * + * If you wish to ensure the directory exists, you can instead use `PUT`, which will create + * the directory if it does not exist, and is idempotent (it will succeed if the directory + * already exists). + */ + async getDirectoryMetadata( + signal: AbortSignal | undefined, + req: GetDirectoryMetadataRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/fs/directories${(req.directoryPath ?? '').split('/').map(encodeURIComponent).join('/')}`; + let resp: GetDirectoryMetadataResponse | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('head', url, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse( + respBody, + unmarshalGetDirectoryMetadataResponseSchema + ); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Get the metadata of a file. The response HTTP headers contain the metadata. There is no + * response body. + */ + async getFileMetadata( + signal: AbortSignal | undefined, + req: GetFileMetadataRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/fs/files${(req.filePath ?? '').split('/').map(encodeURIComponent).join('/')}`; + const params = new URLSearchParams(); + if (req.range !== undefined) { + params.append('Range', req.range); + } + if (req.ifUnmodifiedSince !== undefined) { + params.append('If-Unmodified-Since', req.ifUnmodifiedSince); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + let resp: GetFileMetadataResponse | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('head', fullUrl, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalGetFileMetadataResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + /** + * Returns the contents of a directory. + * If there is no directory at the specified path, the API returns a HTTP 404 error. + */ + async listDirectoryContents( + signal: AbortSignal | undefined, + req: ListDirectoryContentsRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/fs/directories${(req.directoryPath ?? '').split('/').map(encodeURIComponent).join('/')}`; + const params = new URLSearchParams(); + if (req.pageSize !== undefined) { + params.append('page_size', String(req.pageSize)); + } + if (req.pageToken !== undefined) { + params.append('page_token', req.pageToken); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + let resp: ListDirectoryResponse | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('GET', fullUrl, callSignal); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalListDirectoryResponseSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + async *listDirectoryContentsIter( + signal: AbortSignal | undefined, + req: ListDirectoryContentsRequest, + options?: Options + ): AsyncGenerator { + const pageReq: ListDirectoryContentsRequest = {...req}; + for (;;) { + const resp = await this.listDirectoryContents(signal, pageReq, options); + for (const item of resp.contents ?? []) { + yield item; + } + if (resp.nextPageToken === undefined || resp.nextPageToken === '') { + return; + } + pageReq.pageToken = resp.nextPageToken; + } + } + + /** + * Uploads a file of up to 5 GiB. The file contents should be sent as the request body as + * raw bytes (an octet stream); do not encode or otherwise modify the bytes before sending. + * The contents of the resulting file will be exactly the bytes sent in the request body. + * If the request is successful, there is no response body. + */ + async uploadFile( + signal: AbortSignal | undefined, + req: UploadFileRequest + ): Promise { + const url = `${this.host}/api/2.0/fs/files${(req.filePath ?? '').split('/').map(encodeURIComponent).join('/')}`; + const params = new URLSearchParams(); + if (req.overwrite !== undefined) { + params.append('overwrite', String(req.overwrite)); + } + const query = params.toString(); + const fullUrl = query !== '' ? `${url}?${query}` : url; + const headers = new Headers(); + headers.set('Content-Type', 'application/octet-stream'); + const httpReq: HttpRequest = { + url: fullUrl, + method: 'PUT', + headers, + body: req.contents, + ...(signal !== undefined && {signal}), + }; + const resp = await sendAndCheckError({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + } +} diff --git a/packages/files/src/v2/index.ts b/packages/files/src/v2/index.ts new file mode 100644 index 00000000..537047f3 --- /dev/null +++ b/packages/files/src/v2/index.ts @@ -0,0 +1,46 @@ +// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT. + +export {Client} from './client'; + +export {} from './model'; + +export type { + AddBlock, + AddBlock_Response, + Close, + Close_Response, + Create, + Create_Response, + CreateDirectoryRequest, + CreateDirectoryResponse, + Delete, + Delete_Response, + DeleteDirectoryRequest, + DeleteDirectoryResponse, + DeleteFileRequest, + DeleteFileResponse, + DirectoryEntry, + DownloadFileRequest, + DownloadFileResponse, + FileInfo, + GetDirectoryMetadataRequest, + GetDirectoryMetadataResponse, + GetFileMetadataRequest, + GetFileMetadataResponse, + GetStatus, + GetStatus_Response, + ListDirectoryContentsRequest, + ListDirectoryResponse, + ListStatus, + ListStatus_Response, + MkDirs, + MkDirs_Response, + Move, + Move_Response, + Put, + Put_Response, + Read, + Read_Response, + UploadFileRequest, + UploadFileResponse, +} from './model'; diff --git a/packages/files/src/v2/model.ts b/packages/files/src/v2/model.ts new file mode 100644 index 00000000..6ed563b2 --- /dev/null +++ b/packages/files/src/v2/model.ts @@ -0,0 +1,981 @@ +// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT. + +import {z} from 'zod'; + +export interface AddBlock { + /** The handle on an open stream. */ + handle?: number | undefined; + /** The base64-encoded data to append to the stream. This has a limit of 1 MB. */ + data?: Uint8Array | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. +export interface AddBlock_Response {} + +export interface Close { + /** The handle on an open stream. */ + handle?: number | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. +export interface Close_Response {} + +export interface Create { + /** The path of the new file. The path should be the absolute DBFS path. */ + path?: string | undefined; + /** The flag that specifies whether to overwrite existing file/files. */ + overwrite?: boolean | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export interface Create_Response { + /** Handle which should subsequently be passed into the AddBlock and Close calls when writing to a file through a stream. */ + handle?: number | undefined; +} + +/** Create a directory */ +export interface CreateDirectoryRequest { + /** The absolute path of a directory. */ + directoryPath?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface CreateDirectoryResponse {} + +export interface Delete { + /** The path of the file or directory to delete. The path should be the absolute DBFS path. */ + path?: string | undefined; + /** Whether or not to recursively delete the directory's contents. Deleting empty directories can be done without providing the recursive flag. */ + recursive?: boolean | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. +export interface Delete_Response {} + +/** Delete a directory */ +export interface DeleteDirectoryRequest { + /** The absolute path of a directory. */ + directoryPath?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface DeleteDirectoryResponse {} + +/** Delete a file */ +export interface DeleteFileRequest { + /** The absolute path of the file. */ + filePath?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface DeleteFileResponse {} + +export interface DirectoryEntry { + /** The length of the file in bytes. This field is omitted for directories. */ + fileSize?: number | undefined; + /** True if the path is a directory. */ + isDirectory?: boolean | undefined; + /** Last modification time of given file in milliseconds since unix epoch. */ + lastModified?: number | undefined; + /** The name of the file or directory. This is the last component of the path. */ + name?: string | undefined; + /** The absolute path of the file or directory. */ + path?: string | undefined; +} + +/** Download a file */ +export interface DownloadFileRequest { + /** The absolute path of the file. */ + filePath?: string | undefined; + /** + * The range of bytes to retrieve. + * The range is inclusive and zero-based, see + * [RFC 9110](https://datatracker.ietf.org/doc/html/rfc9110#name-range) for further details. + */ + range?: string | undefined; + /** + * Download the file only if it has not been modified since the specified timestamp. + * If it has, a 412 Precondition Failed error will be returned. + * See [RFC 9110](https://datatracker.ietf.org/doc/html/rfc9110#name-if-unmodified-since) for further details. + */ + ifUnmodifiedSince?: string | undefined; +} + +export interface DownloadFileResponse { + /** The length of the HTTP response body in bytes. */ + contentLength?: number | undefined; + contentType?: string | undefined; + contents?: Uint8Array | undefined; + /** The last modified time of the file in HTTP-date (RFC 7231) format. */ + lastModified?: string | undefined; +} + +/** Stores the attributes of a file or directory. */ +export interface FileInfo { + /** The absolute path of the file or directory. */ + path?: string | undefined; + /** True if the path is a directory. */ + isDir?: boolean | undefined; + /** The length of the file in bytes. This field is omitted for directories. */ + fileSize?: number | undefined; + /** Last modification time of given file in milliseconds since epoch. */ + modificationTime?: number | undefined; +} + +/** Get directory metadata */ +export interface GetDirectoryMetadataRequest { + /** The absolute path of a directory. */ + directoryPath?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface GetDirectoryMetadataResponse {} + +/** Get file metadata */ +export interface GetFileMetadataRequest { + /** The absolute path of the file. */ + filePath?: string | undefined; + /** + * The range of bytes to retrieve. + * The range is inclusive and zero-based, see + * [RFC 9110](https://datatracker.ietf.org/doc/html/rfc9110#name-range) for further details. + */ + range?: string | undefined; + /** + * Download the file only if it has not been modified since the specified timestamp. + * If it has, a 412 Precondition Failed error will be returned. + * See [RFC 9110](https://datatracker.ietf.org/doc/html/rfc9110#name-if-unmodified-since) for further details. + */ + ifUnmodifiedSince?: string | undefined; +} + +export interface GetFileMetadataResponse { + /** The length of the HTTP response body in bytes. */ + contentLength?: number | undefined; + contentType?: string | undefined; + /** The last modified time of the file in HTTP-date (RFC 7231) format. */ + lastModified?: string | undefined; +} + +export interface GetStatus { + /** The path of the file or directory. The path should be the absolute DBFS path. */ + path?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export interface GetStatus_Response { + /** The absolute path of the file or directory. */ + path?: string | undefined; + /** True if the path is a directory. */ + isDir?: boolean | undefined; + /** The length of the file in bytes. This field is omitted for directories. */ + fileSize?: number | undefined; + /** Last modification time of given file in milliseconds since epoch. */ + modificationTime?: number | undefined; +} + +/** List directory contents */ +export interface ListDirectoryContentsRequest { + /** The absolute path of a directory. */ + directoryPath?: string | undefined; + /** + * The maximum number of directory entries to return. The response may contain fewer + * entries. If the response contains a `next_page_token`, there may be more entries, + * even if fewer than `page_size` entries are in the response. + * + * We recommend not to set this value unless you are intentionally listing less than + * the complete directory contents. + * + * If unspecified, at most 1000 directory entries will be returned. + * The maximum value is 1000. Values above 1000 will be coerced to 1000. + */ + pageSize?: number | undefined; + /** + * An opaque page token which was the `next_page_token` in the response of the previous + * request to list the contents of this directory. Provide this token to retrieve the + * next page of directory entries. + * When providing a `page_token`, all other parameters provided to the request must match + * the previous request. + * To list all of the entries in a directory, it is necessary to continue requesting + * pages of entries until the response contains no `next_page_token`. Note that the + * number of entries returned must not be used to determine when the listing is complete. + */ + pageToken?: string | undefined; +} + +export interface ListDirectoryResponse { + /** Array of DirectoryEntry. */ + contents?: DirectoryEntry[] | undefined; + /** A token, which can be sent as `page_token` to retrieve the next page. */ + nextPageToken?: string | undefined; +} + +export interface ListStatus { + /** The path of the file or directory. The path should be the absolute DBFS path. */ + path?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export interface ListStatus_Response { + /** A list of FileInfo's that describe contents of directory or file. See example above. */ + files?: FileInfo[] | undefined; +} + +export interface MkDirs { + /** The path of the new directory. The path should be the absolute DBFS path. */ + path?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. +export interface MkDirs_Response {} + +export interface Move { + /** The source path of the file or directory. The path should be the absolute DBFS path. */ + sourcePath?: string | undefined; + /** The destination path of the file or directory. The path should be the absolute DBFS path. */ + destinationPath?: string | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. +export interface Move_Response {} + +export interface Put { + /** The path of the new file. The path should be the absolute DBFS path. */ + path?: string | undefined; + /** This parameter might be absent, and instead a posted file will be used. */ + contents?: Uint8Array | undefined; + /** The flag that specifies whether to overwrite existing file/files. */ + overwrite?: boolean | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. +export interface Put_Response {} + +export interface Read { + /** The path of the file to read. The path should be the absolute DBFS path. */ + path?: string | undefined; + /** The offset to read from in bytes. */ + offset?: number | undefined; + /** + * The number of bytes to read starting from the offset. This has a limit of 1 MB, and a default + * value of 0.5 MB. + */ + length?: number | undefined; +} + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export interface Read_Response { + /** + * The number of bytes read (could be less than ``length`` if we hit end of file). This refers to + * number of bytes read in unencoded version (response data is base64-encoded). + */ + bytesRead?: number | undefined; + /** The base64-encoded contents of the file read. */ + data?: Uint8Array | undefined; +} + +/** Upload a file */ +export interface UploadFileRequest { + /** The absolute path of the file. */ + filePath?: string | undefined; + contents?: Uint8Array | undefined; + /** If true or unspecified, an existing file will be overwritten. If false, an error will be returned if the path points to an existing file. */ + overwrite?: boolean | undefined; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-object-type +export interface UploadFileResponse {} + +export const unmarshalAddBlockSchema: z.ZodType = z + .object({ + handle: z.number().optional(), + data: z + .string() + .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0))) + .optional(), + }) + .transform(d => ({ + handle: d.handle, + data: d.data, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalAddBlock_ResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalCloseSchema: z.ZodType = z + .object({ + handle: z.number().optional(), + }) + .transform(d => ({ + handle: d.handle, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalClose_ResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalCreateSchema: z.ZodType = z + .object({ + path: z.string().optional(), + overwrite: z.boolean().optional(), + }) + .transform(d => ({ + path: d.path, + overwrite: d.overwrite, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalCreate_ResponseSchema: z.ZodType = z + .object({ + handle: z.number().optional(), + }) + .transform(d => ({ + handle: d.handle, + })); + +export const unmarshalCreateDirectoryRequestSchema: z.ZodType = + z + .object({ + directory_path: z.string().optional(), + }) + .transform(d => ({ + directoryPath: d.directory_path, + })); + +export const unmarshalCreateDirectoryResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalDeleteSchema: z.ZodType = z + .object({ + path: z.string().optional(), + recursive: z.boolean().optional(), + }) + .transform(d => ({ + path: d.path, + recursive: d.recursive, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalDelete_ResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalDeleteDirectoryRequestSchema: z.ZodType = + z + .object({ + directory_path: z.string().optional(), + }) + .transform(d => ({ + directoryPath: d.directory_path, + })); + +export const unmarshalDeleteDirectoryResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalDeleteFileRequestSchema: z.ZodType = z + .object({ + file_path: z.string().optional(), + }) + .transform(d => ({ + filePath: d.file_path, + })); + +export const unmarshalDeleteFileResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalDirectoryEntrySchema: z.ZodType = z + .object({ + file_size: z.number().optional(), + is_directory: z.boolean().optional(), + last_modified: z.number().optional(), + name: z.string().optional(), + path: z.string().optional(), + }) + .transform(d => ({ + fileSize: d.file_size, + isDirectory: d.is_directory, + lastModified: d.last_modified, + name: d.name, + path: d.path, + })); + +export const unmarshalDownloadFileRequestSchema: z.ZodType = + z + .object({ + file_path: z.string().optional(), + Range: z.string().optional(), + 'If-Unmodified-Since': z.string().optional(), + }) + .transform(d => ({ + filePath: d.file_path, + range: d.Range, + ifUnmodifiedSince: d['If-Unmodified-Since'], + })); + +export const unmarshalDownloadFileResponseSchema: z.ZodType = + z + .object({ + 'content-length': z.number().optional(), + 'content-type': z.string().optional(), + contents: z + .string() + .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0))) + .optional(), + 'last-modified': z.string().optional(), + }) + .transform(d => ({ + contentLength: d['content-length'], + contentType: d['content-type'], + contents: d.contents, + lastModified: d['last-modified'], + })); + +export const unmarshalFileInfoSchema: z.ZodType = z + .object({ + path: z.string().optional(), + is_dir: z.boolean().optional(), + file_size: z.number().optional(), + modification_time: z.number().optional(), + }) + .transform(d => ({ + path: d.path, + isDir: d.is_dir, + fileSize: d.file_size, + modificationTime: d.modification_time, + })); + +export const unmarshalGetDirectoryMetadataRequestSchema: z.ZodType = + z + .object({ + directory_path: z.string().optional(), + }) + .transform(d => ({ + directoryPath: d.directory_path, + })); + +export const unmarshalGetDirectoryMetadataResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalGetFileMetadataRequestSchema: z.ZodType = + z + .object({ + file_path: z.string().optional(), + Range: z.string().optional(), + 'If-Unmodified-Since': z.string().optional(), + }) + .transform(d => ({ + filePath: d.file_path, + range: d.Range, + ifUnmodifiedSince: d['If-Unmodified-Since'], + })); + +export const unmarshalGetFileMetadataResponseSchema: z.ZodType = + z + .object({ + 'content-length': z.number().optional(), + 'content-type': z.string().optional(), + 'last-modified': z.string().optional(), + }) + .transform(d => ({ + contentLength: d['content-length'], + contentType: d['content-type'], + lastModified: d['last-modified'], + })); + +export const unmarshalGetStatusSchema: z.ZodType = z + .object({ + path: z.string().optional(), + }) + .transform(d => ({ + path: d.path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalGetStatus_ResponseSchema: z.ZodType = + z + .object({ + path: z.string().optional(), + is_dir: z.boolean().optional(), + file_size: z.number().optional(), + modification_time: z.number().optional(), + }) + .transform(d => ({ + path: d.path, + isDir: d.is_dir, + fileSize: d.file_size, + modificationTime: d.modification_time, + })); + +export const unmarshalListDirectoryContentsRequestSchema: z.ZodType = + z + .object({ + directory_path: z.string().optional(), + page_size: z.number().optional(), + page_token: z.string().optional(), + }) + .transform(d => ({ + directoryPath: d.directory_path, + pageSize: d.page_size, + pageToken: d.page_token, + })); + +export const unmarshalListDirectoryResponseSchema: z.ZodType = + z + .object({ + contents: z.array(z.lazy(() => unmarshalDirectoryEntrySchema)).optional(), + next_page_token: z.string().optional(), + }) + .transform(d => ({ + contents: d.contents, + nextPageToken: d.next_page_token, + })); + +export const unmarshalListStatusSchema: z.ZodType = z + .object({ + path: z.string().optional(), + }) + .transform(d => ({ + path: d.path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalListStatus_ResponseSchema: z.ZodType = + z + .object({ + files: z.array(z.lazy(() => unmarshalFileInfoSchema)).optional(), + }) + .transform(d => ({ + files: d.files, + })); + +export const unmarshalMkDirsSchema: z.ZodType = z + .object({ + path: z.string().optional(), + }) + .transform(d => ({ + path: d.path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalMkDirs_ResponseSchema: z.ZodType = + z.object({}); + +export const unmarshalMoveSchema: z.ZodType = z + .object({ + source_path: z.string().optional(), + destination_path: z.string().optional(), + }) + .transform(d => ({ + sourcePath: d.source_path, + destinationPath: d.destination_path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalMove_ResponseSchema: z.ZodType = z.object( + {} +); + +export const unmarshalPutSchema: z.ZodType = z + .object({ + path: z.string().optional(), + contents: z + .string() + .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0))) + .optional(), + overwrite: z.boolean().optional(), + }) + .transform(d => ({ + path: d.path, + contents: d.contents, + overwrite: d.overwrite, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalPut_ResponseSchema: z.ZodType = z.object( + {} +); + +export const unmarshalReadSchema: z.ZodType = z + .object({ + path: z.string().optional(), + offset: z.number().optional(), + length: z.number().optional(), + }) + .transform(d => ({ + path: d.path, + offset: d.offset, + length: d.length, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const unmarshalRead_ResponseSchema: z.ZodType = z + .object({ + bytes_read: z.number().optional(), + data: z + .string() + .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0))) + .optional(), + }) + .transform(d => ({ + bytesRead: d.bytes_read, + data: d.data, + })); + +export const unmarshalUploadFileRequestSchema: z.ZodType = z + .object({ + file_path: z.string().optional(), + contents: z + .string() + .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0))) + .optional(), + overwrite: z.boolean().optional(), + }) + .transform(d => ({ + filePath: d.file_path, + contents: d.contents, + overwrite: d.overwrite, + })); + +export const unmarshalUploadFileResponseSchema: z.ZodType = + z.object({}); + +export const marshalAddBlockSchema: z.ZodType = z + .object({ + handle: z.number().optional(), + data: z + .any() + .transform((d: Uint8Array) => + btoa(Array.from(d, b => String.fromCharCode(b)).join('')) + ) + .optional(), + }) + .transform(d => ({ + handle: d.handle, + data: d.data, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalAddBlock_ResponseSchema: z.ZodType = z.object({}); + +export const marshalCloseSchema: z.ZodType = z + .object({ + handle: z.number().optional(), + }) + .transform(d => ({ + handle: d.handle, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalClose_ResponseSchema: z.ZodType = z.object({}); + +export const marshalCreateSchema: z.ZodType = z + .object({ + path: z.string().optional(), + overwrite: z.boolean().optional(), + }) + .transform(d => ({ + path: d.path, + overwrite: d.overwrite, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalCreate_ResponseSchema: z.ZodType = z + .object({ + handle: z.number().optional(), + }) + .transform(d => ({ + handle: d.handle, + })); + +export const marshalCreateDirectoryRequestSchema: z.ZodType = z + .object({ + directoryPath: z.string().optional(), + }) + .transform(d => ({ + directory_path: d.directoryPath, + })); + +export const marshalCreateDirectoryResponseSchema: z.ZodType = z.object({}); + +export const marshalDeleteSchema: z.ZodType = z + .object({ + path: z.string().optional(), + recursive: z.boolean().optional(), + }) + .transform(d => ({ + path: d.path, + recursive: d.recursive, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalDelete_ResponseSchema: z.ZodType = z.object({}); + +export const marshalDeleteDirectoryRequestSchema: z.ZodType = z + .object({ + directoryPath: z.string().optional(), + }) + .transform(d => ({ + directory_path: d.directoryPath, + })); + +export const marshalDeleteDirectoryResponseSchema: z.ZodType = z.object({}); + +export const marshalDeleteFileRequestSchema: z.ZodType = z + .object({ + filePath: z.string().optional(), + }) + .transform(d => ({ + file_path: d.filePath, + })); + +export const marshalDeleteFileResponseSchema: z.ZodType = z.object({}); + +export const marshalDirectoryEntrySchema: z.ZodType = z + .object({ + fileSize: z.number().optional(), + isDirectory: z.boolean().optional(), + lastModified: z.number().optional(), + name: z.string().optional(), + path: z.string().optional(), + }) + .transform(d => ({ + file_size: d.fileSize, + is_directory: d.isDirectory, + last_modified: d.lastModified, + name: d.name, + path: d.path, + })); + +export const marshalDownloadFileRequestSchema: z.ZodType = z + .object({ + filePath: z.string().optional(), + range: z.string().optional(), + ifUnmodifiedSince: z.string().optional(), + }) + .transform(d => ({ + file_path: d.filePath, + Range: d.range, + 'If-Unmodified-Since': d.ifUnmodifiedSince, + })); + +export const marshalDownloadFileResponseSchema: z.ZodType = z + .object({ + contentLength: z.number().optional(), + contentType: z.string().optional(), + contents: z + .any() + .transform((d: Uint8Array) => + btoa(Array.from(d, b => String.fromCharCode(b)).join('')) + ) + .optional(), + lastModified: z.string().optional(), + }) + .transform(d => ({ + 'content-length': d.contentLength, + 'content-type': d.contentType, + contents: d.contents, + 'last-modified': d.lastModified, + })); + +export const marshalFileInfoSchema: z.ZodType = z + .object({ + path: z.string().optional(), + isDir: z.boolean().optional(), + fileSize: z.number().optional(), + modificationTime: z.number().optional(), + }) + .transform(d => ({ + path: d.path, + is_dir: d.isDir, + file_size: d.fileSize, + modification_time: d.modificationTime, + })); + +export const marshalGetDirectoryMetadataRequestSchema: z.ZodType = z + .object({ + directoryPath: z.string().optional(), + }) + .transform(d => ({ + directory_path: d.directoryPath, + })); + +export const marshalGetDirectoryMetadataResponseSchema: z.ZodType = z.object( + {} +); + +export const marshalGetFileMetadataRequestSchema: z.ZodType = z + .object({ + filePath: z.string().optional(), + range: z.string().optional(), + ifUnmodifiedSince: z.string().optional(), + }) + .transform(d => ({ + file_path: d.filePath, + Range: d.range, + 'If-Unmodified-Since': d.ifUnmodifiedSince, + })); + +export const marshalGetFileMetadataResponseSchema: z.ZodType = z + .object({ + contentLength: z.number().optional(), + contentType: z.string().optional(), + lastModified: z.string().optional(), + }) + .transform(d => ({ + 'content-length': d.contentLength, + 'content-type': d.contentType, + 'last-modified': d.lastModified, + })); + +export const marshalGetStatusSchema: z.ZodType = z + .object({ + path: z.string().optional(), + }) + .transform(d => ({ + path: d.path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalGetStatus_ResponseSchema: z.ZodType = z + .object({ + path: z.string().optional(), + isDir: z.boolean().optional(), + fileSize: z.number().optional(), + modificationTime: z.number().optional(), + }) + .transform(d => ({ + path: d.path, + is_dir: d.isDir, + file_size: d.fileSize, + modification_time: d.modificationTime, + })); + +export const marshalListDirectoryContentsRequestSchema: z.ZodType = z + .object({ + directoryPath: z.string().optional(), + pageSize: z.number().optional(), + pageToken: z.string().optional(), + }) + .transform(d => ({ + directory_path: d.directoryPath, + page_size: d.pageSize, + page_token: d.pageToken, + })); + +export const marshalListDirectoryResponseSchema: z.ZodType = z + .object({ + contents: z.array(z.lazy(() => marshalDirectoryEntrySchema)).optional(), + nextPageToken: z.string().optional(), + }) + .transform(d => ({ + contents: d.contents, + next_page_token: d.nextPageToken, + })); + +export const marshalListStatusSchema: z.ZodType = z + .object({ + path: z.string().optional(), + }) + .transform(d => ({ + path: d.path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalListStatus_ResponseSchema: z.ZodType = z + .object({ + files: z.array(z.lazy(() => marshalFileInfoSchema)).optional(), + }) + .transform(d => ({ + files: d.files, + })); + +export const marshalMkDirsSchema: z.ZodType = z + .object({ + path: z.string().optional(), + }) + .transform(d => ({ + path: d.path, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalMkDirs_ResponseSchema: z.ZodType = z.object({}); + +export const marshalMoveSchema: z.ZodType = z + .object({ + sourcePath: z.string().optional(), + destinationPath: z.string().optional(), + }) + .transform(d => ({ + source_path: d.sourcePath, + destination_path: d.destinationPath, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalMove_ResponseSchema: z.ZodType = z.object({}); + +export const marshalPutSchema: z.ZodType = z + .object({ + path: z.string().optional(), + contents: z + .any() + .transform((d: Uint8Array) => + btoa(Array.from(d, b => String.fromCharCode(b)).join('')) + ) + .optional(), + overwrite: z.boolean().optional(), + }) + .transform(d => ({ + path: d.path, + contents: d.contents, + overwrite: d.overwrite, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalPut_ResponseSchema: z.ZodType = z.object({}); + +export const marshalReadSchema: z.ZodType = z + .object({ + path: z.string().optional(), + offset: z.number().optional(), + length: z.number().optional(), + }) + .transform(d => ({ + path: d.path, + offset: d.offset, + length: d.length, + })); + +// eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. +export const marshalRead_ResponseSchema: z.ZodType = z + .object({ + bytesRead: z.number().optional(), + data: z + .any() + .transform((d: Uint8Array) => + btoa(Array.from(d, b => String.fromCharCode(b)).join('')) + ) + .optional(), + }) + .transform(d => ({ + bytes_read: d.bytesRead, + data: d.data, + })); + +export const marshalUploadFileRequestSchema: z.ZodType = z + .object({ + filePath: z.string().optional(), + contents: z + .any() + .transform((d: Uint8Array) => + btoa(Array.from(d, b => String.fromCharCode(b)).join('')) + ) + .optional(), + overwrite: z.boolean().optional(), + }) + .transform(d => ({ + file_path: d.filePath, + contents: d.contents, + overwrite: d.overwrite, + })); + +export const marshalUploadFileResponseSchema: z.ZodType = z.object({}); diff --git a/packages/files/src/v2/utils.ts b/packages/files/src/v2/utils.ts new file mode 100644 index 00000000..7d70114c --- /dev/null +++ b/packages/files/src/v2/utils.ts @@ -0,0 +1,165 @@ +// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT. + +import {APIError} from '@databricks/sdk-databricks/apierror'; +import type {Logger} from '@databricks/sdk-databricks/logger'; +import type { + HttpClient, + HttpRequest, + HttpResponse, +} from '@databricks/sdk-databricks/transport'; +import type {z} from 'zod'; + +export interface HttpCallOptions { + readonly request: HttpRequest; + readonly httpClient: HttpClient; + readonly logger: Logger; +} + +async function readAll( + body: ReadableStream | null +): Promise { + if (body === null) { + return new Uint8Array(0); + } + const reader = body.getReader(); + const chunks: Uint8Array[] = []; + for (;;) { + const {done, value} = await reader.read(); + if (done) { + break; + } + chunks.push(value); + } + const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0); + const result = new Uint8Array(totalLength); + let offset = 0; + for (const chunk of chunks) { + result.set(chunk, offset); + offset += chunk.length; + } + return result; +} + +export async function executeHttpCall( + opts: HttpCallOptions +): Promise { + opts.logger.debug('HTTP request', { + method: opts.request.method, + url: opts.request.url, + }); + + let resp: HttpResponse; + try { + resp = await opts.httpClient.send(opts.request); + } catch (e: unknown) { + opts.logger.debug('HTTP request failed'); + throw e; + } + + const body = await readAll(resp.body); + + opts.logger.debug('HTTP response', { + statusCode: resp.statusCode, + body: new TextDecoder().decode(body), + }); + + const apiErr = APIError.fromHttpError(resp.statusCode, resp.headers, body); + if (apiErr !== undefined) { + throw apiErr; + } + + return body; +} + +export function buildHttpRequest( + method: string, + url: string, + signal?: AbortSignal, + body?: string +): HttpRequest { + const headers = new Headers(); + headers.set('Content-Type', 'application/json'); + + const req: HttpRequest = {url, method, headers}; + if (body !== undefined) { + req.body = body; + } + if (signal !== undefined) { + req.signal = signal; + } + return req; +} + +export function parseResponse(body: Uint8Array, schema: z.ZodType): T { + const text = new TextDecoder().decode(body); + const parsed: unknown = JSON.parse(text); + return schema.parse(parsed); +} + +export function marshalRequest(data: unknown, schema: z.ZodType): string { + return JSON.stringify(schema.parse(data)); +} + +export function flattenQueryParams( + prefix: string, + value: unknown, + params: URLSearchParams +): void { + if (value === null || value === undefined) { + return; + } + if (Array.isArray(value)) { + // arrays of objects are not yet supported + for (const item of value) { + params.append(prefix, String(item)); + } + } else if (typeof value === 'object') { + for (const [key, val] of Object.entries(value as Record)) { + flattenQueryParams(`${prefix}.${key}`, val, params); + } + } else if ( + typeof value === 'string' || + typeof value === 'number' || + typeof value === 'boolean' || + typeof value === 'bigint' + ) { + params.append(prefix, String(value)); + } else { + throw new Error(`Unsupported query parameter type: ${typeof value}`); + } +} + +/** + * Sends an HTTP request and checks for API errors. On non-2xx responses the + * body is buffered and parsed into an APIError. On 2xx the raw HttpResponse + * is returned with the body stream untouched. + */ +export async function sendAndCheckError( + opts: HttpCallOptions +): Promise { + opts.logger.debug('HTTP request', { + method: opts.request.method, + url: opts.request.url, + }); + + let resp: HttpResponse; + try { + resp = await opts.httpClient.send(opts.request); + } catch (e: unknown) { + opts.logger.debug('HTTP request failed'); + throw e; + } + + opts.logger.debug('HTTP response', {statusCode: resp.statusCode}); + + if (resp.statusCode < 200 || resp.statusCode >= 300) { + const body = await readAll(resp.body); + const apiErr = APIError.fromHttpError(resp.statusCode, resp.headers, body); + if (apiErr !== undefined) { + throw apiErr; + } + throw new Error(`unexpected HTTP status ${String(resp.statusCode)}`); + } + + return resp; +} diff --git a/packages/oauthcustomappintegration/src/v1/model.ts b/packages/oauthcustomappintegration/src/v1/model.ts index 2132cede..8896912a 100644 --- a/packages/oauthcustomappintegration/src/v1/model.ts +++ b/packages/oauthcustomappintegration/src/v1/model.ts @@ -503,7 +503,7 @@ export const unmarshalUpdatePublishedOAuthAppIntegrationSchema: z.ZodType = z.object({}); -export const marshalCreateCustomOAuthAppIntegrationSchema = z +export const marshalCreateCustomOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), redirectUrls: z.array(z.string()).optional(), @@ -523,7 +523,7 @@ export const marshalCreateCustomOAuthAppIntegrationSchema = z user_authorized_scopes: d.userAuthorizedScopes, })); -export const marshalCreatePublishedOAuthAppIntegrationSchema = z +export const marshalCreatePublishedOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), appId: z.string().optional(), @@ -536,15 +536,16 @@ export const marshalCreatePublishedOAuthAppIntegrationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalCreatePublishedOAuthAppIntegration_ResponseSchema = z - .object({ - integrationId: z.string().optional(), - }) - .transform(d => ({ - integration_id: d.integrationId, - })); +export const marshalCreatePublishedOAuthAppIntegration_ResponseSchema: z.ZodType = + z + .object({ + integrationId: z.string().optional(), + }) + .transform(d => ({ + integration_id: d.integrationId, + })); -export const marshalCustomOAuthAppIntegrationSchema = z +export const marshalCustomOAuthAppIntegrationSchema: z.ZodType = z .object({ integrationId: z.string().optional(), clientId: z.string().optional(), @@ -574,7 +575,7 @@ export const marshalCustomOAuthAppIntegrationSchema = z principal_id: d.principalId, })); -export const marshalCustomOAuthAppIntegrationSecretSchema = z +export const marshalCustomOAuthAppIntegrationSecretSchema: z.ZodType = z .object({ integrationId: z.string().optional(), clientId: z.string().optional(), @@ -593,7 +594,7 @@ export const marshalCustomOAuthAppIntegrationSecretSchema = z client_secret_expire_time: d.clientSecretExpireTime, })); -export const marshalDeleteCustomOAuthAppIntegrationSchema = z +export const marshalDeleteCustomOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -604,11 +605,10 @@ export const marshalDeleteCustomOAuthAppIntegrationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDeleteCustomOAuthAppIntegration_ResponseSchema = z.object( - {} -); +export const marshalDeleteCustomOAuthAppIntegration_ResponseSchema: z.ZodType = + z.object({}); -export const marshalDeletePublishedOAuthAppIntegrationSchema = z +export const marshalDeletePublishedOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -619,10 +619,10 @@ export const marshalDeletePublishedOAuthAppIntegrationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDeletePublishedOAuthAppIntegration_ResponseSchema = +export const marshalDeletePublishedOAuthAppIntegration_ResponseSchema: z.ZodType = z.object({}); -export const marshalGetCustomOAuthAppIntegrationSchema = z +export const marshalGetCustomOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -632,7 +632,7 @@ export const marshalGetCustomOAuthAppIntegrationSchema = z integration_id: d.integrationId, })); -export const marshalGetPublishedOAuthAppIntegrationSchema = z +export const marshalGetPublishedOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -642,7 +642,7 @@ export const marshalGetPublishedOAuthAppIntegrationSchema = z integration_id: d.integrationId, })); -export const marshalListCustomOAuthAppIntegrationsSchema = z +export const marshalListCustomOAuthAppIntegrationsSchema: z.ZodType = z .object({ accountId: z.string().optional(), pageToken: z.string().optional(), @@ -657,7 +657,7 @@ export const marshalListCustomOAuthAppIntegrationsSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalListCustomOAuthAppIntegrations_ResponseSchema = z +export const marshalListCustomOAuthAppIntegrations_ResponseSchema: z.ZodType = z .object({ apps: z .array(z.lazy(() => marshalCustomOAuthAppIntegrationSchema)) @@ -669,7 +669,7 @@ export const marshalListCustomOAuthAppIntegrations_ResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListPublishedOAuthAppIntegrationsSchema = z +export const marshalListPublishedOAuthAppIntegrationsSchema: z.ZodType = z .object({ accountId: z.string().optional(), pageToken: z.string().optional(), @@ -682,19 +682,20 @@ export const marshalListPublishedOAuthAppIntegrationsSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalListPublishedOAuthAppIntegrations_ResponseSchema = z - .object({ - apps: z - .array(z.lazy(() => marshalPublishedOAuthAppIntegrationSchema)) - .optional(), - nextPageToken: z.string().optional(), - }) - .transform(d => ({ - apps: d.apps, - next_page_token: d.nextPageToken, - })); +export const marshalListPublishedOAuthAppIntegrations_ResponseSchema: z.ZodType = + z + .object({ + apps: z + .array(z.lazy(() => marshalPublishedOAuthAppIntegrationSchema)) + .optional(), + nextPageToken: z.string().optional(), + }) + .transform(d => ({ + apps: d.apps, + next_page_token: d.nextPageToken, + })); -export const marshalPublishedOAuthAppIntegrationSchema = z +export const marshalPublishedOAuthAppIntegrationSchema: z.ZodType = z .object({ appId: z.string().optional(), integrationId: z.string().optional(), @@ -712,7 +713,7 @@ export const marshalPublishedOAuthAppIntegrationSchema = z create_time: d.createTime, })); -export const marshalTokenAccessPolicySchema = z +export const marshalTokenAccessPolicySchema: z.ZodType = z .object({ accessTokenTtlInMinutes: z.number().optional(), refreshTokenTtlInMinutes: z.number().optional(), @@ -726,7 +727,7 @@ export const marshalTokenAccessPolicySchema = z absolute_session_lifetime_in_minutes: d.absoluteSessionLifetimeInMinutes, })); -export const marshalUpdateCustomOAuthAppIntegrationSchema = z +export const marshalUpdateCustomOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -745,11 +746,10 @@ export const marshalUpdateCustomOAuthAppIntegrationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalUpdateCustomOAuthAppIntegration_ResponseSchema = z.object( - {} -); +export const marshalUpdateCustomOAuthAppIntegration_ResponseSchema: z.ZodType = + z.object({}); -export const marshalUpdatePublishedOAuthAppIntegrationSchema = z +export const marshalUpdatePublishedOAuthAppIntegrationSchema: z.ZodType = z .object({ accountId: z.string().optional(), integrationId: z.string().optional(), @@ -762,5 +762,5 @@ export const marshalUpdatePublishedOAuthAppIntegrationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalUpdatePublishedOAuthAppIntegration_ResponseSchema = +export const marshalUpdatePublishedOAuthAppIntegration_ResponseSchema: z.ZodType = z.object({}); diff --git a/packages/postgres/src/v1/client.ts b/packages/postgres/src/v1/client.ts index dca7c85e..b2960fa6 100644 --- a/packages/postgres/src/v1/client.ts +++ b/packages/postgres/src/v1/client.ts @@ -78,6 +78,7 @@ import type { SyncedTable, SyncedTableOperationMetadata, Table, + UndeleteBranchRequest, UpdateBranchRequest, UpdateDatabaseRequest, UpdateEndpointRequest, @@ -94,6 +95,7 @@ import { marshalRoleSchema, marshalSyncedTableSchema, marshalTableSchema, + marshalUndeleteBranchRequestSchema, unmarshalBranchOperationMetadataSchema, unmarshalBranchSchema, unmarshalCatalogOperationMetadataSchema, @@ -457,6 +459,9 @@ export class Client { if (req.purge !== undefined) { params.append('purge', String(req.purge)); } + if (req.allowMissing !== undefined) { + params.append('allow_missing', String(req.allowMissing)); + } const query = params.toString(); const fullUrl = query !== '' ? `${url}?${query}` : url; let resp: Operation | undefined; @@ -1097,6 +1102,9 @@ export class Client { if (req.pageSize !== undefined) { params.append('page_size', String(req.pageSize)); } + if (req.showDeleted !== undefined) { + params.append('show_deleted', String(req.showDeleted)); + } const query = params.toString(); const fullUrl = query !== '' ? `${url}?${query}` : url; let resp: ListBranchesResponse | undefined; @@ -1398,6 +1406,40 @@ export class Client { } } + /** Undeletes the specified database branch. */ + async undeleteBranch( + signal: AbortSignal | undefined, + req: UndeleteBranchRequest, + options?: Options + ): Promise { + const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`; + const body = marshalRequest(req, marshalUndeleteBranchRequestSchema); + let resp: Operation | undefined; + const call: Call = async (callSignal?: AbortSignal): Promise => { + const httpReq = buildHttpRequest('POST', url, callSignal, body); + const respBody = await executeHttpCall({ + request: httpReq, + httpClient: this.httpClient, + logger: this.logger, + }); + resp = parseResponse(respBody, unmarshalOperationSchema); + }; + await execute(signal, call, options); + if (resp === undefined) { + throw new Error('API call completed without a result.'); + } + return resp; + } + + async undeleteBranchOperation( + signal: AbortSignal | undefined, + req: UndeleteBranchRequest, + options?: Options + ): Promise { + const op = await this.undeleteBranch(signal, req, options); + return new UndeleteBranchOperation(this, op); + } + /** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */ async updateBranch( signal: AbortSignal | undefined, @@ -2922,6 +2964,95 @@ export class DeleteSyncedTableOperation { } } +export class UndeleteBranchOperation { + constructor( + private readonly client: Client, + private operation: Operation + ) {} + + /** Returns the server-assigned name of the long-running operation. */ + name(): Promise { + return Promise.resolve(this.operation.name); + } + + /** Returns metadata associated with the long-running operation. */ + metadata(): Promise { + if (this.operation.metadata === undefined) { + return Promise.resolve(undefined); + } + return Promise.resolve( + z + .lazy(() => unmarshalBranchOperationMetadataSchema) + .parse(this.operation.metadata) + ); + } + + /** + * Polls the operation until it completes. + * + * Throws if the operation failed. + */ + async wait( + signal: AbortSignal | undefined, + options?: Options + ): Promise { + const errStillRunning = new Error('operation still in progress'); + + const call: Call = async (callSignal?: AbortSignal): Promise => { + const op = await this.client.getOperation( + callSignal, + { + name: this.operation.name, + }, + options + ); + this.operation = op; + if (op.done === undefined) { + throw new Error('operation is missing the done field'); + } + if (!op.done) { + throw errStillRunning; + } + + if (op.error !== undefined) { + const msg = + op.error.message !== undefined && op.error.message !== '' + ? op.error.message + : 'unknown error'; + const errorMsg = + op.error.errorCode !== undefined + ? `[${op.error.errorCode}] ${msg}` + : msg; + throw new Error(`operation failed: ${errorMsg}`, { + cause: op.error, + }); + } + }; + + const retryOptions: Options = { + retrier: () => + retryOn({}, (err: Error) => { + return err.message.includes('operation still in progress'); + }), + }; + await execute(signal, call, retryOptions); + } + + /** Checks whether the operation has completed */ + async done( + signal: AbortSignal | undefined, + options?: Options + ): Promise { + const op = await this.client.getOperation( + signal, + {name: this.operation.name}, + options + ); + this.operation = op; + return op.done; + } +} + export class UpdateBranchOperation { constructor( private readonly client: Client, diff --git a/packages/postgres/src/v1/index.ts b/packages/postgres/src/v1/index.ts index ffac7291..df1993b1 100644 --- a/packages/postgres/src/v1/index.ts +++ b/packages/postgres/src/v1/index.ts @@ -16,6 +16,7 @@ export { DeleteProjectOperation, DeleteRoleOperation, DeleteSyncedTableOperation, + UndeleteBranchOperation, UpdateBranchOperation, UpdateDatabaseOperation, UpdateEndpointOperation, @@ -140,6 +141,7 @@ export type { SyncedTablePipelineProgress, SyncedTablePosition, Table, + UndeleteBranchRequest, UpdateBranchRequest, UpdateDatabaseRequest, UpdateEndpointRequest, diff --git a/packages/postgres/src/v1/model.ts b/packages/postgres/src/v1/model.ts index 3a2083fc..bed051d3 100644 --- a/packages/postgres/src/v1/model.ts +++ b/packages/postgres/src/v1/model.ts @@ -592,6 +592,8 @@ export enum BranchStatus_State { READY = 'READY', /** The branch is stored in cost-effective archival storage. Expect slow query response times. */ ARCHIVED = 'ARCHIVED', + /** The branch is deleted and is not available for querying, but can be undeleted. */ + DELETED = 'DELETED', } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested enum name. @@ -798,6 +800,16 @@ export interface BranchStatus { * which follows the `projects/{project_id}/branches/{branch_id}` format and is not user-friendly. */ branchId?: string | undefined; + /** + * A timestamp indicating when the branch was deleted. + * Empty if the branch is not deleted. + */ + deleteTime?: Temporal.Instant | undefined; + /** + * A timestamp indicating when the branch is scheduled to be purged. + * Empty if the branch is not deleted, otherwise set to a timestamp in the future. + */ + purgeTime?: Temporal.Instant | undefined; } export interface Catalog { @@ -1120,6 +1132,11 @@ export interface DeleteBranchRequest { * Soft deletion (purge=false) is not supported yet. */ purge?: boolean | undefined; + /** + * If true, if branch does not exists, the request will succeed and no action will be taken. + * If false (default value) and branch does not exists, the request will fail with NOT_FOUND error. + */ + allowMissing?: boolean | undefined; } export interface DeleteCatalogRequest { @@ -1601,6 +1618,12 @@ export interface ListBranchesRequest { pageToken?: string | undefined; /** Upper bound for items returned. Cannot be negative. */ pageSize?: number | undefined; + /** + * Whether to include soft-deleted branches in the response. + * When true, deleted branches are included alongside active branches. + * Purged branches are never returned. + */ + showDeleted?: boolean | undefined; } export interface ListBranchesResponse { @@ -1685,6 +1708,12 @@ export interface ListProjectsRequest { pageToken?: string | undefined; /** Upper bound for items returned. Cannot be negative. The maximum value is 100. */ pageSize?: number | undefined; + /** + * Whether to include soft-deleted projects in the response. + * When true, soft-deleted projects are included alongside active projects. + * Hard-deleted and already-purged projects are never returned. + */ + showDeleted?: boolean | undefined; } export interface ListProjectsResponse { @@ -1780,6 +1809,16 @@ export interface Project { * spec.default_endpoint_settings to configure default settings for endpoints created after project creation. */ initialEndpointSpec?: InitialEndpointSpec | undefined; + /** + * A timestamp indicating when the project was soft-deleted. + * Empty if the project is not deleted, otherwise set to a timestamp in the past. + */ + deleteTime?: Temporal.Instant | undefined; + /** + * A timestamp indicating when the project is scheduled for permanent deletion. + * Empty if the project is not deleted, otherwise set to a timestamp in the future. + */ + purgeTime?: Temporal.Instant | undefined; } export interface ProjectCustomTag { @@ -2180,6 +2219,14 @@ export interface Table { tableServingUrl?: string | undefined; } +export interface UndeleteBranchRequest { + /** + * The full resource path of the branch to undelete. + * Format: projects/{project_id}/branches/{branch_id} + */ + name?: string | undefined; +} + export interface UpdateBranchRequest { /** * The Branch to update. @@ -2323,6 +2370,14 @@ export const unmarshalBranchStatusSchema: z.ZodType = z .transform(s => Temporal.Instant.from(s)) .optional(), branch_id: z.string().optional(), + delete_time: z + .string() + .transform(s => Temporal.Instant.from(s)) + .optional(), + purge_time: z + .string() + .transform(s => Temporal.Instant.from(s)) + .optional(), }) .transform(d => ({ sourceBranch: d.source_branch, @@ -2336,6 +2391,8 @@ export const unmarshalBranchStatusSchema: z.ZodType = z logicalSizeBytes: d.logical_size_bytes, expireTime: d.expire_time, branchId: d.branch_id, + deleteTime: d.delete_time, + purgeTime: d.purge_time, })); export const unmarshalCatalogSchema: z.ZodType = z @@ -2603,10 +2660,12 @@ export const unmarshalDeleteBranchRequestSchema: z.ZodType .object({ name: z.string().optional(), purge: z.boolean().optional(), + allow_missing: z.boolean().optional(), }) .transform(d => ({ name: d.name, purge: d.purge, + allowMissing: d.allow_missing, })); export const unmarshalDeleteCatalogRequestSchema: z.ZodType = @@ -3106,11 +3165,13 @@ export const unmarshalListBranchesRequestSchema: z.ZodType parent: z.string().optional(), page_token: z.string().optional(), page_size: z.number().optional(), + show_deleted: z.boolean().optional(), }) .transform(d => ({ parent: d.parent, pageToken: d.page_token, pageSize: d.page_size, + showDeleted: d.show_deleted, })); export const unmarshalListBranchesResponseSchema: z.ZodType = @@ -3203,10 +3264,12 @@ export const unmarshalListProjectsRequestSchema: z.ZodType .object({ page_token: z.string().optional(), page_size: z.number().optional(), + show_deleted: z.boolean().optional(), }) .transform(d => ({ pageToken: d.page_token, pageSize: d.page_size, + showDeleted: d.show_deleted, })); export const unmarshalListProjectsResponseSchema: z.ZodType = @@ -3289,6 +3352,14 @@ export const unmarshalProjectSchema: z.ZodType = z initial_endpoint_spec: z .lazy(() => unmarshalInitialEndpointSpecSchema) .optional(), + delete_time: z + .string() + .transform(s => Temporal.Instant.from(s)) + .optional(), + purge_time: z + .string() + .transform(s => Temporal.Instant.from(s)) + .optional(), }) .transform(d => ({ name: d.name, @@ -3298,6 +3369,8 @@ export const unmarshalProjectSchema: z.ZodType = z spec: d.spec, status: d.status, initialEndpointSpec: d.initial_endpoint_spec, + deleteTime: d.delete_time, + purgeTime: d.purge_time, })); export const unmarshalProjectCustomTagSchema: z.ZodType = z @@ -3664,6 +3737,15 @@ export const unmarshalTableSchema: z.ZodType = z tableServingUrl: d.table_serving_url, })); +export const unmarshalUndeleteBranchRequestSchema: z.ZodType = + z + .object({ + name: z.string().optional(), + }) + .transform(d => ({ + name: d.name, + })); + export const unmarshalUpdateBranchRequestSchema: z.ZodType = z .object({ @@ -3718,7 +3800,7 @@ export const unmarshalUpdateRoleRequestSchema: z.ZodType = z updateMask: d.update_mask, })); -export const marshalBranchSchema = z +export const marshalBranchSchema: z.ZodType = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -3744,9 +3826,9 @@ export const marshalBranchSchema = z status: d.status, })); -export const marshalBranchOperationMetadataSchema = z.object({}); +export const marshalBranchOperationMetadataSchema: z.ZodType = z.object({}); -export const marshalBranchSpecSchema = z +export const marshalBranchSpecSchema: z.ZodType = z .object({ sourceBranch: z.string().optional(), sourceBranchLsn: z.string().optional(), @@ -3775,7 +3857,7 @@ export const marshalBranchSpecSchema = z no_expiry: d.noExpiry, })); -export const marshalBranchStatusSchema = z +export const marshalBranchStatusSchema: z.ZodType = z .object({ sourceBranch: z.string().optional(), sourceBranchLsn: z.string().optional(), @@ -3797,6 +3879,14 @@ export const marshalBranchStatusSchema = z .transform((d: Temporal.Instant) => d.toString()) .optional(), branchId: z.string().optional(), + deleteTime: z + .any() + .transform((d: Temporal.Instant) => d.toString()) + .optional(), + purgeTime: z + .any() + .transform((d: Temporal.Instant) => d.toString()) + .optional(), }) .transform(d => ({ source_branch: d.sourceBranch, @@ -3810,9 +3900,11 @@ export const marshalBranchStatusSchema = z logical_size_bytes: d.logicalSizeBytes, expire_time: d.expireTime, branch_id: d.branchId, + delete_time: d.deleteTime, + purge_time: d.purgeTime, })); -export const marshalCatalogSchema = z +export const marshalCatalogSchema: z.ZodType = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -3837,7 +3929,7 @@ export const marshalCatalogSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalCatalog_CatalogSpecSchema = z +export const marshalCatalog_CatalogSpecSchema: z.ZodType = z .object({ postgresDatabase: z.string().optional(), createDatabaseIfMissing: z.boolean().optional(), @@ -3850,7 +3942,7 @@ export const marshalCatalog_CatalogSpecSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalCatalog_CatalogStatusSchema = z +export const marshalCatalog_CatalogStatusSchema: z.ZodType = z .object({ postgresDatabase: z.string().optional(), project: z.string().optional(), @@ -3864,9 +3956,9 @@ export const marshalCatalog_CatalogStatusSchema = z catalog_id: d.catalogId, })); -export const marshalCatalogOperationMetadataSchema = z.object({}); +export const marshalCatalogOperationMetadataSchema: z.ZodType = z.object({}); -export const marshalComputeInstanceSchema = z +export const marshalComputeInstanceSchema: z.ZodType = z .object({ name: z.string().optional(), computeInstanceId: z.string().optional(), @@ -3894,7 +3986,7 @@ export const marshalComputeInstanceSchema = z suspend_time: d.suspendTime, })); -export const marshalCreateBranchRequestSchema = z +export const marshalCreateBranchRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), branchId: z.string().optional(), @@ -3906,7 +3998,7 @@ export const marshalCreateBranchRequestSchema = z branch: d.branch, })); -export const marshalCreateCatalogRequestSchema = z +export const marshalCreateCatalogRequestSchema: z.ZodType = z .object({ catalogId: z.string().optional(), catalog: z.lazy(() => marshalCatalogSchema).optional(), @@ -3916,7 +4008,7 @@ export const marshalCreateCatalogRequestSchema = z catalog: d.catalog, })); -export const marshalCreateDatabaseRequestSchema = z +export const marshalCreateDatabaseRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), databaseId: z.string().optional(), @@ -3928,7 +4020,7 @@ export const marshalCreateDatabaseRequestSchema = z database: d.database, })); -export const marshalCreateEndpointRequestSchema = z +export const marshalCreateEndpointRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), endpointId: z.string().optional(), @@ -3940,7 +4032,7 @@ export const marshalCreateEndpointRequestSchema = z endpoint: d.endpoint, })); -export const marshalCreateProjectRequestSchema = z +export const marshalCreateProjectRequestSchema: z.ZodType = z .object({ projectId: z.string().optional(), project: z.lazy(() => marshalProjectSchema).optional(), @@ -3950,7 +4042,7 @@ export const marshalCreateProjectRequestSchema = z project: d.project, })); -export const marshalCreateRoleRequestSchema = z +export const marshalCreateRoleRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), roleId: z.string().optional(), @@ -3962,7 +4054,7 @@ export const marshalCreateRoleRequestSchema = z role: d.role, })); -export const marshalCreateSyncedTableRequestSchema = z +export const marshalCreateSyncedTableRequestSchema: z.ZodType = z .object({ syncedTableId: z.string().optional(), syncedTable: z.lazy(() => marshalSyncedTableSchema).optional(), @@ -3972,7 +4064,7 @@ export const marshalCreateSyncedTableRequestSchema = z synced_table: d.syncedTable, })); -export const marshalCreateTableRequestSchema = z +export const marshalCreateTableRequestSchema: z.ZodType = z .object({ table: z.lazy(() => marshalTableSchema).optional(), }) @@ -3980,7 +4072,7 @@ export const marshalCreateTableRequestSchema = z table: d.table, })); -export const marshalDatabaseSchema = z +export const marshalDatabaseSchema: z.ZodType = z .object({ name: z.string().optional(), parent: z.string().optional(), @@ -4005,7 +4097,7 @@ export const marshalDatabaseSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDatabase_DatabaseSpecSchema = z +export const marshalDatabase_DatabaseSpecSchema: z.ZodType = z .object({ role: z.string().optional(), postgresDatabase: z.string().optional(), @@ -4016,7 +4108,7 @@ export const marshalDatabase_DatabaseSpecSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalDatabase_DatabaseStatusSchema = z +export const marshalDatabase_DatabaseStatusSchema: z.ZodType = z .object({ role: z.string().optional(), postgresDatabase: z.string().optional(), @@ -4028,7 +4120,7 @@ export const marshalDatabase_DatabaseStatusSchema = z database_id: d.databaseId, })); -export const marshalDatabaseCredentialSchema = z +export const marshalDatabaseCredentialSchema: z.ZodType = z .object({ token: z.string().optional(), expireTime: z @@ -4041,33 +4133,36 @@ export const marshalDatabaseCredentialSchema = z expire_time: d.expireTime, })); -export const marshalDatabaseOperationMetadataSchema = z.object({}); +export const marshalDatabaseOperationMetadataSchema: z.ZodType = z.object({}); -export const marshalDatabricksServiceExceptionWithDetailsProtoSchema = z - .object({ - errorCode: z.enum(ErrorCode).optional(), - message: z.string().optional(), - stackTrace: z.string().optional(), - details: z.array(z.record(z.string(), z.unknown())).optional(), - }) - .transform(d => ({ - error_code: d.errorCode, - message: d.message, - stack_trace: d.stackTrace, - details: d.details, - })); +export const marshalDatabricksServiceExceptionWithDetailsProtoSchema: z.ZodType = + z + .object({ + errorCode: z.enum(ErrorCode).optional(), + message: z.string().optional(), + stackTrace: z.string().optional(), + details: z.array(z.record(z.string(), z.unknown())).optional(), + }) + .transform(d => ({ + error_code: d.errorCode, + message: d.message, + stack_trace: d.stackTrace, + details: d.details, + })); -export const marshalDeleteBranchRequestSchema = z +export const marshalDeleteBranchRequestSchema: z.ZodType = z .object({ name: z.string().optional(), purge: z.boolean().optional(), + allowMissing: z.boolean().optional(), }) .transform(d => ({ name: d.name, purge: d.purge, + allow_missing: d.allowMissing, })); -export const marshalDeleteCatalogRequestSchema = z +export const marshalDeleteCatalogRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4075,7 +4170,7 @@ export const marshalDeleteCatalogRequestSchema = z name: d.name, })); -export const marshalDeleteDatabaseRequestSchema = z +export const marshalDeleteDatabaseRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4083,7 +4178,7 @@ export const marshalDeleteDatabaseRequestSchema = z name: d.name, })); -export const marshalDeleteEndpointRequestSchema = z +export const marshalDeleteEndpointRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4091,7 +4186,7 @@ export const marshalDeleteEndpointRequestSchema = z name: d.name, })); -export const marshalDeleteProjectRequestSchema = z +export const marshalDeleteProjectRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4099,7 +4194,7 @@ export const marshalDeleteProjectRequestSchema = z name: d.name, })); -export const marshalDeleteRoleRequestSchema = z +export const marshalDeleteRoleRequestSchema: z.ZodType = z .object({ name: z.string().optional(), reassignOwnedTo: z.string().optional(), @@ -4109,7 +4204,7 @@ export const marshalDeleteRoleRequestSchema = z reassign_owned_to: d.reassignOwnedTo, })); -export const marshalDeleteSyncedTableRequestSchema = z +export const marshalDeleteSyncedTableRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4117,7 +4212,7 @@ export const marshalDeleteSyncedTableRequestSchema = z name: d.name, })); -export const marshalDeleteTableRequestSchema = z +export const marshalDeleteTableRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4125,7 +4220,7 @@ export const marshalDeleteTableRequestSchema = z name: d.name, })); -export const marshalDeltaTableSyncInfoSchema = z +export const marshalDeltaTableSyncInfoSchema: z.ZodType = z .object({ deltaCommitVersion: z.number().optional(), deltaCommitTime: z @@ -4138,7 +4233,7 @@ export const marshalDeltaTableSyncInfoSchema = z delta_commit_time: d.deltaCommitTime, })); -export const marshalDisableForwardEtlRequestSchema = z +export const marshalDisableForwardEtlRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), tenantId: z.string().optional(), @@ -4154,7 +4249,7 @@ export const marshalDisableForwardEtlRequestSchema = z pg_schema_oid: d.pgSchemaOid, })); -export const marshalDisableForwardEtlResponseSchema = z +export const marshalDisableForwardEtlResponseSchema: z.ZodType = z .object({ disabled: z.boolean().optional(), }) @@ -4162,7 +4257,7 @@ export const marshalDisableForwardEtlResponseSchema = z disabled: d.disabled, })); -export const marshalEndpointSchema = z +export const marshalEndpointSchema: z.ZodType = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -4188,7 +4283,7 @@ export const marshalEndpointSchema = z status: d.status, })); -export const marshalEndpointGroupSpecSchema = z +export const marshalEndpointGroupSpecSchema: z.ZodType = z .object({ min: z.number().optional(), max: z.number().optional(), @@ -4200,7 +4295,7 @@ export const marshalEndpointGroupSpecSchema = z enable_readable_secondaries: d.enableReadableSecondaries, })); -export const marshalEndpointGroupStatusSchema = z +export const marshalEndpointGroupStatusSchema: z.ZodType = z .object({ min: z.number().optional(), max: z.number().optional(), @@ -4212,7 +4307,7 @@ export const marshalEndpointGroupStatusSchema = z enable_readable_secondaries: d.enableReadableSecondaries, })); -export const marshalEndpointHostsSchema = z +export const marshalEndpointHostsSchema: z.ZodType = z .object({ host: z.string().optional(), readOnlyHost: z.string().optional(), @@ -4226,9 +4321,9 @@ export const marshalEndpointHostsSchema = z read_only_pooled_host: d.readOnlyPooledHost, })); -export const marshalEndpointOperationMetadataSchema = z.object({}); +export const marshalEndpointOperationMetadataSchema: z.ZodType = z.object({}); -export const marshalEndpointSettingsSchema = z +export const marshalEndpointSettingsSchema: z.ZodType = z .object({ pgSettings: z.record(z.string(), z.string()).optional(), }) @@ -4237,7 +4332,7 @@ export const marshalEndpointSettingsSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalEndpointSettings_PgSettingsEntrySchema = z +export const marshalEndpointSettings_PgSettingsEntrySchema: z.ZodType = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -4247,7 +4342,7 @@ export const marshalEndpointSettings_PgSettingsEntrySchema = z value: d.value, })); -export const marshalEndpointSpecSchema = z +export const marshalEndpointSpecSchema: z.ZodType = z .object({ endpointType: z.enum(EndpointType).optional(), autoscalingLimitMinCu: z.number().optional(), @@ -4272,7 +4367,7 @@ export const marshalEndpointSpecSchema = z group: d.group, })); -export const marshalEndpointStatusSchema = z +export const marshalEndpointStatusSchema: z.ZodType = z .object({ endpointType: z.enum(EndpointType).optional(), hosts: z.lazy(() => marshalEndpointHostsSchema).optional(), @@ -4308,7 +4403,7 @@ export const marshalEndpointStatusSchema = z endpoint_id: d.endpointId, })); -export const marshalForwardEtlConfigSchema = z +export const marshalForwardEtlConfigSchema: z.ZodType = z .object({ workspaceId: z.number().optional(), tenantId: z.string().optional(), @@ -4334,7 +4429,7 @@ export const marshalForwardEtlConfigSchema = z update_time_millis: d.updateTimeMillis, })); -export const marshalForwardEtlDatabaseSchema = z +export const marshalForwardEtlDatabaseSchema: z.ZodType = z .object({ name: z.string().optional(), oid: z.number().optional(), @@ -4344,7 +4439,7 @@ export const marshalForwardEtlDatabaseSchema = z oid: d.oid, })); -export const marshalForwardEtlMetadataSchema = z +export const marshalForwardEtlMetadataSchema: z.ZodType = z .object({ databases: z .array(z.lazy(() => marshalForwardEtlDatabaseSchema)) @@ -4356,7 +4451,7 @@ export const marshalForwardEtlMetadataSchema = z schemas: d.schemas, })); -export const marshalForwardEtlSchemaSchema = z +export const marshalForwardEtlSchemaSchema: z.ZodType = z .object({ name: z.string().optional(), oid: z.number().optional(), @@ -4366,7 +4461,7 @@ export const marshalForwardEtlSchemaSchema = z oid: d.oid, })); -export const marshalForwardEtlStatusSchema = z +export const marshalForwardEtlStatusSchema: z.ZodType = z .object({ configurations: z .array(z.lazy(() => marshalForwardEtlConfigSchema)) @@ -4380,7 +4475,7 @@ export const marshalForwardEtlStatusSchema = z table_mappings: d.tableMappings, })); -export const marshalForwardEtlTableMappingSchema = z +export const marshalForwardEtlTableMappingSchema: z.ZodType = z .object({ pgTableOid: z.number().optional(), ucTableId: z.string().optional(), @@ -4398,7 +4493,7 @@ export const marshalForwardEtlTableMappingSchema = z enabled: d.enabled, })); -export const marshalGenerateDatabaseCredentialRequestSchema = z +export const marshalGenerateDatabaseCredentialRequestSchema: z.ZodType = z .object({ claims: z.array(z.lazy(() => marshalRequestedClaimsSchema)).optional(), endpoint: z.string().optional(), @@ -4420,7 +4515,7 @@ export const marshalGenerateDatabaseCredentialRequestSchema = z expire_time: d.expireTime, })); -export const marshalGetBranchRequestSchema = z +export const marshalGetBranchRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4428,7 +4523,7 @@ export const marshalGetBranchRequestSchema = z name: d.name, })); -export const marshalGetCatalogRequestSchema = z +export const marshalGetCatalogRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4436,7 +4531,7 @@ export const marshalGetCatalogRequestSchema = z name: d.name, })); -export const marshalGetComputeInstanceRequestSchema = z +export const marshalGetComputeInstanceRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4444,7 +4539,7 @@ export const marshalGetComputeInstanceRequestSchema = z name: d.name, })); -export const marshalGetDatabaseRequestSchema = z +export const marshalGetDatabaseRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4452,7 +4547,7 @@ export const marshalGetDatabaseRequestSchema = z name: d.name, })); -export const marshalGetEndpointRequestSchema = z +export const marshalGetEndpointRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4460,7 +4555,7 @@ export const marshalGetEndpointRequestSchema = z name: d.name, })); -export const marshalGetForwardEtlMetadataRequestSchema = z +export const marshalGetForwardEtlMetadataRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), tenantId: z.string().optional(), @@ -4472,7 +4567,7 @@ export const marshalGetForwardEtlMetadataRequestSchema = z timeline_id: d.timelineId, })); -export const marshalGetForwardEtlStatusRequestSchema = z +export const marshalGetForwardEtlStatusRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), tenantId: z.string().optional(), @@ -4484,7 +4579,7 @@ export const marshalGetForwardEtlStatusRequestSchema = z timeline_id: d.timelineId, })); -export const marshalGetOperationRequestSchema = z +export const marshalGetOperationRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4492,7 +4587,7 @@ export const marshalGetOperationRequestSchema = z name: d.name, })); -export const marshalGetProjectRequestSchema = z +export const marshalGetProjectRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4500,7 +4595,7 @@ export const marshalGetProjectRequestSchema = z name: d.name, })); -export const marshalGetRoleRequestSchema = z +export const marshalGetRoleRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4508,7 +4603,7 @@ export const marshalGetRoleRequestSchema = z name: d.name, })); -export const marshalGetSyncedTableRequestSchema = z +export const marshalGetSyncedTableRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4516,7 +4611,7 @@ export const marshalGetSyncedTableRequestSchema = z name: d.name, })); -export const marshalGetTableRequestSchema = z +export const marshalGetTableRequestSchema: z.ZodType = z .object({ name: z.string().optional(), }) @@ -4524,7 +4619,7 @@ export const marshalGetTableRequestSchema = z name: d.name, })); -export const marshalInitialEndpointSpecSchema = z +export const marshalInitialEndpointSpecSchema: z.ZodType = z .object({ group: z.lazy(() => marshalEndpointGroupSpecSchema).optional(), }) @@ -4532,19 +4627,21 @@ export const marshalInitialEndpointSpecSchema = z group: d.group, })); -export const marshalListBranchesRequestSchema = z +export const marshalListBranchesRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), pageSize: z.number().optional(), + showDeleted: z.boolean().optional(), }) .transform(d => ({ parent: d.parent, page_token: d.pageToken, page_size: d.pageSize, + show_deleted: d.showDeleted, })); -export const marshalListBranchesResponseSchema = z +export const marshalListBranchesResponseSchema: z.ZodType = z .object({ branches: z.array(z.lazy(() => marshalBranchSchema)).optional(), nextPageToken: z.string().optional(), @@ -4554,7 +4651,7 @@ export const marshalListBranchesResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListComputeInstancesRequestSchema = z +export const marshalListComputeInstancesRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), pageSize: z.number().optional(), @@ -4566,7 +4663,7 @@ export const marshalListComputeInstancesRequestSchema = z page_token: d.pageToken, })); -export const marshalListComputeInstancesResponseSchema = z +export const marshalListComputeInstancesResponseSchema: z.ZodType = z .object({ computeInstances: z .array(z.lazy(() => marshalComputeInstanceSchema)) @@ -4578,7 +4675,7 @@ export const marshalListComputeInstancesResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListDatabasesRequestSchema = z +export const marshalListDatabasesRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4590,7 +4687,7 @@ export const marshalListDatabasesRequestSchema = z page_size: d.pageSize, })); -export const marshalListDatabasesResponseSchema = z +export const marshalListDatabasesResponseSchema: z.ZodType = z .object({ databases: z.array(z.lazy(() => marshalDatabaseSchema)).optional(), nextPageToken: z.string().optional(), @@ -4600,7 +4697,7 @@ export const marshalListDatabasesResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListEndpointsRequestSchema = z +export const marshalListEndpointsRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4612,7 +4709,7 @@ export const marshalListEndpointsRequestSchema = z page_size: d.pageSize, })); -export const marshalListEndpointsResponseSchema = z +export const marshalListEndpointsResponseSchema: z.ZodType = z .object({ endpoints: z.array(z.lazy(() => marshalEndpointSchema)).optional(), nextPageToken: z.string().optional(), @@ -4622,17 +4719,19 @@ export const marshalListEndpointsResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListProjectsRequestSchema = z +export const marshalListProjectsRequestSchema: z.ZodType = z .object({ pageToken: z.string().optional(), pageSize: z.number().optional(), + showDeleted: z.boolean().optional(), }) .transform(d => ({ page_token: d.pageToken, page_size: d.pageSize, + show_deleted: d.showDeleted, })); -export const marshalListProjectsResponseSchema = z +export const marshalListProjectsResponseSchema: z.ZodType = z .object({ projects: z.array(z.lazy(() => marshalProjectSchema)).optional(), nextPageToken: z.string().optional(), @@ -4642,7 +4741,7 @@ export const marshalListProjectsResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalListRolesRequestSchema = z +export const marshalListRolesRequestSchema: z.ZodType = z .object({ parent: z.string().optional(), pageToken: z.string().optional(), @@ -4654,7 +4753,7 @@ export const marshalListRolesRequestSchema = z page_size: d.pageSize, })); -export const marshalListRolesResponseSchema = z +export const marshalListRolesResponseSchema: z.ZodType = z .object({ roles: z.array(z.lazy(() => marshalRoleSchema)).optional(), nextPageToken: z.string().optional(), @@ -4664,7 +4763,7 @@ export const marshalListRolesResponseSchema = z next_page_token: d.nextPageToken, })); -export const marshalNewPipelineSpecSchema = z +export const marshalNewPipelineSpecSchema: z.ZodType = z .object({ storageCatalog: z.string().optional(), storageSchema: z.string().optional(), @@ -4676,7 +4775,7 @@ export const marshalNewPipelineSpecSchema = z budget_policy_id: d.budgetPolicyId, })); -export const marshalOperationSchema = z +export const marshalOperationSchema: z.ZodType = z .object({ name: z.string().optional(), metadata: z.record(z.string(), z.unknown()).optional(), @@ -4694,7 +4793,7 @@ export const marshalOperationSchema = z response: d.response, })); -export const marshalProjectSchema = z +export const marshalProjectSchema: z.ZodType = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -4711,6 +4810,14 @@ export const marshalProjectSchema = z initialEndpointSpec: z .lazy(() => marshalInitialEndpointSpecSchema) .optional(), + deleteTime: z + .any() + .transform((d: Temporal.Instant) => d.toString()) + .optional(), + purgeTime: z + .any() + .transform((d: Temporal.Instant) => d.toString()) + .optional(), }) .transform(d => ({ name: d.name, @@ -4720,9 +4827,11 @@ export const marshalProjectSchema = z spec: d.spec, status: d.status, initial_endpoint_spec: d.initialEndpointSpec, + delete_time: d.deleteTime, + purge_time: d.purgeTime, })); -export const marshalProjectCustomTagSchema = z +export const marshalProjectCustomTagSchema: z.ZodType = z .object({ key: z.string().optional(), value: z.string().optional(), @@ -4732,7 +4841,7 @@ export const marshalProjectCustomTagSchema = z value: d.value, })); -export const marshalProjectDefaultEndpointSettingsSchema = z +export const marshalProjectDefaultEndpointSettingsSchema: z.ZodType = z .object({ autoscalingLimitMinCu: z.number().optional(), autoscalingLimitMaxCu: z.number().optional(), @@ -4752,19 +4861,20 @@ export const marshalProjectDefaultEndpointSettingsSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalProjectDefaultEndpointSettings_PgSettingsEntrySchema = z - .object({ - key: z.string().optional(), - value: z.string().optional(), - }) - .transform(d => ({ - key: d.key, - value: d.value, - })); +export const marshalProjectDefaultEndpointSettings_PgSettingsEntrySchema: z.ZodType = + z + .object({ + key: z.string().optional(), + value: z.string().optional(), + }) + .transform(d => ({ + key: d.key, + value: d.value, + })); -export const marshalProjectOperationMetadataSchema = z.object({}); +export const marshalProjectOperationMetadataSchema: z.ZodType = z.object({}); -export const marshalProjectSpecSchema = z +export const marshalProjectSpecSchema: z.ZodType = z .object({ displayName: z.string().optional(), pgVersion: z.number().optional(), @@ -4793,7 +4903,7 @@ export const marshalProjectSpecSchema = z default_branch: d.defaultBranch, })); -export const marshalProjectStatusSchema = z +export const marshalProjectStatusSchema: z.ZodType = z .object({ displayName: z.string().optional(), pgVersion: z.number().optional(), @@ -4833,9 +4943,9 @@ export const marshalProjectStatusSchema = z project_id: d.projectId, })); -export const marshalProvisioningInfoSchema = z.object({}); +export const marshalProvisioningInfoSchema: z.ZodType = z.object({}); -export const marshalRequestedClaimsSchema = z +export const marshalRequestedClaimsSchema: z.ZodType = z .object({ permissionSet: z.enum(RequestedClaims_PermissionSet).optional(), resources: z.array(z.lazy(() => marshalRequestedResourceSchema)).optional(), @@ -4845,7 +4955,7 @@ export const marshalRequestedClaimsSchema = z resources: d.resources, })); -export const marshalRequestedResourceSchema = z +export const marshalRequestedResourceSchema: z.ZodType = z .object({ unspecifiedResourceName: z.string().optional(), tableName: z.string().optional(), @@ -4855,7 +4965,7 @@ export const marshalRequestedResourceSchema = z table_name: d.tableName, })); -export const marshalRoleSchema = z +export const marshalRoleSchema: z.ZodType = z .object({ name: z.string().optional(), parent: z.string().optional(), @@ -4880,7 +4990,7 @@ export const marshalRoleSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalRole_AttributesSchema = z +export const marshalRole_AttributesSchema: z.ZodType = z .object({ createdb: z.boolean().optional(), createrole: z.boolean().optional(), @@ -4893,7 +5003,7 @@ export const marshalRole_AttributesSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalRole_RoleSpecSchema = z +export const marshalRole_RoleSpecSchema: z.ZodType = z .object({ membershipRoles: z.array(z.enum(Role_MembershipRole)).optional(), identityType: z.enum(Role_IdentityType).optional(), @@ -4910,7 +5020,7 @@ export const marshalRole_RoleSpecSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalRole_RoleStatusSchema = z +export const marshalRole_RoleStatusSchema: z.ZodType = z .object({ membershipRoles: z.array(z.enum(Role_MembershipRole)).optional(), identityType: z.enum(Role_IdentityType).optional(), @@ -4928,9 +5038,9 @@ export const marshalRole_RoleStatusSchema = z role_id: d.roleId, })); -export const marshalRoleOperationMetadataSchema = z.object({}); +export const marshalRoleOperationMetadataSchema: z.ZodType = z.object({}); -export const marshalSyncedTableSchema = z +export const marshalSyncedTableSchema: z.ZodType = z .object({ name: z.string().optional(), uid: z.string().optional(), @@ -4950,7 +5060,7 @@ export const marshalSyncedTableSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalSyncedTable_SyncedTableSpecSchema = z +export const marshalSyncedTable_SyncedTableSpecSchema: z.ZodType = z .object({ postgresDatabase: z.string().optional(), branch: z.string().optional(), @@ -4979,7 +5089,7 @@ export const marshalSyncedTable_SyncedTableSpecSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalSyncedTable_SyncedTableStatusSchema = z +export const marshalSyncedTable_SyncedTableStatusSchema: z.ZodType = z .object({ message: z.string().optional(), detailedState: z.enum(SyncedTableState).optional(), @@ -5010,9 +5120,11 @@ export const marshalSyncedTable_SyncedTableStatusSchema = z project: d.project, })); -export const marshalSyncedTableOperationMetadataSchema = z.object({}); +export const marshalSyncedTableOperationMetadataSchema: z.ZodType = z.object( + {} +); -export const marshalSyncedTablePipelineProgressSchema = z +export const marshalSyncedTablePipelineProgressSchema: z.ZodType = z .object({ latestVersionCurrentlyProcessing: z.number().optional(), syncedRowCount: z.number().optional(), @@ -5028,7 +5140,7 @@ export const marshalSyncedTablePipelineProgressSchema = z estimated_completion_time_seconds: d.estimatedCompletionTimeSeconds, })); -export const marshalSyncedTablePositionSchema = z +export const marshalSyncedTablePositionSchema: z.ZodType = z .object({ syncStartTime: z .any() @@ -5048,7 +5160,7 @@ export const marshalSyncedTablePositionSchema = z delta_table_sync_info: d.deltaTableSyncInfo, })); -export const marshalTableSchema = z +export const marshalTableSchema: z.ZodType = z .object({ name: z.string().optional(), database: z.string().optional(), @@ -5064,7 +5176,15 @@ export const marshalTableSchema = z table_serving_url: d.tableServingUrl, })); -export const marshalUpdateBranchRequestSchema = z +export const marshalUndeleteBranchRequestSchema: z.ZodType = z + .object({ + name: z.string().optional(), + }) + .transform(d => ({ + name: d.name, + })); + +export const marshalUpdateBranchRequestSchema: z.ZodType = z .object({ branch: z.lazy(() => marshalBranchSchema).optional(), updateMask: z.string().optional(), @@ -5074,7 +5194,7 @@ export const marshalUpdateBranchRequestSchema = z update_mask: d.updateMask, })); -export const marshalUpdateDatabaseRequestSchema = z +export const marshalUpdateDatabaseRequestSchema: z.ZodType = z .object({ database: z.lazy(() => marshalDatabaseSchema).optional(), updateMask: z.string().optional(), @@ -5084,7 +5204,7 @@ export const marshalUpdateDatabaseRequestSchema = z update_mask: d.updateMask, })); -export const marshalUpdateEndpointRequestSchema = z +export const marshalUpdateEndpointRequestSchema: z.ZodType = z .object({ endpoint: z.lazy(() => marshalEndpointSchema).optional(), updateMask: z.string().optional(), @@ -5094,7 +5214,7 @@ export const marshalUpdateEndpointRequestSchema = z update_mask: d.updateMask, })); -export const marshalUpdateProjectRequestSchema = z +export const marshalUpdateProjectRequestSchema: z.ZodType = z .object({ project: z.lazy(() => marshalProjectSchema).optional(), updateMask: z.string().optional(), @@ -5104,7 +5224,7 @@ export const marshalUpdateProjectRequestSchema = z update_mask: d.updateMask, })); -export const marshalUpdateRoleRequestSchema = z +export const marshalUpdateRoleRequestSchema: z.ZodType = z .object({ role: z.lazy(() => marshalRoleSchema).optional(), updateMask: z.string().optional(), diff --git a/packages/sdk/src/model.ts b/packages/sdk/src/model.ts index d484b973..3ef9d0b7 100644 --- a/packages/sdk/src/model.ts +++ b/packages/sdk/src/model.ts @@ -66,6 +66,28 @@ export enum LaunchStage { GA = 'GA', } +/** + * SDK generation hints for a proto field. + * + * These annotations guide SDK code generators in producing correct + * client code. They do not affect wire format or server behavior. + */ +export interface FieldMetadata { + /** + * When true, the field value may contain path separators (e.g., "/a/b/c") + * and should be treated as a multi-segment path parameter rather than a + * single path segment. + */ + isMultiSegment?: boolean | undefined; + /** + * When true, the field carries a raw byte stream (e.g., file contents) + * rather than a small binary blob. SDK generators use this to send/receive + * the data as a streaming body (application/octet-stream) instead of + * base64-encoding it into JSON. + */ + isStream?: boolean | undefined; +} + /** * Long-Running Operation (LRO) configuration for API methods. * @@ -172,6 +194,29 @@ export interface LongRunningOperation_OperationMethods { cancel?: string | undefined; } +/** + * SDK generation hints for an RPC method. + * + * These annotations guide SDK code generators in producing correct + * client code. They do not affect wire format or server behavior. + */ +export interface MethodMetadata { + /** + * Fields in the response message that are populated from HTTP response + * headers rather than the JSON response body. Each entry is the proto + * field name in the response message; the field's json_name gives the + * corresponding HTTP header name. + */ + responseHeaders?: string[] | undefined; + /** + * Fields in the request message that are sent as HTTP request headers + * rather than in the request body or query string. Each entry is the + * proto field name in the request message; the field's json_name gives + * the corresponding HTTP header name. + */ + requestHeaders?: string[] | undefined; +} + /** * Indicates that an API method returns paginated results. * @@ -372,6 +417,16 @@ export interface WaitForState_StateInfo { messagePath?: string[] | undefined; } +export const unmarshalFieldMetadataSchema: z.ZodType = z + .object({ + is_multi_segment: z.boolean().optional(), + is_stream: z.boolean().optional(), + }) + .transform(d => ({ + isMultiSegment: d.is_multi_segment, + isStream: d.is_stream, + })); + export const unmarshalLongRunningOperationSchema: z.ZodType = z .object({ @@ -417,6 +472,16 @@ export const unmarshalLongRunningOperation_OperationMethodsSchema: z.ZodType = z + .object({ + response_headers: z.array(z.string()).optional(), + request_headers: z.array(z.string()).optional(), + }) + .transform(d => ({ + responseHeaders: d.response_headers, + requestHeaders: d.request_headers, + })); + export const unmarshalPaginationSchema: z.ZodType = z .object({ offset_info: z.lazy(() => unmarshalPagination_OffsetInfoSchema).optional(), @@ -515,7 +580,17 @@ export const unmarshalWaitForState_StateInfoSchema: z.ZodType ({ + is_multi_segment: d.isMultiSegment, + is_stream: d.isStream, + })); + +export const marshalLongRunningOperationSchema: z.ZodType = z .object({ operationInfo: z .lazy(() => marshalLongRunningOperation_OperationInfoSchema) @@ -530,7 +605,7 @@ export const marshalLongRunningOperationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalLongRunningOperation_OperationInfoSchema = z +export const marshalLongRunningOperation_OperationInfoSchema: z.ZodType = z .object({ responseType: z.string().optional(), metadataType: z.string().optional(), @@ -541,7 +616,7 @@ export const marshalLongRunningOperation_OperationInfoSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalLongRunningOperation_OperationMethodsSchema = z +export const marshalLongRunningOperation_OperationMethodsSchema: z.ZodType = z .object({ get: z.string().optional(), list: z.string().optional(), @@ -557,7 +632,17 @@ export const marshalLongRunningOperation_OperationMethodsSchema = z cancel: d.cancel, })); -export const marshalPaginationSchema = z +export const marshalMethodMetadataSchema: z.ZodType = z + .object({ + responseHeaders: z.array(z.string()).optional(), + requestHeaders: z.array(z.string()).optional(), + }) + .transform(d => ({ + response_headers: d.responseHeaders, + request_headers: d.requestHeaders, + })); + +export const marshalPaginationSchema: z.ZodType = z .object({ offsetInfo: z.lazy(() => marshalPagination_OffsetInfoSchema).optional(), tokenInfo: z.lazy(() => marshalPagination_PageTokenInfoSchema).optional(), @@ -570,7 +655,7 @@ export const marshalPaginationSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalPagination_OffsetInfoSchema = z +export const marshalPagination_OffsetInfoSchema: z.ZodType = z .object({ offset: z.string().optional(), maxResults: z.string().optional(), @@ -583,7 +668,7 @@ export const marshalPagination_OffsetInfoSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalPagination_PageTokenInfoSchema = z +export const marshalPagination_PageTokenInfoSchema: z.ZodType = z .object({ request: z.string().optional(), response: z.string().optional(), @@ -597,7 +682,7 @@ export const marshalPagination_PageTokenInfoSchema = z default_max_results: d.defaultMaxResults, })); -export const marshalWaitForStateSchema = z +export const marshalWaitForStateSchema: z.ZodType = z .object({ methodToPoll: z.string().optional(), binding: z.lazy(() => marshalWaitForState_BindingSchema).optional(), @@ -610,7 +695,7 @@ export const marshalWaitForStateSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalWaitForState_BindingSchema = z +export const marshalWaitForState_BindingSchema: z.ZodType = z .object({ pairs: z .array(z.lazy(() => marshalWaitForState_Binding_BindingPairSchema)) @@ -621,7 +706,7 @@ export const marshalWaitForState_BindingSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalWaitForState_Binding_BindingPairSchema = z +export const marshalWaitForState_Binding_BindingPairSchema: z.ZodType = z .object({ pollMethodField: z.string().optional(), requestField: z.string().optional(), @@ -634,7 +719,7 @@ export const marshalWaitForState_Binding_BindingPairSchema = z })); // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. -export const marshalWaitForState_StateInfoSchema = z +export const marshalWaitForState_StateInfoSchema: z.ZodType = z .object({ statePath: z.array(z.string()).optional(), successStates: z.array(z.string()).optional(), diff --git a/packages/tables/src/v1/model.ts b/packages/tables/src/v1/model.ts index 63e24af5..4899a7b0 100644 --- a/packages/tables/src/v1/model.ts +++ b/packages/tables/src/v1/model.ts @@ -75,7 +75,7 @@ export enum DataSourceFormat { ICEBERG = 'ICEBERG', } -/** Latest kind: CONNECTION_API_SOURCE = 310; Next id: 311 */ +/** Latest kind: CONNECTION_VEEVA_VAULT_OAUTH_M2M = 311; Next id: 312 */ export enum SecurableKind { TABLE_STANDARD = 'TABLE_STANDARD', TABLE_EXTERNAL = 'TABLE_EXTERNAL',