@xata.io/client 0.0.0-next.v9a81c4765c87e96d23c4e8ae0cbee78e78451dd5 → 0.0.0-next.va121e4207b94bfe0a3c025fc00b247b923880930
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 +3 -3
- package/CHANGELOG.md +13 -3
- package/dist/index.cjs +127 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1173 -188
- package/dist/index.mjs +113 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2169,7 +2169,7 @@ function defaultOnOpen(response) {
|
|
2169
2169
|
}
|
2170
2170
|
}
|
2171
2171
|
|
2172
|
-
const VERSION = "0.
|
2172
|
+
const VERSION = "0.30.0";
|
2173
2173
|
|
2174
2174
|
class ErrorWithCause extends Error {
|
2175
2175
|
constructor(message, options) {
|
@@ -2483,6 +2483,48 @@ function parseUrl(url) {
|
|
2483
2483
|
|
2484
2484
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2485
2485
|
|
2486
|
+
const getTasks = (variables, signal) => dataPlaneFetch({
|
2487
|
+
url: "/tasks",
|
2488
|
+
method: "get",
|
2489
|
+
...variables,
|
2490
|
+
signal
|
2491
|
+
});
|
2492
|
+
const getTaskStatus = (variables, signal) => dataPlaneFetch({
|
2493
|
+
url: "/tasks/{taskId}",
|
2494
|
+
method: "get",
|
2495
|
+
...variables,
|
2496
|
+
signal
|
2497
|
+
});
|
2498
|
+
const listClusterBranches = (variables, signal) => dataPlaneFetch({
|
2499
|
+
url: "/cluster/{clusterId}/branches",
|
2500
|
+
method: "get",
|
2501
|
+
...variables,
|
2502
|
+
signal
|
2503
|
+
});
|
2504
|
+
const listClusterExtensions = (variables, signal) => dataPlaneFetch({
|
2505
|
+
url: "/cluster/{clusterId}/extensions",
|
2506
|
+
method: "get",
|
2507
|
+
...variables,
|
2508
|
+
signal
|
2509
|
+
});
|
2510
|
+
const installClusterExtension = (variables, signal) => dataPlaneFetch({
|
2511
|
+
url: "/cluster/{clusterId}/extensions",
|
2512
|
+
method: "post",
|
2513
|
+
...variables,
|
2514
|
+
signal
|
2515
|
+
});
|
2516
|
+
const dropClusterExtension = (variables, signal) => dataPlaneFetch({
|
2517
|
+
url: "/cluster/{clusterId}/extensions",
|
2518
|
+
method: "delete",
|
2519
|
+
...variables,
|
2520
|
+
signal
|
2521
|
+
});
|
2522
|
+
const getClusterMetrics = (variables, signal) => dataPlaneFetch({
|
2523
|
+
url: "/cluster/{clusterId}/metrics",
|
2524
|
+
method: "get",
|
2525
|
+
...variables,
|
2526
|
+
signal
|
2527
|
+
});
|
2486
2528
|
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2487
2529
|
url: "/db/{dbBranchName}/migrations/apply",
|
2488
2530
|
method: "post",
|
@@ -2495,6 +2537,18 @@ const startMigration = (variables, signal) => dataPlaneFetch({
|
|
2495
2537
|
...variables,
|
2496
2538
|
signal
|
2497
2539
|
});
|
2540
|
+
const completeMigration = (variables, signal) => dataPlaneFetch({
|
2541
|
+
url: "/db/{dbBranchName}/migrations/complete",
|
2542
|
+
method: "post",
|
2543
|
+
...variables,
|
2544
|
+
signal
|
2545
|
+
});
|
2546
|
+
const rollbackMigration = (variables, signal) => dataPlaneFetch({
|
2547
|
+
url: "/db/{dbBranchName}/migrations/rollback",
|
2548
|
+
method: "post",
|
2549
|
+
...variables,
|
2550
|
+
signal
|
2551
|
+
});
|
2498
2552
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2499
2553
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2500
2554
|
method: "post",
|
@@ -2513,6 +2567,12 @@ const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
|
2513
2567
|
...variables,
|
2514
2568
|
signal
|
2515
2569
|
});
|
2570
|
+
const getMigrationJobs = (variables, signal) => dataPlaneFetch({
|
2571
|
+
url: "/db/{dbBranchName}/migrations/jobs",
|
2572
|
+
method: "get",
|
2573
|
+
...variables,
|
2574
|
+
signal
|
2575
|
+
});
|
2516
2576
|
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2517
2577
|
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2518
2578
|
method: "get",
|
@@ -2538,6 +2598,7 @@ const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
|
|
2538
2598
|
signal
|
2539
2599
|
});
|
2540
2600
|
const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
|
2601
|
+
const createBranchAsync = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/async", method: "put", ...variables, signal });
|
2541
2602
|
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
2542
2603
|
url: "/db/{dbBranchName}",
|
2543
2604
|
method: "get",
|
@@ -2557,12 +2618,25 @@ const getSchema = (variables, signal) => dataPlaneFetch({
|
|
2557
2618
|
...variables,
|
2558
2619
|
signal
|
2559
2620
|
});
|
2621
|
+
const getSchemas = (variables, signal) => dataPlaneFetch({
|
2622
|
+
url: "/db/{dbBranchName}/schemas",
|
2623
|
+
method: "get",
|
2624
|
+
...variables,
|
2625
|
+
signal
|
2626
|
+
});
|
2560
2627
|
const copyBranch = (variables, signal) => dataPlaneFetch({
|
2561
2628
|
url: "/db/{dbBranchName}/copy",
|
2562
2629
|
method: "post",
|
2563
2630
|
...variables,
|
2564
2631
|
signal
|
2565
2632
|
});
|
2633
|
+
const getBranchMoveStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/move", method: "get", ...variables, signal });
|
2634
|
+
const moveBranch = (variables, signal) => dataPlaneFetch({
|
2635
|
+
url: "/db/{dbBranchName}/move",
|
2636
|
+
method: "put",
|
2637
|
+
...variables,
|
2638
|
+
signal
|
2639
|
+
});
|
2566
2640
|
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
2567
2641
|
url: "/db/{dbBranchName}/metadata",
|
2568
2642
|
method: "put",
|
@@ -2910,16 +2984,34 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
2910
2984
|
...variables,
|
2911
2985
|
signal
|
2912
2986
|
});
|
2987
|
+
const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
|
2988
|
+
url: "/db/{dbBranchName}/sql/batch",
|
2989
|
+
method: "post",
|
2990
|
+
...variables,
|
2991
|
+
signal
|
2992
|
+
});
|
2913
2993
|
const operationsByTag$2 = {
|
2994
|
+
tasks: { getTasks, getTaskStatus },
|
2995
|
+
cluster: {
|
2996
|
+
listClusterBranches,
|
2997
|
+
listClusterExtensions,
|
2998
|
+
installClusterExtension,
|
2999
|
+
dropClusterExtension,
|
3000
|
+
getClusterMetrics
|
3001
|
+
},
|
2914
3002
|
migrations: {
|
2915
3003
|
applyMigration,
|
2916
3004
|
startMigration,
|
3005
|
+
completeMigration,
|
3006
|
+
rollbackMigration,
|
2917
3007
|
adaptTable,
|
2918
3008
|
adaptAllTables,
|
2919
3009
|
getBranchMigrationJobStatus,
|
3010
|
+
getMigrationJobs,
|
2920
3011
|
getMigrationJobStatus,
|
2921
3012
|
getMigrationHistory,
|
2922
3013
|
getSchema,
|
3014
|
+
getSchemas,
|
2923
3015
|
getBranchMigrationHistory,
|
2924
3016
|
getBranchMigrationPlan,
|
2925
3017
|
executeBranchMigrationPlan,
|
@@ -2933,10 +3025,13 @@ const operationsByTag$2 = {
|
|
2933
3025
|
},
|
2934
3026
|
branch: {
|
2935
3027
|
getBranchList,
|
3028
|
+
createBranchAsync,
|
2936
3029
|
getBranchDetails,
|
2937
3030
|
createBranch,
|
2938
3031
|
deleteBranch,
|
2939
3032
|
copyBranch,
|
3033
|
+
getBranchMoveStatus,
|
3034
|
+
moveBranch,
|
2940
3035
|
updateBranchMetadata,
|
2941
3036
|
getBranchMetadata,
|
2942
3037
|
getBranchStats,
|
@@ -2998,7 +3093,7 @@ const operationsByTag$2 = {
|
|
2998
3093
|
summarizeTable,
|
2999
3094
|
aggregateTable
|
3000
3095
|
},
|
3001
|
-
sql: { sqlQuery }
|
3096
|
+
sql: { sqlQuery, sqlBatchQuery }
|
3002
3097
|
};
|
3003
3098
|
|
3004
3099
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
@@ -5050,19 +5145,28 @@ class SQLPlugin extends XataPlugin {
|
|
5050
5145
|
throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
|
5051
5146
|
}
|
5052
5147
|
const { statement, params, consistency, responseType } = prepareParams(query, parameters);
|
5053
|
-
const {
|
5054
|
-
records,
|
5055
|
-
rows,
|
5056
|
-
warning,
|
5057
|
-
columns = []
|
5058
|
-
} = await sqlQuery({
|
5148
|
+
const { warning, columns, ...response } = await sqlQuery({
|
5059
5149
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5060
5150
|
body: { statement, params, consistency, responseType },
|
5061
5151
|
...pluginOptions
|
5062
5152
|
});
|
5153
|
+
const records = "records" in response ? response.records : void 0;
|
5154
|
+
const rows = "rows" in response ? response.rows : void 0;
|
5063
5155
|
return { records, rows, warning, columns };
|
5064
5156
|
};
|
5065
5157
|
sqlFunction.connectionString = buildConnectionString(pluginOptions);
|
5158
|
+
sqlFunction.batch = async (query) => {
|
5159
|
+
const { results } = await sqlBatchQuery({
|
5160
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5161
|
+
body: {
|
5162
|
+
statements: query.statements.map(({ statement, params }) => ({ statement, params })),
|
5163
|
+
consistency: query.consistency,
|
5164
|
+
responseType: query.responseType
|
5165
|
+
},
|
5166
|
+
...pluginOptions
|
5167
|
+
});
|
5168
|
+
return { results };
|
5169
|
+
};
|
5066
5170
|
return sqlFunction;
|
5067
5171
|
}
|
5068
5172
|
}
|
@@ -5327,5 +5431,5 @@ class XataError extends Error {
|
|
5327
5431
|
}
|
5328
5432
|
}
|
5329
5433
|
|
5330
|
-
export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteCluster, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAuthorizationCode, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDeployPreviewBranch, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getSchema, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspaceSettings, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, le, lessEquals, lessThan, lessThanEquals, listClusters, 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, startMigration, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
|
5434
|
+
export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, completeMigration, contains, copyBranch, createBranch, createBranchAsync, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteCluster, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, dropClusterExtension, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAuthorizationCode, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchMoveStatus, getBranchSchemaHistory, getBranchStats, getCluster, getClusterMetrics, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDeployPreviewBranch, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationJobs, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getSchema, getSchemas, getTableColumns, getTableSchema, getTaskStatus, getTasks, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspaceSettings, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, installClusterExtension, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, le, lessEquals, lessThan, lessThanEquals, listClusterBranches, listClusterExtensions, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, moveBranch, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, rollbackMigration, searchBranch, searchTable, serialize, setTableSchema, sqlBatchQuery, sqlQuery, startMigration, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
|
5331
5435
|
//# sourceMappingURL=index.mjs.map
|