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

@sensenet/redux

v5.7.4

Published

A set of redux actions, reducers and redux-ovbservable epics for sensenet

Downloads

58

Readme

@sensenet/redux

sn-redux is a convention driven way of building sensenet applications using Redux. It contains all the action types, actions and reducers for built-in sensenet Actions and Functions.

NPM version NPM downloads License: GPL v2

Install

# Yarn
yarn add @sensenet/redux

# NPM
npm install @sensenet/redux

sn-redux gives you a standard set of:

  • action types: e.g. CREATE_CONTENT_SUCCESS
  • actions: e.g. updateContentSuccess, updateContentFailure
  • reducers: for the action types above e.g. updateContentSuccess

Tested with the following sensenet Services version:

sensenet Services

Installation into an external app with node and npm

Create your sensenet portal Repository to use. You can configure your Store to use this repository, when calling Store.ConfigureStore

import { Repository } from '@sensenet/client-core'
import { Reducers, Store } from '@sensenet/redux'
import { combineReducers } from 'redux'

const sensenet = Reducers.sensenet

const myReducer = combineReducers({
  sensenet,
})

const repository = new Repository({
  repositoryUrl: 'http://path-to-your-portal.com',
})

const options: Store.CreateStoreOptions = {
  repository,
  rootReducer: myReducer,
}

const store = Store.createSensenetStore(options)

To enable your external app to send request against your sensenet portal change your Portal.settings. For further information about cross-origin resource sharing in sensenet check [this]https://docs.sensenet.com/guides/setup#portal.settings) article.

Check your sensenet portal's web.config and if the ODataServiceToken is set, you can pass to your Repository as a config value on client side.

const repository = new Repository.SnRepository({
  RepositoryUrl: 'http://path-to-your-portal.com',
  ODataToken: 'MyODataServiceToken',
})

Import

import { Actions } from '@sensenet/redux'
import { Task } from '@sensenet/default-content-types'

...
const content: Task = { Id: 123 }
...
store.dispatch(Actions.DeleteContent(content.Id, false))

Examples

Combine custom reducer with the built-in ones

import { combineReducers } from 'redux'
import { Reducers } from '@sensenet/redux'

const sensenet = Reducers.sensenet
const myReducer = combineReducers({
  sensenet,
  listByFilter,
})

Creating a store

import { Store } from '@sensenet/redux'
import { Repository } from '@sensenet/client-core'

const repository = new Repository({
  repositoryUrl: 'http://path-to-your-portal.com',
})

const options = {
  repository,
  rootReducer: myReducer,
} as Store.CreateStoreOptions

const store = Store.createSensenetStore(options)

Using built-in actions

import { Repository } from '@sensenet/client-core'
import { Task } from '@sensenet/default-content-type'
import { Actions } from '@sensenet/redux'

const repository = new Repository({
  repositoryUrl: 'http://path-to-your-portal.com',
})

const parentPath = '/workspaces/Project/budapestprojectworkspace/tasks';
const content: Task = {
          Id: 123,
          DisplayName: 'My first task'
      })

dispatch(Actions.CreateContent(parentPath, content, 'Task'))

Documentation

Influences

Example applications