@naturalcycles/cloud-storage-lib 1.13.2 → 1.13.4

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.
@@ -1,5 +1,5 @@
1
1
  import { CommonDBCreateOptions, CommonKeyValueDB, KeyValueDBTuple } from '@naturalcycles/db-lib';
2
- import { StringMap } from '@naturalcycles/js-lib';
2
+ import { IncrementTuple } from '@naturalcycles/db-lib/dist/kv/commonKeyValueDB';
3
3
  import { ReadableTyped } from '@naturalcycles/nodejs-lib';
4
4
  import { CommonStorage } from './commonStorage';
5
5
  export interface CommonStorageKeyValueDBCfg {
@@ -34,6 +34,5 @@ export declare class CommonStorageKeyValueDB implements CommonKeyValueDB {
34
34
  streamValues(table: string, limit?: number): ReadableTyped<Buffer>;
35
35
  streamEntries(table: string, limit?: number): ReadableTyped<KeyValueDBTuple>;
36
36
  count(table: string): Promise<number>;
37
- increment(_table: string, _id: string, _by?: number): Promise<number>;
38
- incrementBatch(_table: string, _incrementMap: StringMap<number>): Promise<StringMap<number>>;
37
+ incrementBatch(_table: string, _entries: IncrementTuple[]): Promise<IncrementTuple[]>;
39
38
  }
@@ -82,10 +82,7 @@ class CommonStorageKeyValueDB {
82
82
  const { bucketName, prefix } = this.getBucketAndPrefix(table);
83
83
  return (await this.cfg.storage.getFileNames(bucketName, { prefix })).length;
84
84
  }
85
- async increment(_table, _id, _by) {
86
- throw new js_lib_1.AppError('CommonStorageKeyValueDB.increment() is not implemented');
87
- }
88
- async incrementBatch(_table, _incrementMap) {
85
+ async incrementBatch(_table, _entries) {
89
86
  throw new js_lib_1.AppError('CommonStorageKeyValueDB.incrementBatch() is not implemented');
90
87
  }
91
88
  }
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "engines": {
41
41
  "node": ">=20.13.0"
42
42
  },
43
- "version": "1.13.2",
43
+ "version": "1.13.4",
44
44
  "description": "CommonStorage implementation based on Google Cloud Storage",
45
45
  "author": "Natural Cycles Team",
46
46
  "license": "MIT"
@@ -4,6 +4,7 @@ import {
4
4
  commonKeyValueDBFullSupport,
5
5
  KeyValueDBTuple,
6
6
  } from '@naturalcycles/db-lib'
7
+ import { IncrementTuple } from '@naturalcycles/db-lib/dist/kv/commonKeyValueDB'
7
8
  import { AppError, pMap, StringMap } from '@naturalcycles/js-lib'
8
9
  import { ReadableTyped } from '@naturalcycles/nodejs-lib'
9
10
  import { CommonStorage } from './commonStorage'
@@ -102,7 +103,7 @@ export class CommonStorageKeyValueDB implements CommonKeyValueDB {
102
103
 
103
104
  return this.cfg.storage
104
105
  .getFilesStream(bucketName, { prefix, limit, fullPaths: false })
105
- .map(f => [f.filePath, f.content] satisfies KeyValueDBTuple)
106
+ .map(f => [f.filePath, f.content])
106
107
  }
107
108
 
108
109
  async count(table: string): Promise<number> {
@@ -111,14 +112,7 @@ export class CommonStorageKeyValueDB implements CommonKeyValueDB {
111
112
  return (await this.cfg.storage.getFileNames(bucketName, { prefix })).length
112
113
  }
113
114
 
114
- async increment(_table: string, _id: string, _by?: number): Promise<number> {
115
- throw new AppError('CommonStorageKeyValueDB.increment() is not implemented')
116
- }
117
-
118
- async incrementBatch(
119
- _table: string,
120
- _incrementMap: StringMap<number>,
121
- ): Promise<StringMap<number>> {
115
+ async incrementBatch(_table: string, _entries: IncrementTuple[]): Promise<IncrementTuple[]> {
122
116
  throw new AppError('CommonStorageKeyValueDB.incrementBatch() is not implemented')
123
117
  }
124
118
  }