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

@sociably/stream

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sociably/stream - npm Package Compare versions

Comparing version 0.8.0-alpha.10 to 0.8.0-alpha.28

4

lib/conditions.d.ts
import { MaybeContainer } from '@sociably/core/service';
import Stream from './stream';
declare type PredicateFn<T> = (value: T) => boolean | Promise<boolean>;
import Stream from './stream.js';
type PredicateFn<T> = (value: T) => boolean | Promise<boolean>;
declare function conditions<T, Predicators extends readonly MaybeContainer<PredicateFn<T>>[]>(source: Stream<T>, predicators: Predicators): {

@@ -5,0 +5,0 @@ [I in keyof Predicators]: Predicators[I] extends MaybeContainer<(v: unknown) => v is infer U> ? Stream<U> : Stream<T>;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const injectMaybe_1 = __importDefault(require("./injectMaybe"));
const stream_1 = __importDefault(require("./stream"));
import injectMaybe from './injectMaybe.js';
import Stream from './stream.js';
function conditions(source, predicators) {
const destinations = predicators.map(() => new stream_1.default());
const injectablePredicators = predicators.map((predicateFnOrContainer) => (0, injectMaybe_1.default)(predicateFnOrContainer));
const destinations = predicators.map(() => new Stream());
const injectablePredicators = predicators.map((predicateFnOrContainer) => injectMaybe(predicateFnOrContainer));
source._subscribe(async (frame) => {

@@ -33,3 +28,3 @@ for (let i = 0; i < destinations.length; i += 1) {

}
exports.default = conditions;
export default conditions;
//# sourceMappingURL=conditions.js.map
import { SociablyApp } from '@sociably/core';
import Stream from './stream';
import { EventContextOfApp } from './types';
import Stream from './stream.js';
import { EventContextOfApp } from './types.js';
declare const fromApp: <App extends SociablyApp<any, import("@sociably/core").AnyEventContext>>(app: App) => Stream<EventContextOfApp<App>>;
export default fromApp;

@@ -1,19 +0,13 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const service_1 = require("@sociably/core/service");
const stream_1 = __importDefault(require("./stream"));
import { serviceContainer, ServiceScope } from '@sociably/core/service';
import Stream from './stream.js';
const fromApp = (app) => {
const subject = new stream_1.default();
app.onEvent((0, service_1.serviceContainer)({ deps: [service_1.ServiceScope] })((scope) => (context) => {
var _a;
const subject = new Stream();
app.onEvent(serviceContainer({ deps: [ServiceScope] })((scope) => (context) => {
subject.next({
scope,
value: context,
key: (_a = context.event.thread) === null || _a === void 0 ? void 0 : _a.uid,
key: context.event.thread?.uid,
});
}));
app.onError((0, service_1.serviceContainer)({ deps: [service_1.ServiceScope] })((scope) => (error) => {
app.onError(serviceContainer({ deps: [ServiceScope] })((scope) => (error) => {
subject.error({

@@ -27,3 +21,3 @@ scope,

};
exports.default = fromApp;
export default fromApp;
//# sourceMappingURL=fromApp.js.map

@@ -1,7 +0,7 @@

export { default as Stream } from './stream';
export { default as fromApp } from './fromApp';
export { default as merge } from './merge';
export { default as conditions } from './conditions';
export { default as pipe } from './pipe';
export { STREAMING_KEY_I } from './interface';
export * from './types';
export { default as Stream } from './stream.js';
export { default as fromApp } from './fromApp.js';
export { default as merge } from './merge.js';
export { default as conditions } from './conditions.js';
export { default as pipe } from './pipe.js';
export { STREAMING_KEY_I } from './interface.js';
export * from './types.js';

@@ -1,34 +0,8 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.STREAMING_KEY_I = exports.pipe = exports.conditions = exports.merge = exports.fromApp = exports.Stream = void 0;
var stream_1 = require("./stream");
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return __importDefault(stream_1).default; } });
var fromApp_1 = require("./fromApp");
Object.defineProperty(exports, "fromApp", { enumerable: true, get: function () { return __importDefault(fromApp_1).default; } });
var merge_1 = require("./merge");
Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return __importDefault(merge_1).default; } });
var conditions_1 = require("./conditions");
Object.defineProperty(exports, "conditions", { enumerable: true, get: function () { return __importDefault(conditions_1).default; } });
var pipe_1 = require("./pipe");
Object.defineProperty(exports, "pipe", { enumerable: true, get: function () { return __importDefault(pipe_1).default; } });
var interface_1 = require("./interface");
Object.defineProperty(exports, "STREAMING_KEY_I", { enumerable: true, get: function () { return interface_1.STREAMING_KEY_I; } });
__exportStar(require("./types"), exports);
export { default as Stream } from './stream.js';
export { default as fromApp } from './fromApp.js';
export { default as merge } from './merge.js';
export { default as conditions } from './conditions.js';
export { default as pipe } from './pipe.js';
export { STREAMING_KEY_I } from './interface.js';
export * from './types.js';
//# sourceMappingURL=index.js.map
import { MaybeContainer } from '@sociably/core/service';
import { StreamingFrame } from './types';
declare type Fn<Args extends unknown[], Result> = (...args: Args) => Result;
import { StreamingFrame } from './types.js';
type Fn<Args extends unknown[], Result> = (...args: Args) => Result;
declare const injectMaybe: <Args extends unknown[], Result>(fnOrContainer: MaybeContainer<Fn<Args, Result>>) => (frame: StreamingFrame<unknown>) => (...args: Args) => Result;
export default injectMaybe;

@@ -1,7 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const service_1 = require("@sociably/core/service");
const interface_1 = require("./interface");
import { isServiceContainer } from '@sociably/core/service';
import { STREAMING_KEY_I } from './interface.js';
const injectMaybe = (fnOrContainer) => {
if (!(0, service_1.isServiceContainer)(fnOrContainer)) {
if (!isServiceContainer(fnOrContainer)) {
return () => fnOrContainer;

@@ -11,7 +9,7 @@ }

const { key, scope } = frame;
const provisions = new Map([[interface_1.STREAMING_KEY_I, key]]);
const provisions = new Map([[STREAMING_KEY_I, key]]);
return scope.injectContainer(fnOrContainer, provisions)(...args);
};
};
exports.default = injectMaybe;
export default injectMaybe;
//# sourceMappingURL=injectMaybe.js.map

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.STREAMING_KEY_I = void 0;
/* eslint-disable import/prefer-default-export */
const service_1 = require("@sociably/core/service");
exports.STREAMING_KEY_I = (0, service_1.serviceInterface)({
import { serviceInterface } from '@sociably/core/service';
export const STREAMING_KEY_I = serviceInterface({
name: 'XStreamingKey',
});
//# sourceMappingURL=interface.js.map

@@ -1,2 +0,2 @@

import Stream from './stream';
import Stream from './stream.js';
declare function merge<A, B>(a: Stream<A>, b: Stream<B>): Stream<A | B>;

@@ -3,0 +3,0 @@ declare function merge<A, B, C>(a: Stream<A>, b: Stream<B>, c: Stream<C>): Stream<A | B | C>;

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

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __importDefault(require("./stream"));
import Stream from './stream.js';
/* eslint-enable */
function merge(...sources) {
const destination = new stream_1.default();
const destination = new Stream();
const next = (frame) => destination.next(frame);

@@ -17,3 +12,3 @@ const error = (frame) => destination.error(frame);

}
exports.default = merge;
export default merge;
//# sourceMappingURL=merge.js.map

@@ -1,4 +0,4 @@

import { OperatorFunction } from '../types';
import { OperatorFunction } from '../types.js';
/** @category Operator */
declare const debounce: <T>(t: number) => OperatorFunction<T, T[]>;
export default debounce;

@@ -1,7 +0,2 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __importDefault(require("../stream"));
import Stream from '../stream.js';
/** @category Operator */

@@ -11,3 +6,3 @@ const debounce = (t) => {

return (source) => {
const destination = new stream_1.default();
const destination = new Stream();
const emitBufferedResult = (key) => {

@@ -45,3 +40,3 @@ const cache = debouncingCaches.get(key);

};
exports.default = debounce;
export default debounce;
//# sourceMappingURL=debounce.js.map

@@ -1,4 +0,4 @@

import Stream from '../stream';
import { StreamingFrame, OperatorFunction } from '../types';
import Stream from '../stream.js';
import { StreamingFrame, OperatorFunction } from '../types.js';
declare const doAsyncByKey: <T, R>(effect: (frame: StreamingFrame<T>, observer: Stream<R>) => Promise<void>) => OperatorFunction<T, R>;
export default doAsyncByKey;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = __importDefault(require("../stream"));
import Stream from '../stream.js';
const doAsyncByKey = (effect) => {
return (input) => {
const buffersByThread = new Map();
const destination = new stream_1.default();
const destination = new Stream();
const execute = async (frame) => {

@@ -52,3 +47,3 @@ const { scope, key } = frame;

};
exports.default = doAsyncByKey;
export default doAsyncByKey;
//# sourceMappingURL=doAsyncByKey.js.map
import { ServiceContainer } from '@sociably/core/service';
import { OperatorFunction } from '../types';
export declare type PredicateFn<T> = (value: T) => boolean | Promise<boolean>;
import { OperatorFunction } from '../types.js';
export type PredicateFn<T> = (value: T) => boolean | Promise<boolean>;
/** @category Operator */

@@ -5,0 +5,0 @@ declare function filter<T, Predicator extends ServiceContainer<PredicateFn<T>, unknown[]>>(predicator: Predicator): Predicator extends ServiceContainer<(v: any) => v is infer U, unknown[]> ? OperatorFunction<T, U> : OperatorFunction<T, T>;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const injectMaybe_1 = __importDefault(require("../injectMaybe"));
const doAsyncByKey_1 = __importDefault(require("./doAsyncByKey"));
import injectMaybe from '../injectMaybe.js';
import doAsyncByKey from './doAsyncByKey.js';
function filter(predicator) {
const injectPredicate = (0, injectMaybe_1.default)(predicator);
return (0, doAsyncByKey_1.default)(async (frame, stream) => {
const injectPredicate = injectMaybe(predicator);
return doAsyncByKey(async (frame, stream) => {
const ok = await injectPredicate(frame)(frame.value);

@@ -17,3 +12,3 @@ if (ok) {

}
exports.default = filter;
export default filter;
//# sourceMappingURL=filter.js.map

@@ -1,5 +0,5 @@

export { default as filter, PredicateFn } from './filter';
export { default as tap, EffectFn } from './tap';
export { default as map, MapFn } from './map';
export { default as mapMetadata, MapMetadataFn } from './mapMetadata';
export { default as debounce } from './debounce';
export { default as filter, PredicateFn } from './filter.js';
export { default as tap, EffectFn } from './tap.js';
export { default as map, MapFn } from './map.js';
export { default as mapMetadata, MapMetadataFn } from './mapMetadata.js';
export { default as debounce } from './debounce.js';

@@ -1,17 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.debounce = exports.mapMetadata = exports.map = exports.tap = exports.filter = void 0;
var filter_1 = require("./filter");
Object.defineProperty(exports, "filter", { enumerable: true, get: function () { return __importDefault(filter_1).default; } });
var tap_1 = require("./tap");
Object.defineProperty(exports, "tap", { enumerable: true, get: function () { return __importDefault(tap_1).default; } });
var map_1 = require("./map");
Object.defineProperty(exports, "map", { enumerable: true, get: function () { return __importDefault(map_1).default; } });
var mapMetadata_1 = require("./mapMetadata");
Object.defineProperty(exports, "mapMetadata", { enumerable: true, get: function () { return __importDefault(mapMetadata_1).default; } });
var debounce_1 = require("./debounce");
Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return __importDefault(debounce_1).default; } });
export { default as filter } from './filter.js';
export { default as tap } from './tap.js';
export { default as map } from './map.js';
export { default as mapMetadata } from './mapMetadata.js';
export { default as debounce } from './debounce.js';
//# sourceMappingURL=index.js.map
import { ServiceContainer } from '@sociably/core/service';
import { OperatorFunction } from '../types';
export declare type MapFn<T, R> = (value: T) => R | Promise<R>;
import { OperatorFunction } from '../types.js';
export type MapFn<T, R> = (value: T) => R | Promise<R>;
/** @category Operator */

@@ -5,0 +5,0 @@ declare function map<T, R>(mapper: ServiceContainer<MapFn<T, R>, unknown[]>): OperatorFunction<T, R>;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const injectMaybe_1 = __importDefault(require("../injectMaybe"));
const doAsyncByKey_1 = __importDefault(require("./doAsyncByKey"));
import injectMaybe from '../injectMaybe.js';
import doAsyncByKey from './doAsyncByKey.js';
function map(mapper) {
const injectMapper = (0, injectMaybe_1.default)(mapper);
return (0, doAsyncByKey_1.default)(async (frame, observer) => {
const injectMapper = injectMaybe(mapper);
return doAsyncByKey(async (frame, observer) => {
const { scope, key } = frame;

@@ -16,3 +11,3 @@ const result = await injectMapper(frame)(frame.value);

}
exports.default = map;
export default map;
//# sourceMappingURL=map.js.map
import { ServiceContainer } from '@sociably/core/service';
import { OperatorFunction, StreamingFrame } from '../types';
export declare type MapMetadataFn<T, R> = (frame: StreamingFrame<T>) => Partial<StreamingFrame<R>> | Promise<Partial<StreamingFrame<R>>>;
import { OperatorFunction, StreamingFrame } from '../types.js';
export type MapMetadataFn<T, R> = (frame: StreamingFrame<T>) => Partial<StreamingFrame<R>> | Promise<Partial<StreamingFrame<R>>>;
/** @category Operator */

@@ -5,0 +5,0 @@ declare function mapMetadata<T, R>(mapper: ServiceContainer<MapMetadataFn<T, R>, unknown[]>): OperatorFunction<T, R>;

@@ -1,16 +0,11 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const injectMaybe_1 = __importDefault(require("../injectMaybe"));
const doAsyncByKey_1 = __importDefault(require("./doAsyncByKey"));
import injectMaybe from '../injectMaybe.js';
import doAsyncByKey from './doAsyncByKey.js';
function mapMetadata(mapper) {
const injectMapper = (0, injectMaybe_1.default)(mapper);
return (0, doAsyncByKey_1.default)(async (frame, observer) => {
const injectMapper = injectMaybe(mapper);
return doAsyncByKey(async (frame, observer) => {
const updatingFrame = await injectMapper(frame)(frame);
observer.next(Object.assign(Object.assign({}, frame), updatingFrame));
observer.next({ ...frame, ...updatingFrame });
});
}
exports.default = mapMetadata;
export default mapMetadata;
//# sourceMappingURL=mapMetadata.js.map
import { ServiceContainer } from '@sociably/core/service';
import { OperatorFunction } from '../types';
export declare type EffectFn<T> = (val: T) => unknown | Promise<unknown>;
import { OperatorFunction } from '../types.js';
export type EffectFn<T> = (val: T) => unknown | Promise<unknown>;
/** @category Operator */

@@ -5,0 +5,0 @@ declare function tap<T>(effecter: ServiceContainer<EffectFn<T>, unknown[]>): OperatorFunction<T, T>;

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const injectMaybe_1 = __importDefault(require("../injectMaybe"));
const doAsyncByKey_1 = __importDefault(require("./doAsyncByKey"));
import injectMaybe from '../injectMaybe.js';
import doAsyncByKey from './doAsyncByKey.js';
function tap(effecter) {
const injectEffect = (0, injectMaybe_1.default)(effecter);
return (0, doAsyncByKey_1.default)(async (frame, observer) => {
const injectEffect = injectMaybe(effecter);
return doAsyncByKey(async (frame, observer) => {
try {

@@ -21,3 +16,3 @@ await injectEffect(frame)(frame.value);

}
exports.default = tap;
export default tap;
//# sourceMappingURL=tap.js.map

@@ -1,3 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-enable prettier/prettier */

@@ -15,3 +13,3 @@ function pipe(...fns) {

}
exports.default = pipe;
export default pipe;
//# sourceMappingURL=pipe.js.map
import { MaybeContainer } from '@sociably/core/service';
import { StreamingFrame, OperatorFunction } from './types';
import { StreamingFrame, OperatorFunction } from './types.js';
export default class Stream<T> {

@@ -4,0 +4,0 @@ private _eventSubject;

@@ -1,13 +0,8 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const rxjs_1 = require("rxjs");
const injectMaybe_1 = __importDefault(require("./injectMaybe"));
const pipe_1 = __importDefault(require("./pipe"));
class Stream {
import { Subject as RxSubject } from 'rxjs';
import injectMaybe from './injectMaybe.js';
import pipe from './pipe.js';
export default class Stream {
constructor() {
this._eventSubject = new rxjs_1.Subject();
this._errorSubject = new rxjs_1.Subject();
this._eventSubject = new RxSubject();
this._errorSubject = new RxSubject();
this._errorListeners = [];

@@ -29,3 +24,3 @@ }

pipe(...fns) {
return (0, pipe_1.default)(...fns)(this);
return pipe(...fns)(this);
}

@@ -54,4 +49,4 @@ /**

subscribe(subscriber, errorCatcher) {
const emitEvent = (0, injectMaybe_1.default)(subscriber);
const catchError = errorCatcher ? (0, injectMaybe_1.default)(errorCatcher) : null;
const emitEvent = injectMaybe(subscriber);
const catchError = errorCatcher ? injectMaybe(errorCatcher) : null;
this._eventSubject.subscribe(async (frame) => {

@@ -83,3 +78,3 @@ try {

catch(errorListener) {
this._errorListeners.push((0, injectMaybe_1.default)(errorListener));
this._errorListeners.push(injectMaybe(errorListener));
return this;

@@ -97,3 +92,2 @@ }

}
exports.default = Stream;
//# sourceMappingURL=stream.js.map
import type { SociablyApp } from '@sociably/core';
import { ServiceScope } from '@sociably/core/service';
import Stream from './stream';
export declare type StreamingFrame<T> = {
import Stream from './stream.js';
export type StreamingFrame<T> = {
key: undefined | string;

@@ -9,3 +9,3 @@ scope: ServiceScope;

};
export declare type OperatorFunction<T, R> = (input: Stream<T>) => Stream<R>;
export declare type EventContextOfApp<App extends SociablyApp<any, any>> = App extends SociablyApp<any, infer Context> ? Context : never;
export type OperatorFunction<T, R> = (input: Stream<T>) => Stream<R>;
export type EventContextOfApp<App extends SociablyApp<any, any>> = App extends SociablyApp<any, infer Context> ? Context : never;

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=types.js.map
{
"name": "@sociably/stream",
"version": "0.8.0-alpha.10",
"version": "0.8.0-alpha.28",
"type": "module",
"description": "Reactive programming library for Sociably.js",

@@ -24,7 +25,5 @@ "main": "./lib/index.js",

"lib/*",
"README.md",
"polyfill-exports.js"
"README.md"
],
"scripts": {
"postinstall": "node ./polyfill-exports.js",
"prepack": "make -f ../../package.mk prepack"

@@ -31,0 +30,0 @@ },

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

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