@congruent-stack/congruent-api 0.6.0 → 0.7.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/index.d.cts +18 -1
- package/dist/index.d.mts +18 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -30,7 +30,7 @@ type LowerCasedHttpMethod = Lowercase<HttpMethod>;
|
|
|
30
30
|
|
|
31
31
|
declare function response<TStatus extends HttpStatusCode, TDef extends IHttpMethodEndpointResponseDefinition<TStatus>>(definition: TDef): HttpMethodEndpointResponse<TStatus, TDef>;
|
|
32
32
|
interface IHttpMethodEndpointResponseDefinition<_TStatus extends HttpStatusCode> {
|
|
33
|
-
headers?:
|
|
33
|
+
headers?: z.ZodType;
|
|
34
34
|
body?: z.ZodType;
|
|
35
35
|
}
|
|
36
36
|
declare class HttpMethodEndpointResponse<TStatus extends HttpStatusCode, TDef extends IHttpMethodEndpointResponseDefinition<TStatus>> {
|
|
@@ -133,20 +133,37 @@ type HttpMethodEndpointHandlerOutput<TEndpointDefinition extends IHttpMethodEndp
|
|
|
133
133
|
[THttpStatusCode in keyof TEndpointDefinition['responses'] & HttpStatusCode]: TEndpointDefinition['responses'][THttpStatusCode] extends HttpMethodEndpointResponse<THttpStatusCode, infer TRespDef> ? CreateHandlerOutput<THttpStatusCode, TRespDef> : never;
|
|
134
134
|
}[keyof TEndpointDefinition['responses'] & HttpStatusCode];
|
|
135
135
|
type CreateHandlerOutput<THttpStatusCode extends HttpStatusCode, TRespDef> = TRespDef extends {
|
|
136
|
+
headers: z$1.ZodType;
|
|
136
137
|
body: z$1.ZodType;
|
|
137
138
|
} ? {
|
|
138
139
|
code: THttpStatusCode;
|
|
140
|
+
headers: z$1.input<TRespDef['headers']>;
|
|
141
|
+
body: z$1.input<TRespDef['body']>;
|
|
142
|
+
} : TRespDef extends {
|
|
143
|
+
headers: z$1.ZodType;
|
|
144
|
+
} ? {
|
|
145
|
+
code: THttpStatusCode;
|
|
146
|
+
headers: z$1.input<TRespDef['headers']>;
|
|
147
|
+
body?: never;
|
|
148
|
+
} : TRespDef extends {
|
|
149
|
+
body: z$1.ZodType;
|
|
150
|
+
} ? {
|
|
151
|
+
code: THttpStatusCode;
|
|
152
|
+
headers?: never;
|
|
139
153
|
body: z$1.input<TRespDef['body']>;
|
|
140
154
|
} : {
|
|
141
155
|
code: THttpStatusCode;
|
|
156
|
+
headers?: never;
|
|
142
157
|
body?: never;
|
|
143
158
|
};
|
|
144
159
|
type ClientHttpMethodEndpointHandlerOutput = {
|
|
145
160
|
code: HttpStatusCode;
|
|
161
|
+
headers?: any;
|
|
146
162
|
body: any;
|
|
147
163
|
};
|
|
148
164
|
type HttpResponseObject = {
|
|
149
165
|
code: HttpStatusCode;
|
|
166
|
+
headers?: any;
|
|
150
167
|
body?: any;
|
|
151
168
|
};
|
|
152
169
|
declare function isHttpResponseObject(obj: any): obj is HttpResponseObject;
|
package/dist/index.d.mts
CHANGED
|
@@ -30,7 +30,7 @@ type LowerCasedHttpMethod = Lowercase<HttpMethod>;
|
|
|
30
30
|
|
|
31
31
|
declare function response<TStatus extends HttpStatusCode, TDef extends IHttpMethodEndpointResponseDefinition<TStatus>>(definition: TDef): HttpMethodEndpointResponse<TStatus, TDef>;
|
|
32
32
|
interface IHttpMethodEndpointResponseDefinition<_TStatus extends HttpStatusCode> {
|
|
33
|
-
headers?:
|
|
33
|
+
headers?: z.ZodType;
|
|
34
34
|
body?: z.ZodType;
|
|
35
35
|
}
|
|
36
36
|
declare class HttpMethodEndpointResponse<TStatus extends HttpStatusCode, TDef extends IHttpMethodEndpointResponseDefinition<TStatus>> {
|
|
@@ -133,20 +133,37 @@ type HttpMethodEndpointHandlerOutput<TEndpointDefinition extends IHttpMethodEndp
|
|
|
133
133
|
[THttpStatusCode in keyof TEndpointDefinition['responses'] & HttpStatusCode]: TEndpointDefinition['responses'][THttpStatusCode] extends HttpMethodEndpointResponse<THttpStatusCode, infer TRespDef> ? CreateHandlerOutput<THttpStatusCode, TRespDef> : never;
|
|
134
134
|
}[keyof TEndpointDefinition['responses'] & HttpStatusCode];
|
|
135
135
|
type CreateHandlerOutput<THttpStatusCode extends HttpStatusCode, TRespDef> = TRespDef extends {
|
|
136
|
+
headers: z$1.ZodType;
|
|
136
137
|
body: z$1.ZodType;
|
|
137
138
|
} ? {
|
|
138
139
|
code: THttpStatusCode;
|
|
140
|
+
headers: z$1.input<TRespDef['headers']>;
|
|
141
|
+
body: z$1.input<TRespDef['body']>;
|
|
142
|
+
} : TRespDef extends {
|
|
143
|
+
headers: z$1.ZodType;
|
|
144
|
+
} ? {
|
|
145
|
+
code: THttpStatusCode;
|
|
146
|
+
headers: z$1.input<TRespDef['headers']>;
|
|
147
|
+
body?: never;
|
|
148
|
+
} : TRespDef extends {
|
|
149
|
+
body: z$1.ZodType;
|
|
150
|
+
} ? {
|
|
151
|
+
code: THttpStatusCode;
|
|
152
|
+
headers?: never;
|
|
139
153
|
body: z$1.input<TRespDef['body']>;
|
|
140
154
|
} : {
|
|
141
155
|
code: THttpStatusCode;
|
|
156
|
+
headers?: never;
|
|
142
157
|
body?: never;
|
|
143
158
|
};
|
|
144
159
|
type ClientHttpMethodEndpointHandlerOutput = {
|
|
145
160
|
code: HttpStatusCode;
|
|
161
|
+
headers?: any;
|
|
146
162
|
body: any;
|
|
147
163
|
};
|
|
148
164
|
type HttpResponseObject = {
|
|
149
165
|
code: HttpStatusCode;
|
|
166
|
+
headers?: any;
|
|
150
167
|
body?: any;
|
|
151
168
|
};
|
|
152
169
|
declare function isHttpResponseObject(obj: any): obj is HttpResponseObject;
|