@rematch/select
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,2 @@ | ||
import { ExtractRematchSelectorsFromModels, Models, Plugin } from '../../../typings/rematch'; | ||
import { ExtractRematchSelectorsFromModels, Models, Plugin } from '@rematch/core'; | ||
export declare const select: {}; | ||
@@ -7,7 +7,3 @@ export declare function getSelect<M extends Models = Models>(): ExtractRematchSelectorsFromModels<M, any>; | ||
} | ||
declare const selectPlugin: ({ sliceState, }?: SelectConfig) => Plugin<Models, { | ||
type: string; | ||
payload?: any; | ||
meta?: any; | ||
}>; | ||
declare const selectPlugin: ({ sliceState, }?: SelectConfig) => Plugin<Models, import("../node_modules/@rematch/core/src/typings").Action<any, any>>; | ||
export default selectPlugin; |
@@ -1,2 +0,47 @@ | ||
"use strict";function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}Object.defineProperty(exports,"__esModule",{value:!0});var lib=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={},t.getSelect=function(){return t.select};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(l){n.validate([["function"!=typeof e.selectors[l],"Selector ("+e.name+"/"+l+") must be a function"]]),t.select[e.name][l]=function(t){for(var n,c=[],r=1;arguments.length>r;r++)c[r-1]=arguments[r];return(n=e.selectors)[l].apply(n,[o(t,e)].concat(c))}})}}}}),index=unwrapExports(lib),lib_1=lib.select,lib_2=lib.getSelect;exports.default=index,exports.select=lib_1,exports.getSelect=lib_2; | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var select = {}; | ||
function getSelect() { | ||
return select; | ||
} | ||
var selectPlugin = function (_a) { | ||
var _b = (_a === void 0 ? {} : _a).sliceState, sliceState = _b === void 0 ? function (rootState, model) { return rootState[model.name]; } : _b; | ||
return ({ | ||
exposed: { select: select }, | ||
onInit: function () { | ||
this.validate([ | ||
[ | ||
typeof sliceState !== 'function', | ||
"The selectPlugin's getState config must be a function. Instead got type " + typeof sliceState + ".", | ||
], | ||
]); | ||
}, | ||
onModel: function (model) { | ||
var _this = this; | ||
select[model.name] = {}; | ||
Object.keys(model.selectors || {}).forEach(function (selectorName) { | ||
_this.validate([ | ||
[ | ||
typeof model.selectors[selectorName] !== 'function', | ||
"Selector (" + model.name + "/" + selectorName + ") must be a function", | ||
], | ||
]); | ||
select[model.name][selectorName] = function (state) { | ||
var _a; | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
return (_a = model.selectors)[selectorName].apply(_a, [sliceState(state, model)].concat(args)); | ||
}; | ||
}); | ||
}, | ||
}); | ||
}; | ||
exports.select = select; | ||
exports.getSelect = getSelect; | ||
exports.default = selectPlugin; | ||
//# sourceMappingURL=rematch-select.cjs.js.map |
@@ -1,2 +0,42 @@ | ||
function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var lib=createCommonjsModule(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={},t.getSelect=function(){return t.select};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(l){n.validate([["function"!=typeof e.selectors[l],"Selector ("+e.name+"/"+l+") must be a function"]]),t.select[e.name][l]=function(t){for(var n,c=[],r=1;arguments.length>r;r++)c[r-1]=arguments[r];return(n=e.selectors)[l].apply(n,[o(t,e)].concat(c))}})}}}}),index=unwrapExports(lib),lib_1=lib.select,lib_2=lib.getSelect;export default index;export{lib_1 as select,lib_2 as getSelect}; | ||
var select = {}; | ||
function getSelect() { | ||
return select; | ||
} | ||
var selectPlugin = function (_a) { | ||
var _b = (_a === void 0 ? {} : _a).sliceState, sliceState = _b === void 0 ? function (rootState, model) { return rootState[model.name]; } : _b; | ||
return ({ | ||
exposed: { select: select }, | ||
onInit: function () { | ||
this.validate([ | ||
[ | ||
typeof sliceState !== 'function', | ||
"The selectPlugin's getState config must be a function. Instead got type " + typeof sliceState + ".", | ||
], | ||
]); | ||
}, | ||
onModel: function (model) { | ||
var _this = this; | ||
select[model.name] = {}; | ||
Object.keys(model.selectors || {}).forEach(function (selectorName) { | ||
_this.validate([ | ||
[ | ||
typeof model.selectors[selectorName] !== 'function', | ||
"Selector (" + model.name + "/" + selectorName + ") must be a function", | ||
], | ||
]); | ||
select[model.name][selectorName] = function (state) { | ||
var _a; | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
return (_a = model.selectors)[selectorName].apply(_a, [sliceState(state, model)].concat(args)); | ||
}; | ||
}); | ||
}, | ||
}); | ||
}; | ||
export default selectPlugin; | ||
export { select, getSelect }; | ||
//# sourceMappingURL=rematch-select.esm.js.map |
@@ -1,2 +0,53 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RematchSelect={})}(this,function(e){"use strict";var t,n,o=(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.select={},t.getSelect=function(){return t.select};t.default=function(e){var n=(void 0===e?{}:e).sliceState,o=void 0===n?function(e,t){return e[t.name]}:n;return{exposed:{select:t.select},onInit:function(){this.validate([["function"!=typeof o,"The selectPlugin's getState config must be a function. Instead got type "+typeof o+"."]])},onModel:function(e){var n=this;t.select[e.name]={},Object.keys(e.selectors||{}).forEach(function(c){n.validate([["function"!=typeof e.selectors[c],"Selector ("+e.name+"/"+c+") must be a function"]]),t.select[e.name][c]=function(t){for(var n,s=[],l=1;arguments.length>l;l++)s[l-1]=arguments[l];return(n=e.selectors)[c].apply(n,[o(t,e)].concat(s))}})}}}}(t={exports:{}},t.exports),t.exports),c=(n=o)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,s=o.select,l=o.getSelect;e.default=c,e.select=s,e.getSelect=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.RematchSelect = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
var select = {}; | ||
function getSelect() { | ||
return select; | ||
} | ||
var selectPlugin = function (_a) { | ||
var _b = (_a === void 0 ? {} : _a).sliceState, sliceState = _b === void 0 ? function (rootState, model) { return rootState[model.name]; } : _b; | ||
return ({ | ||
exposed: { select: select }, | ||
onInit: function () { | ||
this.validate([ | ||
[ | ||
typeof sliceState !== 'function', | ||
"The selectPlugin's getState config must be a function. Instead got type " + typeof sliceState + ".", | ||
], | ||
]); | ||
}, | ||
onModel: function (model) { | ||
var _this = this; | ||
select[model.name] = {}; | ||
Object.keys(model.selectors || {}).forEach(function (selectorName) { | ||
_this.validate([ | ||
[ | ||
typeof model.selectors[selectorName] !== 'function', | ||
"Selector (" + model.name + "/" + selectorName + ") must be a function", | ||
], | ||
]); | ||
select[model.name][selectorName] = function (state) { | ||
var _a; | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
return (_a = model.selectors)[selectorName].apply(_a, [sliceState(state, model)].concat(args)); | ||
}; | ||
}); | ||
}, | ||
}); | ||
}; | ||
exports.select = select; | ||
exports.getSelect = getSelect; | ||
exports.default = selectPlugin; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=rematch-select.umd.js.map |
@@ -1,13 +0,9 @@ | ||
import index from './dist'; | ||
import { ExtractRematchSelectorsFromModels, Models } from '../../typings/rematch/index' | ||
import { Action, ExtractRematchSelectorsFromModels, Models, Plugin } from '@rematch/core' | ||
// @ts-ignore | ||
export const select = {} | ||
// @ts-ignore | ||
export function getSelect<M extends Models = Models>() { | ||
return select as ExtractRematchSelectorsFromModels<M> | ||
export declare const select: {} | ||
export declare function getSelect<M extends Models = Models>(): ExtractRematchSelectorsFromModels<M, any> | ||
export interface SelectConfig { | ||
sliceState?: any | ||
} | ||
export * from './dist'; | ||
export default index; | ||
declare const selectPlugin: ({ sliceState, }?: SelectConfig) => Plugin<Models, Action<any, any>> | ||
export default selectPlugin |
{ | ||
"name": "@rematch/select", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Selectors plugin for Rematch", | ||
@@ -13,9 +13,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/rematch/rematch/issues" | ||
"url": "git+https://github.com/rematch/rematch/issues" | ||
}, | ||
"license": "ISC", | ||
"authors": [ | ||
"Blair Bodnar <blairbodnar@gmail.com> (https://github.com/blairbodnar)", | ||
"Tom Aranda <tga@arandacybersolutions.com> (https://github.com/taranda)" | ||
], | ||
"files": [ | ||
@@ -27,6 +23,3 @@ "dist", | ||
"module": "dist/rematch-select.esm.js", | ||
"browser": "dist/rematch-select.umd.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -37,16 +30,25 @@ "type": "git", | ||
"scripts": { | ||
"build": "rimraf build dist && tsc && NODE_ENV=production rollup -c" | ||
"build": "NODE_ENV=production npm run clean && rollup -c", | ||
"clean": "npm run clean:dist & npm run clean:build", | ||
"clean:build": "npx rimraf build", | ||
"clean:dist": "npx rimraf dist" | ||
}, | ||
"browser": "dist/rematch-select.umd.js", | ||
"devDependencies": { | ||
"@rematch/core": "^1.0.0-alpha.3", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.56.5", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"@rematch/core": "^1.0.0-alpha.8", | ||
"rollup": "^0.60.1", | ||
"rollup-plugin-commonjs": "^9.1.3", | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup-plugin-typescript2": "^0.14.0", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"typescript": "^2.9.1", | ||
"uglify-es": "^3.3.9" | ||
}, | ||
"peerDependencies": { | ||
"@rematch/core": ">=1.0.0-alpha.0" | ||
} | ||
"@rematch/core": ">=1.0.0-alpha.8" | ||
}, | ||
"authors": [ | ||
"Blair Bodnar <blairbodnar@gmail.com> (https://github.com/blairbodnar)", | ||
"Tom Aranda <tga@arandacybersolutions.com> (https://github.com/taranda)" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17398
150
8
1