silgi 0.39.5 → 0.39.7
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/cli/index.mjs +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +3 -0
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.d.mts
CHANGED
|
@@ -121,7 +121,7 @@ declare function getEventContext<T extends SilgiRuntimeContext>(event?: SilgiEve
|
|
|
121
121
|
*
|
|
122
122
|
* @param params - Schema configuration parameters
|
|
123
123
|
* @param params.path - Complete API path
|
|
124
|
-
* @param params.method - HTTP method(s) as an array (
|
|
124
|
+
* @param params.method - HTTP method(s) as an array (optional)
|
|
125
125
|
* @param params.setup - Schema definition for the specified methods
|
|
126
126
|
* @returns Route schema object with complete type information
|
|
127
127
|
*
|
|
@@ -140,8 +140,8 @@ declare function getEventContext<T extends SilgiRuntimeContext>(event?: SilgiEve
|
|
|
140
140
|
declare function createSchema<Path extends keyof Routers, Method extends HTTPMethod & string, UsedMethod extends readonly Method[], Schema extends HasPathParams<Path> extends true ? BaseMethodSchema & WithPathParams<Path> : BaseMethodSchema>(params: {
|
|
141
141
|
/** Complete API path */
|
|
142
142
|
path: Path;
|
|
143
|
-
/** HTTP method(s) this schema applies to (
|
|
144
|
-
method
|
|
143
|
+
/** HTTP method(s) this schema applies to (optional) */
|
|
144
|
+
method?: UsedMethod;
|
|
145
145
|
/** Schema definition */
|
|
146
146
|
setup: Schema;
|
|
147
147
|
}): {
|
package/dist/core/index.mjs
CHANGED
|
@@ -1030,6 +1030,9 @@ function getEventContext(event) {
|
|
|
1030
1030
|
function createSchema(params) {
|
|
1031
1031
|
const { path, method, setup } = params;
|
|
1032
1032
|
const result = {};
|
|
1033
|
+
if (!method) {
|
|
1034
|
+
throw new Error("Method is required createSchema " + path);
|
|
1035
|
+
}
|
|
1033
1036
|
for (let i = 0; i < method.length; i++) {
|
|
1034
1037
|
const methodName = method[i];
|
|
1035
1038
|
result[`${String(methodName)}:${path}`] = setup;
|