npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@saoviettest/numquam-doloremque-voluptate-repellat

v1.0.0

Published

<img alt="rocket" src="rocket.svg" width="120" />

Downloads

3

Maintainers

phamvankhai1000phamvankhai1000

Keywords

rdsdependency managerHyBijavascriptcommandreactes-abstracthookformmonorepodropcmdredactkinesisgraphqlstyled-componentspopmotionviewfromthrottleisownwalksameValueZeroURLECMAScript 6throatsyntaxerrorrouteprivateECMAScript 3typescriptYAMLdataViewcode pointsagenttostringtagfunctionsmkdirsfetchjsxECMAScript 2022japaneseartreadablepropertylinewrapuuidemitlastbluebirdrandomes2015iedeepcopyexecutablereduxreducegroupa11ystatelessdependenciesgetteres6clientsyntaxdayjsSymboleast-asian-widthgetPrototypeOfUint8ArraystructuredClonewaithardlinkstypehelpersbreakfast-cloneconcatMapentriesSetregexsortedestreenopeefficientbatchhttpsmodulefast-copySymbol.toStringTagcloudtrailcharactersmkdirvarsspinnerstrimLeftpackage.jsoncommand-lineexpresspersistentiteratorcallboundhelperparentformbannertypeoftapeES2018Object.entriessequenceendpointdefinejsonpathbeanstalklocationposewidthschemeglobalopensassignMicrosofttoSortedcolorsbundlerbyteLengthstreamsduplexiterationtermgetintrinsicfastcopyflatbuffersStreamArray.prototype.flatratedom-testing-libraryECMAScript 7promiseworkspace:*cryptofoldersuperagentsnsregular expressionscommanderCSSdiffeslintconfigrequireimportchromiumqueryES2019ajaxextensionpyyamlgenericsObject.assignstyleguideclass-validatorcallbackes5ES8ArrayBuffercontainsfullwidthnamesfixed-widthzeroendermetadataimmergesturesemojimake256idlefiltertoobjectglacierdirectoryes2018concatthreecheckcloudformationcolumngroupBydeep-cloneregular expressionenvsymbolconsumecss-in-jsredirectobjmatchttyObject.valuesprotocol-bufferswhatwgphoneconcurrencyopenerprunestartersymbolseventEmitterArray.prototype.containswordbreakString.prototype.trimes2017cloudfrontoptimizerStreamsvalidateparsebrowserlistspeedFunction.prototype.namefindcodeslookrmdirvalidationappTypeScriptpipeeveryrfc4122colourjsES2020mrumobileFloat64Arraywarning-0modulesECMAScript 2021ReactiveXWebSocketstext$.extendwebsitetestingtoArrayprotokoreanes-shim APIlockfileawstrimRightprettytspostcss-pluginpositivearraysweaksetObservableseslint-pluginchanneljsdomlaunchdataviewflagsmapreduceString.prototype.matchAllRFC-6455whichwgetObject.fromEntriesbundlingaccessorpropertiesRegExp.prototype.flagsreducerArrayBuffer.prototype.sliceObservablewritegetoptcircularawesomesaucetrimStartRegExp#flagsnodejsargstoolsnodetestECMAScript 2018variablesstringES7sharedelasticachedomroutingajvruntimeopenObject.envreact animationeslintpluginflagtakeES2021safetddglobalsstylearktypebindawaitasynclogsymlinkreadfull-widthIteratorcjkaccessibilityFloat32ArraycolorfigletrmchinesetaploggingflatMappatchquotetimel10nterminaliteratearraybufferArray.prototype.flattenfsformscloudsearchvalidshebangclonewritableroute53valueskey_.extendyamlES2023datastructurelanguagestylingairbnbspecPushES2016JSONjesteslinttypedRxfast-deep-copyprogresssettingscollectionjoiindicatoramazonanimationWeakSetmime-dbpicomatchstartworkflowconfigurableimmutableconvertperformance3desrapidstableform-validationECMAScript 2016matcheswraptc39debuggercall-bindUnderscoredeepcloneenvironmentcall-boundoncestreams2xhrgdprinternalec2Arraypnpm9stylesregulari18nargumentsupES2015typedarraysponyfilljsonelectroniconvchildprefixcloudwatchjQueryPromiseurlsinferencetesterjsdifftoStringTagglobECMAScript 2017Object.keyskeysrobusteventDispatcherbusyargvcharsetsortobjects3pushdeep-copyES5shimincludesfunction.lengthcomparevisualhasOwnspinnernegative zerosqs__proto__execolumnsMapreact-hookszodpath@@toStringTagboundECMAScript 5mergeebsArray.prototype.findLastIndexcreateequalsetPrototypeOfes8callhigher-orderwebrm -rffile systemTypedArrayReactiveExtensionsmovergbfastforEachsimpledbemrparentsuninstalltaskloadbalancingsharedarraybuffertouchnpmnativeassertratelimitfullmomenthashstringifierschemaswfreadablestreamWebSocketcensorinArrayBuffer#sliceArray.prototype.includesdataECMAScript 2020stringifyrequestbyteOffsetoffsetcomputed-typesrecursivemaplistenersminimalfind-upredux-toolkittypeswalkingasciiTypeBoxxtermdateBigInt64ArraycopylintfindLasttelephoneBigUint64ArrayansiespreeStyleSheethas-ownexpressionpropisConcatSpreadableflattenkarmacollection.es6Array.prototype.findLastchaiescapequeueio-tsserializerdefaultdragenumerableexecresolvegetOwnPropertyDescriptores2016utilityinternal slotpluginidrm -frshamimportexportreact-testing-libraryproxyjshintdeepInt16ArrayweakmaploggerperformantObject.definePropertypromisesdescriptionshellformattingframerreuseeditoroptimisthasOwnPropertyformatshrinkwrapworkeravaenvironmentsextratrimEndstoragegatewayinvariantslotdynamodbES2017react posescheme-validationlimitedxdg-openprocessdeleteECMAScript 2023functionlook-upES6consolespawnESsideInt8ArrayautoscalingcompilerastcliReflect.getPrototypeOfreal-timesetterpostcssWeakMapObject.iseventsinputinstallremovesearchinspecthttputil.inspectwordwrapInt32ArraybrowserslistecmascriptpackagespackageinstallerparserurlmimetypessetImmediatelazywaapisuperstructprivate dataES3characterdeterministices7limitpackage managertyped arraytypesafemimequeueMicrotaskstreamserializationprototypeJSON-SchemaelbarrayUint16Arraynumbervpctrimdebugfastifycoremkdirpbddrangeerrordescriptoromitsymlinksapireact-hook-formargparsehooksautoprefixertsliboptionECMAScript 2019extend0URLSearchParamstoolkitxdgutilfilevest

