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

@grlt-hub/app-compose

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grlt-hub/app-compose - npm Package Compare versions

Comparing version 1.0.0-next.0 to 1.0.0-next.1

18

dist/index.d.ts
import * as effector from 'effector';
import { StoreWritable } from 'effector';
import { StoreWritable, StoreValue } from 'effector';

@@ -70,8 +70,20 @@ type NonEmptyTuple<T = unknown> = [T, ...T[]];

type ContainerStatusMap<T extends AnyContainer[]> = {
[K in T[number]['id']]: StoreValue<ContainerStatus>;
};
type ContainerAPIsMap<T extends AnyContainer[]> = {
[K in T[number]['id']]: Awaited<ReturnType<T[number]['start']>>['api'];
};
type UpResult<T extends AnyContainer[]> = {
done: boolean;
hasErrors: boolean;
statuses: ContainerStatusMap<T>;
apis: ContainerAPIsMap<T>;
};
declare const compose: {
up: (containers: AnyContainer[], config?: {
up: <T extends AnyContainer[]>(containers: T, config?: {
debug?: boolean;
}) => Promise<unknown>;
}) => Promise<UpResult<T>>;
};
export { compose, createContainer };

4

dist/index.js

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

import{clearNode as P,combine as f,createEffect as O,launch as v,sample as D}from"effector";import{createStore as T}from"effector";import"effector";var a={idle:"idle",pending:"pending",done:"done",fail:"fail",off:"off"};var m={CONTAINER_ID_EMPTY_STRING:"Container ID cannot be an empty string.",depsIntersection:(e,s)=>`
import{clearNode as b,combine as f,createEffect as T,launch as g,sample as A}from"effector";import{createStore as O}from"effector";import"effector";var a={idle:"idle",pending:"pending",done:"done",fail:"fail",off:"off"};var I={CONTAINER_ID_EMPTY_STRING:"Container ID cannot be an empty string.",depsIntersection:(e,s)=>`
Dependency conflict detected in container '${s}':
The following dependencies are listed as both required and optional: [${e.join(", ")}].
Each dependency should be listed only once, as either required or optional.`},R=e=>{if(e.id==="")throw new Error(m.CONTAINER_ID_EMPTY_STRING)},x=e=>{if(!e.dependsOn||!e.optionalDependsOn)return;let s=new Set(e.dependsOn.map(p=>p.id)),y=new Set(e.optionalDependsOn.map(p=>p.id)),c=s.intersection(y);if(c.size>0)throw new Error(m.depsIntersection(Array.from(c),e.id))},C=e=>(R(e),x(e),e);var g=e=>{let s=C(e),y=T(a.idle);return{...s,$status:y}};var b=(e,s)=>{if(s.has(e))throw new Error(`Duplicate container ID found: ${e}`);s.add(e)},r={off:e=>e===a.off,fail:e=>e===a.fail,pending:e=>e===a.pending,done:e=>e===a.done,idle:e=>e===a.idle},w=async(e,s)=>{let y=new Set;for(let n of e)b(n.id,y);let c=e.reduce((n,o)=>(n[o.id]=o.$status,n),{}),p=f(c,n=>{let o=Object.values(n),i=o.every(u=>/^(done|fail|off)$/.test(u)),l=o.some(r.fail);return{done:i,hasErrors:l,statuses:n}});s!=null&&s.debug&&p.watch(n=>{console.debug(`[${new Date().toISOString()}] app-compose:`,JSON.stringify(n.statuses,null,2))});let A=[p],d={};return await Promise.all(e.map(async n=>{var S,I;let o=f(((S=n.dependsOn)!=null?S:[]).map(t=>t.$status),t=>t.some(r.off)?a.off:t.some(r.fail)?a.fail:t.some(r.pending)?a.pending:t.every(r.done)||t.length===0?a.done:a.idle),i=f(((I=n.optionalDependsOn)!=null?I:[]).map(t=>t.$status),t=>t.some(r.pending)?a.pending:t.some(r.idle)?a.idle:a.done),l=f([o,i],t=>t.every(r.done)),u=O(async()=>n.enable?await n.enable(d,d):!0),E=O(async()=>{d[n.id]=(await n.start(d,d)).api});D({clock:u.doneData,fn:t=>t?a.pending:a.off,target:n.$status}),D({clock:u.failData,fn:()=>a.fail,target:n.$status}),D({clock:n.$status,filter:r.pending,target:E}),D({clock:E.finally,fn:t=>t.status,target:n.$status}),o.watch(t=>{(r.off(t)||r.fail(t))&&v(n.$status,t)}),l.watch(t=>{t&&u()}),A=[...A,o,i,l,u,E]})),new Promise((n,o)=>{p.watch(i=>{i.done===!0&&(d={},A.forEach(l=>P(l,{deep:!0})),i.hasErrors&&o(i),n(i))})})},N={up:w};export{N as compose,g as createContainer};
Each dependency should be listed only once, as either required or optional.`},R=e=>{if(e.id==="")throw new Error(I.CONTAINER_ID_EMPTY_STRING)},x=e=>{if(!e.dependsOn||!e.optionalDependsOn)return;let s=new Set(e.dependsOn.map(p=>p.id)),y=new Set(e.optionalDependsOn.map(p=>p.id)),c=s.intersection(y);if(c.size>0)throw new Error(I.depsIntersection(Array.from(c),e.id))},m=e=>(R(e),x(e),e);var P=e=>{let s=m(e),y=O(a.idle);return{...s,$status:y}};var v=(e,s)=>{if(s.has(e))throw new Error(`Duplicate container ID found: ${e}`);s.add(e)},r={off:e=>e===a.off,fail:e=>e===a.fail,pending:e=>e===a.pending,done:e=>e===a.done,idle:e=>e===a.idle},w=async(e,s)=>{let y=new Set;for(let n of e)v(n.id,y);let c=e.reduce((n,o)=>(n[o.id]=o.$status,n),{}),p=f(c,n=>{let o=Object.values(n),i=o.every(u=>/^(done|fail|off)$/.test(u)),l=o.some(r.fail);return{done:i,hasErrors:l,statuses:n}});s!=null&&s.debug&&p.watch(n=>{console.debug(`[${new Date().toISOString()}] app-compose:`,JSON.stringify(n.statuses,null,2))});let D=[p],d={};return await Promise.all(e.map(async n=>{var S,C;let o=f(((S=n.dependsOn)!=null?S:[]).map(t=>t.$status),t=>t.some(r.off)?a.off:t.some(r.fail)?a.fail:t.some(r.pending)?a.pending:t.every(r.done)||t.length===0?a.done:a.idle),i=f(((C=n.optionalDependsOn)!=null?C:[]).map(t=>t.$status),t=>t.some(r.pending)?a.pending:t.some(r.idle)?a.idle:a.done),l=f([o,i],t=>t.every(r.done)),u=T(async()=>n.enable?await n.enable(d,d):!0),E=T(async()=>{d[n.id]=(await n.start(d,d)).api});A({clock:u.doneData,fn:t=>t?a.pending:a.off,target:n.$status}),A({clock:u.failData,fn:()=>a.fail,target:n.$status}),A({clock:n.$status,filter:r.pending,target:E}),A({clock:E.finally,fn:t=>t.status,target:n.$status}),o.watch(t=>{(r.off(t)||r.fail(t))&&g(n.$status,t)}),l.watch(t=>{t&&u()}),D=[...D,o,i,l,u,E]})),new Promise((n,o)=>{p.watch(i=>{i.done===!0&&(D.forEach(l=>b(l,{deep:!0})),i.hasErrors&&o({...i,apis:d}),n({...i,apis:d}))})})},N={up:w};export{N as compose,P as createContainer};
{
"name": "@grlt-hub/app-compose",
"version": "1.0.0-next.0",
"version": "1.0.0-next.1",
"type": "module",

@@ -5,0 +5,0 @@ "private": false,

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