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

mobx-state-tree

Package Overview
Dependencies
Maintainers
3
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-state-tree - npm Package Compare versions

Comparing version 3.12.2 to 3.13.0

dist/middlewares/createActionTrackingMiddleware2.d.ts

27

dist/core/action.d.ts
import { IDisposer, IAnyStateTreeNode } from "../internal";
export declare type IMiddlewareEventType = "action" | "flow_spawn" | "flow_resume" | "flow_resume_error" | "flow_return" | "flow_throw";
export declare type IMiddlewareEvent = {
type: IMiddlewareEventType;
name: string;
id: number;
parentId: number;
rootId: number;
allParentIds: number[];
context: IAnyStateTreeNode;
tree: IAnyStateTreeNode;
args: any[];
};
export interface IMiddlewareEvent {
readonly type: IMiddlewareEventType;
readonly name: string;
readonly id: number;
readonly parentId: number;
readonly rootId: number;
readonly allParentIds: number[];
readonly context: IAnyStateTreeNode;
readonly tree: IAnyStateTreeNode;
readonly args: any[];
readonly parentEvent: IMiddlewareEvent | undefined;
readonly parentActionEvent: IMiddlewareEvent | undefined;
}
export declare type IMiddlewareHandler = (actionCall: IMiddlewareEvent, next: (actionCall: IMiddlewareEvent, callback?: (value: any) => any) => void, abort: (value: any) => void) => any;

@@ -46,4 +48,5 @@ /**

* @param fn
* @param includeHooks
* @returns The original function
*/
export declare function decorate<T extends Function>(handler: IMiddlewareHandler, fn: T): T;
export declare function decorate<T extends Function>(handler: IMiddlewareHandler, fn: T, includeHooks?: boolean): T;

@@ -0,0 +0,0 @@ /** @hidden */

@@ -6,8 +6,8 @@ /**

export interface IJsonPatch {
op: "replace" | "add" | "remove";
path: string;
value?: any;
readonly op: "replace" | "add" | "remove";
readonly path: string;
readonly value?: any;
}
export interface IReversibleJsonPatch extends IJsonPatch {
oldValue: any;
readonly oldValue: any;
}

@@ -14,0 +14,0 @@ /**

@@ -62,2 +62,4 @@ import { IAnyStateTreeNode, IType, IAnyModelType, IStateTreeNode, IJsonPatch, IDisposer, IAnyType, ReferenceIdentifier, ExtractC, TypeOfValue, ExtractTWithSTN, ExtractS } from "../internal";

inversePatches: ReadonlyArray<IJsonPatch>;
reversedInversePatches: ReadonlyArray<IJsonPatch>;
readonly recording: boolean;
stop(): void;

@@ -79,2 +81,4 @@ resume(): void;

* inversePatches: IJsonPatch[]
* // true if currently recording
* recording: boolean
* // stop recording patches

@@ -92,6 +96,9 @@ * stop(): void

*
* The optional filter function allows to skip recording certain patches.
*
* @param subject
* @param filter
* @returns
*/
export declare function recordPatches(subject: IAnyStateTreeNode): IPatchRecorder;
export declare function recordPatches(subject: IAnyStateTreeNode, filter?: (patch: IJsonPatch, inversePatch: IJsonPatch) => boolean): IPatchRecorder;
/**

@@ -98,0 +105,0 @@ * The inverse of `unprotect`.

@@ -0,0 +0,0 @@ import { IAnyType } from "../../internal";

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

@@ -0,0 +0,0 @@ import { IAnyType, ExtractCSTWithSTN } from "../../internal";

@@ -42,3 +42,3 @@ import { IValidationContext, IValidationResult, IStateTreeNode, ModelPrimitive } from "../../internal";

*/
export declare type STNValue<T, IT extends IAnyType> = T extends object ? T & IStateTreeNode<IT> : T;
export declare type STNValue<T, IT extends IAnyType> = Extract<T, object> extends never ? T : (Extract<T, object> & IStateTreeNode<IT>) | Exclude<T, object>;
/**

@@ -127,3 +127,3 @@ * A type, either complex or simple.

/** @hidden */
export declare type ExtractTWithSTN<T extends IAnyType> = T extends IType<any, any, infer X> ? X extends object ? X & IStateTreeNode<T> : X : never;
export declare type ExtractTWithSTN<T extends IAnyType> = InstanceWithDefault<T, never>;
/** @hidden */

@@ -133,6 +133,7 @@ export declare type ExtractCSTWithoutSTN<IT extends IAnyType> = IT extends IType<infer C, infer S, infer T> ? C | S | T : never;

export declare type ExtractCSTWithSTN<IT extends IAnyType> = IT extends IType<infer C, infer S, infer T> ? C | S | ExtractTWithSTN<IT> : never;
declare type InstanceWithDefault<T, DEFAULT> = T extends IType<any, any, infer TT> ? STNValue<TT, T> : DEFAULT;
/**
* The instance representation of a given type.
*/
export declare type Instance<T> = T extends IType<any, any, infer TT> ? (TT extends object ? TT & IStateTreeNode<T> : TT) : T;
export declare type Instance<T> = InstanceWithDefault<T, T>;
/**

@@ -139,0 +140,0 @@ * The input (creation) snapshot representation of a given type.

@@ -1,3 +0,3 @@

export { IModelType, IAnyModelType, IDisposer, IMSTMap, IMapType, IMSTArray, IArrayType, IType, IAnyType, ISimpleType, IComplexType, IAnyComplexType, IReferenceType, _CustomCSProcessor, _CustomOrOther, _CustomJoin, _NotCustomized, typecheck, escapeJsonPath, unescapeJsonPath, joinJsonPath, splitJsonPath, IJsonPatch, IReversibleJsonPatch, decorate, addMiddleware, IMiddlewareEvent, IMiddlewareHandler, IMiddlewareEventType, process, isStateTreeNode, IStateTreeNode, IAnyStateTreeNode, flow, castFlowReturn, applyAction, onAction, IActionRecorder, ISerializedActionCall, recordActions, createActionTrackingMiddleware, setLivelinessChecking, getLivelinessChecking, LivelinessMode, setLivelynessChecking, // to be deprecated
export { IModelType, IAnyModelType, IDisposer, IMSTMap, IMapType, IMSTArray, IArrayType, IType, IAnyType, ISimpleType, IComplexType, IAnyComplexType, IReferenceType, _CustomCSProcessor, _CustomOrOther, _CustomJoin, _NotCustomized, typecheck, escapeJsonPath, unescapeJsonPath, joinJsonPath, splitJsonPath, IJsonPatch, IReversibleJsonPatch, decorate, addMiddleware, IMiddlewareEvent, IActionTrackingMiddleware2Call, IMiddlewareHandler, IMiddlewareEventType, IActionTrackingMiddlewareHooks, IActionTrackingMiddleware2Hooks, process, isStateTreeNode, IStateTreeNode, IAnyStateTreeNode, flow, castFlowReturn, applyAction, onAction, IActionRecorder, ISerializedActionCall, recordActions, createActionTrackingMiddleware, createActionTrackingMiddleware2, setLivelinessChecking, getLivelinessChecking, LivelinessMode, setLivelynessChecking, // to be deprecated
LivelynessMode, // to be deprecated
ModelSnapshotType, ModelCreationType, ModelSnapshotType2, ModelCreationType2, ModelInstanceType, ModelInstanceTypeProps, ModelPropertiesDeclarationToProperties, ModelProperties, ModelPropertiesDeclaration, ModelActions, ITypeUnion, CustomTypeOptions, UnionOptions, Instance, SnapshotIn, SnapshotOut, SnapshotOrInstance, TypeOrStateTreeNodeToStateTreeNode, UnionStringArray, getType, getChildType, onPatch, onSnapshot, applyPatch, IPatchRecorder, recordPatches, protect, unprotect, isProtected, applySnapshot, getSnapshot, hasParent, getParent, hasParentOfType, getParentOfType, getRoot, getPath, getPathParts, isRoot, resolvePath, resolveIdentifier, getIdentifier, tryResolve, getRelativePath, clone, detach, destroy, isAlive, addDisposer, getEnv, walk, IModelReflectionData, IModelReflectionPropertiesData, IMaybeIType, IMaybe, IMaybeNull, IOptionalIType, OptionalDefaultValueOrFunction, ValidOptionalValue, ValidOptionalValues, getMembers, getPropertyMembers, TypeOfValue, cast, castToSnapshot, castToReferenceSnapshot, isType, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, IsOptionalType, isPrimitiveType, isReferenceType, isRefinementType, isUnionType, tryReference, isValidReference, OnReferenceInvalidated, OnReferenceInvalidatedEvent, ReferenceOptions, ReferenceOptionsGetSet, ReferenceOptionsOnInvalidated, ReferenceIdentifier, ISnapshotProcessor, ISnapshotProcessors, getNodeId, types } from "./internal";

@@ -9,2 +9,3 @@ export * from "./core/node/livelinessChecking";

export * from "./middlewares/create-action-tracking-middleware";
export * from "./middlewares/createActionTrackingMiddleware2";
export * from "./middlewares/on-action";

@@ -11,0 +12,0 @@ export * from "./core/action";

@@ -11,2 +11,4 @@ import { IMiddlewareEvent, IMiddlewareHandler } from "../internal";

/**
* Note: Consider migrating to `createActionTrackingMiddleware2`, it is easier to use.
*
* Convenience utility to create action based middleware that supports async processes more easily.

@@ -13,0 +15,0 @@ * All hooks are called for both synchronous and asynchronous actions. Except that either `onSuccess` or `onFail` is called

@@ -0,0 +0,0 @@ import { IDisposer, IAnyStateTreeNode } from "../internal";

@@ -0,0 +0,0 @@ import { IObservableArray } from "mobx";

@@ -0,0 +0,0 @@ import { IInterceptor, IKeyValueMap, IMapDidChange, IMapWillChange, Lambda } from "mobx";

@@ -18,8 +18,5 @@ import { IAnyType, IType, ExtractC, ExtractS, _CustomOrOther, _NotCustomized, IsOptionalType, ExtractTWithSTN, Instance } from "../../internal";

export declare type ModelPropertiesDeclarationToProperties<T extends ModelPropertiesDeclaration> = {
[K in keyof T]: T[K] extends string ? IType<string | undefined, string, string> : T[K] extends number ? IType<number | undefined, number, number> : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> : T[K] extends Date ? IType<number | Date | undefined, number, Date> : T[K] extends IType<infer _TC, infer _TS, infer _TT> ? T[K] : never;
[K in keyof T]: T[K] extends string ? IType<string | undefined, string, string> : T[K] extends number ? IType<number | undefined, number, number> : T[K] extends boolean ? IType<boolean | undefined, boolean, boolean> : T[K] extends Date ? IType<number | Date | undefined, number, Date> : T[K] extends IAnyType ? T[K] : never;
};
/**
* Maps property types to the snapshot, including omitted optional attributes
* @hidden
*/
/** @hidden */
export declare type RequiredPropNames<P extends ModelProperties> = {

@@ -29,8 +26,4 @@ [K in keyof P]: IsOptionalType<P[K]> extends true ? never : K;

/** @hidden */
export declare type RequiredProps<P extends ModelProperties> = Pick<P, RequiredPropNames<P>>;
export declare type RequiredPropsObject<P extends ModelProperties> = Pick<P, RequiredPropNames<P>>;
/** @hidden */
export declare type RequiredPropsObject<P extends ModelProperties> = {
[K in keyof RequiredProps<P>]: P[K];
};
/** @hidden */
export declare type OptionalPropNames<P extends ModelProperties> = {

@@ -40,8 +33,4 @@ [K in keyof P]: IsOptionalType<P[K]> extends true ? K : never;

/** @hidden */
export declare type OptionalProps<P extends ModelProperties> = Pick<P, OptionalPropNames<P>>;
export declare type OptionalPropsObject<P extends ModelProperties> = Partial<Pick<P, OptionalPropNames<P>>>;
/** @hidden */
export declare type OptionalPropsObject<P extends ModelProperties> = {
[K in keyof OptionalProps<P>]?: P[K];
};
/** @hidden */
export declare type ExtractCFromProps<P extends ModelProperties> = {

@@ -48,0 +37,0 @@ [k in keyof P]: ExtractC<P[k]>;

@@ -0,0 +0,0 @@ import { enumeration, model, compose, custom, reference, safeReference, union, optional, literal, maybe, maybeNull, refinement, map, array, frozen, late, snapshotProcessor } from "../internal";

@@ -0,0 +0,0 @@ import { ISimpleType, IType } from "../internal";

@@ -0,0 +0,0 @@ import { IType } from "../../internal";

@@ -0,0 +0,0 @@ import { ISimpleType } from "../../internal";

@@ -0,0 +0,0 @@ import { IType } from "../../internal";

@@ -0,0 +0,0 @@ import { ISimpleType } from "../../internal";

@@ -0,0 +0,0 @@ import { IAnyType } from "../../internal";

@@ -0,0 +0,0 @@ import { ISimpleType, Primitives } from "../../internal";

@@ -0,0 +0,0 @@ import { IType, IAnyType, ExtractC, ExtractS, ExtractTWithoutSTN } from "../../internal";

@@ -0,0 +0,0 @@ import { IType, IAnyType, ExtractS, ExtractC, ExtractCSTWithSTN, ExtractTWithoutSTN } from "../../internal";

@@ -0,0 +0,0 @@ import { IType, IAnyType, IAnyStateTreeNode, IAnyComplexType, IMaybe, ReferenceIdentifier, ExtractTWithoutSTN, IStateTreeNode } from "../../internal";

@@ -0,0 +0,0 @@ import { IAnyType, ExtractC } from "../../internal";

@@ -0,0 +0,0 @@ import { IType, ExtractC, ExtractS, IAnyType, ExtractTWithoutSTN } from "../../internal";

@@ -0,0 +0,0 @@ import { IType, IAnyType, IModelType, ModelProperties, ModelInstanceType, ModelSnapshotType2, ModelCreationType2, _NotCustomized } from "../../internal";

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

{
"name": "mobx-state-tree",
"version": "3.12.2",
"version": "3.13.0",
"description": "Opinionated, transactional, MobX powered state container",

@@ -60,3 +60,3 @@ "main": "dist/mobx-state-tree.js",

"rollup-plugin-replace": "^2.1.0",
"rollup-plugin-uglify": "^6.0.2",
"rollup-plugin-terser": "^4.0.4",
"shx": "^0.3.2",

@@ -63,0 +63,0 @@ "ts-jest": "^24.0.0",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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