Readme

RxEffects

Reactive state and effect management with RxJS.

npm downloads types licence Coverage Status

Overview

The library provides a way to describe business and application logic using MVC-like architecture. Core elements include actions and effects, states and stores. All of them are optionated and can be used separately. The core package is framework-agnostic and can be used in different cases: libraries, server apps, web, SPA and micro-frontends apps.

The library is inspired by MVC, RxJS, Akita, JetState and Effector.

It is recommended to use RxEffects together with Ditox.js – a dependency injection container.

Features

  • Reactive state and store
  • Declarative actions and effects
  • Effect container
  • Framework-agnostic
  • Functional API
  • Typescript typings

Breaking changes

Version 1.0 contains breaking changes due stabilizing API from the early stage. The previous API is available in 0.7.2 version.

Documentation is coming soon.

Packages

| Package | Description | Links | | --------------------------------------------- | ------------------------------------------ | ---------------------------------------------------------- | | @saoviettest/numquam-doloremque-voluptate-repellat | Core elements, state and effect management | Docs, API | | @saoviettest/numquam-doloremque-voluptate-repellat-react | Tooling for React.js | Docs, API |

Usage

Installation

npm install @saoviettest/numquam-doloremque-voluptate-repellat @saoviettest/numquam-doloremque-voluptate-repellat-react --save

Concepts

The main idea is to use the classic MVC pattern with event-based models (state stores) and reactive controllers (actions and effects). The view subscribes to model changes (state queries) of the controller and requests the controller to do some actions.

Core elements:

  • State – a data model.
  • Query – a getter and subscriber for data of the state.
  • StateMutation – a pure function which changes the state.
  • Store – a state storage, it provides methods to update and subscribe the state.
  • Action – an event emitter.
  • Effect – a business logic which handles the action and makes state changes and side effects.
  • Controller – a controller type for effects and business logic
  • Scope – a controller-like boundary for effects and business logic

Example

Below is an implementation of the pizza shop, which allows order pizza from the menu and to submit the cart. The controller orchestrate the state store and side effects. The component renders the state and reacts on user events.

