Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xyo-network/storage

Package Overview
Dependencies
Maintainers
4
Versions
549
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xyo-network/storage - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

5

dist/@types/index.d.ts
/// <reference types="node" />
import { XyoError } from "@xyo-network/errors";
import { XyoStoragePriority } from "../xyo-storage-priority";
/**

@@ -10,5 +9,5 @@ * The interface for storage in the system. Provides a simple

/** Should persist the value for the corresponding key */
write(key: Buffer, value: Buffer, priority: XyoStoragePriority, cache: boolean, timeout: number): Promise<XyoError | undefined>;
write(key: Buffer, value: Buffer): Promise<XyoError | undefined>;
/** Attempts to the read the value for key, returns `undefined` if it does not exist */
read(key: Buffer, timeout: number): Promise<Buffer | undefined>;
read(key: Buffer): Promise<Buffer | undefined>;
/** Returns a list of all the keys in storage */

@@ -15,0 +14,0 @@ getAllKeys(): Promise<Buffer[]>;

2

dist/@types/index.js

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

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:13:48 pm
* @Last modified time: Tuesday, 11th December 2018 9:56:53 am
* @License: All Rights Reserved

@@ -11,0 +11,0 @@ * @Copyright: Copyright XY | The Findables Company

@@ -1,3 +0,2 @@

export { IXyoBufferKeyValuePair, IXyoIterableStorageProvider, IXyoStorageIterationResult, IXyoStorageProvider } from './@types';
export { XyoStoragePriority } from './xyo-storage-priority';
export { IXyoIterableStorageProvider, IXyoStorageProvider } from './@types';
export { XyoInMemoryStorageProvider } from './xyo-in-memory-storage-provider';

@@ -4,0 +3,0 @@ export { XyoLocalFileStorageProvider } from './xyo-local-file-storage-provider';

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

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:33:38 pm
* @Last modified time: Tuesday, 11th December 2018 9:56:20 am
* @License: All Rights Reserved

@@ -14,4 +14,2 @@ * @Copyright: Copyright XY | The Findables Company

Object.defineProperty(exports, "__esModule", { value: true });
var xyo_storage_priority_1 = require("./xyo-storage-priority");
exports.XyoStoragePriority = xyo_storage_priority_1.XyoStoragePriority;
var xyo_in_memory_storage_provider_1 = require("./xyo-in-memory-storage-provider");

@@ -18,0 +16,0 @@ exports.XyoInMemoryStorageProvider = xyo_in_memory_storage_provider_1.XyoInMemoryStorageProvider;

/// <reference types="node" />
import { XyoStoragePriority } from './xyo-storage-priority';
import { IXyoStorageProvider } from './@types';

@@ -24,3 +23,3 @@ import { XyoError } from '@xyo-network/errors';

