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

concent-utils

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concent-utils - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

2

lib/concent-utils.min.js

@@ -15,2 +15,2 @@ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("concent")):"function"==typeof define&&define.amd?define(["exports","concent"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["concent-utils"]={},e.concent)}(this,(function(e,n){"use strict";

and limitations under the License.
***************************************************************************** */function t(e,n,t,r){return new(t||(t=Promise))((function(o,u){function c(e){try{s(r.next(e))}catch(e){u(e)}}function a(e){try{s(r.throw(e))}catch(e){u(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,a)}s((r=r.apply(e,n||[])).next())}))}function r(e,n){var t,r,o,u,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;c;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){c.label=u[1];break}if(6===u[0]&&c.label<o[1]){c.label=o[1],o=u;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(u);break}o[2]&&c.ops.pop(),c.trys.pop();continue}u=n.call(e,c)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}var o=function(){return{}};e.callTarget=function(e,n){return t(this,void 0,void 0,(function(){var t,o,u,c,a,s;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),Array.isArray(e)?(t=e[0],u=e[1],[4,n.dispatch(t,u)]):[3,2];case 1:return r.sent(),[3,4];case 2:return o=e.fnName,u=e.payload,c=e.renderKey,a=e.delay,[4,n.dispatch(o,u,c,a)];case 3:r.sent(),r.label=4;case 4:return[3,6];case 5:return s=r.sent(),alert(s.message),[3,6];case 6:return[2]}}))}))},e.makeUseModel=function(e){return function(t){var r=t||{};return n.useConcent({module:e,props:r})}},e.makeUseModelWithSetup=function(e){return function(t,r){var u=r||{},c=u.cuDesc,a=u.props,s=u.extra,i=u.passCuDesc,l=a||{},f=void 0===i||i?c:null,p=t||o;return n.useConcent({module:e,setup:p,props:l,extra:s,cuDesc:f})}},e.makeUseModelWithSetupCuf=function(e){return function(t,r){var u=r||{},c=u.cuDesc,a=u.props,s=u.extra,i=u.passCuDesc,l=a||{},f=void 0===i||i?c:null,p=t||o;return n.useConcent({module:e,setup:p,props:l,extra:s,cuDesc:f})}},Object.defineProperty(e,"__esModule",{value:!0})}));
***************************************************************************** */function t(e,n,t,r){return new(t||(t=Promise))((function(o,u){function c(e){try{s(r.next(e))}catch(e){u(e)}}function a(e){try{s(r.throw(e))}catch(e){u(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,a)}s((r=r.apply(e,n||[])).next())}))}function r(e,n){var t,r,o,u,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(u){return function(a){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;c;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return c.label++,{value:u[1],done:!1};case 5:c.label++,r=u[1],u=[0];continue;case 7:u=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){c=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){c.label=u[1];break}if(6===u[0]&&c.label<o[1]){c.label=o[1],o=u;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(u);break}o[2]&&c.ops.pop(),c.trys.pop();continue}u=n.call(e,c)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}var o=function(){return{}};e.callTarget=function(e,n){return t(this,void 0,void 0,(function(){var t,o,u,c,a,s;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,5,,6]),Array.isArray(e)?(t=e[0],u=e[1],[4,n.dispatch(t,u)]):[3,2];case 1:return r.sent(),[3,4];case 2:return o=e.fnName,u=e.payload,c=e.renderKey,a=e.delay,[4,n.dispatch(o,u,c,a)];case 3:r.sent(),r.label=4;case 4:return[3,6];case 5:return s=r.sent(),alert(s.message),[3,6];case 6:return[2]}}))}))},e.makeUseModel=function(e){return function(t){var r=t||{};return n.useConcent({module:e,props:r})}},e.makeUseModelWithSetup=function(e){return function(t,r){var u=r||{},c=u.cuDesc,a=u.props,s=u.extra,i=u.passCuDesc,l=void 0===i||i,f=u.ccClassKey,p=u.tag,d=a||{},y=l?c:null,h=t||o;return n.useConcent({module:e,tag:p,setup:h,props:d,extra:s,cuDesc:y},f)}},e.makeUseModelWithSetupCuf=function(e){return function(t,r){var u=r||{},c=u.cuDesc,a=u.props,s=u.extra,i=u.passCuDesc,l=void 0===i||i,f=u.ccClassKey,p=u.tag,d=a||{},y=l?c:null,h=t||o;return n.useConcent({module:e,tag:p,setup:h,props:d,extra:s,cuDesc:y},f)}},Object.defineProperty(e,"__esModule",{value:!0})}));
/**
* concent 相关的一些公共封装函数
*/
import { IRefCtxM, ModuleDesc, ReducerCallerParams, IReducerFn, IActionCtxBase, ICtxBase, IAnyObj, SettingsType, ComputedValType, ComputedValTypeForFn, MultiComputedFn, MultiComputed, StateType } from 'concent';
import { IRefCtxM, ModuleDesc, ReducerCallerParams, IReducerFn, IActionCtxBase, ICtxBase, IAnyObj, SettingsType, ComputedValType, ComputedValTypeForFn, MultiComputedFn, MultiComputed } from 'concent';
/**

@@ -23,2 +23,8 @@ * 调用目标函数,用于对接 reducer里的 ghost函数

passCuDesc?: boolean;
/**
* 用于辅助定位 ccc.refs 或者 cc.getRefs 具体ref
*/
tag?: string;
ccClassKey?: string;
moduleName?: string;
}

