@xata.io/client 0.26.1 → 0.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-add-version.log +1 -1
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +88 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +44 -9
- package/dist/index.mjs +87 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -7229,19 +7229,44 @@ declare class XataFile {
|
|
7229
7229
|
url: string;
|
7230
7230
|
signedUrl: string | undefined;
|
7231
7231
|
metadataUrl: string;
|
7232
|
+
metadataSignedUrl: string | undefined;
|
7232
7233
|
};
|
7233
7234
|
}
|
7234
7235
|
type XataArrayFile = Identifiable & XataFile;
|
7235
7236
|
|
7236
7237
|
type SelectableColumn<O, RecursivePath extends any[] = []> = '*' | 'id' | `xata.${'version' | 'createdAt' | 'updatedAt'}` | DataProps<O> | NestedColumns<O, RecursivePath>;
|
7238
|
+
type ExpandedColumnNotation = {
|
7239
|
+
name: string;
|
7240
|
+
columns?: SelectableColumn<any>[];
|
7241
|
+
as?: string;
|
7242
|
+
limit?: number;
|
7243
|
+
offset?: number;
|
7244
|
+
order?: {
|
7245
|
+
column: string;
|
7246
|
+
order: 'asc' | 'desc';
|
7247
|
+
}[];
|
7248
|
+
};
|
7249
|
+
type SelectableColumnWithObjectNotation<O, RecursivePath extends any[] = []> = SelectableColumn<O, RecursivePath> | ExpandedColumnNotation;
|
7250
|
+
declare function isValidExpandedColumn(column: any): column is ExpandedColumnNotation;
|
7251
|
+
declare function isValidSelectableColumns(columns: any): columns is SelectableColumn<any>[];
|
7252
|
+
type StringColumns<T> = T extends string ? T : never;
|
7253
|
+
type ProjectionColumns<T> = T extends string ? never : T extends {
|
7254
|
+
as: infer As;
|
7255
|
+
} ? NonNullable<As> extends string ? NonNullable<As> : never : never;
|
7237
7256
|
type WildcardColumns<O> = Values<{
|
7238
7257
|
[K in SelectableColumn<O>]: K extends `${string}*` ? K : never;
|
7239
7258
|
}>;
|
7240
7259
|
type ColumnsByValue<O, Value> = Values<{
|
7241
7260
|
[K in SelectableColumn<O>]: ValueAtColumn<O, K> extends infer C ? C extends Value ? K extends WildcardColumns<O> ? never : K : never : never;
|
7242
7261
|
}>;
|
7243
|
-
type SelectedPick<O extends XataRecord, Key extends
|
7244
|
-
[K in Key[number]]: NestedValueAtColumn<O, K> & XataRecord<O>;
|
7262
|
+
type SelectedPick<O extends XataRecord, Key extends SelectableColumnWithObjectNotation<O>[]> = XataRecord<O> & UnionToIntersection<Values<{
|
7263
|
+
[K in StringColumns<Key[number]>]: NestedValueAtColumn<O, K> & XataRecord<O>;
|
7264
|
+
}>> & UnionToIntersection<Values<{
|
7265
|
+
[K in ProjectionColumns<Key[number]>]: {
|
7266
|
+
[Key in K]: {
|
7267
|
+
records: (Record<string, any> & XataRecord<O>)[];
|
7268
|
+
};
|
7269
|
+
};
|
7245
7270
|
}>>;
|
7246
7271
|
type ValueAtColumn<Object, Key> = Key extends '*' ? Values<Object> : Key extends 'id' ? string : Key extends 'xata.version' ? number : Key extends 'xata.createdAt' ? Date : Key extends 'xata.updatedAt' ? Date : Key extends keyof Object ? Object[Key] : Key extends `${infer K}.${infer V}` ? K extends keyof Object ? Values<NonNullable<Object[K]> extends infer Item ? Item extends Record<string, any> ? V extends SelectableColumn<Item> ? {
|
7247
7272
|
V: ValueAtColumn<Item, V>;
|
@@ -7420,7 +7445,15 @@ type JSONData<O> = JSONDataBase & Partial<Omit<{
|
|
7420
7445
|
[K in keyof O]: JSONDataFields<O[K]>;
|
7421
7446
|
}, keyof XataRecord>>;
|
7422
7447
|
|
7448
|
+
type JSONValue<Value> = Value & {
|
7449
|
+
__json: true;
|
7450
|
+
};
|
7451
|
+
|
7452
|
+
type JSONFilterColumns<Record> = Values<{
|
7453
|
+
[K in keyof Record]: NonNullable<Record[K]> extends JSONValue<any> ? K extends string ? `${K}->${string}` : never : never;
|
7454
|
+
}>;
|
7423
7455
|
type FilterColumns<T> = ColumnsByValue<T, any> | `xata.${keyof XataRecordMetadata}`;
|
7456
|
+
type FilterValueAtColumn<Record, F> = NonNullable<ValueAtColumn<Record, F>> extends JSONValue<any> ? PropertyFilter<any> : Filter<NonNullable<ValueAtColumn<Record, F>>>;
|
7424
7457
|
/**
|
7425
7458
|
* PropertyMatchFilter
|
7426
7459
|
* Example:
|
@@ -7441,6 +7474,8 @@ type FilterColumns<T> = ColumnsByValue<T, any> | `xata.${keyof XataRecordMetadat
|
|
7441
7474
|
*/
|
7442
7475
|
type PropertyAccessFilter<Record> = {
|
7443
7476
|
[key in FilterColumns<Record>]?: NestedApiFilter<ValueAtColumn<Record, key>> | PropertyFilter<ValueAtColumn<Record, key>>;
|
7477
|
+
} & {
|
7478
|
+
[key in JSONFilterColumns<Record>]?: PropertyFilter<Record[keyof Record]>;
|
7444
7479
|
};
|
7445
7480
|
type PropertyFilter<T> = T | {
|
7446
7481
|
$is: T;
|
@@ -7923,7 +7958,7 @@ type SummarizeFilter<Record extends XataRecord, Expression extends Dictionary<Su
|
|
7923
7958
|
type SummarizeResultItem<Record extends XataRecord, Expression extends Dictionary<SummarizeExpression<Record>>, Columns extends SelectableColumn<Record>[]> = SummarizeValuePick<Record, Expression> & SelectedPick<Record, Columns>;
|
7924
7959
|
|
7925
7960
|
type BaseOptions<T extends XataRecord> = {
|
7926
|
-
columns?:
|
7961
|
+
columns?: SelectableColumnWithObjectNotation<T>[];
|
7927
7962
|
consistency?: 'strong' | 'eventual';
|
7928
7963
|
cache?: number;
|
7929
7964
|
fetchOptions?: Record<string, unknown>;
|
@@ -7991,7 +8026,7 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
7991
8026
|
* @param value The value to filter.
|
7992
8027
|
* @returns A new Query object.
|
7993
8028
|
*/
|
7994
|
-
filter<F extends
|
8029
|
+
filter<F extends FilterColumns<Record> | JSONFilterColumns<Record>>(column: F, value: FilterValueAtColumn<Record, F>): Query<Record, Result>;
|
7995
8030
|
/**
|
7996
8031
|
* Builds a new query object adding one or more constraints. Examples:
|
7997
8032
|
*
|
@@ -8012,15 +8047,15 @@ declare class Query<Record extends XataRecord, Result extends XataRecord = Recor
|
|
8012
8047
|
* @param direction The direction. Either ascending or descending.
|
8013
8048
|
* @returns A new Query object.
|
8014
8049
|
*/
|
8015
|
-
sort<F extends
|
8050
|
+
sort<F extends SortColumns<Record>>(column: F, direction: SortDirection): Query<Record, Result>;
|
8016
8051
|
sort(column: '*', direction: 'random'): Query<Record, Result>;
|
8017
|
-
sort<F extends
|
8052
|
+
sort<F extends SortColumns<Record>>(column: F): Query<Record, Result>;
|
8018
8053
|
/**
|
8019
8054
|
* Builds a new query specifying the set of columns to be returned in the query response.
|
8020
8055
|
* @param columns Array of column names to be returned by the query.
|
8021
8056
|
* @returns A new Query object.
|
8022
8057
|
*/
|
8023
|
-
select<K extends
|
8058
|
+
select<K extends SelectableColumnWithObjectNotation<Record>>(columns: K[]): Query<Record, SelectedPick<Record, K[]>>;
|
8024
8059
|
/**
|
8025
8060
|
* Get paginated results
|
8026
8061
|
*
|
@@ -9034,7 +9069,7 @@ type PropertyType<Tables, Properties, PropertyName extends PropertyKey> = Proper
|
|
9034
9069
|
} : {
|
9035
9070
|
[K in PropertyName]?: InnerType<Type, ObjectColumns, Tables, LinkedTable> | null;
|
9036
9071
|
} : never : never;
|
9037
|
-
type InnerType<Type, ObjectColumns, Tables, LinkedTable> = Type extends 'string' | 'text' | 'email' ? string : Type extends 'int' | 'float' ? number : Type extends 'bool' ? boolean : Type extends 'datetime' ? Date : Type extends 'multiple' ? string[] : Type extends 'vector' ? number[] : Type extends 'file' ? XataFile : Type extends 'file[]' ? XataArrayFile[] : Type extends 'object' ? ObjectColumns extends readonly unknown[] ? ObjectColumns[number] extends {
|
9072
|
+
type InnerType<Type, ObjectColumns, Tables, LinkedTable> = Type extends 'string' | 'text' | 'email' ? string : Type extends 'int' | 'float' ? number : Type extends 'bool' ? boolean : Type extends 'datetime' ? Date : Type extends 'multiple' ? string[] : Type extends 'vector' ? number[] : Type extends 'file' ? XataFile : Type extends 'file[]' ? XataArrayFile[] : Type extends 'json' ? JSONValue<any> : Type extends 'object' ? ObjectColumns extends readonly unknown[] ? ObjectColumns[number] extends {
|
9038
9073
|
name: string;
|
9039
9074
|
type: string;
|
9040
9075
|
} ? UnionToIntersection<Values<{
|
@@ -9427,4 +9462,4 @@ declare class XataError extends Error {
|
|
9427
9462
|
constructor(message: string, status: number);
|
9428
9463
|
}
|
9429
9464
|
|
9430
|
-
export { type AcceptWorkspaceMemberInviteError, type AcceptWorkspaceMemberInvitePathParams, type AcceptWorkspaceMemberInviteVariables, type AddGitBranchesEntryError, type AddGitBranchesEntryPathParams, type AddGitBranchesEntryRequestBody, type AddGitBranchesEntryResponse, type AddGitBranchesEntryVariables, type AddTableColumnError, type AddTableColumnPathParams, type AddTableColumnVariables, type AggregateTableError, type AggregateTablePathParams, type AggregateTableRequestBody, type AggregateTableVariables, type ApiExtraProps, type ApplyBranchSchemaEditError, type ApplyBranchSchemaEditPathParams, type ApplyBranchSchemaEditRequestBody, type ApplyBranchSchemaEditVariables, type AskOptions, type AskResult, type AskTableError, type AskTablePathParams, type AskTableRequestBody, type AskTableResponse, type AskTableSessionError, type AskTableSessionPathParams, type AskTableSessionRequestBody, type AskTableSessionResponse, type AskTableSessionVariables, type AskTableVariables, BaseClient, type BaseClientOptions, type BaseData, type BaseSchema, type BinaryFile, type BranchTransactionError, type BranchTransactionPathParams, type BranchTransactionRequestBody, type BranchTransactionVariables, type BulkInsertTableRecordsError, type BulkInsertTableRecordsPathParams, type BulkInsertTableRecordsQueryParams, type BulkInsertTableRecordsRequestBody, type BulkInsertTableRecordsVariables, type CacheImpl, type CancelWorkspaceMemberInviteError, type CancelWorkspaceMemberInvitePathParams, type CancelWorkspaceMemberInviteVariables, type ClientConstructor, type ColumnsByValue, type CompareBranchSchemasError, type CompareBranchSchemasPathParams, type CompareBranchSchemasRequestBody, type CompareBranchSchemasVariables, type CompareBranchWithUserSchemaError, type CompareBranchWithUserSchemaPathParams, type CompareBranchWithUserSchemaRequestBody, type CompareBranchWithUserSchemaVariables, type CompareMigrationRequestError, type CompareMigrationRequestPathParams, type CompareMigrationRequestVariables, type CopyBranchError, type CopyBranchPathParams, type CopyBranchRequestBody, type CopyBranchVariables, type CreateBranchError, type CreateBranchPathParams, type CreateBranchQueryParams, type CreateBranchRequestBody, type CreateBranchResponse, type CreateBranchVariables, type CreateDatabaseError, type CreateDatabasePathParams, type CreateDatabaseRequestBody, type CreateDatabaseResponse, type CreateDatabaseVariables, type CreateMigrationRequestError, type CreateMigrationRequestPathParams, type CreateMigrationRequestRequestBody, type CreateMigrationRequestResponse, type CreateMigrationRequestVariables, type CreateTableError, type CreateTablePathParams, type CreateTableResponse, type CreateTableVariables, type CreateUserAPIKeyError, type CreateUserAPIKeyPathParams, type CreateUserAPIKeyResponse, type CreateUserAPIKeyVariables, type CreateWorkspaceError, type CreateWorkspaceVariables, type CursorNavigationOptions, type DeleteBranchError, type DeleteBranchPathParams, type DeleteBranchResponse, type DeleteBranchVariables, type DeleteColumnError, type DeleteColumnPathParams, type DeleteColumnVariables, type DeleteDatabaseError, type DeleteDatabaseGithubSettingsError, type DeleteDatabaseGithubSettingsPathParams, type DeleteDatabaseGithubSettingsVariables, type DeleteDatabasePathParams, type DeleteDatabaseResponse, type DeleteDatabaseVariables, type DeleteFileError, type DeleteFileItemError, type DeleteFileItemPathParams, type DeleteFileItemVariables, type DeleteFilePathParams, type DeleteFileVariables, type DeleteOAuthAccessTokenError, type DeleteOAuthAccessTokenPathParams, type DeleteOAuthAccessTokenVariables, type DeleteRecordError, type DeleteRecordPathParams, type DeleteRecordQueryParams, type DeleteRecordVariables, type DeleteTableError, type DeleteTablePathParams, type DeleteTableResponse, type DeleteTableVariables, type DeleteUserAPIKeyError, type DeleteUserAPIKeyPathParams, type DeleteUserAPIKeyVariables, type DeleteUserError, type DeleteUserOAuthClientError, type DeleteUserOAuthClientPathParams, type DeleteUserOAuthClientVariables, type DeleteUserVariables, type DeleteWorkspaceError, type DeleteWorkspacePathParams, type DeleteWorkspaceVariables, type DeserializedType, type DownloadDestination, type EditableData, type ExecuteBranchMigrationPlanError, type ExecuteBranchMigrationPlanPathParams, type ExecuteBranchMigrationPlanRequestBody, type ExecuteBranchMigrationPlanVariables, type FetchImpl, FetcherError, type FetcherExtraProps, type FileAccessError, type FileAccessPathParams, type FileAccessQueryParams, type FileAccessVariables, FilesPlugin, type FilesPluginResult, type GetAuthorizationCodeError, type GetAuthorizationCodeQueryParams, type GetAuthorizationCodeVariables, type GetBranchDetailsError, type GetBranchDetailsPathParams, type GetBranchDetailsVariables, type GetBranchListError, type GetBranchListPathParams, type GetBranchListVariables, type GetBranchMetadataError, type GetBranchMetadataPathParams, type GetBranchMetadataVariables, type GetBranchMigrationHistoryError, type GetBranchMigrationHistoryPathParams, type GetBranchMigrationHistoryRequestBody, type GetBranchMigrationHistoryResponse, type GetBranchMigrationHistoryVariables, type GetBranchMigrationPlanError, type GetBranchMigrationPlanPathParams, type GetBranchMigrationPlanVariables, type GetBranchSchemaHistoryError, type GetBranchSchemaHistoryPathParams, type GetBranchSchemaHistoryRequestBody, type GetBranchSchemaHistoryResponse, type GetBranchSchemaHistoryVariables, type GetBranchStatsError, type GetBranchStatsPathParams, type GetBranchStatsResponse, type GetBranchStatsVariables, type GetColumnError, type GetColumnPathParams, type GetColumnVariables, type GetDatabaseGithubSettingsError, type GetDatabaseGithubSettingsPathParams, type GetDatabaseGithubSettingsVariables, type GetDatabaseListError, type GetDatabaseListPathParams, type GetDatabaseListVariables, type GetDatabaseMetadataError, type GetDatabaseMetadataPathParams, type GetDatabaseMetadataVariables, type GetFileError, type GetFileItemError, type GetFileItemPathParams, type GetFileItemVariables, type GetFilePathParams, type GetFileVariables, type GetGitBranchesMappingError, type GetGitBranchesMappingPathParams, type GetGitBranchesMappingVariables, type GetMigrationRequestError, type GetMigrationRequestIsMergedError, type GetMigrationRequestIsMergedPathParams, type GetMigrationRequestIsMergedResponse, type GetMigrationRequestIsMergedVariables, type GetMigrationRequestPathParams, type GetMigrationRequestVariables, type GetRecordError, type GetRecordPathParams, type GetRecordQueryParams, type GetRecordVariables, type GetTableColumnsError, type GetTableColumnsPathParams, type GetTableColumnsResponse, type GetTableColumnsVariables, type GetTableSchemaError, type GetTableSchemaPathParams, type GetTableSchemaResponse, type GetTableSchemaVariables, type GetUserAPIKeysError, type GetUserAPIKeysResponse, type GetUserAPIKeysVariables, type GetUserError, type GetUserOAuthAccessTokensError, type GetUserOAuthAccessTokensResponse, type GetUserOAuthAccessTokensVariables, type GetUserOAuthClientsError, type GetUserOAuthClientsResponse, type GetUserOAuthClientsVariables, type GetUserVariables, type GetWorkspaceError, type GetWorkspaceMembersListError, type GetWorkspaceMembersListPathParams, type GetWorkspaceMembersListVariables, type GetWorkspacePathParams, type GetWorkspaceVariables, type GetWorkspacesListError, type GetWorkspacesListResponse, type GetWorkspacesListVariables, type GrantAuthorizationCodeError, type GrantAuthorizationCodeVariables, type HostProvider, type Identifiable, type ImageTransformations, type InsertRecordError, type InsertRecordPathParams, type InsertRecordQueryParams, type InsertRecordVariables, type InsertRecordWithIDError, type InsertRecordWithIDPathParams, type InsertRecordWithIDQueryParams, type InsertRecordWithIDVariables, type InviteWorkspaceMemberError, type InviteWorkspaceMemberPathParams, type InviteWorkspaceMemberRequestBody, type InviteWorkspaceMemberVariables, type JSONData, type KeywordAskOptions, type Link, type ListMigrationRequestsCommitsError, type ListMigrationRequestsCommitsPathParams, type ListMigrationRequestsCommitsRequestBody, type ListMigrationRequestsCommitsResponse, type ListMigrationRequestsCommitsVariables, type ListRegionsError, type ListRegionsPathParams, type ListRegionsVariables, type MergeMigrationRequestError, type MergeMigrationRequestPathParams, type MergeMigrationRequestVariables, type OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, type Paginable, type PaginationQueryMeta, type PreviewBranchSchemaEditError, type PreviewBranchSchemaEditPathParams, type PreviewBranchSchemaEditRequestBody, type PreviewBranchSchemaEditResponse, type PreviewBranchSchemaEditVariables, type PushBranchMigrationsError, type PushBranchMigrationsPathParams, type PushBranchMigrationsRequestBody, type PushBranchMigrationsVariables, type PutFileError, type PutFileItemError, type PutFileItemPathParams, type PutFileItemVariables, type PutFilePathParams, type PutFileVariables, Query, type QueryMigrationRequestsError, type QueryMigrationRequestsPathParams, type QueryMigrationRequestsRequestBody, type QueryMigrationRequestsResponse, type QueryMigrationRequestsVariables, type QueryTableError, type QueryTablePathParams, type QueryTableRequestBody, type QueryTableVariables, RecordArray, RecordColumnTypes, type RemoveGitBranchesEntryError, type RemoveGitBranchesEntryPathParams, type RemoveGitBranchesEntryQueryParams, type RemoveGitBranchesEntryVariables, type RemoveWorkspaceMemberError, type RemoveWorkspaceMemberPathParams, type RemoveWorkspaceMemberVariables, type RenameDatabaseError, type RenameDatabasePathParams, type RenameDatabaseRequestBody, type RenameDatabaseVariables, Repository, type ResendWorkspaceMemberInviteError, type ResendWorkspaceMemberInvitePathParams, type ResendWorkspaceMemberInviteVariables, type ResolveBranchError, type ResolveBranchPathParams, type ResolveBranchQueryParams, type ResolveBranchResponse, type ResolveBranchVariables, responses as Responses, RestRepository, SQLPlugin, type SQLPluginResult, type SQLQuery, type SQLQueryParams, type SchemaDefinition, type SchemaInference, SchemaPlugin, type SchemaPluginResult, schemas as Schemas, type SearchBranchError, type SearchBranchPathParams, type SearchBranchRequestBody, type SearchBranchVariables, type SearchOptions, SearchPlugin, type SearchPluginResult, type SearchTableError, type SearchTablePathParams, type SearchTableRequestBody, type SearchTableVariables, type SearchXataRecord, type SelectableColumn, type SelectedPick, type SerializedString, Serializer, type SerializerResult, type SetTableSchemaError, type SetTableSchemaPathParams, type SetTableSchemaRequestBody, type SetTableSchemaVariables, SimpleCache, type SimpleCacheOptions, type SqlQueryError, type SqlQueryPathParams, type SqlQueryRequestBody, type SqlQueryVariables, type SummarizeTableError, type SummarizeTablePathParams, type SummarizeTableRequestBody, type SummarizeTableVariables, type UpdateBranchMetadataError, type UpdateBranchMetadataPathParams, type UpdateBranchMetadataVariables, type UpdateBranchSchemaError, type UpdateBranchSchemaPathParams, type UpdateBranchSchemaVariables, type UpdateColumnError, type UpdateColumnPathParams, type UpdateColumnRequestBody, type UpdateColumnVariables, type UpdateDatabaseGithubSettingsError, type UpdateDatabaseGithubSettingsPathParams, type UpdateDatabaseGithubSettingsVariables, type UpdateDatabaseMetadataError, type UpdateDatabaseMetadataPathParams, type UpdateDatabaseMetadataRequestBody, type UpdateDatabaseMetadataVariables, type UpdateMigrationRequestError, type UpdateMigrationRequestPathParams, type UpdateMigrationRequestRequestBody, type UpdateMigrationRequestVariables, type UpdateOAuthAccessTokenError, type UpdateOAuthAccessTokenPathParams, type UpdateOAuthAccessTokenRequestBody, type UpdateOAuthAccessTokenVariables, type UpdateRecordWithIDError, type UpdateRecordWithIDPathParams, type UpdateRecordWithIDQueryParams, type UpdateRecordWithIDVariables, type UpdateTableError, type UpdateTablePathParams, type UpdateTableRequestBody, type UpdateTableVariables, type UpdateUserError, type UpdateUserVariables, type UpdateWorkspaceError, type UpdateWorkspaceMemberInviteError, type UpdateWorkspaceMemberInvitePathParams, type UpdateWorkspaceMemberInviteRequestBody, type UpdateWorkspaceMemberInviteVariables, type UpdateWorkspaceMemberRoleError, type UpdateWorkspaceMemberRolePathParams, type UpdateWorkspaceMemberRoleRequestBody, type UpdateWorkspaceMemberRoleVariables, type UpdateWorkspacePathParams, type UpdateWorkspaceVariables, type UploadDestination, type UpsertRecordWithIDError, type UpsertRecordWithIDPathParams, type UpsertRecordWithIDQueryParams, type UpsertRecordWithIDVariables, type ValueAtColumn, type VectorAskOptions, type VectorSearchTableError, type VectorSearchTablePathParams, type VectorSearchTableRequestBody, type VectorSearchTableVariables, XataApiClient, type XataApiClientOptions, XataApiPlugin, type XataArrayFile, XataError, XataFile, XataPlugin, type XataPluginOptions, type XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
9465
|
+
export { type AcceptWorkspaceMemberInviteError, type AcceptWorkspaceMemberInvitePathParams, type AcceptWorkspaceMemberInviteVariables, type AddGitBranchesEntryError, type AddGitBranchesEntryPathParams, type AddGitBranchesEntryRequestBody, type AddGitBranchesEntryResponse, type AddGitBranchesEntryVariables, type AddTableColumnError, type AddTableColumnPathParams, type AddTableColumnVariables, type AggregateTableError, type AggregateTablePathParams, type AggregateTableRequestBody, type AggregateTableVariables, type ApiExtraProps, type ApplyBranchSchemaEditError, type ApplyBranchSchemaEditPathParams, type ApplyBranchSchemaEditRequestBody, type ApplyBranchSchemaEditVariables, type AskOptions, type AskResult, type AskTableError, type AskTablePathParams, type AskTableRequestBody, type AskTableResponse, type AskTableSessionError, type AskTableSessionPathParams, type AskTableSessionRequestBody, type AskTableSessionResponse, type AskTableSessionVariables, type AskTableVariables, BaseClient, type BaseClientOptions, type BaseData, type BaseSchema, type BinaryFile, type BranchTransactionError, type BranchTransactionPathParams, type BranchTransactionRequestBody, type BranchTransactionVariables, type BulkInsertTableRecordsError, type BulkInsertTableRecordsPathParams, type BulkInsertTableRecordsQueryParams, type BulkInsertTableRecordsRequestBody, type BulkInsertTableRecordsVariables, type CacheImpl, type CancelWorkspaceMemberInviteError, type CancelWorkspaceMemberInvitePathParams, type CancelWorkspaceMemberInviteVariables, type ClientConstructor, type ColumnsByValue, type CompareBranchSchemasError, type CompareBranchSchemasPathParams, type CompareBranchSchemasRequestBody, type CompareBranchSchemasVariables, type CompareBranchWithUserSchemaError, type CompareBranchWithUserSchemaPathParams, type CompareBranchWithUserSchemaRequestBody, type CompareBranchWithUserSchemaVariables, type CompareMigrationRequestError, type CompareMigrationRequestPathParams, type CompareMigrationRequestVariables, type CopyBranchError, type CopyBranchPathParams, type CopyBranchRequestBody, type CopyBranchVariables, type CreateBranchError, type CreateBranchPathParams, type CreateBranchQueryParams, type CreateBranchRequestBody, type CreateBranchResponse, type CreateBranchVariables, type CreateDatabaseError, type CreateDatabasePathParams, type CreateDatabaseRequestBody, type CreateDatabaseResponse, type CreateDatabaseVariables, type CreateMigrationRequestError, type CreateMigrationRequestPathParams, type CreateMigrationRequestRequestBody, type CreateMigrationRequestResponse, type CreateMigrationRequestVariables, type CreateTableError, type CreateTablePathParams, type CreateTableResponse, type CreateTableVariables, type CreateUserAPIKeyError, type CreateUserAPIKeyPathParams, type CreateUserAPIKeyResponse, type CreateUserAPIKeyVariables, type CreateWorkspaceError, type CreateWorkspaceVariables, type CursorNavigationOptions, type DeleteBranchError, type DeleteBranchPathParams, type DeleteBranchResponse, type DeleteBranchVariables, type DeleteColumnError, type DeleteColumnPathParams, type DeleteColumnVariables, type DeleteDatabaseError, type DeleteDatabaseGithubSettingsError, type DeleteDatabaseGithubSettingsPathParams, type DeleteDatabaseGithubSettingsVariables, type DeleteDatabasePathParams, type DeleteDatabaseResponse, type DeleteDatabaseVariables, type DeleteFileError, type DeleteFileItemError, type DeleteFileItemPathParams, type DeleteFileItemVariables, type DeleteFilePathParams, type DeleteFileVariables, type DeleteOAuthAccessTokenError, type DeleteOAuthAccessTokenPathParams, type DeleteOAuthAccessTokenVariables, type DeleteRecordError, type DeleteRecordPathParams, type DeleteRecordQueryParams, type DeleteRecordVariables, type DeleteTableError, type DeleteTablePathParams, type DeleteTableResponse, type DeleteTableVariables, type DeleteUserAPIKeyError, type DeleteUserAPIKeyPathParams, type DeleteUserAPIKeyVariables, type DeleteUserError, type DeleteUserOAuthClientError, type DeleteUserOAuthClientPathParams, type DeleteUserOAuthClientVariables, type DeleteUserVariables, type DeleteWorkspaceError, type DeleteWorkspacePathParams, type DeleteWorkspaceVariables, type DeserializedType, type DownloadDestination, type EditableData, type ExecuteBranchMigrationPlanError, type ExecuteBranchMigrationPlanPathParams, type ExecuteBranchMigrationPlanRequestBody, type ExecuteBranchMigrationPlanVariables, type FetchImpl, FetcherError, type FetcherExtraProps, type FileAccessError, type FileAccessPathParams, type FileAccessQueryParams, type FileAccessVariables, FilesPlugin, type FilesPluginResult, type GetAuthorizationCodeError, type GetAuthorizationCodeQueryParams, type GetAuthorizationCodeVariables, type GetBranchDetailsError, type GetBranchDetailsPathParams, type GetBranchDetailsVariables, type GetBranchListError, type GetBranchListPathParams, type GetBranchListVariables, type GetBranchMetadataError, type GetBranchMetadataPathParams, type GetBranchMetadataVariables, type GetBranchMigrationHistoryError, type GetBranchMigrationHistoryPathParams, type GetBranchMigrationHistoryRequestBody, type GetBranchMigrationHistoryResponse, type GetBranchMigrationHistoryVariables, type GetBranchMigrationPlanError, type GetBranchMigrationPlanPathParams, type GetBranchMigrationPlanVariables, type GetBranchSchemaHistoryError, type GetBranchSchemaHistoryPathParams, type GetBranchSchemaHistoryRequestBody, type GetBranchSchemaHistoryResponse, type GetBranchSchemaHistoryVariables, type GetBranchStatsError, type GetBranchStatsPathParams, type GetBranchStatsResponse, type GetBranchStatsVariables, type GetColumnError, type GetColumnPathParams, type GetColumnVariables, type GetDatabaseGithubSettingsError, type GetDatabaseGithubSettingsPathParams, type GetDatabaseGithubSettingsVariables, type GetDatabaseListError, type GetDatabaseListPathParams, type GetDatabaseListVariables, type GetDatabaseMetadataError, type GetDatabaseMetadataPathParams, type GetDatabaseMetadataVariables, type GetFileError, type GetFileItemError, type GetFileItemPathParams, type GetFileItemVariables, type GetFilePathParams, type GetFileVariables, type GetGitBranchesMappingError, type GetGitBranchesMappingPathParams, type GetGitBranchesMappingVariables, type GetMigrationRequestError, type GetMigrationRequestIsMergedError, type GetMigrationRequestIsMergedPathParams, type GetMigrationRequestIsMergedResponse, type GetMigrationRequestIsMergedVariables, type GetMigrationRequestPathParams, type GetMigrationRequestVariables, type GetRecordError, type GetRecordPathParams, type GetRecordQueryParams, type GetRecordVariables, type GetTableColumnsError, type GetTableColumnsPathParams, type GetTableColumnsResponse, type GetTableColumnsVariables, type GetTableSchemaError, type GetTableSchemaPathParams, type GetTableSchemaResponse, type GetTableSchemaVariables, type GetUserAPIKeysError, type GetUserAPIKeysResponse, type GetUserAPIKeysVariables, type GetUserError, type GetUserOAuthAccessTokensError, type GetUserOAuthAccessTokensResponse, type GetUserOAuthAccessTokensVariables, type GetUserOAuthClientsError, type GetUserOAuthClientsResponse, type GetUserOAuthClientsVariables, type GetUserVariables, type GetWorkspaceError, type GetWorkspaceMembersListError, type GetWorkspaceMembersListPathParams, type GetWorkspaceMembersListVariables, type GetWorkspacePathParams, type GetWorkspaceVariables, type GetWorkspacesListError, type GetWorkspacesListResponse, type GetWorkspacesListVariables, type GrantAuthorizationCodeError, type GrantAuthorizationCodeVariables, type HostProvider, type Identifiable, type ImageTransformations, type InsertRecordError, type InsertRecordPathParams, type InsertRecordQueryParams, type InsertRecordVariables, type InsertRecordWithIDError, type InsertRecordWithIDPathParams, type InsertRecordWithIDQueryParams, type InsertRecordWithIDVariables, type InviteWorkspaceMemberError, type InviteWorkspaceMemberPathParams, type InviteWorkspaceMemberRequestBody, type InviteWorkspaceMemberVariables, type JSONData, type KeywordAskOptions, type Link, type ListMigrationRequestsCommitsError, type ListMigrationRequestsCommitsPathParams, type ListMigrationRequestsCommitsRequestBody, type ListMigrationRequestsCommitsResponse, type ListMigrationRequestsCommitsVariables, type ListRegionsError, type ListRegionsPathParams, type ListRegionsVariables, type MergeMigrationRequestError, type MergeMigrationRequestPathParams, type MergeMigrationRequestVariables, type OffsetNavigationOptions, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, type Paginable, type PaginationQueryMeta, type PreviewBranchSchemaEditError, type PreviewBranchSchemaEditPathParams, type PreviewBranchSchemaEditRequestBody, type PreviewBranchSchemaEditResponse, type PreviewBranchSchemaEditVariables, type PushBranchMigrationsError, type PushBranchMigrationsPathParams, type PushBranchMigrationsRequestBody, type PushBranchMigrationsVariables, type PutFileError, type PutFileItemError, type PutFileItemPathParams, type PutFileItemVariables, type PutFilePathParams, type PutFileVariables, Query, type QueryMigrationRequestsError, type QueryMigrationRequestsPathParams, type QueryMigrationRequestsRequestBody, type QueryMigrationRequestsResponse, type QueryMigrationRequestsVariables, type QueryTableError, type QueryTablePathParams, type QueryTableRequestBody, type QueryTableVariables, RecordArray, RecordColumnTypes, type RemoveGitBranchesEntryError, type RemoveGitBranchesEntryPathParams, type RemoveGitBranchesEntryQueryParams, type RemoveGitBranchesEntryVariables, type RemoveWorkspaceMemberError, type RemoveWorkspaceMemberPathParams, type RemoveWorkspaceMemberVariables, type RenameDatabaseError, type RenameDatabasePathParams, type RenameDatabaseRequestBody, type RenameDatabaseVariables, Repository, type ResendWorkspaceMemberInviteError, type ResendWorkspaceMemberInvitePathParams, type ResendWorkspaceMemberInviteVariables, type ResolveBranchError, type ResolveBranchPathParams, type ResolveBranchQueryParams, type ResolveBranchResponse, type ResolveBranchVariables, responses as Responses, RestRepository, SQLPlugin, type SQLPluginResult, type SQLQuery, type SQLQueryParams, type SchemaDefinition, type SchemaInference, SchemaPlugin, type SchemaPluginResult, schemas as Schemas, type SearchBranchError, type SearchBranchPathParams, type SearchBranchRequestBody, type SearchBranchVariables, type SearchOptions, SearchPlugin, type SearchPluginResult, type SearchTableError, type SearchTablePathParams, type SearchTableRequestBody, type SearchTableVariables, type SearchXataRecord, type SelectableColumn, type SelectableColumnWithObjectNotation, type SelectedPick, type SerializedString, Serializer, type SerializerResult, type SetTableSchemaError, type SetTableSchemaPathParams, type SetTableSchemaRequestBody, type SetTableSchemaVariables, SimpleCache, type SimpleCacheOptions, type SqlQueryError, type SqlQueryPathParams, type SqlQueryRequestBody, type SqlQueryVariables, type SummarizeTableError, type SummarizeTablePathParams, type SummarizeTableRequestBody, type SummarizeTableVariables, type UpdateBranchMetadataError, type UpdateBranchMetadataPathParams, type UpdateBranchMetadataVariables, type UpdateBranchSchemaError, type UpdateBranchSchemaPathParams, type UpdateBranchSchemaVariables, type UpdateColumnError, type UpdateColumnPathParams, type UpdateColumnRequestBody, type UpdateColumnVariables, type UpdateDatabaseGithubSettingsError, type UpdateDatabaseGithubSettingsPathParams, type UpdateDatabaseGithubSettingsVariables, type UpdateDatabaseMetadataError, type UpdateDatabaseMetadataPathParams, type UpdateDatabaseMetadataRequestBody, type UpdateDatabaseMetadataVariables, type UpdateMigrationRequestError, type UpdateMigrationRequestPathParams, type UpdateMigrationRequestRequestBody, type UpdateMigrationRequestVariables, type UpdateOAuthAccessTokenError, type UpdateOAuthAccessTokenPathParams, type UpdateOAuthAccessTokenRequestBody, type UpdateOAuthAccessTokenVariables, type UpdateRecordWithIDError, type UpdateRecordWithIDPathParams, type UpdateRecordWithIDQueryParams, type UpdateRecordWithIDVariables, type UpdateTableError, type UpdateTablePathParams, type UpdateTableRequestBody, type UpdateTableVariables, type UpdateUserError, type UpdateUserVariables, type UpdateWorkspaceError, type UpdateWorkspaceMemberInviteError, type UpdateWorkspaceMemberInvitePathParams, type UpdateWorkspaceMemberInviteRequestBody, type UpdateWorkspaceMemberInviteVariables, type UpdateWorkspaceMemberRoleError, type UpdateWorkspaceMemberRolePathParams, type UpdateWorkspaceMemberRoleRequestBody, type UpdateWorkspaceMemberRoleVariables, type UpdateWorkspacePathParams, type UpdateWorkspaceVariables, type UploadDestination, type UpsertRecordWithIDError, type UpsertRecordWithIDPathParams, type UpsertRecordWithIDQueryParams, type UpsertRecordWithIDVariables, type ValueAtColumn, type VectorAskOptions, type VectorSearchTableError, type VectorSearchTablePathParams, type VectorSearchTableRequestBody, type VectorSearchTableVariables, XataApiClient, type XataApiClientOptions, XataApiPlugin, type XataArrayFile, XataError, XataFile, XataPlugin, type XataPluginOptions, type XataRecord, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
package/dist/index.mjs
CHANGED
@@ -527,7 +527,7 @@ function defaultOnOpen(response) {
|
|
527
527
|
}
|
528
528
|
}
|
529
529
|
|
530
|
-
const VERSION = "0.26.
|
530
|
+
const VERSION = "0.26.3";
|
531
531
|
|
532
532
|
var __defProp$7 = Object.defineProperty;
|
533
533
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -2848,7 +2848,8 @@ class XataFile {
|
|
2848
2848
|
return {
|
2849
2849
|
url: transformImage(this.url, ...options),
|
2850
2850
|
signedUrl: transformImage(this.signedUrl, ...options),
|
2851
|
-
metadataUrl: transformImage(this.url, ...options, { format: "json" })
|
2851
|
+
metadataUrl: transformImage(this.url, ...options, { format: "json" }),
|
2852
|
+
metadataSignedUrl: transformImage(this.signedUrl, ...options, { format: "json" })
|
2852
2853
|
};
|
2853
2854
|
}
|
2854
2855
|
}
|
@@ -2886,6 +2887,25 @@ function cleanFilter(filter) {
|
|
2886
2887
|
return Object.keys(values).length > 0 ? values : void 0;
|
2887
2888
|
}
|
2888
2889
|
|
2890
|
+
function stringifyJson(value) {
|
2891
|
+
if (!isDefined(value))
|
2892
|
+
return value;
|
2893
|
+
if (isString(value))
|
2894
|
+
return value;
|
2895
|
+
try {
|
2896
|
+
return JSON.stringify(value);
|
2897
|
+
} catch (e) {
|
2898
|
+
return value;
|
2899
|
+
}
|
2900
|
+
}
|
2901
|
+
function parseJson(value) {
|
2902
|
+
try {
|
2903
|
+
return JSON.parse(value);
|
2904
|
+
} catch (e) {
|
2905
|
+
return value;
|
2906
|
+
}
|
2907
|
+
}
|
2908
|
+
|
2889
2909
|
var __defProp$5 = Object.defineProperty;
|
2890
2910
|
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2891
2911
|
var __publicField$5 = (obj, key, value) => {
|
@@ -3356,6 +3376,24 @@ function isXataRecord(x) {
|
|
3356
3376
|
return isIdentifiable(x) && isObject(metadata) && typeof metadata.version === "number";
|
3357
3377
|
}
|
3358
3378
|
|
3379
|
+
function isValidExpandedColumn(column) {
|
3380
|
+
return isObject(column) && isString(column.name);
|
3381
|
+
}
|
3382
|
+
function isValidSelectableColumns(columns) {
|
3383
|
+
if (!Array.isArray(columns)) {
|
3384
|
+
return false;
|
3385
|
+
}
|
3386
|
+
return columns.every((column) => {
|
3387
|
+
if (typeof column === "string") {
|
3388
|
+
return true;
|
3389
|
+
}
|
3390
|
+
if (typeof column === "object") {
|
3391
|
+
return isValidExpandedColumn(column);
|
3392
|
+
}
|
3393
|
+
return false;
|
3394
|
+
});
|
3395
|
+
}
|
3396
|
+
|
3359
3397
|
function isSortFilterString(value) {
|
3360
3398
|
return isString(value);
|
3361
3399
|
}
|
@@ -3456,24 +3494,24 @@ class RestRepository extends Query {
|
|
3456
3494
|
if (a.length === 0)
|
3457
3495
|
return [];
|
3458
3496
|
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
3459
|
-
const columns =
|
3497
|
+
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3460
3498
|
const result = await this.read(ids, columns);
|
3461
3499
|
return result;
|
3462
3500
|
}
|
3463
3501
|
if (isString(a) && isObject(b)) {
|
3464
3502
|
if (a === "")
|
3465
3503
|
throw new Error("The id can't be empty");
|
3466
|
-
const columns =
|
3504
|
+
const columns = isValidSelectableColumns(c) ? c : void 0;
|
3467
3505
|
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
3468
3506
|
}
|
3469
3507
|
if (isObject(a) && isString(a.id)) {
|
3470
3508
|
if (a.id === "")
|
3471
3509
|
throw new Error("The id can't be empty");
|
3472
|
-
const columns =
|
3510
|
+
const columns = isValidSelectableColumns(b) ? b : void 0;
|
3473
3511
|
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
3474
3512
|
}
|
3475
3513
|
if (isObject(a)) {
|
3476
|
-
const columns =
|
3514
|
+
const columns = isValidSelectableColumns(b) ? b : void 0;
|
3477
3515
|
return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
|
3478
3516
|
}
|
3479
3517
|
throw new Error("Invalid arguments for create method");
|
@@ -3481,7 +3519,7 @@ class RestRepository extends Query {
|
|
3481
3519
|
}
|
3482
3520
|
async read(a, b) {
|
3483
3521
|
return __privateGet$4(this, _trace).call(this, "read", async () => {
|
3484
|
-
const columns =
|
3522
|
+
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3485
3523
|
if (Array.isArray(a)) {
|
3486
3524
|
if (a.length === 0)
|
3487
3525
|
return [];
|
@@ -3508,7 +3546,13 @@ class RestRepository extends Query {
|
|
3508
3546
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3509
3547
|
});
|
3510
3548
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3511
|
-
return initObject(
|
3549
|
+
return initObject(
|
3550
|
+
__privateGet$4(this, _db),
|
3551
|
+
schemaTables,
|
3552
|
+
__privateGet$4(this, _table),
|
3553
|
+
response,
|
3554
|
+
columns
|
3555
|
+
);
|
3512
3556
|
} catch (e) {
|
3513
3557
|
if (isObject(e) && e.status === 404) {
|
3514
3558
|
return null;
|
@@ -3550,17 +3594,17 @@ class RestRepository extends Query {
|
|
3550
3594
|
ifVersion,
|
3551
3595
|
upsert: false
|
3552
3596
|
});
|
3553
|
-
const columns =
|
3597
|
+
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3554
3598
|
const result = await this.read(a, columns);
|
3555
3599
|
return result;
|
3556
3600
|
}
|
3557
3601
|
try {
|
3558
3602
|
if (isString(a) && isObject(b)) {
|
3559
|
-
const columns =
|
3603
|
+
const columns = isValidSelectableColumns(c) ? c : void 0;
|
3560
3604
|
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
3561
3605
|
}
|
3562
3606
|
if (isObject(a) && isString(a.id)) {
|
3563
|
-
const columns =
|
3607
|
+
const columns = isValidSelectableColumns(b) ? b : void 0;
|
3564
3608
|
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
3565
3609
|
}
|
3566
3610
|
} catch (error) {
|
@@ -3600,20 +3644,20 @@ class RestRepository extends Query {
|
|
3600
3644
|
ifVersion,
|
3601
3645
|
upsert: true
|
3602
3646
|
});
|
3603
|
-
const columns =
|
3647
|
+
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3604
3648
|
const result = await this.read(a, columns);
|
3605
3649
|
return result;
|
3606
3650
|
}
|
3607
3651
|
if (isString(a) && isObject(b)) {
|
3608
3652
|
if (a === "")
|
3609
3653
|
throw new Error("The id can't be empty");
|
3610
|
-
const columns =
|
3654
|
+
const columns = isValidSelectableColumns(c) ? c : void 0;
|
3611
3655
|
return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
3612
3656
|
}
|
3613
3657
|
if (isObject(a) && isString(a.id)) {
|
3614
3658
|
if (a.id === "")
|
3615
3659
|
throw new Error("The id can't be empty");
|
3616
|
-
const columns =
|
3660
|
+
const columns = isValidSelectableColumns(c) ? c : void 0;
|
3617
3661
|
return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
3618
3662
|
}
|
3619
3663
|
if (!isDefined(a) && isObject(b)) {
|
@@ -3632,20 +3676,20 @@ class RestRepository extends Query {
|
|
3632
3676
|
if (a.length === 0)
|
3633
3677
|
return [];
|
3634
3678
|
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
3635
|
-
const columns =
|
3679
|
+
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3636
3680
|
const result = await this.read(ids, columns);
|
3637
3681
|
return result;
|
3638
3682
|
}
|
3639
3683
|
if (isString(a) && isObject(b)) {
|
3640
3684
|
if (a === "")
|
3641
3685
|
throw new Error("The id can't be empty");
|
3642
|
-
const columns =
|
3686
|
+
const columns = isValidSelectableColumns(c) ? c : void 0;
|
3643
3687
|
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
3644
3688
|
}
|
3645
3689
|
if (isObject(a) && isString(a.id)) {
|
3646
3690
|
if (a.id === "")
|
3647
3691
|
throw new Error("The id can't be empty");
|
3648
|
-
const columns =
|
3692
|
+
const columns = isValidSelectableColumns(c) ? c : void 0;
|
3649
3693
|
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
3650
3694
|
}
|
3651
3695
|
if (!isDefined(a) && isObject(b)) {
|
@@ -3669,7 +3713,7 @@ class RestRepository extends Query {
|
|
3669
3713
|
return o.id;
|
3670
3714
|
throw new Error("Invalid arguments for delete method");
|
3671
3715
|
});
|
3672
|
-
const columns =
|
3716
|
+
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3673
3717
|
const result = await this.read(a, columns);
|
3674
3718
|
await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
|
3675
3719
|
return result;
|
@@ -3788,7 +3832,13 @@ class RestRepository extends Query {
|
|
3788
3832
|
});
|
3789
3833
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3790
3834
|
const records = objects.map(
|
3791
|
-
(record) => initObject(
|
3835
|
+
(record) => initObject(
|
3836
|
+
__privateGet$4(this, _db),
|
3837
|
+
schemaTables,
|
3838
|
+
__privateGet$4(this, _table),
|
3839
|
+
record,
|
3840
|
+
data.columns ?? ["*"]
|
3841
|
+
)
|
3792
3842
|
);
|
3793
3843
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
3794
3844
|
return new Page(query, meta, records);
|
@@ -4094,6 +4144,9 @@ transformObjectToApi_fn = async function(object) {
|
|
4094
4144
|
case "file[]":
|
4095
4145
|
result[key] = await promiseMap(value, (item) => parseInputFileEntry(item));
|
4096
4146
|
break;
|
4147
|
+
case "json":
|
4148
|
+
result[key] = stringifyJson(value);
|
4149
|
+
break;
|
4097
4150
|
default:
|
4098
4151
|
result[key] = value;
|
4099
4152
|
}
|
@@ -4137,13 +4190,19 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4137
4190
|
if (item === column.name) {
|
4138
4191
|
return [...acc, "*"];
|
4139
4192
|
}
|
4140
|
-
if (item.startsWith(`${column.name}.`)) {
|
4193
|
+
if (isString(item) && item.startsWith(`${column.name}.`)) {
|
4141
4194
|
const [, ...path] = item.split(".");
|
4142
4195
|
return [...acc, path.join(".")];
|
4143
4196
|
}
|
4144
4197
|
return acc;
|
4145
4198
|
}, []);
|
4146
|
-
data[column.name] = initObject(
|
4199
|
+
data[column.name] = initObject(
|
4200
|
+
db,
|
4201
|
+
schemaTables,
|
4202
|
+
linkTable,
|
4203
|
+
value,
|
4204
|
+
selectedLinkColumns
|
4205
|
+
);
|
4147
4206
|
} else {
|
4148
4207
|
data[column.name] = null;
|
4149
4208
|
}
|
@@ -4155,6 +4214,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4155
4214
|
case "file[]":
|
4156
4215
|
data[column.name] = value?.map((item) => new XataFile(item)) ?? null;
|
4157
4216
|
break;
|
4217
|
+
case "json":
|
4218
|
+
data[column.name] = parseJson(value);
|
4219
|
+
break;
|
4158
4220
|
default:
|
4159
4221
|
data[column.name] = value ?? null;
|
4160
4222
|
if (column.notNull === true && value === null) {
|
@@ -4170,12 +4232,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4170
4232
|
return db[table].read(record["id"], columns2);
|
4171
4233
|
};
|
4172
4234
|
record.update = function(data2, b, c) {
|
4173
|
-
const columns2 =
|
4235
|
+
const columns2 = isValidSelectableColumns(b) ? b : ["*"];
|
4174
4236
|
const ifVersion = parseIfVersion(b, c);
|
4175
4237
|
return db[table].update(record["id"], data2, columns2, { ifVersion });
|
4176
4238
|
};
|
4177
4239
|
record.replace = function(data2, b, c) {
|
4178
|
-
const columns2 =
|
4240
|
+
const columns2 = isValidSelectableColumns(b) ? b : ["*"];
|
4179
4241
|
const ifVersion = parseIfVersion(b, c);
|
4180
4242
|
return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
|
4181
4243
|
};
|
@@ -4208,7 +4270,7 @@ function extractId(value) {
|
|
4208
4270
|
function isValidColumn(columns, column) {
|
4209
4271
|
if (columns.includes("*"))
|
4210
4272
|
return true;
|
4211
|
-
return columns.filter((item) => item.startsWith(column.name)).length > 0;
|
4273
|
+
return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
|
4212
4274
|
}
|
4213
4275
|
function parseIfVersion(...args) {
|
4214
4276
|
for (const arg of args) {
|
@@ -4773,5 +4835,5 @@ class XataError extends Error {
|
|
4773
4835
|
}
|
4774
4836
|
}
|
4775
4837
|
|
4776
|
-
export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
4838
|
+
export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
4777
4839
|
//# sourceMappingURL=index.mjs.map
|