@diphyx/harlemify 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -9,6 +9,7 @@ export interface RuntimeActionConfig {
|
|
|
9
9
|
concurrent?: ActionConcurrent;
|
|
10
10
|
}
|
|
11
11
|
export declare const DEFINITION: unique symbol;
|
|
12
|
+
export declare const AUTO: unique symbol;
|
|
12
13
|
export declare enum ActionOneMode {
|
|
13
14
|
SET = "set",
|
|
14
15
|
RESET = "reset",
|
|
@@ -103,8 +104,8 @@ export interface ActionDefinition<M extends Model, V, R = void> {
|
|
|
103
104
|
}
|
|
104
105
|
export type ActionDefinitions<M extends Model, V> = Record<string, ActionDefinition<M, V, unknown>>;
|
|
105
106
|
export interface ActionCommitMethod<M extends Model, V, R> {
|
|
106
|
-
<K extends keyof M, Mode extends ActionOneMode>(model: K, mode: Mode, ...args: Mode extends ActionOneMode.RESET ? [] : [value?: ActionCommitValue<M, K, Mode
|
|
107
|
-
<K extends keyof M, Mode extends ActionManyMode>(model: K, mode: Mode, ...args: Mode extends ActionManyMode.RESET ? [] : [value?: ActionCommitValue<M, K, Mode
|
|
107
|
+
<K extends keyof M, Mode extends ActionOneMode>(model: K, mode: Mode, ...args: Mode extends ActionOneMode.RESET ? [] : [value?: ActionCommitValue<M, K, Mode> | typeof AUTO, options?: MutationsOneOptions]): ActionCommitChain<M, V, R>;
|
|
108
|
+
<K extends keyof M, Mode extends ActionManyMode>(model: K, mode: Mode, ...args: Mode extends ActionManyMode.RESET ? [] : [value?: ActionCommitValue<M, K, Mode> | typeof AUTO, options?: MutationsManyOptions]): ActionCommitChain<M, V, R>;
|
|
108
109
|
}
|
|
109
110
|
export interface ActionApiChain<M extends Model, V, ApiResponse> {
|
|
110
111
|
handle<R>(callback: ActionHandleCallback<M, V, R, ApiResponse>): ActionHandleChain<M, V, R>;
|
|
@@ -3,7 +3,7 @@ import { resolveShape } from "./shape.js";
|
|
|
3
3
|
import {
|
|
4
4
|
ModelKind
|
|
5
5
|
} from "../types/model.js";
|
|
6
|
-
import { ActionOneMode, ActionManyMode } from "../types/action.js";
|
|
6
|
+
import { ActionOneMode, ActionManyMode, AUTO } from "../types/action.js";
|
|
7
7
|
export function initializeState(model) {
|
|
8
8
|
const state = {};
|
|
9
9
|
for (const [key, definition] of Object.entries(model)) {
|
|
@@ -212,7 +212,10 @@ export function executeCommit(definition, mutations, result) {
|
|
|
212
212
|
break;
|
|
213
213
|
}
|
|
214
214
|
default: {
|
|
215
|
-
handler(
|
|
215
|
+
handler(
|
|
216
|
+
definition.value === AUTO || definition.value === void 0 ? result : definition.value,
|
|
217
|
+
definition.options
|
|
218
|
+
);
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { Store, StoreConfig } from "./core/store.js";
|
|
|
3
3
|
export { shape } from "./core/layers/shape.js";
|
|
4
4
|
export type { ShapeInfer } from "./core/types/shape.js";
|
|
5
5
|
export { ModelKind } from "./core/types/model.js";
|
|
6
|
-
export { ActionOneMode, ActionManyMode, ActionStatus, ActionConcurrent, ActionApiMethod } from "./core/types/action.js";
|
|
6
|
+
export { AUTO, ActionOneMode, ActionManyMode, ActionStatus, ActionConcurrent, ActionApiMethod, } from "./core/types/action.js";
|
|
7
7
|
export type { Action, ActionCallPayload, ActionApiShortcutDefinition, ActionError, ActionApiError, ActionHandleError, ActionCommitError, ActionConcurrentError, } from "./core/types/action.js";
|
|
8
8
|
export { useIsolatedActionStatus, useIsolatedActionError } from "./composables/action.js";
|
|
9
9
|
export type { RuntimeConfig } from "./config.js";
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export { createStore } from "./core/store.js";
|
|
2
2
|
export { shape } from "./core/layers/shape.js";
|
|
3
3
|
export { ModelKind } from "./core/types/model.js";
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
AUTO,
|
|
6
|
+
ActionOneMode,
|
|
7
|
+
ActionManyMode,
|
|
8
|
+
ActionStatus,
|
|
9
|
+
ActionConcurrent,
|
|
10
|
+
ActionApiMethod
|
|
11
|
+
} from "./core/types/action.js";
|
|
5
12
|
export { useIsolatedActionStatus, useIsolatedActionError } from "./composables/action.js";
|