@ez4/stateful
Advanced tools
Comparing version 0.6.0 to 0.7.0
import type { EntryState, EntryStates } from '../types/entry.js'; | ||
import type { StepHandlers, StepState } from '../types/step.js'; | ||
export type ApplyState<E extends EntryState = EntryState> = { | ||
export type ApplyResult<E extends EntryState = EntryState> = { | ||
result: EntryStates<E>; | ||
errors: Error[]; | ||
}; | ||
export declare const applySteps: <E extends EntryState>(stepList: StepState[], newEntries: EntryStates<E> | undefined, oldEntries: EntryStates<E> | undefined, handlers: StepHandlers<E>) => Promise<ApplyState<E>>; | ||
export declare const applySteps: <E extends EntryState>(stepList: StepState[], newEntries: EntryStates<E> | undefined, oldEntries: EntryStates<E> | undefined, handlers: StepHandlers<E>) => Promise<ApplyResult<E>>; |
@@ -1,6 +0,6 @@ | ||
import type { EntryState, EntryStates, TypedEntryState } from '../types/entry.js'; | ||
import type { EntryState, EntryStates } from '../types/entry.js'; | ||
export declare const getEntry: <E extends EntryState>(entryMap: EntryStates<E>, entryId: string) => E; | ||
export declare const attachEntry: <E1 extends EntryState, E2 extends E1>(entryMap: EntryStates<E1>, entry: E2) => E2; | ||
export declare const attachEntry: <E extends EntryState, T extends E>(entryMap: EntryStates<E>, entry: T) => T; | ||
export declare const validateEntries: <E extends EntryState>(entryMap: EntryStates<E>) => void; | ||
export declare const linkDependency: <E extends EntryState>(entryMap: EntryStates<E>, entryId: string, dependencyId: string) => void; | ||
export declare const getDependencies: <E extends EntryState, T extends string>(entryMap: EntryStates<E>, entry: E, type?: T) => TypedEntryState<E, T>[]; | ||
export declare const getDependencies: <E extends EntryState>(entryMap: EntryStates, entry: EntryState, type?: E["type"]) => E[]; |
@@ -8,12 +8,6 @@ /** | ||
dependencies: string[]; | ||
parameters: Record<string, any>; | ||
result?: Record<string, any>; | ||
parameters: unknown; | ||
result?: unknown; | ||
}; | ||
/** | ||
* Regular entry state with type overwritten. | ||
*/ | ||
export type TypedEntryState<E extends EntryState, T extends string> = E & { | ||
type: T; | ||
}; | ||
/** | ||
* Map of regular entry states. | ||
@@ -20,0 +14,0 @@ */ |
import type { ObjectComparison } from '@ez4/utils'; | ||
import type { StepAction } from '../state/step.js'; | ||
import type { EntryState, TypedEntryState } from './entry.js'; | ||
import type { EntryState } from './entry.js'; | ||
/** | ||
@@ -16,3 +16,3 @@ * A step state that contains an action to perform. | ||
*/ | ||
export type StepContext<E extends EntryState = EntryState> = { | ||
export type StepContext = { | ||
/** | ||
@@ -25,3 +25,3 @@ * Get all dependencies from the current step entry, if a `type` is given | ||
*/ | ||
getDependencies: <T extends string>(type?: T) => TypedEntryState<E, T>[]; | ||
getDependencies: <E extends EntryState>(type?: E['type']) => E[]; | ||
}; | ||
@@ -45,3 +45,3 @@ /** | ||
*/ | ||
create: (candidate: Readonly<E>, context: StepContext<E>) => Record<string, any> | undefined | Promise<Record<string, any> | unknown>; | ||
create: (candidate: Readonly<E>, context: StepContext) => Record<string, any> | undefined | Promise<Record<string, any> | undefined>; | ||
/** | ||
@@ -54,3 +54,3 @@ * Handle entry replacement. | ||
*/ | ||
replace: (candidate: Readonly<E>, current: Readonly<E>, context: StepContext<E>) => Record<string, any> | undefined | Promise<Record<string, any> | undefined>; | ||
replace: (candidate: Readonly<E>, current: Readonly<E>, context: StepContext) => Record<string, any> | undefined | Promise<Record<string, any> | undefined>; | ||
/** | ||
@@ -70,3 +70,3 @@ * Handle entry preview. | ||
*/ | ||
update: (candidate: Readonly<E>, current: Readonly<E>, context: StepContext<E>) => Record<string, any> | undefined | Promise<Record<string, any> | undefined>; | ||
update: (candidate: Readonly<E>, current: Readonly<E>, context: StepContext) => Record<string, any> | undefined | Promise<Record<string, any> | undefined>; | ||
/** | ||
@@ -78,3 +78,3 @@ * Handle entry deletion. | ||
*/ | ||
delete: (candidate: Readonly<E>, context: StepContext<E>) => void | Promise<void>; | ||
delete: (candidate: Readonly<E>, context: StepContext) => void | Promise<void>; | ||
}; | ||
@@ -81,0 +81,0 @@ /** |
{ | ||
"name": "@ez4/stateful", | ||
"description": "EZ4: State management with dependencies for providers", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"author": "Silas B.", | ||
@@ -38,4 +38,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@ez4/utils": "^0.6.0" | ||
"@ez4/utils": "^0.7.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
18754
278
+ Added@ez4/utils@0.7.1(transitive)
- Removed@ez4/utils@0.6.0(transitive)
Updated@ez4/utils@^0.7.0