@kellanjs/actioncraft 0.2.0 → 0.3.0
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/README.md +47 -68
- package/dist/classes/{action-builder.d.ts → builder.d.ts} +20 -16
- package/dist/classes/{action-builder.js → builder.js} +34 -25
- package/dist/classes/builder.js.map +1 -0
- package/dist/classes/executor/executor.d.ts +3 -3
- package/dist/classes/executor/executor.js +1 -1
- package/dist/classes/executor/executor.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/standard-schema.js +2 -1
- package/dist/standard-schema.js.map +1 -1
- package/package.json +16 -13
- package/dist/actioncraft-error.d.ts +0 -23
- package/dist/actioncraft-error.js +0 -60
- package/dist/actioncraft-error.js.map +0 -1
- package/dist/actioncraft-prev.d.ts +0 -93
- package/dist/actioncraft-prev.js +0 -387
- package/dist/actioncraft-prev.js.map +0 -1
- package/dist/actioncraft.d.ts +0 -143
- package/dist/actioncraft.js +0 -613
- package/dist/actioncraft.js.map +0 -1
- package/dist/api.d.ts +0 -49
- package/dist/api.js +0 -84
- package/dist/api.js.map +0 -1
- package/dist/classes/action-builder.js.map +0 -1
- package/dist/classes/craft-builder.d.ts +0 -66
- package/dist/classes/craft-builder.js +0 -129
- package/dist/classes/craft-builder.js.map +0 -1
- package/dist/classes/crafter.d.ts +0 -66
- package/dist/classes/crafter.js +0 -129
- package/dist/classes/crafter.js.map +0 -1
- package/dist/classes/executor.d.ts +0 -64
- package/dist/classes/executor.js +0 -354
- package/dist/classes/executor.js.map +0 -1
- package/dist/core/callbacks.d.ts +0 -6
- package/dist/core/callbacks.js +0 -20
- package/dist/core/callbacks.js.map +0 -1
- package/dist/core/errors.d.ts +0 -28
- package/dist/core/errors.js +0 -101
- package/dist/core/errors.js.map +0 -1
- package/dist/core/logging.d.ts +0 -6
- package/dist/core/logging.js +0 -8
- package/dist/core/logging.js.map +0 -1
- package/dist/core/transformation.d.ts +0 -17
- package/dist/core/transformation.js +0 -43
- package/dist/core/transformation.js.map +0 -1
- package/dist/core/validation.d.ts +0 -16
- package/dist/core/validation.js +0 -70
- package/dist/core/validation.js.map +0 -1
- package/dist/craft.d.ts +0 -29
- package/dist/craft.js +0 -62
- package/dist/craft.js.map +0 -1
- package/dist/error.d.ts +0 -31
- package/dist/error.js +0 -71
- package/dist/error.js.map +0 -1
- package/dist/initial.d.ts +0 -14
- package/dist/initial.js +0 -47
- package/dist/initial.js.map +0 -1
- package/dist/types/config.d.ts +0 -84
- package/dist/types/config.js +0 -2
- package/dist/types/config.js.map +0 -1
- package/dist/types/crafter.d.ts +0 -87
- package/dist/types/crafter.js +0 -2
- package/dist/types/crafter.js.map +0 -1
package/dist/core/validation.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { standardParse } from "../standard-schema.js";
|
|
2
|
-
import { INTERNAL_ERROR_TYPES, EXTERNAL_ERROR_TYPES } from "../types/errors.js";
|
|
3
|
-
import { ok, err } from "../types/result.js";
|
|
4
|
-
import { createValidationError, createInternalLogicError, formatValidationIssues, } from "./errors.js";
|
|
5
|
-
/**
|
|
6
|
-
* Validate input using the configured input schema.
|
|
7
|
-
*/
|
|
8
|
-
export async function validateInput(schemas, config, rawInput, actionId) {
|
|
9
|
-
if (!schemas.inputSchema) {
|
|
10
|
-
return ok(undefined, actionId);
|
|
11
|
-
}
|
|
12
|
-
const result = await standardParse(schemas.inputSchema, rawInput);
|
|
13
|
-
if (Array.isArray(result.issues) && result.issues.length > 0) {
|
|
14
|
-
const format = config.validationErrorFormat ?? "flattened";
|
|
15
|
-
const baseError = formatValidationIssues(result.issues, format);
|
|
16
|
-
const inputValidationError = createValidationError(EXTERNAL_ERROR_TYPES.INPUT_VALIDATION, "Input validation failed", baseError);
|
|
17
|
-
return err(inputValidationError, actionId);
|
|
18
|
-
}
|
|
19
|
-
if (!result.issues && "value" in result) {
|
|
20
|
-
return ok(result.value, actionId);
|
|
21
|
-
}
|
|
22
|
-
// Should never happen
|
|
23
|
-
const logicErr = createInternalLogicError("Unexpected validation state in input validation: neither success nor failure");
|
|
24
|
-
return err(logicErr, actionId);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Validate bound arguments using configured bind schemas.
|
|
28
|
-
*/
|
|
29
|
-
export async function validateBindArgs(schemas, config, bindArgs, actionId) {
|
|
30
|
-
if (!schemas.bindSchemas) {
|
|
31
|
-
return ok([], actionId);
|
|
32
|
-
}
|
|
33
|
-
const validated = [];
|
|
34
|
-
for (let i = 0; i < schemas.bindSchemas.length; i++) {
|
|
35
|
-
const schema = schemas.bindSchemas[i];
|
|
36
|
-
const arg = bindArgs[i];
|
|
37
|
-
const result = await standardParse(schema, arg);
|
|
38
|
-
if (Array.isArray(result.issues) && result.issues.length > 0) {
|
|
39
|
-
const format = config.validationErrorFormat ?? "flattened";
|
|
40
|
-
const baseError = formatValidationIssues(result.issues, format);
|
|
41
|
-
const bindError = createValidationError(EXTERNAL_ERROR_TYPES.BIND_ARGS_VALIDATION, "Bind arguments validation failed", baseError);
|
|
42
|
-
return err(bindError, actionId);
|
|
43
|
-
}
|
|
44
|
-
if ("value" in result) {
|
|
45
|
-
validated.push(result.value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return ok(validated, actionId);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Validate action output using configured output schema.
|
|
52
|
-
*/
|
|
53
|
-
export async function validateOutput(schemas, config, data, actionId) {
|
|
54
|
-
if (!schemas.outputSchema) {
|
|
55
|
-
return ok(data, actionId);
|
|
56
|
-
}
|
|
57
|
-
const result = await standardParse(schemas.outputSchema, data);
|
|
58
|
-
if (Array.isArray(result.issues) && result.issues.length > 0) {
|
|
59
|
-
const format = config.validationErrorFormat ?? "flattened";
|
|
60
|
-
const baseError = formatValidationIssues(result.issues, format);
|
|
61
|
-
const outputError = createValidationError(INTERNAL_ERROR_TYPES.OUTPUT_VALIDATION, "Output validation failed", baseError);
|
|
62
|
-
return err(outputError, actionId);
|
|
63
|
-
}
|
|
64
|
-
if (!result.issues && "value" in result) {
|
|
65
|
-
return ok(result.value, actionId);
|
|
66
|
-
}
|
|
67
|
-
const logicErr = createInternalLogicError("Unexpected validation state in output validation: neither success nor failure");
|
|
68
|
-
return err(logicErr, actionId);
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"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"}
|
package/dist/craft.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Crafter } from "./classes/crafter.js";
|
|
2
|
-
import type { CraftedAction } from "./types/actions.js";
|
|
3
|
-
import type { CrafterConfig, CrafterSchemas, CrafterErrors, CrafterCallbacks } from "./types/crafter.js";
|
|
4
|
-
/**
|
|
5
|
-
* Represents the function that the user passes to `craft()` in order to build an action.
|
|
6
|
-
*/
|
|
7
|
-
type CraftFn<TConfig extends CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors, TCallbacks extends CrafterCallbacks<TConfig, TSchemas, TErrors, TData>, TData> = (crafter: Crafter<CrafterConfig, Record<string, never>, Record<string, never>, Record<string, never>, unknown>) => Crafter<TConfig, TSchemas, TErrors, TCallbacks, TData> | Promise<Crafter<TConfig, TSchemas, TErrors, TCallbacks, TData>>;
|
|
8
|
-
/**
|
|
9
|
-
* One of two entry points to the Actioncraft system.
|
|
10
|
-
* It provides you with an empty Crafter instance on which you can call any of the fluent
|
|
11
|
-
* Crafter methods to configure and define your action.
|
|
12
|
-
*
|
|
13
|
-
* Example Usage:
|
|
14
|
-
* ```ts
|
|
15
|
-
* const myAction = craft(async (action) => {
|
|
16
|
-
* return action
|
|
17
|
-
* .config(...)
|
|
18
|
-
* .schemas(...)
|
|
19
|
-
* .errors(...)
|
|
20
|
-
* .handler(...)
|
|
21
|
-
* .callbacks(...)
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @param craftFn - The function that the user passes to `craft()` in order to build an action.
|
|
26
|
-
* @returns The fully-typed server action function that can be used in your app.
|
|
27
|
-
*/
|
|
28
|
-
export declare function craft<TConfig extends CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors, TCallbacks extends CrafterCallbacks<TConfig, TSchemas, TErrors, TData>, TData>(craftFn: CraftFn<TConfig, TSchemas, TErrors, TCallbacks, TData>): CraftedAction<TConfig, TSchemas, TErrors, TData>;
|
|
29
|
-
export {};
|
package/dist/craft.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Crafter } from "./classes/crafter.js";
|
|
2
|
-
import { Executor } from "./classes/executor.js";
|
|
3
|
-
/**
|
|
4
|
-
* One of two entry points to the Actioncraft system.
|
|
5
|
-
* It provides you with an empty Crafter instance on which you can call any of the fluent
|
|
6
|
-
* Crafter methods to configure and define your action.
|
|
7
|
-
*
|
|
8
|
-
* Example Usage:
|
|
9
|
-
* ```ts
|
|
10
|
-
* const myAction = craft(async (action) => {
|
|
11
|
-
* return action
|
|
12
|
-
* .config(...)
|
|
13
|
-
* .schemas(...)
|
|
14
|
-
* .errors(...)
|
|
15
|
-
* .handler(...)
|
|
16
|
-
* .callbacks(...)
|
|
17
|
-
* });
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @param craftFn - The function that the user passes to `craft()` in order to build an action.
|
|
21
|
-
* @returns The fully-typed server action function that can be used in your app.
|
|
22
|
-
*/
|
|
23
|
-
export function craft(craftFn) {
|
|
24
|
-
const crafter = craftFn(new Crafter({}, {}, {}, {}, undefined));
|
|
25
|
-
// Handle async crafter functions
|
|
26
|
-
if (crafter instanceof Promise) {
|
|
27
|
-
return _craftAsync(crafter);
|
|
28
|
-
}
|
|
29
|
-
// Handle sync crafter functions
|
|
30
|
-
const executor = new Executor(crafter);
|
|
31
|
-
const craftedAction = executor.craft();
|
|
32
|
-
return craftedAction;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Internal helper function to handle async craft functions.
|
|
36
|
-
* Encapsulates the logic for creating async actions and preserving metadata.
|
|
37
|
-
*/
|
|
38
|
-
function _craftAsync(crafterPromise) {
|
|
39
|
-
// Resolve the crafter once and cache the resulting action to ensure consistent IDs
|
|
40
|
-
const actionPromise = crafterPromise.then((resolvedCrafter) => {
|
|
41
|
-
const executor = new Executor(resolvedCrafter);
|
|
42
|
-
return executor.craft();
|
|
43
|
-
});
|
|
44
|
-
// For async craft functions, we need to return an async action
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
const asyncAction = (async (...args) => {
|
|
47
|
-
// Wait for the cached action to be ready
|
|
48
|
-
const craftedAction = await actionPromise;
|
|
49
|
-
// Call the action with the user's arguments
|
|
50
|
-
return craftedAction(...args);
|
|
51
|
-
});
|
|
52
|
-
// We need to preserve the config and ID for the initial() function to work
|
|
53
|
-
// We'll use the same cached action to ensure consistent metadata
|
|
54
|
-
actionPromise.then((craftedAction) => {
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
-
asyncAction.__ac_config = craftedAction.__ac_config;
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
58
|
-
asyncAction.__ac_id = craftedAction.__ac_id;
|
|
59
|
-
});
|
|
60
|
-
return asyncAction;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=craft.js.map
|
package/dist/craft.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"craft.js","sourceRoot":"","sources":["../src/craft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAkCjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,KAAK,CAOnB,OAA+D;IAE/D,MAAM,OAAO,GAAG,OAAO,CACrB,IAAI,OAAO,CACT,EAAmB,EACnB,EAA2B,EAC3B,EAA2B,EAC3B,EAA2B,EAC3B,SAAS,CACV,CACF,CAAC;IAEF,iCAAiC;IACjC,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,gCAAgC;IAChC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEvC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAOlB,cAEC;IAED,mFAAmF;IACnF,MAAM,aAAa,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;QAC5D,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,+DAA+D;IAC/D,8DAA8D;IAC9D,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,GAAG,IAAW,EAAE,EAAE;QAC5C,yCAAyC;QACzC,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC;QAE1C,4CAA4C;QAC5C,OAAO,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC,CAAqD,CAAC;IAEvD,2EAA2E;IAC3E,iEAAiE;IACjE,aAAa,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE;QACnC,8DAA8D;QAC7D,WAAmB,CAAC,WAAW,GAAI,aAAqB,CAAC,WAAW,CAAC;QACtE,8DAA8D;QAC7D,WAAmB,CAAC,OAAO,GAAI,aAAqB,CAAC,OAAO,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/error.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { CraftedAction } from "./types/actions.js";
|
|
2
|
-
import type { BaseError } from "./types/errors.js";
|
|
3
|
-
import type { InferErrors } from "./types/inference.js";
|
|
4
|
-
/**
|
|
5
|
-
* Error wrapper that provides standard Error semantics while preserving
|
|
6
|
-
* the original Actioncraft error data in the cause property.
|
|
7
|
-
*/
|
|
8
|
-
export declare class ActioncraftError<TErrorData extends BaseError = BaseError> extends Error {
|
|
9
|
-
readonly cause: TErrorData;
|
|
10
|
-
readonly actionId?: string;
|
|
11
|
-
constructor(errorData: TErrorData, actionId?: string);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Type guard to check if an error is an ActioncraftError.
|
|
15
|
-
*
|
|
16
|
-
* When called with just an error, performs basic structural validation.
|
|
17
|
-
* When called with an error and action, performs verified action ID checking.
|
|
18
|
-
*
|
|
19
|
-
* @param error - The unknown error to check
|
|
20
|
-
* @param action - Optional action for verified checking and type inference
|
|
21
|
-
* @returns Type predicate indicating if error is ActioncraftError
|
|
22
|
-
*/
|
|
23
|
-
export declare function isActioncraftError<TAction extends CraftedAction<any, any, any, any>>(error: unknown, action?: TAction): error is ActioncraftError<TAction extends undefined ? BaseError : InferErrors<TAction>>;
|
|
24
|
-
/**
|
|
25
|
-
* Utility to extract the action ID from a crafted action.
|
|
26
|
-
* Useful for debugging and logging purposes.
|
|
27
|
-
*
|
|
28
|
-
* @param action - The crafted action
|
|
29
|
-
* @returns The action ID if available, undefined otherwise
|
|
30
|
-
*/
|
|
31
|
-
export declare function getActionId<TAction extends CraftedAction<any, any, any, any>>(action: TAction): string | undefined;
|
package/dist/error.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error wrapper that provides standard Error semantics while preserving
|
|
3
|
-
* the original Actioncraft error data in the cause property.
|
|
4
|
-
*/
|
|
5
|
-
export class ActioncraftError extends Error {
|
|
6
|
-
cause;
|
|
7
|
-
actionId;
|
|
8
|
-
constructor(errorData, actionId) {
|
|
9
|
-
super(`Actioncraft Error: ${errorData.type}${"message" in errorData ? ` - ${errorData.message}` : ""}`);
|
|
10
|
-
this.name = "ActioncraftError";
|
|
11
|
-
this.cause = errorData;
|
|
12
|
-
this.actionId = actionId;
|
|
13
|
-
// Ensure proper prototype chain for instanceof checks
|
|
14
|
-
Object.setPrototypeOf(this, ActioncraftError.prototype);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Type guard to check if an error is an ActioncraftError.
|
|
19
|
-
*
|
|
20
|
-
* When called with just an error, performs basic structural validation.
|
|
21
|
-
* When called with an error and action, performs verified action ID checking.
|
|
22
|
-
*
|
|
23
|
-
* @param error - The unknown error to check
|
|
24
|
-
* @param action - Optional action for verified checking and type inference
|
|
25
|
-
* @returns Type predicate indicating if error is ActioncraftError
|
|
26
|
-
*/
|
|
27
|
-
export function isActioncraftError(error, action) {
|
|
28
|
-
if (!(error instanceof ActioncraftError)) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
// Verify the cause property exists and has the expected BaseError structure
|
|
32
|
-
const cause = error.cause;
|
|
33
|
-
if (!cause || typeof cause !== "object") {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
// Verify the cause has a type property that's a string (required by BaseError)
|
|
37
|
-
if (!("type" in cause) || typeof cause.type !== "string") {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
// If message exists, it should be a string (optional in BaseError)
|
|
41
|
-
if ("message" in cause &&
|
|
42
|
-
cause.message !== undefined &&
|
|
43
|
-
typeof cause.message !== "string") {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
// If no action provided, just do structural validation
|
|
47
|
-
if (!action) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
// If action provided, verify the action ID matches
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
-
const actionId = action.__ac_id;
|
|
53
|
-
// Both action and error must have IDs for verification to be possible
|
|
54
|
-
if (!actionId || !error.actionId) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
// Check if the error's action ID matches the action's ID
|
|
58
|
-
return error.actionId === actionId;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Utility to extract the action ID from a crafted action.
|
|
62
|
-
* Useful for debugging and logging purposes.
|
|
63
|
-
*
|
|
64
|
-
* @param action - The crafted action
|
|
65
|
-
* @returns The action ID if available, undefined otherwise
|
|
66
|
-
*/
|
|
67
|
-
export function getActionId(action) {
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
return action.__ac_id;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=error.js.map
|
package/dist/error.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,OAAO,gBAEX,SAAQ,KAAK;IACY,KAAK,CAAa;IAC3B,QAAQ,CAAU;IAElC,YAAY,SAAqB,EAAE,QAAiB;QAClD,KAAK,CACH,sBAAsB,SAAS,CAAC,IAAI,GAClC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EACvD,EAAE,CACH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,sDAAsD;QACtD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAIhC,KAAc,EACd,MAAgB;IAIhB,IAAI,CAAC,CAAC,KAAK,YAAY,gBAAgB,CAAC,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,4EAA4E;IAC5E,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+EAA+E;IAC/E,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,mEAAmE;IACnE,IACE,SAAS,IAAI,KAAK;QAClB,KAAK,CAAC,OAAO,KAAK,SAAS;QAC3B,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EACjC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,uDAAuD;IACvD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,8DAA8D;IAC9D,MAAM,QAAQ,GAAI,MAAc,CAAC,OAA6B,CAAC;IAE/D,sEAAsE;IACtE,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yDAAyD;IACzD,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAGzB,MAAe;IACf,8DAA8D;IAC9D,OAAQ,MAAc,CAAC,OAA6B,CAAC;AACvD,CAAC"}
|
package/dist/initial.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { InferResult } from "./types/inference.js";
|
|
2
|
-
/**
|
|
3
|
-
* Creates an appropriate initial state for any action based on its configuration.
|
|
4
|
-
* The initial state uses the action's real ID for consistency with actual results.
|
|
5
|
-
*
|
|
6
|
-
* For useActionState actions: returns StatefulApiResult with error and values
|
|
7
|
-
* For functional format actions: returns Result.err() with error
|
|
8
|
-
* For regular actions: returns ApiResult with error
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* - useActionState: const [state, action] = useActionState(myAction, initial(myAction))
|
|
12
|
-
* - useState: const [state, setState] = useState(initial(myAction))
|
|
13
|
-
*/
|
|
14
|
-
export declare function initial<TAction>(action: TAction): InferResult<TAction>;
|
package/dist/initial.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { EXTERNAL_ERROR_TYPES } from "./types/errors.js";
|
|
2
|
-
import { err } from "./types/result.js";
|
|
3
|
-
/**
|
|
4
|
-
* Creates an appropriate initial state for any action based on its configuration.
|
|
5
|
-
* The initial state uses the action's real ID for consistency with actual results.
|
|
6
|
-
*
|
|
7
|
-
* For useActionState actions: returns StatefulApiResult with error and values
|
|
8
|
-
* For functional format actions: returns Result.err() with error
|
|
9
|
-
* For regular actions: returns ApiResult with error
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* - useActionState: const [state, action] = useActionState(myAction, initial(myAction))
|
|
13
|
-
* - useState: const [state, setState] = useState(initial(myAction))
|
|
14
|
-
*/
|
|
15
|
-
export function initial(action) {
|
|
16
|
-
const error = {
|
|
17
|
-
type: EXTERNAL_ERROR_TYPES.INITIAL_STATE,
|
|
18
|
-
message: "Action has not been executed yet",
|
|
19
|
-
};
|
|
20
|
-
// Attempt to read the action ID created during craft()
|
|
21
|
-
const actionId =
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
action?.__ac_id ?? "unknown";
|
|
24
|
-
// Attempt to read the Actioncraft config attached during craft()
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
const cfg = action?.__ac_config;
|
|
27
|
-
// Functional format -> Result<_, _>
|
|
28
|
-
if (cfg?.resultFormat === "functional") {
|
|
29
|
-
return err(error, actionId);
|
|
30
|
-
}
|
|
31
|
-
// useActionState enabled -> StatefulApiResult
|
|
32
|
-
if (cfg?.useActionState) {
|
|
33
|
-
return {
|
|
34
|
-
success: false,
|
|
35
|
-
error,
|
|
36
|
-
values: undefined,
|
|
37
|
-
__ac_id: actionId,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
// Default ApiResult shape
|
|
41
|
-
return {
|
|
42
|
-
success: false,
|
|
43
|
-
error,
|
|
44
|
-
__ac_id: actionId,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=initial.js.map
|
package/dist/initial.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initial.js","sourceRoot":"","sources":["../src/initial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,OAAO,CAAU,MAAe;IAC9C,MAAM,KAAK,GAAG;QACZ,IAAI,EAAE,oBAAoB,CAAC,aAAa;QACxC,OAAO,EAAE,kCAAkC;KACnC,CAAC;IAEX,uDAAuD;IACvD,MAAM,QAAQ;IACZ,8DAA8D;IAC5D,MAAc,EAAE,OAA8B,IAAI,SAAS,CAAC;IAEhE,iEAAiE;IACjE,8DAA8D;IAC9D,MAAM,GAAG,GAAI,MAAc,EAAE,WAEhB,CAAC;IAEd,oCAAoC;IACpC,IAAI,GAAG,EAAE,YAAY,KAAK,YAAY,EAAE,CAAC;QACvC,OAAO,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAoC,CAAC;IACjE,CAAC;IAED,8CAA8C;IAC9C,IAAI,GAAG,EAAE,cAAc,EAAE,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,KAAc;YACvB,KAAK;YACL,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,QAAQ;SACiB,CAAC;IACvC,CAAC;IAED,0BAA0B;IAC1B,OAAO;QACL,OAAO,EAAE,KAAc;QACvB,KAAK;QACL,OAAO,EAAE,QAAQ;KACiB,CAAC;AACvC,CAAC"}
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from "../standard-schema.js";
|
|
2
|
-
import type { InferCraftedActionResult } from "./actions.js";
|
|
3
|
-
import type { AllPossibleErrors, ErrorDefinition, UserDefinedError } from "./errors.js";
|
|
4
|
-
import type { CallbackMetadata } from "./shared.js";
|
|
5
|
-
/**
|
|
6
|
-
* Custom logging interface for ActionCraft.
|
|
7
|
-
*/
|
|
8
|
-
export type CrafterLogger = {
|
|
9
|
-
/** Called when callback functions fail */
|
|
10
|
-
error?: (message: string, error: unknown) => void;
|
|
11
|
-
/** Called when ActionCraft detects internal bugs */
|
|
12
|
-
warn?: (message: string, details?: unknown) => void;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Configuration options for building actions.
|
|
16
|
-
*/
|
|
17
|
-
export type CrafterConfig = {
|
|
18
|
-
/**
|
|
19
|
-
* Result format returned by actions.
|
|
20
|
-
* "api" returns {success, data/error}, "functional" returns {type, value/error}.
|
|
21
|
-
* Ignored when useActionState is enabled.
|
|
22
|
-
*/
|
|
23
|
-
resultFormat?: "api" | "functional";
|
|
24
|
-
/**
|
|
25
|
-
* Validation error structure.
|
|
26
|
-
* "flattened" returns array of {path, message}, "nested" groups by field.
|
|
27
|
-
*/
|
|
28
|
-
validationErrorFormat?: "flattened" | "nested";
|
|
29
|
-
/**
|
|
30
|
-
* Enables React useActionState compatibility.
|
|
31
|
-
* Action accepts prevState parameter and returns a stateful result.
|
|
32
|
-
*/
|
|
33
|
-
useActionState?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Custom handler for unexpected thrown errors.
|
|
36
|
-
* Transforms exceptions into structured error objects.
|
|
37
|
-
*/
|
|
38
|
-
handleThrownError?: (error: unknown) => UserDefinedError;
|
|
39
|
-
/**
|
|
40
|
-
* Logger for ActionCraft internal events.
|
|
41
|
-
*/
|
|
42
|
-
logger?: CrafterLogger;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Schema definitions for validating inputs and outputs.
|
|
46
|
-
*/
|
|
47
|
-
export type CrafterSchemas = {
|
|
48
|
-
/** Validates input values passed to the action */
|
|
49
|
-
inputSchema?: StandardSchemaV1;
|
|
50
|
-
/** Validates success data returned from the action */
|
|
51
|
-
outputSchema?: StandardSchemaV1;
|
|
52
|
-
/** Array of schemas for validating bound arguments */
|
|
53
|
-
bindSchemas?: readonly StandardSchemaV1[];
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Custom error types that actions can return.
|
|
57
|
-
* Each property is a function that creates a typed error object.
|
|
58
|
-
*/
|
|
59
|
-
export type CrafterErrors = Record<string, ErrorDefinition>;
|
|
60
|
-
/**
|
|
61
|
-
* Lifecycle hooks that run during action execution.
|
|
62
|
-
* Callback errors are logged but do not affect action results.
|
|
63
|
-
*/
|
|
64
|
-
export type CrafterCallbacks<TConfig extends CrafterConfig, TSchemas extends CrafterSchemas, TErrors extends CrafterErrors, TData> = {
|
|
65
|
-
/** Called when action starts executing, before any validation. */
|
|
66
|
-
onStart?: (params: {
|
|
67
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
68
|
-
}) => Promise<void> | void;
|
|
69
|
-
/** Called when action fails. */
|
|
70
|
-
onError?: (params: {
|
|
71
|
-
error: AllPossibleErrors<TErrors, TConfig, TSchemas>;
|
|
72
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
73
|
-
}) => Promise<void> | void;
|
|
74
|
-
/** Called when action succeeds. */
|
|
75
|
-
onSuccess?: (params: {
|
|
76
|
-
data: TData;
|
|
77
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
78
|
-
}) => Promise<void> | void;
|
|
79
|
-
/** Called after action finishes, regardless of success or failure. */
|
|
80
|
-
onSettled?: (params: {
|
|
81
|
-
result: InferCraftedActionResult<TConfig, TSchemas, TErrors, TData>;
|
|
82
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
83
|
-
}) => Promise<void> | void;
|
|
84
|
-
};
|
package/dist/types/config.js
DELETED
package/dist/types/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
|
package/dist/types/crafter.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type { StandardSchemaV1 } from "../standard-schema.js";
|
|
2
|
-
import type { InferCraftedActionResult } from "./actions.js";
|
|
3
|
-
import type { AllPossibleErrors, ErrorDefinition, UserDefinedError } from "./errors.js";
|
|
4
|
-
import type { CallbackMetadata } from "./shared.js";
|
|
5
|
-
/**
|
|
6
|
-
* Custom logging interface for Actioncraft.
|
|
7
|
-
*/
|
|
8
|
-
export type Logger = {
|
|
9
|
-
/** Called when callback functions fail */
|
|
10
|
-
error?: (message: string, error: unknown) => void;
|
|
11
|
-
/** Called when Actioncraft detects internal bugs */
|
|
12
|
-
warn?: (message: string, details?: unknown) => void;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Configuration options for crafting actions.
|
|
16
|
-
*/
|
|
17
|
-
export type Config = {
|
|
18
|
-
/**
|
|
19
|
-
* Result format returned by actions.
|
|
20
|
-
* "api" returns {success, data/error}, "functional" returns {type, value/error}.
|
|
21
|
-
* Ignored when useActionState is enabled.
|
|
22
|
-
* @default "api"
|
|
23
|
-
*/
|
|
24
|
-
resultFormat?: "api" | "functional";
|
|
25
|
-
/**
|
|
26
|
-
* Validation error structure.
|
|
27
|
-
* "flattened" returns array of {path, message}, "nested" groups by field.
|
|
28
|
-
* @default "flattened"
|
|
29
|
-
*/
|
|
30
|
-
validationErrorFormat?: "flattened" | "nested";
|
|
31
|
-
/**
|
|
32
|
-
* Enables React useActionState compatibility.
|
|
33
|
-
* Action accepts prevState parameter and returns a stateful result.
|
|
34
|
-
* @default false
|
|
35
|
-
*/
|
|
36
|
-
useActionState?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Custom handler for unexpected thrown errors.
|
|
39
|
-
* Transforms exceptions into structured error objects.
|
|
40
|
-
*/
|
|
41
|
-
handleThrownError?: (error: unknown) => UserDefinedError;
|
|
42
|
-
/**
|
|
43
|
-
* Logger for Actioncraft internal events.
|
|
44
|
-
*/
|
|
45
|
-
logger?: Logger;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Schema definitions for validating inputs and outputs.
|
|
49
|
-
*/
|
|
50
|
-
export type Schemas = {
|
|
51
|
-
/** Validates input values passed to the action */
|
|
52
|
-
inputSchema?: StandardSchemaV1;
|
|
53
|
-
/** Validates success data returned from the action */
|
|
54
|
-
outputSchema?: StandardSchemaV1;
|
|
55
|
-
/** Array of schemas for validating bound arguments */
|
|
56
|
-
bindSchemas?: readonly StandardSchemaV1[];
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Custom error types that actions can return.
|
|
60
|
-
* Each property is a function that creates a typed error object.
|
|
61
|
-
*/
|
|
62
|
-
export type Errors = Record<string, ErrorDefinition>;
|
|
63
|
-
/**
|
|
64
|
-
* Lifecycle hooks that run during action execution.
|
|
65
|
-
* Callback errors are logged but do not affect action results.
|
|
66
|
-
*/
|
|
67
|
-
export type Callbacks<TConfig extends Config, TSchemas extends Schemas, TErrors extends Errors, TData> = {
|
|
68
|
-
/** Called when action starts executing, before any validation. */
|
|
69
|
-
onStart?: (params: {
|
|
70
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
71
|
-
}) => Promise<void> | void;
|
|
72
|
-
/** Called when action fails. */
|
|
73
|
-
onError?: (params: {
|
|
74
|
-
error: AllPossibleErrors<TErrors, TConfig, TSchemas>;
|
|
75
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
76
|
-
}) => Promise<void> | void;
|
|
77
|
-
/** Called when action succeeds. */
|
|
78
|
-
onSuccess?: (params: {
|
|
79
|
-
data: TData;
|
|
80
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
81
|
-
}) => Promise<void> | void;
|
|
82
|
-
/** Called after action finishes, regardless of success or failure. */
|
|
83
|
-
onSettled?: (params: {
|
|
84
|
-
result: InferCraftedActionResult<TConfig, TSchemas, TErrors, TData>;
|
|
85
|
-
metadata: CallbackMetadata<TConfig, TSchemas, TErrors, TData>;
|
|
86
|
-
}) => Promise<void> | void;
|
|
87
|
-
};
|
package/dist/types/crafter.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crafter.js","sourceRoot":"","sources":["../../src/types/crafter.ts"],"names":[],"mappings":""}
|