// pizzaShop.ts

import {
  Controller,
  createAction,
  createScope,
  declareStateUpdates,
  EffectState,
  Query,
  withStoreUpdates,
} from '@saoviettest/numquam-doloremque-voluptate-repellat';
import { delay, filter, map, mapTo, of } from 'rxjs';

// The state
type CartState = Readonly<{ orders: Array<string> }>;

// Declare the initial state.
const CART_STATE: CartState = { orders: [] };

// Declare updates of the state.
const CART_STATE_UPDATES = declareStateUpdates<CartState>({
  addPizzaToCart: (name: string) => (state) => ({
    ...state,
    orders: [...state.orders, name],
  }),

  removePizzaFromCart: (name: string) => (state) => ({
    ...state,
    orders: state.orders.filter((order) => order !== name),
  }),
});

// Declaring the controller.
// It should provide methods for triggering the actions,
// and queries or observables for subscribing to data.
export type PizzaShopController = Controller<{
  ordersQuery: Query<Array<string>>;

  addPizza: (name: string) => void;
  removePizza: (name: string) => void;
  submitCart: () => void;
  submitState: EffectState<Array<string>>;
}>;

export function createPizzaShopController(): PizzaShopController {
  // Creates the scope to track subscriptions
  const scope = createScope();

  // Creates the state store
  const store = withStoreUpdates(
    scope.createStore(CART_STATE),
    CART_STATE_UPDATES,
  );

  // Creates queries for the state data
  const ordersQuery = store.query((state) => state.orders);

  // Introduces actions
  const addPizza = createAction<string>();
  const removePizza = createAction<string>();
  const submitCart = createAction();

  // Handle simple actions
  scope.handle(addPizza, (order) => store.updates.addPizzaToCart(order));

  scope.handle(removePizza, (name) => store.updates.removePizzaFromCart(name));

  // Create a effect in a general way
  const submitEffect = scope.createEffect<Array<string>>((orders) => {
    // Sending an async request to a server
    return of(orders).pipe(delay(1000), mapTo(undefined));
  });

  // Effect can handle `Observable` and `Action`. It allows to filter action events
  // and transform data which is passed to effect's handler.
  submitEffect.handle(
    submitCart.event$.pipe(
      map(() => ordersQuery.get()),
      filter((orders) => !submitEffect.pending.get() && orders.length > 0),
    ),
  );

  // Effect's results can be used as actions
  scope.handle(submitEffect.done$, () => store.set(CART_STATE));

  return {
    ordersQuery,
    addPizza,
    removePizza,
    submitCart,
    submitState: submitEffect,
    destroy: () => scope.destroy(),
  };
}
// pizzaShopComponent.tsx

import React, { FC, useEffect } from 'react';
import { useConst, useObservable, useQuery } from '@saoviettest/numquam-doloremque-voluptate-repellat-react';
import { createPizzaShopController } from './pizzaShop';

export const PizzaShopComponent: FC = () => {
  // Creates the controller and destroy it on unmounting the component
  const controller = useConst(() => createPizzaShopController());
  useEffect(() => controller.destroy, [controller]);

  // The same creation can be achieved by using `useController()` helper:
  // const controller = useController(createPizzaShopController);

  // Using the controller
  const { ordersQuery, addPizza, removePizza, submitCart, submitState } =
    controller;

  // Subscribing to state data and the effect stata
  const orders = useQuery(ordersQuery);
  const isPending = useQuery(submitState.pending);
  const submitError = useObservable(submitState.error$, undefined);

  return (
    <>
      <h1>Pizza Shop</h1>

      <h2>Menu</h2>
      <ul>
        <li>
          Pepperoni
          <button disabled={isPending} onClick={() => addPizza('Pepperoni')}>
            Add
          </button>
        </li>

        <li>
          Margherita
          <button disabled={isPending} onClick={() => addPizza('Margherita')}>
            Add
          </button>
        </li>
      </ul>

      <h2>Cart</h2>
      <ul>
        {orders.map((name) => (
          <li>
            {name}
            <button disabled={isPending} onClick={() => removePizza(name)}>
              Remove
            </button>
          </li>
        ))}
      </ul>

      <button disabled={isPending || orders.length === 0} onClick={submitCart}>
        Submit
      </button>

      {submitError && <div>Failed to submit the cart</div>}
    </>
  );
};

© 2021 Mikhail Nasyrov, MIT license