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

@iflix/events-receiver-client

Package Overview
Dependencies
Maintainers
47
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iflix/events-receiver-client - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

2

built/src/buffer/IndexedDbBuffer.d.ts

@@ -7,2 +7,4 @@ import { Event } from '../types';

lockKey: LockKey;
eventKeys: IDBKeyRange;
lockKeys: IDBKeyRange;
constructor();

@@ -9,0 +11,0 @@ queue(event: Event): Promise<void>;

13

built/src/buffer/IndexedDbBuffer.js

@@ -11,5 +11,3 @@ "use strict";

const EVENT_KEY_PREFIX = 'event!';
const EVENT_KEYS = IDBKeyRange.bound(EVENT_KEY_PREFIX, EVENT_KEY_PREFIX + '\uffff', false, false);
const LOCK_KEY_PREFIX = 'lock!';
const LOCK_KEYS = IDBKeyRange.bound(LOCK_KEY_PREFIX, LOCK_KEY_PREFIX + '\uffff', false, false);
function generateKey(event) {

@@ -46,2 +44,5 @@ return `${EVENT_KEY_PREFIX}${event.timestamp}!${event.guid}`;

this.lockKey = `${LOCK_KEY_PREFIX}${v4_1.default()}`;
// These can't just be global constants because we may not have access to IDBKeyRange (on Node, for example)
this.eventKeys = IDBKeyRange.bound(EVENT_KEY_PREFIX, EVENT_KEY_PREFIX + '\uffff', false, false);
this.lockKeys = IDBKeyRange.bound(LOCK_KEY_PREFIX, LOCK_KEY_PREFIX + '\uffff', false, false);
}

@@ -52,3 +53,3 @@ async queue(event) {

async peek(count) {
return this.db.getAll(EVENT_KEYS, count);
return this.db.getAll(this.eventKeys, count);
}

@@ -59,3 +60,3 @@ async dequeue(events) {

async lock(durationMs) {
const existingLocks = await this.db.getAll(LOCK_KEYS);
const existingLocks = await this.db.getAll(this.lockKeys);
const existingLock = winningLock(existingLocks);

@@ -71,3 +72,3 @@ if (existingLock === this.lockKey) {

await this.db.put(makeLock(this.lockKey, durationMs), this.lockKey);
const locks = await this.db.getAll(LOCK_KEYS);
const locks = await this.db.getAll(this.lockKeys);
const winning = winningLock(locks);

@@ -83,3 +84,3 @@ if (winning === this.lockKey) {

async unlock() {
const locks = await this.db.getAll(LOCK_KEYS);
const locks = await this.db.getAll(this.lockKeys);
if (winningLock(locks) !== this.lockKey) {

@@ -86,0 +87,0 @@ console.warn(` (${this.lockKey}) unlocking but we weren't in charge`);

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

const MemBuffer_1 = require("./buffer/MemBuffer");
const idb_1 = require("./utils/idb");
__export(require("./types"));

@@ -31,3 +32,3 @@ exports.getDeviceId = deviceId_1.createDeviceIdGetter();

function createBuffer() {
if (typeof indexedDB !== 'undefined') {
if (idb_1.idbAvailable()) {
console.info('detected indexeddb');

@@ -34,0 +35,0 @@ return new IndexedDbBuffer_1.IndexedDbBuffer(); // TODO params

declare type Transactor<T> = (store: IDBObjectStore) => T;
export declare function idbAvailable(): boolean;
export declare class IdbKv {

@@ -3,0 +4,0 @@ db: Promise<IDBDatabase>;

@@ -44,2 +44,6 @@ "use strict";

}
function idbAvailable() {
return typeof indexedDB !== 'undefined';
}
exports.idbAvailable = idbAvailable;
class IdbKv {

@@ -46,0 +50,0 @@ constructor(dbName, storeName) {

{
"name": "@iflix/events-receiver-client",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Decodes (and encodes) user tokens",

@@ -5,0 +5,0 @@ "main": "built/src/index.js",

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