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

@proscom/prostore

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@proscom/prostore - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

9

lib/RequestStore.d.ts

@@ -19,5 +19,11 @@ import { IStore } from './IStore';

export declare type ISkipQueryFn<Vars, Data> = (vars: Vars) => Data | null | undefined;
export declare type IUpdateDataFn<Vars, Data> = (data: Data, oldData: Data, params: {
store: any;
variables: Vars;
options: any;
}) => Data;
export interface IRequestStoreParams<Vars, Data> {
initialData?: Data;
skipQuery?: ISkipQueryFn<Vars, Data>;
updateData?: IUpdateDataFn<Vars, Data>;
ssrId?: string;

@@ -40,4 +46,5 @@ }

protected skipQuery: ISkipQueryFn<Vars, Data>;
protected updateData: IUpdateDataFn<Vars, Data>;
protected loadedValueFromContext: boolean;
constructor({ initialData, skipQuery, ssrId }: IRequestStoreParams<Vars, Data>);
constructor({ initialData, skipQuery, ssrId, updateData }: IRequestStoreParams<Vars, Data>);
state: IRequestState<Vars, Data>;

@@ -44,0 +51,0 @@ createState(): Observable<IRequestState<Vars, Data>>;

5

lib/RequestStore.js

@@ -21,7 +21,7 @@ "use strict";

class RequestStore {
constructor({ initialData = null, skipQuery = (x) => undefined, ssrId = null }) {
constructor({ initialData = null, skipQuery = (x) => undefined, ssrId = null, updateData = (data) => data }) {
this.variables$ = new rxjs_1.Subject();
this.loadedValueFromContext = false;
this.mapRequestResult = (variables, options) => (data) => ({
data,
data: this.updateData(data, this.state.data, { store: this, variables, options }),
loading: false,

@@ -40,2 +40,3 @@ loaded: true,

this.skipQuery = skipQuery;
this.updateData = updateData;
this.state$ = this.createState();

@@ -42,0 +43,0 @@ }

{
"name": "@proscom/prostore",
"version": "0.0.5",
"version": "0.0.6",
"description": "> TODO: description",

@@ -27,3 +27,3 @@ "author": "Andrew Starostin <a.starostin@proscom.ru>",

},
"gitHead": "77a672e5ae9c126e5d7d679f2d03fd54a4cb2d9a"
"gitHead": "05b84a2076076ef6bc3da5b4028cb96625a964a2"
}

@@ -24,6 +24,9 @@ import {IStore} from './IStore';

export type IUpdateDataFn<Vars, Data> = (data: Data, oldData: Data, params: {store: any, variables: Vars, options: any}) => Data;
export interface IRequestStoreParams<Vars, Data> {
initialData?: Data;
skipQuery?: ISkipQueryFn<Vars, Data>;
ssrId?: string
updateData?: IUpdateDataFn<Vars, Data>;
ssrId?: string;
}

@@ -50,2 +53,3 @@

protected skipQuery: ISkipQueryFn<Vars, Data>;
protected updateData: IUpdateDataFn<Vars, Data>;
protected loadedValueFromContext: boolean = false;

@@ -56,3 +60,4 @@

skipQuery = (x) => undefined,
ssrId = null
ssrId = null,
updateData = (data) => data
}: IRequestStoreParams<Vars, Data>) {

@@ -66,2 +71,3 @@ this.initialState = {

this.skipQuery = skipQuery;
this.updateData = updateData;
this.state$ = this.createState();

@@ -117,3 +123,3 @@ }

mapRequestResult = (variables: Vars, options: Options) => (data: Data): IRequestState<Vars, Data> => ({
data,
data: this.updateData(data, this.state.data, { store: this, variables, options }),
loading: false,

@@ -120,0 +126,0 @@ loaded: true,

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