1.19.0 • Published 6 months ago

@azot-dev/cortex-storage-stub-adapter v1.19.0

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

Stub Storage Adapter

installation

npm i @azot-dev/cortex-storage-stub-adapter

or

yarn add @azot-dev/cortex-storage-stub-adapter

adapter

export * from '../storage.gateway';

import { StorageGateway } from '../storage.gateway';

export class StubStorageAdapter implements StorageGateway {
  private storage: Record<string, any> = {};

  getItem(key: string) {
    return this.storage[key];
  }
  async setItem(key: string, value: any) {
    this.storage[key] = value;
  }
  async removeItem(key: string) {
    delete this.storage[key];
  }
  async clear() {
    this.storage = {};
  }
  async getAllKeys() {
    return Object.keys(this.storage);
  }
}

gateway

export interface StorageGateway {
  getItem(key: string): Promise<any>;
  setItem(key: string, value: any): Promise<void>;
  removeItem(key: string): Promise<void>;
  clear(): Promise<void>;
  getAllKeys(): Promise<string[]>;
}
1.15.0

6 months ago

1.14.0

6 months ago

1.13.0

6 months ago

1.19.0

6 months ago

1.18.0

6 months ago

1.17.0

6 months ago

1.16.0

6 months ago

1.12.0

7 months ago

1.11.0

7 months ago

1.10.0

7 months ago

1.9.0

7 months ago

1.8.0

7 months ago

1.7.0

7 months ago

1.6.0

7 months ago

1.5.0

7 months ago

1.4.0

7 months ago

1.3.0

7 months ago

1.2.0

7 months ago

1.1.0

7 months ago