Comparing version 3.8.1 to 3.9.0
{ | ||
"version": "3.8.0" | ||
"version": "3.8.1" | ||
} |
@@ -5,12 +5,16 @@ "use strict"; | ||
describe('Connection', () => { | ||
let driver; | ||
beforeAll(async () => { | ||
driver = await (0, test_utils_1.initDriver)(); | ||
it('Test GRPC connection', async () => { | ||
let driver = await (0, test_utils_1.initDriver)({ endpoint: 'grpc://localhost:2136' }); | ||
await driver.tableClient.withSession(async (session) => { | ||
await session.executeQuery('SELECT 1'); | ||
}); | ||
await (0, test_utils_1.destroyDriver)(driver); | ||
}); | ||
afterAll(() => (0, test_utils_1.destroyDriver)(driver)); | ||
it('Test connection', async () => { | ||
it('Test GRPCS connection', async () => { | ||
let driver = await (0, test_utils_1.initDriver)(); | ||
await driver.tableClient.withSession(async (session) => { | ||
await session.executeQuery('SELECT 1'); | ||
}); | ||
await (0, test_utils_1.destroyDriver)(driver); | ||
}); | ||
}); |
@@ -27,2 +27,3 @@ /// <reference types="node" /> | ||
import BulkUpsertResult = Ydb.Table.BulkUpsertResult; | ||
import OperationMode = Ydb.Operations.OperationParams.OperationMode; | ||
export declare class SessionService extends AuthenticatedService<TableService> { | ||
@@ -46,3 +47,3 @@ endpoint: Endpoint; | ||
export declare class OperationParams implements Ydb.Operations.IOperationParams { | ||
operationMode?: Ydb.Operations.OperationParams.OperationMode; | ||
operationMode?: OperationMode; | ||
operationTimeout?: google.protobuf.IDuration; | ||
@@ -336,2 +337,15 @@ cancelAfter?: google.protobuf.IDuration; | ||
dropIndexes: string[]; | ||
alterStorageSettings?: Ydb.Table.IStorageSettings; | ||
addColumnFamilies?: Ydb.Table.IColumnFamily[]; | ||
alterColumnFamilies?: Ydb.Table.IColumnFamily[]; | ||
alterAttributes?: { | ||
[k: string]: string; | ||
}; | ||
setCompactionPolicy?: string; | ||
alterPartitioningSettings?: Ydb.Table.IPartitioningSettings; | ||
setKeyBloomFilter?: Ydb.FeatureFlag.Status; | ||
setReadReplicasSettings?: Ydb.Table.IReadReplicasSettings; | ||
addChangefeeds?: Ydb.Table.IChangefeed[]; | ||
dropChangefeeds?: string[]; | ||
renameIndexes?: Ydb.Table.IRenameIndexItem[]; | ||
constructor(); | ||
@@ -338,0 +352,0 @@ withAddColumn(column: Column): this; |
@@ -29,2 +29,3 @@ "use strict"; | ||
var BulkUpsertResult = ydb_sdk_proto_1.Ydb.Table.BulkUpsertResult; | ||
var OperationMode = ydb_sdk_proto_1.Ydb.Operations.OperationParams.OperationMode; | ||
class SessionService extends utils_1.AuthenticatedService { | ||
@@ -62,7 +63,7 @@ constructor(endpoint, database, authService, logger, sslCredentials, clientOptions) { | ||
withSyncMode() { | ||
this.operationMode = ydb_sdk_proto_1.Ydb.Operations.OperationParams.OperationMode.SYNC; | ||
this.operationMode = OperationMode.SYNC; | ||
return this; | ||
} | ||
withAsyncMode() { | ||
this.operationMode = ydb_sdk_proto_1.Ydb.Operations.OperationParams.OperationMode.ASYNC; | ||
this.operationMode = OperationMode.ASYNC; | ||
return this; | ||
@@ -278,12 +279,4 @@ } | ||
async alterTable(tablePath, description, settings) { | ||
const { addColumns, dropColumns, alterColumns, setTtlSettings, dropTtlSettings } = description; | ||
const request = { | ||
sessionId: this.sessionId, | ||
path: `${this.endpoint.database}/${tablePath}`, | ||
addColumns, | ||
dropColumns, | ||
alterColumns, | ||
setTtlSettings, | ||
dropTtlSettings, | ||
}; | ||
var _a; | ||
const request = Object.assign(Object.assign({}, description), { sessionId: this.sessionId, path: `${this.endpoint.database}/${tablePath}` }); | ||
if (settings) { | ||
@@ -293,3 +286,11 @@ request.operationParams = settings.operationParams; | ||
const response = await this.api.alterTable(request); | ||
(0, utils_1.ensureOperationSucceeded)(this.processResponseMetadata(request, response)); | ||
try { | ||
(0, utils_1.ensureOperationSucceeded)(this.processResponseMetadata(request, response)); | ||
} | ||
catch (error) { | ||
// !! does not returns response status if async operation mode | ||
if (((_a = request.operationParams) === null || _a === void 0 ? void 0 : _a.operationMode) !== OperationMode.SYNC && error instanceof errors_1.MissingStatus) | ||
return; | ||
throw error; | ||
} | ||
} | ||
@@ -296,0 +297,0 @@ /* |
{ | ||
"version": "3.8.0" | ||
"version": "3.8.1" | ||
} |
@@ -5,12 +5,16 @@ "use strict"; | ||
describe('Connection', () => { | ||
let driver; | ||
beforeAll(async () => { | ||
driver = await (0, test_utils_1.initDriver)(); | ||
it('Test GRPC connection', async () => { | ||
let driver = await (0, test_utils_1.initDriver)({ endpoint: 'grpc://localhost:2136' }); | ||
await driver.tableClient.withSession(async (session) => { | ||
await session.executeQuery('SELECT 1'); | ||
}); | ||
await (0, test_utils_1.destroyDriver)(driver); | ||
}); | ||
afterAll(() => (0, test_utils_1.destroyDriver)(driver)); | ||
it('Test connection', async () => { | ||
it('Test GRPCS connection', async () => { | ||
let driver = await (0, test_utils_1.initDriver)(); | ||
await driver.tableClient.withSession(async (session) => { | ||
await session.executeQuery('SELECT 1'); | ||
}); | ||
await (0, test_utils_1.destroyDriver)(driver); | ||
}); | ||
}); |
@@ -27,2 +27,3 @@ /// <reference types="node" /> | ||
import BulkUpsertResult = Ydb.Table.BulkUpsertResult; | ||
import OperationMode = Ydb.Operations.OperationParams.OperationMode; | ||
export declare class SessionService extends AuthenticatedService<TableService> { | ||
@@ -46,3 +47,3 @@ endpoint: Endpoint; | ||
export declare class OperationParams implements Ydb.Operations.IOperationParams { | ||
operationMode?: Ydb.Operations.OperationParams.OperationMode; | ||
operationMode?: OperationMode; | ||
operationTimeout?: google.protobuf.IDuration; | ||
@@ -336,2 +337,15 @@ cancelAfter?: google.protobuf.IDuration; | ||
dropIndexes: string[]; | ||
alterStorageSettings?: Ydb.Table.IStorageSettings; | ||
addColumnFamilies?: Ydb.Table.IColumnFamily[]; | ||
alterColumnFamilies?: Ydb.Table.IColumnFamily[]; | ||
alterAttributes?: { | ||
[k: string]: string; | ||
}; | ||
setCompactionPolicy?: string; | ||
alterPartitioningSettings?: Ydb.Table.IPartitioningSettings; | ||
setKeyBloomFilter?: Ydb.FeatureFlag.Status; | ||
setReadReplicasSettings?: Ydb.Table.IReadReplicasSettings; | ||
addChangefeeds?: Ydb.Table.IChangefeed[]; | ||
dropChangefeeds?: string[]; | ||
renameIndexes?: Ydb.Table.IRenameIndexItem[]; | ||
constructor(); | ||
@@ -338,0 +352,0 @@ withAddColumn(column: Column): this; |
@@ -29,2 +29,3 @@ "use strict"; | ||
var BulkUpsertResult = ydb_sdk_proto_1.Ydb.Table.BulkUpsertResult; | ||
var OperationMode = ydb_sdk_proto_1.Ydb.Operations.OperationParams.OperationMode; | ||
class SessionService extends utils_1.AuthenticatedService { | ||
@@ -69,7 +70,7 @@ endpoint; | ||
withSyncMode() { | ||
this.operationMode = ydb_sdk_proto_1.Ydb.Operations.OperationParams.OperationMode.SYNC; | ||
this.operationMode = OperationMode.SYNC; | ||
return this; | ||
} | ||
withAsyncMode() { | ||
this.operationMode = ydb_sdk_proto_1.Ydb.Operations.OperationParams.OperationMode.ASYNC; | ||
this.operationMode = OperationMode.ASYNC; | ||
return this; | ||
@@ -301,11 +302,6 @@ } | ||
async alterTable(tablePath, description, settings) { | ||
const { addColumns, dropColumns, alterColumns, setTtlSettings, dropTtlSettings } = description; | ||
const request = { | ||
...description, | ||
sessionId: this.sessionId, | ||
path: `${this.endpoint.database}/${tablePath}`, | ||
addColumns, | ||
dropColumns, | ||
alterColumns, | ||
setTtlSettings, | ||
dropTtlSettings, | ||
}; | ||
@@ -316,3 +312,11 @@ if (settings) { | ||
const response = await this.api.alterTable(request); | ||
(0, utils_1.ensureOperationSucceeded)(this.processResponseMetadata(request, response)); | ||
try { | ||
(0, utils_1.ensureOperationSucceeded)(this.processResponseMetadata(request, response)); | ||
} | ||
catch (error) { | ||
// !! does not returns response status if async operation mode | ||
if (request.operationParams?.operationMode !== OperationMode.SYNC && error instanceof errors_1.MissingStatus) | ||
return; | ||
throw error; | ||
} | ||
} | ||
@@ -1070,2 +1074,13 @@ /* | ||
dropIndexes = []; | ||
alterStorageSettings; | ||
addColumnFamilies; | ||
alterColumnFamilies; | ||
alterAttributes; | ||
setCompactionPolicy; | ||
alterPartitioningSettings; | ||
setKeyBloomFilter; | ||
setReadReplicasSettings; | ||
addChangefeeds; | ||
dropChangefeeds; | ||
renameIndexes; | ||
constructor() { } | ||
@@ -1072,0 +1087,0 @@ withAddColumn(column) { |
@@ -5,2 +5,15 @@ # Changelog | ||
## [3.9.0](https://github.com/ydb-platform/ydb-nodejs-sdk/compare/v3.8.1...v3.9.0) (2023-02-09) | ||
### Features | ||
* add alter table async mode handling ([9c18405](https://github.com/ydb-platform/ydb-nodejs-sdk/commit/9c184053009e97fc7914ee542f3cd6382979f4db)) | ||
* add parameters to alterTable ([648a6ca](https://github.com/ydb-platform/ydb-nodejs-sdk/commit/648a6ca21e7cb4ea732dc364816042bfc4f51ac6)) | ||
### Bug Fixes | ||
* bugfix MissingStatus import ([1835a85](https://github.com/ydb-platform/ydb-nodejs-sdk/commit/1835a85b343baae4ff894636421db7f92a83e0c2)) | ||
## [3.8.1](https://github.com/ydb-platform/ydb-nodejs-sdk/compare/v3.8.0...v3.8.1) (2023-01-13) | ||
@@ -7,0 +20,0 @@ |
{ | ||
"name": "ydb-sdk", | ||
"version": "3.8.1", | ||
"version": "3.9.0", | ||
"description": "Node.js bindings for working with YDB API over gRPC", | ||
@@ -5,0 +5,0 @@ "main": "build/cjs/src/index.js", |
1058720
120
13088