test-repo/node_modules/iceberg-js/dist/index.cjs.map

1 line
42 KiB
Plaintext

{"version":3,"sources":["../src/errors/IcebergError.ts","../src/utils/url.ts","../src/http/createFetchClient.ts","../src/catalog/namespaces.ts","../src/catalog/tables.ts","../src/catalog/IcebergRestCatalog.ts","../src/catalog/types.ts"],"names":["namespaceToPath"],"mappings":";;;AASO,IAAM,YAAA,GAAN,cAA2B,KAAA,CAAM;AAAA,EAOtC,WAAA,CACE,SACA,IAAA,EAMA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,IAAA,IAAA,CAAK,SAAS,IAAA,CAAK,MAAA;AACnB,IAAA,IAAA,CAAK,cAAc,IAAA,CAAK,WAAA;AACxB,IAAA,IAAA,CAAK,cAAc,IAAA,CAAK,WAAA;AACxB,IAAA,IAAA,CAAK,UAAU,IAAA,CAAK,OAAA;AAGpB,IAAA,IAAA,CAAK,uBACH,IAAA,CAAK,WAAA,KAAgB,6BAAA,IACpB,CAAC,KAAK,GAAA,EAAK,GAAG,CAAA,CAAE,QAAA,CAAS,KAAK,MAAM,CAAA,IAAK,KAAK,WAAA,EAAa,QAAA,CAAS,aAAa,CAAA,KAAM,IAAA;AAAA,EAC5F;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA,GAAsB;AACpB,IAAA,OAAO,KAAK,MAAA,KAAW,GAAA;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,UAAA,GAAsB;AACpB,IAAA,OAAO,KAAK,MAAA,KAAW,GAAA;AAAA,EACzB;AAAA;AAAA;AAAA;AAAA,EAKA,uBAAA,GAAmC;AACjC,IAAA,OAAO,KAAK,MAAA,KAAW,GAAA;AAAA,EACzB;AACF;;;AC1DO,SAAS,QAAA,CACd,OAAA,EACA,IAAA,EACA,KAAA,EACQ;AACR,EAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,IAAA,EAAM,OAAO,CAAA;AAEjC,EAAA,IAAI,K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,YAAY,QAAA,EAAU;AACxB,IAAA,OAAO,SAAS,SAAA,KAAc,QAAA,CAAS,SAAA,IAAa,QAAA,CAAS,UAAU,QAAA,CAAS,KAAA;AAAA,EAClF;AAGA,EAAA,MAAM,MAAA,GAAS,eAAe,CAAC,CAAA;AAC/B,EAAA,MAAM,MAAA,GAAS,eAAe,CAAC,CAAA;AAC/B,EAAA,IAAI,UAAU,MAAA,EAAQ;AACpB,IAAA,OAAO,MAAA,CAAO,WAAW,MAAA,CAAO,MAAA;AAAA,EAClC;AAGA,EAAA,OAAO,CAAA,KAAM,CAAA;AACf;AA4LO,SAAS,iBAAiB,QAAA,EAAkD;AACjF,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,KAAM,EAAE,WAAW,CAAA,KAAM,QAAA,CAAS,mBAAmB,CAAC,CAAA;AACtF","file":"index.cjs","sourcesContent":["export interface IcebergErrorResponse {\n error: {\n message: string\n type: string\n code: number\n stack?: string[]\n }\n}\n\nexport class IcebergError extends Error {\n readonly status: number\n readonly icebergType?: string\n readonly icebergCode?: number\n readonly details?: unknown\n readonly isCommitStateUnknown: boolean\n\n constructor(\n message: string,\n opts: {\n status: number\n icebergType?: string\n icebergCode?: number\n details?: unknown\n }\n ) {\n super(message)\n this.name = 'IcebergError'\n this.status = opts.status\n this.icebergType = opts.icebergType\n this.icebergCode = opts.icebergCode\n this.details = opts.details\n\n // Detect CommitStateUnknownException (500, 502, 504 during table commits)\n this.isCommitStateUnknown =\n opts.icebergType === 'CommitStateUnknownException' ||\n ([500, 502, 504].includes(opts.status) && opts.icebergType?.includes('CommitState') === true)\n }\n\n /**\n * Returns true if the error is a 404 Not Found error.\n */\n isNotFound(): boolean {\n return this.status === 404\n }\n\n /**\n * Returns true if the error is a 409 Conflict error.\n */\n isConflict(): boolean {\n return this.status === 409\n }\n\n /**\n * Returns true if the error is a 419 Authentication Timeout error.\n */\n isAuthenticationTimeout(): boolean {\n return this.status === 419\n }\n}\n","export function buildUrl(\n baseUrl: string,\n path: string,\n query?: Record<string, string | undefined>\n): string {\n const url = new URL(path, baseUrl)\n\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n url.searchParams.set(key, value)\n }\n }\n }\n\n return url.toString()\n}\n","import { IcebergError, type IcebergErrorResponse } from '../errors/IcebergError'\nimport { buildUrl } from '../utils/url'\nimport type { AuthConfig, HttpClient, HttpRequest, HttpResponse } from './types'\n\nasync function buildAuthHeaders(auth?: AuthConfig): Promise<Record<string, string>> {\n if (!auth || auth.type === 'none') {\n return {}\n }\n\n if (auth.type === 'bearer') {\n return { Authorization: `Bearer ${auth.token}` }\n }\n\n if (auth.type === 'header') {\n return { [auth.name]: auth.value }\n }\n\n if (auth.type === 'custom') {\n return await auth.getHeaders()\n }\n\n return {}\n}\n\nexport function createFetchClient(options: {\n baseUrl: string\n auth?: AuthConfig\n fetchImpl?: typeof fetch\n}): HttpClient {\n const fetchFn = options.fetchImpl ?? globalThis.fetch\n\n return {\n async request<T>({\n method,\n path,\n query,\n body,\n headers,\n }: HttpRequest): Promise<HttpResponse<T>> {\n const url = buildUrl(options.baseUrl, path, query)\n const authHeaders = await buildAuthHeaders(options.auth)\n\n const res = await fetchFn(url, {\n method,\n headers: {\n ...(body ? { 'Content-Type': 'application/json' } : {}),\n ...authHeaders,\n ...headers,\n },\n body: body ? JSON.stringify(body) : undefined,\n })\n\n const text = await res.text()\n const isJson = (res.headers.get('content-type') || '').includes('application/json')\n const data = isJson && text ? (JSON.parse(text) as T) : (text as T)\n\n if (!res.ok) {\n const errBody = isJson ? (data as IcebergErrorResponse) : undefined\n const errorDetail = errBody?.error\n throw new IcebergError(\n errorDetail?.message ?? `Request failed with status ${res.status}`,\n {\n status: res.status,\n icebergType: errorDetail?.type,\n icebergCode: errorDetail?.code,\n details: errBody,\n }\n )\n }\n\n return { status: res.status, headers: res.headers, data: data as T }\n },\n }\n}\n","import type { HttpClient } from '../http/types'\nimport { IcebergError } from '../errors/IcebergError'\nimport type {\n CreateNamespaceRequest,\n CreateNamespaceResponse,\n GetNamespaceResponse,\n ListNamespacesResponse,\n NamespaceIdentifier,\n NamespaceMetadata,\n} from './types'\n\nfunction namespaceToPath(namespace: string[]): string {\n return namespace.join('\\x1F')\n}\n\nexport class NamespaceOperations {\n constructor(\n private readonly client: HttpClient,\n private readonly prefix: string = ''\n ) {}\n\n async listNamespaces(parent?: NamespaceIdentifier): Promise<NamespaceIdentifier[]> {\n const query = parent ? { parent: namespaceToPath(parent.namespace) } : undefined\n\n const response = await this.client.request<ListNamespacesResponse>({\n method: 'GET',\n path: `${this.prefix}/namespaces`,\n query,\n })\n\n return response.data.namespaces.map((ns) => ({ namespace: ns }))\n }\n\n async createNamespace(\n id: NamespaceIdentifier,\n metadata?: NamespaceMetadata\n ): Promise<CreateNamespaceResponse> {\n const request: CreateNamespaceRequest = {\n namespace: id.namespace,\n properties: metadata?.properties,\n }\n\n const response = await this.client.request<CreateNamespaceResponse>({\n method: 'POST',\n path: `${this.prefix}/namespaces`,\n body: request,\n })\n\n return response.data\n }\n\n async dropNamespace(id: NamespaceIdentifier): Promise<void> {\n await this.client.request<void>({\n method: 'DELETE',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}`,\n })\n }\n\n async loadNamespaceMetadata(id: NamespaceIdentifier): Promise<NamespaceMetadata> {\n const response = await this.client.request<GetNamespaceResponse>({\n method: 'GET',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}`,\n })\n\n return {\n properties: response.data.properties,\n }\n }\n\n async namespaceExists(id: NamespaceIdentifier): Promise<boolean> {\n try {\n await this.client.request<void>({\n method: 'HEAD',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}`,\n })\n return true\n } catch (error) {\n if (error instanceof IcebergError && error.status === 404) {\n return false\n }\n throw error\n }\n }\n\n async createNamespaceIfNotExists(\n id: NamespaceIdentifier,\n metadata?: NamespaceMetadata\n ): Promise<CreateNamespaceResponse | void> {\n try {\n return await this.createNamespace(id, metadata)\n } catch (error) {\n if (error instanceof IcebergError && error.status === 409) {\n return\n }\n throw error\n }\n }\n}\n","import type { HttpClient } from '../http/types'\nimport { IcebergError } from '../errors/IcebergError'\nimport type {\n CreateTableRequest,\n CommitTableResponse,\n ListTablesResponse,\n LoadTableResponse,\n NamespaceIdentifier,\n TableIdentifier,\n TableMetadata,\n UpdateTableRequest,\n DropTableRequest,\n} from './types'\n\nfunction namespaceToPath(namespace: string[]): string {\n return namespace.join('\\x1F')\n}\n\nexport class TableOperations {\n constructor(\n private readonly client: HttpClient,\n private readonly prefix: string = '',\n private readonly accessDelegation?: string\n ) {}\n\n async listTables(namespace: NamespaceIdentifier): Promise<TableIdentifier[]> {\n const response = await this.client.request<ListTablesResponse>({\n method: 'GET',\n path: `${this.prefix}/namespaces/${namespaceToPath(namespace.namespace)}/tables`,\n })\n\n return response.data.identifiers\n }\n\n async createTable(\n namespace: NamespaceIdentifier,\n request: CreateTableRequest\n ): Promise<TableMetadata> {\n const headers: Record<string, string> = {}\n if (this.accessDelegation) {\n headers['X-Iceberg-Access-Delegation'] = this.accessDelegation\n }\n\n const response = await this.client.request<LoadTableResponse>({\n method: 'POST',\n path: `${this.prefix}/namespaces/${namespaceToPath(namespace.namespace)}/tables`,\n body: request,\n headers,\n })\n\n return response.data.metadata\n }\n\n async updateTable(id: TableIdentifier, request: UpdateTableRequest): Promise<CommitTableResponse> {\n const response = await this.client.request<LoadTableResponse>({\n method: 'POST',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}/tables/${id.name}`,\n body: request,\n })\n\n return {\n 'metadata-location': response.data['metadata-location'],\n metadata: response.data.metadata,\n }\n }\n\n async dropTable(id: TableIdentifier, options?: DropTableRequest): Promise<void> {\n await this.client.request<void>({\n method: 'DELETE',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}/tables/${id.name}`,\n query: { purgeRequested: String(options?.purge ?? false) },\n })\n }\n\n async loadTable(id: TableIdentifier): Promise<TableMetadata> {\n const headers: Record<string, string> = {}\n if (this.accessDelegation) {\n headers['X-Iceberg-Access-Delegation'] = this.accessDelegation\n }\n\n const response = await this.client.request<LoadTableResponse>({\n method: 'GET',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}/tables/${id.name}`,\n headers,\n })\n\n return response.data.metadata\n }\n\n async tableExists(id: TableIdentifier): Promise<boolean> {\n const headers: Record<string, string> = {}\n if (this.accessDelegation) {\n headers['X-Iceberg-Access-Delegation'] = this.accessDelegation\n }\n\n try {\n await this.client.request<void>({\n method: 'HEAD',\n path: `${this.prefix}/namespaces/${namespaceToPath(id.namespace)}/tables/${id.name}`,\n headers,\n })\n return true\n } catch (error) {\n if (error instanceof IcebergError && error.status === 404) {\n return false\n }\n throw error\n }\n }\n\n async createTableIfNotExists(\n namespace: NamespaceIdentifier,\n request: CreateTableRequest\n ): Promise<TableMetadata> {\n try {\n return await this.createTable(namespace, request)\n } catch (error) {\n if (error instanceof IcebergError && error.status === 409) {\n return await this.loadTable({ namespace: namespace.namespace, name: request.name })\n }\n throw error\n }\n }\n}\n","import { createFetchClient } from '../http/createFetchClient'\nimport type { AuthConfig, HttpClient } from '../http/types'\nimport { NamespaceOperations } from './namespaces'\nimport { TableOperations } from './tables'\nimport type {\n CreateTableRequest,\n CreateNamespaceResponse,\n CommitTableResponse,\n NamespaceIdentifier,\n NamespaceMetadata,\n TableIdentifier,\n TableMetadata,\n UpdateTableRequest,\n DropTableRequest,\n} from './types'\n\n/**\n * Access delegation mechanisms supported by the Iceberg REST Catalog.\n *\n * - `vended-credentials`: Server provides temporary credentials for data access\n * - `remote-signing`: Server signs requests on behalf of the client\n */\nexport type AccessDelegation = 'vended-credentials' | 'remote-signing'\n\n/**\n * Configuration options for the Iceberg REST Catalog client.\n */\nexport interface IcebergRestCatalogOptions {\n /** Base URL of the Iceberg REST Catalog API */\n baseUrl: string\n /** Optional catalog name prefix for multi-catalog servers */\n catalogName?: string\n /** Authentication configuration */\n auth?: AuthConfig\n /** Custom fetch implementation (defaults to globalThis.fetch) */\n fetch?: typeof fetch\n /**\n * Access delegation mechanisms to request from the server.\n * When specified, the X-Iceberg-Access-Delegation header will be sent\n * with supported operations (createTable, loadTable).\n *\n * @example ['vended-credentials']\n * @example ['vended-credentials', 'remote-signing']\n */\n accessDelegation?: AccessDelegation[]\n}\n\n/**\n * Client for interacting with an Apache Iceberg REST Catalog.\n *\n * This class provides methods for managing namespaces and tables in an Iceberg catalog.\n * It handles authentication, request formatting, and error handling automatically.\n *\n * @example\n * ```typescript\n * const catalog = new IcebergRestCatalog({\n * baseUrl: 'https://my-catalog.example.com/iceberg/v1',\n * auth: { type: 'bearer', token: process.env.ICEBERG_TOKEN }\n * });\n *\n * // Create a namespace\n * await catalog.createNamespace({ namespace: ['analytics'] });\n *\n * // Create a table\n * await catalog.createTable(\n * { namespace: ['analytics'] },\n * {\n * name: 'events',\n * schema: { type: 'struct', fields: [...] }\n * }\n * );\n * ```\n */\nexport class IcebergRestCatalog {\n private readonly client: HttpClient\n private readonly namespaceOps: NamespaceOperations\n private readonly tableOps: TableOperations\n private readonly accessDelegation?: string\n\n /**\n * Creates a new Iceberg REST Catalog client.\n *\n * @param options - Configuration options for the catalog client\n */\n constructor(options: IcebergRestCatalogOptions) {\n let prefix = 'v1'\n if (options.catalogName) {\n prefix += `/${options.catalogName}`\n }\n\n const baseUrl = options.baseUrl.endsWith('/') ? options.baseUrl : `${options.baseUrl}/`\n\n this.client = createFetchClient({\n baseUrl,\n auth: options.auth,\n fetchImpl: options.fetch,\n })\n\n // Format accessDelegation as comma-separated string per spec\n this.accessDelegation = options.accessDelegation?.join(',')\n\n this.namespaceOps = new NamespaceOperations(this.client, prefix)\n this.tableOps = new TableOperations(this.client, prefix, this.accessDelegation)\n }\n\n /**\n * Lists all namespaces in the catalog.\n *\n * @param parent - Optional parent namespace to list children under\n * @returns Array of namespace identifiers\n *\n * @example\n * ```typescript\n * // List all top-level namespaces\n * const namespaces = await catalog.listNamespaces();\n *\n * // List namespaces under a parent\n * const children = await catalog.listNamespaces({ namespace: ['analytics'] });\n * ```\n */\n async listNamespaces(parent?: NamespaceIdentifier): Promise<NamespaceIdentifier[]> {\n return this.namespaceOps.listNamespaces(parent)\n }\n\n /**\n * Creates a new namespace in the catalog.\n *\n * @param id - Namespace identifier to create\n * @param metadata - Optional metadata properties for the namespace\n * @returns Response containing the created namespace and its properties\n *\n * @example\n * ```typescript\n * const response = await catalog.createNamespace(\n * { namespace: ['analytics'] },\n * { properties: { owner: 'data-team' } }\n * );\n * console.log(response.namespace); // ['analytics']\n * console.log(response.properties); // { owner: 'data-team', ... }\n * ```\n */\n async createNamespace(id: NamespaceIdentifier, metadata?: NamespaceMetadata): Promise<CreateNamespaceResponse> {\n return this.namespaceOps.createNamespace(id, metadata)\n }\n\n /**\n * Drops a namespace from the catalog.\n *\n * The namespace must be empty (contain no tables) before it can be dropped.\n *\n * @param id - Namespace identifier to drop\n *\n * @example\n * ```typescript\n * await catalog.dropNamespace({ namespace: ['analytics'] });\n * ```\n */\n async dropNamespace(id: NamespaceIdentifier): Promise<void> {\n await this.namespaceOps.dropNamespace(id)\n }\n\n /**\n * Loads metadata for a namespace.\n *\n * @param id - Namespace identifier to load\n * @returns Namespace metadata including properties\n *\n * @example\n * ```typescript\n * const metadata = await catalog.loadNamespaceMetadata({ namespace: ['analytics'] });\n * console.log(metadata.properties);\n * ```\n */\n async loadNamespaceMetadata(id: NamespaceIdentifier): Promise<NamespaceMetadata> {\n return this.namespaceOps.loadNamespaceMetadata(id)\n }\n\n /**\n * Lists all tables in a namespace.\n *\n * @param namespace - Namespace identifier to list tables from\n * @returns Array of table identifiers\n *\n * @example\n * ```typescript\n * const tables = await catalog.listTables({ namespace: ['analytics'] });\n * console.log(tables); // [{ namespace: ['analytics'], name: 'events' }, ...]\n * ```\n */\n async listTables(namespace: NamespaceIdentifier): Promise<TableIdentifier[]> {\n return this.tableOps.listTables(namespace)\n }\n\n /**\n * Creates a new table in the catalog.\n *\n * @param namespace - Namespace to create the table in\n * @param request - Table creation request including name, schema, partition spec, etc.\n * @returns Table metadata for the created table\n *\n * @example\n * ```typescript\n * const metadata = await catalog.createTable(\n * { namespace: ['analytics'] },\n * {\n * name: 'events',\n * schema: {\n * type: 'struct',\n * fields: [\n * { id: 1, name: 'id', type: 'long', required: true },\n * { id: 2, name: 'timestamp', type: 'timestamp', required: true }\n * ],\n * 'schema-id': 0\n * },\n * 'partition-spec': {\n * 'spec-id': 0,\n * fields: [\n * { source_id: 2, field_id: 1000, name: 'ts_day', transform: 'day' }\n * ]\n * }\n * }\n * );\n * ```\n */\n async createTable(\n namespace: NamespaceIdentifier,\n request: CreateTableRequest\n ): Promise<TableMetadata> {\n return this.tableOps.createTable(namespace, request)\n }\n\n /**\n * Updates an existing table's metadata.\n *\n * Can update the schema, partition spec, or properties of a table.\n *\n * @param id - Table identifier to update\n * @param request - Update request with fields to modify\n * @returns Response containing the metadata location and updated table metadata\n *\n * @example\n * ```typescript\n * const response = await catalog.updateTable(\n * { namespace: ['analytics'], name: 'events' },\n * {\n * properties: { 'read.split.target-size': '134217728' }\n * }\n * );\n * console.log(response['metadata-location']); // s3://...\n * console.log(response.metadata); // TableMetadata object\n * ```\n */\n async updateTable(id: TableIdentifier, request: UpdateTableRequest): Promise<CommitTableResponse> {\n return this.tableOps.updateTable(id, request)\n }\n\n /**\n * Drops a table from the catalog.\n *\n * @param id - Table identifier to drop\n *\n * @example\n * ```typescript\n * await catalog.dropTable({ namespace: ['analytics'], name: 'events' });\n * ```\n */\n async dropTable(id: TableIdentifier, options?: DropTableRequest): Promise<void> {\n await this.tableOps.dropTable(id, options)\n }\n\n /**\n * Loads metadata for a table.\n *\n * @param id - Table identifier to load\n * @returns Table metadata including schema, partition spec, location, etc.\n *\n * @example\n * ```typescript\n * const metadata = await catalog.loadTable({ namespace: ['analytics'], name: 'events' });\n * console.log(metadata.schema);\n * console.log(metadata.location);\n * ```\n */\n async loadTable(id: TableIdentifier): Promise<TableMetadata> {\n return this.tableOps.loadTable(id)\n }\n\n /**\n * Checks if a namespace exists in the catalog.\n *\n * @param id - Namespace identifier to check\n * @returns True if the namespace exists, false otherwise\n *\n * @example\n * ```typescript\n * const exists = await catalog.namespaceExists({ namespace: ['analytics'] });\n * console.log(exists); // true or false\n * ```\n */\n async namespaceExists(id: NamespaceIdentifier): Promise<boolean> {\n return this.namespaceOps.namespaceExists(id)\n }\n\n /**\n * Checks if a table exists in the catalog.\n *\n * @param id - Table identifier to check\n * @returns True if the table exists, false otherwise\n *\n * @example\n * ```typescript\n * const exists = await catalog.tableExists({ namespace: ['analytics'], name: 'events' });\n * console.log(exists); // true or false\n * ```\n */\n async tableExists(id: TableIdentifier): Promise<boolean> {\n return this.tableOps.tableExists(id)\n }\n\n /**\n * Creates a namespace if it does not exist.\n *\n * If the namespace already exists, returns void. If created, returns the response.\n *\n * @param id - Namespace identifier to create\n * @param metadata - Optional metadata properties for the namespace\n * @returns Response containing the created namespace and its properties, or void if it already exists\n *\n * @example\n * ```typescript\n * const response = await catalog.createNamespaceIfNotExists(\n * { namespace: ['analytics'] },\n * { properties: { owner: 'data-team' } }\n * );\n * if (response) {\n * console.log('Created:', response.namespace);\n * } else {\n * console.log('Already exists');\n * }\n * ```\n */\n async createNamespaceIfNotExists(\n id: NamespaceIdentifier,\n metadata?: NamespaceMetadata\n ): Promise<CreateNamespaceResponse | void> {\n return this.namespaceOps.createNamespaceIfNotExists(id, metadata)\n }\n\n /**\n * Creates a table if it does not exist.\n *\n * If the table already exists, returns its metadata instead.\n *\n * @param namespace - Namespace to create the table in\n * @param request - Table creation request including name, schema, partition spec, etc.\n * @returns Table metadata for the created or existing table\n *\n * @example\n * ```typescript\n * const metadata = await catalog.createTableIfNotExists(\n * { namespace: ['analytics'] },\n * {\n * name: 'events',\n * schema: {\n * type: 'struct',\n * fields: [\n * { id: 1, name: 'id', type: 'long', required: true },\n * { id: 2, name: 'timestamp', type: 'timestamp', required: true }\n * ],\n * 'schema-id': 0\n * }\n * }\n * );\n * ```\n */\n async createTableIfNotExists(\n namespace: NamespaceIdentifier,\n request: CreateTableRequest\n ): Promise<TableMetadata> {\n return this.tableOps.createTableIfNotExists(namespace, request)\n }\n}\n","export interface NamespaceIdentifier {\n namespace: string[]\n}\n\nexport interface NamespaceMetadata {\n properties: Record<string, string>\n}\n\nexport interface TableIdentifier {\n namespace: string[]\n name: string\n}\n\n/**\n * Primitive types in Iceberg - all represented as strings.\n * Parameterized types use string format: decimal(precision,scale) and fixed[length]\n *\n * Note: The OpenAPI spec defines PrimitiveType as `type: string`, so any string is valid.\n * We include known types for autocomplete, plus a catch-all for flexibility.\n */\nexport type PrimitiveType =\n | 'boolean'\n | 'int'\n | 'long'\n | 'float'\n | 'double'\n | 'string'\n | 'timestamp'\n | 'date'\n | 'time'\n | 'timestamptz'\n | 'uuid'\n | 'binary'\n | `decimal(${number},${number})`\n | `fixed[${number}]`\n | (string & {}) // catch-all for any format (e.g., \"decimal(10, 2)\" with spaces) and future types\n\n/**\n * Regex patterns for parsing parameterized types.\n * These allow flexible whitespace matching.\n */\nconst DECIMAL_REGEX = /^decimal\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)$/\nconst FIXED_REGEX = /^fixed\\s*\\[\\s*(\\d+)\\s*\\]$/\n\n/**\n * Parse a decimal type string into its components.\n * Handles any whitespace formatting (e.g., \"decimal(10,2)\", \"decimal(10, 2)\", \"decimal( 10 , 2 )\").\n *\n * @param type - The type string to parse\n * @returns Object with precision and scale, or null if not a valid decimal type\n */\nexport function parseDecimalType(type: string): { precision: number; scale: number } | null {\n const match = type.match(DECIMAL_REGEX)\n if (!match) return null\n return {\n precision: parseInt(match[1], 10),\n scale: parseInt(match[2], 10),\n }\n}\n\n/**\n * Parse a fixed type string into its length.\n * Handles any whitespace formatting (e.g., \"fixed[16]\", \"fixed[ 16 ]\").\n *\n * @param type - The type string to parse\n * @returns Object with length, or null if not a valid fixed type\n */\nexport function parseFixedType(type: string): { length: number } | null {\n const match = type.match(FIXED_REGEX)\n if (!match) return null\n return {\n length: parseInt(match[1], 10),\n }\n}\n\n/**\n * Check if a type string is a decimal type.\n */\nexport function isDecimalType(type: string): boolean {\n return DECIMAL_REGEX.test(type)\n}\n\n/**\n * Check if a type string is a fixed type.\n */\nexport function isFixedType(type: string): boolean {\n return FIXED_REGEX.test(type)\n}\n\n/**\n * Compare two Iceberg type strings for equality, ignoring whitespace differences.\n * This is useful when comparing types from user input vs catalog responses,\n * as catalogs may normalize whitespace differently.\n *\n * @param a - First type string\n * @param b - Second type string\n * @returns true if the types are equivalent\n */\nexport function typesEqual(a: string, b: string): boolean {\n // For decimal types, compare parsed values\n const decimalA = parseDecimalType(a)\n const decimalB = parseDecimalType(b)\n if (decimalA && decimalB) {\n return decimalA.precision === decimalB.precision && decimalA.scale === decimalB.scale\n }\n\n // For fixed types, compare parsed values\n const fixedA = parseFixedType(a)\n const fixedB = parseFixedType(b)\n if (fixedA && fixedB) {\n return fixedA.length === fixedB.length\n }\n\n // For other types, direct string comparison\n return a === b\n}\n\n/**\n * Struct type - a nested structure containing fields.\n * Used for nested records within a field.\n */\nexport interface StructType {\n type: 'struct'\n fields: StructField[]\n}\n\n/**\n * List type - an array of elements.\n */\nexport interface ListType {\n type: 'list'\n 'element-id': number\n element: IcebergType\n 'element-required': boolean\n}\n\n/**\n * Map type - a key-value mapping.\n */\nexport interface MapType {\n type: 'map'\n 'key-id': number\n key: IcebergType\n 'value-id': number\n value: IcebergType\n 'value-required': boolean\n}\n\n/**\n * Union of all Iceberg types.\n * Can be a primitive type (string) or a complex type (struct, list, map).\n */\nexport type IcebergType = PrimitiveType | StructType | ListType | MapType\n\n/**\n * Primitive type values for default values.\n * Represents the possible values for initial-default and write-default.\n */\nexport type PrimitiveTypeValue = boolean | number | string\n\n/**\n * A field within a struct (used in nested StructType).\n */\nexport interface StructField {\n id: number\n name: string\n type: IcebergType\n required: boolean\n doc?: string\n 'initial-default'?: PrimitiveTypeValue\n 'write-default'?: PrimitiveTypeValue\n}\n\n/**\n * A field within a table schema (top-level).\n * Equivalent to StructField but kept for backwards compatibility.\n */\nexport interface TableField {\n id: number\n name: string\n type: IcebergType\n required: boolean\n doc?: string\n 'initial-default'?: PrimitiveTypeValue\n 'write-default'?: PrimitiveTypeValue\n}\n\nexport interface TableSchema {\n type: 'struct'\n fields: TableField[]\n 'schema-id'?: number\n 'identifier-field-ids'?: number[]\n}\n\nexport interface PartitionField {\n source_id: number\n field_id: number\n name: string\n transform: string\n}\n\nexport interface PartitionSpec {\n 'spec-id': number\n fields: PartitionField[]\n}\n\nexport interface SortField {\n source_id: number\n transform: string\n direction: 'asc' | 'desc'\n null_order: 'nulls-first' | 'nulls-last'\n}\n\nexport interface SortOrder {\n 'order-id': number\n fields: SortField[]\n}\n\nexport interface CreateTableRequest {\n name: string\n schema: TableSchema\n 'partition-spec'?: PartitionSpec\n 'write-order'?: SortOrder\n properties?: Record<string, string>\n 'stage-create'?: boolean\n}\n\nexport interface UpdateTableRequest {\n schema?: TableSchema\n 'partition-spec'?: PartitionSpec\n properties?: Record<string, string>\n}\n\nexport interface DropTableRequest {\n purge?: boolean\n}\n\nexport interface TableMetadata {\n name?: string\n location: string\n schemas: TableSchema[]\n 'current-schema-id': number\n 'partition-specs': PartitionSpec[]\n 'default-spec-id'?: number\n 'sort-orders': SortOrder[]\n 'default-sort-order-id'?: number\n properties: Record<string, string>\n 'metadata-location'?: string\n 'current-snapshot-id'?: number\n snapshots?: unknown[]\n 'snapshot-log'?: unknown[]\n 'metadata-log'?: unknown[]\n refs?: Record<string, unknown>\n 'last-updated-ms'?: number\n 'last-column-id'?: number\n 'last-sequence-number'?: number\n 'table-uuid'?: string\n 'format-version'?: number\n 'last-partition-id'?: number\n}\n\nexport interface CreateNamespaceRequest {\n namespace: string[]\n properties?: Record<string, string>\n}\n\nexport interface CreateNamespaceResponse {\n namespace: string[]\n properties?: Record<string, string>\n}\n\nexport interface GetNamespaceResponse {\n namespace: string[]\n properties: Record<string, string>\n}\n\nexport interface ListNamespacesResponse {\n namespaces: string[][]\n 'next-page-token'?: string\n}\n\nexport interface ListTablesResponse {\n identifiers: TableIdentifier[]\n 'next-page-token'?: string\n}\n\nexport interface LoadTableResponse {\n 'metadata-location': string\n metadata: TableMetadata\n config?: Record<string, string>\n}\n\nexport interface CommitTableResponse {\n 'metadata-location': string\n metadata: TableMetadata\n}\n\n/**\n * Gets the current (active) schema from table metadata.\n *\n * @param metadata - Table metadata containing schemas array and current-schema-id\n * @returns The current table schema, or undefined if not found\n */\nexport function getCurrentSchema(metadata: TableMetadata): TableSchema | undefined {\n return metadata.schemas.find((s) => s['schema-id'] === metadata['current-schema-id'])\n}\n"]}