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

@psdk/frame-father

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@psdk/frame-father - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

25

build/device/adapter/connected_device.js

@@ -1,10 +0,1 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/**

@@ -28,5 +19,3 @@ * Connected device

}
disconnect() {
return __awaiter(this, void 0, void 0, function* () {
});
async disconnect() {
}

@@ -36,11 +25,7 @@ canRead() {

}
read(options) {
return __awaiter(this, void 0, void 0, function* () {
return PsdkConst.EMPTY_BYTES;
});
async read(options) {
return PsdkConst.EMPTY_BYTES;
}
write(data) {
return __awaiter(this, void 0, void 0, function* () {
console.log('WRITE: ', data);
});
async write(data) {
console.log('WRITE: ', data);
}

@@ -47,0 +32,0 @@ flush() {

71

build/father/device/write_operation.js

@@ -1,10 +0,1 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/**

@@ -37,28 +28,26 @@ * Data write operation

}
write() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.options.enableChunkWrite) {
const reporter = yield this.writData(this.binary);
this.doCallback(reporter, this.binary, 1, 1);
async write() {
if (!this.options.enableChunkWrite) {
const reporter = await this.writData(this.binary);
this.doCallback(reporter, this.binary, 1, 1);
return reporter;
}
const writeData = Array.from(this.binary);
const parts = CollectionKit.split(writeData, this.options.chunkSize);
const totalTimes = parts.length;
let currentTimes = 0;
for (const part of parts) {
currentTimes += 1;
const partBinary = new Uint8Array(part);
const reporter = await this.writData(partBinary);
const control = this.doCallback(reporter, partBinary, currentTimes, totalTimes);
if (control == WriteControl.STOP) {
reporter.controlExit = true;
return reporter;
}
const writeData = Array.from(this.binary);
const parts = CollectionKit.split(writeData, this.options.chunkSize);
const totalTimes = parts.length;
let currentTimes = 0;
for (const part of parts) {
currentTimes += 1;
const partBinary = new Uint8Array(part);
const reporter = yield this.writData(partBinary);
const control = this.doCallback(reporter, partBinary, currentTimes, totalTimes);
if (control == WriteControl.STOP) {
reporter.controlExit = true;
return reporter;
}
if (!reporter.ok) {
return reporter;
}
if (!reporter.ok) {
return reporter;
}
return new WroteReporter(true, this.binary, false);
});
}
return new WroteReporter(true, this.binary, false);
}

@@ -81,13 +70,11 @@ doCallback(reporter, binary, currentTimes, totalTimes) {

}
writData(binary) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield this.connectedDevice.write(binary);
return new WroteReporter(true, binary, false);
}
catch (e) {
return new WroteReporter(false, binary, false, e);
}
});
async writData(binary) {
try {
await this.connectedDevice.write(binary);
return new WroteReporter(true, binary, false);
}
catch (e) {
return new WroteReporter(false, binary, false, e);
}
}
}

@@ -1,10 +0,1 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { PsdkConst, WriteOptions } from "./types";

@@ -58,15 +49,13 @@ import { DataWriteOperation } from "./device/write_operation";

*/
write(options) {
return __awaiter(this, void 0, void 0, function* () {
const connectedDevice = this.connectedDevice();
if (!connectedDevice)
throw Error('It\'s seems you missing to set connectedDevice');
options = options !== null && options !== void 0 ? options : WriteOptions.def();
const command = this.command();
const binary = command.binary();
const operation = new DataWriteOperation(options, binary, connectedDevice);
const reporter = yield operation.write();
this.clear();
return reporter;
});
async write(options) {
const connectedDevice = this.connectedDevice();
if (!connectedDevice)
throw Error('It\'s seems you missing to set connectedDevice');
options = options !== null && options !== void 0 ? options : WriteOptions.def();
const command = this.command();
const binary = command.binary();
const operation = new DataWriteOperation(options, binary, connectedDevice);
const reporter = await operation.write();
this.clear();
return reporter;
}

@@ -73,0 +62,0 @@ /**

{
"name": "@psdk/frame-father",
"version": "0.3.3",
"version": "0.3.4",
"description": "psdk",

@@ -35,3 +35,3 @@ "main": "build/index.js",

],
"gitHead": "20a3fc1bb587f8d627f9b1e05dd27240b7785dec"
"gitHead": "b8c2fdcb52f1bd3e9d75d004d37d717bd465b4c9"
}
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