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

pico-framework

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pico-framework - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

1

dist/src/Channel.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanChannelTags = exports.cleanQueryPolicy = exports.cleanEventPolicy = exports.assertQueryPolicy = exports.assertEventPolicy = exports.Channel = void 0;
const _ = require("lodash");

@@ -5,0 +4,0 @@ const utils_1 = require("./utils");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dbRange = void 0;
const _ = require("lodash");

@@ -5,0 +4,0 @@ function dbRange(ldb, opts, onData) {

5

dist/src/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanChannelTags = exports.PicoFramework = void 0;
const Channel_1 = require("./Channel");
Object.defineProperty(exports, "cleanChannelTags", { enumerable: true, get: function () { return Channel_1.cleanChannelTags; } });
exports.cleanChannelTags = Channel_1.cleanChannelTags;
const PicoFramework_1 = require("./PicoFramework");
Object.defineProperty(exports, "PicoFramework", { enumerable: true, get: function () { return PicoFramework_1.PicoFramework; } });
exports.PicoFramework = PicoFramework_1.PicoFramework;
//# sourceMappingURL=index.js.map

@@ -93,6 +93,8 @@ import { Channel, ChannelConfig, ChannelReadOnly } from "./Channel";

private current;
private currentTxn;
raiseEvent(domain: string, name: string, attrs: PicoEventPayload["attrs"], forRid?: string): void;
clearSchedule(): void;
addToSchedule(rid: string, event: PicoEvent): void;
private addEventToSchedule;
private doTxn;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pico = void 0;
const _ = require("lodash");

@@ -307,3 +306,3 @@ const Channel_1 = require("./Channel");

if (typeof forRid === "string") {
this.schedule.push({ rid: forRid, event });
this.addToSchedule(forRid, event);
}

@@ -316,41 +315,66 @@ else {

this.schedule = [];
if (this.currentTxn && this.currentTxn.kind === "event") {
this.pf.emit({
type: "eventScheduleCleared",
picoId: this.id,
txn: this.currentTxn,
});
}
}
addToSchedule(rid, event) {
this.schedule.push({ rid, event });
if (this.currentTxn && this.currentTxn.kind === "event") {
this.pf.emit({
type: "eventScheduleAdded",
picoId: this.id,
txn: this.currentTxn,
rid,
event,
});
}
}
addEventToSchedule(event) {
for (const rid of Object.keys(this.rulesets)) {
this.schedule.push({ rid, event });
this.addToSchedule(rid, event);
}
}
async doTxn(txn) {
switch (txn.kind) {
case "event":
this.schedule = []; // reset schedule every new event
this.addEventToSchedule(txn.event);
const eid = txn.id;
const responses = [];
try {
while ((this.current = this.schedule.shift())) {
const rs = this.rulesets[this.current.rid];
if (rs && rs.instance.event) {
// must process one event at a time to maintain the pico's single-threaded guarantee
const response = await rs.instance.event(this.current.event, eid);
responses.push(response);
this.currentTxn = txn;
try {
switch (txn.kind) {
case "event":
this.schedule = []; // reset schedule every new event
this.addEventToSchedule(txn.event);
const eid = txn.id;
const responses = [];
try {
while ((this.current = this.schedule.shift())) {
const rs = this.rulesets[this.current.rid];
if (rs && rs.instance.event) {
// must process one event at a time to maintain the pico's single-threaded guarantee
const response = await rs.instance.event(this.current.event, eid);
responses.push(response);
}
}
}
}
finally {
this.current = undefined;
}
return { eid, responses };
case "query":
const rs = this.rulesets[txn.query.rid];
if (!rs) {
throw new Error(`Pico doesn't have ${txn.query.rid} installed.`);
}
const qfn = rs.instance.query && rs.instance.query[txn.query.name];
if (!qfn) {
throw new Error(`Ruleset ${txn.query.rid} does not have query function "${txn.query.name}"`);
}
const data = await qfn(txn.query, txn.id);
return data;
finally {
this.current = undefined;
}
return { eid, responses };
case "query":
const rs = this.rulesets[txn.query.rid];
if (!rs) {
throw new Error(`Pico doesn't have ${txn.query.rid} installed.`);
}
const qfn = rs.instance.query && rs.instance.query[txn.query.name];
if (!qfn) {
throw new Error(`Ruleset ${txn.query.rid} does not have query function "${txn.query.name}"`);
}
const data = await qfn(txn.query, txn.id);
return data;
}
}
finally {
this.currentTxn = undefined;
}
}

@@ -357,0 +381,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanEvent = void 0;
const utils_1 = require("./utils");

@@ -5,0 +4,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PicoFramework = void 0;
const cuid = require("cuid");

@@ -5,0 +4,0 @@ const levelup_1 = require("levelup");

import { RulesetConfig } from ".";
import { PicoTxn } from "./PicoQueue";
export declare type PicoFrameworkEvent = PicoFrameworkEvent_startup | PicoFrameworkEvent_startupDone | PicoFrameworkEvent_txnQueued | PicoFrameworkEvent_txnStart | PicoFrameworkEvent_txnDone | PicoFrameworkEvent_txnError | PicoFrameworkEvent_reInitRulesetError;
import { PicoEvent } from "./PicoEvent";
import { PicoTxn, PicoTxn_event } from "./PicoQueue";
export declare type PicoFrameworkEvent = PicoFrameworkEvent_startup | PicoFrameworkEvent_startupDone | PicoFrameworkEvent_txnQueued | PicoFrameworkEvent_txnStart | PicoFrameworkEvent_txnDone | PicoFrameworkEvent_txnError | PicoFrameworkEvent_reInitRulesetError | PicoFrameworkEvent_eventScheduleAdded | PicoFrameworkEvent_eventScheduleCleared;
export interface PicoFrameworkEvent_startup {

@@ -39,1 +40,13 @@ type: "startup";

}
export interface PicoFrameworkEvent_eventScheduleAdded {
type: "eventScheduleAdded";
picoId: string;
txn: PicoTxn_event;
rid: string;
event: PicoEvent;
}
export interface PicoFrameworkEvent_eventScheduleCleared {
type: "eventScheduleCleared";
picoId: string;
txn: PicoTxn_event;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanQuery = void 0;
const utils_1 = require("./utils");

@@ -5,0 +4,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PicoQueue = void 0;
class PicoQueue {

@@ -5,0 +4,0 @@ constructor(picoId, worker, emit) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createRulesetContext = void 0;
/**

@@ -5,0 +4,0 @@ * This is a constructor function to be sure that we don't leak things that a ruleset should not have access to.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNotStringOrBlank = void 0;
function isNotStringOrBlank(val) {

@@ -5,0 +4,0 @@ return typeof val !== "string" || val.trim().length === 0;

{
"name": "pico-framework",
"version": "0.4.0",
"version": "0.4.1",
"description": "A framework for building actor-based, people-centric systems. (pico = PersIstent Compute Objects)",

@@ -5,0 +5,0 @@ "repository": {

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

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