next-action-plus 2.0.1 → 2.0.2
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/index.d.ts +6 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -87,9 +87,12 @@ type TActionData<D extends TActionDefinition, Output> = D['output'] extends TSch
|
|
|
87
87
|
type TActionResult<D extends TActionDefinition, Output> = D['response'] extends TResponseLambda ? TResponseApply<D['response'], TActionData<D, Output>, TErrorUnion<D['errors']>> : TActionData<D, Output>;
|
|
88
88
|
type TActionParams<D extends TActionDefinition> = [
|
|
89
89
|
...TActionArgs<D['args'], 'input'>,
|
|
90
|
-
...(D['input'] extends TSchema ? (undefined extends TSchemaInput<D['input']> ? [input?: TSchemaInput<D['input']>
|
|
90
|
+
...(D['input'] extends TSchema ? (undefined extends TSchemaInput<D['input']> ? [input?: TSchemaInput<D['input']>] : [input: TSchemaInput<D['input']>]) : [input?: unknown])
|
|
91
91
|
];
|
|
92
|
-
type TActionFunction<D extends TActionDefinition, Output> =
|
|
92
|
+
type TActionFunction<D extends TActionDefinition, Output> = D['input'] extends TSchema ? {
|
|
93
|
+
(...params: [...TActionArgs<D['args'], 'input'>, form: FormData]): Promise<TActionResult<D, Output>>;
|
|
94
|
+
(...params: TActionParams<D>): Promise<TActionResult<D, Output>>;
|
|
95
|
+
} : (...params: TActionParams<D>) => Promise<TActionResult<D, Output>>;
|
|
93
96
|
type TActionHandler<D extends TActionDefinition, Output, Extra = {}> = (props: TPrettify<TActionHandlerProps<D> & Extra>) => Promise<D['output'] extends TSchema ? TSchemaInput<D['output']> : Output>;
|
|
94
97
|
type TActionGateCheck<D extends TActionDefinition> = D['gate'] extends 'required' ? TTypeError<'This action has no gate: add an auth plugin with .use(...) or call .public()'> : unknown;
|
|
95
98
|
type TActionBuilder<D extends TActionDefinition> = {
|
|
@@ -129,9 +132,7 @@ type TActionBuilder<D extends TActionDefinition> = {
|
|
|
129
132
|
state: {
|
|
130
133
|
previous: unknown;
|
|
131
134
|
};
|
|
132
|
-
}>) => (...params: [...TActionArgs<D['args'], 'input'>, previous: TActionResult<D, Output> | null | undefined, ...
|
|
133
|
-
args: [];
|
|
134
|
-
}>>]) => Promise<TActionResult<D, Output>>;
|
|
135
|
+
}>) => (...params: [...TActionArgs<D['args'], 'input'>, previous: TActionResult<D, Output> | null | undefined, ...(D['input'] extends TSchema ? [input: TSchemaInput<D['input']> | FormData] : [input?: unknown])]) => Promise<TActionResult<D, Output>>;
|
|
135
136
|
};
|
|
136
137
|
|
|
137
138
|
declare const actionCreate: <const Required extends boolean = true, Lambda extends TResponseLambda = never>(props?: Omit<TActionOptions, "gate" | "response"> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-action-plus",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Type-safe, secure-by-default Next.js Server Actions: any Standard Schema validator, gates for auth, typed errors, your own response shape, concurrency control, and drop-in adapters for auth, rate limits, locks, queues and telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|