kizunajs 2.0.0-beta.2 → 2.0.0-beta.21
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 +3 -2
- package/dist/{adapter-CZW-unqX.mjs → adapter-BSqNrxhq.mjs} +522 -104
- package/dist/adapter-C3WYdSfx.d.cts +2754 -0
- package/dist/{adapter-DDR_yo9L.cjs → adapter-ClaFZoab.cjs} +638 -196
- package/dist/adapter-D4bTPElA.d.mts +2754 -0
- package/dist/adapter.cjs +37 -29
- package/dist/adapter.d.cts +3 -5
- package/dist/adapter.d.mts +3 -5
- package/dist/adapter.mjs +5 -5
- package/dist/{error-response-C8Ragjcd.cjs → error-response-C9ymqSU4.cjs} +25 -5
- package/dist/{error-response-C839d8By.mjs → error-response-CNQaKVYd.mjs} +20 -6
- package/dist/{security-scheme-BrszwGD5.d.cts → error-response-NoOGdh8H.d.mts} +151 -24
- package/dist/{security-scheme-D3nb4XKj.d.mts → error-response-YbkRMKno.d.cts} +151 -24
- package/dist/generator.cjs +190 -95
- package/dist/generator.d.cts +189 -28
- package/dist/generator.d.mts +189 -28
- package/dist/generator.mjs +151 -60
- package/dist/index.cjs +159 -84
- package/dist/index.d.cts +193 -253
- package/dist/index.d.mts +193 -253
- package/dist/index.mjs +112 -38
- package/dist/jobs-entry.cjs +12 -11
- package/dist/jobs-entry.d.cts +1 -1
- package/dist/jobs-entry.d.mts +1 -1
- package/dist/jobs-entry.mjs +3 -2
- package/dist/plugin-Dw-yCjTY.cjs +233 -0
- package/dist/{cache-CLN5y0Xp.mjs → plugin-server-BztlE1fz.mjs} +188 -49
- package/dist/{cache-BgohRj0i.cjs → plugin-server-kUsK7thV.cjs} +238 -93
- package/dist/plugin-xxCxibmu.mjs +138 -0
- package/dist/plugin.cjs +8 -72
- package/dist/plugin.d.cts +3 -3
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.mjs +2 -68
- package/dist/{protected-resource-metadata-CA0v5cjg.d.mts → protected-resource-metadata-B9hMFQ9N.d.cts} +1 -1
- package/dist/{protected-resource-metadata-Cprrv0mt.d.cts → protected-resource-metadata-CfBVsqIk.d.mts} +1 -1
- package/dist/{schemas-C56no6bv.cjs → schemas-DNPVDvkd.cjs} +28 -1
- package/dist/{schemas-CJQcc97N.mjs → schemas-HW2FDsvz.mjs} +23 -2
- package/dist/schemas.cjs +3 -2
- package/dist/schemas.d.cts +24 -3
- package/dist/schemas.d.mts +24 -3
- package/dist/schemas.mjs +3 -3
- package/package.json +1 -1
- package/src/adapter.ts +245 -29
- package/src/api-definition.ts +12 -16
- package/src/api.ts +7 -3
- package/src/brand.ts +29 -0
- package/src/config.ts +51 -10
- package/src/configured.ts +13 -6
- package/src/define-config.ts +118 -39
- package/src/generator.ts +363 -46
- package/src/group-routes.ts +106 -0
- package/src/groups.ts +140 -0
- package/src/handler-pipeline.ts +78 -19
- package/src/index.ts +15 -6
- package/src/job-runner.ts +5 -0
- package/src/job-transport.ts +3 -3
- package/src/job.ts +8 -6
- package/src/jobs-dev-runner.ts +6 -0
- package/src/jobs.ts +61 -8
- package/src/kizuna.ts +56 -33
- package/src/plugin-server.ts +129 -19
- package/src/plugin.ts +269 -127
- package/src/routes.ts +80 -32
- package/src/schemas.ts +1 -0
- package/src/tool-answer.ts +21 -0
- package/src/tool-definitions.ts +166 -0
- package/src/tool-events.ts +90 -18
- package/src/tool-records.ts +11 -3
- package/src/tool-runner.ts +298 -0
- package/src/types.ts +90 -24
- package/src/zod-internals.ts +22 -5
- package/src/zod-meta.ts +7 -2
- package/dist/adapter-BGfMqEkM.d.cts +0 -563
- package/dist/adapter-Ci3cfcoT.d.mts +0 -563
- package/dist/api-definition-BHnh15zD.d.mts +0 -803
- package/dist/api-definition-DQj-ewHy.d.cts +0 -803
- package/dist/error-response-BBGSdgYw.d.mts +0 -67
- package/dist/error-response-Do38sr-9.d.cts +0 -67
- package/dist/plugin-Cz0kn6Lk.d.mts +0 -830
- package/dist/plugin-DhKvx_T0.d.cts +0 -830
- package/src/tags.ts +0 -67
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
//#region src/error-response.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* RFC 9457 Problem Details, the single error schema used across kizuna.
|
|
6
|
-
*
|
|
7
|
-
* Matches the shape returned by `deny()` in guards, validation errors,
|
|
8
|
-
* and all built-in error responses (404, 405, 415, etc.).
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { ProblemDetailsSchema } from 'kizunajs/schemas';
|
|
12
|
-
*
|
|
13
|
-
* const routes = k.routes({
|
|
14
|
-
* getUser: {
|
|
15
|
-
* method: 'GET',
|
|
16
|
-
* path: '/users/:id',
|
|
17
|
-
* responses: {
|
|
18
|
-
* 200: UserSchema,
|
|
19
|
-
* 404: ProblemDetailsSchema,
|
|
20
|
-
* },
|
|
21
|
-
* },
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* Add domain fields as RFC 9457 **extension members** with native `.extend`, inline:
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* responses: {
|
|
29
|
-
* 409: ProblemDetailsSchema.extend({
|
|
30
|
-
* conflictingId: z.string(),
|
|
31
|
-
* }),
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* or as a named component (appears in the OpenAPI spec) via `Kizuna.model`:
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* export const ConflictError = Kizuna.model({
|
|
39
|
-
* title: 'ConflictError',
|
|
40
|
-
* schema: ProblemDetailsSchema.extend({
|
|
41
|
-
* conflictingId: z.string(),
|
|
42
|
-
* }),
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* The handler supplies `detail` plus any extensions; `type`/`title`/`status` are
|
|
47
|
-
* auto-filled. Extension members are also how an API migrating onto kizuna keeps its
|
|
48
|
-
* existing error fields (e.g. `errorCode`, `requestId`), old clients still read them.
|
|
49
|
-
*/
|
|
50
|
-
declare const ProblemDetailsSchema: z.ZodObject<{
|
|
51
|
-
type: z.ZodString;
|
|
52
|
-
title: z.ZodString;
|
|
53
|
-
status: z.ZodNumber;
|
|
54
|
-
detail: z.ZodString;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
/**
|
|
57
|
-
* Type guard for an RFC 9457 Problem Details body, the shared shape behind every kizuna
|
|
58
|
-
* error response (validation failures, guards, handler errors, built-in 404/405/415, …).
|
|
59
|
-
*/
|
|
60
|
-
declare function isProblemDetails(body: unknown): body is {
|
|
61
|
-
type: string;
|
|
62
|
-
title: string;
|
|
63
|
-
status: number;
|
|
64
|
-
detail: string;
|
|
65
|
-
};
|
|
66
|
-
//#endregion
|
|
67
|
-
export { isProblemDetails as n, ProblemDetailsSchema as t };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
//#region src/error-response.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* RFC 9457 Problem Details, the single error schema used across kizuna.
|
|
6
|
-
*
|
|
7
|
-
* Matches the shape returned by `deny()` in guards, validation errors,
|
|
8
|
-
* and all built-in error responses (404, 405, 415, etc.).
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { ProblemDetailsSchema } from 'kizunajs/schemas';
|
|
12
|
-
*
|
|
13
|
-
* const routes = k.routes({
|
|
14
|
-
* getUser: {
|
|
15
|
-
* method: 'GET',
|
|
16
|
-
* path: '/users/:id',
|
|
17
|
-
* responses: {
|
|
18
|
-
* 200: UserSchema,
|
|
19
|
-
* 404: ProblemDetailsSchema,
|
|
20
|
-
* },
|
|
21
|
-
* },
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* Add domain fields as RFC 9457 **extension members** with native `.extend`, inline:
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* responses: {
|
|
29
|
-
* 409: ProblemDetailsSchema.extend({
|
|
30
|
-
* conflictingId: z.string(),
|
|
31
|
-
* }),
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* or as a named component (appears in the OpenAPI spec) via `Kizuna.model`:
|
|
36
|
-
*
|
|
37
|
-
* ```ts
|
|
38
|
-
* export const ConflictError = Kizuna.model({
|
|
39
|
-
* title: 'ConflictError',
|
|
40
|
-
* schema: ProblemDetailsSchema.extend({
|
|
41
|
-
* conflictingId: z.string(),
|
|
42
|
-
* }),
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* The handler supplies `detail` plus any extensions; `type`/`title`/`status` are
|
|
47
|
-
* auto-filled. Extension members are also how an API migrating onto kizuna keeps its
|
|
48
|
-
* existing error fields (e.g. `errorCode`, `requestId`), old clients still read them.
|
|
49
|
-
*/
|
|
50
|
-
declare const ProblemDetailsSchema: z.ZodObject<{
|
|
51
|
-
type: z.ZodString;
|
|
52
|
-
title: z.ZodString;
|
|
53
|
-
status: z.ZodNumber;
|
|
54
|
-
detail: z.ZodString;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
/**
|
|
57
|
-
* Type guard for an RFC 9457 Problem Details body, the shared shape behind every kizuna
|
|
58
|
-
* error response (validation failures, guards, handler errors, built-in 404/405/415, …).
|
|
59
|
-
*/
|
|
60
|
-
declare function isProblemDetails(body: unknown): body is {
|
|
61
|
-
type: string;
|
|
62
|
-
title: string;
|
|
63
|
-
status: number;
|
|
64
|
-
detail: string;
|
|
65
|
-
};
|
|
66
|
-
//#endregion
|
|
67
|
-
export { isProblemDetails as n, ProblemDetailsSchema as t };
|