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

@osaas/client-db

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@osaas/client-db - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

2

lib/valkey.d.ts
/// <reference types="node" />
import { Context } from '@osaas/client-core';
export declare const delay: (ms: number) => Promise<unknown>;
export declare class ValkeyDb {
private context;
private name;
private token?;
private url?;

@@ -9,0 +7,0 @@ constructor({ context, name }: {

25

lib/valkey.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValkeyDb = exports.delay = void 0;
exports.ValkeyDb = void 0;
const client_core_1 = require("@osaas/client-core");
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
exports.delay = delay;
const client_services_1 = require("@osaas/client-services");
const SERVICE_ID = 'valkey-io-valkey';

@@ -11,3 +10,2 @@ class ValkeyDb {

name;
token;
url;

@@ -26,6 +24,4 @@ constructor({ context, name }) {

async getRedisPort() {
if (!this.token) {
this.token = await this.context.getServiceAccessToken(SERVICE_ID);
}
const ports = await (0, client_core_1.getPortsForInstance)(this.context, SERVICE_ID, this.name, this.token);
const token = await this.context.getServiceAccessToken(SERVICE_ID);
const ports = await (0, client_core_1.getPortsForInstance)(this.context, SERVICE_ID, this.name, token);
const redisPort = ports.find((port) => port.internalPort == 6379);

@@ -35,11 +31,5 @@ return redisPort;

async init() {
this.token = await this.context.getServiceAccessToken(SERVICE_ID);
const instance = await (0, client_core_1.getInstance)(this.context, SERVICE_ID, this.name, this.token);
const instance = await (0, client_services_1.getValkeyIoValkeyInstance)(this.context, this.name);
if (!instance) {
if (!(await (0, client_core_1.createInstance)(this.context, SERVICE_ID, this.token, {
name: this.name
}))) {
throw new Error('Failed to create Valkey instance');
}
await (0, exports.delay)(5000);
await (0, client_services_1.createValkeyIoValkeyInstance)(this.context, { name: this.name });
}

@@ -53,4 +43,3 @@ const redisPort = await this.getRedisPort();

try {
this.token = await this.context.getServiceAccessToken(SERVICE_ID);
await (0, client_core_1.removeInstance)(this.context, SERVICE_ID, this.name, this.token);
await (0, client_services_1.removeValkeyIoValkeyInstance)(this.context, this.name);
}

@@ -57,0 +46,0 @@ catch (err) {

{
"name": "@osaas/client-db",
"version": "0.3.2",
"version": "0.4.0",
"description": "Open Source Cloud Client SDK database library",

@@ -29,2 +29,3 @@ "author": "Eyevinn Open Source Cloud <osc@eyevinn.se>",

"@osaas/client-core": "^0.15.0",
"@osaas/client-services": "^0.4.0",
"chalk": "4.1.2"

@@ -35,3 +36,3 @@ },

},
"gitHead": "eb88400f144914fba52d8d37dfc9b26a7966a8bc"
"gitHead": "0907e1a5bf0eb7c7c59a57e119d624e5bb3bd8eb"
}

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