@platform/state.types
Advanced tools
Comparing version 0.1.4 to 0.1.5
export * from './types.Node'; | ||
export * from './types.Patch'; | ||
export * from './types.State'; | ||
export * from './types.StateObject'; | ||
@@ -4,0 +5,0 @@ export * from './types.StateObject.events'; |
@@ -6,2 +6,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./types.Patch"), exports); | ||
tslib_1.__exportStar(require("./types.State"), exports); | ||
tslib_1.__exportStar(require("./types.StateObject"), exports); | ||
@@ -8,0 +9,0 @@ tslib_1.__exportStar(require("./types.StateObject.events"), exports); |
import * as t from './common'; | ||
declare type O = Record<string, unknown>; | ||
export declare type ArrayPatch = { | ||
op: 'replace' | 'remove' | 'add'; | ||
op: PatchOperation['op']; | ||
path: (string | number)[]; | ||
@@ -11,3 +12,11 @@ value?: any; | ||
isEmpty(patches: t.PatchSet): boolean; | ||
change<T extends O>(from: T, fn: t.StateChanger<T> | T): t.PatchChange<T>; | ||
changeAsync<T extends O>(from: T, fn: t.StateChangerAsync<T>): Promise<t.PatchChange<T>>; | ||
apply<T extends O>(from: T, patches: t.PatchOperation[] | t.PatchSet): T; | ||
}; | ||
export declare type PatchChange<T extends O> = { | ||
to: T; | ||
op: t.StateChangeOperation; | ||
patches: t.PatchSet; | ||
}; | ||
export declare type PatchSet = { | ||
@@ -14,0 +23,0 @@ prev: PatchOperation[]; |
@@ -26,7 +26,6 @@ import * as t from './common'; | ||
}; | ||
export declare type StateObjectChange<T extends O> = (input: StateObjectChanger<T> | T) => IStateObjectChangeResponse<T>; | ||
export declare type StateObjectChangeAsync<T extends O> = (input: StateObjectChangerAsync<T>) => Promise<IStateObjectChangeResponse<T>>; | ||
export declare type StateObjectChangeOperation = 'update' | 'replace'; | ||
export declare type StateObjectChange<T extends O> = (input: t.StateChanger<T> | T) => IStateObjectChangeResponse<T>; | ||
export declare type StateObjectChangeAsync<T extends O> = (input: t.StateChangerAsync<T>) => Promise<IStateObjectChangeResponse<T>>; | ||
export declare type IStateObjectChangeResponse<T extends O> = { | ||
op: StateObjectChangeOperation; | ||
op: t.StateChangeOperation; | ||
cid: string; | ||
@@ -37,4 +36,2 @@ patches: t.PatchSet; | ||
}; | ||
export declare type StateObjectChanger<T extends O> = (draft: T) => void; | ||
export declare type StateObjectChangerAsync<T extends O> = (draft: T) => Promise<void>; | ||
export declare type StateMerger<T extends CombineObject> = { | ||
@@ -41,0 +38,0 @@ readonly store: t.IStateObjectReadable<T>; |
@@ -17,3 +17,3 @@ import * as t from './common'; | ||
export declare type IStateObjectChanging<T extends O = any> = { | ||
op: t.StateObjectChangeOperation; | ||
op: t.StateChangeOperation; | ||
cid: string; | ||
@@ -31,3 +31,3 @@ from: T; | ||
export declare type IStateObjectChanged<T extends O = any> = { | ||
op: t.StateObjectChangeOperation; | ||
op: t.StateChangeOperation; | ||
cid: string; | ||
@@ -43,3 +43,3 @@ patches: t.PatchSet; | ||
export declare type IStateObjectPatched = { | ||
op: t.StateObjectChangeOperation; | ||
op: t.StateChangeOperation; | ||
cid: string; | ||
@@ -46,0 +46,0 @@ prev: t.PatchSet['prev']; |
{ | ||
"name": "@platform/state.types", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Abstract type definitions for the state library.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20284
26
476