fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at feat/use-query-options 91 lines 1.9 kB view raw
1import type { UserConfig } from '@hey-api/openapi-ts'; 2 3export type PluginConfig = NonNullable<NonNullable<UserConfig['plugins']>[number]>; 4 5export const presets = { 6 angular: () => [ 7 { 8 httpRequests: 'flat', 9 name: '@angular/common', 10 }, 11 ], 12 full: () => [ 13 /** Full kitchen sink for comprehensive testing */ 14 '@hey-api/typescript', 15 { 16 name: '@hey-api/sdk', 17 paramsStructure: 'flat', 18 }, 19 { 20 name: '@hey-api/transformers', 21 }, 22 { 23 metadata: true, 24 name: 'zod', 25 }, 26 { 27 name: '@tanstack/react-query', 28 queryKeys: { 29 tags: true, 30 }, 31 }, 32 ], 33 rpc: () => [ 34 /** RPC-style SDK with Zod validation */ 35 'orpc', 36 'zod', 37 ], 38 sdk: () => [ 39 /** SDK with types */ 40 '@hey-api/typescript', 41 { 42 name: '@hey-api/sdk', 43 operations: { 44 containerName: 'OpenCode', 45 strategy: 'single', 46 }, 47 paramsStructure: 'flat', 48 }, 49 ], 50 tanstack: () => [ 51 /** SDK + TanStack Query */ 52 '@hey-api/typescript', 53 '@hey-api/sdk', 54 { 55 name: '@tanstack/react-query', 56 queryKeys: { 57 tags: true, 58 }, 59 }, 60 ], 61 types: () => [ 62 /** Just types, nothing else */ 63 '@hey-api/typescript', 64 ], 65 validated: () => [ 66 /** SDK + Zod validation */ 67 '@hey-api/typescript', 68 { 69 name: '@hey-api/sdk', 70 validator: 'zod', 71 }, 72 { 73 metadata: true, 74 name: 'valibot', 75 }, 76 { 77 metadata: true, 78 name: 'zod', 79 }, 80 ], 81} as const satisfies Record<string, () => ReadonlyArray<PluginConfig>>; 82 83export type PresetKey = keyof typeof presets; 84 85export function getPreset(key: PresetKey = (process.env.PRESET as PresetKey) || 'sdk') { 86 const preset = presets[key]; 87 if (!preset) { 88 throw new Error(`Unknown preset: ${key}. Available: ${Object.keys(presets).join(', ')}`); 89 } 90 return preset(); 91}