fets 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fets",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience",
5
5
  "sideEffects": false,
6
6
  "dependencies": {
@@ -113,6 +113,40 @@ export type OASRequestParams<TOAS extends OpenAPIDocument, TPath extends keyof O
113
113
  } : {}) & (TPath extends `${string}:${string}${string}` ? {
114
114
  params: Record<ExtractPathParamsWithPattern<TPath>, string | number>;
115
115
  } : {}) & (OASMethodMap<TOAS, TPath>[TMethod] extends {
116
+ security: {
117
+ [TSchemeNameKey in infer TSecuritySchemeName]: any;
118
+ }[];
119
+ } ? TOAS extends {
120
+ components: {
121
+ securitySchemes: {
122
+ [TSecuritySchemeNameKey in TSecuritySchemeName extends string ? TSecuritySchemeName : never]: {
123
+ type: infer TSecurityType;
124
+ };
125
+ };
126
+ };
127
+ } ? OASSecurityParamsByType<TSecurityType> : {} : {}) & (TOAS extends {
128
+ security: {
129
+ [TSchemeNameKey in infer TSecuritySchemeName]: any;
130
+ }[];
131
+ } ? TOAS extends {
132
+ components: {
133
+ securitySchemes: {
134
+ [TSecuritySchemeNameKey in TSecuritySchemeName extends string ? TSecuritySchemeName : never]: {
135
+ type: infer TSecurityType;
136
+ };
137
+ };
138
+ };
139
+ } ? OASSecurityParamsByType<TSecurityType> : {} : {}) & (TOAS extends {
140
+ security: {
141
+ [TSchemeNameKey in infer TSecuritySchemeName]: any;
142
+ }[];
143
+ } ? TOAS extends {
144
+ securityDefinitions: {
145
+ [TSecuritySchemeNameKey in TSecuritySchemeName extends string ? TSecuritySchemeName : never]: {
146
+ type: infer TSecurityType;
147
+ };
148
+ };
149
+ } ? OASSecurityParamsByType<TSecurityType> : {} : {}) & (OASMethodMap<TOAS, TPath>[TMethod] extends {
116
150
  requestBody: {
117
151
  content: {
118
152
  'multipart/form-data': {
@@ -189,4 +223,17 @@ export type ExtractPathParamsWithPattern<TPath extends string> = Pipe<TPath, [
189
223
  Tuples.Map<Strings.Trim<':'>>,
190
224
  Tuples.ToUnion
191
225
  ]>;
226
+ export interface OASSecurityParamsMap {
227
+ oauth2: {
228
+ headers: {
229
+ Authorization: `Bearer ${string}`;
230
+ };
231
+ };
232
+ basic: {
233
+ headers: {
234
+ Authorization: `Basic ${string}`;
235
+ };
236
+ };
237
+ }
238
+ export type OASSecurityParamsByType<TSecurityType> = TSecurityType extends keyof OASSecurityParamsMap ? OASSecurityParamsMap[TSecurityType] : {};
192
239
  export {};
@@ -113,6 +113,40 @@ export type OASRequestParams<TOAS extends OpenAPIDocument, TPath extends keyof O
113
113
  } : {}) & (TPath extends `${string}:${string}${string}` ? {
114
114
  params: Record<ExtractPathParamsWithPattern<TPath>, string | number>;
115
115
  } : {}) & (OASMethodMap<TOAS, TPath>[TMethod] extends {
116
+ security: {
117
+ [TSchemeNameKey in infer TSecuritySchemeName]: any;
118
+ }[];
119
+ } ? TOAS extends {
120
+ components: {
121
+ securitySchemes: {
122
+ [TSecuritySchemeNameKey in TSecuritySchemeName extends string ? TSecuritySchemeName : never]: {
123
+ type: infer TSecurityType;
124
+ };
125
+ };
126
+ };
127
+ } ? OASSecurityParamsByType<TSecurityType> : {} : {}) & (TOAS extends {
128
+ security: {
129
+ [TSchemeNameKey in infer TSecuritySchemeName]: any;
130
+ }[];
131
+ } ? TOAS extends {
132
+ components: {
133
+ securitySchemes: {
134
+ [TSecuritySchemeNameKey in TSecuritySchemeName extends string ? TSecuritySchemeName : never]: {
135
+ type: infer TSecurityType;
136
+ };
137
+ };
138
+ };
139
+ } ? OASSecurityParamsByType<TSecurityType> : {} : {}) & (TOAS extends {
140
+ security: {
141
+ [TSchemeNameKey in infer TSecuritySchemeName]: any;
142
+ }[];
143
+ } ? TOAS extends {
144
+ securityDefinitions: {
145
+ [TSecuritySchemeNameKey in TSecuritySchemeName extends string ? TSecuritySchemeName : never]: {
146
+ type: infer TSecurityType;
147
+ };
148
+ };
149
+ } ? OASSecurityParamsByType<TSecurityType> : {} : {}) & (OASMethodMap<TOAS, TPath>[TMethod] extends {
116
150
  requestBody: {
117
151
  content: {
118
152
  'multipart/form-data': {
@@ -189,4 +223,17 @@ export type ExtractPathParamsWithPattern<TPath extends string> = Pipe<TPath, [
189
223
  Tuples.Map<Strings.Trim<':'>>,
190
224
  Tuples.ToUnion
191
225
  ]>;
226
+ export interface OASSecurityParamsMap {
227
+ oauth2: {
228
+ headers: {
229
+ Authorization: `Bearer ${string}`;
230
+ };
231
+ };
232
+ basic: {
233
+ headers: {
234
+ Authorization: `Basic ${string}`;
235
+ };
236
+ };
237
+ }
238
+ export type OASSecurityParamsByType<TSecurityType> = TSecurityType extends keyof OASSecurityParamsMap ? OASSecurityParamsMap[TSecurityType] : {};
192
239
  export {};