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

direct-vuex

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

direct-vuex - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

3

.vscode/settings.json
{
"[markdown]": {
"editor.tabSize": 2,
},
"editor.codeActionsOnSave": {

@@ -6,0 +3,0 @@ "source.fixAll": true

14

dist/direct-vuex.js

@@ -6,3 +6,3 @@ "use strict";

const original = new vuex_1.default.Store(options);
const direct = {
const store = {
get state() {

@@ -14,8 +14,10 @@ return original.state;

dispatch: dispatchFromOptions({}, options, original.dispatch),
original,
original
};
direct.directActionContext = actionContextProvider(direct);
direct.directRootActionContext = rootActionContextProvider(direct);
original.direct = direct;
return direct;
original.direct = store;
return {
store,
directActionContext: actionContextProvider(store),
directRootActionContext: rootActionContextProvider(store)
};
}

@@ -22,0 +24,0 @@ exports.createDirectStore = createDirectStore;

{
"name": "direct-vuex",
"version": "0.4.0",
"version": "0.5.0",
"description": "Just Vuex with typing. Compatible with the Vue 3 composition API.",

@@ -5,0 +5,0 @@ "author": "Paleo",

@@ -11,3 +11,5 @@ # direct-vuex

npm install direct-vuex
```
npm install direct-vuex
```

@@ -27,3 +29,3 @@ ### Create the store

const store = createDirectStore({
const { store, directActionContext, directRootActionContext } = createDirectStore({
// … store implementation here …

@@ -40,2 +42,4 @@ } as const)

}
export { directActionContext, directRootActionContext }
```

@@ -94,9 +98,2 @@

In the file where the store is created, add these lines:
```ts
export const directActionContext = store.directActionContext
export const directRootActionContext = store.directRootActionContext
```
Here is an example on how to do in a module:

@@ -103,0 +100,0 @@

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

import Vuex, { ActionContext, Commit, Dispatch, Store } from "vuex"
import Vuex, { ActionContext, Store } from "vuex"
import { ActionsImpl, GettersImpl, MutationsImpl, StoreOptions, StoreOrModuleOptions } from "../types"
import { DirectActionContext, ToDirectStore, VuexStore } from "../types/direct-types"
import { CreatedStore, ToDirectStore, VuexStore } from "../types/direct-types"
export function createDirectStore<O extends StoreOptions>(options: O): ToDirectStore<O> {
export function createDirectStore<O extends StoreOptions>(options: O): CreatedStore<O> {
const original = new Vuex.Store(options) as VuexStore<O>
const direct = {
const store: ToDirectStore<O> = {
get state() {

@@ -15,10 +15,12 @@ return original.state

dispatch: dispatchFromOptions({}, options, original.dispatch),
original,
} as ToDirectStore<O>
original
}
direct.directActionContext = actionContextProvider(direct)
direct.directRootActionContext = rootActionContextProvider(direct)
original.direct = store
original.direct = direct
return direct
return {
store,
directActionContext: actionContextProvider(store),
directRootActionContext: rootActionContextProvider(store)
}
}

@@ -25,0 +27,0 @@

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

import { Store, ActionContext } from "vuex"
import { ActionContext, Store } from "vuex"
import { ActionsImpl, GettersImpl, ModulesImpl, MutationsImpl, StoreOptions, StoreOrModuleOptions } from "./index"
export interface CreatedStore<O> {
store: ToDirectStore<O>
directActionContext: <P extends StoreOrModuleOptions>(
context: ActionContext<any, any>, options: P
) => DirectActionContext<O, P>
directRootActionContext: (context: ActionContext<any, any>) => DirectActionContext<O, O>
}
export type ToDirectStore<O extends StoreOptions> = {

@@ -10,7 +19,2 @@ readonly state: ToFlatType<DirectState<O>>

original: VuexStore<O>
directActionContext: <P extends StoreOrModuleOptions>(
context: ActionContext<any, any>, options: P
) => DirectActionContext<O, P>
directRootActionContext: (context: ActionContext<any, any>) => DirectActionContext<O, O>
}

@@ -17,0 +21,0 @@

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

import { ToDirectStore } from "./direct-types"
import { CreatedStore } from "./direct-types"
export function createDirectStore<O extends StoreOptions>(options: O): ToDirectStore<O>
export function createDirectStore<O extends StoreOptions>(options: O): CreatedStore<O>

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

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