@@ -55,3 +61,6 @@ export interface Opts<CuDesc extends MultiComputed<any>, P extends IAnyObj, Extra extends IAnyObj> extends BaseOpts<P, Extra> {

*/
export declare function makeUseModelWithSetup<RootInfo, ModelDesc extends ModuleDesc>(moduleName: string): <Setup extends SetupParam, CuDesc extends MultiComputed<StateType<ModelDesc['state']>>, P extends IAnyObj, Extra extends IAnyObj>(setup: Setup, opts?: Opts<CuDesc, P, Extra> | undefined) => IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValType<CuDesc>, Extra>;
export declare function makeUseModelWithSetup<RootInfo, ModelDesc extends ModuleDesc>(moduleName: string):
<Setup extends SetupParam, CuDesc extends MultiComputed<IAnyObj>, P extends IAnyObj, Extra extends IAnyObj>
(setup: Setup, opts?: Opts<CuDesc, P, Extra> | undefined)
=> IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValType<CuDesc>, Extra>;
/**

@@ -61,2 +70,5 @@ * 函数型 cuSpec 用此函数来推导类型

*/
export declare function makeUseModelWithSetupCuf<RootInfo, ModelDesc extends ModuleDesc>(moduleName: string): <Setup extends SetupParam, CuDesc extends MultiComputedFn<StateType<ModelDesc['state']>>, P extends IAnyObj, Extra extends IAnyObj>(setup: Setup, opts?: CufOpts<CuDesc, P, Extra> | undefined) => IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValTypeForFn<CuDesc>, Extra>;
export declare function makeUseModelWithSetupCuf<RootInfo, ModelDesc extends ModuleDesc>(moduleName: string):
<Setup extends SetupParam, CuDesc extends MultiComputedFn<IAnyObj>, P extends IAnyObj, Extra extends IAnyObj>
(setup: Setup, opts?: CufOpts<CuDesc, P, Extra> | undefined)
=> IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValTypeForFn<CuDesc>, Extra>;

@@ -95,7 +95,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

return function useModelWithSetup(setup, opts) {
var _a = opts || {}, cuDesc = _a.cuDesc, props = _a.props, extra = _a.extra, _b = _a.passCuDesc, passCuDesc = _b === void 0 ? true : _b;
var _a = opts || {}, cuDesc = _a.cuDesc, props = _a.props, extra = _a.extra, _b = _a.passCuDesc, passCuDesc = _b === void 0 ? true : _b, ccClassKey = _a.ccClassKey, tag = _a.tag;
var targetProps = (props || {});
var targetCuDesc = passCuDesc ? cuDesc : null;
var targetSetup = (setup || noop);
return useConcent({ module: moduleName, setup: targetSetup, props: targetProps, extra: extra, cuDesc: targetCuDesc });
return useConcent({ module: moduleName, tag: tag, setup: targetSetup, props: targetProps, extra: extra, cuDesc: targetCuDesc }, ccClassKey);
};

@@ -119,8 +119,8 @@ }

return function useModelWithSetupCuf(setup, opts) {
var _a = opts || {}, cuDesc = _a.cuDesc, props = _a.props, extra = _a.extra, _b = _a.passCuDesc, passCuDesc = _b === void 0 ? true : _b;
var _a = opts || {}, cuDesc = _a.cuDesc, props = _a.props, extra = _a.extra, _b = _a.passCuDesc, passCuDesc = _b === void 0 ? true : _b, ccClassKey = _a.ccClassKey, tag = _a.tag;
var targetProps = (props || {});
var targetCuDesc = passCuDesc ? cuDesc : null;
var targetSetup = (setup || noop);
return useConcent({ module: moduleName, setup: targetSetup, props: targetProps, extra: extra, cuDesc: targetCuDesc });
return useConcent({ module: moduleName, tag: tag, setup: targetSetup, props: targetProps, extra: extra, cuDesc: targetCuDesc }, ccClassKey);
};
}

@@ -65,3 +65,3 @@ {

},
"version": "1.2.2"
"version": "1.2.3"
}

@@ -51,2 +51,8 @@ /**

passCuDesc?: boolean;
/**
* 用于辅助定位 ccc.refs 或者 cc.getRefs 具体ref
*/
tag?: string;
ccClassKey?: string;
moduleName?: string;
}

@@ -102,3 +108,3 @@

>(setup: Setup, opts?: Opts<CuDesc, P, Extra>) {
const { cuDesc, props, extra, passCuDesc = true } = opts || {};
const { cuDesc, props, extra, passCuDesc = true, ccClassKey, tag } = opts || {};
const targetProps = (props || {}) as P;

@@ -109,3 +115,6 @@ const targetCuDesc = passCuDesc ? cuDesc : null;

type Ctx = IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValType<CuDesc>, Extra>;
return useConcent<P, Ctx>({ module: moduleName, setup: targetSetup, props: targetProps, extra, cuDesc: targetCuDesc });
return useConcent<P, Ctx>(
{ module: moduleName, tag, setup: targetSetup, props: targetProps, extra, cuDesc: targetCuDesc }
, ccClassKey,
);
}

@@ -133,3 +142,3 @@ }

>(setup: Setup, opts?: CufOpts<CuDesc, P, Extra>) {
const { cuDesc, props, extra, passCuDesc = true } = opts || {};
const { cuDesc, props, extra, passCuDesc = true, ccClassKey, tag } = opts || {};
const targetProps = (props || {}) as P;

@@ -140,4 +149,7 @@ const targetCuDesc = passCuDesc ? cuDesc : null;

type Ctx = IRefCtxM<RootInfo, P, ModelDesc, SettingsType<Setup>, ComputedValTypeForFn<CuDesc>, Extra>;
return useConcent<P, Ctx>({ module: moduleName, setup: targetSetup, props: targetProps, extra, cuDesc: targetCuDesc });
return useConcent<P, Ctx>(
{ module: moduleName, tag, setup: targetSetup, props: targetProps, extra, cuDesc: targetCuDesc },
ccClassKey,
);
}
}
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