*/
write(key: Buffer, value: Buffer, priority: XyoStoragePriority, cache: boolean, timeout: number): Promise<XyoError | undefined>;
write(key: Buffer, value: Buffer): Promise<XyoError | undefined>;
/**

@@ -31,3 +30,3 @@ * Attempts to retrieve a value corresponding to the location identifier `key`

*/
read(key: Buffer, timeout: number): Promise<Buffer | undefined>;
read(key: Buffer): Promise<Buffer | undefined>;
/**

@@ -34,0 +33,0 @@ * Returns a list of the all they `keys` or location identifiers in storage

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

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:21:17 pm
* @Last modified time: Tuesday, 11th December 2018 9:57:22 am
* @License: All Rights Reserved

@@ -38,3 +38,3 @@ * @Copyright: Copyright XY | The Findables Company

*/
write(key, value, priority, cache, timeout) {
write(key, value) {
return __awaiter(this, void 0, void 0, function* () {

@@ -50,3 +50,3 @@ this.data[key.toString()] = value;

*/
read(key, timeout) {
read(key) {
return __awaiter(this, void 0, void 0, function* () {

@@ -53,0 +53,0 @@ const result = this.data[key.toString()];

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

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:32:55 pm
* @Last modified time: Tuesday, 11th December 2018 9:58:22 am
* @License: All Rights Reserved

@@ -22,3 +22,2 @@ * @Copyright: Copyright XY | The Findables Company

Object.defineProperty(exports, "__esModule", { value: true });
const xyo_storage_priority_1 = require("./xyo-storage-priority");
const base_1 = require("@xyo-network/base");

@@ -57,3 +56,3 @@ /**

if (namespaceExists) {
const namespaceBufferValue = yield this.storageProvider.read(this.namespaceKey, 60000);
const namespaceBufferValue = yield this.storageProvider.read(this.namespaceKey);
namespaceValue = JSON.parse(namespaceBufferValue.toString());

@@ -71,3 +70,3 @@ const index = namespaceValue.indexOf(namespace);

if (shouldUpdateNamespaceList) {
yield this.storageProvider.write(this.namespaceKey, Buffer.from(base_1.XyoBase.stringify(namespaceValue)), xyo_storage_priority_1.XyoStoragePriority.PRIORITY_HIGH, true, 60000);
yield this.storageProvider.write(this.namespaceKey, Buffer.from(base_1.XyoBase.stringify(namespaceValue)));
}

@@ -86,9 +85,9 @@ return new XyoNamespacedStorageProvider(this.storageProvider, namespace);

/** Should persist the value for the corresponding key */
write(key, value, priority, cache, timeout) {
return this.proxyStorageProvider.write(this.getProxyKey(key), value, priority, cache, timeout);
write(key, value) {
return this.proxyStorageProvider.write(this.getProxyKey(key), value);
}
/** Attempts to the read the value for key, returns `undefined` if it does not exist */
read(key, timeout) {
read(key) {
return __awaiter(this, void 0, void 0, function* () {
return this.proxyStorageProvider.read(this.getProxyKey(key), timeout);
return this.proxyStorageProvider.read(this.getProxyKey(key));
});

@@ -95,0 +94,0 @@ }

/// <reference types="node" />
import { IXyoStorageProvider } from "./@types";
import { XyoError } from "@xyo-network/errors";
import { XyoStoragePriority } from "./xyo-storage-priority";
import { XyoBase } from "@xyo-network/base";

@@ -18,8 +17,8 @@ /**

constructor(dataFile: string);
read(key: Buffer, timeout: number): Promise<Buffer | undefined>;
read(key: Buffer): Promise<Buffer | undefined>;
getAllKeys(): Promise<Buffer[]>;
containsKey(key: Buffer): Promise<boolean>;
write(key: Buffer, value: Buffer, priority: XyoStoragePriority, cache: boolean, timeout: number): Promise<XyoError | undefined>;
write(key: Buffer, value: Buffer): Promise<XyoError | undefined>;
delete(key: Buffer): Promise<void>;
}
//# sourceMappingURL=xyo-local-file-storage-provider.d.ts.map

@@ -28,4 +28,4 @@ "use strict";

}
read(key, timeout) {
return this.delegate.read(key, timeout);
read(key) {
return this.delegate.read(key);
}

@@ -38,5 +38,5 @@ getAllKeys() {

}
write(key, value, priority, cache, timeout) {
write(key, value) {
return __awaiter(this, void 0, void 0, function* () {
yield this.delegate.write(key, value, priority, cache, timeout);
yield this.delegate.write(key, value);
yield persist(this.dataFile, this.delegate.data);

@@ -43,0 +43,0 @@ return;

{
"name": "@xyo-network/storage",
"version": "0.2.1",
"version": "0.3.0",
"description": "An abstraction around persistence in the Xyo Network",

@@ -10,4 +10,4 @@ "main": "dist/index.js",

"dependencies": {
"@xyo-network/base": "^0.2.1",
"@xyo-network/errors": "^0.2.1"
"@xyo-network/base": "^0.3.0",
"@xyo-network/errors": "^0.3.0"
},

@@ -23,3 +23,3 @@ "devDependencies": {

},
"gitHead": "0635d162b742fbb5ee4f09d4e3faf5149b43eaf0"
"gitHead": "55319bda08512a2701fb6494ad2e2526791e6bb7"
}

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:13:48 pm
* @Last modified time: Tuesday, 11th December 2018 9:56:53 am
* @License: All Rights Reserved

@@ -14,3 +14,2 @@ * @Copyright: Copyright XY | The Findables Company

import { XyoError } from "@xyo-network/errors"
import { XyoStoragePriority } from "../xyo-storage-priority"

@@ -24,12 +23,6 @@ /**

/** Should persist the value for the corresponding key */
write(
key: Buffer,
value: Buffer,
priority: XyoStoragePriority,
cache: boolean,
timeout: number
): Promise<XyoError | undefined>
write(key: Buffer, value: Buffer): Promise<XyoError | undefined>
/** Attempts to the read the value for key, returns `undefined` if it does not exist */
read(key: Buffer, timeout: number): Promise<Buffer | undefined>
read(key: Buffer): Promise<Buffer | undefined>

@@ -36,0 +29,0 @@ /** Returns a list of all the keys in storage */

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:33:38 pm
* @Last modified time: Tuesday, 11th December 2018 9:56:20 am
* @License: All Rights Reserved

@@ -14,11 +14,8 @@ * @Copyright: Copyright XY | The Findables Company

export {
IXyoBufferKeyValuePair,
IXyoIterableStorageProvider,
IXyoStorageIterationResult,
IXyoStorageProvider
} from './@types'
export { XyoStoragePriority } from './xyo-storage-priority'
export { XyoInMemoryStorageProvider } from './xyo-in-memory-storage-provider'
export { XyoLocalFileStorageProvider } from './xyo-local-file-storage-provider'
export { XyoKeyValueDatabase } from './xyo-key-value-database'

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:21:17 pm
* @Last modified time: Tuesday, 11th December 2018 9:57:22 am
* @License: All Rights Reserved

@@ -13,3 +13,2 @@ * @Copyright: Copyright XY | The Findables Company

import { XyoStoragePriority } from './xyo-storage-priority'
import { IXyoStorageProvider } from './@types'

@@ -36,9 +35,3 @@ import { XyoError } from '@xyo-network/errors'

public async write(
key: Buffer,
value: Buffer,
priority: XyoStoragePriority,
cache: boolean,
timeout: number
): Promise<XyoError | undefined> {
public async write(key: Buffer, value: Buffer): Promise<XyoError | undefined> {
this.data[key.toString()] = value

@@ -54,3 +47,3 @@ return

public async read(key: Buffer, timeout: number): Promise<Buffer | undefined> {
public async read(key: Buffer): Promise<Buffer | undefined> {
const result = this.data[key.toString()]

@@ -57,0 +50,0 @@ if (!result) {

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:32:55 pm
* @Last modified time: Tuesday, 11th December 2018 9:58:22 am
* @License: All Rights Reserved

@@ -14,3 +14,2 @@ * @Copyright: Copyright XY | The Findables Company

import { IXyoStorageProvider } from "./@types"
import { XyoStoragePriority } from "./xyo-storage-priority"
import { XyoError } from '@xyo-network/errors'

@@ -53,3 +52,3 @@ import { XyoBase } from "@xyo-network/base"

if (namespaceExists) {
const namespaceBufferValue = await this.storageProvider.read(this.namespaceKey, 60000)
const namespaceBufferValue = await this.storageProvider.read(this.namespaceKey)
namespaceValue = JSON.parse(namespaceBufferValue!.toString()) as string[]

@@ -69,6 +68,3 @@ const index = namespaceValue.indexOf(namespace)

this.namespaceKey,
Buffer.from(XyoBase.stringify(namespaceValue)),
XyoStoragePriority.PRIORITY_HIGH,
true,
60000
Buffer.from(XyoBase.stringify(namespaceValue))
)

@@ -90,21 +86,9 @@ }

/** Should persist the value for the corresponding key */
public write(
key: Buffer,
value: Buffer,
priority: XyoStoragePriority,
cache: boolean,
timeout: number
): Promise<XyoError | undefined> {
return this.proxyStorageProvider.write(
this.getProxyKey(key),
value,
priority,
cache,
timeout
)
public write(key: Buffer, value: Buffer): Promise<XyoError | undefined> {
return this.proxyStorageProvider.write(this.getProxyKey(key), value)
}
/** Attempts to the read the value for key, returns `undefined` if it does not exist */
public async read(key: Buffer, timeout: number): Promise<Buffer | undefined> {
return this.proxyStorageProvider.read(this.getProxyKey(key), timeout)
public async read(key: Buffer): Promise<Buffer | undefined> {
return this.proxyStorageProvider.read(this.getProxyKey(key))
}

@@ -111,0 +95,0 @@

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Tuesday, 20th November 2018 1:24:22 pm
* @Last modified time: Tuesday, 11th December 2018 9:58:50 am
* @License: All Rights Reserved

@@ -16,3 +16,2 @@ * @Copyright: Copyright XY | The Findables Company

import { XyoError } from "@xyo-network/errors"
import { XyoStoragePriority } from "./xyo-storage-priority"
import { XyoBase } from "@xyo-network/base"

@@ -37,4 +36,4 @@

public read(key: Buffer, timeout: number): Promise<Buffer | undefined> {
return this.delegate.read(key, timeout)
public read(key: Buffer): Promise<Buffer | undefined> {
return this.delegate.read(key)
}

@@ -52,8 +51,5 @@

key: Buffer,
value: Buffer,
priority: XyoStoragePriority,
cache: boolean,
timeout: number
value: Buffer
): Promise<XyoError | undefined> {
await this.delegate.write(key, value, priority, cache, timeout)
await this.delegate.write(key, value)
await persist(this.dataFile, this.delegate.data)

@@ -60,0 +56,0 @@ return

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

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

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