@fuzdev/fuz_app 0.157.0 → 0.158.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/dist/actions/CLAUDE.md +1 -0
- package/dist/actions/compile_action_registry.d.ts +5 -1
- package/dist/actions/compile_action_registry.d.ts.map +1 -1
- package/dist/actions/compile_action_registry.js +8 -1
- package/dist/auth/CLAUDE.md +2 -1
- package/dist/auth/actor_lookup_action_specs.d.ts +184 -40
- package/dist/auth/actor_lookup_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_lookup_action_specs.js +16 -14
- package/dist/auth/actor_search_action_specs.d.ts +180 -40
- package/dist/auth/actor_search_action_specs.d.ts.map +1 -1
- package/dist/auth/actor_search_action_specs.js +12 -15
- package/dist/http/CLAUDE.md +13 -6
- package/dist/http/error_schemas.d.ts +5 -2
- package/dist/http/error_schemas.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +7 -4
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/http/route_spec.js +26 -5
- package/dist/http/schema_helpers.d.ts +21 -3
- package/dist/http/schema_helpers.d.ts.map +1 -1
- package/dist/http/schema_helpers.js +34 -4
- package/dist/http/surface.d.ts +2 -0
- package/dist/http/surface.d.ts.map +1 -1
- package/dist/http/surface.js +6 -2
- package/dist/primitive_schemas.d.ts +1 -1
- package/dist/primitive_schemas.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.d.ts +19 -4
- package/dist/primitive_schemas_fuz.d.ts.map +1 -1
- package/dist/primitive_schemas_fuz.js +22 -4
- package/dist/schema_issues.d.ts +11 -0
- package/dist/schema_issues.d.ts.map +1 -1
- package/dist/schema_issues.js +15 -0
- package/package.json +1 -1
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
*
|
|
72
72
|
* @module
|
|
73
73
|
*/
|
|
74
|
-
import {
|
|
74
|
+
import { type Infer } from '@fuzdev/fuz_schema/schema.ts';
|
|
75
75
|
/**
|
|
76
76
|
* Hard cap on the number of rows returned per call. Bounds the search-result
|
|
77
77
|
* enumeration surface. Default limit (`ACTOR_SEARCH_LIMIT_DEFAULT`) is
|
|
@@ -89,23 +89,71 @@ export declare const ACTOR_SEARCH_QUERY_LENGTH_MAX = 50;
|
|
|
89
89
|
/**
|
|
90
90
|
* Reason: `scope_ids` was empty and the caller is not admin. Distinct from
|
|
91
91
|
* standard `invalid_params` issues so the visiones picker can surface a
|
|
92
|
-
* specific "pick a scope first" message rather than echoing
|
|
92
|
+
* specific "pick a scope first" message rather than echoing validation issues.
|
|
93
93
|
*/
|
|
94
94
|
export declare const ERROR_ACTOR_SEARCH_SCOPE_REQUIRED: "actor_search_scope_required";
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
limit
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
/** Input for `actor_search`, a `@fuzdev/fuz_schema` schema. */
|
|
96
|
+
export declare const ActorSearchInput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
97
|
+
query: string;
|
|
98
|
+
limit?: number | undefined;
|
|
99
|
+
scope_ids?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[] | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
query: string;
|
|
102
|
+
limit?: number | undefined;
|
|
103
|
+
scope_ids?: string[] | undefined;
|
|
104
|
+
}, "object", {
|
|
105
|
+
query: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
106
|
+
scope_ids: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[] | undefined, string[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
107
|
+
readonly '~types'?: {
|
|
108
|
+
readonly input: string;
|
|
109
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
110
|
+
} | undefined;
|
|
111
|
+
}>>>;
|
|
112
|
+
limit: import("@fuzdev/fuz_schema/schema.ts").Schema<number | undefined, number | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>>>;
|
|
113
|
+
}>;
|
|
114
|
+
export type ActorSearchInput = Infer<typeof ActorSearchInput>;
|
|
115
|
+
/** Output for `actor_search`, a `@fuzdev/fuz_schema` schema. */
|
|
116
|
+
export declare const ActorSearchOutput: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
117
|
+
actors: {
|
|
118
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
119
|
+
username: string;
|
|
120
|
+
display_name?: string | undefined;
|
|
121
|
+
}[];
|
|
122
|
+
}, {
|
|
123
|
+
actors: {
|
|
124
|
+
id: string;
|
|
125
|
+
username: string;
|
|
126
|
+
display_name?: string | undefined;
|
|
127
|
+
}[];
|
|
128
|
+
}, "object", {
|
|
129
|
+
actors: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
130
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
131
|
+
username: string;
|
|
132
|
+
display_name?: string | undefined;
|
|
133
|
+
}[], {
|
|
134
|
+
id: string;
|
|
135
|
+
username: string;
|
|
136
|
+
display_name?: string | undefined;
|
|
137
|
+
}[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
138
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
139
|
+
username: string;
|
|
140
|
+
display_name?: string | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
id: string;
|
|
143
|
+
username: string;
|
|
144
|
+
display_name?: string | undefined;
|
|
145
|
+
}, "object", {
|
|
146
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
147
|
+
readonly '~types'?: {
|
|
148
|
+
readonly input: string;
|
|
149
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
150
|
+
} | undefined;
|
|
151
|
+
};
|
|
152
|
+
username: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
153
|
+
display_name: import("@fuzdev/fuz_schema/schema.ts").Schema<string | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
154
|
+
}>>;
|
|
155
|
+
}>;
|
|
156
|
+
export type ActorSearchOutput = Infer<typeof ActorSearchOutput>;
|
|
109
157
|
export declare const actor_search_action_spec: {
|
|
110
158
|
method: string;
|
|
111
159
|
kind: "request_response";
|
|
@@ -115,18 +163,64 @@ export declare const actor_search_action_spec: {
|
|
|
115
163
|
actor: "none";
|
|
116
164
|
};
|
|
117
165
|
side_effects: false;
|
|
118
|
-
input:
|
|
119
|
-
query:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
166
|
+
input: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
167
|
+
query: string;
|
|
168
|
+
limit?: number | undefined;
|
|
169
|
+
scope_ids?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[] | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
query: string;
|
|
172
|
+
limit?: number | undefined;
|
|
173
|
+
scope_ids?: string[] | undefined;
|
|
174
|
+
}, "object", {
|
|
175
|
+
query: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
176
|
+
scope_ids: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[] | undefined, string[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
177
|
+
readonly '~types'?: {
|
|
178
|
+
readonly input: string;
|
|
179
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
180
|
+
} | undefined;
|
|
181
|
+
}>>>;
|
|
182
|
+
limit: import("@fuzdev/fuz_schema/schema.ts").Schema<number | undefined, number | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>>>;
|
|
183
|
+
}>;
|
|
184
|
+
output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
185
|
+
actors: {
|
|
186
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
187
|
+
username: string;
|
|
188
|
+
display_name?: string | undefined;
|
|
189
|
+
}[];
|
|
190
|
+
}, {
|
|
191
|
+
actors: {
|
|
192
|
+
id: string;
|
|
193
|
+
username: string;
|
|
194
|
+
display_name?: string | undefined;
|
|
195
|
+
}[];
|
|
196
|
+
}, "object", {
|
|
197
|
+
actors: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
198
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
199
|
+
username: string;
|
|
200
|
+
display_name?: string | undefined;
|
|
201
|
+
}[], {
|
|
202
|
+
id: string;
|
|
203
|
+
username: string;
|
|
204
|
+
display_name?: string | undefined;
|
|
205
|
+
}[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
206
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
207
|
+
username: string;
|
|
208
|
+
display_name?: string | undefined;
|
|
209
|
+
}, {
|
|
210
|
+
id: string;
|
|
211
|
+
username: string;
|
|
212
|
+
display_name?: string | undefined;
|
|
213
|
+
}, "object", {
|
|
214
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
215
|
+
readonly '~types'?: {
|
|
216
|
+
readonly input: string;
|
|
217
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
218
|
+
} | undefined;
|
|
219
|
+
};
|
|
220
|
+
username: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
221
|
+
display_name: import("@fuzdev/fuz_schema/schema.ts").Schema<string | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
222
|
+
}>>;
|
|
223
|
+
}>;
|
|
130
224
|
async: true;
|
|
131
225
|
rate_limit: "account";
|
|
132
226
|
error_reasons: "actor_search_scope_required"[];
|
|
@@ -146,18 +240,64 @@ export declare const all_actor_search_action_specs: readonly [{
|
|
|
146
240
|
actor: "none";
|
|
147
241
|
};
|
|
148
242
|
side_effects: false;
|
|
149
|
-
input:
|
|
150
|
-
query:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
243
|
+
input: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
244
|
+
query: string;
|
|
245
|
+
limit?: number | undefined;
|
|
246
|
+
scope_ids?: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[] | undefined;
|
|
247
|
+
}, {
|
|
248
|
+
query: string;
|
|
249
|
+
limit?: number | undefined;
|
|
250
|
+
scope_ids?: string[] | undefined;
|
|
251
|
+
}, "object", {
|
|
252
|
+
query: import("@fuzdev/fuz_schema/schema.ts").PipeSchema<string, import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>;
|
|
253
|
+
scope_ids: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[] | undefined, string[] | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">[], string[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
254
|
+
readonly '~types'?: {
|
|
255
|
+
readonly input: string;
|
|
256
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
257
|
+
} | undefined;
|
|
258
|
+
}>>>;
|
|
259
|
+
limit: import("@fuzdev/fuz_schema/schema.ts").Schema<number | undefined, number | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").PipeSchema<number, import("@fuzdev/fuz_schema/schema.ts").Schema<number, number, "number", undefined>>>>;
|
|
260
|
+
}>;
|
|
261
|
+
output: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
262
|
+
actors: {
|
|
263
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
264
|
+
username: string;
|
|
265
|
+
display_name?: string | undefined;
|
|
266
|
+
}[];
|
|
267
|
+
}, {
|
|
268
|
+
actors: {
|
|
269
|
+
id: string;
|
|
270
|
+
username: string;
|
|
271
|
+
display_name?: string | undefined;
|
|
272
|
+
}[];
|
|
273
|
+
}, "object", {
|
|
274
|
+
actors: import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
275
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
276
|
+
username: string;
|
|
277
|
+
display_name?: string | undefined;
|
|
278
|
+
}[], {
|
|
279
|
+
id: string;
|
|
280
|
+
username: string;
|
|
281
|
+
display_name?: string | undefined;
|
|
282
|
+
}[], "array", import("@fuzdev/fuz_schema/schema.ts").Schema<{
|
|
283
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">;
|
|
284
|
+
username: string;
|
|
285
|
+
display_name?: string | undefined;
|
|
286
|
+
}, {
|
|
287
|
+
id: string;
|
|
288
|
+
username: string;
|
|
289
|
+
display_name?: string | undefined;
|
|
290
|
+
}, "object", {
|
|
291
|
+
id: import("@fuzdev/fuz_schema/schema.ts").Schema<import("@fuzdev/fuz_schema/schema.ts").Branded<string, "Uuid">, string, "pipe", readonly (import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"string"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"number"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"bigint"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"boolean"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"check"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"uuid"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"unknown"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"record"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"array"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"union"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"literal"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"nullable"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"optional"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"transform"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"pipe"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"lazy"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"regex"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"to_lower_case"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"one_of"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"with_default_fn"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"loose_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"strip_object"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"object_with_rest"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"variant"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_length"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"min_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"max_value"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"safe_integer"> | import("@fuzdev/fuz_schema/schema.ts").SchemaOfKind<"iso_datetime">)[]> & {
|
|
292
|
+
readonly '~types'?: {
|
|
293
|
+
readonly input: string;
|
|
294
|
+
readonly first: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
295
|
+
} | undefined;
|
|
296
|
+
};
|
|
297
|
+
username: import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>;
|
|
298
|
+
display_name: import("@fuzdev/fuz_schema/schema.ts").Schema<string | undefined, string | undefined, "optional", import("@fuzdev/fuz_schema/schema.ts").SchemaWrapperDef<import("@fuzdev/fuz_schema/schema.ts").Schema<string, string, "string", undefined>>>;
|
|
299
|
+
}>>;
|
|
300
|
+
}>;
|
|
161
301
|
async: true;
|
|
162
302
|
rate_limit: "account";
|
|
163
303
|
error_reasons: "actor_search_scope_required"[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor_search_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/actor_search_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;
|
|
1
|
+
{"version":3,"file":"actor_search_action_specs.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/auth/actor_search_action_specs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAGH,OAAO,EASN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAOtC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,gDAAgD;AAChD,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAG,6BAAsC,CAAC;AAExF,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;EAgB3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,gEAAgE;AAChE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEhE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcA,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
|
|
@@ -71,8 +71,9 @@
|
|
|
71
71
|
*
|
|
72
72
|
* @module
|
|
73
73
|
*/
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
74
|
+
import { meta } from '@fuzdev/fuz_schema/meta.ts';
|
|
75
|
+
import { array, integer, max_value, min_value, number, object, optional, pipe } from '@fuzdev/fuz_schema/schema.ts';
|
|
76
|
+
import { Uuid, bounded_string } from '../primitive_schemas_fuz.js';
|
|
76
77
|
import { ActorLookupEntryJson } from './actor_lookup_action_specs.js';
|
|
77
78
|
/**
|
|
78
79
|
* Hard cap on the number of rows returned per call. Bounds the search-result
|
|
@@ -91,29 +92,25 @@ export const ACTOR_SEARCH_QUERY_LENGTH_MAX = 50;
|
|
|
91
92
|
/**
|
|
92
93
|
* Reason: `scope_ids` was empty and the caller is not admin. Distinct from
|
|
93
94
|
* standard `invalid_params` issues so the visiones picker can surface a
|
|
94
|
-
* specific "pick a scope first" message rather than echoing
|
|
95
|
+
* specific "pick a scope first" message rather than echoing validation issues.
|
|
95
96
|
*/
|
|
96
97
|
export const ERROR_ACTOR_SEARCH_SCOPE_REQUIRED = 'actor_search_scope_required';
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
/** Input for `actor_search`, a `@fuzdev/fuz_schema` schema. */
|
|
99
|
+
export const ActorSearchInput = object({
|
|
100
|
+
query: meta(bounded_string({ min: 1, max: ACTOR_SEARCH_QUERY_LENGTH_MAX }), {
|
|
99
101
|
description: `Case-insensitive prefix match against \`actor.name\`. Length 1–${ACTOR_SEARCH_QUERY_LENGTH_MAX}.`,
|
|
100
102
|
sensitivity: 'personal'
|
|
101
103
|
}),
|
|
102
|
-
scope_ids:
|
|
104
|
+
scope_ids: meta(optional(array(Uuid)), {
|
|
103
105
|
description: 'Restrict results to actors holding a role_grant on any of these scopes. Required (non-empty) for non-admin callers; admin callers may omit or pass empty for unbounded search. Caller is responsible for pre-filtering against their own authority — the SQL filter does not enforce it.'
|
|
104
106
|
}),
|
|
105
|
-
limit:
|
|
106
|
-
.number()
|
|
107
|
-
.int()
|
|
108
|
-
.min(1)
|
|
109
|
-
.max(ACTOR_SEARCH_LIMIT_MAX)
|
|
110
|
-
.optional()
|
|
111
|
-
.meta({
|
|
107
|
+
limit: meta(optional(pipe(number, integer, min_value(1), max_value(ACTOR_SEARCH_LIMIT_MAX))), {
|
|
112
108
|
description: `Maximum rows to return. Defaults to ${ACTOR_SEARCH_LIMIT_DEFAULT}, hard cap ${ACTOR_SEARCH_LIMIT_MAX}.`
|
|
113
109
|
})
|
|
114
110
|
});
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
/** Output for `actor_search`, a `@fuzdev/fuz_schema` schema. */
|
|
112
|
+
export const ActorSearchOutput = object({
|
|
113
|
+
actors: array(ActorLookupEntryJson)
|
|
117
114
|
});
|
|
118
115
|
export const actor_search_action_spec = {
|
|
119
116
|
method: 'actor_search',
|
package/dist/http/CLAUDE.md
CHANGED
|
@@ -60,10 +60,14 @@ consumers.
|
|
|
60
60
|
|
|
61
61
|
Every schema field takes a Zod or a `@fuzdev/fuz_schema` schema
|
|
62
62
|
(`ValidationSchema`, `schema_issues.ts`), validated through `parse_any`, its
|
|
63
|
-
refusals answered with `to_wire_issues`'s `WireIssue`s either way. A
|
|
64
|
-
|
|
65
|
-
(`
|
|
66
|
-
|
|
63
|
+
refusals answered with `to_wire_issues`'s `WireIssue`s either way. A slot
|
|
64
|
+
holding a value of neither library throws at registration, naming the route
|
|
65
|
+
and the slot (`assert_validation_schema`) — in an assembled app, surface
|
|
66
|
+
generation (`schema_to_surface`) reads most slots first and throws the same
|
|
67
|
+
refusal; `params`, `query` and an `errors` entry
|
|
68
|
+
may be absent. A fuz_schema `params` or `query` must be an object schema
|
|
69
|
+
under any wrappers (`get_schema_entries`); `apply_route_specs` throws naming
|
|
70
|
+
the route on one that isn't. Input/output naming mirrors SAES `ActionSpec`. Use a strict object for
|
|
67
71
|
inputs — `z.strictObject()` or fuz_schema's `object` — the surface diagnostic
|
|
68
72
|
warns on non-strict objects because unknown keys are silently stripped by Zod
|
|
69
73
|
4's default `z.object()` (and by fuz_schema's `strip_object`, kept by its
|
|
@@ -178,7 +182,9 @@ Pair every schema with the `z.infer` type export.
|
|
|
178
182
|
### Three-layer error-schema merge
|
|
179
183
|
|
|
180
184
|
`merge_error_schemas(spec, middleware_errors?)` (in `http/schema_helpers.ts`)
|
|
181
|
-
merges three layers, later overrides earlier at the same status code
|
|
185
|
+
merges three layers, later overrides earlier at the same status code; an
|
|
186
|
+
entry left `undefined` is absent (`strip_undefined_error_schemas`), so it
|
|
187
|
+
overrides nothing:
|
|
182
188
|
|
|
183
189
|
1. **Derived** — from `derive_error_schemas({auth, has_input?, has_params?, has_query?, rate_limit?, checks_content_type?})`:
|
|
184
190
|
- `has_input || has_params || has_query` → 400 `ValidationError`
|
|
@@ -249,10 +255,11 @@ Key helpers:
|
|
|
249
255
|
- `json_has_own_proto_key(value)` — whether any object in a parsed JSON value has an own `__proto__` key, by an iterative walk (no recursion — `JSON.parse` nests deeper than the call stack); the dispatcher refuses such params with `ERROR_PARAMS_PROTO_KEY`. Twin of the Rust `fuz_http::json_has_own_proto_key`
|
|
250
256
|
- `safe_parse_dropping_unknown_keys(schema, value)` — the forward-compatible read of a remote-authored payload, Zod or fuz_schema, returning `parse_any`'s `{ok, value}` / `{ok: false, issues}`: while every issue is an unknown key (`unknown_key_targets`), strips them from a copy and reparses — after the first parse that reports unknown keys, one schema-guided pass deletes every key a strict fuz_schema `object` doesn't name anywhere the schema reaches (entries, array items, record values, the `variant` option), as a fuz_schema parse reports at most a hundred issues; a key under a fuz_schema `union` is never stripped (the union fails as one issue of its own), and a later `pipe` stage is stripped only as reported — until nothing is left to strip, capped at `UNKNOWN_KEY_PASSES_MAX` passes (the last failure returned past it); any other issue still fails. A Zod union of strict objects reports the key and is stripped, a fuz_schema `union` reports one issue of its own and is not. Used for response `result`s (`ActionEvent`) and peer replies (`peer/ping`); matches serde's ignore-unknown-fields default on the Rust spine
|
|
251
257
|
- `is_strict_object_schema(schema)` — detects `z.strictObject()` by checking `schema.def.catchall instanceof z.ZodNever`, or a fuz_schema `object` (not `strip_object` / `loose_object`); a fuz_schema `pipe` is read through to its first schema when no stage is a `transform` (so a refined `object` reads strict), while any Zod `ZodPipe` — even `O.pipe(O)` with no transform — reads not strict
|
|
252
|
-
- `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — Zod or fuz_schema → JSON Schema (`z.toJSONSchema` or fuz_schema's `to_json_schema`, by `is_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `z.custom()`, a fuz_schema `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `z.unknown()` / `z.any()`) or one an emitter refuses outright throws, prefixed with `source` — so a root-level transform output (`z.unknown().transform(f)` included), `z.custom()` or `z.date()` fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
|
|
258
|
+
- `schema_to_surface(schema, {io?, source?, on_unrepresentable?}?)` — throws first on a value of neither library (`assert_validation_schema`, naming `source`, so an assembled app's slot of neither library fails boot as registration would refuse it, not as an unwritable JSON Schema); Zod or fuz_schema → JSON Schema (`z.toJSONSchema` or fuz_schema's `to_json_schema`, by `is_schema`), on the side `io` names (`'output'` by default), with `$schema` and `default` keys stripped recursively (defaults may be non-deterministic; `$schema` is snapshot noise). `null` for a null or void schema. A part JSON Schema can't say (an output-side transform, a `z.custom()`, a fuz_schema `check`) is left out or written as `{}` (`unrepresentable: 'any'`) and reported to `on_unrepresentable`; a schema with nothing describable (`{}` from a schema other than `z.unknown()` / `z.any()`) or one an emitter refuses outright throws, prefixed with `source` — so a root-level transform output (`z.unknown().transform(f)` included), `z.custom()` or `z.date()` fails server assembly. It never answers `null` for a failure, which would read as "no input" and drop the schema from every suite that reads the surface
|
|
253
259
|
- `middleware_applies(mw_path, route_path)` — Hono pattern matching: `'*'`, exact, `'/api/*'` prefix (handles `prefix.slice(0, -1)` so `/api/*` also matches the bare `/api`)
|
|
254
260
|
- `middleware_spec_applies(spec, route_path)` — the layer runs on the route: its `path` applies and none of its `carve_outs` does; what surface generation merges middleware errors by
|
|
255
261
|
- `merge_error_schemas(spec, middleware_errors?)` — the three-layer merge described above
|
|
262
|
+
- `strip_undefined_error_schemas(errors)` — an error-schema map without its `undefined` entries, what the merge and `collect_middleware_errors` read each layer through
|
|
256
263
|
|
|
257
264
|
## Surface Generation
|
|
258
265
|
|
|
@@ -316,8 +316,11 @@ export type AccountVanishedError = z.infer<typeof AccountVanishedError>;
|
|
|
316
316
|
* returns its Zod-only form, `DerivedErrorSchemas`.
|
|
317
317
|
*/
|
|
318
318
|
export type RouteErrorSchemas = Partial<Record<number, ValidationSchema>>;
|
|
319
|
-
/**
|
|
320
|
-
|
|
319
|
+
/**
|
|
320
|
+
* The error schemas `derive_error_schemas` builds, all of them Zod, with no
|
|
321
|
+
* entry left `undefined`.
|
|
322
|
+
*/
|
|
323
|
+
export type DerivedErrorSchemas = Record<number, z.ZodType>;
|
|
321
324
|
/**
|
|
322
325
|
* Rate limit key type — declares what a route or RPC action's rate limiter
|
|
323
326
|
* is keyed on.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_schemas.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/error_schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvE,0CAA0C;AAC1C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAG,kBAA2B,CAAC;AAIlE,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,EAAG,yBAAkC,CAAC;AAEhF,+CAA+C;AAC/C,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAElF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,EAAG,0BAAmC,CAAC;AAElF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,EAAG,sBAA+B,CAAC;AAE1E,yCAAyC;AACzC,eAAO,MAAM,yBAAyB,EAAG,qBAA8B,CAAC;AAExE,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,EAAG,qBAA8B,CAAC;AAExE,qDAAqD;AACrD,eAAO,MAAM,uBAAuB,EAAG,mBAA4B,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAG,qBAA8B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AAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;;;EAAoC,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,GAAI,6EAOlC,yBAAyB,KAAG,mBA8C9B,CAAC"}
|
|
@@ -301,15 +301,18 @@ export declare const apply_middleware_specs: (app: Hono, specs: Array<Middleware
|
|
|
301
301
|
* registries (`compile_action_registry`) share the same helper with
|
|
302
302
|
* `input` only — `ActionSpec` has no `query` shape.
|
|
303
303
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
304
|
+
* Every schema slot (`params`, `query`, `input`, `output`, each `errors`
|
|
305
|
+
* entry) must hold a Zod or a `@fuzdev/fuz_schema` schema
|
|
306
|
+
* (`assert_validation_schema`): a value of neither library throws naming the
|
|
307
|
+
* route and the slot. A `@fuzdev/fuz_schema` `params` or `query` must be an
|
|
308
|
+
* object schema (`get_schema_entries`), as the path params and query string
|
|
309
|
+
* are an object: one that isn't throws naming the route.
|
|
307
310
|
*
|
|
308
311
|
* @param resolve_auth_guards - maps `RouteAuth` to middleware — use `fuz_auth_guard_resolver` from `auth/auth_guard_resolver.ts`
|
|
309
312
|
* @param authorize - optional authorization phase; runs after the pre-authorization guards and before the post-authorization guards
|
|
310
313
|
* @param db - used for transaction wrapping and `RouteContext`
|
|
311
314
|
* @mutates `app`
|
|
312
|
-
* @throws Error if two specs share the same `method` + `path` (each combination must be unique), if any spec violates a cross-axis auth invariant or the actor-acting biconditional, or if a fuz_schema `params` or `query` is not an object schema
|
|
315
|
+
* @throws Error if two specs share the same `method` + `path` (each combination must be unique), if a schema slot holds a value of neither library, if any spec violates a cross-axis auth invariant or the actor-acting biconditional, or if a fuz_schema `params` or `query` is not an object schema
|
|
313
316
|
*/
|
|
314
317
|
export declare const apply_route_specs: (app: Hono, specs: Array<RouteSpec>, resolve_auth_guards: AuthGuardResolver, log: Logger, db: Db, authorize?: AuthorizationHandler) => void;
|
|
315
318
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route_spec.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/http/route_spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAW,IAAI,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAOjB,MAAM,oBAAoB,CAAC;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G;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC,SAAS,CAAC,KAAG,KAAK,CAAC,SAAS,CAK3F,CAAC"}
|
package/dist/http/route_spec.js
CHANGED
|
@@ -23,7 +23,7 @@ import { jsonrpc_error_code_to_http_status, jsonrpc_error_code_to_name, dev_only
|
|
|
23
23
|
import { is_null_schema, merge_error_schemas } from './schema_helpers.js';
|
|
24
24
|
import { dispatch_with_post_commit_rollback } from './pending_effects.js';
|
|
25
25
|
import { assert_route_auth_acting_biconditional, assert_route_auth_invariants } from './auth_shape.js';
|
|
26
|
-
import { parse_any, to_wire_issues } from '../schema_issues.js';
|
|
26
|
+
import { assert_validation_schema, parse_any, to_wire_issues } from '../schema_issues.js';
|
|
27
27
|
export function get_route_input(c, _schema) {
|
|
28
28
|
return c.get('validated_input');
|
|
29
29
|
}
|
|
@@ -356,15 +356,18 @@ const build_rest_error_body = (err) => {
|
|
|
356
356
|
* registries (`compile_action_registry`) share the same helper with
|
|
357
357
|
* `input` only — `ActionSpec` has no `query` shape.
|
|
358
358
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
359
|
+
* Every schema slot (`params`, `query`, `input`, `output`, each `errors`
|
|
360
|
+
* entry) must hold a Zod or a `@fuzdev/fuz_schema` schema
|
|
361
|
+
* (`assert_validation_schema`): a value of neither library throws naming the
|
|
362
|
+
* route and the slot. A `@fuzdev/fuz_schema` `params` or `query` must be an
|
|
363
|
+
* object schema (`get_schema_entries`), as the path params and query string
|
|
364
|
+
* are an object: one that isn't throws naming the route.
|
|
362
365
|
*
|
|
363
366
|
* @param resolve_auth_guards - maps `RouteAuth` to middleware — use `fuz_auth_guard_resolver` from `auth/auth_guard_resolver.ts`
|
|
364
367
|
* @param authorize - optional authorization phase; runs after the pre-authorization guards and before the post-authorization guards
|
|
365
368
|
* @param db - used for transaction wrapping and `RouteContext`
|
|
366
369
|
* @mutates `app`
|
|
367
|
-
* @throws Error if two specs share the same `method` + `path` (each combination must be unique), if any spec violates a cross-axis auth invariant or the actor-acting biconditional, or if a fuz_schema `params` or `query` is not an object schema
|
|
370
|
+
* @throws Error if two specs share the same `method` + `path` (each combination must be unique), if a schema slot holds a value of neither library, if any spec violates a cross-axis auth invariant or the actor-acting biconditional, or if a fuz_schema `params` or `query` is not an object schema
|
|
368
371
|
*/
|
|
369
372
|
export const apply_route_specs = (app, specs, resolve_auth_guards, log, db, authorize) => {
|
|
370
373
|
const registered = new Set();
|
|
@@ -374,6 +377,7 @@ export const apply_route_specs = (app, specs, resolve_auth_guards, log, db, auth
|
|
|
374
377
|
throw new Error(`Duplicate route: ${route_key} — each method+path combination must be unique`);
|
|
375
378
|
}
|
|
376
379
|
registered.add(route_key);
|
|
380
|
+
assert_schema_slots(spec, route_key);
|
|
377
381
|
assert_object_slot(spec.params, 'params', route_key);
|
|
378
382
|
assert_object_slot(spec.query, 'query', route_key);
|
|
379
383
|
assert_route_auth_invariants(spec.auth, `Route "${route_key}"`);
|
|
@@ -419,6 +423,23 @@ export const apply_route_specs = (app, specs, resolve_auth_guards, log, db, auth
|
|
|
419
423
|
app.on(spec.method, [spec.path], ...content_type_check, ...params_validation, ...query_validation, ...pre_authorization_guards, ...authorization, ...post_authorization_guards, ...input_validation, handler);
|
|
420
424
|
}
|
|
421
425
|
};
|
|
426
|
+
// throws unless every schema slot holds a Zod or fuz_schema schema; `params`,
|
|
427
|
+
// `query` and an `errors` entry may be absent
|
|
428
|
+
const assert_schema_slots = (spec, route_key) => {
|
|
429
|
+
const label = `Route "${route_key}"`;
|
|
430
|
+
if (spec.params !== undefined)
|
|
431
|
+
assert_validation_schema(spec.params, `${label}: params`);
|
|
432
|
+
if (spec.query !== undefined)
|
|
433
|
+
assert_validation_schema(spec.query, `${label}: query`);
|
|
434
|
+
assert_validation_schema(spec.input, `${label}: input`);
|
|
435
|
+
assert_validation_schema(spec.output, `${label}: output`);
|
|
436
|
+
if (spec.errors) {
|
|
437
|
+
for (const [status, schema] of Object.entries(spec.errors)) {
|
|
438
|
+
if (schema !== undefined)
|
|
439
|
+
assert_validation_schema(schema, `${label}: errors.${status}`);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
};
|
|
422
443
|
// throws unless a fuz_schema `params` / `query` is an object schema under any
|
|
423
444
|
// wrappers; a Zod one is a `z.ZodObject` by its type
|
|
424
445
|
const assert_object_slot = (schema, slot, route_key) => {
|
|
@@ -173,6 +173,13 @@ export interface SchemaToSurfaceOptions {
|
|
|
173
173
|
* Convert a Zod or `@fuzdev/fuz_schema` schema to its JSON Schema for the
|
|
174
174
|
* surface, with `$schema` and `default` stripped at every depth.
|
|
175
175
|
*
|
|
176
|
+
* A value of neither library throws first (`assert_validation_schema`),
|
|
177
|
+
* naming `options.source`, so a slot that surface generation reads before
|
|
178
|
+
* any registration does — a route's, an event's `params`, a `ws_endpoints`
|
|
179
|
+
* action's — fails server assembly naming the slot, as registration refuses
|
|
180
|
+
* a route's or action's slot, not as a JSON Schema the emitter could not
|
|
181
|
+
* write.
|
|
182
|
+
*
|
|
176
183
|
* Returns `null` for a null schema (`is_null_schema`) and a void schema
|
|
177
184
|
* (`is_void_schema`), in either library: no body, no params. Any other
|
|
178
185
|
* schema is written with its library's emitter (`to_json_schema` for fuz_schema, `z.toJSONSchema`
|
|
@@ -197,7 +204,7 @@ export interface SchemaToSurfaceOptions {
|
|
|
197
204
|
* @param schema - the schema to describe, Zod or fuz_schema
|
|
198
205
|
* @param options - the side to describe, the schema's name for errors, and a listener for gaps
|
|
199
206
|
* @returns the JSON Schema, or `null` for a null or void schema
|
|
200
|
-
* @throws Error naming `options.source` when the schema can't be written, or nothing of it can
|
|
207
|
+
* @throws Error naming `options.source` when the value is of neither library, when the schema can't be written, or when nothing of it can
|
|
201
208
|
*/
|
|
202
209
|
export declare const schema_to_surface: (schema: ValidationSchema, options?: SchemaToSurfaceOptions) => unknown;
|
|
203
210
|
/**
|
|
@@ -231,11 +238,22 @@ export declare const middleware_spec_applies: (spec: {
|
|
|
231
238
|
readonly path: string;
|
|
232
239
|
}> | null;
|
|
233
240
|
}, route_path: string) => boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Copy an error-schema map without its entries left `undefined`, so a
|
|
243
|
+
* status declared `undefined` reads as absent: it overrides nothing beneath
|
|
244
|
+
* it in a merge.
|
|
245
|
+
*
|
|
246
|
+
* @param errors - a route's or middleware's error schemas, keyed by status
|
|
247
|
+
* @returns the entries that hold a schema
|
|
248
|
+
*/
|
|
249
|
+
export declare const strip_undefined_error_schemas: (errors: RouteErrorSchemas) => Record<number, ValidationSchema>;
|
|
234
250
|
/**
|
|
235
251
|
* Merge auto-derived, middleware, and explicit error schemas for a route spec.
|
|
236
252
|
*
|
|
237
253
|
* Merge order: derived -> middleware -> explicit route errors.
|
|
238
|
-
* Later layers override earlier ones for the same status code
|
|
254
|
+
* Later layers override earlier ones for the same status code; an entry left
|
|
255
|
+
* `undefined` is absent (`strip_undefined_error_schemas`), so it leaves the
|
|
256
|
+
* layer beneath it in place.
|
|
239
257
|
*
|
|
240
258
|
* @param spec - the route spec (reads `method`, `auth`, `input`, `params`, `query`, `rate_limit`, `errors`)
|
|
241
259
|
* @param middleware_errors - errors contributed by middleware whose path matches the route
|
|
@@ -249,5 +267,5 @@ export declare const merge_error_schemas: (spec: {
|
|
|
249
267
|
query?: ValidationSchema;
|
|
250
268
|
rate_limit?: RateLimitKey;
|
|
251
269
|
errors?: RouteErrorSchemas;
|
|
252
|
-
}, middleware_errors?: RouteErrorSchemas | null) =>
|
|
270
|
+
}, middleware_errors?: RouteErrorSchemas | null) => Record<number, ValidationSchema> | null;
|
|
253
271
|
//# sourceMappingURL=schema_helpers.d.ts.map
|