New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@naturalcycles/db-lib

Package Overview
Dependencies
Maintainers
3
Versions
303
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@naturalcycles/db-lib - npm Package Compare versions

Comparing version 8.7.0 to 8.7.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [8.7.1](https://github.com/NaturalCycles/db-lib/compare/v8.7.0...v8.7.1) (2021-06-27)
### Bug Fixes
* clarify CommonKVDB interface ([29a398f](https://github.com/NaturalCycles/db-lib/commit/29a398fc8680b37f32445ec40eddef7953c64348))
# [8.7.0](https://github.com/NaturalCycles/db-lib/compare/v8.6.2...v8.7.0) (2021-06-27)

@@ -2,0 +9,0 @@

2

dist/adapter/inmemory/inMemory.kv.db.d.ts
/// <reference types="node" />
import { StringMap } from '@naturalcycles/js-lib';
import { CommonDBCreateOptions } from '../../db.model';
import { CommonKVDB } from '../../kv/common.kv.db';

@@ -11,2 +12,3 @@ export interface InMemoryKVDBCfg {

ping(): Promise<void>;
createTable(_table: string, _opt?: CommonDBCreateOptions): Promise<void>;
deleteByIds(table: string, ids: string[]): Promise<void>;

@@ -13,0 +15,0 @@ getByIds(table: string, ids: string[]): Promise<Buffer[]>;

@@ -12,2 +12,3 @@ "use strict";

async ping() { }
async createTable(_table, _opt) { }
async deleteByIds(table, ids) {

@@ -14,0 +15,0 @@ var _a;

/// <reference types="node" />
import { StringMap } from '@naturalcycles/js-lib';
import { CommonDaoLogLevel } from '../commondao/common.dao.model';
import { CommonDBCreateOptions } from '../db.model';
import { CommonKVDB } from './common.kv.db';

@@ -30,2 +31,3 @@ export interface CommonKVDaoCfg<T> {

ping(): Promise<void>;
createTable(opt?: CommonDBCreateOptions): Promise<void>;
getById(id?: string): Promise<T | null>;

@@ -32,0 +34,0 @@ getByIds(ids: string[]): Promise<T[]>;

@@ -14,2 +14,5 @@ "use strict";

}
async createTable(opt = {}) {
await this.cfg.db.createTable(this.cfg.table, opt);
}
async getById(id) {

@@ -16,0 +19,0 @@ if (!id)

/// <reference types="node" />
import { StringMap } from '@naturalcycles/js-lib';
import { CommonDBCreateOptions } from '../db.model';
/**

@@ -14,2 +15,7 @@ * Common interface for Key-Value database implementations.

/**
* Will do like `create table ...` for mysql.
* Caution! dropIfExists defaults to false. If set to true - will actually DROP the table!
*/
createTable(table: string, opt?: CommonDBCreateOptions): Promise<void>;
/**
* Returns an array of values found. Not found values are not returned (no error is thrown).

@@ -16,0 +22,0 @@ */

2

dist/testing/kvDBTest.js

@@ -23,3 +23,3 @@ "use strict";

const results = await db.getByIds(test_model_1.TEST_TABLE, testIds);
expect(results).toStrictEqual(Object.values(testItems));
expect(results).toEqual(Object.values(testItems));
});

@@ -26,0 +26,0 @@ test('deleteByIds should clear', async () => {

@@ -43,3 +43,3 @@ {

},
"version": "8.7.0",
"version": "8.7.1",
"description": "Lowest Common Denominator API to supported Databases",

@@ -46,0 +46,0 @@ "keywords": [

import { StringMap, _stringMapEntries } from '@naturalcycles/js-lib'
import { CommonDBCreateOptions } from '../../db.model'
import { CommonKVDB } from '../../kv/common.kv.db'

@@ -14,2 +15,4 @@

async createTable(_table: string, _opt?: CommonDBCreateOptions): Promise<void> {}
async deleteByIds(table: string, ids: string[]): Promise<void> {

@@ -16,0 +19,0 @@ this.data[table] ||= {}

import { pMap, StringMap, _stringMapEntries } from '@naturalcycles/js-lib'
import { CommonDaoLogLevel } from '../commondao/common.dao.model'
import { CommonDBCreateOptions } from '../db.model'
import { CommonKVDB } from './common.kv.db'

@@ -42,2 +43,6 @@

async createTable(opt: CommonDBCreateOptions = {}): Promise<void> {
await this.cfg.db.createTable(this.cfg.table, opt)
}
async getById(id?: string): Promise<T | null> {

@@ -44,0 +49,0 @@ if (!id) return null

import { StringMap } from '@naturalcycles/js-lib'
import { CommonDBCreateOptions } from '../db.model'

@@ -15,2 +16,8 @@ /**

/**
* Will do like `create table ...` for mysql.
* Caution! dropIfExists defaults to false. If set to true - will actually DROP the table!
*/
createTable(table: string, opt?: CommonDBCreateOptions): Promise<void>
/**
* Returns an array of values found. Not found values are not returned (no error is thrown).

@@ -17,0 +24,0 @@ */

@@ -30,3 +30,3 @@ import { StringMap, _range } from '@naturalcycles/js-lib'

const results = await db.getByIds(TEST_TABLE, testIds)
expect(results).toStrictEqual(Object.values(testItems))
expect(results).toEqual(Object.values(testItems))
})

@@ -33,0 +33,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc