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

mobx-keystone

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-keystone - npm Package Compare versions

Comparing version 0.63.0 to 0.63.1

4

CHANGELOG.md
# Change Log
## 0.63.1
- Added `FromSnapshotDefaultType<typeof props>` and `ToSnapshotDefaultType<typeof props>` so the default type does not need to be repeated when using `fromSnapshotProcessor` / `toSnapshotProcessor`.
## 0.63.0

@@ -4,0 +8,0 @@

22

dist/model/Model.d.ts

@@ -7,4 +7,10 @@ import type { AbstractModelClass } from "../modelShared/BaseModelShared";

export declare type _ComposedCreationData<SuperModel, TProps extends ModelProps> = SuperModel extends BaseModel<any, any, any, infer TCD, any, any, any> ? ModelPropsToTransformedCreationData<TProps> & TCD : ModelPropsToTransformedCreationData<TProps>;
export declare type _FromSnapshot<TProps extends ModelProps> = SnapshotInOfObject<ModelPropsToCreationData<TProps>>;
export declare type _ToSnapshot<TProps extends ModelProps> = SnapshotOutOfObject<ModelPropsToData<TProps>>;
/**
* The default type used by fromSnapshot before processors are applied.
*/
export declare type FromSnapshotDefaultType<TProps extends ModelProps> = SnapshotInOfObject<ModelPropsToCreationData<TProps>>;
/**
* The default type used by getSnapshot before processors are applied.
*/
export declare type ToSnapshotDefaultType<TProps extends ModelProps> = SnapshotOutOfObject<ModelPropsToData<TProps>>;
export declare type _ModelId<SuperModel, TProps extends ModelProps> = SuperModel extends AnyModel ? ModelIdPropertyName<SuperModel> : ExtractModelIdProp<TProps> & string;

