@gnosticdev/hono-actions 1.0.5 → 1.0.11
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/actions.d.ts +16 -16
- package/dist/actions.js +2 -2
- package/dist/index.d.ts +30 -6
- package/dist/index.js +2480 -80
- package/package.json +20 -35
- package/dist/integration.d.ts +0 -20
- package/dist/integration.js +0 -216
package/dist/actions.d.ts
CHANGED
|
@@ -4,6 +4,20 @@ import * as hono_types from 'hono/types';
|
|
|
4
4
|
import { Context } from 'hono';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Standard error codes for actions
|
|
9
|
+
*/
|
|
10
|
+
type ActionErrorCode = 'INPUT_VALIDATION_ERROR' | 'EXTERNAL_API_ERROR' | 'INTERNAL_SERVER_ERROR' | 'UNKNOWN_ERROR' | 'LOCATION_NOT_FOUND' | 'SESSION_NOT_FOUND';
|
|
11
|
+
declare class HonoActionError<TSchema extends v.ObjectSchema<v.ObjectEntries, v.ErrorMessage<v.ObjectIssue> | undefined>, TMessage extends string, TCode extends ActionErrorCode, TIssue extends v.InferIssue<TSchema>> extends Error {
|
|
12
|
+
code: TCode;
|
|
13
|
+
issue?: TIssue;
|
|
14
|
+
constructor({ message, code, issue, }: {
|
|
15
|
+
message: TMessage;
|
|
16
|
+
code: TCode;
|
|
17
|
+
issue?: TIssue;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
interface Bindings {
|
|
8
22
|
}
|
|
9
23
|
/**
|
|
@@ -13,7 +27,7 @@ interface Bindings {
|
|
|
13
27
|
*/
|
|
14
28
|
interface HonoEnv {
|
|
15
29
|
Bindings: Bindings;
|
|
16
|
-
Variables: Record<string,
|
|
30
|
+
Variables: Record<string, unknown>;
|
|
17
31
|
}
|
|
18
32
|
type HonoActionSchema = v.ObjectSchema<v.ObjectEntries, v.ErrorMessage<v.ObjectIssue> | undefined> | v.NeverSchema<undefined>;
|
|
19
33
|
interface HonoActionContext<TEnv extends HonoEnv, TPath extends string, TSchema extends HonoActionSchema> extends Context<TEnv, TPath, {
|
|
@@ -121,18 +135,4 @@ declare function defineHonoAction<TPath extends string, TSchema extends HonoActi
|
|
|
121
135
|
};
|
|
122
136
|
}; } extends infer T ? { [KeyType in keyof T]: T[KeyType]; } : never, "/">;
|
|
123
137
|
|
|
124
|
-
|
|
125
|
-
* Standard error codes for actions
|
|
126
|
-
*/
|
|
127
|
-
type ActionErrorCode = 'INPUT_VALIDATION_ERROR' | 'EXTERNAL_API_ERROR' | 'INTERNAL_SERVER_ERROR' | 'UNKNOWN_ERROR' | 'LOCATION_NOT_FOUND' | 'SESSION_NOT_FOUND';
|
|
128
|
-
declare class HonoActionError<TSchema extends v.ObjectSchema<v.ObjectEntries, v.ErrorMessage<v.ObjectIssue> | undefined>, TMessage extends string, TCode extends ActionErrorCode, TIssue extends v.InferIssue<TSchema>> extends Error {
|
|
129
|
-
code: TCode;
|
|
130
|
-
issue?: TIssue;
|
|
131
|
-
constructor({ message, code, issue }: {
|
|
132
|
-
message: TMessage;
|
|
133
|
-
code: TCode;
|
|
134
|
-
issue?: TIssue;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export { type ActionErrorCode, type Bindings, HonoActionError, type HonoEnv, defineHonoAction };
|
|
138
|
+
export { type Bindings, HonoActionError, type HonoEnv, defineHonoAction };
|
package/dist/actions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/actions.ts
|
|
2
2
|
import { vValidator } from "@hono/valibot-validator";
|
|
3
3
|
import { createFactory } from "hono/factory";
|
|
4
4
|
import * as v from "valibot";
|
|
@@ -19,7 +19,7 @@ var HonoActionError = class extends Error {
|
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
// src/
|
|
22
|
+
// src/actions.ts
|
|
23
23
|
function defineHonoAction({ path, schema, handler }) {
|
|
24
24
|
const factory = createFactory();
|
|
25
25
|
const app = factory.createApp();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import * as astro from 'astro';
|
|
2
|
+
import { z } from 'astro/zod';
|
|
3
|
+
|
|
4
|
+
declare const optionsSchema: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
basePath: z.ZodOptional<z.ZodString>;
|
|
6
|
+
actionsPath: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
basePath?: string | undefined;
|
|
9
|
+
actionsPath?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
basePath?: string | undefined;
|
|
12
|
+
actionsPath?: string | undefined;
|
|
13
|
+
}>>;
|
|
14
|
+
type IntegrationOptions = z.infer<typeof optionsSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* Astro integration for Hono Actions
|
|
17
|
+
*
|
|
18
|
+
* This integration automatically discovers action files in your project,
|
|
19
|
+
* generates type-safe client code, and sets up API routes.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Configuration options for the integration
|
|
22
|
+
* @param options.basePath - Base path for API routes (default: '/api')
|
|
23
|
+
* @param options.actionsPath - Custom path to actions file (optional, auto-discovered by default)
|
|
24
|
+
*/
|
|
25
|
+
declare const _default: (options?: {
|
|
26
|
+
basePath?: string | undefined;
|
|
27
|
+
actionsPath?: string | undefined;
|
|
28
|
+
} | undefined) => astro.AstroIntegration & {};
|
|
29
|
+
|
|
30
|
+
export { type IntegrationOptions, _default as default };
|