@@ -33,3 +39,3 @@ export interface _Model<SuperModel, TProps extends ModelProps, FromSnapshot, ToSnapshot> {

*/
export declare function ExtendedModel<TProps extends ModelProps, TModel extends AnyModel, A extends [], FS = _FromSnapshot<TProps>, TS = _ToSnapshot<TProps>>(genFn: (...args: A) => {
export declare function ExtendedModel<TProps extends ModelProps, TModel extends AnyModel, A extends [], FS = FromSnapshotDefaultType<TProps>, TS = ToSnapshotDefaultType<TProps>>(genFn: (...args: A) => {
baseModel: AbstractModelClass<TModel>;

@@ -48,3 +54,3 @@ props: TProps;

*/
export declare function ExtendedModel<TProps extends ModelProps, TModel extends AnyModel, FS = _FromSnapshot<TProps>, TS = _ToSnapshot<TProps>>(baseModel: AbstractModelClass<TModel>, modelProps: TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<TModel, TProps, FS, TS>;
export declare function ExtendedModel<TProps extends ModelProps, TModel extends AnyModel, FS = FromSnapshotDefaultType<TProps>, TS = ToSnapshotDefaultType<TProps>>(baseModel: AbstractModelClass<TModel>, modelProps: TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<TModel, TProps, FS, TS>;
/**

@@ -59,3 +65,3 @@ * Base abstract class for models.

*/
export declare function Model<TProps extends ModelProps, A extends [], FS = _FromSnapshot<TProps>, TS = _ToSnapshot<TProps>>(fnModelProps: (...args: A) => TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<unknown, TProps, FS, TS>;
export declare function Model<TProps extends ModelProps, A extends [], FS = FromSnapshotDefaultType<TProps>, TS = ToSnapshotDefaultType<TProps>>(fnModelProps: (...args: A) => TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<unknown, TProps, FS, TS>;
/**

@@ -70,3 +76,3 @@ * Base abstract class for models.

*/
export declare function Model<TProps extends ModelProps, FS = _FromSnapshot<TProps>, TS = _ToSnapshot<TProps>>(modelProps: TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<unknown, TProps, FS, TS>;
export declare function Model<TProps extends ModelProps, FS = FromSnapshotDefaultType<TProps>, TS = ToSnapshotDefaultType<TProps>>(modelProps: TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<unknown, TProps, FS, TS>;
/**

@@ -88,3 +94,3 @@ * Model options.

*/
fromSnapshotProcessor?(sn: FS): _FromSnapshot<TProps>;
fromSnapshotProcessor?(sn: FS): FromSnapshotDefaultType<TProps>;
/**

@@ -97,3 +103,3 @@ * Optional transformation that will be run when converting the data part of the model into a snapshot.

*/
toSnapshotProcessor?(sn: _ToSnapshot<TProps>, modelInstance: any): TS;
toSnapshotProcessor?(sn: ToSnapshotDefaultType<TProps>, modelInstance: any): TS;
}
{
"name": "mobx-keystone",
"version": "0.63.0",
"version": "0.63.1",
"description": "A MobX powered state management solution based on data trees with first class support for Typescript, snapshots, patches and much more",

@@ -78,5 +78,5 @@ "keywords": [

"ts-node": "^10.2.1",
"typedoc": "^0.22.4",
"typedoc": "^0.22.5",
"typescript": "^4.4.3",
"vite": "^2.6.1"
"vite": "^2.6.2"
},

@@ -83,0 +83,0 @@ "dependencies": {

@@ -23,7 +23,15 @@ import type { AbstractModelClass, ModelClass } from "../modelShared/BaseModelShared"

export type _FromSnapshot<TProps extends ModelProps> = SnapshotInOfObject<
/**
* The default type used by fromSnapshot before processors are applied.
*/
export type FromSnapshotDefaultType<TProps extends ModelProps> = SnapshotInOfObject<
ModelPropsToCreationData<TProps>
>
export type _ToSnapshot<TProps extends ModelProps> = SnapshotOutOfObject<ModelPropsToData<TProps>>
/**
* The default type used by getSnapshot before processors are applied.
*/
export type ToSnapshotDefaultType<TProps extends ModelProps> = SnapshotOutOfObject<
ModelPropsToData<TProps>
>

@@ -73,4 +81,4 @@ export type _ModelId<SuperModel, TProps extends ModelProps> = SuperModel extends AnyModel

A extends [],
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(

@@ -97,4 +105,4 @@ genFn: (...args: A) => {

TModel extends AnyModel,
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(

@@ -110,4 +118,4 @@ baseModel: AbstractModelClass<TModel>,

TModel extends AnyModel,
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(...args: any[]): _Model<TModel, TProps, FS, TS> {

@@ -146,4 +154,4 @@ let baseModel

A extends [],
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(

@@ -165,4 +173,4 @@ fnModelProps: (...args: A) => TProps,

TProps extends ModelProps,
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(modelProps: TProps, modelOptions?: ModelOptions<TProps, FS, TS>): _Model<unknown, TProps, FS, TS>

@@ -173,4 +181,4 @@

TProps extends ModelProps,
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(

@@ -190,4 +198,4 @@ fnModelPropsOrModelProps: (() => TProps) | TProps,

TBaseModel extends AnyModel,
FS = _FromSnapshot<TProps>,
TS = _ToSnapshot<TProps>
FS = FromSnapshotDefaultType<TProps>,
TS = ToSnapshotDefaultType<TProps>
>(

@@ -225,3 +233,3 @@ modelProps: TProps,

*/
fromSnapshotProcessor?(sn: FS): _FromSnapshot<TProps>
fromSnapshotProcessor?(sn: FS): FromSnapshotDefaultType<TProps>

@@ -235,3 +243,3 @@ /**

*/
toSnapshotProcessor?(sn: _ToSnapshot<TProps>, modelInstance: any): TS
toSnapshotProcessor?(sn: ToSnapshotDefaultType<TProps>, modelInstance: any): TS
}

@@ -0,0 +0,0 @@ import { assertTweakedObject } from "../tweaker/core"

@@ -0,0 +0,0 @@ import { action, createAtom, IAtom, untracked } from "mobx"

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

Sorry, the diff of this file is not supported yet

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