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

Merge pull request #2939 from hey-api/feat/sdk-plugin-tanstack

fix(tanstack-query): correctly access instantiated SDKs

authored by

Lubos and committed by
GitHub
1cbf85fe b852e47a

+4017 -1555
+5
.changeset/wet-vans-taste.md
··· 1 + --- 2 + '@hey-api/openapi-ts': patch 3 + --- 4 + 5 + fix(tanstack-query): correctly access instantiated SDKs
+8 -7
dev/openapi-ts.config.ts
··· 41 41 // 'circular.yaml', 42 42 // 'dutchie.json', 43 43 // 'invalid', 44 - // 'openai.yaml', 45 44 // 'full.yaml', 46 - 'opencode.yaml', 47 - // 'sdk-circular-bug.yaml', 45 + 'openai.yaml', 46 + // 'opencode.yaml', 48 47 // 'sdk-instance.yaml', 49 48 // 'string-with-format.yaml', 50 49 // 'transformers.json', ··· 217 216 { 218 217 // baseUrl: false, 219 218 // exportFromIndex: true, 220 - // name: '@hey-api/client-fetch', 221 - // name: 'legacy/angular', 219 + name: '@hey-api/client-fetch', 222 220 // runtimeConfigPath: path.resolve(__dirname, 'hey-api.ts'), 223 221 // runtimeConfigPath: './src/hey-api.ts', 224 222 // strictBaseUrl: true, ··· 256 254 // classNameBuilder: '{{name}}', 257 255 // classNameBuilder: '{{name}}Service', 258 256 // classStructure: 'off', 259 - // client: false, 257 + client: false, 260 258 // getSignature: ({ fields, signature, operation }) => { 261 259 // // ... 262 260 // fields.unwrap('path') ··· 265 263 instance: true, 266 264 name: '@hey-api/sdk', 267 265 // operationId: false, 268 - paramsStructure: 'flat', 266 + // paramsStructure: 'flat', 269 267 // responseStyle: 'data', 270 268 // signature: 'auto', 271 269 // signature: 'client', ··· 298 296 }, 299 297 { 300 298 // name: 'fastify', 299 + }, 300 + { 301 + name: 'swr', 301 302 }, 302 303 { 303 304 // case: 'SCREAMING_SNAKE_CASE',
+1
dev/package.json
··· 16 16 "@tanstack/svelte-query": "5.73.3", 17 17 "@tanstack/vue-query": "5.73.3", 18 18 "arktype": "2.1.25", 19 + "swr": "2.3.6", 19 20 "typescript": "5.9.3", 20 21 "valibot": "1.1.0", 21 22 "zod": "4.1.12"
+3 -9
examples/openapi-ts-angular/src/client/sdk.gen.ts
··· 81 81 meta?: Record<string, unknown>; 82 82 }; 83 83 84 - @Injectable({ 85 - providedIn: 'root', 86 - }) 84 + @Injectable({ providedIn: 'root' }) 87 85 export class PetService { 88 86 /** 89 87 * Add a new pet to the store. ··· 295 293 } 296 294 } 297 295 298 - @Injectable({ 299 - providedIn: 'root', 300 - }) 296 + @Injectable({ providedIn: 'root' }) 301 297 export class StoreService { 302 298 /** 303 299 * Returns pet inventories by status. ··· 382 378 } 383 379 } 384 380 385 - @Injectable({ 386 - providedIn: 'root', 387 - }) 381 + @Injectable({ providedIn: 'root' }) 388 382 export class UserService { 389 383 /** 390 384 * Create user.
+192 -167
examples/openapi-ts-openai/src/client/sdk.gen.ts
··· 365 365 meta?: Record<string, unknown>; 366 366 }; 367 367 368 - class _HeyApiClient { 369 - protected _client: Client = client; 368 + class HeyApiClient { 369 + protected client: Client; 370 370 371 371 constructor(args?: { client?: Client }) { 372 - if (args?.client) { 373 - this._client = args.client; 372 + this.client = args?.client ?? client; 373 + } 374 + } 375 + 376 + class HeyApiRegistry<T> { 377 + private readonly defaultKey = 'default'; 378 + 379 + private readonly instances: Map<string, T> = new Map(); 380 + 381 + get(key?: string): T { 382 + const instance = this.instances.get(key ?? this.defaultKey); 383 + if (!instance) { 384 + throw new Error( 385 + `No SDK client found. Create one with "new OpenAi()" to fix this error.`, 386 + ); 374 387 } 388 + return instance; 389 + } 390 + 391 + set(value: T, key?: string): void { 392 + this.instances.set(key ?? this.defaultKey, value); 375 393 } 376 394 } 377 395 378 - export class OpenAi extends _HeyApiClient { 396 + export class OpenAi extends HeyApiClient { 397 + public static readonly __registry = new HeyApiRegistry<OpenAi>(); 398 + 399 + constructor(args?: { client?: Client; key?: string }) { 400 + super(args); 401 + OpenAi.__registry.set(this, args?.key); 402 + } 403 + 379 404 /** 380 405 * List assistants 381 406 * ··· 384 409 public listAssistants<ThrowOnError extends boolean = false>( 385 410 options?: Options<ListAssistantsData, ThrowOnError>, 386 411 ) { 387 - return (options?.client ?? this._client).get< 412 + return (options?.client ?? this.client).get< 388 413 ListAssistantsResponses, 389 414 unknown, 390 415 ThrowOnError ··· 408 433 public createAssistant<ThrowOnError extends boolean = false>( 409 434 options: Options<CreateAssistantData, ThrowOnError>, 410 435 ) { 411 - return (options.client ?? this._client).post< 436 + return (options.client ?? this.client).post< 412 437 CreateAssistantResponses, 413 438 unknown, 414 439 ThrowOnError ··· 436 461 public deleteAssistant<ThrowOnError extends boolean = false>( 437 462 options: Options<DeleteAssistantData, ThrowOnError>, 438 463 ) { 439 - return (options.client ?? this._client).delete< 464 + return (options.client ?? this.client).delete< 440 465 DeleteAssistantResponses, 441 466 unknown, 442 467 ThrowOnError ··· 460 485 public getAssistant<ThrowOnError extends boolean = false>( 461 486 options: Options<GetAssistantData, ThrowOnError>, 462 487 ) { 463 - return (options.client ?? this._client).get< 488 + return (options.client ?? this.client).get< 464 489 GetAssistantResponses, 465 490 unknown, 466 491 ThrowOnError ··· 484 509 public modifyAssistant<ThrowOnError extends boolean = false>( 485 510 options: Options<ModifyAssistantData, ThrowOnError>, 486 511 ) { 487 - return (options.client ?? this._client).post< 512 + return (options.client ?? this.client).post< 488 513 ModifyAssistantResponses, 489 514 unknown, 490 515 ThrowOnError ··· 512 537 public createSpeech<ThrowOnError extends boolean = false>( 513 538 options: Options<CreateSpeechData, ThrowOnError>, 514 539 ) { 515 - return (options.client ?? this._client).post< 540 + return (options.client ?? this.client).post< 516 541 CreateSpeechResponses, 517 542 unknown, 518 543 ThrowOnError ··· 540 565 public createTranscription<ThrowOnError extends boolean = false>( 541 566 options: Options<CreateTranscriptionData, ThrowOnError>, 542 567 ) { 543 - return (options.client ?? this._client).post< 568 + return (options.client ?? this.client).post< 544 569 CreateTranscriptionResponses, 545 570 unknown, 546 571 ThrowOnError ··· 569 594 public createTranslation<ThrowOnError extends boolean = false>( 570 595 options: Options<CreateTranslationData, ThrowOnError>, 571 596 ) { 572 - return (options.client ?? this._client).post< 597 + return (options.client ?? this.client).post< 573 598 CreateTranslationResponses, 574 599 unknown, 575 600 ThrowOnError ··· 598 623 public listBatches<ThrowOnError extends boolean = false>( 599 624 options?: Options<ListBatchesData, ThrowOnError>, 600 625 ) { 601 - return (options?.client ?? this._client).get< 626 + return (options?.client ?? this.client).get< 602 627 ListBatchesResponses, 603 628 unknown, 604 629 ThrowOnError ··· 622 647 public createBatch<ThrowOnError extends boolean = false>( 623 648 options: Options<CreateBatchData, ThrowOnError>, 624 649 ) { 625 - return (options.client ?? this._client).post< 650 + return (options.client ?? this.client).post< 626 651 CreateBatchResponses, 627 652 unknown, 628 653 ThrowOnError ··· 650 675 public retrieveBatch<ThrowOnError extends boolean = false>( 651 676 options: Options<RetrieveBatchData, ThrowOnError>, 652 677 ) { 653 - return (options.client ?? this._client).get< 678 + return (options.client ?? this.client).get< 654 679 RetrieveBatchResponses, 655 680 unknown, 656 681 ThrowOnError ··· 674 699 public cancelBatch<ThrowOnError extends boolean = false>( 675 700 options: Options<CancelBatchData, ThrowOnError>, 676 701 ) { 677 - return (options.client ?? this._client).post< 702 + return (options.client ?? this.client).post< 678 703 CancelBatchResponses, 679 704 unknown, 680 705 ThrowOnError ··· 700 725 public listChatCompletions<ThrowOnError extends boolean = false>( 701 726 options?: Options<ListChatCompletionsData, ThrowOnError>, 702 727 ) { 703 - return (options?.client ?? this._client).get< 728 + return (options?.client ?? this.client).get< 704 729 ListChatCompletionsResponses, 705 730 unknown, 706 731 ThrowOnError ··· 739 764 public createChatCompletion<ThrowOnError extends boolean = false>( 740 765 options: Options<CreateChatCompletionData, ThrowOnError>, 741 766 ) { 742 - return (options.client ?? this._client).post< 767 + return (options.client ?? this.client).post< 743 768 CreateChatCompletionResponses, 744 769 unknown, 745 770 ThrowOnError ··· 769 794 public deleteChatCompletion<ThrowOnError extends boolean = false>( 770 795 options: Options<DeleteChatCompletionData, ThrowOnError>, 771 796 ) { 772 - return (options.client ?? this._client).delete< 797 + return (options.client ?? this.client).delete< 773 798 DeleteChatCompletionResponses, 774 799 unknown, 775 800 ThrowOnError ··· 795 820 public getChatCompletion<ThrowOnError extends boolean = false>( 796 821 options: Options<GetChatCompletionData, ThrowOnError>, 797 822 ) { 798 - return (options.client ?? this._client).get< 823 + return (options.client ?? this.client).get< 799 824 GetChatCompletionResponses, 800 825 unknown, 801 826 ThrowOnError ··· 822 847 public updateChatCompletion<ThrowOnError extends boolean = false>( 823 848 options: Options<UpdateChatCompletionData, ThrowOnError>, 824 849 ) { 825 - return (options.client ?? this._client).post< 850 + return (options.client ?? this.client).post< 826 851 UpdateChatCompletionResponses, 827 852 unknown, 828 853 ThrowOnError ··· 853 878 public getChatCompletionMessages<ThrowOnError extends boolean = false>( 854 879 options: Options<GetChatCompletionMessagesData, ThrowOnError>, 855 880 ) { 856 - return (options.client ?? this._client).get< 881 + return (options.client ?? this.client).get< 857 882 GetChatCompletionMessagesResponses, 858 883 unknown, 859 884 ThrowOnError ··· 877 902 public createCompletion<ThrowOnError extends boolean = false>( 878 903 options: Options<CreateCompletionData, ThrowOnError>, 879 904 ) { 880 - return (options.client ?? this._client).post< 905 + return (options.client ?? this.client).post< 881 906 CreateCompletionResponses, 882 907 unknown, 883 908 ThrowOnError ··· 905 930 public listContainers<ThrowOnError extends boolean = false>( 906 931 options?: Options<ListContainersData, ThrowOnError>, 907 932 ) { 908 - return (options?.client ?? this._client).get< 933 + return (options?.client ?? this.client).get< 909 934 ListContainersResponses, 910 935 unknown, 911 936 ThrowOnError ··· 929 954 public createContainer<ThrowOnError extends boolean = false>( 930 955 options?: Options<CreateContainerData, ThrowOnError>, 931 956 ) { 932 - return (options?.client ?? this._client).post< 957 + return (options?.client ?? this.client).post< 933 958 CreateContainerResponses, 934 959 unknown, 935 960 ThrowOnError ··· 957 982 public deleteContainer<ThrowOnError extends boolean = false>( 958 983 options: Options<DeleteContainerData, ThrowOnError>, 959 984 ) { 960 - return (options.client ?? this._client).delete< 985 + return (options.client ?? this.client).delete< 961 986 DeleteContainerResponses, 962 987 unknown, 963 988 ThrowOnError ··· 981 1006 public retrieveContainer<ThrowOnError extends boolean = false>( 982 1007 options: Options<RetrieveContainerData, ThrowOnError>, 983 1008 ) { 984 - return (options.client ?? this._client).get< 1009 + return (options.client ?? this.client).get< 985 1010 RetrieveContainerResponses, 986 1011 unknown, 987 1012 ThrowOnError ··· 1005 1030 public listContainerFiles<ThrowOnError extends boolean = false>( 1006 1031 options: Options<ListContainerFilesData, ThrowOnError>, 1007 1032 ) { 1008 - return (options.client ?? this._client).get< 1033 + return (options.client ?? this.client).get< 1009 1034 ListContainerFilesResponses, 1010 1035 unknown, 1011 1036 ThrowOnError ··· 1032 1057 public createContainerFile<ThrowOnError extends boolean = false>( 1033 1058 options: Options<CreateContainerFileData, ThrowOnError>, 1034 1059 ) { 1035 - return (options.client ?? this._client).post< 1060 + return (options.client ?? this.client).post< 1036 1061 CreateContainerFileResponses, 1037 1062 unknown, 1038 1063 ThrowOnError ··· 1061 1086 public deleteContainerFile<ThrowOnError extends boolean = false>( 1062 1087 options: Options<DeleteContainerFileData, ThrowOnError>, 1063 1088 ) { 1064 - return (options.client ?? this._client).delete< 1089 + return (options.client ?? this.client).delete< 1065 1090 DeleteContainerFileResponses, 1066 1091 unknown, 1067 1092 ThrowOnError ··· 1085 1110 public retrieveContainerFile<ThrowOnError extends boolean = false>( 1086 1111 options: Options<RetrieveContainerFileData, ThrowOnError>, 1087 1112 ) { 1088 - return (options.client ?? this._client).get< 1113 + return (options.client ?? this.client).get< 1089 1114 RetrieveContainerFileResponses, 1090 1115 unknown, 1091 1116 ThrowOnError ··· 1109 1134 public retrieveContainerFileContent<ThrowOnError extends boolean = false>( 1110 1135 options: Options<RetrieveContainerFileContentData, ThrowOnError>, 1111 1136 ) { 1112 - return (options.client ?? this._client).get< 1137 + return (options.client ?? this.client).get< 1113 1138 RetrieveContainerFileContentResponses, 1114 1139 unknown, 1115 1140 ThrowOnError ··· 1133 1158 public createEmbedding<ThrowOnError extends boolean = false>( 1134 1159 options: Options<CreateEmbeddingData, ThrowOnError>, 1135 1160 ) { 1136 - return (options.client ?? this._client).post< 1161 + return (options.client ?? this.client).post< 1137 1162 CreateEmbeddingResponses, 1138 1163 unknown, 1139 1164 ThrowOnError ··· 1162 1187 public listEvals<ThrowOnError extends boolean = false>( 1163 1188 options?: Options<ListEvalsData, ThrowOnError>, 1164 1189 ) { 1165 - return (options?.client ?? this._client).get< 1190 + return (options?.client ?? this.client).get< 1166 1191 ListEvalsResponses, 1167 1192 unknown, 1168 1193 ThrowOnError ··· 1189 1214 public createEval<ThrowOnError extends boolean = false>( 1190 1215 options: Options<CreateEvalData, ThrowOnError>, 1191 1216 ) { 1192 - return (options.client ?? this._client).post< 1217 + return (options.client ?? this.client).post< 1193 1218 CreateEvalResponses, 1194 1219 unknown, 1195 1220 ThrowOnError ··· 1218 1243 public deleteEval<ThrowOnError extends boolean = false>( 1219 1244 options: Options<DeleteEvalData, ThrowOnError>, 1220 1245 ) { 1221 - return (options.client ?? this._client).delete< 1246 + return (options.client ?? this.client).delete< 1222 1247 DeleteEvalResponses, 1223 1248 DeleteEvalErrors, 1224 1249 ThrowOnError ··· 1243 1268 public getEval<ThrowOnError extends boolean = false>( 1244 1269 options: Options<GetEvalData, ThrowOnError>, 1245 1270 ) { 1246 - return (options.client ?? this._client).get< 1271 + return (options.client ?? this.client).get< 1247 1272 GetEvalResponses, 1248 1273 unknown, 1249 1274 ThrowOnError ··· 1268 1293 public updateEval<ThrowOnError extends boolean = false>( 1269 1294 options: Options<UpdateEvalData, ThrowOnError>, 1270 1295 ) { 1271 - return (options.client ?? this._client).post< 1296 + return (options.client ?? this.client).post< 1272 1297 UpdateEvalResponses, 1273 1298 unknown, 1274 1299 ThrowOnError ··· 1297 1322 public getEvalRuns<ThrowOnError extends boolean = false>( 1298 1323 options: Options<GetEvalRunsData, ThrowOnError>, 1299 1324 ) { 1300 - return (options.client ?? this._client).get< 1325 + return (options.client ?? this.client).get< 1301 1326 GetEvalRunsResponses, 1302 1327 unknown, 1303 1328 ThrowOnError ··· 1322 1347 public createEvalRun<ThrowOnError extends boolean = false>( 1323 1348 options: Options<CreateEvalRunData, ThrowOnError>, 1324 1349 ) { 1325 - return (options.client ?? this._client).post< 1350 + return (options.client ?? this.client).post< 1326 1351 CreateEvalRunResponses, 1327 1352 CreateEvalRunErrors, 1328 1353 ThrowOnError ··· 1351 1376 public deleteEvalRun<ThrowOnError extends boolean = false>( 1352 1377 options: Options<DeleteEvalRunData, ThrowOnError>, 1353 1378 ) { 1354 - return (options.client ?? this._client).delete< 1379 + return (options.client ?? this.client).delete< 1355 1380 DeleteEvalRunResponses, 1356 1381 DeleteEvalRunErrors, 1357 1382 ThrowOnError ··· 1376 1401 public getEvalRun<ThrowOnError extends boolean = false>( 1377 1402 options: Options<GetEvalRunData, ThrowOnError>, 1378 1403 ) { 1379 - return (options.client ?? this._client).get< 1404 + return (options.client ?? this.client).get< 1380 1405 GetEvalRunResponses, 1381 1406 unknown, 1382 1407 ThrowOnError ··· 1401 1426 public cancelEvalRun<ThrowOnError extends boolean = false>( 1402 1427 options: Options<CancelEvalRunData, ThrowOnError>, 1403 1428 ) { 1404 - return (options.client ?? this._client).post< 1429 + return (options.client ?? this.client).post< 1405 1430 CancelEvalRunResponses, 1406 1431 unknown, 1407 1432 ThrowOnError ··· 1426 1451 public getEvalRunOutputItems<ThrowOnError extends boolean = false>( 1427 1452 options: Options<GetEvalRunOutputItemsData, ThrowOnError>, 1428 1453 ) { 1429 - return (options.client ?? this._client).get< 1454 + return (options.client ?? this.client).get< 1430 1455 GetEvalRunOutputItemsResponses, 1431 1456 unknown, 1432 1457 ThrowOnError ··· 1451 1476 public getEvalRunOutputItem<ThrowOnError extends boolean = false>( 1452 1477 options: Options<GetEvalRunOutputItemData, ThrowOnError>, 1453 1478 ) { 1454 - return (options.client ?? this._client).get< 1479 + return (options.client ?? this.client).get< 1455 1480 GetEvalRunOutputItemResponses, 1456 1481 unknown, 1457 1482 ThrowOnError ··· 1475 1500 public listFiles<ThrowOnError extends boolean = false>( 1476 1501 options?: Options<ListFilesData, ThrowOnError>, 1477 1502 ) { 1478 - return (options?.client ?? this._client).get< 1503 + return (options?.client ?? this.client).get< 1479 1504 ListFilesResponses, 1480 1505 unknown, 1481 1506 ThrowOnError ··· 1508 1533 public createFile<ThrowOnError extends boolean = false>( 1509 1534 options: Options<CreateFileData, ThrowOnError>, 1510 1535 ) { 1511 - return (options.client ?? this._client).post< 1536 + return (options.client ?? this.client).post< 1512 1537 CreateFileResponses, 1513 1538 unknown, 1514 1539 ThrowOnError ··· 1537 1562 public deleteFile<ThrowOnError extends boolean = false>( 1538 1563 options: Options<DeleteFileData, ThrowOnError>, 1539 1564 ) { 1540 - return (options.client ?? this._client).delete< 1565 + return (options.client ?? this.client).delete< 1541 1566 DeleteFileResponses, 1542 1567 unknown, 1543 1568 ThrowOnError ··· 1561 1586 public retrieveFile<ThrowOnError extends boolean = false>( 1562 1587 options: Options<RetrieveFileData, ThrowOnError>, 1563 1588 ) { 1564 - return (options.client ?? this._client).get< 1589 + return (options.client ?? this.client).get< 1565 1590 RetrieveFileResponses, 1566 1591 unknown, 1567 1592 ThrowOnError ··· 1585 1610 public downloadFile<ThrowOnError extends boolean = false>( 1586 1611 options: Options<DownloadFileData, ThrowOnError>, 1587 1612 ) { 1588 - return (options.client ?? this._client).get< 1613 + return (options.client ?? this.client).get< 1589 1614 DownloadFileResponses, 1590 1615 unknown, 1591 1616 ThrowOnError ··· 1610 1635 public runGrader<ThrowOnError extends boolean = false>( 1611 1636 options: Options<RunGraderData, ThrowOnError>, 1612 1637 ) { 1613 - return (options.client ?? this._client).post< 1638 + return (options.client ?? this.client).post< 1614 1639 RunGraderResponses, 1615 1640 unknown, 1616 1641 ThrowOnError ··· 1639 1664 public validateGrader<ThrowOnError extends boolean = false>( 1640 1665 options: Options<ValidateGraderData, ThrowOnError>, 1641 1666 ) { 1642 - return (options.client ?? this._client).post< 1667 + return (options.client ?? this.client).post< 1643 1668 ValidateGraderResponses, 1644 1669 unknown, 1645 1670 ThrowOnError ··· 1670 1695 public listFineTuningCheckpointPermissions< 1671 1696 ThrowOnError extends boolean = false, 1672 1697 >(options: Options<ListFineTuningCheckpointPermissionsData, ThrowOnError>) { 1673 - return (options.client ?? this._client).get< 1698 + return (options.client ?? this.client).get< 1674 1699 ListFineTuningCheckpointPermissionsResponses, 1675 1700 unknown, 1676 1701 ThrowOnError ··· 1697 1722 public createFineTuningCheckpointPermission< 1698 1723 ThrowOnError extends boolean = false, 1699 1724 >(options: Options<CreateFineTuningCheckpointPermissionData, ThrowOnError>) { 1700 - return (options.client ?? this._client).post< 1725 + return (options.client ?? this.client).post< 1701 1726 CreateFineTuningCheckpointPermissionResponses, 1702 1727 unknown, 1703 1728 ThrowOnError ··· 1728 1753 public deleteFineTuningCheckpointPermission< 1729 1754 ThrowOnError extends boolean = false, 1730 1755 >(options: Options<DeleteFineTuningCheckpointPermissionData, ThrowOnError>) { 1731 - return (options.client ?? this._client).delete< 1756 + return (options.client ?? this.client).delete< 1732 1757 DeleteFineTuningCheckpointPermissionResponses, 1733 1758 unknown, 1734 1759 ThrowOnError ··· 1753 1778 public listPaginatedFineTuningJobs<ThrowOnError extends boolean = false>( 1754 1779 options?: Options<ListPaginatedFineTuningJobsData, ThrowOnError>, 1755 1780 ) { 1756 - return (options?.client ?? this._client).get< 1781 + return (options?.client ?? this.client).get< 1757 1782 ListPaginatedFineTuningJobsResponses, 1758 1783 unknown, 1759 1784 ThrowOnError ··· 1782 1807 public createFineTuningJob<ThrowOnError extends boolean = false>( 1783 1808 options: Options<CreateFineTuningJobData, ThrowOnError>, 1784 1809 ) { 1785 - return (options.client ?? this._client).post< 1810 + return (options.client ?? this.client).post< 1786 1811 CreateFineTuningJobResponses, 1787 1812 unknown, 1788 1813 ThrowOnError ··· 1813 1838 public retrieveFineTuningJob<ThrowOnError extends boolean = false>( 1814 1839 options: Options<RetrieveFineTuningJobData, ThrowOnError>, 1815 1840 ) { 1816 - return (options.client ?? this._client).get< 1841 + return (options.client ?? this.client).get< 1817 1842 RetrieveFineTuningJobResponses, 1818 1843 unknown, 1819 1844 ThrowOnError ··· 1838 1863 public cancelFineTuningJob<ThrowOnError extends boolean = false>( 1839 1864 options: Options<CancelFineTuningJobData, ThrowOnError>, 1840 1865 ) { 1841 - return (options.client ?? this._client).post< 1866 + return (options.client ?? this.client).post< 1842 1867 CancelFineTuningJobResponses, 1843 1868 unknown, 1844 1869 ThrowOnError ··· 1863 1888 public listFineTuningJobCheckpoints<ThrowOnError extends boolean = false>( 1864 1889 options: Options<ListFineTuningJobCheckpointsData, ThrowOnError>, 1865 1890 ) { 1866 - return (options.client ?? this._client).get< 1891 + return (options.client ?? this.client).get< 1867 1892 ListFineTuningJobCheckpointsResponses, 1868 1893 unknown, 1869 1894 ThrowOnError ··· 1888 1913 public listFineTuningEvents<ThrowOnError extends boolean = false>( 1889 1914 options: Options<ListFineTuningEventsData, ThrowOnError>, 1890 1915 ) { 1891 - return (options.client ?? this._client).get< 1916 + return (options.client ?? this.client).get< 1892 1917 ListFineTuningEventsResponses, 1893 1918 unknown, 1894 1919 ThrowOnError ··· 1913 1938 public pauseFineTuningJob<ThrowOnError extends boolean = false>( 1914 1939 options: Options<PauseFineTuningJobData, ThrowOnError>, 1915 1940 ) { 1916 - return (options.client ?? this._client).post< 1941 + return (options.client ?? this.client).post< 1917 1942 PauseFineTuningJobResponses, 1918 1943 unknown, 1919 1944 ThrowOnError ··· 1938 1963 public resumeFineTuningJob<ThrowOnError extends boolean = false>( 1939 1964 options: Options<ResumeFineTuningJobData, ThrowOnError>, 1940 1965 ) { 1941 - return (options.client ?? this._client).post< 1966 + return (options.client ?? this.client).post< 1942 1967 ResumeFineTuningJobResponses, 1943 1968 unknown, 1944 1969 ThrowOnError ··· 1962 1987 public createImageEdit<ThrowOnError extends boolean = false>( 1963 1988 options: Options<CreateImageEditData, ThrowOnError>, 1964 1989 ) { 1965 - return (options.client ?? this._client).post< 1990 + return (options.client ?? this.client).post< 1966 1991 CreateImageEditResponses, 1967 1992 unknown, 1968 1993 ThrowOnError ··· 1992 2017 public createImage<ThrowOnError extends boolean = false>( 1993 2018 options: Options<CreateImageData, ThrowOnError>, 1994 2019 ) { 1995 - return (options.client ?? this._client).post< 2020 + return (options.client ?? this.client).post< 1996 2021 CreateImageResponses, 1997 2022 unknown, 1998 2023 ThrowOnError ··· 2020 2045 public createImageVariation<ThrowOnError extends boolean = false>( 2021 2046 options: Options<CreateImageVariationData, ThrowOnError>, 2022 2047 ) { 2023 - return (options.client ?? this._client).post< 2048 + return (options.client ?? this.client).post< 2024 2049 CreateImageVariationResponses, 2025 2050 unknown, 2026 2051 ThrowOnError ··· 2049 2074 public listModels<ThrowOnError extends boolean = false>( 2050 2075 options?: Options<ListModelsData, ThrowOnError>, 2051 2076 ) { 2052 - return (options?.client ?? this._client).get< 2077 + return (options?.client ?? this.client).get< 2053 2078 ListModelsResponses, 2054 2079 unknown, 2055 2080 ThrowOnError ··· 2073 2098 public deleteModel<ThrowOnError extends boolean = false>( 2074 2099 options: Options<DeleteModelData, ThrowOnError>, 2075 2100 ) { 2076 - return (options.client ?? this._client).delete< 2101 + return (options.client ?? this.client).delete< 2077 2102 DeleteModelResponses, 2078 2103 unknown, 2079 2104 ThrowOnError ··· 2097 2122 public retrieveModel<ThrowOnError extends boolean = false>( 2098 2123 options: Options<RetrieveModelData, ThrowOnError>, 2099 2124 ) { 2100 - return (options.client ?? this._client).get< 2125 + return (options.client ?? this.client).get< 2101 2126 RetrieveModelResponses, 2102 2127 unknown, 2103 2128 ThrowOnError ··· 2123 2148 public createModeration<ThrowOnError extends boolean = false>( 2124 2149 options: Options<CreateModerationData, ThrowOnError>, 2125 2150 ) { 2126 - return (options.client ?? this._client).post< 2151 + return (options.client ?? this.client).post< 2127 2152 CreateModerationResponses, 2128 2153 unknown, 2129 2154 ThrowOnError ··· 2151 2176 public adminApiKeysList<ThrowOnError extends boolean = false>( 2152 2177 options?: Options<AdminApiKeysListData, ThrowOnError>, 2153 2178 ) { 2154 - return (options?.client ?? this._client).get< 2179 + return (options?.client ?? this.client).get< 2155 2180 AdminApiKeysListResponses, 2156 2181 unknown, 2157 2182 ThrowOnError ··· 2175 2200 public adminApiKeysCreate<ThrowOnError extends boolean = false>( 2176 2201 options: Options<AdminApiKeysCreateData, ThrowOnError>, 2177 2202 ) { 2178 - return (options.client ?? this._client).post< 2203 + return (options.client ?? this.client).post< 2179 2204 AdminApiKeysCreateResponses, 2180 2205 unknown, 2181 2206 ThrowOnError ··· 2203 2228 public adminApiKeysDelete<ThrowOnError extends boolean = false>( 2204 2229 options: Options<AdminApiKeysDeleteData, ThrowOnError>, 2205 2230 ) { 2206 - return (options.client ?? this._client).delete< 2231 + return (options.client ?? this.client).delete< 2207 2232 AdminApiKeysDeleteResponses, 2208 2233 unknown, 2209 2234 ThrowOnError ··· 2227 2252 public adminApiKeysGet<ThrowOnError extends boolean = false>( 2228 2253 options: Options<AdminApiKeysGetData, ThrowOnError>, 2229 2254 ) { 2230 - return (options.client ?? this._client).get< 2255 + return (options.client ?? this.client).get< 2231 2256 AdminApiKeysGetResponses, 2232 2257 unknown, 2233 2258 ThrowOnError ··· 2251 2276 public listAuditLogs<ThrowOnError extends boolean = false>( 2252 2277 options?: Options<ListAuditLogsData, ThrowOnError>, 2253 2278 ) { 2254 - return (options?.client ?? this._client).get< 2279 + return (options?.client ?? this.client).get< 2255 2280 ListAuditLogsResponses, 2256 2281 unknown, 2257 2282 ThrowOnError ··· 2284 2309 public listOrganizationCertificates<ThrowOnError extends boolean = false>( 2285 2310 options?: Options<ListOrganizationCertificatesData, ThrowOnError>, 2286 2311 ) { 2287 - return (options?.client ?? this._client).get< 2312 + return (options?.client ?? this.client).get< 2288 2313 ListOrganizationCertificatesResponses, 2289 2314 unknown, 2290 2315 ThrowOnError ··· 2311 2336 public uploadCertificate<ThrowOnError extends boolean = false>( 2312 2337 options: Options<UploadCertificateData, ThrowOnError>, 2313 2338 ) { 2314 - return (options.client ?? this._client).post< 2339 + return (options.client ?? this.client).post< 2315 2340 UploadCertificateResponses, 2316 2341 unknown, 2317 2342 ThrowOnError ··· 2342 2367 public activateOrganizationCertificates<ThrowOnError extends boolean = false>( 2343 2368 options: Options<ActivateOrganizationCertificatesData, ThrowOnError>, 2344 2369 ) { 2345 - return (options.client ?? this._client).post< 2370 + return (options.client ?? this.client).post< 2346 2371 ActivateOrganizationCertificatesResponses, 2347 2372 unknown, 2348 2373 ThrowOnError ··· 2373 2398 public deactivateOrganizationCertificates< 2374 2399 ThrowOnError extends boolean = false, 2375 2400 >(options: Options<DeactivateOrganizationCertificatesData, ThrowOnError>) { 2376 - return (options.client ?? this._client).post< 2401 + return (options.client ?? this.client).post< 2377 2402 DeactivateOrganizationCertificatesResponses, 2378 2403 unknown, 2379 2404 ThrowOnError ··· 2404 2429 public deleteCertificate<ThrowOnError extends boolean = false>( 2405 2430 options?: Options<DeleteCertificateData, ThrowOnError>, 2406 2431 ) { 2407 - return (options?.client ?? this._client).delete< 2432 + return (options?.client ?? this.client).delete< 2408 2433 DeleteCertificateResponses, 2409 2434 unknown, 2410 2435 ThrowOnError ··· 2431 2456 public getCertificate<ThrowOnError extends boolean = false>( 2432 2457 options: Options<GetCertificateData, ThrowOnError>, 2433 2458 ) { 2434 - return (options.client ?? this._client).get< 2459 + return (options.client ?? this.client).get< 2435 2460 GetCertificateResponses, 2436 2461 unknown, 2437 2462 ThrowOnError ··· 2456 2481 public modifyCertificate<ThrowOnError extends boolean = false>( 2457 2482 options: Options<ModifyCertificateData, ThrowOnError>, 2458 2483 ) { 2459 - return (options.client ?? this._client).post< 2484 + return (options.client ?? this.client).post< 2460 2485 ModifyCertificateResponses, 2461 2486 unknown, 2462 2487 ThrowOnError ··· 2484 2509 public usageCosts<ThrowOnError extends boolean = false>( 2485 2510 options: Options<UsageCostsData, ThrowOnError>, 2486 2511 ) { 2487 - return (options.client ?? this._client).get< 2512 + return (options.client ?? this.client).get< 2488 2513 UsageCostsResponses, 2489 2514 unknown, 2490 2515 ThrowOnError ··· 2508 2533 public listInvites<ThrowOnError extends boolean = false>( 2509 2534 options?: Options<ListInvitesData, ThrowOnError>, 2510 2535 ) { 2511 - return (options?.client ?? this._client).get< 2536 + return (options?.client ?? this.client).get< 2512 2537 ListInvitesResponses, 2513 2538 unknown, 2514 2539 ThrowOnError ··· 2532 2557 public inviteUser<ThrowOnError extends boolean = false>( 2533 2558 options: Options<InviteUserData, ThrowOnError>, 2534 2559 ) { 2535 - return (options.client ?? this._client).post< 2560 + return (options.client ?? this.client).post< 2536 2561 InviteUserResponses, 2537 2562 unknown, 2538 2563 ThrowOnError ··· 2560 2585 public deleteInvite<ThrowOnError extends boolean = false>( 2561 2586 options: Options<DeleteInviteData, ThrowOnError>, 2562 2587 ) { 2563 - return (options.client ?? this._client).delete< 2588 + return (options.client ?? this.client).delete< 2564 2589 DeleteInviteResponses, 2565 2590 unknown, 2566 2591 ThrowOnError ··· 2584 2609 public retrieveInvite<ThrowOnError extends boolean = false>( 2585 2610 options: Options<RetrieveInviteData, ThrowOnError>, 2586 2611 ) { 2587 - return (options.client ?? this._client).get< 2612 + return (options.client ?? this.client).get< 2588 2613 RetrieveInviteResponses, 2589 2614 unknown, 2590 2615 ThrowOnError ··· 2608 2633 public listProjects<ThrowOnError extends boolean = false>( 2609 2634 options?: Options<ListProjectsData, ThrowOnError>, 2610 2635 ) { 2611 - return (options?.client ?? this._client).get< 2636 + return (options?.client ?? this.client).get< 2612 2637 ListProjectsResponses, 2613 2638 unknown, 2614 2639 ThrowOnError ··· 2632 2657 public createProject<ThrowOnError extends boolean = false>( 2633 2658 options: Options<CreateProjectData, ThrowOnError>, 2634 2659 ) { 2635 - return (options.client ?? this._client).post< 2660 + return (options.client ?? this.client).post< 2636 2661 CreateProjectResponses, 2637 2662 unknown, 2638 2663 ThrowOnError ··· 2660 2685 public retrieveProject<ThrowOnError extends boolean = false>( 2661 2686 options: Options<RetrieveProjectData, ThrowOnError>, 2662 2687 ) { 2663 - return (options.client ?? this._client).get< 2688 + return (options.client ?? this.client).get< 2664 2689 RetrieveProjectResponses, 2665 2690 unknown, 2666 2691 ThrowOnError ··· 2684 2709 public modifyProject<ThrowOnError extends boolean = false>( 2685 2710 options: Options<ModifyProjectData, ThrowOnError>, 2686 2711 ) { 2687 - return (options.client ?? this._client).post< 2712 + return (options.client ?? this.client).post< 2688 2713 ModifyProjectResponses, 2689 2714 ModifyProjectErrors, 2690 2715 ThrowOnError ··· 2712 2737 public listProjectApiKeys<ThrowOnError extends boolean = false>( 2713 2738 options: Options<ListProjectApiKeysData, ThrowOnError>, 2714 2739 ) { 2715 - return (options.client ?? this._client).get< 2740 + return (options.client ?? this.client).get< 2716 2741 ListProjectApiKeysResponses, 2717 2742 unknown, 2718 2743 ThrowOnError ··· 2736 2761 public deleteProjectApiKey<ThrowOnError extends boolean = false>( 2737 2762 options: Options<DeleteProjectApiKeyData, ThrowOnError>, 2738 2763 ) { 2739 - return (options.client ?? this._client).delete< 2764 + return (options.client ?? this.client).delete< 2740 2765 DeleteProjectApiKeyResponses, 2741 2766 DeleteProjectApiKeyErrors, 2742 2767 ThrowOnError ··· 2760 2785 public retrieveProjectApiKey<ThrowOnError extends boolean = false>( 2761 2786 options: Options<RetrieveProjectApiKeyData, ThrowOnError>, 2762 2787 ) { 2763 - return (options.client ?? this._client).get< 2788 + return (options.client ?? this.client).get< 2764 2789 RetrieveProjectApiKeyResponses, 2765 2790 unknown, 2766 2791 ThrowOnError ··· 2784 2809 public archiveProject<ThrowOnError extends boolean = false>( 2785 2810 options: Options<ArchiveProjectData, ThrowOnError>, 2786 2811 ) { 2787 - return (options.client ?? this._client).post< 2812 + return (options.client ?? this.client).post< 2788 2813 ArchiveProjectResponses, 2789 2814 unknown, 2790 2815 ThrowOnError ··· 2808 2833 public listProjectCertificates<ThrowOnError extends boolean = false>( 2809 2834 options: Options<ListProjectCertificatesData, ThrowOnError>, 2810 2835 ) { 2811 - return (options.client ?? this._client).get< 2836 + return (options.client ?? this.client).get< 2812 2837 ListProjectCertificatesResponses, 2813 2838 unknown, 2814 2839 ThrowOnError ··· 2835 2860 public activateProjectCertificates<ThrowOnError extends boolean = false>( 2836 2861 options: Options<ActivateProjectCertificatesData, ThrowOnError>, 2837 2862 ) { 2838 - return (options.client ?? this._client).post< 2863 + return (options.client ?? this.client).post< 2839 2864 ActivateProjectCertificatesResponses, 2840 2865 unknown, 2841 2866 ThrowOnError ··· 2865 2890 public deactivateProjectCertificates<ThrowOnError extends boolean = false>( 2866 2891 options: Options<DeactivateProjectCertificatesData, ThrowOnError>, 2867 2892 ) { 2868 - return (options.client ?? this._client).post< 2893 + return (options.client ?? this.client).post< 2869 2894 DeactivateProjectCertificatesResponses, 2870 2895 unknown, 2871 2896 ThrowOnError ··· 2893 2918 public listProjectRateLimits<ThrowOnError extends boolean = false>( 2894 2919 options: Options<ListProjectRateLimitsData, ThrowOnError>, 2895 2920 ) { 2896 - return (options.client ?? this._client).get< 2921 + return (options.client ?? this.client).get< 2897 2922 ListProjectRateLimitsResponses, 2898 2923 unknown, 2899 2924 ThrowOnError ··· 2917 2942 public updateProjectRateLimits<ThrowOnError extends boolean = false>( 2918 2943 options: Options<UpdateProjectRateLimitsData, ThrowOnError>, 2919 2944 ) { 2920 - return (options.client ?? this._client).post< 2945 + return (options.client ?? this.client).post< 2921 2946 UpdateProjectRateLimitsResponses, 2922 2947 UpdateProjectRateLimitsErrors, 2923 2948 ThrowOnError ··· 2945 2970 public listProjectServiceAccounts<ThrowOnError extends boolean = false>( 2946 2971 options: Options<ListProjectServiceAccountsData, ThrowOnError>, 2947 2972 ) { 2948 - return (options.client ?? this._client).get< 2973 + return (options.client ?? this.client).get< 2949 2974 ListProjectServiceAccountsResponses, 2950 2975 ListProjectServiceAccountsErrors, 2951 2976 ThrowOnError ··· 2969 2994 public createProjectServiceAccount<ThrowOnError extends boolean = false>( 2970 2995 options: Options<CreateProjectServiceAccountData, ThrowOnError>, 2971 2996 ) { 2972 - return (options.client ?? this._client).post< 2997 + return (options.client ?? this.client).post< 2973 2998 CreateProjectServiceAccountResponses, 2974 2999 CreateProjectServiceAccountErrors, 2975 3000 ThrowOnError ··· 2997 3022 public deleteProjectServiceAccount<ThrowOnError extends boolean = false>( 2998 3023 options: Options<DeleteProjectServiceAccountData, ThrowOnError>, 2999 3024 ) { 3000 - return (options.client ?? this._client).delete< 3025 + return (options.client ?? this.client).delete< 3001 3026 DeleteProjectServiceAccountResponses, 3002 3027 unknown, 3003 3028 ThrowOnError ··· 3021 3046 public retrieveProjectServiceAccount<ThrowOnError extends boolean = false>( 3022 3047 options: Options<RetrieveProjectServiceAccountData, ThrowOnError>, 3023 3048 ) { 3024 - return (options.client ?? this._client).get< 3049 + return (options.client ?? this.client).get< 3025 3050 RetrieveProjectServiceAccountResponses, 3026 3051 unknown, 3027 3052 ThrowOnError ··· 3045 3070 public listProjectUsers<ThrowOnError extends boolean = false>( 3046 3071 options: Options<ListProjectUsersData, ThrowOnError>, 3047 3072 ) { 3048 - return (options.client ?? this._client).get< 3073 + return (options.client ?? this.client).get< 3049 3074 ListProjectUsersResponses, 3050 3075 ListProjectUsersErrors, 3051 3076 ThrowOnError ··· 3069 3094 public createProjectUser<ThrowOnError extends boolean = false>( 3070 3095 options: Options<CreateProjectUserData, ThrowOnError>, 3071 3096 ) { 3072 - return (options.client ?? this._client).post< 3097 + return (options.client ?? this.client).post< 3073 3098 CreateProjectUserResponses, 3074 3099 CreateProjectUserErrors, 3075 3100 ThrowOnError ··· 3097 3122 public deleteProjectUser<ThrowOnError extends boolean = false>( 3098 3123 options: Options<DeleteProjectUserData, ThrowOnError>, 3099 3124 ) { 3100 - return (options.client ?? this._client).delete< 3125 + return (options.client ?? this.client).delete< 3101 3126 DeleteProjectUserResponses, 3102 3127 DeleteProjectUserErrors, 3103 3128 ThrowOnError ··· 3121 3146 public retrieveProjectUser<ThrowOnError extends boolean = false>( 3122 3147 options: Options<RetrieveProjectUserData, ThrowOnError>, 3123 3148 ) { 3124 - return (options.client ?? this._client).get< 3149 + return (options.client ?? this.client).get< 3125 3150 RetrieveProjectUserResponses, 3126 3151 unknown, 3127 3152 ThrowOnError ··· 3145 3170 public modifyProjectUser<ThrowOnError extends boolean = false>( 3146 3171 options: Options<ModifyProjectUserData, ThrowOnError>, 3147 3172 ) { 3148 - return (options.client ?? this._client).post< 3173 + return (options.client ?? this.client).post< 3149 3174 ModifyProjectUserResponses, 3150 3175 ModifyProjectUserErrors, 3151 3176 ThrowOnError ··· 3173 3198 public usageAudioSpeeches<ThrowOnError extends boolean = false>( 3174 3199 options: Options<UsageAudioSpeechesData, ThrowOnError>, 3175 3200 ) { 3176 - return (options.client ?? this._client).get< 3201 + return (options.client ?? this.client).get< 3177 3202 UsageAudioSpeechesResponses, 3178 3203 unknown, 3179 3204 ThrowOnError ··· 3197 3222 public usageAudioTranscriptions<ThrowOnError extends boolean = false>( 3198 3223 options: Options<UsageAudioTranscriptionsData, ThrowOnError>, 3199 3224 ) { 3200 - return (options.client ?? this._client).get< 3225 + return (options.client ?? this.client).get< 3201 3226 UsageAudioTranscriptionsResponses, 3202 3227 unknown, 3203 3228 ThrowOnError ··· 3221 3246 public usageCodeInterpreterSessions<ThrowOnError extends boolean = false>( 3222 3247 options: Options<UsageCodeInterpreterSessionsData, ThrowOnError>, 3223 3248 ) { 3224 - return (options.client ?? this._client).get< 3249 + return (options.client ?? this.client).get< 3225 3250 UsageCodeInterpreterSessionsResponses, 3226 3251 unknown, 3227 3252 ThrowOnError ··· 3245 3270 public usageCompletions<ThrowOnError extends boolean = false>( 3246 3271 options: Options<UsageCompletionsData, ThrowOnError>, 3247 3272 ) { 3248 - return (options.client ?? this._client).get< 3273 + return (options.client ?? this.client).get< 3249 3274 UsageCompletionsResponses, 3250 3275 unknown, 3251 3276 ThrowOnError ··· 3269 3294 public usageEmbeddings<ThrowOnError extends boolean = false>( 3270 3295 options: Options<UsageEmbeddingsData, ThrowOnError>, 3271 3296 ) { 3272 - return (options.client ?? this._client).get< 3297 + return (options.client ?? this.client).get< 3273 3298 UsageEmbeddingsResponses, 3274 3299 unknown, 3275 3300 ThrowOnError ··· 3293 3318 public usageImages<ThrowOnError extends boolean = false>( 3294 3319 options: Options<UsageImagesData, ThrowOnError>, 3295 3320 ) { 3296 - return (options.client ?? this._client).get< 3321 + return (options.client ?? this.client).get< 3297 3322 UsageImagesResponses, 3298 3323 unknown, 3299 3324 ThrowOnError ··· 3317 3342 public usageModerations<ThrowOnError extends boolean = false>( 3318 3343 options: Options<UsageModerationsData, ThrowOnError>, 3319 3344 ) { 3320 - return (options.client ?? this._client).get< 3345 + return (options.client ?? this.client).get< 3321 3346 UsageModerationsResponses, 3322 3347 unknown, 3323 3348 ThrowOnError ··· 3341 3366 public usageVectorStores<ThrowOnError extends boolean = false>( 3342 3367 options: Options<UsageVectorStoresData, ThrowOnError>, 3343 3368 ) { 3344 - return (options.client ?? this._client).get< 3369 + return (options.client ?? this.client).get< 3345 3370 UsageVectorStoresResponses, 3346 3371 unknown, 3347 3372 ThrowOnError ··· 3365 3390 public listUsers<ThrowOnError extends boolean = false>( 3366 3391 options?: Options<ListUsersData, ThrowOnError>, 3367 3392 ) { 3368 - return (options?.client ?? this._client).get< 3393 + return (options?.client ?? this.client).get< 3369 3394 ListUsersResponses, 3370 3395 unknown, 3371 3396 ThrowOnError ··· 3389 3414 public deleteUser<ThrowOnError extends boolean = false>( 3390 3415 options: Options<DeleteUserData, ThrowOnError>, 3391 3416 ) { 3392 - return (options.client ?? this._client).delete< 3417 + return (options.client ?? this.client).delete< 3393 3418 DeleteUserResponses, 3394 3419 unknown, 3395 3420 ThrowOnError ··· 3413 3438 public retrieveUser<ThrowOnError extends boolean = false>( 3414 3439 options: Options<RetrieveUserData, ThrowOnError>, 3415 3440 ) { 3416 - return (options.client ?? this._client).get< 3441 + return (options.client ?? this.client).get< 3417 3442 RetrieveUserResponses, 3418 3443 unknown, 3419 3444 ThrowOnError ··· 3437 3462 public modifyUser<ThrowOnError extends boolean = false>( 3438 3463 options: Options<ModifyUserData, ThrowOnError>, 3439 3464 ) { 3440 - return (options.client ?? this._client).post< 3465 + return (options.client ?? this.client).post< 3441 3466 ModifyUserResponses, 3442 3467 unknown, 3443 3468 ThrowOnError ··· 3472 3497 public createRealtimeSession<ThrowOnError extends boolean = false>( 3473 3498 options: Options<CreateRealtimeSessionData, ThrowOnError>, 3474 3499 ) { 3475 - return (options.client ?? this._client).post< 3500 + return (options.client ?? this.client).post< 3476 3501 CreateRealtimeSessionResponses, 3477 3502 unknown, 3478 3503 ThrowOnError ··· 3507 3532 public createRealtimeTranscriptionSession< 3508 3533 ThrowOnError extends boolean = false, 3509 3534 >(options: Options<CreateRealtimeTranscriptionSessionData, ThrowOnError>) { 3510 - return (options.client ?? this._client).post< 3535 + return (options.client ?? this.client).post< 3511 3536 CreateRealtimeTranscriptionSessionResponses, 3512 3537 unknown, 3513 3538 ThrowOnError ··· 3542 3567 public createResponse<ThrowOnError extends boolean = false>( 3543 3568 options: Options<CreateResponseData, ThrowOnError>, 3544 3569 ) { 3545 - return (options.client ?? this._client).post< 3570 + return (options.client ?? this.client).post< 3546 3571 CreateResponseResponses, 3547 3572 unknown, 3548 3573 ThrowOnError ··· 3571 3596 public deleteResponse<ThrowOnError extends boolean = false>( 3572 3597 options: Options<DeleteResponseData, ThrowOnError>, 3573 3598 ) { 3574 - return (options.client ?? this._client).delete< 3599 + return (options.client ?? this.client).delete< 3575 3600 DeleteResponseResponses, 3576 3601 DeleteResponseErrors, 3577 3602 ThrowOnError ··· 3596 3621 public getResponse<ThrowOnError extends boolean = false>( 3597 3622 options: Options<GetResponseData, ThrowOnError>, 3598 3623 ) { 3599 - return (options.client ?? this._client).get< 3624 + return (options.client ?? this.client).get< 3600 3625 GetResponseResponses, 3601 3626 unknown, 3602 3627 ThrowOnError ··· 3623 3648 public cancelResponse<ThrowOnError extends boolean = false>( 3624 3649 options: Options<CancelResponseData, ThrowOnError>, 3625 3650 ) { 3626 - return (options.client ?? this._client).post< 3651 + return (options.client ?? this.client).post< 3627 3652 CancelResponseResponses, 3628 3653 CancelResponseErrors, 3629 3654 ThrowOnError ··· 3647 3672 public listInputItems<ThrowOnError extends boolean = false>( 3648 3673 options: Options<ListInputItemsData, ThrowOnError>, 3649 3674 ) { 3650 - return (options.client ?? this._client).get< 3675 + return (options.client ?? this.client).get< 3651 3676 ListInputItemsResponses, 3652 3677 unknown, 3653 3678 ThrowOnError ··· 3671 3696 public createThread<ThrowOnError extends boolean = false>( 3672 3697 options?: Options<CreateThreadData, ThrowOnError>, 3673 3698 ) { 3674 - return (options?.client ?? this._client).post< 3699 + return (options?.client ?? this.client).post< 3675 3700 CreateThreadResponses, 3676 3701 unknown, 3677 3702 ThrowOnError ··· 3699 3724 public createThreadAndRun<ThrowOnError extends boolean = false>( 3700 3725 options: Options<CreateThreadAndRunData, ThrowOnError>, 3701 3726 ) { 3702 - return (options.client ?? this._client).post< 3727 + return (options.client ?? this.client).post< 3703 3728 CreateThreadAndRunResponses, 3704 3729 unknown, 3705 3730 ThrowOnError ··· 3727 3752 public deleteThread<ThrowOnError extends boolean = false>( 3728 3753 options: Options<DeleteThreadData, ThrowOnError>, 3729 3754 ) { 3730 - return (options.client ?? this._client).delete< 3755 + return (options.client ?? this.client).delete< 3731 3756 DeleteThreadResponses, 3732 3757 unknown, 3733 3758 ThrowOnError ··· 3751 3776 public getThread<ThrowOnError extends boolean = false>( 3752 3777 options: Options<GetThreadData, ThrowOnError>, 3753 3778 ) { 3754 - return (options.client ?? this._client).get< 3779 + return (options.client ?? this.client).get< 3755 3780 GetThreadResponses, 3756 3781 unknown, 3757 3782 ThrowOnError ··· 3775 3800 public modifyThread<ThrowOnError extends boolean = false>( 3776 3801 options: Options<ModifyThreadData, ThrowOnError>, 3777 3802 ) { 3778 - return (options.client ?? this._client).post< 3803 + return (options.client ?? this.client).post< 3779 3804 ModifyThreadResponses, 3780 3805 unknown, 3781 3806 ThrowOnError ··· 3803 3828 public listMessages<ThrowOnError extends boolean = false>( 3804 3829 options: Options<ListMessagesData, ThrowOnError>, 3805 3830 ) { 3806 - return (options.client ?? this._client).get< 3831 + return (options.client ?? this.client).get< 3807 3832 ListMessagesResponses, 3808 3833 unknown, 3809 3834 ThrowOnError ··· 3827 3852 public createMessage<ThrowOnError extends boolean = false>( 3828 3853 options: Options<CreateMessageData, ThrowOnError>, 3829 3854 ) { 3830 - return (options.client ?? this._client).post< 3855 + return (options.client ?? this.client).post< 3831 3856 CreateMessageResponses, 3832 3857 unknown, 3833 3858 ThrowOnError ··· 3855 3880 public deleteMessage<ThrowOnError extends boolean = false>( 3856 3881 options: Options<DeleteMessageData, ThrowOnError>, 3857 3882 ) { 3858 - return (options.client ?? this._client).delete< 3883 + return (options.client ?? this.client).delete< 3859 3884 DeleteMessageResponses, 3860 3885 unknown, 3861 3886 ThrowOnError ··· 3879 3904 public getMessage<ThrowOnError extends boolean = false>( 3880 3905 options: Options<GetMessageData, ThrowOnError>, 3881 3906 ) { 3882 - return (options.client ?? this._client).get< 3907 + return (options.client ?? this.client).get< 3883 3908 GetMessageResponses, 3884 3909 unknown, 3885 3910 ThrowOnError ··· 3903 3928 public modifyMessage<ThrowOnError extends boolean = false>( 3904 3929 options: Options<ModifyMessageData, ThrowOnError>, 3905 3930 ) { 3906 - return (options.client ?? this._client).post< 3931 + return (options.client ?? this.client).post< 3907 3932 ModifyMessageResponses, 3908 3933 unknown, 3909 3934 ThrowOnError ··· 3931 3956 public listRuns<ThrowOnError extends boolean = false>( 3932 3957 options: Options<ListRunsData, ThrowOnError>, 3933 3958 ) { 3934 - return (options.client ?? this._client).get< 3959 + return (options.client ?? this.client).get< 3935 3960 ListRunsResponses, 3936 3961 unknown, 3937 3962 ThrowOnError ··· 3955 3980 public createRun<ThrowOnError extends boolean = false>( 3956 3981 options: Options<CreateRunData, ThrowOnError>, 3957 3982 ) { 3958 - return (options.client ?? this._client).post< 3983 + return (options.client ?? this.client).post< 3959 3984 CreateRunResponses, 3960 3985 unknown, 3961 3986 ThrowOnError ··· 3983 4008 public getRun<ThrowOnError extends boolean = false>( 3984 4009 options: Options<GetRunData, ThrowOnError>, 3985 4010 ) { 3986 - return (options.client ?? this._client).get< 4011 + return (options.client ?? this.client).get< 3987 4012 GetRunResponses, 3988 4013 unknown, 3989 4014 ThrowOnError ··· 4007 4032 public modifyRun<ThrowOnError extends boolean = false>( 4008 4033 options: Options<ModifyRunData, ThrowOnError>, 4009 4034 ) { 4010 - return (options.client ?? this._client).post< 4035 + return (options.client ?? this.client).post< 4011 4036 ModifyRunResponses, 4012 4037 unknown, 4013 4038 ThrowOnError ··· 4035 4060 public cancelRun<ThrowOnError extends boolean = false>( 4036 4061 options: Options<CancelRunData, ThrowOnError>, 4037 4062 ) { 4038 - return (options.client ?? this._client).post< 4063 + return (options.client ?? this.client).post< 4039 4064 CancelRunResponses, 4040 4065 unknown, 4041 4066 ThrowOnError ··· 4059 4084 public listRunSteps<ThrowOnError extends boolean = false>( 4060 4085 options: Options<ListRunStepsData, ThrowOnError>, 4061 4086 ) { 4062 - return (options.client ?? this._client).get< 4087 + return (options.client ?? this.client).get< 4063 4088 ListRunStepsResponses, 4064 4089 unknown, 4065 4090 ThrowOnError ··· 4083 4108 public getRunStep<ThrowOnError extends boolean = false>( 4084 4109 options: Options<GetRunStepData, ThrowOnError>, 4085 4110 ) { 4086 - return (options.client ?? this._client).get< 4111 + return (options.client ?? this.client).get< 4087 4112 GetRunStepResponses, 4088 4113 unknown, 4089 4114 ThrowOnError ··· 4108 4133 public submitToolOuputsToRun<ThrowOnError extends boolean = false>( 4109 4134 options: Options<SubmitToolOuputsToRunData, ThrowOnError>, 4110 4135 ) { 4111 - return (options.client ?? this._client).post< 4136 + return (options.client ?? this.client).post< 4112 4137 SubmitToolOuputsToRunResponses, 4113 4138 unknown, 4114 4139 ThrowOnError ··· 4153 4178 public createUpload<ThrowOnError extends boolean = false>( 4154 4179 options: Options<CreateUploadData, ThrowOnError>, 4155 4180 ) { 4156 - return (options.client ?? this._client).post< 4181 + return (options.client ?? this.client).post< 4157 4182 CreateUploadResponses, 4158 4183 unknown, 4159 4184 ThrowOnError ··· 4182 4207 public cancelUpload<ThrowOnError extends boolean = false>( 4183 4208 options: Options<CancelUploadData, ThrowOnError>, 4184 4209 ) { 4185 - return (options.client ?? this._client).post< 4210 + return (options.client ?? this.client).post< 4186 4211 CancelUploadResponses, 4187 4212 unknown, 4188 4213 ThrowOnError ··· 4213 4238 public completeUpload<ThrowOnError extends boolean = false>( 4214 4239 options: Options<CompleteUploadData, ThrowOnError>, 4215 4240 ) { 4216 - return (options.client ?? this._client).post< 4241 + return (options.client ?? this.client).post< 4217 4242 CompleteUploadResponses, 4218 4243 unknown, 4219 4244 ThrowOnError ··· 4246 4271 public addUploadPart<ThrowOnError extends boolean = false>( 4247 4272 options: Options<AddUploadPartData, ThrowOnError>, 4248 4273 ) { 4249 - return (options.client ?? this._client).post< 4274 + return (options.client ?? this.client).post< 4250 4275 AddUploadPartResponses, 4251 4276 unknown, 4252 4277 ThrowOnError ··· 4275 4300 public listVectorStores<ThrowOnError extends boolean = false>( 4276 4301 options?: Options<ListVectorStoresData, ThrowOnError>, 4277 4302 ) { 4278 - return (options?.client ?? this._client).get< 4303 + return (options?.client ?? this.client).get< 4279 4304 ListVectorStoresResponses, 4280 4305 unknown, 4281 4306 ThrowOnError ··· 4299 4324 public createVectorStore<ThrowOnError extends boolean = false>( 4300 4325 options: Options<CreateVectorStoreData, ThrowOnError>, 4301 4326 ) { 4302 - return (options.client ?? this._client).post< 4327 + return (options.client ?? this.client).post< 4303 4328 CreateVectorStoreResponses, 4304 4329 unknown, 4305 4330 ThrowOnError ··· 4327 4352 public deleteVectorStore<ThrowOnError extends boolean = false>( 4328 4353 options: Options<DeleteVectorStoreData, ThrowOnError>, 4329 4354 ) { 4330 - return (options.client ?? this._client).delete< 4355 + return (options.client ?? this.client).delete< 4331 4356 DeleteVectorStoreResponses, 4332 4357 unknown, 4333 4358 ThrowOnError ··· 4351 4376 public getVectorStore<ThrowOnError extends boolean = false>( 4352 4377 options: Options<GetVectorStoreData, ThrowOnError>, 4353 4378 ) { 4354 - return (options.client ?? this._client).get< 4379 + return (options.client ?? this.client).get< 4355 4380 GetVectorStoreResponses, 4356 4381 unknown, 4357 4382 ThrowOnError ··· 4375 4400 public modifyVectorStore<ThrowOnError extends boolean = false>( 4376 4401 options: Options<ModifyVectorStoreData, ThrowOnError>, 4377 4402 ) { 4378 - return (options.client ?? this._client).post< 4403 + return (options.client ?? this.client).post< 4379 4404 ModifyVectorStoreResponses, 4380 4405 unknown, 4381 4406 ThrowOnError ··· 4403 4428 public createVectorStoreFileBatch<ThrowOnError extends boolean = false>( 4404 4429 options: Options<CreateVectorStoreFileBatchData, ThrowOnError>, 4405 4430 ) { 4406 - return (options.client ?? this._client).post< 4431 + return (options.client ?? this.client).post< 4407 4432 CreateVectorStoreFileBatchResponses, 4408 4433 unknown, 4409 4434 ThrowOnError ··· 4431 4456 public getVectorStoreFileBatch<ThrowOnError extends boolean = false>( 4432 4457 options: Options<GetVectorStoreFileBatchData, ThrowOnError>, 4433 4458 ) { 4434 - return (options.client ?? this._client).get< 4459 + return (options.client ?? this.client).get< 4435 4460 GetVectorStoreFileBatchResponses, 4436 4461 unknown, 4437 4462 ThrowOnError ··· 4455 4480 public cancelVectorStoreFileBatch<ThrowOnError extends boolean = false>( 4456 4481 options: Options<CancelVectorStoreFileBatchData, ThrowOnError>, 4457 4482 ) { 4458 - return (options.client ?? this._client).post< 4483 + return (options.client ?? this.client).post< 4459 4484 CancelVectorStoreFileBatchResponses, 4460 4485 unknown, 4461 4486 ThrowOnError ··· 4479 4504 public listFilesInVectorStoreBatch<ThrowOnError extends boolean = false>( 4480 4505 options: Options<ListFilesInVectorStoreBatchData, ThrowOnError>, 4481 4506 ) { 4482 - return (options.client ?? this._client).get< 4507 + return (options.client ?? this.client).get< 4483 4508 ListFilesInVectorStoreBatchResponses, 4484 4509 unknown, 4485 4510 ThrowOnError ··· 4503 4528 public listVectorStoreFiles<ThrowOnError extends boolean = false>( 4504 4529 options: Options<ListVectorStoreFilesData, ThrowOnError>, 4505 4530 ) { 4506 - return (options.client ?? this._client).get< 4531 + return (options.client ?? this.client).get< 4507 4532 ListVectorStoreFilesResponses, 4508 4533 unknown, 4509 4534 ThrowOnError ··· 4527 4552 public createVectorStoreFile<ThrowOnError extends boolean = false>( 4528 4553 options: Options<CreateVectorStoreFileData, ThrowOnError>, 4529 4554 ) { 4530 - return (options.client ?? this._client).post< 4555 + return (options.client ?? this.client).post< 4531 4556 CreateVectorStoreFileResponses, 4532 4557 unknown, 4533 4558 ThrowOnError ··· 4555 4580 public deleteVectorStoreFile<ThrowOnError extends boolean = false>( 4556 4581 options: Options<DeleteVectorStoreFileData, ThrowOnError>, 4557 4582 ) { 4558 - return (options.client ?? this._client).delete< 4583 + return (options.client ?? this.client).delete< 4559 4584 DeleteVectorStoreFileResponses, 4560 4585 unknown, 4561 4586 ThrowOnError ··· 4579 4604 public getVectorStoreFile<ThrowOnError extends boolean = false>( 4580 4605 options: Options<GetVectorStoreFileData, ThrowOnError>, 4581 4606 ) { 4582 - return (options.client ?? this._client).get< 4607 + return (options.client ?? this.client).get< 4583 4608 GetVectorStoreFileResponses, 4584 4609 unknown, 4585 4610 ThrowOnError ··· 4603 4628 public updateVectorStoreFileAttributes<ThrowOnError extends boolean = false>( 4604 4629 options: Options<UpdateVectorStoreFileAttributesData, ThrowOnError>, 4605 4630 ) { 4606 - return (options.client ?? this._client).post< 4631 + return (options.client ?? this.client).post< 4607 4632 UpdateVectorStoreFileAttributesResponses, 4608 4633 unknown, 4609 4634 ThrowOnError ··· 4631 4656 public retrieveVectorStoreFileContent<ThrowOnError extends boolean = false>( 4632 4657 options: Options<RetrieveVectorStoreFileContentData, ThrowOnError>, 4633 4658 ) { 4634 - return (options.client ?? this._client).get< 4659 + return (options.client ?? this.client).get< 4635 4660 RetrieveVectorStoreFileContentResponses, 4636 4661 unknown, 4637 4662 ThrowOnError ··· 4655 4680 public searchVectorStore<ThrowOnError extends boolean = false>( 4656 4681 options: Options<SearchVectorStoreData, ThrowOnError>, 4657 4682 ) { 4658 - return (options.client ?? this._client).post< 4683 + return (options.client ?? this.client).post< 4659 4684 SearchVectorStoreResponses, 4660 4685 unknown, 4661 4686 ThrowOnError
+4 -1
examples/openapi-ts-tanstack-react-query/openapi-ts.config.ts
··· 11 11 plugins: [ 12 12 '@hey-api/client-fetch', 13 13 '@hey-api/schemas', 14 - '@hey-api/sdk', 14 + { 15 + instance: true, 16 + name: '@hey-api/sdk', 17 + }, 15 18 { 16 19 enums: 'javascript', 17 20 name: '@hey-api/typescript',
+20 -41
examples/openapi-ts-tanstack-react-query/src/client/@tanstack/react-query.gen.ts
··· 7 7 } from '@tanstack/react-query'; 8 8 9 9 import { client } from '../client.gen'; 10 - import { 11 - addPet, 12 - createUser, 13 - createUsersWithListInput, 14 - deleteOrder, 15 - deletePet, 16 - deleteUser, 17 - findPetsByStatus, 18 - findPetsByTags, 19 - getInventory, 20 - getOrderById, 21 - getPetById, 22 - getUserByName, 23 - loginUser, 24 - logoutUser, 25 - type Options, 26 - placeOrder, 27 - updatePet, 28 - updatePetWithForm, 29 - updateUser, 30 - uploadFile, 31 - } from '../sdk.gen'; 10 + import { type Options, Sdk } from '../sdk.gen'; 32 11 import type { 33 12 AddPetData, 34 13 AddPetResponse, ··· 72 51 Options<AddPetData> 73 52 > = { 74 53 mutationFn: async (fnOptions) => { 75 - const { data } = await addPet({ 54 + const { data } = await Sdk.__registry.get().addPet({ 76 55 ...options, 77 56 ...fnOptions, 78 57 throwOnError: true, ··· 101 80 Options<UpdatePetData> 102 81 > = { 103 82 mutationFn: async (fnOptions) => { 104 - const { data } = await updatePet({ 83 + const { data } = await Sdk.__registry.get().updatePet({ 105 84 ...options, 106 85 ...fnOptions, 107 86 throwOnError: true, ··· 166 145 ) => 167 146 queryOptions({ 168 147 queryFn: async ({ queryKey, signal }) => { 169 - const { data } = await findPetsByStatus({ 148 + const { data } = await Sdk.__registry.get().findPetsByStatus({ 170 149 ...options, 171 150 ...queryKey[0], 172 151 signal, ··· 188 167 export const findPetsByTagsOptions = (options: Options<FindPetsByTagsData>) => 189 168 queryOptions({ 190 169 queryFn: async ({ queryKey, signal }) => { 191 - const { data } = await findPetsByTags({ 170 + const { data } = await Sdk.__registry.get().findPetsByTags({ 192 171 ...options, 193 172 ...queryKey[0], 194 173 signal, ··· 213 192 Options<DeletePetData> 214 193 > = { 215 194 mutationFn: async (fnOptions) => { 216 - const { data } = await deletePet({ 195 + const { data } = await Sdk.__registry.get().deletePet({ 217 196 ...options, 218 197 ...fnOptions, 219 198 throwOnError: true, ··· 235 214 export const getPetByIdOptions = (options: Options<GetPetByIdData>) => 236 215 queryOptions({ 237 216 queryFn: async ({ queryKey, signal }) => { 238 - const { data } = await getPetById({ 217 + const { data } = await Sdk.__registry.get().getPetById({ 239 218 ...options, 240 219 ...queryKey[0], 241 220 signal, ··· 264 243 Options<UpdatePetWithFormData> 265 244 > = { 266 245 mutationFn: async (fnOptions) => { 267 - const { data } = await updatePetWithForm({ 246 + const { data } = await Sdk.__registry.get().updatePetWithForm({ 268 247 ...options, 269 248 ...fnOptions, 270 249 throwOnError: true, ··· 293 272 Options<UploadFileData> 294 273 > = { 295 274 mutationFn: async (fnOptions) => { 296 - const { data } = await uploadFile({ 275 + const { data } = await Sdk.__registry.get().uploadFile({ 297 276 ...options, 298 277 ...fnOptions, 299 278 throwOnError: true, ··· 315 294 export const getInventoryOptions = (options?: Options<GetInventoryData>) => 316 295 queryOptions({ 317 296 queryFn: async ({ queryKey, signal }) => { 318 - const { data } = await getInventory({ 297 + const { data } = await Sdk.__registry.get().getInventory({ 319 298 ...options, 320 299 ...queryKey[0], 321 300 signal, ··· 344 323 Options<PlaceOrderData> 345 324 > = { 346 325 mutationFn: async (fnOptions) => { 347 - const { data } = await placeOrder({ 326 + const { data } = await Sdk.__registry.get().placeOrder({ 348 327 ...options, 349 328 ...fnOptions, 350 329 throwOnError: true, ··· 369 348 Options<DeleteOrderData> 370 349 > = { 371 350 mutationFn: async (fnOptions) => { 372 - const { data } = await deleteOrder({ 351 + const { data } = await Sdk.__registry.get().deleteOrder({ 373 352 ...options, 374 353 ...fnOptions, 375 354 throwOnError: true, ··· 391 370 export const getOrderByIdOptions = (options: Options<GetOrderByIdData>) => 392 371 queryOptions({ 393 372 queryFn: async ({ queryKey, signal }) => { 394 - const { data } = await getOrderById({ 373 + const { data } = await Sdk.__registry.get().getOrderById({ 395 374 ...options, 396 375 ...queryKey[0], 397 376 signal, ··· 420 399 Options<CreateUserData> 421 400 > = { 422 401 mutationFn: async (fnOptions) => { 423 - const { data } = await createUser({ 402 + const { data } = await Sdk.__registry.get().createUser({ 424 403 ...options, 425 404 ...fnOptions, 426 405 throwOnError: true, ··· 449 428 Options<CreateUsersWithListInputData> 450 429 > = { 451 430 mutationFn: async (fnOptions) => { 452 - const { data } = await createUsersWithListInput({ 431 + const { data } = await Sdk.__registry.get().createUsersWithListInput({ 453 432 ...options, 454 433 ...fnOptions, 455 434 throwOnError: true, ··· 471 450 export const loginUserOptions = (options?: Options<LoginUserData>) => 472 451 queryOptions({ 473 452 queryFn: async ({ queryKey, signal }) => { 474 - const { data } = await loginUser({ 453 + const { data } = await Sdk.__registry.get().loginUser({ 475 454 ...options, 476 455 ...queryKey[0], 477 456 signal, ··· 493 472 export const logoutUserOptions = (options?: Options<LogoutUserData>) => 494 473 queryOptions({ 495 474 queryFn: async ({ queryKey, signal }) => { 496 - const { data } = await logoutUser({ 475 + const { data } = await Sdk.__registry.get().logoutUser({ 497 476 ...options, 498 477 ...queryKey[0], 499 478 signal, ··· 518 497 Options<DeleteUserData> 519 498 > = { 520 499 mutationFn: async (fnOptions) => { 521 - const { data } = await deleteUser({ 500 + const { data } = await Sdk.__registry.get().deleteUser({ 522 501 ...options, 523 502 ...fnOptions, 524 503 throwOnError: true, ··· 540 519 export const getUserByNameOptions = (options: Options<GetUserByNameData>) => 541 520 queryOptions({ 542 521 queryFn: async ({ queryKey, signal }) => { 543 - const { data } = await getUserByName({ 522 + const { data } = await Sdk.__registry.get().getUserByName({ 544 523 ...options, 545 524 ...queryKey[0], 546 525 signal, ··· 565 544 Options<UpdateUserData> 566 545 > = { 567 546 mutationFn: async (fnOptions) => { 568 - const { data } = await updateUser({ 547 + const { data } = await Sdk.__registry.get().updateUser({ 569 548 ...options, 570 549 ...fnOptions, 571 550 throwOnError: true,
+444 -384
examples/openapi-ts-tanstack-react-query/src/client/sdk.gen.ts
··· 79 79 meta?: Record<string, unknown>; 80 80 }; 81 81 82 - /** 83 - * Add a new pet to the store. 84 - * 85 - * Add a new pet to the store. 86 - */ 87 - export const addPet = <ThrowOnError extends boolean = false>( 88 - options: Options<AddPetData, ThrowOnError>, 89 - ) => 90 - (options.client ?? client).post<AddPetResponses, AddPetErrors, ThrowOnError>({ 91 - security: [ 92 - { 93 - scheme: 'bearer', 94 - type: 'http', 95 - }, 96 - ], 97 - url: '/pet', 98 - ...options, 99 - headers: { 100 - 'Content-Type': 'application/json', 101 - ...options.headers, 102 - }, 103 - }); 82 + class HeyApiClient { 83 + protected client: Client; 104 84 105 - /** 106 - * Update an existing pet. 107 - * 108 - * Update an existing pet by Id. 109 - */ 110 - export const updatePet = <ThrowOnError extends boolean = false>( 111 - options: Options<UpdatePetData, ThrowOnError>, 112 - ) => 113 - (options.client ?? client).put< 114 - UpdatePetResponses, 115 - UpdatePetErrors, 116 - ThrowOnError 117 - >({ 118 - security: [ 119 - { 120 - scheme: 'bearer', 121 - type: 'http', 122 - }, 123 - ], 124 - url: '/pet', 125 - ...options, 126 - headers: { 127 - 'Content-Type': 'application/json', 128 - ...options.headers, 129 - }, 130 - }); 85 + constructor(args?: { client?: Client }) { 86 + this.client = args?.client ?? client; 87 + } 88 + } 131 89 132 - /** 133 - * Finds Pets by status. 134 - * 135 - * Multiple status values can be provided with comma separated strings. 136 - */ 137 - export const findPetsByStatus = <ThrowOnError extends boolean = false>( 138 - options: Options<FindPetsByStatusData, ThrowOnError>, 139 - ) => 140 - (options.client ?? client).get< 141 - FindPetsByStatusResponses, 142 - FindPetsByStatusErrors, 143 - ThrowOnError 144 - >({ 145 - security: [ 146 - { 147 - scheme: 'bearer', 148 - type: 'http', 149 - }, 150 - ], 151 - url: '/pet/findByStatus', 152 - ...options, 153 - }); 90 + class HeyApiRegistry<T> { 91 + private readonly defaultKey = 'default'; 154 92 155 - /** 156 - * Finds Pets by tags. 157 - * 158 - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 159 - */ 160 - export const findPetsByTags = <ThrowOnError extends boolean = false>( 161 - options: Options<FindPetsByTagsData, ThrowOnError>, 162 - ) => 163 - (options.client ?? client).get< 164 - FindPetsByTagsResponses, 165 - FindPetsByTagsErrors, 166 - ThrowOnError 167 - >({ 168 - security: [ 169 - { 170 - scheme: 'bearer', 171 - type: 'http', 172 - }, 173 - ], 174 - url: '/pet/findByTags', 175 - ...options, 176 - }); 93 + private readonly instances: Map<string, T> = new Map(); 94 + 95 + get(key?: string): T { 96 + const instance = this.instances.get(key ?? this.defaultKey); 97 + if (!instance) { 98 + throw new Error( 99 + `No SDK client found. Create one with "new Sdk()" to fix this error.`, 100 + ); 101 + } 102 + return instance; 103 + } 104 + 105 + set(value: T, key?: string): void { 106 + this.instances.set(key ?? this.defaultKey, value); 107 + } 108 + } 177 109 178 - /** 179 - * Deletes a pet. 180 - * 181 - * Delete a pet. 182 - */ 183 - export const deletePet = <ThrowOnError extends boolean = false>( 184 - options: Options<DeletePetData, ThrowOnError>, 185 - ) => 186 - (options.client ?? client).delete< 187 - DeletePetResponses, 188 - DeletePetErrors, 189 - ThrowOnError 190 - >({ 191 - security: [ 192 - { 193 - scheme: 'bearer', 194 - type: 'http', 195 - }, 196 - ], 197 - url: '/pet/{petId}', 198 - ...options, 199 - }); 110 + export class Sdk extends HeyApiClient { 111 + public static readonly __registry = new HeyApiRegistry<Sdk>(); 200 112 201 - /** 202 - * Find pet by ID. 203 - * 204 - * Returns a single pet. 205 - */ 206 - export const getPetById = <ThrowOnError extends boolean = false>( 207 - options: Options<GetPetByIdData, ThrowOnError>, 208 - ) => 209 - (options.client ?? client).get< 210 - GetPetByIdResponses, 211 - GetPetByIdErrors, 212 - ThrowOnError 213 - >({ 214 - security: [ 215 - { 216 - name: 'api_key', 217 - type: 'apiKey', 218 - }, 219 - { 220 - scheme: 'bearer', 221 - type: 'http', 222 - }, 223 - ], 224 - url: '/pet/{petId}', 225 - ...options, 226 - }); 113 + constructor(args?: { client?: Client; key?: string }) { 114 + super(args); 115 + Sdk.__registry.set(this, args?.key); 116 + } 227 117 228 - /** 229 - * Updates a pet in the store with form data. 230 - * 231 - * Updates a pet resource based on the form data. 232 - */ 233 - export const updatePetWithForm = <ThrowOnError extends boolean = false>( 234 - options: Options<UpdatePetWithFormData, ThrowOnError>, 235 - ) => 236 - (options.client ?? client).post< 237 - UpdatePetWithFormResponses, 238 - UpdatePetWithFormErrors, 239 - ThrowOnError 240 - >({ 241 - security: [ 242 - { 243 - scheme: 'bearer', 244 - type: 'http', 118 + /** 119 + * Add a new pet to the store. 120 + * 121 + * Add a new pet to the store. 122 + */ 123 + public addPet<ThrowOnError extends boolean = false>( 124 + options: Options<AddPetData, ThrowOnError>, 125 + ) { 126 + return (options.client ?? this.client).post< 127 + AddPetResponses, 128 + AddPetErrors, 129 + ThrowOnError 130 + >({ 131 + security: [ 132 + { 133 + scheme: 'bearer', 134 + type: 'http', 135 + }, 136 + ], 137 + url: '/pet', 138 + ...options, 139 + headers: { 140 + 'Content-Type': 'application/json', 141 + ...options.headers, 245 142 }, 246 - ], 247 - url: '/pet/{petId}', 248 - ...options, 249 - }); 143 + }); 144 + } 250 145 251 - /** 252 - * Uploads an image. 253 - * 254 - * Upload image of the pet. 255 - */ 256 - export const uploadFile = <ThrowOnError extends boolean = false>( 257 - options: Options<UploadFileData, ThrowOnError>, 258 - ) => 259 - (options.client ?? client).post< 260 - UploadFileResponses, 261 - UploadFileErrors, 262 - ThrowOnError 263 - >({ 264 - bodySerializer: null, 265 - security: [ 266 - { 267 - scheme: 'bearer', 268 - type: 'http', 146 + /** 147 + * Update an existing pet. 148 + * 149 + * Update an existing pet by Id. 150 + */ 151 + public updatePet<ThrowOnError extends boolean = false>( 152 + options: Options<UpdatePetData, ThrowOnError>, 153 + ) { 154 + return (options.client ?? this.client).put< 155 + UpdatePetResponses, 156 + UpdatePetErrors, 157 + ThrowOnError 158 + >({ 159 + security: [ 160 + { 161 + scheme: 'bearer', 162 + type: 'http', 163 + }, 164 + ], 165 + url: '/pet', 166 + ...options, 167 + headers: { 168 + 'Content-Type': 'application/json', 169 + ...options.headers, 269 170 }, 270 - ], 271 - url: '/pet/{petId}/uploadImage', 272 - ...options, 273 - headers: { 274 - 'Content-Type': 'application/octet-stream', 275 - ...options.headers, 276 - }, 277 - }); 171 + }); 172 + } 173 + 174 + /** 175 + * Finds Pets by status. 176 + * 177 + * Multiple status values can be provided with comma separated strings. 178 + */ 179 + public findPetsByStatus<ThrowOnError extends boolean = false>( 180 + options: Options<FindPetsByStatusData, ThrowOnError>, 181 + ) { 182 + return (options.client ?? this.client).get< 183 + FindPetsByStatusResponses, 184 + FindPetsByStatusErrors, 185 + ThrowOnError 186 + >({ 187 + security: [ 188 + { 189 + scheme: 'bearer', 190 + type: 'http', 191 + }, 192 + ], 193 + url: '/pet/findByStatus', 194 + ...options, 195 + }); 196 + } 197 + 198 + /** 199 + * Finds Pets by tags. 200 + * 201 + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. 202 + */ 203 + public findPetsByTags<ThrowOnError extends boolean = false>( 204 + options: Options<FindPetsByTagsData, ThrowOnError>, 205 + ) { 206 + return (options.client ?? this.client).get< 207 + FindPetsByTagsResponses, 208 + FindPetsByTagsErrors, 209 + ThrowOnError 210 + >({ 211 + security: [ 212 + { 213 + scheme: 'bearer', 214 + type: 'http', 215 + }, 216 + ], 217 + url: '/pet/findByTags', 218 + ...options, 219 + }); 220 + } 221 + 222 + /** 223 + * Deletes a pet. 224 + * 225 + * Delete a pet. 226 + */ 227 + public deletePet<ThrowOnError extends boolean = false>( 228 + options: Options<DeletePetData, ThrowOnError>, 229 + ) { 230 + return (options.client ?? this.client).delete< 231 + DeletePetResponses, 232 + DeletePetErrors, 233 + ThrowOnError 234 + >({ 235 + security: [ 236 + { 237 + scheme: 'bearer', 238 + type: 'http', 239 + }, 240 + ], 241 + url: '/pet/{petId}', 242 + ...options, 243 + }); 244 + } 245 + 246 + /** 247 + * Find pet by ID. 248 + * 249 + * Returns a single pet. 250 + */ 251 + public getPetById<ThrowOnError extends boolean = false>( 252 + options: Options<GetPetByIdData, ThrowOnError>, 253 + ) { 254 + return (options.client ?? this.client).get< 255 + GetPetByIdResponses, 256 + GetPetByIdErrors, 257 + ThrowOnError 258 + >({ 259 + security: [ 260 + { 261 + name: 'api_key', 262 + type: 'apiKey', 263 + }, 264 + { 265 + scheme: 'bearer', 266 + type: 'http', 267 + }, 268 + ], 269 + url: '/pet/{petId}', 270 + ...options, 271 + }); 272 + } 273 + 274 + /** 275 + * Updates a pet in the store with form data. 276 + * 277 + * Updates a pet resource based on the form data. 278 + */ 279 + public updatePetWithForm<ThrowOnError extends boolean = false>( 280 + options: Options<UpdatePetWithFormData, ThrowOnError>, 281 + ) { 282 + return (options.client ?? this.client).post< 283 + UpdatePetWithFormResponses, 284 + UpdatePetWithFormErrors, 285 + ThrowOnError 286 + >({ 287 + security: [ 288 + { 289 + scheme: 'bearer', 290 + type: 'http', 291 + }, 292 + ], 293 + url: '/pet/{petId}', 294 + ...options, 295 + }); 296 + } 278 297 279 - /** 280 - * Returns pet inventories by status. 281 - * 282 - * Returns a map of status codes to quantities. 283 - */ 284 - export const getInventory = <ThrowOnError extends boolean = false>( 285 - options?: Options<GetInventoryData, ThrowOnError>, 286 - ) => 287 - (options?.client ?? client).get< 288 - GetInventoryResponses, 289 - GetInventoryErrors, 290 - ThrowOnError 291 - >({ 292 - security: [ 293 - { 294 - name: 'api_key', 295 - type: 'apiKey', 298 + /** 299 + * Uploads an image. 300 + * 301 + * Upload image of the pet. 302 + */ 303 + public uploadFile<ThrowOnError extends boolean = false>( 304 + options: Options<UploadFileData, ThrowOnError>, 305 + ) { 306 + return (options.client ?? this.client).post< 307 + UploadFileResponses, 308 + UploadFileErrors, 309 + ThrowOnError 310 + >({ 311 + bodySerializer: null, 312 + security: [ 313 + { 314 + scheme: 'bearer', 315 + type: 'http', 316 + }, 317 + ], 318 + url: '/pet/{petId}/uploadImage', 319 + ...options, 320 + headers: { 321 + 'Content-Type': 'application/octet-stream', 322 + ...options.headers, 296 323 }, 297 - ], 298 - url: '/store/inventory', 299 - ...options, 300 - }); 324 + }); 325 + } 301 326 302 - /** 303 - * Place an order for a pet. 304 - * 305 - * Place a new order in the store. 306 - */ 307 - export const placeOrder = <ThrowOnError extends boolean = false>( 308 - options?: Options<PlaceOrderData, ThrowOnError>, 309 - ) => 310 - (options?.client ?? client).post< 311 - PlaceOrderResponses, 312 - PlaceOrderErrors, 313 - ThrowOnError 314 - >({ 315 - url: '/store/order', 316 - ...options, 317 - headers: { 318 - 'Content-Type': 'application/json', 319 - ...options?.headers, 320 - }, 321 - }); 327 + /** 328 + * Returns pet inventories by status. 329 + * 330 + * Returns a map of status codes to quantities. 331 + */ 332 + public getInventory<ThrowOnError extends boolean = false>( 333 + options?: Options<GetInventoryData, ThrowOnError>, 334 + ) { 335 + return (options?.client ?? this.client).get< 336 + GetInventoryResponses, 337 + GetInventoryErrors, 338 + ThrowOnError 339 + >({ 340 + security: [ 341 + { 342 + name: 'api_key', 343 + type: 'apiKey', 344 + }, 345 + ], 346 + url: '/store/inventory', 347 + ...options, 348 + }); 349 + } 322 350 323 - /** 324 - * Delete purchase order by identifier. 325 - * 326 - * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 327 - */ 328 - export const deleteOrder = <ThrowOnError extends boolean = false>( 329 - options: Options<DeleteOrderData, ThrowOnError>, 330 - ) => 331 - (options.client ?? client).delete< 332 - DeleteOrderResponses, 333 - DeleteOrderErrors, 334 - ThrowOnError 335 - >({ 336 - url: '/store/order/{orderId}', 337 - ...options, 338 - }); 351 + /** 352 + * Place an order for a pet. 353 + * 354 + * Place a new order in the store. 355 + */ 356 + public placeOrder<ThrowOnError extends boolean = false>( 357 + options?: Options<PlaceOrderData, ThrowOnError>, 358 + ) { 359 + return (options?.client ?? this.client).post< 360 + PlaceOrderResponses, 361 + PlaceOrderErrors, 362 + ThrowOnError 363 + >({ 364 + url: '/store/order', 365 + ...options, 366 + headers: { 367 + 'Content-Type': 'application/json', 368 + ...options?.headers, 369 + }, 370 + }); 371 + } 339 372 340 - /** 341 - * Find purchase order by ID. 342 - * 343 - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 344 - */ 345 - export const getOrderById = <ThrowOnError extends boolean = false>( 346 - options: Options<GetOrderByIdData, ThrowOnError>, 347 - ) => 348 - (options.client ?? client).get< 349 - GetOrderByIdResponses, 350 - GetOrderByIdErrors, 351 - ThrowOnError 352 - >({ 353 - url: '/store/order/{orderId}', 354 - ...options, 355 - }); 373 + /** 374 + * Delete purchase order by identifier. 375 + * 376 + * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. 377 + */ 378 + public deleteOrder<ThrowOnError extends boolean = false>( 379 + options: Options<DeleteOrderData, ThrowOnError>, 380 + ) { 381 + return (options.client ?? this.client).delete< 382 + DeleteOrderResponses, 383 + DeleteOrderErrors, 384 + ThrowOnError 385 + >({ 386 + url: '/store/order/{orderId}', 387 + ...options, 388 + }); 389 + } 356 390 357 - /** 358 - * Create user. 359 - * 360 - * This can only be done by the logged in user. 361 - */ 362 - export const createUser = <ThrowOnError extends boolean = false>( 363 - options?: Options<CreateUserData, ThrowOnError>, 364 - ) => 365 - (options?.client ?? client).post< 366 - CreateUserResponses, 367 - CreateUserErrors, 368 - ThrowOnError 369 - >({ 370 - url: '/user', 371 - ...options, 372 - headers: { 373 - 'Content-Type': 'application/json', 374 - ...options?.headers, 375 - }, 376 - }); 391 + /** 392 + * Find purchase order by ID. 393 + * 394 + * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. 395 + */ 396 + public getOrderById<ThrowOnError extends boolean = false>( 397 + options: Options<GetOrderByIdData, ThrowOnError>, 398 + ) { 399 + return (options.client ?? this.client).get< 400 + GetOrderByIdResponses, 401 + GetOrderByIdErrors, 402 + ThrowOnError 403 + >({ 404 + url: '/store/order/{orderId}', 405 + ...options, 406 + }); 407 + } 377 408 378 - /** 379 - * Creates list of users with given input array. 380 - * 381 - * Creates list of users with given input array. 382 - */ 383 - export const createUsersWithListInput = <ThrowOnError extends boolean = false>( 384 - options?: Options<CreateUsersWithListInputData, ThrowOnError>, 385 - ) => 386 - (options?.client ?? client).post< 387 - CreateUsersWithListInputResponses, 388 - CreateUsersWithListInputErrors, 389 - ThrowOnError 390 - >({ 391 - url: '/user/createWithList', 392 - ...options, 393 - headers: { 394 - 'Content-Type': 'application/json', 395 - ...options?.headers, 396 - }, 397 - }); 409 + /** 410 + * Create user. 411 + * 412 + * This can only be done by the logged in user. 413 + */ 414 + public createUser<ThrowOnError extends boolean = false>( 415 + options?: Options<CreateUserData, ThrowOnError>, 416 + ) { 417 + return (options?.client ?? this.client).post< 418 + CreateUserResponses, 419 + CreateUserErrors, 420 + ThrowOnError 421 + >({ 422 + url: '/user', 423 + ...options, 424 + headers: { 425 + 'Content-Type': 'application/json', 426 + ...options?.headers, 427 + }, 428 + }); 429 + } 398 430 399 - /** 400 - * Logs user into the system. 401 - * 402 - * Log into the system. 403 - */ 404 - export const loginUser = <ThrowOnError extends boolean = false>( 405 - options?: Options<LoginUserData, ThrowOnError>, 406 - ) => 407 - (options?.client ?? client).get< 408 - LoginUserResponses, 409 - LoginUserErrors, 410 - ThrowOnError 411 - >({ 412 - url: '/user/login', 413 - ...options, 414 - }); 431 + /** 432 + * Creates list of users with given input array. 433 + * 434 + * Creates list of users with given input array. 435 + */ 436 + public createUsersWithListInput<ThrowOnError extends boolean = false>( 437 + options?: Options<CreateUsersWithListInputData, ThrowOnError>, 438 + ) { 439 + return (options?.client ?? this.client).post< 440 + CreateUsersWithListInputResponses, 441 + CreateUsersWithListInputErrors, 442 + ThrowOnError 443 + >({ 444 + url: '/user/createWithList', 445 + ...options, 446 + headers: { 447 + 'Content-Type': 'application/json', 448 + ...options?.headers, 449 + }, 450 + }); 451 + } 415 452 416 - /** 417 - * Logs out current logged in user session. 418 - * 419 - * Log user out of the system. 420 - */ 421 - export const logoutUser = <ThrowOnError extends boolean = false>( 422 - options?: Options<LogoutUserData, ThrowOnError>, 423 - ) => 424 - (options?.client ?? client).get< 425 - LogoutUserResponses, 426 - LogoutUserErrors, 427 - ThrowOnError 428 - >({ 429 - url: '/user/logout', 430 - ...options, 431 - }); 453 + /** 454 + * Logs user into the system. 455 + * 456 + * Log into the system. 457 + */ 458 + public loginUser<ThrowOnError extends boolean = false>( 459 + options?: Options<LoginUserData, ThrowOnError>, 460 + ) { 461 + return (options?.client ?? this.client).get< 462 + LoginUserResponses, 463 + LoginUserErrors, 464 + ThrowOnError 465 + >({ 466 + url: '/user/login', 467 + ...options, 468 + }); 469 + } 432 470 433 - /** 434 - * Delete user resource. 435 - * 436 - * This can only be done by the logged in user. 437 - */ 438 - export const deleteUser = <ThrowOnError extends boolean = false>( 439 - options: Options<DeleteUserData, ThrowOnError>, 440 - ) => 441 - (options.client ?? client).delete< 442 - DeleteUserResponses, 443 - DeleteUserErrors, 444 - ThrowOnError 445 - >({ 446 - url: '/user/{username}', 447 - ...options, 448 - }); 471 + /** 472 + * Logs out current logged in user session. 473 + * 474 + * Log user out of the system. 475 + */ 476 + public logoutUser<ThrowOnError extends boolean = false>( 477 + options?: Options<LogoutUserData, ThrowOnError>, 478 + ) { 479 + return (options?.client ?? this.client).get< 480 + LogoutUserResponses, 481 + LogoutUserErrors, 482 + ThrowOnError 483 + >({ 484 + url: '/user/logout', 485 + ...options, 486 + }); 487 + } 488 + 489 + /** 490 + * Delete user resource. 491 + * 492 + * This can only be done by the logged in user. 493 + */ 494 + public deleteUser<ThrowOnError extends boolean = false>( 495 + options: Options<DeleteUserData, ThrowOnError>, 496 + ) { 497 + return (options.client ?? this.client).delete< 498 + DeleteUserResponses, 499 + DeleteUserErrors, 500 + ThrowOnError 501 + >({ 502 + url: '/user/{username}', 503 + ...options, 504 + }); 505 + } 449 506 450 - /** 451 - * Get user by user name. 452 - * 453 - * Get user detail based on username. 454 - */ 455 - export const getUserByName = <ThrowOnError extends boolean = false>( 456 - options: Options<GetUserByNameData, ThrowOnError>, 457 - ) => 458 - (options.client ?? client).get< 459 - GetUserByNameResponses, 460 - GetUserByNameErrors, 461 - ThrowOnError 462 - >({ 463 - url: '/user/{username}', 464 - ...options, 465 - }); 507 + /** 508 + * Get user by user name. 509 + * 510 + * Get user detail based on username. 511 + */ 512 + public getUserByName<ThrowOnError extends boolean = false>( 513 + options: Options<GetUserByNameData, ThrowOnError>, 514 + ) { 515 + return (options.client ?? this.client).get< 516 + GetUserByNameResponses, 517 + GetUserByNameErrors, 518 + ThrowOnError 519 + >({ 520 + url: '/user/{username}', 521 + ...options, 522 + }); 523 + } 466 524 467 - /** 468 - * Update user resource. 469 - * 470 - * This can only be done by the logged in user. 471 - */ 472 - export const updateUser = <ThrowOnError extends boolean = false>( 473 - options: Options<UpdateUserData, ThrowOnError>, 474 - ) => 475 - (options.client ?? client).put< 476 - UpdateUserResponses, 477 - UpdateUserErrors, 478 - ThrowOnError 479 - >({ 480 - url: '/user/{username}', 481 - ...options, 482 - headers: { 483 - 'Content-Type': 'application/json', 484 - ...options.headers, 485 - }, 486 - }); 525 + /** 526 + * Update user resource. 527 + * 528 + * This can only be done by the logged in user. 529 + */ 530 + public updateUser<ThrowOnError extends boolean = false>( 531 + options: Options<UpdateUserData, ThrowOnError>, 532 + ) { 533 + return (options.client ?? this.client).put< 534 + UpdateUserResponses, 535 + UpdateUserErrors, 536 + ThrowOnError 537 + >({ 538 + url: '/user/{username}', 539 + ...options, 540 + headers: { 541 + 'Content-Type': 'application/json', 542 + ...options.headers, 543 + }, 544 + }); 545 + } 546 + }
+2
examples/openapi-ts-tanstack-react-query/src/main.tsx
··· 8 8 9 9 import App from './App.tsx'; 10 10 import { client } from './client/client.gen'; 11 + import { Sdk } from './client/sdk.gen.ts'; 11 12 12 13 const queryClient = new QueryClient({ 13 14 defaultOptions: { ··· 26 27 Authorization: 'Bearer <token_from_service_client>', 27 28 }, 28 29 }); 30 + new Sdk(); 29 31 30 32 ReactDOM.createRoot(document.getElementById('root')!).render( 31 33 <React.StrictMode>
+42 -16
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class Domains extends _HeyApiClient { 49 + export class Domains extends HeyApiClient { 34 50 public get<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsGetData, ThrowOnError>) { 35 - return (options?.client ?? this._client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ 36 52 url: '/business/providers/domains', 37 53 ...options 38 54 }); 39 55 } 40 56 41 57 public post<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsPostData, ThrowOnError>) { 42 - return (options?.client ?? this._client).post<BusinessProvidersDomainsPostResponses, unknown, ThrowOnError>({ 58 + return (options?.client ?? this.client).post<BusinessProvidersDomainsPostResponses, unknown, ThrowOnError>({ 43 59 url: '/business/providers/domains', 44 60 ...options 45 61 }); 46 62 } 47 63 } 48 64 49 - export class Providers extends _HeyApiClient { 50 - domains = new Domains({ client: this._client }); 65 + export class Providers extends HeyApiClient { 66 + domains = new Domains({ client: this.client }); 51 67 } 52 68 53 - export class Business extends _HeyApiClient { 69 + export class Business extends HeyApiClient { 54 70 public get<ThrowOnError extends boolean = false>(options?: Options<BusinessGetData, ThrowOnError>) { 55 - return (options?.client ?? this._client).get<BusinessGetResponses, unknown, ThrowOnError>({ 71 + return (options?.client ?? this.client).get<BusinessGetResponses, unknown, ThrowOnError>({ 56 72 url: '/locations/businesses', 57 73 ...options 58 74 }); 59 75 } 60 76 61 - providers = new Providers({ client: this._client }); 77 + providers = new Providers({ client: this.client }); 62 78 } 63 79 64 - export class NestedSdkWithInstance extends _HeyApiClient { 80 + export class NestedSdkWithInstance extends HeyApiClient { 81 + public static readonly __registry = new HeyApiRegistry<NestedSdkWithInstance>(); 82 + 83 + constructor(args?: { 84 + client?: Client; 85 + key?: string; 86 + }) { 87 + super(args); 88 + NestedSdkWithInstance.__registry.set(this, args?.key); 89 + } 90 + 65 91 public putBusinessProvidersDomains<ThrowOnError extends boolean = false>(options?: Options<PutBusinessProvidersDomainsData, ThrowOnError>) { 66 - return (options?.client ?? this._client).put<PutBusinessProvidersDomainsResponses, unknown, ThrowOnError>({ 92 + return (options?.client ?? this.client).put<PutBusinessProvidersDomainsResponses, unknown, ThrowOnError>({ 67 93 url: '/business/providers/domains', 68 94 ...options 69 95 }); 70 96 } 71 97 72 98 public get<ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) { 73 - return (options?.client ?? this._client).get<GetResponses, unknown, ThrowOnError>({ 99 + return (options?.client ?? this.client).get<GetResponses, unknown, ThrowOnError>({ 74 100 url: '/locations', 75 101 ...options 76 102 }); 77 103 } 78 104 79 - business = new Business({ client: this._client }); 105 + business = new Business({ client: this.client }); 80 106 }
+41 -15
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class Bar extends _HeyApiClient { 49 + export class Bar extends HeyApiClient { 34 50 public post<ThrowOnError extends boolean = false>(options?: Options<FooBarPostData, ThrowOnError>) { 35 - return (options?.client ?? this._client).post<FooBarPostResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).post<FooBarPostResponses, unknown, ThrowOnError>({ 36 52 url: '/foo/bar', 37 53 ...options 38 54 }); 39 55 } 40 56 41 57 public put<ThrowOnError extends boolean = false>(options?: Options<FooBarPutData, ThrowOnError>) { 42 - return (options?.client ?? this._client).put<FooBarPutResponses, unknown, ThrowOnError>({ 58 + return (options?.client ?? this.client).put<FooBarPutResponses, unknown, ThrowOnError>({ 43 59 url: '/foo/bar', 44 60 ...options 45 61 }); 46 62 } 47 63 } 48 64 49 - export class Foo extends _HeyApiClient { 65 + export class Foo extends HeyApiClient { 50 66 public post<ThrowOnError extends boolean = false>(options?: Options<FooPostData, ThrowOnError>) { 51 - return (options?.client ?? this._client).post<FooPostResponses, unknown, ThrowOnError>({ 67 + return (options?.client ?? this.client).post<FooPostResponses, unknown, ThrowOnError>({ 52 68 url: '/foo', 53 69 ...options 54 70 }); 55 71 } 56 72 57 73 public put<ThrowOnError extends boolean = false>(options?: Options<FooPutData, ThrowOnError>) { 58 - return (options?.client ?? this._client).put<FooPutResponses, unknown, ThrowOnError>({ 74 + return (options?.client ?? this.client).put<FooPutResponses, unknown, ThrowOnError>({ 59 75 url: '/foo', 60 76 ...options 61 77 }); 62 78 } 63 79 64 - bar = new Bar({ client: this._client }); 80 + bar = new Bar({ client: this.client }); 65 81 } 66 82 67 - export class Sdk extends _HeyApiClient { 83 + export class Sdk extends HeyApiClient { 84 + public static readonly __registry = new HeyApiRegistry<Sdk>(); 85 + 86 + constructor(args?: { 87 + client?: Client; 88 + key?: string; 89 + }) { 90 + super(args); 91 + Sdk.__registry.set(this, args?.key); 92 + } 93 + 68 94 public getFoo<ThrowOnError extends boolean = false>(options?: Options<GetFooData, ThrowOnError>) { 69 - return (options?.client ?? this._client).get<GetFooResponses, unknown, ThrowOnError>({ 95 + return (options?.client ?? this.client).get<GetFooResponses, unknown, ThrowOnError>({ 70 96 url: '/foo', 71 97 ...options 72 98 }); 73 99 } 74 100 75 101 public getFooBar<ThrowOnError extends boolean = false>(options?: Options<GetFooBarData, ThrowOnError>) { 76 - return (options?.client ?? this._client).get<GetFooBarResponses, unknown, ThrowOnError>({ 102 + return (options?.client ?? this.client).get<GetFooBarResponses, unknown, ThrowOnError>({ 77 103 url: '/foo/bar', 78 104 ...options 79 105 }); 80 106 } 81 107 82 - foo = new Foo({ client: this._client }); 108 + foo = new Foo({ client: this.client }); 83 109 }
+42 -16
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class Domains extends _HeyApiClient { 49 + export class Domains extends HeyApiClient { 34 50 public get<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsGetData, ThrowOnError>) { 35 - return (options?.client ?? this._client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ 36 52 url: '/business/providers/domains', 37 53 ...options 38 54 }); 39 55 } 40 56 41 57 public post<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsPostData, ThrowOnError>) { 42 - return (options?.client ?? this._client).post<BusinessProvidersDomainsPostResponses, unknown, ThrowOnError>({ 58 + return (options?.client ?? this.client).post<BusinessProvidersDomainsPostResponses, unknown, ThrowOnError>({ 43 59 url: '/business/providers/domains', 44 60 ...options 45 61 }); 46 62 } 47 63 } 48 64 49 - export class Providers extends _HeyApiClient { 50 - domains = new Domains({ client: this._client }); 65 + export class Providers extends HeyApiClient { 66 + domains = new Domains({ client: this.client }); 51 67 } 52 68 53 - export class Business extends _HeyApiClient { 69 + export class Business extends HeyApiClient { 54 70 public get<ThrowOnError extends boolean = false>(options?: Options<BusinessGetData, ThrowOnError>) { 55 - return (options?.client ?? this._client).get<BusinessGetResponses, unknown, ThrowOnError>({ 71 + return (options?.client ?? this.client).get<BusinessGetResponses, unknown, ThrowOnError>({ 56 72 url: '/locations/businesses', 57 73 ...options 58 74 }); 59 75 } 60 76 61 - providers = new Providers({ client: this._client }); 77 + providers = new Providers({ client: this.client }); 62 78 } 63 79 64 - export class NestedSdkWithInstance extends _HeyApiClient { 80 + export class NestedSdkWithInstance extends HeyApiClient { 81 + public static readonly __registry = new HeyApiRegistry<NestedSdkWithInstance>(); 82 + 83 + constructor(args?: { 84 + client?: Client; 85 + key?: string; 86 + }) { 87 + super(args); 88 + NestedSdkWithInstance.__registry.set(this, args?.key); 89 + } 90 + 65 91 public putBusinessProvidersDomains<ThrowOnError extends boolean = false>(options?: Options<PutBusinessProvidersDomainsData, ThrowOnError>) { 66 - return (options?.client ?? this._client).put<PutBusinessProvidersDomainsResponses, unknown, ThrowOnError>({ 92 + return (options?.client ?? this.client).put<PutBusinessProvidersDomainsResponses, unknown, ThrowOnError>({ 67 93 url: '/business/providers/domains', 68 94 ...options 69 95 }); 70 96 } 71 97 72 98 public get<ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) { 73 - return (options?.client ?? this._client).get<GetResponses, unknown, ThrowOnError>({ 99 + return (options?.client ?? this.client).get<GetResponses, unknown, ThrowOnError>({ 74 100 url: '/locations', 75 101 ...options 76 102 }); 77 103 } 78 104 79 - business = new Business({ client: this._client }); 105 + business = new Business({ client: this.client }); 80 106 }
+41 -15
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class Bar extends _HeyApiClient { 49 + export class Bar extends HeyApiClient { 34 50 public post<ThrowOnError extends boolean = false>(options?: Options<FooBarPostData, ThrowOnError>) { 35 - return (options?.client ?? this._client).post<FooBarPostResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).post<FooBarPostResponses, unknown, ThrowOnError>({ 36 52 url: '/foo/bar', 37 53 ...options 38 54 }); 39 55 } 40 56 41 57 public put<ThrowOnError extends boolean = false>(options?: Options<FooBarPutData, ThrowOnError>) { 42 - return (options?.client ?? this._client).put<FooBarPutResponses, unknown, ThrowOnError>({ 58 + return (options?.client ?? this.client).put<FooBarPutResponses, unknown, ThrowOnError>({ 43 59 url: '/foo/bar', 44 60 ...options 45 61 }); 46 62 } 47 63 } 48 64 49 - export class Foo extends _HeyApiClient { 65 + export class Foo extends HeyApiClient { 50 66 public post<ThrowOnError extends boolean = false>(options?: Options<FooPostData, ThrowOnError>) { 51 - return (options?.client ?? this._client).post<FooPostResponses, unknown, ThrowOnError>({ 67 + return (options?.client ?? this.client).post<FooPostResponses, unknown, ThrowOnError>({ 52 68 url: '/foo', 53 69 ...options 54 70 }); 55 71 } 56 72 57 73 public put<ThrowOnError extends boolean = false>(options?: Options<FooPutData, ThrowOnError>) { 58 - return (options?.client ?? this._client).put<FooPutResponses, unknown, ThrowOnError>({ 74 + return (options?.client ?? this.client).put<FooPutResponses, unknown, ThrowOnError>({ 59 75 url: '/foo', 60 76 ...options 61 77 }); 62 78 } 63 79 64 - bar = new Bar({ client: this._client }); 80 + bar = new Bar({ client: this.client }); 65 81 } 66 82 67 - export class Sdk extends _HeyApiClient { 83 + export class Sdk extends HeyApiClient { 84 + public static readonly __registry = new HeyApiRegistry<Sdk>(); 85 + 86 + constructor(args?: { 87 + client?: Client; 88 + key?: string; 89 + }) { 90 + super(args); 91 + Sdk.__registry.set(this, args?.key); 92 + } 93 + 68 94 public getFoo<ThrowOnError extends boolean = false>(options?: Options<GetFooData, ThrowOnError>) { 69 - return (options?.client ?? this._client).get<GetFooResponses, unknown, ThrowOnError>({ 95 + return (options?.client ?? this.client).get<GetFooResponses, unknown, ThrowOnError>({ 70 96 url: '/foo', 71 97 ...options 72 98 }); 73 99 } 74 100 75 101 public getFooBar<ThrowOnError extends boolean = false>(options?: Options<GetFooBarData, ThrowOnError>) { 76 - return (options?.client ?? this._client).get<GetFooBarResponses, unknown, ThrowOnError>({ 102 + return (options?.client ?? this.client).get<GetFooBarResponses, unknown, ThrowOnError>({ 77 103 url: '/foo/bar', 78 104 ...options 79 105 }); 80 106 } 81 107 82 - foo = new Foo({ client: this._client }); 108 + foo = new Foo({ client: this.client }); 83 109 }
+42 -16
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new NestedSdkWithInstance()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class Domains extends _HeyApiClient { 49 + export class Domains extends HeyApiClient { 34 50 public get<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsGetData, ThrowOnError>) { 35 - return (options?.client ?? this._client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).get<BusinessProvidersDomainsGetResponses, unknown, ThrowOnError>({ 36 52 url: '/business/providers/domains', 37 53 ...options 38 54 }); 39 55 } 40 56 41 57 public post<ThrowOnError extends boolean = false>(options?: Options<BusinessProvidersDomainsPostData, ThrowOnError>) { 42 - return (options?.client ?? this._client).post<BusinessProvidersDomainsPostResponses, unknown, ThrowOnError>({ 58 + return (options?.client ?? this.client).post<BusinessProvidersDomainsPostResponses, unknown, ThrowOnError>({ 43 59 url: '/business/providers/domains', 44 60 ...options 45 61 }); 46 62 } 47 63 } 48 64 49 - export class Providers extends _HeyApiClient { 50 - domains = new Domains({ client: this._client }); 65 + export class Providers extends HeyApiClient { 66 + domains = new Domains({ client: this.client }); 51 67 } 52 68 53 - export class Business extends _HeyApiClient { 69 + export class Business extends HeyApiClient { 54 70 public get<ThrowOnError extends boolean = false>(options?: Options<BusinessGetData, ThrowOnError>) { 55 - return (options?.client ?? this._client).get<BusinessGetResponses, unknown, ThrowOnError>({ 71 + return (options?.client ?? this.client).get<BusinessGetResponses, unknown, ThrowOnError>({ 56 72 url: '/locations/businesses', 57 73 ...options 58 74 }); 59 75 } 60 76 61 - providers = new Providers({ client: this._client }); 77 + providers = new Providers({ client: this.client }); 62 78 } 63 79 64 - export class NestedSdkWithInstance extends _HeyApiClient { 80 + export class NestedSdkWithInstance extends HeyApiClient { 81 + public static readonly __registry = new HeyApiRegistry<NestedSdkWithInstance>(); 82 + 83 + constructor(args?: { 84 + client?: Client; 85 + key?: string; 86 + }) { 87 + super(args); 88 + NestedSdkWithInstance.__registry.set(this, args?.key); 89 + } 90 + 65 91 public putBusinessProvidersDomains<ThrowOnError extends boolean = false>(options?: Options<PutBusinessProvidersDomainsData, ThrowOnError>) { 66 - return (options?.client ?? this._client).put<PutBusinessProvidersDomainsResponses, unknown, ThrowOnError>({ 92 + return (options?.client ?? this.client).put<PutBusinessProvidersDomainsResponses, unknown, ThrowOnError>({ 67 93 url: '/business/providers/domains', 68 94 ...options 69 95 }); 70 96 } 71 97 72 98 public get<ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) { 73 - return (options?.client ?? this._client).get<GetResponses, unknown, ThrowOnError>({ 99 + return (options?.client ?? this.client).get<GetResponses, unknown, ThrowOnError>({ 74 100 url: '/locations', 75 101 ...options 76 102 }); 77 103 } 78 104 79 - business = new Business({ client: this._client }); 105 + business = new Business({ client: this.client }); 80 106 }
+41 -15
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class Bar extends _HeyApiClient { 49 + export class Bar extends HeyApiClient { 34 50 public post<ThrowOnError extends boolean = false>(options?: Options<FooBarPostData, ThrowOnError>) { 35 - return (options?.client ?? this._client).post<FooBarPostResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).post<FooBarPostResponses, unknown, ThrowOnError>({ 36 52 url: '/foo/bar', 37 53 ...options 38 54 }); 39 55 } 40 56 41 57 public put<ThrowOnError extends boolean = false>(options?: Options<FooBarPutData, ThrowOnError>) { 42 - return (options?.client ?? this._client).put<FooBarPutResponses, unknown, ThrowOnError>({ 58 + return (options?.client ?? this.client).put<FooBarPutResponses, unknown, ThrowOnError>({ 43 59 url: '/foo/bar', 44 60 ...options 45 61 }); 46 62 } 47 63 } 48 64 49 - export class Foo extends _HeyApiClient { 65 + export class Foo extends HeyApiClient { 50 66 public post<ThrowOnError extends boolean = false>(options?: Options<FooPostData, ThrowOnError>) { 51 - return (options?.client ?? this._client).post<FooPostResponses, unknown, ThrowOnError>({ 67 + return (options?.client ?? this.client).post<FooPostResponses, unknown, ThrowOnError>({ 52 68 url: '/foo', 53 69 ...options 54 70 }); 55 71 } 56 72 57 73 public put<ThrowOnError extends boolean = false>(options?: Options<FooPutData, ThrowOnError>) { 58 - return (options?.client ?? this._client).put<FooPutResponses, unknown, ThrowOnError>({ 74 + return (options?.client ?? this.client).put<FooPutResponses, unknown, ThrowOnError>({ 59 75 url: '/foo', 60 76 ...options 61 77 }); 62 78 } 63 79 64 - bar = new Bar({ client: this._client }); 80 + bar = new Bar({ client: this.client }); 65 81 } 66 82 67 - export class Sdk extends _HeyApiClient { 83 + export class Sdk extends HeyApiClient { 84 + public static readonly __registry = new HeyApiRegistry<Sdk>(); 85 + 86 + constructor(args?: { 87 + client?: Client; 88 + key?: string; 89 + }) { 90 + super(args); 91 + Sdk.__registry.set(this, args?.key); 92 + } 93 + 68 94 public getFoo<ThrowOnError extends boolean = false>(options?: Options<GetFooData, ThrowOnError>) { 69 - return (options?.client ?? this._client).get<GetFooResponses, unknown, ThrowOnError>({ 95 + return (options?.client ?? this.client).get<GetFooResponses, unknown, ThrowOnError>({ 70 96 url: '/foo', 71 97 ...options 72 98 }); 73 99 } 74 100 75 101 public getFooBar<ThrowOnError extends boolean = false>(options?: Options<GetFooBarData, ThrowOnError>) { 76 - return (options?.client ?? this._client).get<GetFooBarResponses, unknown, ThrowOnError>({ 102 + return (options?.client ?? this.client).get<GetFooBarResponses, unknown, ThrowOnError>({ 77 103 url: '/foo/bar', 78 104 ...options 79 105 }); 80 106 } 81 107 82 - foo = new Foo({ client: this._client }); 108 + foo = new Foo({ client: this.client }); 83 109 }
+211 -185
packages/openapi-ts-tests/sdks/__snapshots__/method-class-conflict/instance/sdk.gen.ts
··· 18 18 meta?: Record<string, unknown>; 19 19 }; 20 20 21 - class _HeyApiClient { 22 - protected _client: Client = client; 21 + class HeyApiClient { 22 + protected client: Client; 23 23 24 24 constructor(args?: { 25 25 client?: Client; 26 26 }) { 27 - if (args?.client) { 28 - this._client = args.client; 27 + this.client = args?.client ?? client; 28 + } 29 + } 30 + 31 + class HeyApiRegistry<T> { 32 + private readonly defaultKey = "default"; 33 + 34 + private readonly instances: Map<string, T> = new Map(); 35 + 36 + get(key?: string): T { 37 + const instance = this.instances.get(key ?? this.defaultKey); 38 + if (!instance) { 39 + throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`); 29 40 } 41 + return instance; 42 + } 43 + 44 + set(value: T, key?: string): void { 45 + this.instances.set(key ?? this.defaultKey, value); 30 46 } 31 47 } 32 48 33 - export class AccountingCompanies extends _HeyApiClient { 49 + export class AccountingCompanies extends HeyApiClient { 34 50 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataAccountingCompaniesCountData, ThrowOnError>) { 35 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataAccountingCompaniesCountResponses, unknown, ThrowOnError>({ 51 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataAccountingCompaniesCountResponses, unknown, ThrowOnError>({ 36 52 url: '/api/v1/odata/AccountingCompanies/$count', 37 53 ...options 38 54 }); 39 55 } 40 56 } 41 57 42 - export class AccountingCompanyMemberships extends _HeyApiClient { 58 + export class AccountingCompanyMemberships extends HeyApiClient { 43 59 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataAccountingCompanyMembershipsCountData, ThrowOnError>) { 44 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataAccountingCompanyMembershipsCountResponses, unknown, ThrowOnError>({ 60 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataAccountingCompanyMembershipsCountResponses, unknown, ThrowOnError>({ 45 61 url: '/api/v1/odata/AccountingCompanyMemberships/$count', 46 62 ...options 47 63 }); 48 64 } 49 65 } 50 66 51 - export class BankAccounts extends _HeyApiClient { 67 + export class BankAccounts extends HeyApiClient { 52 68 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBankAccountsCountData, ThrowOnError>) { 53 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBankAccountsCountResponses, unknown, ThrowOnError>({ 69 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBankAccountsCountResponses, unknown, ThrowOnError>({ 54 70 url: '/api/v1/odata/BankAccounts/$count', 55 71 ...options 56 72 }); 57 73 } 58 74 } 59 75 60 - export class BusinessAccountantAssignments extends _HeyApiClient { 76 + export class BusinessAccountantAssignments extends HeyApiClient { 61 77 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessAccountantAssignmentsCountData, ThrowOnError>) { 62 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessAccountantAssignmentsCountResponses, unknown, ThrowOnError>({ 78 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessAccountantAssignmentsCountResponses, unknown, ThrowOnError>({ 63 79 url: '/api/v1/odata/BusinessAccountantAssignments/$count', 64 80 ...options 65 81 }); 66 82 } 67 83 } 68 84 69 - export class BusinessDocumentActivities extends _HeyApiClient { 85 + export class BusinessDocumentActivities extends HeyApiClient { 70 86 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessDocumentActivitiesCountData, ThrowOnError>) { 71 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessDocumentActivitiesCountResponses, unknown, ThrowOnError>({ 87 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessDocumentActivitiesCountResponses, unknown, ThrowOnError>({ 72 88 url: '/api/v1/odata/BusinessDocumentActivities/$count', 73 89 ...options 74 90 }); 75 91 } 76 92 } 77 93 78 - export class BusinessDocuments extends _HeyApiClient { 94 + export class BusinessDocuments extends HeyApiClient { 79 95 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessDocumentsCountData, ThrowOnError>) { 80 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessDocumentsCountResponses, unknown, ThrowOnError>({ 96 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessDocumentsCountResponses, unknown, ThrowOnError>({ 81 97 url: '/api/v1/odata/BusinessDocuments/$count', 82 98 ...options 83 99 }); 84 100 } 85 101 } 86 102 87 - export class BusinessDocumentsSummaries extends _HeyApiClient { 103 + export class BusinessDocumentsSummaries extends HeyApiClient { 88 104 /** 89 105 * @deprecated 90 106 */ 91 107 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessDocumentsSummariesCountData, ThrowOnError>) { 92 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessDocumentsSummariesCountResponses, unknown, ThrowOnError>({ 108 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessDocumentsSummariesCountResponses, unknown, ThrowOnError>({ 93 109 url: '/api/v1/odata/BusinessDocumentsSummaries/$count', 94 110 ...options 95 111 }); 96 112 } 97 113 } 98 114 99 - export class Businesses extends _HeyApiClient { 115 + export class Businesses extends HeyApiClient { 100 116 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessesCountData, ThrowOnError>) { 101 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessesCountResponses, unknown, ThrowOnError>({ 117 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessesCountResponses, unknown, ThrowOnError>({ 102 118 url: '/api/v1/odata/Businesses/$count', 103 119 ...options 104 120 }); 105 121 } 106 122 107 123 public key<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessesKey2Data, ThrowOnError>) { 108 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessesKey2Responses, unknown, ThrowOnError>({ 124 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessesKey2Responses, unknown, ThrowOnError>({ 109 125 url: '/api/v1/odata/Businesses/{key}', 110 126 ...options 111 127 }); 112 128 } 113 129 } 114 130 115 - export class BusinessSummaries extends _HeyApiClient { 131 + export class BusinessSummaries extends HeyApiClient { 116 132 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessSummariesCountData, ThrowOnError>) { 117 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessSummariesCountResponses, unknown, ThrowOnError>({ 133 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessSummariesCountResponses, unknown, ThrowOnError>({ 118 134 url: '/api/v1/odata/BusinessSummaries/$count', 119 135 ...options 120 136 }); 121 137 } 122 138 } 123 139 124 - export class Counterparties extends _HeyApiClient { 140 + export class Counterparties extends HeyApiClient { 125 141 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataCounterpartiesCountData, ThrowOnError>) { 126 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataCounterpartiesCountResponses, unknown, ThrowOnError>({ 142 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataCounterpartiesCountResponses, unknown, ThrowOnError>({ 127 143 url: '/api/v1/odata/Counterparties/$count', 128 144 ...options 129 145 }); 130 146 } 131 147 } 132 148 133 - export class DataBoxCredentials extends _HeyApiClient { 149 + export class DataBoxCredentials extends HeyApiClient { 134 150 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataDataBoxCredentialsCountData, ThrowOnError>) { 135 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataDataBoxCredentialsCountResponses, unknown, ThrowOnError>({ 151 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataDataBoxCredentialsCountResponses, unknown, ThrowOnError>({ 136 152 url: '/api/v1/odata/DataBoxCredentials/$count', 137 153 ...options 138 154 }); 139 155 } 140 156 } 141 157 142 - export class DocumentTypes extends _HeyApiClient { 158 + export class DocumentTypes extends HeyApiClient { 143 159 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataDocumentTypesCountData, ThrowOnError>) { 144 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataDocumentTypesCountResponses, unknown, ThrowOnError>({ 160 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataDocumentTypesCountResponses, unknown, ThrowOnError>({ 145 161 url: '/api/v1/odata/DocumentTypes/$count', 146 162 ...options 147 163 }); 148 164 } 149 165 } 150 166 151 - export class Invitations extends _HeyApiClient { 167 + export class Invitations extends HeyApiClient { 152 168 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataInvitationsCountData, ThrowOnError>) { 153 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataInvitationsCountResponses, unknown, ThrowOnError>({ 169 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataInvitationsCountResponses, unknown, ThrowOnError>({ 154 170 url: '/api/v1/odata/Invitations/$count', 155 171 ...options 156 172 }); 157 173 } 158 174 } 159 175 160 - export class Invoices extends _HeyApiClient { 176 + export class Invoices extends HeyApiClient { 161 177 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataInvoicesCountData, ThrowOnError>) { 162 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataInvoicesCountResponses, unknown, ThrowOnError>({ 178 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataInvoicesCountResponses, unknown, ThrowOnError>({ 163 179 url: '/api/v1/odata/Invoices/$count', 164 180 ...options 165 181 }); 166 182 } 167 183 } 168 184 169 - export class InvoiceSettings extends _HeyApiClient { 185 + export class InvoiceSettings extends HeyApiClient { 170 186 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataInvoiceSettingsCountData, ThrowOnError>) { 171 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataInvoiceSettingsCountResponses, unknown, ThrowOnError>({ 187 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataInvoiceSettingsCountResponses, unknown, ThrowOnError>({ 172 188 url: '/api/v1/odata/InvoiceSettings/$count', 173 189 ...options 174 190 }); 175 191 } 176 192 } 177 193 178 - export class Licenses extends _HeyApiClient { 194 + export class Licenses extends HeyApiClient { 179 195 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataLicensesCountData, ThrowOnError>) { 180 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataLicensesCountResponses, unknown, ThrowOnError>({ 196 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataLicensesCountResponses, unknown, ThrowOnError>({ 181 197 url: '/api/v1/odata/Licenses/$count', 182 198 ...options 183 199 }); 184 200 } 185 201 } 186 202 187 - export class PersonalDocuments extends _HeyApiClient { 203 + export class PersonalDocuments extends HeyApiClient { 188 204 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataPersonalDocumentsCountData, ThrowOnError>) { 189 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataPersonalDocumentsCountResponses, unknown, ThrowOnError>({ 205 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataPersonalDocumentsCountResponses, unknown, ThrowOnError>({ 190 206 url: '/api/v1/odata/PersonalDocuments/$count', 191 207 ...options 192 208 }); 193 209 } 194 210 } 195 211 196 - export class RecurringTasks extends _HeyApiClient { 212 + export class RecurringTasks extends HeyApiClient { 197 213 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataRecurringTasksCountData, ThrowOnError>) { 198 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataRecurringTasksCountResponses, unknown, ThrowOnError>({ 214 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataRecurringTasksCountResponses, unknown, ThrowOnError>({ 199 215 url: '/api/v1/odata/RecurringTasks/$count', 200 216 ...options 201 217 }); 202 218 } 203 219 } 204 220 205 - export class Tasks extends _HeyApiClient { 221 + export class Tasks extends HeyApiClient { 206 222 public count<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataTasksCountData, ThrowOnError>) { 207 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataTasksCountResponses, unknown, ThrowOnError>({ 223 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataTasksCountResponses, unknown, ThrowOnError>({ 208 224 url: '/api/v1/odata/Tasks/$count', 209 225 ...options 210 226 }); 211 227 } 212 228 213 229 public key<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataTasksKey2Data, ThrowOnError>) { 214 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataTasksKey2Responses, unknown, ThrowOnError>({ 230 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataTasksKey2Responses, unknown, ThrowOnError>({ 215 231 url: '/api/v1/odata/Tasks/{key}', 216 232 ...options 217 233 }); 218 234 } 219 235 } 220 236 221 - export class Odata extends _HeyApiClient { 237 + export class Odata extends HeyApiClient { 222 238 public accountingCompanies<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataAccountingCompaniesData, ThrowOnError>) { 223 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataAccountingCompaniesResponses, unknown, ThrowOnError>({ 239 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataAccountingCompaniesResponses, unknown, ThrowOnError>({ 224 240 url: '/api/v1/odata/AccountingCompanies', 225 241 ...options 226 242 }); 227 243 } 228 244 229 245 public accountingCompanyMemberships<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataAccountingCompanyMembershipsData, ThrowOnError>) { 230 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataAccountingCompanyMembershipsResponses, unknown, ThrowOnError>({ 246 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataAccountingCompanyMembershipsResponses, unknown, ThrowOnError>({ 231 247 url: '/api/v1/odata/AccountingCompanyMemberships', 232 248 ...options 233 249 }); 234 250 } 235 251 236 252 public bankAccounts<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBankAccountsData, ThrowOnError>) { 237 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBankAccountsResponses, unknown, ThrowOnError>({ 253 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBankAccountsResponses, unknown, ThrowOnError>({ 238 254 url: '/api/v1/odata/BankAccounts', 239 255 ...options 240 256 }); 241 257 } 242 258 243 259 public businessAccountantAssignments<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessAccountantAssignmentsData, ThrowOnError>) { 244 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessAccountantAssignmentsResponses, unknown, ThrowOnError>({ 260 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessAccountantAssignmentsResponses, unknown, ThrowOnError>({ 245 261 url: '/api/v1/odata/BusinessAccountantAssignments', 246 262 ...options 247 263 }); 248 264 } 249 265 250 266 public businessDocumentActivities<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessDocumentActivitiesData, ThrowOnError>) { 251 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessDocumentActivitiesResponses, unknown, ThrowOnError>({ 267 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessDocumentActivitiesResponses, unknown, ThrowOnError>({ 252 268 url: '/api/v1/odata/BusinessDocumentActivities', 253 269 ...options 254 270 }); 255 271 } 256 272 257 273 public businessDocuments<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessDocumentsData, ThrowOnError>) { 258 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessDocumentsResponses, unknown, ThrowOnError>({ 274 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessDocumentsResponses, unknown, ThrowOnError>({ 259 275 url: '/api/v1/odata/BusinessDocuments', 260 276 ...options 261 277 }); ··· 265 281 * @deprecated 266 282 */ 267 283 public businessDocumentsSummaries<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessDocumentsSummariesData, ThrowOnError>) { 268 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessDocumentsSummariesResponses, unknown, ThrowOnError>({ 284 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessDocumentsSummariesResponses, unknown, ThrowOnError>({ 269 285 url: '/api/v1/odata/BusinessDocumentsSummaries', 270 286 ...options 271 287 }); 272 288 } 273 289 274 290 public businesses<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessesData, ThrowOnError>) { 275 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessesResponses, unknown, ThrowOnError>({ 291 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessesResponses, unknown, ThrowOnError>({ 276 292 url: '/api/v1/odata/Businesses', 277 293 ...options 278 294 }); 279 295 } 280 296 281 297 public businessesKey<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessesKeyData, ThrowOnError>) { 282 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessesKeyResponses, unknown, ThrowOnError>({ 298 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessesKeyResponses, unknown, ThrowOnError>({ 283 299 url: '/api/v1/odata/Businesses({key})', 284 300 ...options 285 301 }); 286 302 } 287 303 288 304 public businessSummaries<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataBusinessSummariesData, ThrowOnError>) { 289 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataBusinessSummariesResponses, unknown, ThrowOnError>({ 305 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataBusinessSummariesResponses, unknown, ThrowOnError>({ 290 306 url: '/api/v1/odata/BusinessSummaries', 291 307 ...options 292 308 }); 293 309 } 294 310 295 311 public counterparties<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataCounterpartiesData, ThrowOnError>) { 296 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataCounterpartiesResponses, unknown, ThrowOnError>({ 312 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataCounterpartiesResponses, unknown, ThrowOnError>({ 297 313 url: '/api/v1/odata/Counterparties', 298 314 ...options 299 315 }); 300 316 } 301 317 302 318 public dataBoxCredentials<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataDataBoxCredentialsData, ThrowOnError>) { 303 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataDataBoxCredentialsResponses, unknown, ThrowOnError>({ 319 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataDataBoxCredentialsResponses, unknown, ThrowOnError>({ 304 320 url: '/api/v1/odata/DataBoxCredentials', 305 321 ...options 306 322 }); 307 323 } 308 324 309 325 public documentTypes<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataDocumentTypesData, ThrowOnError>) { 310 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataDocumentTypesResponses, unknown, ThrowOnError>({ 326 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataDocumentTypesResponses, unknown, ThrowOnError>({ 311 327 url: '/api/v1/odata/DocumentTypes', 312 328 ...options 313 329 }); 314 330 } 315 331 316 332 public invitations<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataInvitationsData, ThrowOnError>) { 317 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataInvitationsResponses, unknown, ThrowOnError>({ 333 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataInvitationsResponses, unknown, ThrowOnError>({ 318 334 url: '/api/v1/odata/Invitations', 319 335 ...options 320 336 }); 321 337 } 322 338 323 339 public invoices<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataInvoicesData, ThrowOnError>) { 324 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataInvoicesResponses, unknown, ThrowOnError>({ 340 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataInvoicesResponses, unknown, ThrowOnError>({ 325 341 url: '/api/v1/odata/Invoices', 326 342 ...options 327 343 }); 328 344 } 329 345 330 346 public invoiceSettings<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataInvoiceSettingsData, ThrowOnError>) { 331 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataInvoiceSettingsResponses, unknown, ThrowOnError>({ 347 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataInvoiceSettingsResponses, unknown, ThrowOnError>({ 332 348 url: '/api/v1/odata/InvoiceSettings', 333 349 ...options 334 350 }); 335 351 } 336 352 337 353 public licenses<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataLicensesData, ThrowOnError>) { 338 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataLicensesResponses, unknown, ThrowOnError>({ 354 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataLicensesResponses, unknown, ThrowOnError>({ 339 355 url: '/api/v1/odata/Licenses', 340 356 ...options 341 357 }); 342 358 } 343 359 344 360 public personalDocuments<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataPersonalDocumentsData, ThrowOnError>) { 345 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataPersonalDocumentsResponses, unknown, ThrowOnError>({ 361 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataPersonalDocumentsResponses, unknown, ThrowOnError>({ 346 362 url: '/api/v1/odata/PersonalDocuments', 347 363 ...options 348 364 }); 349 365 } 350 366 351 367 public recurringTasks<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataRecurringTasksData, ThrowOnError>) { 352 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataRecurringTasksResponses, unknown, ThrowOnError>({ 368 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataRecurringTasksResponses, unknown, ThrowOnError>({ 353 369 url: '/api/v1/odata/RecurringTasks', 354 370 ...options 355 371 }); 356 372 } 357 373 358 374 public tasks<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataTasksData, ThrowOnError>) { 359 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataTasksResponses, unknown, ThrowOnError>({ 375 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataTasksResponses, unknown, ThrowOnError>({ 360 376 url: '/api/v1/odata/Tasks', 361 377 ...options 362 378 }); 363 379 } 364 380 365 381 public tasksKey<ThrowOnError extends boolean = false>(options?: Options<ApiVVersionApiVersionOdataTasksKeyData, ThrowOnError>) { 366 - return (options?.client ?? this._client).get<ApiVVersionApiVersionOdataTasksKeyResponses, unknown, ThrowOnError>({ 382 + return (options?.client ?? this.client).get<ApiVVersionApiVersionOdataTasksKeyResponses, unknown, ThrowOnError>({ 367 383 url: '/api/v1/odata/Tasks({key})', 368 384 ...options 369 385 }); 370 386 } 371 387 372 - accountingCompanies2 = new AccountingCompanies({ client: this._client }); 388 + accountingCompanies2 = new AccountingCompanies({ client: this.client }); 373 389 374 - accountingCompanyMemberships2 = new AccountingCompanyMemberships({ client: this._client }); 390 + accountingCompanyMemberships2 = new AccountingCompanyMemberships({ client: this.client }); 375 391 376 - bankAccounts2 = new BankAccounts({ client: this._client }); 392 + bankAccounts2 = new BankAccounts({ client: this.client }); 377 393 378 - businessAccountantAssignments2 = new BusinessAccountantAssignments({ client: this._client }); 394 + businessAccountantAssignments2 = new BusinessAccountantAssignments({ client: this.client }); 379 395 380 - businessDocumentActivities2 = new BusinessDocumentActivities({ client: this._client }); 396 + businessDocumentActivities2 = new BusinessDocumentActivities({ client: this.client }); 381 397 382 - businessDocuments2 = new BusinessDocuments({ client: this._client }); 398 + businessDocuments2 = new BusinessDocuments({ client: this.client }); 383 399 384 - businessDocumentsSummaries2 = new BusinessDocumentsSummaries({ client: this._client }); 400 + businessDocumentsSummaries2 = new BusinessDocumentsSummaries({ client: this.client }); 385 401 386 - businesses2 = new Businesses({ client: this._client }); 402 + businesses2 = new Businesses({ client: this.client }); 387 403 388 - businessSummaries2 = new BusinessSummaries({ client: this._client }); 404 + businessSummaries2 = new BusinessSummaries({ client: this.client }); 389 405 390 - counterparties2 = new Counterparties({ client: this._client }); 406 + counterparties2 = new Counterparties({ client: this.client }); 391 407 392 - dataBoxCredentials2 = new DataBoxCredentials({ client: this._client }); 408 + dataBoxCredentials2 = new DataBoxCredentials({ client: this.client }); 393 409 394 - documentTypes2 = new DocumentTypes({ client: this._client }); 410 + documentTypes2 = new DocumentTypes({ client: this.client }); 395 411 396 - invitations2 = new Invitations({ client: this._client }); 412 + invitations2 = new Invitations({ client: this.client }); 397 413 398 - invoices2 = new Invoices({ client: this._client }); 414 + invoices2 = new Invoices({ client: this.client }); 399 415 400 - invoiceSettings2 = new InvoiceSettings({ client: this._client }); 416 + invoiceSettings2 = new InvoiceSettings({ client: this.client }); 401 417 402 - licenses2 = new Licenses({ client: this._client }); 418 + licenses2 = new Licenses({ client: this.client }); 403 419 404 - personalDocuments2 = new PersonalDocuments({ client: this._client }); 420 + personalDocuments2 = new PersonalDocuments({ client: this.client }); 405 421 406 - recurringTasks2 = new RecurringTasks({ client: this._client }); 422 + recurringTasks2 = new RecurringTasks({ client: this.client }); 407 423 408 - tasks2 = new Tasks({ client: this._client }); 424 + tasks2 = new Tasks({ client: this.client }); 409 425 } 410 426 411 - export class User extends _HeyApiClient { 427 + export class User extends HeyApiClient { 412 428 public confirmEmail<ThrowOnError extends boolean = false>(options: Options<MapIdentityApiApiVVersionApiVersionUserConfirmEmailData, ThrowOnError>) { 413 - return (options.client ?? this._client).get<MapIdentityApiApiVVersionApiVersionUserConfirmEmailResponses, unknown, ThrowOnError>({ 429 + return (options.client ?? this.client).get<MapIdentityApiApiVVersionApiVersionUserConfirmEmailResponses, unknown, ThrowOnError>({ 414 430 url: '/api/v1/user/confirmEmail', 415 431 ...options 416 432 }); 417 433 } 418 434 } 419 435 420 - export class VVersionApiVersion extends _HeyApiClient { 421 - odata = new Odata({ client: this._client }); 436 + export class VVersionApiVersion extends HeyApiClient { 437 + odata = new Odata({ client: this.client }); 422 438 423 - user = new User({ client: this._client }); 439 + user = new User({ client: this.client }); 424 440 } 425 441 426 - export class Api extends _HeyApiClient { 427 - vVersionApiVersion = new VVersionApiVersion({ client: this._client }); 442 + export class Api extends HeyApiClient { 443 + vVersionApiVersion = new VVersionApiVersion({ client: this.client }); 428 444 } 429 445 430 - export class MapIdentityApi extends _HeyApiClient { 431 - api = new Api({ client: this._client }); 446 + export class MapIdentityApi extends HeyApiClient { 447 + api = new Api({ client: this.client }); 432 448 } 433 449 434 - export class Sdk extends _HeyApiClient { 450 + export class Sdk extends HeyApiClient { 451 + public static readonly __registry = new HeyApiRegistry<Sdk>(); 452 + 453 + constructor(args?: { 454 + client?: Client; 455 + key?: string; 456 + }) { 457 + super(args); 458 + Sdk.__registry.set(this, args?.key); 459 + } 460 + 435 461 public postApiV1AccountingCompanies<ThrowOnError extends boolean = false>(options?: Options<PostApiV1AccountingCompaniesData, ThrowOnError>) { 436 - return (options?.client ?? this._client).post<PostApiV1AccountingCompaniesResponses, unknown, ThrowOnError>({ 462 + return (options?.client ?? this.client).post<PostApiV1AccountingCompaniesResponses, unknown, ThrowOnError>({ 437 463 url: '/api/v1/accounting-companies', 438 464 ...options, 439 465 headers: { ··· 444 470 } 445 471 446 472 public deleteApiV1AccountingCompaniesById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AccountingCompaniesByIdData, ThrowOnError>) { 447 - return (options.client ?? this._client).delete<DeleteApiV1AccountingCompaniesByIdResponses, unknown, ThrowOnError>({ 473 + return (options.client ?? this.client).delete<DeleteApiV1AccountingCompaniesByIdResponses, unknown, ThrowOnError>({ 448 474 url: '/api/v1/accounting-companies/{id}', 449 475 ...options 450 476 }); 451 477 } 452 478 453 479 public postApiV1AccountingCompaniesById<ThrowOnError extends boolean = false>(options: Options<PostApiV1AccountingCompaniesByIdData, ThrowOnError>) { 454 - return (options.client ?? this._client).post<PostApiV1AccountingCompaniesByIdResponses, unknown, ThrowOnError>({ 480 + return (options.client ?? this.client).post<PostApiV1AccountingCompaniesByIdResponses, unknown, ThrowOnError>({ 455 481 url: '/api/v1/accounting-companies/{id}', 456 482 ...options, 457 483 headers: { ··· 462 488 } 463 489 464 490 public putApiV1AccountingCompanyMemberships<ThrowOnError extends boolean = false>(options?: Options<PutApiV1AccountingCompanyMembershipsData, ThrowOnError>) { 465 - return (options?.client ?? this._client).put<PutApiV1AccountingCompanyMembershipsResponses, unknown, ThrowOnError>({ 491 + return (options?.client ?? this.client).put<PutApiV1AccountingCompanyMembershipsResponses, unknown, ThrowOnError>({ 466 492 url: '/api/v1/accounting-company-memberships', 467 493 ...options, 468 494 headers: { ··· 473 499 } 474 500 475 501 public deleteApiV1AccountingCompanyMembershipsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AccountingCompanyMembershipsByIdData, ThrowOnError>) { 476 - return (options.client ?? this._client).delete<DeleteApiV1AccountingCompanyMembershipsByIdResponses, unknown, ThrowOnError>({ 502 + return (options.client ?? this.client).delete<DeleteApiV1AccountingCompanyMembershipsByIdResponses, unknown, ThrowOnError>({ 477 503 url: '/api/v1/accounting-company-memberships/{id}', 478 504 ...options 479 505 }); 480 506 } 481 507 482 508 public putApiV1BankAccounts<ThrowOnError extends boolean = false>(options?: Options<PutApiV1BankAccountsData, ThrowOnError>) { 483 - return (options?.client ?? this._client).put<PutApiV1BankAccountsResponses, unknown, ThrowOnError>({ 509 + return (options?.client ?? this.client).put<PutApiV1BankAccountsResponses, unknown, ThrowOnError>({ 484 510 url: '/api/v1/bank-accounts', 485 511 ...options, 486 512 headers: { ··· 491 517 } 492 518 493 519 public deleteApiV1BankAccountsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1BankAccountsByIdData, ThrowOnError>) { 494 - return (options.client ?? this._client).delete<DeleteApiV1BankAccountsByIdResponses, unknown, ThrowOnError>({ 520 + return (options.client ?? this.client).delete<DeleteApiV1BankAccountsByIdResponses, unknown, ThrowOnError>({ 495 521 url: '/api/v1/bank-accounts/{id}', 496 522 ...options 497 523 }); 498 524 } 499 525 500 526 public putApiV1BusinessAccountantAssignments<ThrowOnError extends boolean = false>(options?: Options<PutApiV1BusinessAccountantAssignmentsData, ThrowOnError>) { 501 - return (options?.client ?? this._client).put<PutApiV1BusinessAccountantAssignmentsResponses, unknown, ThrowOnError>({ 527 + return (options?.client ?? this.client).put<PutApiV1BusinessAccountantAssignmentsResponses, unknown, ThrowOnError>({ 502 528 url: '/api/v1/business-accountant-assignments', 503 529 ...options, 504 530 headers: { ··· 509 535 } 510 536 511 537 public deleteApiV1BusinessAccountantAssignmentsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1BusinessAccountantAssignmentsByIdData, ThrowOnError>) { 512 - return (options.client ?? this._client).delete<DeleteApiV1BusinessAccountantAssignmentsByIdResponses, unknown, ThrowOnError>({ 538 + return (options.client ?? this.client).delete<DeleteApiV1BusinessAccountantAssignmentsByIdResponses, unknown, ThrowOnError>({ 513 539 url: '/api/v1/business-accountant-assignments/{id}', 514 540 ...options 515 541 }); 516 542 } 517 543 518 544 public getApiV1BusinessDocumentsByIdRaw<ThrowOnError extends boolean = false>(options: Options<GetApiV1BusinessDocumentsByIdRawData, ThrowOnError>) { 519 - return (options.client ?? this._client).get<GetApiV1BusinessDocumentsByIdRawResponses, unknown, ThrowOnError>({ 545 + return (options.client ?? this.client).get<GetApiV1BusinessDocumentsByIdRawResponses, unknown, ThrowOnError>({ 520 546 url: '/api/v1/business-documents/{id}/raw', 521 547 ...options 522 548 }); 523 549 } 524 550 525 551 public postApiV1BusinessDocuments<ThrowOnError extends boolean = false>(options?: Options<PostApiV1BusinessDocumentsData, ThrowOnError>) { 526 - return (options?.client ?? this._client).post<PostApiV1BusinessDocumentsResponses, unknown, ThrowOnError>({ 552 + return (options?.client ?? this.client).post<PostApiV1BusinessDocumentsResponses, unknown, ThrowOnError>({ 527 553 ...formDataBodySerializer, 528 554 url: '/api/v1/business-documents', 529 555 ...options, ··· 535 561 } 536 562 537 563 public deleteApiV1BusinessDocumentsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1BusinessDocumentsByIdData, ThrowOnError>) { 538 - return (options.client ?? this._client).delete<DeleteApiV1BusinessDocumentsByIdResponses, unknown, ThrowOnError>({ 564 + return (options.client ?? this.client).delete<DeleteApiV1BusinessDocumentsByIdResponses, unknown, ThrowOnError>({ 539 565 url: '/api/v1/business-documents/{id}', 540 566 ...options 541 567 }); 542 568 } 543 569 544 570 public putApiV1BusinessDocumentsById<ThrowOnError extends boolean = false>(options: Options<PutApiV1BusinessDocumentsByIdData, ThrowOnError>) { 545 - return (options.client ?? this._client).put<PutApiV1BusinessDocumentsByIdResponses, unknown, ThrowOnError>({ 571 + return (options.client ?? this.client).put<PutApiV1BusinessDocumentsByIdResponses, unknown, ThrowOnError>({ 546 572 url: '/api/v1/business-documents/{id}', 547 573 ...options, 548 574 headers: { ··· 553 579 } 554 580 555 581 public postApiV1BusinessDocumentsByIdApprove<ThrowOnError extends boolean = false>(options: Options<PostApiV1BusinessDocumentsByIdApproveData, ThrowOnError>) { 556 - return (options.client ?? this._client).post<PostApiV1BusinessDocumentsByIdApproveResponses, unknown, ThrowOnError>({ 582 + return (options.client ?? this.client).post<PostApiV1BusinessDocumentsByIdApproveResponses, unknown, ThrowOnError>({ 557 583 url: '/api/v1/business-documents/{id}/approve', 558 584 ...options 559 585 }); 560 586 } 561 587 562 588 public postApiV1BusinessDocumentsByIdUnapprove<ThrowOnError extends boolean = false>(options: Options<PostApiV1BusinessDocumentsByIdUnapproveData, ThrowOnError>) { 563 - return (options.client ?? this._client).post<PostApiV1BusinessDocumentsByIdUnapproveResponses, unknown, ThrowOnError>({ 589 + return (options.client ?? this.client).post<PostApiV1BusinessDocumentsByIdUnapproveResponses, unknown, ThrowOnError>({ 564 590 url: '/api/v1/business-documents/{id}/unapprove', 565 591 ...options 566 592 }); 567 593 } 568 594 569 595 public postApiV1BusinessDocumentsByIdMoveToPersonal<ThrowOnError extends boolean = false>(options: Options<PostApiV1BusinessDocumentsByIdMoveToPersonalData, ThrowOnError>) { 570 - return (options.client ?? this._client).post<PostApiV1BusinessDocumentsByIdMoveToPersonalResponses, unknown, ThrowOnError>({ 596 + return (options.client ?? this.client).post<PostApiV1BusinessDocumentsByIdMoveToPersonalResponses, unknown, ThrowOnError>({ 571 597 url: '/api/v1/business-documents/{id}/move-to-personal', 572 598 ...options 573 599 }); 574 600 } 575 601 576 602 public postApiV1BusinessDocumentsByIdMoveToBusiness<ThrowOnError extends boolean = false>(options: Options<PostApiV1BusinessDocumentsByIdMoveToBusinessData, ThrowOnError>) { 577 - return (options.client ?? this._client).post<PostApiV1BusinessDocumentsByIdMoveToBusinessResponses, unknown, ThrowOnError>({ 603 + return (options.client ?? this.client).post<PostApiV1BusinessDocumentsByIdMoveToBusinessResponses, unknown, ThrowOnError>({ 578 604 url: '/api/v1/business-documents/{id}/move-to-business', 579 605 ...options, 580 606 headers: { ··· 585 611 } 586 612 587 613 public getApiV1BusinessesByIdDocumentTypesSummary<ThrowOnError extends boolean = false>(options: Options<GetApiV1BusinessesByIdDocumentTypesSummaryData, ThrowOnError>) { 588 - return (options.client ?? this._client).get<GetApiV1BusinessesByIdDocumentTypesSummaryResponses, unknown, ThrowOnError>({ 614 + return (options.client ?? this.client).get<GetApiV1BusinessesByIdDocumentTypesSummaryResponses, unknown, ThrowOnError>({ 589 615 url: '/api/v1/businesses/{id}/document-types-summary', 590 616 ...options 591 617 }); 592 618 } 593 619 594 620 public postApiV1Businesses<ThrowOnError extends boolean = false>(options?: Options<PostApiV1BusinessesData, ThrowOnError>) { 595 - return (options?.client ?? this._client).post<PostApiV1BusinessesResponses, unknown, ThrowOnError>({ 621 + return (options?.client ?? this.client).post<PostApiV1BusinessesResponses, unknown, ThrowOnError>({ 596 622 url: '/api/v1/businesses', 597 623 ...options, 598 624 headers: { ··· 603 629 } 604 630 605 631 public deleteApiV1BusinessesById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1BusinessesByIdData, ThrowOnError>) { 606 - return (options.client ?? this._client).delete<DeleteApiV1BusinessesByIdResponses, unknown, ThrowOnError>({ 632 + return (options.client ?? this.client).delete<DeleteApiV1BusinessesByIdResponses, unknown, ThrowOnError>({ 607 633 url: '/api/v1/businesses/{id}', 608 634 ...options 609 635 }); 610 636 } 611 637 612 638 public putApiV1BusinessesById<ThrowOnError extends boolean = false>(options: Options<PutApiV1BusinessesByIdData, ThrowOnError>) { 613 - return (options.client ?? this._client).put<PutApiV1BusinessesByIdResponses, unknown, ThrowOnError>({ 639 + return (options.client ?? this.client).put<PutApiV1BusinessesByIdResponses, unknown, ThrowOnError>({ 614 640 url: '/api/v1/businesses/{id}', 615 641 ...options, 616 642 headers: { ··· 621 647 } 622 648 623 649 public putApiV1BusinessesByIdContact<ThrowOnError extends boolean = false>(options: Options<PutApiV1BusinessesByIdContactData, ThrowOnError>) { 624 - return (options.client ?? this._client).put<PutApiV1BusinessesByIdContactResponses, unknown, ThrowOnError>({ 650 + return (options.client ?? this.client).put<PutApiV1BusinessesByIdContactResponses, unknown, ThrowOnError>({ 625 651 url: '/api/v1/businesses/{id}/contact', 626 652 ...options, 627 653 headers: { ··· 632 658 } 633 659 634 660 public postApiV1BusinessesByIdDisconnect<ThrowOnError extends boolean = false>(options: Options<PostApiV1BusinessesByIdDisconnectData, ThrowOnError>) { 635 - return (options.client ?? this._client).post<PostApiV1BusinessesByIdDisconnectResponses, unknown, ThrowOnError>({ 661 + return (options.client ?? this.client).post<PostApiV1BusinessesByIdDisconnectResponses, unknown, ThrowOnError>({ 636 662 url: '/api/v1/businesses/{id}/disconnect', 637 663 ...options 638 664 }); 639 665 } 640 666 641 667 public putApiV1BusinessMemberships<ThrowOnError extends boolean = false>(options?: Options<PutApiV1BusinessMembershipsData, ThrowOnError>) { 642 - return (options?.client ?? this._client).put<PutApiV1BusinessMembershipsResponses, unknown, ThrowOnError>({ 668 + return (options?.client ?? this.client).put<PutApiV1BusinessMembershipsResponses, unknown, ThrowOnError>({ 643 669 url: '/api/v1/business-memberships', 644 670 ...options, 645 671 headers: { ··· 650 676 } 651 677 652 678 public postApiV1Counterparties<ThrowOnError extends boolean = false>(options?: Options<PostApiV1CounterpartiesData, ThrowOnError>) { 653 - return (options?.client ?? this._client).post<PostApiV1CounterpartiesResponses, unknown, ThrowOnError>({ 679 + return (options?.client ?? this.client).post<PostApiV1CounterpartiesResponses, unknown, ThrowOnError>({ 654 680 url: '/api/v1/counterparties', 655 681 ...options, 656 682 headers: { ··· 661 687 } 662 688 663 689 public deleteApiV1CounterpartiesById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1CounterpartiesByIdData, ThrowOnError>) { 664 - return (options.client ?? this._client).delete<DeleteApiV1CounterpartiesByIdResponses, unknown, ThrowOnError>({ 690 + return (options.client ?? this.client).delete<DeleteApiV1CounterpartiesByIdResponses, unknown, ThrowOnError>({ 665 691 url: '/api/v1/counterparties/{id}', 666 692 ...options 667 693 }); 668 694 } 669 695 670 696 public patchApiV1CounterpartiesById<ThrowOnError extends boolean = false>(options: Options<PatchApiV1CounterpartiesByIdData, ThrowOnError>) { 671 - return (options.client ?? this._client).patch<PatchApiV1CounterpartiesByIdResponses, unknown, ThrowOnError>({ 697 + return (options.client ?? this.client).patch<PatchApiV1CounterpartiesByIdResponses, unknown, ThrowOnError>({ 672 698 url: '/api/v1/counterparties/{id}', 673 699 ...options, 674 700 headers: { ··· 679 705 } 680 706 681 707 public putApiV1DataBoxCredentials<ThrowOnError extends boolean = false>(options?: Options<PutApiV1DataBoxCredentialsData, ThrowOnError>) { 682 - return (options?.client ?? this._client).put<PutApiV1DataBoxCredentialsResponses, unknown, ThrowOnError>({ 708 + return (options?.client ?? this.client).put<PutApiV1DataBoxCredentialsResponses, unknown, ThrowOnError>({ 683 709 url: '/api/v1/data-box-credentials', 684 710 ...options, 685 711 headers: { ··· 690 716 } 691 717 692 718 public deleteApiV1DataBoxCredentialsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1DataBoxCredentialsByIdData, ThrowOnError>) { 693 - return (options.client ?? this._client).delete<DeleteApiV1DataBoxCredentialsByIdResponses, unknown, ThrowOnError>({ 719 + return (options.client ?? this.client).delete<DeleteApiV1DataBoxCredentialsByIdResponses, unknown, ThrowOnError>({ 694 720 url: '/api/v1/data-box-credentials/{id}', 695 721 ...options 696 722 }); 697 723 } 698 724 699 725 public getApiDev<ThrowOnError extends boolean = false>(options?: Options<GetApiDevData, ThrowOnError>) { 700 - return (options?.client ?? this._client).get<GetApiDevResponses, unknown, ThrowOnError>({ 726 + return (options?.client ?? this.client).get<GetApiDevResponses, unknown, ThrowOnError>({ 701 727 url: '/api/dev', 702 728 ...options 703 729 }); 704 730 } 705 731 706 732 public getApiDevReseedDb<ThrowOnError extends boolean = false>(options?: Options<GetApiDevReseedDbData, ThrowOnError>) { 707 - return (options?.client ?? this._client).get<GetApiDevReseedDbResponses, unknown, ThrowOnError>({ 733 + return (options?.client ?? this.client).get<GetApiDevReseedDbResponses, unknown, ThrowOnError>({ 708 734 url: '/api/dev/reseed-db', 709 735 ...options 710 736 }); 711 737 } 712 738 713 739 public getApiDevDbReset<ThrowOnError extends boolean = false>(options?: Options<GetApiDevDbResetData, ThrowOnError>) { 714 - return (options?.client ?? this._client).get<GetApiDevDbResetResponses, unknown, ThrowOnError>({ 740 + return (options?.client ?? this.client).get<GetApiDevDbResetResponses, unknown, ThrowOnError>({ 715 741 url: '/api/dev/db-reset', 716 742 ...options 717 743 }); 718 744 } 719 745 720 746 public getApiDevDbReset2<ThrowOnError extends boolean = false>(options?: Options<GetApiDevDbReset2Data, ThrowOnError>) { 721 - return (options?.client ?? this._client).get<GetApiDevDbReset2Responses, unknown, ThrowOnError>({ 747 + return (options?.client ?? this.client).get<GetApiDevDbReset2Responses, unknown, ThrowOnError>({ 722 748 url: '/api/dev/db/reset', 723 749 ...options 724 750 }); 725 751 } 726 752 727 753 public getApiDevDbCreate<ThrowOnError extends boolean = false>(options?: Options<GetApiDevDbCreateData, ThrowOnError>) { 728 - return (options?.client ?? this._client).get<GetApiDevDbCreateResponses, unknown, ThrowOnError>({ 754 + return (options?.client ?? this.client).get<GetApiDevDbCreateResponses, unknown, ThrowOnError>({ 729 755 url: '/api/dev/db/create', 730 756 ...options 731 757 }); 732 758 } 733 759 734 760 public getApiDevDbTouch<ThrowOnError extends boolean = false>(options?: Options<GetApiDevDbTouchData, ThrowOnError>) { 735 - return (options?.client ?? this._client).get<GetApiDevDbTouchResponses, unknown, ThrowOnError>({ 761 + return (options?.client ?? this.client).get<GetApiDevDbTouchResponses, unknown, ThrowOnError>({ 736 762 url: '/api/dev/db/touch', 737 763 ...options 738 764 }); 739 765 } 740 766 741 767 public getApiDevSeed<ThrowOnError extends boolean = false>(options?: Options<GetApiDevSeedData, ThrowOnError>) { 742 - return (options?.client ?? this._client).get<GetApiDevSeedResponses, unknown, ThrowOnError>({ 768 + return (options?.client ?? this.client).get<GetApiDevSeedResponses, unknown, ThrowOnError>({ 743 769 url: '/api/dev/seed', 744 770 ...options 745 771 }); 746 772 } 747 773 748 774 public getApiDevSeedAll<ThrowOnError extends boolean = false>(options?: Options<GetApiDevSeedAllData, ThrowOnError>) { 749 - return (options?.client ?? this._client).get<GetApiDevSeedAllResponses, unknown, ThrowOnError>({ 775 + return (options?.client ?? this.client).get<GetApiDevSeedAllResponses, unknown, ThrowOnError>({ 750 776 url: '/api/dev/seed-all', 751 777 ...options 752 778 }); 753 779 } 754 780 755 781 public getApiDevSeedProd<ThrowOnError extends boolean = false>(options?: Options<GetApiDevSeedProdData, ThrowOnError>) { 756 - return (options?.client ?? this._client).get<GetApiDevSeedProdResponses, unknown, ThrowOnError>({ 782 + return (options?.client ?? this.client).get<GetApiDevSeedProdResponses, unknown, ThrowOnError>({ 757 783 url: '/api/dev/seed-prod', 758 784 ...options 759 785 }); 760 786 } 761 787 762 788 public getApiDevJobProcessRecurringTasks<ThrowOnError extends boolean = false>(options?: Options<GetApiDevJobProcessRecurringTasksData, ThrowOnError>) { 763 - return (options?.client ?? this._client).get<GetApiDevJobProcessRecurringTasksResponses, unknown, ThrowOnError>({ 789 + return (options?.client ?? this.client).get<GetApiDevJobProcessRecurringTasksResponses, unknown, ThrowOnError>({ 764 790 url: '/api/dev/job/process-recurring-tasks', 765 791 ...options 766 792 }); 767 793 } 768 794 769 795 public getApiDevNotificationsSendTest<ThrowOnError extends boolean = false>(options?: Options<GetApiDevNotificationsSendTestData, ThrowOnError>) { 770 - return (options?.client ?? this._client).get<GetApiDevNotificationsSendTestResponses, unknown, ThrowOnError>({ 796 + return (options?.client ?? this.client).get<GetApiDevNotificationsSendTestResponses, unknown, ThrowOnError>({ 771 797 url: '/api/dev/notifications/send-test', 772 798 ...options 773 799 }); 774 800 } 775 801 776 802 public getApiDevConfirmEmail<ThrowOnError extends boolean = false>(options?: Options<GetApiDevConfirmEmailData, ThrowOnError>) { 777 - return (options?.client ?? this._client).get<GetApiDevConfirmEmailResponses, unknown, ThrowOnError>({ 803 + return (options?.client ?? this.client).get<GetApiDevConfirmEmailResponses, unknown, ThrowOnError>({ 778 804 url: '/api/dev/confirm-email', 779 805 ...options 780 806 }); 781 807 } 782 808 783 809 public getApiDevEmailSendTest<ThrowOnError extends boolean = false>(options?: Options<GetApiDevEmailSendTestData, ThrowOnError>) { 784 - return (options?.client ?? this._client).get<GetApiDevEmailSendTestResponses, unknown, ThrowOnError>({ 810 + return (options?.client ?? this.client).get<GetApiDevEmailSendTestResponses, unknown, ThrowOnError>({ 785 811 url: '/api/dev/email/send-test', 786 812 ...options 787 813 }); 788 814 } 789 815 790 816 public deleteApiV1NotificationsDeviceTokens<ThrowOnError extends boolean = false>(options?: Options<DeleteApiV1NotificationsDeviceTokensData, ThrowOnError>) { 791 - return (options?.client ?? this._client).delete<DeleteApiV1NotificationsDeviceTokensResponses, unknown, ThrowOnError>({ 817 + return (options?.client ?? this.client).delete<DeleteApiV1NotificationsDeviceTokensResponses, unknown, ThrowOnError>({ 792 818 url: '/api/v1/notifications/device-tokens', 793 819 ...options, 794 820 headers: { ··· 799 825 } 800 826 801 827 public putApiV1NotificationsDeviceTokens<ThrowOnError extends boolean = false>(options?: Options<PutApiV1NotificationsDeviceTokensData, ThrowOnError>) { 802 - return (options?.client ?? this._client).put<PutApiV1NotificationsDeviceTokensResponses, unknown, ThrowOnError>({ 828 + return (options?.client ?? this.client).put<PutApiV1NotificationsDeviceTokensResponses, unknown, ThrowOnError>({ 803 829 url: '/api/v1/notifications/device-tokens', 804 830 ...options, 805 831 headers: { ··· 810 836 } 811 837 812 838 public postApiV1Feedback<ThrowOnError extends boolean = false>(options?: Options<PostApiV1FeedbackData, ThrowOnError>) { 813 - return (options?.client ?? this._client).post<PostApiV1FeedbackResponses, unknown, ThrowOnError>({ 839 + return (options?.client ?? this.client).post<PostApiV1FeedbackResponses, unknown, ThrowOnError>({ 814 840 url: '/api/v1/feedback', 815 841 ...options, 816 842 headers: { ··· 821 847 } 822 848 823 849 public postApiV1Invitations<ThrowOnError extends boolean = false>(options?: Options<PostApiV1InvitationsData, ThrowOnError>) { 824 - return (options?.client ?? this._client).post<PostApiV1InvitationsResponses, unknown, ThrowOnError>({ 850 + return (options?.client ?? this.client).post<PostApiV1InvitationsResponses, unknown, ThrowOnError>({ 825 851 url: '/api/v1/invitations', 826 852 ...options, 827 853 headers: { ··· 832 858 } 833 859 834 860 public postApiV1InvitationsByIdAccept<ThrowOnError extends boolean = false>(options: Options<PostApiV1InvitationsByIdAcceptData, ThrowOnError>) { 835 - return (options.client ?? this._client).post<PostApiV1InvitationsByIdAcceptResponses, unknown, ThrowOnError>({ 861 + return (options.client ?? this.client).post<PostApiV1InvitationsByIdAcceptResponses, unknown, ThrowOnError>({ 836 862 url: '/api/v1/invitations/{id}/accept', 837 863 ...options, 838 864 headers: { ··· 843 869 } 844 870 845 871 public postApiV1InvitationsByIdReject<ThrowOnError extends boolean = false>(options: Options<PostApiV1InvitationsByIdRejectData, ThrowOnError>) { 846 - return (options.client ?? this._client).post<PostApiV1InvitationsByIdRejectResponses, unknown, ThrowOnError>({ 872 + return (options.client ?? this.client).post<PostApiV1InvitationsByIdRejectResponses, unknown, ThrowOnError>({ 847 873 url: '/api/v1/invitations/{id}/reject', 848 874 ...options 849 875 }); 850 876 } 851 877 852 878 public deleteApiV1InvitationsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1InvitationsByIdData, ThrowOnError>) { 853 - return (options.client ?? this._client).delete<DeleteApiV1InvitationsByIdResponses, unknown, ThrowOnError>({ 879 + return (options.client ?? this.client).delete<DeleteApiV1InvitationsByIdResponses, unknown, ThrowOnError>({ 854 880 url: '/api/v1/invitations/{id}', 855 881 ...options 856 882 }); 857 883 } 858 884 859 885 public patchApiV1InvitationsById<ThrowOnError extends boolean = false>(options: Options<PatchApiV1InvitationsByIdData, ThrowOnError>) { 860 - return (options.client ?? this._client).patch<PatchApiV1InvitationsByIdResponses, unknown, ThrowOnError>({ 886 + return (options.client ?? this.client).patch<PatchApiV1InvitationsByIdResponses, unknown, ThrowOnError>({ 861 887 url: '/api/v1/invitations/{id}', 862 888 ...options, 863 889 headers: { ··· 868 894 } 869 895 870 896 public postApiV1Invoices<ThrowOnError extends boolean = false>(options?: Options<PostApiV1InvoicesData, ThrowOnError>) { 871 - return (options?.client ?? this._client).post<PostApiV1InvoicesResponses, unknown, ThrowOnError>({ 897 + return (options?.client ?? this.client).post<PostApiV1InvoicesResponses, unknown, ThrowOnError>({ 872 898 url: '/api/v1/invoices', 873 899 ...options, 874 900 headers: { ··· 879 905 } 880 906 881 907 public deleteApiV1InvoicesById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1InvoicesByIdData, ThrowOnError>) { 882 - return (options.client ?? this._client).delete<DeleteApiV1InvoicesByIdResponses, unknown, ThrowOnError>({ 908 + return (options.client ?? this.client).delete<DeleteApiV1InvoicesByIdResponses, unknown, ThrowOnError>({ 883 909 url: '/api/v1/invoices/{id}', 884 910 ...options 885 911 }); 886 912 } 887 913 888 914 public patchApiV1InvoicesById<ThrowOnError extends boolean = false>(options: Options<PatchApiV1InvoicesByIdData, ThrowOnError>) { 889 - return (options.client ?? this._client).patch<PatchApiV1InvoicesByIdResponses, unknown, ThrowOnError>({ 915 + return (options.client ?? this.client).patch<PatchApiV1InvoicesByIdResponses, unknown, ThrowOnError>({ 890 916 url: '/api/v1/invoices/{id}', 891 917 ...options, 892 918 headers: { ··· 897 923 } 898 924 899 925 public getApiV1InvoicesByIdPreview<ThrowOnError extends boolean = false>(options: Options<GetApiV1InvoicesByIdPreviewData, ThrowOnError>) { 900 - return (options.client ?? this._client).get<GetApiV1InvoicesByIdPreviewResponses, unknown, ThrowOnError>({ 926 + return (options.client ?? this.client).get<GetApiV1InvoicesByIdPreviewResponses, unknown, ThrowOnError>({ 901 927 url: '/api/v1/invoices/{id}/preview', 902 928 ...options 903 929 }); 904 930 } 905 931 906 932 public postApiV1InvoicesByIdSend<ThrowOnError extends boolean = false>(options: Options<PostApiV1InvoicesByIdSendData, ThrowOnError>) { 907 - return (options.client ?? this._client).post<PostApiV1InvoicesByIdSendResponses, unknown, ThrowOnError>({ 933 + return (options.client ?? this.client).post<PostApiV1InvoicesByIdSendResponses, unknown, ThrowOnError>({ 908 934 url: '/api/v1/invoices/{id}/send', 909 935 ...options, 910 936 headers: { ··· 915 941 } 916 942 917 943 public postApiV1InvoicesByIdSnapshot<ThrowOnError extends boolean = false>(options: Options<PostApiV1InvoicesByIdSnapshotData, ThrowOnError>) { 918 - return (options.client ?? this._client).post<PostApiV1InvoicesByIdSnapshotResponses, unknown, ThrowOnError>({ 944 + return (options.client ?? this.client).post<PostApiV1InvoicesByIdSnapshotResponses, unknown, ThrowOnError>({ 919 945 url: '/api/v1/invoices/{id}/snapshot', 920 946 ...options 921 947 }); 922 948 } 923 949 924 950 public putApiV1InvoiceSettings<ThrowOnError extends boolean = false>(options?: Options<PutApiV1InvoiceSettingsData, ThrowOnError>) { 925 - return (options?.client ?? this._client).put<PutApiV1InvoiceSettingsResponses, unknown, ThrowOnError>({ 951 + return (options?.client ?? this.client).put<PutApiV1InvoiceSettingsResponses, unknown, ThrowOnError>({ 926 952 url: '/api/v1/invoice-settings', 927 953 ...options, 928 954 headers: { ··· 933 959 } 934 960 935 961 public postApiV1NotificationsTest<ThrowOnError extends boolean = false>(options?: Options<PostApiV1NotificationsTestData, ThrowOnError>) { 936 - return (options?.client ?? this._client).post<PostApiV1NotificationsTestResponses, unknown, ThrowOnError>({ 962 + return (options?.client ?? this.client).post<PostApiV1NotificationsTestResponses, unknown, ThrowOnError>({ 937 963 url: '/api/v1/notifications/test', 938 964 ...options, 939 965 headers: { ··· 944 970 } 945 971 946 972 public getApiV1PersonalDocumentsByIdRaw<ThrowOnError extends boolean = false>(options: Options<GetApiV1PersonalDocumentsByIdRawData, ThrowOnError>) { 947 - return (options.client ?? this._client).get<GetApiV1PersonalDocumentsByIdRawResponses, unknown, ThrowOnError>({ 973 + return (options.client ?? this.client).get<GetApiV1PersonalDocumentsByIdRawResponses, unknown, ThrowOnError>({ 948 974 url: '/api/v1/personal-documents/{id}/raw', 949 975 ...options 950 976 }); 951 977 } 952 978 953 979 public postApiV1PersonalDocuments<ThrowOnError extends boolean = false>(options?: Options<PostApiV1PersonalDocumentsData, ThrowOnError>) { 954 - return (options?.client ?? this._client).post<PostApiV1PersonalDocumentsResponses, unknown, ThrowOnError>({ 980 + return (options?.client ?? this.client).post<PostApiV1PersonalDocumentsResponses, unknown, ThrowOnError>({ 955 981 ...formDataBodySerializer, 956 982 url: '/api/v1/personal-documents', 957 983 ...options, ··· 963 989 } 964 990 965 991 public postApiV1PersonalDocumentsByIdMoveToBusiness<ThrowOnError extends boolean = false>(options: Options<PostApiV1PersonalDocumentsByIdMoveToBusinessData, ThrowOnError>) { 966 - return (options.client ?? this._client).post<PostApiV1PersonalDocumentsByIdMoveToBusinessResponses, unknown, ThrowOnError>({ 992 + return (options.client ?? this.client).post<PostApiV1PersonalDocumentsByIdMoveToBusinessResponses, unknown, ThrowOnError>({ 967 993 url: '/api/v1/personal-documents/{id}/move-to-business', 968 994 ...options, 969 995 headers: { ··· 974 1000 } 975 1001 976 1002 public deleteApiV1PersonalDocumentsById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PersonalDocumentsByIdData, ThrowOnError>) { 977 - return (options.client ?? this._client).delete<DeleteApiV1PersonalDocumentsByIdResponses, unknown, ThrowOnError>({ 1003 + return (options.client ?? this.client).delete<DeleteApiV1PersonalDocumentsByIdResponses, unknown, ThrowOnError>({ 978 1004 url: '/api/v1/personal-documents/{id}', 979 1005 ...options 980 1006 }); 981 1007 } 982 1008 983 1009 public getApiV1PersonalDocumentsSummary<ThrowOnError extends boolean = false>(options?: Options<GetApiV1PersonalDocumentsSummaryData, ThrowOnError>) { 984 - return (options?.client ?? this._client).get<GetApiV1PersonalDocumentsSummaryResponses, unknown, ThrowOnError>({ 1010 + return (options?.client ?? this.client).get<GetApiV1PersonalDocumentsSummaryResponses, unknown, ThrowOnError>({ 985 1011 url: '/api/v1/personal-documents/summary', 986 1012 ...options 987 1013 }); 988 1014 } 989 1015 990 1016 public postApiV1RecurringTasks<ThrowOnError extends boolean = false>(options?: Options<PostApiV1RecurringTasksData, ThrowOnError>) { 991 - return (options?.client ?? this._client).post<PostApiV1RecurringTasksResponses, unknown, ThrowOnError>({ 1017 + return (options?.client ?? this.client).post<PostApiV1RecurringTasksResponses, unknown, ThrowOnError>({ 992 1018 url: '/api/v1/recurring-tasks', 993 1019 ...options, 994 1020 headers: { ··· 999 1025 } 1000 1026 1001 1027 public deleteApiV1RecurringTasksById<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RecurringTasksByIdData, ThrowOnError>) { 1002 - return (options.client ?? this._client).delete<DeleteApiV1RecurringTasksByIdResponses, unknown, ThrowOnError>({ 1028 + return (options.client ?? this.client).delete<DeleteApiV1RecurringTasksByIdResponses, unknown, ThrowOnError>({ 1003 1029 url: '/api/v1/recurring-tasks/{id}', 1004 1030 ...options 1005 1031 }); 1006 1032 } 1007 1033 1008 1034 public patchApiV1RecurringTasksById<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RecurringTasksByIdData, ThrowOnError>) { 1009 - return (options.client ?? this._client).patch<PatchApiV1RecurringTasksByIdResponses, unknown, ThrowOnError>({ 1035 + return (options.client ?? this.client).patch<PatchApiV1RecurringTasksByIdResponses, unknown, ThrowOnError>({ 1010 1036 url: '/api/v1/recurring-tasks/{id}', 1011 1037 ...options, 1012 1038 headers: { ··· 1017 1043 } 1018 1044 1019 1045 public get<ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) { 1020 - return (options?.client ?? this._client).get<GetResponses, unknown, ThrowOnError>({ 1046 + return (options?.client ?? this.client).get<GetResponses, unknown, ThrowOnError>({ 1021 1047 url: '/', 1022 1048 ...options 1023 1049 }); 1024 1050 } 1025 1051 1026 1052 public postApiV1Tasks<ThrowOnError extends boolean = false>(options?: Options<PostApiV1TasksData, ThrowOnError>) { 1027 - return (options?.client ?? this._client).post<PostApiV1TasksResponses, unknown, ThrowOnError>({ 1053 + return (options?.client ?? this.client).post<PostApiV1TasksResponses, unknown, ThrowOnError>({ 1028 1054 url: '/api/v1/tasks', 1029 1055 ...options, 1030 1056 headers: { ··· 1035 1061 } 1036 1062 1037 1063 public putApiV1TasksById<ThrowOnError extends boolean = false>(options: Options<PutApiV1TasksByIdData, ThrowOnError>) { 1038 - return (options.client ?? this._client).put<PutApiV1TasksByIdResponses, unknown, ThrowOnError>({ 1064 + return (options.client ?? this.client).put<PutApiV1TasksByIdResponses, unknown, ThrowOnError>({ 1039 1065 url: '/api/v1/tasks/{id}', 1040 1066 ...options, 1041 1067 headers: { ··· 1046 1072 } 1047 1073 1048 1074 public postApiV1TasksByIdSubmit<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksByIdSubmitData, ThrowOnError>) { 1049 - return (options.client ?? this._client).post<PostApiV1TasksByIdSubmitResponses, unknown, ThrowOnError>({ 1075 + return (options.client ?? this.client).post<PostApiV1TasksByIdSubmitResponses, unknown, ThrowOnError>({ 1050 1076 url: '/api/v1/tasks/{id}/submit', 1051 1077 ...options, 1052 1078 headers: { ··· 1057 1083 } 1058 1084 1059 1085 public postApiV1TasksByIdApprove<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksByIdApproveData, ThrowOnError>) { 1060 - return (options.client ?? this._client).post<PostApiV1TasksByIdApproveResponses, unknown, ThrowOnError>({ 1086 + return (options.client ?? this.client).post<PostApiV1TasksByIdApproveResponses, unknown, ThrowOnError>({ 1061 1087 url: '/api/v1/tasks/{id}/approve', 1062 1088 ...options 1063 1089 }); 1064 1090 } 1065 1091 1066 1092 public postApiV1TasksByIdReject<ThrowOnError extends boolean = false>(options: Options<PostApiV1TasksByIdRejectData, ThrowOnError>) { 1067 - return (options.client ?? this._client).post<PostApiV1TasksByIdRejectResponses, unknown, ThrowOnError>({ 1093 + return (options.client ?? this.client).post<PostApiV1TasksByIdRejectResponses, unknown, ThrowOnError>({ 1068 1094 url: '/api/v1/tasks/{id}/reject', 1069 1095 ...options, 1070 1096 headers: { ··· 1075 1101 } 1076 1102 1077 1103 public getApiV1TasksByIdComments<ThrowOnError extends boolean = false>(options: Options<GetApiV1TasksByIdCommentsData, ThrowOnError>) { 1078 - return (options.client ?? this._client).get<GetApiV1TasksByIdCommentsResponses, unknown, ThrowOnError>({ 1104 + return (options.client ?? this.client).get<GetApiV1TasksByIdCommentsResponses, unknown, ThrowOnError>({ 1079 1105 url: '/api/v1/tasks/{id}/comments', 1080 1106 ...options 1081 1107 }); 1082 1108 } 1083 1109 1084 1110 public getApiV1TasksByIdDocuments<ThrowOnError extends boolean = false>(options: Options<GetApiV1TasksByIdDocumentsData, ThrowOnError>) { 1085 - return (options.client ?? this._client).get<GetApiV1TasksByIdDocumentsResponses, unknown, ThrowOnError>({ 1111 + return (options.client ?? this.client).get<GetApiV1TasksByIdDocumentsResponses, unknown, ThrowOnError>({ 1086 1112 url: '/api/v1/tasks/{id}/documents', 1087 1113 ...options 1088 1114 }); 1089 1115 } 1090 1116 1091 1117 public postApiV1UserRegister<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserRegisterData, ThrowOnError>) { 1092 - return (options.client ?? this._client).post<PostApiV1UserRegisterResponses, PostApiV1UserRegisterErrors, ThrowOnError>({ 1118 + return (options.client ?? this.client).post<PostApiV1UserRegisterResponses, PostApiV1UserRegisterErrors, ThrowOnError>({ 1093 1119 url: '/api/v1/user/register', 1094 1120 ...options, 1095 1121 headers: { ··· 1100 1126 } 1101 1127 1102 1128 public postApiV1UserLogin<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserLoginData, ThrowOnError>) { 1103 - return (options.client ?? this._client).post<PostApiV1UserLoginResponses, unknown, ThrowOnError>({ 1129 + return (options.client ?? this.client).post<PostApiV1UserLoginResponses, unknown, ThrowOnError>({ 1104 1130 url: '/api/v1/user/login', 1105 1131 ...options, 1106 1132 headers: { ··· 1111 1137 } 1112 1138 1113 1139 public postApiV1UserRefresh<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserRefreshData, ThrowOnError>) { 1114 - return (options.client ?? this._client).post<PostApiV1UserRefreshResponses, unknown, ThrowOnError>({ 1140 + return (options.client ?? this.client).post<PostApiV1UserRefreshResponses, unknown, ThrowOnError>({ 1115 1141 url: '/api/v1/user/refresh', 1116 1142 ...options, 1117 1143 headers: { ··· 1122 1148 } 1123 1149 1124 1150 public postApiV1UserResendConfirmationEmail<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserResendConfirmationEmailData, ThrowOnError>) { 1125 - return (options.client ?? this._client).post<PostApiV1UserResendConfirmationEmailResponses, unknown, ThrowOnError>({ 1151 + return (options.client ?? this.client).post<PostApiV1UserResendConfirmationEmailResponses, unknown, ThrowOnError>({ 1126 1152 url: '/api/v1/user/resendConfirmationEmail', 1127 1153 ...options, 1128 1154 headers: { ··· 1133 1159 } 1134 1160 1135 1161 public postApiV1UserForgotPassword<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserForgotPasswordData, ThrowOnError>) { 1136 - return (options.client ?? this._client).post<PostApiV1UserForgotPasswordResponses, PostApiV1UserForgotPasswordErrors, ThrowOnError>({ 1162 + return (options.client ?? this.client).post<PostApiV1UserForgotPasswordResponses, PostApiV1UserForgotPasswordErrors, ThrowOnError>({ 1137 1163 url: '/api/v1/user/forgotPassword', 1138 1164 ...options, 1139 1165 headers: { ··· 1144 1170 } 1145 1171 1146 1172 public postApiV1UserResetPassword<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserResetPasswordData, ThrowOnError>) { 1147 - return (options.client ?? this._client).post<PostApiV1UserResetPasswordResponses, PostApiV1UserResetPasswordErrors, ThrowOnError>({ 1173 + return (options.client ?? this.client).post<PostApiV1UserResetPasswordResponses, PostApiV1UserResetPasswordErrors, ThrowOnError>({ 1148 1174 url: '/api/v1/user/resetPassword', 1149 1175 ...options, 1150 1176 headers: { ··· 1155 1181 } 1156 1182 1157 1183 public postApiV1UserManage2Fa<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserManage2FaData, ThrowOnError>) { 1158 - return (options.client ?? this._client).post<PostApiV1UserManage2FaResponses, PostApiV1UserManage2FaErrors, ThrowOnError>({ 1184 + return (options.client ?? this.client).post<PostApiV1UserManage2FaResponses, PostApiV1UserManage2FaErrors, ThrowOnError>({ 1159 1185 url: '/api/v1/user/manage/2fa', 1160 1186 ...options, 1161 1187 headers: { ··· 1166 1192 } 1167 1193 1168 1194 public getApiV1UserManageInfo<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UserManageInfoData, ThrowOnError>) { 1169 - return (options?.client ?? this._client).get<GetApiV1UserManageInfoResponses, GetApiV1UserManageInfoErrors, ThrowOnError>({ 1195 + return (options?.client ?? this.client).get<GetApiV1UserManageInfoResponses, GetApiV1UserManageInfoErrors, ThrowOnError>({ 1170 1196 url: '/api/v1/user/manage/info', 1171 1197 ...options 1172 1198 }); 1173 1199 } 1174 1200 1175 1201 public postApiV1UserManageInfo<ThrowOnError extends boolean = false>(options: Options<PostApiV1UserManageInfoData, ThrowOnError>) { 1176 - return (options.client ?? this._client).post<PostApiV1UserManageInfoResponses, PostApiV1UserManageInfoErrors, ThrowOnError>({ 1202 + return (options.client ?? this.client).post<PostApiV1UserManageInfoResponses, PostApiV1UserManageInfoErrors, ThrowOnError>({ 1177 1203 url: '/api/v1/user/manage/info', 1178 1204 ...options, 1179 1205 headers: { ··· 1184 1210 } 1185 1211 1186 1212 public postApiV1UserLogout<ThrowOnError extends boolean = false>(options?: Options<PostApiV1UserLogoutData, ThrowOnError>) { 1187 - return (options?.client ?? this._client).post<PostApiV1UserLogoutResponses, unknown, ThrowOnError>({ 1213 + return (options?.client ?? this.client).post<PostApiV1UserLogoutResponses, unknown, ThrowOnError>({ 1188 1214 url: '/api/v1/user/logout', 1189 1215 ...options, 1190 1216 headers: { ··· 1198 1224 * @deprecated 1199 1225 */ 1200 1226 public getApiV1UserDocumentsSummary<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UserDocumentsSummaryData, ThrowOnError>) { 1201 - return (options?.client ?? this._client).get<GetApiV1UserDocumentsSummaryResponses, unknown, ThrowOnError>({ 1227 + return (options?.client ?? this.client).get<GetApiV1UserDocumentsSummaryResponses, unknown, ThrowOnError>({ 1202 1228 url: '/api/v1/user/documents-summary', 1203 1229 ...options 1204 1230 }); 1205 1231 } 1206 1232 1207 1233 public deleteApiV1User<ThrowOnError extends boolean = false>(options?: Options<DeleteApiV1UserData, ThrowOnError>) { 1208 - return (options?.client ?? this._client).delete<DeleteApiV1UserResponses, unknown, ThrowOnError>({ 1234 + return (options?.client ?? this.client).delete<DeleteApiV1UserResponses, unknown, ThrowOnError>({ 1209 1235 url: '/api/v1/user', 1210 1236 ...options 1211 1237 }); 1212 1238 } 1213 1239 1214 1240 public getApiV1UsersMe<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersMeData, ThrowOnError>) { 1215 - return (options?.client ?? this._client).get<GetApiV1UsersMeResponses, unknown, ThrowOnError>({ 1241 + return (options?.client ?? this.client).get<GetApiV1UsersMeResponses, unknown, ThrowOnError>({ 1216 1242 url: '/api/v1/users/me', 1217 1243 ...options 1218 1244 }); 1219 1245 } 1220 1246 1221 1247 public patchApiV1UsersById<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdData, ThrowOnError>) { 1222 - return (options.client ?? this._client).patch<PatchApiV1UsersByIdResponses, unknown, ThrowOnError>({ 1248 + return (options.client ?? this.client).patch<PatchApiV1UsersByIdResponses, unknown, ThrowOnError>({ 1223 1249 url: '/api/v1/users/{id}', 1224 1250 ...options, 1225 1251 headers: { ··· 1229 1255 }); 1230 1256 } 1231 1257 1232 - api = new Api({ client: this._client }); 1258 + api = new Api({ client: this.client }); 1233 1259 1234 - mapIdentityApi = new MapIdentityApi({ client: this._client }); 1260 + mapIdentityApi = new MapIdentityApi({ client: this.client }); 1235 1261 }
+283 -231
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/class.ts
··· 1 + import type { Symbol } from '@hey-api/codegen-core'; 1 2 import type ts from 'typescript'; 2 3 3 4 import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; ··· 5 6 createOperationComment, 6 7 isOperationOptionsRequired, 7 8 } from '~/plugins/shared/utils/operation'; 8 - import { tsc } from '~/tsc'; 9 + import type { TsDsl } from '~/ts-dsl'; 10 + import { $ } from '~/ts-dsl'; 11 + import { toParameterDeclarations } from '~/tsc/types'; 9 12 import { stringCase } from '~/utils/stringCase'; 10 13 11 14 import type { HeyApiSdkPlugin } from '../types'; ··· 36 39 /** 37 40 * List of class nodes containing methods. 38 41 */ 39 - nodes: Array<ts.ClassElement>; 42 + nodes: Array<ts.ClassElement | TsDsl>; 40 43 /** 41 44 * Is this a root class? 42 45 */ 43 46 root: boolean; 44 47 }; 45 48 46 - const createClientClassNodes = ({ 49 + export const registryName = '__registry'; 50 + 51 + const createRegistryClass = ({ 52 + sdkName, 53 + symbol, 54 + }: { 55 + plugin: HeyApiSdkPlugin['Instance']; 56 + sdkName: string; 57 + symbol: Symbol; 58 + }): TsDsl => { 59 + const defaultKey = 'defaultKey'; 60 + const instances = 'instances'; 61 + return $.class(symbol.placeholder) 62 + .export(symbol.exported) 63 + .generic('T') 64 + .field(defaultKey, (f) => 65 + f.private().readonly().assign($.literal('default')), 66 + ) 67 + .newline() 68 + .field(instances, (f) => 69 + f 70 + .private() 71 + .readonly() 72 + .type($.type('Map').generics('string', 'T')) 73 + .assign($.new('Map')), 74 + ) 75 + .newline() 76 + .method('get', (m) => 77 + m 78 + .returns('T') 79 + .param('key', (p) => p.type('string').optional()) 80 + .do( 81 + $.const('instance').assign( 82 + $('this') 83 + .attr('instances') 84 + .attr('get') 85 + .call($('key').coalesce($('this').attr(defaultKey))), 86 + ), 87 + $.if($.not('instance')).do( 88 + $.throw('Error').message( 89 + $.template('No SDK client found. Create one with "new ') 90 + .add(sdkName) 91 + .add('()" to fix this error.'), 92 + ), 93 + ), 94 + $.return('instance'), 95 + ), 96 + ) 97 + .newline() 98 + .method('set', (m) => 99 + m 100 + .returns('void') 101 + .param('value', (p) => p.type('T')) 102 + .param('key', (p) => p.type('string').optional()) 103 + .do( 104 + $('this') 105 + .attr(instances) 106 + .attr('set') 107 + .call($('key').coalesce($('this').attr(defaultKey)), 'value'), 108 + ), 109 + ); 110 + }; 111 + 112 + const createClientClass = ({ 47 113 plugin, 114 + symbol, 48 115 }: { 49 116 plugin: HeyApiSdkPlugin['Instance']; 50 - }): ReadonlyArray<ts.ClassElement> => { 51 - const clientAssignmentStatement = tsc.expressionToStatement({ 52 - expression: tsc.binaryExpression({ 53 - left: tsc.propertyAccessExpression({ 54 - expression: tsc.this(), 55 - name: '_client', 56 - }), 57 - operator: '=', 58 - right: tsc.propertyAccessExpression({ 59 - expression: tsc.identifier({ text: 'args' }), 60 - name: 'client', 61 - }), 62 - }), 117 + symbol: Symbol; 118 + }): TsDsl => { 119 + const symClient = plugin.getSymbol({ 120 + category: 'client', 63 121 }); 64 - 122 + const optionalClient = Boolean(plugin.config.client && symClient); 65 123 const symbolClient = plugin.referenceSymbol({ 66 124 category: 'external', 67 125 resource: 'client.Client', 68 126 }); 69 - const symClient = plugin.getSymbol({ 70 - category: 'client', 71 - }); 72 - 73 - return [ 74 - tsc.propertyDeclaration({ 75 - initializer: symClient 76 - ? tsc.identifier({ text: symClient.placeholder }) 77 - : undefined, 78 - modifier: 'protected', 79 - name: '_client', 80 - type: tsc.typeReferenceNode({ typeName: symbolClient.placeholder }), 81 - }), 82 - // @ts-expect-error 83 - tsc.identifier({ text: '\n' }), 84 - tsc.constructorDeclaration({ 85 - multiLine: true, 86 - parameters: [ 87 - { 88 - isRequired: !plugin.config.client, 89 - name: 'args', 90 - type: tsc.typeInterfaceNode({ 91 - properties: [ 92 - { 93 - isRequired: !plugin.config.client, 94 - name: 'client', 95 - type: symbolClient.placeholder, 96 - }, 97 - ], 98 - useLegacyResolution: false, 99 - }), 100 - }, 101 - ], 102 - statements: [ 103 - !plugin.config.client 104 - ? clientAssignmentStatement 105 - : tsc.ifStatement({ 106 - expression: tsc.propertyAccessExpression({ 107 - expression: tsc.identifier({ text: 'args' }), 108 - isOptional: true, 109 - name: 'client', 110 - }), 111 - thenStatement: tsc.block({ 112 - statements: [clientAssignmentStatement], 113 - }), 114 - }), 115 - ], 116 - }), 117 - ]; 127 + return $.class(symbol.placeholder) 128 + .export(symbol.exported) 129 + .field('client', (f) => f.protected().type(symbolClient.placeholder)) 130 + .newline() 131 + .init((i) => 132 + i 133 + .param('args', (p) => 134 + p 135 + .optional(optionalClient) 136 + .type() 137 + .object((o) => 138 + o.prop('client', (p) => 139 + p.optional(optionalClient).type(symbolClient.placeholder), 140 + ), 141 + ), 142 + ) 143 + .do( 144 + $('this') 145 + .attr('client') 146 + .assign( 147 + $('args') 148 + .attr('client') 149 + .optional(optionalClient) 150 + .$if(optionalClient, (a) => a.coalesce(symClient!.placeholder)), 151 + ), 152 + ), 153 + ); 118 154 }; 119 155 120 156 export const generateClassSdk = ({ ··· 130 166 * Track unique added classes. 131 167 */ 132 168 const generatedClasses = new Set<string>(); 133 - 134 - const clientClassNodes = plugin.config.instance 135 - ? createClientClassNodes({ plugin }) 136 - : []; 137 169 138 170 plugin.forEach( 139 171 'operation', ··· 222 254 operation, 223 255 plugin, 224 256 }); 225 - const functionNode = tsc.methodDeclaration({ 226 - accessLevel: 'public', 227 - comment: createOperationComment({ operation }), 228 - isStatic: isAngularClient ? false : !plugin.config.instance, 229 - name: entry.methodName, 230 - parameters: opParameters.parameters, 231 - returnType: undefined, 232 - statements, 233 - types: isNuxtClient 234 - ? [ 235 - { 236 - default: tsc.ots.string('$fetch'), 237 - extends: tsc.typeNode( 238 - plugin.referenceSymbol({ 239 - category: 'external', 240 - resource: 'client.Composable', 241 - }).placeholder, 257 + const functionNode = $.method(entry.methodName, (m) => 258 + m 259 + .$if(createOperationComment({ operation }), (m, v) => 260 + m.describe(v as Array<string>), 261 + ) 262 + .public() 263 + .static(!isAngularClient && !plugin.config.instance) 264 + .$if( 265 + isNuxtClient, 266 + (m) => 267 + m 268 + .generic(nuxtTypeComposable, (t) => 269 + t 270 + .extends( 271 + plugin.referenceSymbol({ 272 + category: 'external', 273 + resource: 'client.Composable', 274 + }).placeholder, 275 + ) 276 + .default($.type.literal('$fetch')), 277 + ) 278 + .generic(nuxtTypeDefault, (t) => 279 + t.$if(symbolResponse, (t, s) => 280 + t.extends(s.placeholder).default(s.placeholder), 281 + ), 242 282 ), 243 - name: nuxtTypeComposable, 244 - }, 245 - { 246 - default: symbolResponse 247 - ? tsc.typeReferenceNode({ 248 - typeName: symbolResponse.placeholder, 249 - }) 250 - : tsc.typeNode('undefined'), 251 - extends: symbolResponse 252 - ? tsc.typeReferenceNode({ 253 - typeName: symbolResponse.placeholder, 254 - }) 255 - : undefined, 256 - name: nuxtTypeDefault, 257 - }, 258 - ] 259 - : [ 260 - { 261 - default: 262 - ('throwOnError' in client.config 263 - ? client.config.throwOnError 264 - : false) ?? false, 265 - extends: 'boolean', 266 - name: 'ThrowOnError', 267 - }, 268 - ], 269 - }); 283 + (m) => 284 + m.generic('ThrowOnError', (t) => 285 + t 286 + .extends('boolean') 287 + .default( 288 + ('throwOnError' in client.config 289 + ? client.config.throwOnError 290 + : false) ?? false, 291 + ), 292 + ), 293 + ) 294 + .params(...toParameterDeclarations(opParameters.parameters)) 295 + .do(...statements), 296 + ); 270 297 271 298 if (!currentClass.nodes.length) { 272 299 currentClass.nodes.push(functionNode); 273 300 } else { 274 - currentClass.nodes.push( 275 - // @ts-expect-error 276 - tsc.identifier({ text: '\n' }), 277 - functionNode, 278 - ); 301 + currentClass.nodes.push($.newline(), functionNode); 279 302 } 280 303 281 304 currentClass.methods.add(entry.methodName); ··· 289 312 }, 290 313 ); 291 314 292 - const symbolHeyApiClient = plugin.registerSymbol({ 293 - exported: false, 294 - kind: 'class', 295 - meta: { 296 - category: 'utility', 297 - resource: 'class', 298 - resourceId: '_HeyApiClient', 299 - tool: 'sdk', 300 - }, 301 - name: '_HeyApiClient', 302 - }); 315 + const symbolHeyApiClient = plugin.config.instance 316 + ? plugin.registerSymbol({ 317 + exported: false, 318 + kind: 'class', 319 + meta: { 320 + category: 'utility', 321 + resource: 'class', 322 + resourceId: 'HeyApiClient', 323 + tool: 'sdk', 324 + }, 325 + name: 'HeyApiClient', 326 + }) 327 + : undefined; 328 + const symbolHeyApiRegistry = plugin.config.instance 329 + ? plugin.registerSymbol({ 330 + exported: false, 331 + kind: 'class', 332 + meta: { 333 + category: 'utility', 334 + resource: 'class', 335 + resourceId: 'HeyApiRegistry', 336 + tool: 'sdk', 337 + }, 338 + name: 'HeyApiRegistry', 339 + }) 340 + : undefined; 303 341 304 342 const generateClass = (currentClass: SdkClassEntry) => { 305 343 if (generatedClasses.has(currentClass.className)) { ··· 339 377 340 378 let subClassReferenceNode: 341 379 | ts.GetAccessorDeclaration 342 - | ts.PropertyDeclaration; 380 + | ts.PropertyDeclaration 381 + | TsDsl; 343 382 if (plugin.isSymbolRegistered(refChildClass.id)) { 344 - subClassReferenceNode = tsc.propertyDeclaration({ 345 - initializer: plugin.config.instance 346 - ? tsc.newExpression({ 347 - argumentsArray: plugin.config.instance 348 - ? [ 349 - tsc.objectExpression({ 350 - multiLine: false, 351 - obj: [ 352 - { 353 - key: 'client', 354 - value: tsc.propertyAccessExpression({ 355 - expression: tsc.this(), 356 - name: '_client', 357 - }), 358 - }, 359 - ], 360 - }), 361 - ] 362 - : [], 363 - expression: tsc.identifier({ 364 - text: refChildClass.placeholder, 365 - }), 366 - }) 367 - : tsc.identifier({ text: refChildClass.placeholder }), 368 - modifier: plugin.config.instance ? undefined : 'static', 369 - name: memberName, 370 - }); 383 + subClassReferenceNode = $.field(memberName, (f) => 384 + f 385 + .static(!plugin.config.instance) 386 + .assign( 387 + plugin.config.instance 388 + ? $.new(refChildClass.placeholder).args( 389 + $.object((o) => 390 + o.prop('client', () => $('this').attr('client')), 391 + ), 392 + ) 393 + : $(refChildClass.placeholder), 394 + ), 395 + ); 371 396 } else { 372 - subClassReferenceNode = tsc.getAccessorDeclaration({ 373 - modifiers: plugin.config.instance 374 - ? undefined 375 - : ['public', 'static'], 376 - name: memberName, 377 - statements: plugin.config.instance 378 - ? [ 379 - tsc.returnStatement({ 380 - expression: tsc.newExpression({ 381 - argumentsArray: [ 382 - tsc.objectExpression({ 383 - multiLine: false, 384 - obj: [ 385 - { 386 - key: 'client', 387 - value: tsc.propertyAccessExpression({ 388 - expression: tsc.this(), 389 - name: '_client', 390 - }), 391 - }, 392 - ], 393 - }), 394 - ], 395 - expression: tsc.identifier({ 396 - text: refChildClass.placeholder, 397 - }), 398 - }), 399 - }), 400 - ] 401 - : [ 402 - tsc.returnStatement({ 403 - expression: tsc.identifier({ 404 - text: refChildClass.placeholder, 405 - }), 406 - }), 407 - ], 408 - }); 397 + subClassReferenceNode = $.getter(memberName, (g) => 398 + g 399 + .$if(!plugin.config.instance, (g) => g.public().static()) 400 + .do( 401 + plugin.config.instance 402 + ? $.return( 403 + $.new(refChildClass.placeholder).args( 404 + $.object((o) => 405 + o.prop('client', () => $('this').attr('client')), 406 + ), 407 + ), 408 + ) 409 + : $.return(refChildClass.placeholder), 410 + ), 411 + ); 409 412 } 410 413 411 414 if (!currentClass.nodes.length) { 412 415 currentClass.nodes.push(subClassReferenceNode); 413 416 } else { 414 - currentClass.nodes.push( 415 - // @ts-expect-error 416 - tsc.identifier({ text: '\n' }), 417 - subClassReferenceNode, 418 - ); 417 + currentClass.nodes.push($.newline(), subClassReferenceNode); 419 418 } 420 419 } 421 420 } 422 421 422 + if ( 423 + symbolHeyApiClient && 424 + !plugin.gen.symbols.hasValue(symbolHeyApiClient.id) 425 + ) { 426 + const node = createClientClass({ 427 + plugin, 428 + symbol: symbolHeyApiClient, 429 + }).$render(); 430 + plugin.setSymbolValue(symbolHeyApiClient, node); 431 + } 432 + 423 433 const symbol = plugin.registerSymbol({ 424 434 exported: true, 425 435 kind: 'class', ··· 431 441 }, 432 442 name: resourceId, 433 443 }); 434 - const node = tsc.classDeclaration({ 435 - decorator: 436 - currentClass.root && isAngularClient 437 - ? { 438 - args: [ 439 - { 440 - providedIn: 'root', 441 - }, 442 - ], 443 - name: plugin.referenceSymbol({ 444 - category: 'external', 445 - resource: '@angular/core.Injectable', 446 - }).placeholder, 447 - } 448 - : undefined, 449 - exportClass: symbol.exported, 450 - extendedClasses: plugin.config.instance 451 - ? [symbolHeyApiClient.placeholder] 452 - : undefined, 453 - name: symbol.placeholder, 454 - nodes: currentClass.nodes, 455 - }); 444 + 445 + if (currentClass.root && symbolHeyApiRegistry) { 446 + const symClient = plugin.getSymbol({ 447 + category: 'client', 448 + }); 449 + const isClientRequired = !plugin.config.client || !symClient; 450 + const symbolClient = plugin.referenceSymbol({ 451 + category: 'external', 452 + resource: 'client.Client', 453 + }); 454 + const ctor = $.init((i) => 455 + i 456 + .param('args', (p) => 457 + p 458 + .optional(!isClientRequired) 459 + .type() 460 + .object((o) => 461 + o 462 + .prop('client', (p) => 463 + p 464 + .optional(!isClientRequired) 465 + .type(symbolClient.placeholder), 466 + ) 467 + .prop('key', (p) => p.optional().type('string')), 468 + ), 469 + ) 470 + .do( 471 + $('super').call('args'), 472 + $(symbol.placeholder) 473 + .attr(registryName) 474 + .attr('set') 475 + .call('this', $('args').attr('key').optional(!isClientRequired)), 476 + ), 477 + ); 478 + 479 + if (!currentClass.nodes.length) { 480 + currentClass.nodes.unshift(ctor); 481 + } else { 482 + currentClass.nodes.unshift(ctor, $.newline()); 483 + } 484 + 485 + const node = createRegistryClass({ 486 + plugin, 487 + sdkName: symbol.placeholder, 488 + symbol: symbolHeyApiRegistry, 489 + }).$render(); 490 + plugin.setSymbolValue(symbolHeyApiRegistry, node); 491 + const registryNode = $.field(registryName, (f) => 492 + f 493 + .public() 494 + .static() 495 + .readonly() 496 + .assign( 497 + $.new(symbolHeyApiRegistry.placeholder).generic(symbol.placeholder), 498 + ), 499 + ); 500 + currentClass.nodes.unshift(registryNode, $.newline()); 501 + } 502 + 503 + const node = $.class(symbol.placeholder) 504 + .export(symbol.exported) 505 + .extends(symbolHeyApiClient?.placeholder) 506 + .$if(currentClass.root && isAngularClient, (c) => 507 + c.decorator( 508 + plugin.referenceSymbol({ 509 + category: 'external', 510 + resource: '@angular/core.Injectable', 511 + }).placeholder, 512 + (o) => o.prop('providedIn', () => $.literal('root')), 513 + ), 514 + ) 515 + .do(...currentClass.nodes) 516 + .$render(); 456 517 plugin.setSymbolValue(symbol, node); 457 518 }; 458 - 459 - if (clientClassNodes.length) { 460 - const node = tsc.classDeclaration({ 461 - exportClass: symbolHeyApiClient.exported, 462 - name: symbolHeyApiClient.placeholder, 463 - nodes: clientClassNodes, 464 - }); 465 - plugin.setSymbolValue(symbolHeyApiClient, node); 466 - } 467 519 468 520 for (const sdkClass of sdkClasses.values()) { 469 521 generateClass(sdkClass);
+1 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts
··· 690 690 operator: '??', 691 691 right: tsc.propertyAccessExpression({ 692 692 expression: tsc.this(), 693 - name: '_client', 693 + name: 'client', 694 694 }), 695 695 }); 696 696 } else if (symbolClient) {
+1 -1
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/typeOptions.ts
··· 72 72 'individual options. This might be also useful if you want to implement a', 73 73 'custom client.', 74 74 ], 75 - isRequired: !plugin.config.client, 75 + isRequired: !plugin.config.client && !plugin.config.instance, 76 76 name: 'client', 77 77 type: tsc.typeReferenceNode({ 78 78 typeName: symbolClient.placeholder,
+2 -108
packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts
··· 1 - import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; 2 - import { stringCase } from '~/utils/stringCase'; 3 - 4 - import { createMutationOptions } from './mutationOptions'; 5 - import { createQueryOptions } from './queryOptions'; 6 1 import type { PiniaColadaPlugin } from './types'; 7 - 8 - export const handler: PiniaColadaPlugin['Handler'] = ({ plugin }) => { 9 - plugin.registerSymbol({ 10 - external: plugin.name, 11 - meta: { 12 - category: 'external', 13 - resource: `${plugin.name}.defineQueryOptions`, 14 - }, 15 - name: 'defineQueryOptions', 16 - }); 17 - plugin.registerSymbol({ 18 - external: plugin.name, 19 - kind: 'type', 20 - meta: { 21 - category: 'external', 22 - resource: `${plugin.name}.UseMutationOptions`, 23 - }, 24 - name: 'UseMutationOptions', 25 - }); 26 - plugin.registerSymbol({ 27 - external: plugin.name, 28 - kind: 'type', 29 - meta: { 30 - category: 'external', 31 - resource: `${plugin.name}.UseQueryOptions`, 32 - }, 33 - name: 'UseQueryOptions', 34 - }); 35 - plugin.registerSymbol({ 36 - external: plugin.name, 37 - kind: 'type', 38 - meta: { 39 - category: 'external', 40 - resource: `${plugin.name}._JSONValue`, 41 - }, 42 - name: '_JSONValue', 43 - }); 44 - plugin.registerSymbol({ 45 - external: 'axios', 46 - kind: 'type', 47 - meta: { 48 - category: 'external', 49 - resource: 'axios.AxiosError', 50 - }, 51 - name: 'AxiosError', 52 - }); 53 - 54 - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); 55 - 56 - plugin.forEach( 57 - 'operation', 58 - ({ operation }) => { 59 - const classes = sdkPlugin.config.asClass 60 - ? operationClasses({ 61 - context: plugin.context, 62 - operation, 63 - plugin: sdkPlugin, 64 - }) 65 - : undefined; 66 - const entry = classes ? classes.values().next().value : undefined; 67 - const queryFn = 68 - // TODO: this should use class graph to determine correct path string 69 - // as it's really easy to break once we change the class casing 70 - entry 71 - ? [ 72 - plugin.referenceSymbol({ 73 - category: 'utility', 74 - resource: 'class', 75 - resourceId: entry.path[0], 76 - tool: 'sdk', 77 - }).placeholder, 78 - ...entry.path.slice(1).map((className: string) => 79 - stringCase({ 80 - case: 'camelCase', 81 - value: className, 82 - }), 83 - ), 84 - entry.methodName, 85 - ] 86 - .filter(Boolean) 87 - .join('.') 88 - : plugin.referenceSymbol({ 89 - category: 'sdk', 90 - resource: 'operation', 91 - resourceId: operation.id, 92 - }).placeholder; 2 + import { handlerV0 } from './v0/plugin'; 93 3 94 - if (plugin.hooks.operation.isQuery(operation)) { 95 - if (plugin.config.queryOptions.enabled) { 96 - createQueryOptions({ operation, plugin, queryFn }); 97 - } 98 - } 99 - 100 - if (plugin.hooks.operation.isMutation(operation)) { 101 - if (plugin.config.mutationOptions.enabled) { 102 - createMutationOptions({ operation, plugin, queryFn }); 103 - } 104 - } 105 - }, 106 - { 107 - order: 'declarations', 108 - }, 109 - ); 110 - }; 4 + export const handler: PiniaColadaPlugin['Handler'] = (args) => handlerV0(args);
+110
packages/openapi-ts/src/plugins/@pinia/colada/v0/plugin.ts
··· 1 + import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; 2 + import { stringCase } from '~/utils/stringCase'; 3 + 4 + import { createMutationOptions } from '../mutationOptions'; 5 + import { createQueryOptions } from '../queryOptions'; 6 + import type { PiniaColadaPlugin } from '../types'; 7 + 8 + export const handlerV0: PiniaColadaPlugin['Handler'] = ({ plugin }) => { 9 + plugin.registerSymbol({ 10 + external: plugin.name, 11 + meta: { 12 + category: 'external', 13 + resource: `${plugin.name}.defineQueryOptions`, 14 + }, 15 + name: 'defineQueryOptions', 16 + }); 17 + plugin.registerSymbol({ 18 + external: plugin.name, 19 + kind: 'type', 20 + meta: { 21 + category: 'external', 22 + resource: `${plugin.name}.UseMutationOptions`, 23 + }, 24 + name: 'UseMutationOptions', 25 + }); 26 + plugin.registerSymbol({ 27 + external: plugin.name, 28 + kind: 'type', 29 + meta: { 30 + category: 'external', 31 + resource: `${plugin.name}.UseQueryOptions`, 32 + }, 33 + name: 'UseQueryOptions', 34 + }); 35 + plugin.registerSymbol({ 36 + external: plugin.name, 37 + kind: 'type', 38 + meta: { 39 + category: 'external', 40 + resource: `${plugin.name}._JSONValue`, 41 + }, 42 + name: '_JSONValue', 43 + }); 44 + plugin.registerSymbol({ 45 + external: 'axios', 46 + kind: 'type', 47 + meta: { 48 + category: 'external', 49 + resource: 'axios.AxiosError', 50 + }, 51 + name: 'AxiosError', 52 + }); 53 + 54 + const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); 55 + 56 + plugin.forEach( 57 + 'operation', 58 + ({ operation }) => { 59 + const classes = sdkPlugin.config.asClass 60 + ? operationClasses({ 61 + context: plugin.context, 62 + operation, 63 + plugin: sdkPlugin, 64 + }) 65 + : undefined; 66 + const entry = classes ? classes.values().next().value : undefined; 67 + const queryFn = 68 + // TODO: this should use class graph to determine correct path string 69 + // as it's really easy to break once we change the class casing 70 + entry 71 + ? [ 72 + plugin.referenceSymbol({ 73 + category: 'utility', 74 + resource: 'class', 75 + resourceId: entry.path[0], 76 + tool: 'sdk', 77 + }).placeholder, 78 + ...entry.path.slice(1).map((className: string) => 79 + stringCase({ 80 + case: 'camelCase', 81 + value: className, 82 + }), 83 + ), 84 + entry.methodName, 85 + ] 86 + .filter(Boolean) 87 + .join('.') 88 + : plugin.referenceSymbol({ 89 + category: 'sdk', 90 + resource: 'operation', 91 + resourceId: operation.id, 92 + }).placeholder; 93 + 94 + if (plugin.hooks.operation.isQuery(operation)) { 95 + if (plugin.config.queryOptions.enabled) { 96 + createQueryOptions({ operation, plugin, queryFn }); 97 + } 98 + } 99 + 100 + if (plugin.hooks.operation.isMutation(operation)) { 101 + if (plugin.config.mutationOptions.enabled) { 102 + createMutationOptions({ operation, plugin, queryFn }); 103 + } 104 + } 105 + }, 106 + { 107 + order: 'declarations', 108 + }, 109 + ); 110 + };
+2 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts
··· 10 10 import { tsc } from '~/tsc'; 11 11 import { tsNodeToString } from '~/tsc/utils'; 12 12 13 - import { handleMeta } from './meta'; 14 13 import { 15 14 createQueryKeyFunction, 16 15 createQueryKeyType, 17 16 queryKeyStatement, 18 17 } from './queryKey'; 18 + import { handleMeta } from './shared/meta'; 19 + import { useTypeData, useTypeError, useTypeResponse } from './shared/useType'; 19 20 import type { PluginInstance } from './types'; 20 - import { useTypeData, useTypeError, useTypeResponse } from './useType'; 21 21 22 22 const createInfiniteParamsFunction = ({ 23 23 plugin,
+1 -1
packages/openapi-ts/src/plugins/@tanstack/query-core/meta.ts packages/openapi-ts/src/plugins/@tanstack/query-core/shared/meta.ts
··· 3 3 import type { IR } from '~/ir/types'; 4 4 import { tsc } from '~/tsc'; 5 5 6 - import type { PluginInstance } from './types'; 6 + import type { PluginInstance } from '../types'; 7 7 8 8 export const handleMeta = ( 9 9 plugin: PluginInstance,
+2 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts
··· 5 5 import { createOperationComment } from '~/plugins/shared/utils/operation'; 6 6 import { tsc } from '~/tsc'; 7 7 8 - import { handleMeta } from './meta'; 8 + import { handleMeta } from './shared/meta'; 9 + import { useTypeData, useTypeError, useTypeResponse } from './shared/useType'; 9 10 import type { PluginInstance } from './types'; 10 - import { useTypeData, useTypeError, useTypeResponse } from './useType'; 11 11 12 12 export const createMutationOptions = ({ 13 13 operation,
+3 -140
packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts
··· 1 - import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; 2 - import { stringCase } from '~/utils/stringCase'; 3 - 4 - import { createInfiniteQueryOptions } from './infiniteQueryOptions'; 5 - import { createMutationOptions } from './mutationOptions'; 6 - import { createQueryOptions } from './queryOptions'; 7 1 import type { PluginHandler } from './types'; 8 - import { createUseQuery } from './useQuery'; 2 + import { handlerV5 } from './v5/plugin'; 9 3 10 - export const handler: PluginHandler = ({ plugin }) => { 11 - plugin.registerSymbol({ 12 - external: plugin.name, 13 - kind: 'type', 14 - meta: { 15 - category: 'external', 16 - resource: `${plugin.name}.DefaultError`, 17 - }, 18 - name: 'DefaultError', 19 - }); 20 - plugin.registerSymbol({ 21 - external: plugin.name, 22 - kind: 'type', 23 - meta: { 24 - category: 'external', 25 - resource: `${plugin.name}.InfiniteData`, 26 - }, 27 - name: 'InfiniteData', 28 - }); 29 - const mutationsType = 30 - plugin.name === '@tanstack/angular-query-experimental' || 31 - plugin.name === '@tanstack/svelte-query' || 32 - plugin.name === '@tanstack/solid-query' 33 - ? 'MutationOptions' 34 - : 'UseMutationOptions'; 35 - plugin.registerSymbol({ 36 - external: plugin.name, 37 - kind: 'type', 38 - meta: { 39 - category: 'external', 40 - resource: `${plugin.name}.MutationOptions`, 41 - }, 42 - name: mutationsType, 43 - }); 44 - plugin.registerSymbol({ 45 - external: plugin.name, 46 - meta: { 47 - category: 'external', 48 - resource: `${plugin.name}.infiniteQueryOptions`, 49 - }, 50 - name: 'infiniteQueryOptions', 51 - }); 52 - plugin.registerSymbol({ 53 - external: plugin.name, 54 - meta: { 55 - category: 'external', 56 - resource: `${plugin.name}.queryOptions`, 57 - }, 58 - name: 'queryOptions', 59 - }); 60 - plugin.registerSymbol({ 61 - external: plugin.name, 62 - meta: { 63 - category: 'external', 64 - resource: `${plugin.name}.useQuery`, 65 - }, 66 - name: 'useQuery', 67 - }); 68 - plugin.registerSymbol({ 69 - external: 'axios', 70 - kind: 'type', 71 - meta: { 72 - category: 'external', 73 - resource: 'axios.AxiosError', 74 - }, 75 - name: 'AxiosError', 76 - }); 77 - 78 - const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); 79 - 80 - plugin.forEach( 81 - 'operation', 82 - ({ operation }) => { 83 - const classes = sdkPlugin.config.asClass 84 - ? operationClasses({ 85 - context: plugin.context, 86 - operation, 87 - plugin: sdkPlugin, 88 - }) 89 - : undefined; 90 - const entry = classes ? classes.values().next().value : undefined; 91 - const queryFn = 92 - // TODO: this should use class graph to determine correct path string 93 - // as it's really easy to break once we change the class casing 94 - entry 95 - ? [ 96 - plugin.referenceSymbol({ 97 - category: 'utility', 98 - resource: 'class', 99 - resourceId: entry.path[0], 100 - tool: 'sdk', 101 - }).placeholder, 102 - ...entry.path.slice(1).map((className) => 103 - stringCase({ 104 - case: 'camelCase', 105 - value: className, 106 - }), 107 - ), 108 - entry.methodName, 109 - ] 110 - .filter(Boolean) 111 - .join('.') 112 - : plugin.referenceSymbol({ 113 - category: 'sdk', 114 - resource: 'operation', 115 - resourceId: operation.id, 116 - }).placeholder; 117 - 118 - if (plugin.hooks.operation.isQuery(operation)) { 119 - if (plugin.config.queryOptions.enabled) { 120 - createQueryOptions({ operation, plugin, queryFn }); 121 - } 122 - 123 - if (plugin.config.infiniteQueryOptions.enabled) { 124 - createInfiniteQueryOptions({ operation, plugin, queryFn }); 125 - } 126 - 127 - if ('useQuery' in plugin.config && plugin.config.useQuery.enabled) { 128 - createUseQuery({ operation, plugin }); 129 - } 130 - } 131 - 132 - if (plugin.hooks.operation.isMutation(operation)) { 133 - if (plugin.config.mutationOptions.enabled) { 134 - createMutationOptions({ operation, plugin, queryFn }); 135 - } 136 - } 137 - }, 138 - { 139 - order: 'declarations', 140 - }, 141 - ); 142 - }; 4 + export const handler: PluginHandler = (args) => 5 + handlerV5(args as Parameters<PluginHandler>[0]);
+1 -1
packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts
··· 7 7 import { getClientBaseUrlKey } from '~/plugins/@hey-api/client-core/utils'; 8 8 import { type Property, tsc } from '~/tsc'; 9 9 10 + import { useTypeData } from './shared/useType'; 10 11 import type { PluginInstance } from './types'; 11 - import { useTypeData } from './useType'; 12 12 13 13 const TOptionsType = 'TOptions'; 14 14
+4 -4
packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts packages/openapi-ts/src/plugins/@tanstack/query-core/v5/queryOptions.ts
··· 9 9 } from '~/plugins/shared/utils/operation'; 10 10 import { tsc } from '~/tsc'; 11 11 12 - import { handleMeta } from './meta'; 13 12 import { 14 13 createQueryKeyFunction, 15 14 createQueryKeyType, 16 15 queryKeyStatement, 17 - } from './queryKey'; 18 - import type { PluginInstance } from './types'; 19 - import { useTypeData } from './useType'; 16 + } from '../queryKey'; 17 + import { handleMeta } from '../shared/meta'; 18 + import { useTypeData } from '../shared/useType'; 19 + import type { PluginInstance } from '../types'; 20 20 21 21 const optionsParamName = 'options'; 22 22
+2 -2
packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts packages/openapi-ts/src/plugins/@tanstack/query-core/v5/useQuery.ts
··· 7 7 } from '~/plugins/shared/utils/operation'; 8 8 import { tsc } from '~/tsc'; 9 9 10 - import type { PluginInstance } from './types'; 11 - import { useTypeData } from './useType'; 10 + import { useTypeData } from '../shared/useType'; 11 + import type { PluginInstance } from '../types'; 12 12 13 13 const optionsParamName = 'options'; 14 14
+1 -1
packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts packages/openapi-ts/src/plugins/@tanstack/query-core/shared/useType.ts
··· 2 2 import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; 3 3 import { operationOptionsType } from '~/plugins/@hey-api/sdk/shared/operation'; 4 4 5 - import type { PluginInstance } from './types'; 5 + import type { PluginInstance } from '../types'; 6 6 7 7 export const useTypeData = ({ 8 8 operation,
+147
packages/openapi-ts/src/plugins/@tanstack/query-core/v5/plugin.ts
··· 1 + import { registryName } from '~/plugins/@hey-api/sdk/shared/class'; 2 + import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; 3 + import { stringCase } from '~/utils/stringCase'; 4 + 5 + import { createInfiniteQueryOptions } from '../infiniteQueryOptions'; 6 + import { createMutationOptions } from '../mutationOptions'; 7 + import type { PluginHandler } from '../types'; 8 + import { createQueryOptions } from './queryOptions'; 9 + import { createUseQuery } from './useQuery'; 10 + 11 + export const handlerV5: PluginHandler = ({ plugin }) => { 12 + plugin.registerSymbol({ 13 + external: plugin.name, 14 + kind: 'type', 15 + meta: { 16 + category: 'external', 17 + resource: `${plugin.name}.DefaultError`, 18 + }, 19 + name: 'DefaultError', 20 + }); 21 + plugin.registerSymbol({ 22 + external: plugin.name, 23 + kind: 'type', 24 + meta: { 25 + category: 'external', 26 + resource: `${plugin.name}.InfiniteData`, 27 + }, 28 + name: 'InfiniteData', 29 + }); 30 + const mutationsType = 31 + plugin.name === '@tanstack/angular-query-experimental' || 32 + plugin.name === '@tanstack/svelte-query' || 33 + plugin.name === '@tanstack/solid-query' 34 + ? 'MutationOptions' 35 + : 'UseMutationOptions'; 36 + plugin.registerSymbol({ 37 + external: plugin.name, 38 + kind: 'type', 39 + meta: { 40 + category: 'external', 41 + resource: `${plugin.name}.MutationOptions`, 42 + }, 43 + name: mutationsType, 44 + }); 45 + plugin.registerSymbol({ 46 + external: plugin.name, 47 + meta: { 48 + category: 'external', 49 + resource: `${plugin.name}.infiniteQueryOptions`, 50 + }, 51 + name: 'infiniteQueryOptions', 52 + }); 53 + plugin.registerSymbol({ 54 + external: plugin.name, 55 + meta: { 56 + category: 'external', 57 + resource: `${plugin.name}.queryOptions`, 58 + }, 59 + name: 'queryOptions', 60 + }); 61 + plugin.registerSymbol({ 62 + external: plugin.name, 63 + meta: { 64 + category: 'external', 65 + resource: `${plugin.name}.useQuery`, 66 + }, 67 + name: 'useQuery', 68 + }); 69 + plugin.registerSymbol({ 70 + external: 'axios', 71 + kind: 'type', 72 + meta: { 73 + category: 'external', 74 + resource: 'axios.AxiosError', 75 + }, 76 + name: 'AxiosError', 77 + }); 78 + 79 + const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); 80 + 81 + plugin.forEach( 82 + 'operation', 83 + ({ operation }) => { 84 + const classes = sdkPlugin.config.asClass 85 + ? operationClasses({ 86 + context: plugin.context, 87 + operation, 88 + plugin: sdkPlugin, 89 + }) 90 + : undefined; 91 + const entry = classes ? classes.values().next().value : undefined; 92 + // TODO: this should use class graph to determine correct path string 93 + // as it's really easy to break once we change the class casing 94 + let queryFn: string; 95 + if (entry) { 96 + const symbolClass = plugin.referenceSymbol({ 97 + category: 'utility', 98 + resource: 'class', 99 + resourceId: entry.path[0], 100 + tool: 'sdk', 101 + }); 102 + queryFn = [ 103 + symbolClass.placeholder, 104 + ...(sdkPlugin.config.instance ? [registryName, 'get()'] : []), 105 + ...entry.path.slice(1).map((className) => 106 + stringCase({ 107 + case: 'camelCase', 108 + value: className, 109 + }), 110 + ), 111 + entry.methodName, 112 + ] 113 + .filter(Boolean) 114 + .join('.'); 115 + } else { 116 + queryFn = plugin.referenceSymbol({ 117 + category: 'sdk', 118 + resource: 'operation', 119 + resourceId: operation.id, 120 + }).placeholder; 121 + } 122 + 123 + if (plugin.hooks.operation.isQuery(operation)) { 124 + if (plugin.config.queryOptions.enabled) { 125 + createQueryOptions({ operation, plugin, queryFn }); 126 + } 127 + 128 + if (plugin.config.infiniteQueryOptions.enabled) { 129 + createInfiniteQueryOptions({ operation, plugin, queryFn }); 130 + } 131 + 132 + if ('useQuery' in plugin.config && plugin.config.useQuery.enabled) { 133 + createUseQuery({ operation, plugin }); 134 + } 135 + } 136 + 137 + if (plugin.hooks.operation.isMutation(operation)) { 138 + if (plugin.config.mutationOptions.enabled) { 139 + createMutationOptions({ operation, plugin, queryFn }); 140 + } 141 + } 142 + }, 143 + { 144 + order: 'declarations', 145 + }, 146 + ); 147 + };
+6 -6
packages/openapi-ts/src/plugins/swr/config.ts
··· 86 86 value: plugin.config.queryOptions, 87 87 }); 88 88 89 - plugin.config.useQuery = context.valueToObject({ 89 + plugin.config.useSwr = context.valueToObject({ 90 90 defaultValue: { 91 91 case: plugin.config.case ?? 'camelCase', 92 - enabled: false, 93 - name: 'use{{name}}Query', 92 + enabled: true, 93 + name: 'use{{name}}', 94 94 }, 95 95 mappers: { 96 96 boolean: (enabled) => ({ enabled }), ··· 98 98 object: (fields) => ({ enabled: true, ...fields }), 99 99 string: (name) => ({ enabled: true, name }), 100 100 }, 101 - value: plugin.config.useQuery, 101 + value: plugin.config.useSwr, 102 102 }); 103 103 104 - if (plugin.config.useQuery.enabled) { 105 - // useQuery hooks consume queryOptions 104 + if (plugin.config.useSwr.enabled) { 105 + // useSwr hooks consume queryOptions 106 106 if (!plugin.config.queryOptions.enabled) { 107 107 plugin.config.queryOptions.enabled = true; 108 108 plugin.config.queryOptions.exported = false;
+2 -3
packages/openapi-ts/src/plugins/swr/plugin.ts
··· 1 1 import type { SwrPlugin } from './types'; 2 + import { handlerV2 } from './v2/plugin'; 2 3 3 - export const handler: SwrPlugin['Handler'] = ({ plugin }) => { 4 - console.log(plugin.name); 5 - }; 4 + export const handler: SwrPlugin['Handler'] = (args) => handlerV2(args);
+17 -17
packages/openapi-ts/src/plugins/swr/types.d.ts
··· 11 11 */ 12 12 case?: StringCase; 13 13 /** 14 - * Add comments from SDK functions to the generated TanStack Query code? 14 + * Add comments from SDK functions to the generated SWR code? 15 15 * 16 16 * Duplicating comments this way is useful so you don't need to drill into 17 17 * the underlying SDK function to learn what it does or whether it's ··· 308 308 name?: StringName; 309 309 }; 310 310 /** 311 - * Configuration for generated `useQuery()` function helpers. 311 + * Configuration for generated `useSwr()` function helpers. 312 312 * 313 - * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useQuery useQuery} 313 + * See {@link https://swr.vercel.app/docs/api API} 314 314 * 315 315 * Can be: 316 316 * - `boolean`: Shorthand for `{ enabled: boolean }` 317 317 * - `string` or `function`: Shorthand for `{ name: string | function }` 318 318 * - `object`: Full configuration object 319 319 * 320 - * @default false 320 + * @default true 321 321 */ 322 - useQuery?: 322 + useSwr?: 323 323 | boolean 324 324 | StringName 325 325 | { ··· 330 330 */ 331 331 case?: StringCase; 332 332 /** 333 - * Whether to generate `useQuery()` function helpers. 333 + * Whether to generate `useSwr()` function helpers. 334 334 * 335 335 * @default true 336 336 */ 337 337 enabled?: boolean; 338 338 /** 339 - * Custom naming pattern for generated `useQuery()` function names. The name variable is 339 + * Custom naming pattern for generated `useSwr()` function names. The name variable is 340 340 * obtained from the SDK function name. 341 341 * 342 - * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useQuery useQuery} 342 + * See {@link https://swr.vercel.app/docs/api API} 343 343 * 344 - * @default 'use{{name}}Query' 344 + * @default 'use{{name}}' 345 345 */ 346 346 name?: StringName; 347 347 }; ··· 356 356 */ 357 357 case: StringCase; 358 358 /** 359 - * Add comments from SDK functions to the generated TanStack Query code? 359 + * Add comments from SDK functions to the generated SWR code? 360 360 * 361 361 * @default true 362 362 */ ··· 592 592 name: StringName; 593 593 }; 594 594 /** 595 - * Configuration for generated `useQuery()` function helpers. 595 + * Configuration for generated `useSwr()` function helpers. 596 596 * 597 - * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useQuery useQuery} 597 + * See {@link https://swr.vercel.app/docs/api API} 598 598 */ 599 - useQuery: { 599 + useSwr: { 600 600 /** 601 601 * The casing convention to use for generated names. 602 602 * ··· 604 604 */ 605 605 case: StringCase; 606 606 /** 607 - * Whether to generate `useQuery()` function helpers. 607 + * Whether to generate `useSwr()` function helpers. 608 608 * 609 609 * @default true 610 610 */ 611 611 enabled: boolean; 612 612 /** 613 - * Custom naming pattern for generated `useQuery()` function names. The name variable is 613 + * Custom naming pattern for generated `useSwr()` function names. The name variable is 614 614 * obtained from the SDK function name. 615 615 * 616 - * See {@link https://tanstack.com/query/v5/docs/framework/react/reference/useQuery useQuery} 616 + * See {@link https://swr.vercel.app/docs/api API} 617 617 * 618 - * @default 'use{{name}}Query' 618 + * @default 'use{{name}}' 619 619 */ 620 620 name: StringName; 621 621 };
+77
packages/openapi-ts/src/plugins/swr/v2/plugin.ts
··· 1 + import { operationClasses } from '~/plugins/@hey-api/sdk/shared/operation'; 2 + import { stringCase } from '~/utils/stringCase'; 3 + 4 + import type { SwrPlugin } from '../types'; 5 + import { createUseSwr } from './useSwr'; 6 + 7 + export const handlerV2: SwrPlugin['Handler'] = ({ plugin }) => { 8 + plugin.registerSymbol({ 9 + external: 'swr', 10 + importKind: 'default', 11 + kind: 'function', 12 + meta: { 13 + category: 'external', 14 + resource: 'swr', 15 + }, 16 + name: 'useSWR', 17 + }); 18 + 19 + const sdkPlugin = plugin.getPluginOrThrow('@hey-api/sdk'); 20 + 21 + plugin.forEach( 22 + 'operation', 23 + ({ operation }) => { 24 + const classes = sdkPlugin.config.asClass 25 + ? operationClasses({ 26 + context: plugin.context, 27 + operation, 28 + plugin: sdkPlugin, 29 + }) 30 + : undefined; 31 + const entry = classes ? classes.values().next().value : undefined; 32 + const queryFn = 33 + // TODO: this should use class graph to determine correct path string 34 + // as it's really easy to break once we change the class casing 35 + entry 36 + ? [ 37 + plugin.referenceSymbol({ 38 + category: 'utility', 39 + resource: 'class', 40 + resourceId: entry.path[0], 41 + tool: 'sdk', 42 + }).placeholder, 43 + ...entry.path.slice(1).map((className) => 44 + stringCase({ 45 + case: 'camelCase', 46 + value: className, 47 + }), 48 + ), 49 + entry.methodName, 50 + ] 51 + .filter(Boolean) 52 + .join('.') 53 + : plugin.referenceSymbol({ 54 + category: 'sdk', 55 + resource: 'operation', 56 + resourceId: operation.id, 57 + }).placeholder; 58 + 59 + if (plugin.hooks.operation.isQuery(operation)) { 60 + // if (plugin.config.queryOptions.enabled) { 61 + // createQueryOptions({ operation, plugin, queryFn }); 62 + // } 63 + 64 + // if (plugin.config.infiniteQueryOptions.enabled) { 65 + // createInfiniteQueryOptions({ operation, plugin, queryFn }); 66 + // } 67 + 68 + if (plugin.config.useSwr.enabled) { 69 + createUseSwr({ operation, plugin, queryFn }); 70 + } 71 + } 72 + }, 73 + { 74 + order: 'declarations', 75 + }, 76 + ); 77 + };
+120
packages/openapi-ts/src/plugins/swr/v2/useSwr.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { IR } from '~/ir/types'; 4 + import { buildName } from '~/openApi/shared/utils/name'; 5 + import { 6 + createOperationComment, 7 + hasOperationSse, 8 + } from '~/plugins/shared/utils/operation'; 9 + import { tsc } from '~/tsc'; 10 + 11 + import type { SwrPlugin } from '../types'; 12 + 13 + export const createUseSwr = ({ 14 + operation, 15 + plugin, 16 + queryFn, 17 + }: { 18 + operation: IR.OperationObject; 19 + plugin: SwrPlugin['Instance']; 20 + queryFn: string; 21 + }): void => { 22 + if (hasOperationSse({ operation })) { 23 + return; 24 + } 25 + 26 + const symbolUseSwr = plugin.referenceSymbol({ 27 + category: 'external', 28 + resource: 'swr', 29 + }); 30 + const symbolUseQueryFn = plugin.registerSymbol({ 31 + exported: true, 32 + name: buildName({ 33 + config: plugin.config.useSwr, 34 + name: operation.id, 35 + }), 36 + }); 37 + 38 + const awaitSdkExpression = tsc.awaitExpression({ 39 + expression: tsc.callExpression({ 40 + functionName: queryFn, 41 + parameters: [ 42 + tsc.objectExpression({ 43 + multiLine: true, 44 + obj: [ 45 + // { 46 + // spread: optionsParamName, 47 + // }, 48 + // { 49 + // spread: 'queryKey[0]', 50 + // }, 51 + // { 52 + // key: 'signal', 53 + // shorthand: true, 54 + // value: tsc.identifier({ 55 + // text: 'signal', 56 + // }), 57 + // }, 58 + { 59 + key: 'throwOnError', 60 + value: true, 61 + }, 62 + ], 63 + }), 64 + ], 65 + }), 66 + }); 67 + const statements: Array<ts.Statement> = []; 68 + if (plugin.getPluginOrThrow('@hey-api/sdk').config.responseStyle === 'data') { 69 + statements.push( 70 + tsc.returnVariable({ 71 + expression: awaitSdkExpression, 72 + }), 73 + ); 74 + } else { 75 + statements.push( 76 + tsc.constVariable({ 77 + destructure: true, 78 + expression: awaitSdkExpression, 79 + name: 'data', 80 + }), 81 + tsc.returnVariable({ 82 + expression: 'data', 83 + }), 84 + ); 85 + } 86 + 87 + const statement = tsc.constVariable({ 88 + comment: plugin.config.comments 89 + ? createOperationComment({ operation }) 90 + : undefined, 91 + exportConst: symbolUseQueryFn.exported, 92 + expression: tsc.arrowFunction({ 93 + parameters: [ 94 + // { 95 + // isRequired: isRequiredOptions, 96 + // name: optionsParamName, 97 + // type: typeData, 98 + // }, 99 + ], 100 + statements: [ 101 + tsc.returnStatement({ 102 + expression: tsc.callExpression({ 103 + functionName: symbolUseSwr.placeholder, 104 + parameters: [ 105 + tsc.stringLiteral({ 106 + text: operation.path, 107 + }), 108 + tsc.arrowFunction({ 109 + async: true, 110 + statements, 111 + }), 112 + ], 113 + }), 114 + }), 115 + ], 116 + }), 117 + name: symbolUseQueryFn.placeholder, 118 + }); 119 + plugin.setSymbolValue(symbolUseQueryFn, statement); 120 + };
+43
packages/openapi-ts/src/ts-dsl/attr.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { ExprInput, MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { AccessMixin } from './mixins/access'; 7 + import { mixin } from './mixins/apply'; 8 + import { AssignmentMixin } from './mixins/assignment'; 9 + import { OperatorMixin } from './mixins/operator'; 10 + import { OptionalMixin } from './mixins/optional'; 11 + 12 + export class AttrTsDsl extends TsDsl<ts.PropertyAccessExpression> { 13 + private left: MaybeTsDsl<ExprInput>; 14 + private right: string; 15 + 16 + constructor(left: MaybeTsDsl<ExprInput>, right: string) { 17 + super(); 18 + this.left = left; 19 + this.right = right; 20 + } 21 + 22 + $render(): ts.PropertyAccessExpression { 23 + const leftNode = this.$node(this.left); 24 + if (this.isOptional) { 25 + return ts.factory.createPropertyAccessChain( 26 + leftNode, 27 + ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), 28 + ts.factory.createIdentifier(this.right), 29 + ); 30 + } 31 + return ts.factory.createPropertyAccessExpression( 32 + leftNode, 33 + ts.factory.createIdentifier(this.right), 34 + ); 35 + } 36 + } 37 + 38 + export interface AttrTsDsl 39 + extends AccessMixin, 40 + AssignmentMixin, 41 + OperatorMixin, 42 + OptionalMixin {} 43 + mixin(AttrTsDsl, AccessMixin, AssignmentMixin, OperatorMixin, OptionalMixin);
+133
packages/openapi-ts/src/ts-dsl/base.ts
··· 1 + import ts from 'typescript'; 2 + 3 + export type ExprInput<T = ts.Expression> = T | string; 4 + 5 + export type TypeInput = string | boolean | MaybeTsDsl<ts.TypeNode>; 6 + 7 + export interface ITsDsl<T extends ts.Node = ts.Node> { 8 + $render(): T; 9 + } 10 + 11 + export abstract class TsDsl<T extends ts.Node = ts.Node> implements ITsDsl<T> { 12 + abstract $render(): T; 13 + 14 + protected $expr<T>(expr: ExprInput<T>): T { 15 + return typeof expr === 'string' 16 + ? (ts.factory.createIdentifier(expr) as T) 17 + : expr; 18 + } 19 + 20 + /** Conditionally applies a callback to this builder. */ 21 + $if<T extends TsDsl, V, R extends TsDsl = T>( 22 + this: T, 23 + value: V, 24 + ifTrue: (self: T, v: Exclude<V, false | null | undefined>) => R | void, 25 + ifFalse?: (self: T, v: Extract<V, false | null | undefined>) => R | void, 26 + ): R | T { 27 + if (value) { 28 + const result = ifTrue( 29 + this, 30 + value as Exclude<V, false | null | undefined>, 31 + ); 32 + return result ?? this; 33 + } 34 + if (ifFalse) { 35 + const result = ifFalse( 36 + this, 37 + value as Extract<V, false | null | undefined>, 38 + ); 39 + return result ?? this; 40 + } 41 + return this; 42 + } 43 + 44 + protected $node<I>(input: I): NodeOfMaybe<I> { 45 + if (input === undefined) { 46 + return undefined as NodeOfMaybe<I>; 47 + } 48 + if (typeof input === 'string') { 49 + return this.$expr(input) as NodeOfMaybe<I>; 50 + } 51 + if (input instanceof Array) { 52 + return input.map((item) => this._render(item)) as NodeOfMaybe<I>; 53 + } 54 + return this._render(input as any) as NodeOfMaybe<I>; 55 + } 56 + 57 + protected $stmt( 58 + input: 59 + | MaybeTsDsl<ExprInput<ts.Statement | ts.Expression>> 60 + | ReadonlyArray<MaybeTsDsl<ExprInput<ts.Statement | ts.Expression>>>, 61 + ): ReadonlyArray<ts.Statement> { 62 + const arr = input instanceof Array ? input : [input]; 63 + return arr.map((item) => { 64 + const node = 65 + typeof item === 'string' 66 + ? ts.factory.createIdentifier(item) 67 + : this._render(item as any); 68 + return ts.isExpression(node) 69 + ? ts.factory.createExpressionStatement(node) 70 + : (node as ts.Statement); 71 + }); 72 + } 73 + 74 + protected $type<I>(type: I): TypeOfMaybe<I> { 75 + if (type === undefined) { 76 + return undefined as TypeOfMaybe<I>; 77 + } 78 + if (typeof type === 'string') { 79 + return ts.factory.createTypeReferenceNode( 80 + type, 81 + ) as unknown as TypeOfMaybe<I>; 82 + } 83 + if (typeof type === 'boolean') { 84 + const literal = type ? ts.factory.createTrue() : ts.factory.createFalse(); 85 + return ts.factory.createLiteralTypeNode(literal) as TypeOfMaybe<I>; 86 + } 87 + return this._render(type as any) as TypeOfMaybe<I>; 88 + } 89 + 90 + private _render<T extends ts.Node>(value: MaybeTsDsl<T>): T { 91 + return (value instanceof TsDsl ? value.$render() : value) as T; 92 + } 93 + } 94 + 95 + type NodeOfMaybe<I> = undefined extends I 96 + ? NodeOf<NonNullable<I>> | undefined 97 + : NodeOf<I>; 98 + 99 + type NodeOf<I> = 100 + I extends ReadonlyArray<infer U> 101 + ? ReadonlyArray<U extends TsDsl<infer N> ? N : U> 102 + : I extends string 103 + ? ts.Expression 104 + : I extends TsDsl<infer N> 105 + ? N 106 + : I extends ts.Node 107 + ? I 108 + : never; 109 + 110 + type TypeOfMaybe<I> = undefined extends I 111 + ? TypeOf<NonNullable<I>> | undefined 112 + : TypeOf<I>; 113 + 114 + type TypeOf<I> = I extends string 115 + ? ts.TypeNode 116 + : I extends boolean 117 + ? ts.LiteralTypeNode 118 + : I extends TsDsl<infer N> 119 + ? N 120 + : I extends ts.TypeNode 121 + ? I 122 + : never; 123 + 124 + export type MaybeTsDsl<T> = 125 + // if T includes string in the union 126 + string extends T 127 + ? Exclude<T, string> extends ts.Node 128 + ? string | Exclude<T, string> | TsDsl<Exclude<T, string>> 129 + : string 130 + : // otherwise only node or DSL 131 + T extends ts.Node 132 + ? T | TsDsl<T> 133 + : never;
+81
packages/openapi-ts/src/ts-dsl/binary.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + type Operator = 7 + | '!=' 8 + | '!==' 9 + | '&&' 10 + | '*' 11 + | '+' 12 + | '-' 13 + | '/' 14 + | '<' 15 + | '<=' 16 + | '=' 17 + | '==' 18 + | '===' 19 + | '>' 20 + | '>=' 21 + | '??' 22 + | '||'; 23 + 24 + export class BinaryTsDsl extends TsDsl<ts.BinaryExpression> { 25 + private left: MaybeTsDsl<ExprInput>; 26 + private operator: Operator | ts.BinaryOperator; 27 + private right: MaybeTsDsl<ExprInput>; 28 + 29 + constructor( 30 + left: MaybeTsDsl<ExprInput>, 31 + operator: Operator | ts.BinaryOperator, 32 + right: MaybeTsDsl<ExprInput>, 33 + ) { 34 + super(); 35 + this.left = left; 36 + this.operator = operator; 37 + this.right = right; 38 + } 39 + 40 + $render(): ts.BinaryExpression { 41 + const leftNode = this.$node(this.left); 42 + const rightNode = this.$node(this.right); 43 + const operatorToken = 44 + typeof this.operator === 'string' 45 + ? this.mapOperator(this.operator) 46 + : this.operator; 47 + return ts.factory.createBinaryExpression( 48 + leftNode, 49 + operatorToken, 50 + rightNode, 51 + ); 52 + } 53 + 54 + private mapOperator( 55 + operator: Operator, 56 + ): ts.BinaryOperator | ts.BinaryOperatorToken { 57 + const tokenMap: Record<Operator, ts.BinaryOperator> = { 58 + '!=': ts.SyntaxKind.ExclamationEqualsToken, 59 + '!==': ts.SyntaxKind.ExclamationEqualsEqualsToken, 60 + '&&': ts.SyntaxKind.AmpersandAmpersandToken, 61 + '*': ts.SyntaxKind.AsteriskToken, 62 + '+': ts.SyntaxKind.PlusToken, 63 + '-': ts.SyntaxKind.MinusToken, 64 + '/': ts.SyntaxKind.SlashToken, 65 + '<': ts.SyntaxKind.LessThanToken, 66 + '<=': ts.SyntaxKind.LessThanEqualsToken, 67 + '=': ts.SyntaxKind.EqualsToken, 68 + '==': ts.SyntaxKind.EqualsEqualsToken, 69 + '===': ts.SyntaxKind.EqualsEqualsEqualsToken, 70 + '>': ts.SyntaxKind.GreaterThanToken, 71 + '>=': ts.SyntaxKind.GreaterThanEqualsToken, 72 + '??': ts.SyntaxKind.QuestionQuestionToken, 73 + '||': ts.SyntaxKind.BarBarToken, 74 + }; 75 + const token = tokenMap[operator]; 76 + if (!token) { 77 + throw new Error(`Unsupported operator: ${operator}`); 78 + } 79 + return token; 80 + } 81 + }
+30
packages/openapi-ts/src/ts-dsl/call.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + export class CallTsDsl extends TsDsl<ts.CallExpression> { 7 + private callee: MaybeTsDsl<ExprInput>; 8 + private callArgs: ReadonlyArray<MaybeTsDsl<ExprInput>> = []; 9 + 10 + constructor( 11 + callee: MaybeTsDsl<ExprInput>, 12 + ...args: ReadonlyArray<MaybeTsDsl<ExprInput>> 13 + ) { 14 + super(); 15 + this.callee = callee; 16 + if (args.length) this.callArgs = args; 17 + } 18 + 19 + /** Adds one or more arguments to the call expression. */ 20 + args(...args: ReadonlyArray<MaybeTsDsl<ExprInput>>): this { 21 + this.callArgs = args; 22 + return this; 23 + } 24 + 25 + $render(): ts.CallExpression { 26 + const calleeNode = this.$node(this.callee); 27 + const argsNodes = this.$node(this.callArgs).map((arg) => this.$expr(arg)); 28 + return ts.factory.createCallExpression(calleeNode, undefined, argsNodes); 29 + } 30 + }
+108
packages/openapi-ts/src/ts-dsl/class.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { ExprInput, MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { FieldTsDsl } from './field'; 7 + import { InitTsDsl } from './init'; 8 + import { MethodTsDsl } from './method'; 9 + import { mixin } from './mixins/apply'; 10 + import { DecoratorMixin } from './mixins/decorator'; 11 + import { DescribeMixin } from './mixins/describe'; 12 + import { GenericsMixin } from './mixins/generics'; 13 + import { 14 + AbstractMixin, 15 + createModifierAccessor, 16 + DefaultMixin, 17 + ExportMixin, 18 + } from './mixins/modifiers'; 19 + import { NewlineTsDsl } from './newline'; 20 + 21 + export class ClassTsDsl extends TsDsl<ts.ClassDeclaration> { 22 + private heritageClauses: Array<ts.HeritageClause> = []; 23 + private body: Array<MaybeTsDsl<ts.ClassElement> | NewlineTsDsl> = []; 24 + private modifiers = createModifierAccessor(this); 25 + private name: string; 26 + 27 + constructor(name: string) { 28 + super(); 29 + this.name = name; 30 + } 31 + 32 + /** Adds a class constructor. */ 33 + init(fn?: (i: InitTsDsl) => void): this { 34 + const i = new InitTsDsl(fn); 35 + this.body.push(i); 36 + return this; 37 + } 38 + 39 + /** Adds a base class to extend from. */ 40 + extends(base?: ExprInput | false | null): this { 41 + if (!base) return this; 42 + this.heritageClauses.push( 43 + ts.factory.createHeritageClause(ts.SyntaxKind.ExtendsKeyword, [ 44 + ts.factory.createExpressionWithTypeArguments( 45 + this.$expr(base), 46 + undefined, 47 + ), 48 + ]), 49 + ); 50 + return this; 51 + } 52 + 53 + /** Adds a class field. */ 54 + field(name: string, fn?: (f: FieldTsDsl) => void): this { 55 + const f = new FieldTsDsl(name, fn); 56 + this.body.push(f); 57 + return this; 58 + } 59 + 60 + /** Adds a class method. */ 61 + method(name: string, fn?: (m: MethodTsDsl) => void): this { 62 + const m = new MethodTsDsl(name, fn); 63 + this.body.push(m); 64 + return this; 65 + } 66 + 67 + /** Adds one or more class members (fields, methods, etc.). */ 68 + do(...items: ReadonlyArray<MaybeTsDsl<ts.ClassElement | ts.Node>>): this { 69 + // @ts-expect-error --- IGNORE --- 70 + this.body.push(...items); 71 + return this; 72 + } 73 + 74 + /** Inserts an empty line between members for formatting. */ 75 + newline(): this { 76 + this.body.push(new NewlineTsDsl()); 77 + return this; 78 + } 79 + 80 + /** Builds the `ClassDeclaration` node. */ 81 + $render(): ts.ClassDeclaration { 82 + const builtBody = this.$node(this.body) as ReadonlyArray<ts.ClassElement>; 83 + return ts.factory.createClassDeclaration( 84 + [...(this.decorators ?? []), ...this.modifiers.list()], 85 + ts.factory.createIdentifier(this.name), 86 + this.$generics(), 87 + this.heritageClauses, 88 + builtBody, 89 + ); 90 + } 91 + } 92 + 93 + export interface ClassTsDsl 94 + extends AbstractMixin, 95 + DecoratorMixin, 96 + DescribeMixin, 97 + DefaultMixin, 98 + ExportMixin, 99 + GenericsMixin {} 100 + mixin( 101 + ClassTsDsl, 102 + AbstractMixin, 103 + DecoratorMixin, 104 + [DescribeMixin, { overrideRender: true }], 105 + DefaultMixin, 106 + ExportMixin, 107 + GenericsMixin, 108 + );
+52
packages/openapi-ts/src/ts-dsl/const.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import { TsDsl } from './base'; 5 + import { mixin } from './mixins/apply'; 6 + import { DescribeMixin } from './mixins/describe'; 7 + import { 8 + createModifierAccessor, 9 + DefaultMixin, 10 + ExportMixin, 11 + } from './mixins/modifiers'; 12 + import { ValueMixin } from './mixins/value'; 13 + 14 + export class ConstTsDsl extends TsDsl<ts.VariableStatement> { 15 + private modifiers = createModifierAccessor(this); 16 + private name: string; 17 + 18 + constructor(name: string) { 19 + super(); 20 + this.name = name; 21 + } 22 + 23 + $render(): ts.VariableStatement { 24 + return ts.factory.createVariableStatement( 25 + this.modifiers.list(), 26 + ts.factory.createVariableDeclarationList( 27 + [ 28 + ts.factory.createVariableDeclaration( 29 + ts.factory.createIdentifier(this.name), 30 + undefined, 31 + undefined, 32 + this.$node(this.initializer), 33 + ), 34 + ], 35 + ts.NodeFlags.Const, 36 + ), 37 + ); 38 + } 39 + } 40 + 41 + export interface ConstTsDsl 42 + extends DefaultMixin, 43 + DescribeMixin, 44 + ExportMixin, 45 + ValueMixin {} 46 + mixin( 47 + ConstTsDsl, 48 + DefaultMixin, 49 + [DescribeMixin, { overrideRender: true }], 50 + ExportMixin, 51 + ValueMixin, 52 + );
+72
packages/openapi-ts/src/ts-dsl/describe.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import { TsDsl } from './base'; 4 + 5 + export class DescribeTsDsl extends TsDsl { 6 + private _lines: Array<string> = []; 7 + 8 + constructor( 9 + lines?: string | ReadonlyArray<string>, 10 + fn?: (d: DescribeTsDsl) => void, 11 + ) { 12 + super(); 13 + if (lines) { 14 + if (typeof lines === 'string') { 15 + this.add(lines); 16 + } else { 17 + this.add(...lines); 18 + } 19 + } 20 + if (fn) fn(this); 21 + } 22 + 23 + add(...lines: ReadonlyArray<string>): this { 24 + this._lines.push(...lines); 25 + return this; 26 + } 27 + 28 + apply<T extends ts.Node>(node: T): T { 29 + const lines = this._lines.filter((line) => Boolean(line) || line === ''); 30 + if (!lines.length) return node; 31 + 32 + const jsdocTexts = lines.map((line, index) => { 33 + let text = line; 34 + if (index !== lines.length) { 35 + text = `${text}\n`; 36 + } 37 + return ts.factory.createJSDocText(text); 38 + }); 39 + 40 + const jsdoc = ts.factory.createJSDocComment( 41 + ts.factory.createNodeArray(jsdocTexts), 42 + undefined, 43 + ); 44 + 45 + const cleanedJsdoc = ts 46 + .createPrinter() 47 + .printNode( 48 + ts.EmitHint.Unspecified, 49 + jsdoc, 50 + node.getSourceFile?.() ?? 51 + ts.createSourceFile('', '', ts.ScriptTarget.Latest), 52 + ) 53 + .replace('/*', '') 54 + .replace('* */', ''); 55 + 56 + ts.addSyntheticLeadingComment( 57 + node, 58 + ts.SyntaxKind.MultiLineCommentTrivia, 59 + cleanedJsdoc, 60 + true, 61 + ); 62 + 63 + return node; 64 + } 65 + 66 + $render(): ts.Node { 67 + // this class does not build a standalone node; 68 + // it modifies other nodes via `apply()`. 69 + // Return a dummy comment node for compliance. 70 + return ts.factory.createIdentifier(''); 71 + } 72 + }
+24
packages/openapi-ts/src/ts-dsl/expr.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import type ts from 'typescript'; 3 + 4 + import type { ExprInput, MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { AccessMixin } from './mixins/access'; 7 + import { mixin } from './mixins/apply'; 8 + import { OperatorMixin } from './mixins/operator'; 9 + 10 + export class ExprTsDsl extends TsDsl<ts.Expression> { 11 + private input: MaybeTsDsl<ExprInput>; 12 + 13 + constructor(id: MaybeTsDsl<ExprInput>) { 14 + super(); 15 + this.input = id; 16 + } 17 + 18 + $render(): ts.Expression { 19 + return this.$node(this.input); 20 + } 21 + } 22 + 23 + export interface ExprTsDsl extends AccessMixin, OperatorMixin {} 24 + mixin(ExprTsDsl, AccessMixin, OperatorMixin);
+64
packages/openapi-ts/src/ts-dsl/field.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import { TsDsl } from './base'; 5 + import { mixin } from './mixins/apply'; 6 + import { DecoratorMixin } from './mixins/decorator'; 7 + import { DescribeMixin } from './mixins/describe'; 8 + import { 9 + createModifierAccessor, 10 + PrivateMixin, 11 + ProtectedMixin, 12 + PublicMixin, 13 + ReadonlyMixin, 14 + StaticMixin, 15 + } from './mixins/modifiers'; 16 + import { createTypeAccessor } from './mixins/type'; 17 + import { ValueMixin } from './mixins/value'; 18 + 19 + export class FieldTsDsl extends TsDsl<ts.PropertyDeclaration> { 20 + private modifiers = createModifierAccessor(this); 21 + private name: string; 22 + private _type = createTypeAccessor(this); 23 + 24 + constructor(name: string, fn?: (f: FieldTsDsl) => void) { 25 + super(); 26 + this.name = name; 27 + if (fn) fn(this); 28 + } 29 + 30 + /** Sets the property's type. */ 31 + type = this._type.method; 32 + 33 + /** Builds the `PropertyDeclaration` node. */ 34 + $render(): ts.PropertyDeclaration { 35 + return ts.factory.createPropertyDeclaration( 36 + [...(this.decorators ?? []), ...this.modifiers.list()], 37 + ts.factory.createIdentifier(this.name), 38 + undefined, 39 + this._type.$render(), 40 + this.$node(this.initializer), 41 + ); 42 + } 43 + } 44 + 45 + export interface FieldTsDsl 46 + extends DecoratorMixin, 47 + DescribeMixin, 48 + PrivateMixin, 49 + ProtectedMixin, 50 + PublicMixin, 51 + ReadonlyMixin, 52 + StaticMixin, 53 + ValueMixin {} 54 + mixin( 55 + FieldTsDsl, 56 + DecoratorMixin, 57 + [DescribeMixin, { overrideRender: true }], 58 + PrivateMixin, 59 + ProtectedMixin, 60 + PublicMixin, 61 + ReadonlyMixin, 62 + StaticMixin, 63 + ValueMixin, 64 + );
+70
packages/openapi-ts/src/ts-dsl/getter.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { mixin } from './mixins/apply'; 7 + import { DecoratorMixin } from './mixins/decorator'; 8 + import { DescribeMixin } from './mixins/describe'; 9 + import type { AsyncMixin } from './mixins/modifiers'; 10 + import { 11 + AbstractMixin, 12 + createModifierAccessor, 13 + PrivateMixin, 14 + ProtectedMixin, 15 + PublicMixin, 16 + StaticMixin, 17 + } from './mixins/modifiers'; 18 + import { ParamMixin } from './mixins/param'; 19 + 20 + export class GetterTsDsl extends TsDsl<ts.GetAccessorDeclaration> { 21 + private body: Array<MaybeTsDsl<ts.Statement | ts.Expression>> = []; 22 + private modifiers = createModifierAccessor(this); 23 + private name: string; 24 + 25 + constructor(name: string, fn?: (g: GetterTsDsl) => void) { 26 + super(); 27 + this.name = name; 28 + if (fn) fn(this); 29 + } 30 + 31 + /** Adds one or more expressions to the getter body. */ 32 + do(...items: ReadonlyArray<MaybeTsDsl<ts.Statement | ts.Expression>>): this { 33 + this.body.push(...items); 34 + return this; 35 + } 36 + 37 + $render(): ts.GetAccessorDeclaration { 38 + const builtParams = this.$node(this._params ?? []); 39 + const builtBody = this.$stmt(this.body); 40 + return ts.factory.createGetAccessorDeclaration( 41 + [...(this.decorators ?? []), ...this.modifiers.list()], 42 + this.name, 43 + builtParams, 44 + undefined, 45 + ts.factory.createBlock(builtBody, true), 46 + ); 47 + } 48 + } 49 + 50 + export interface GetterTsDsl 51 + extends AbstractMixin, 52 + AsyncMixin, 53 + DecoratorMixin, 54 + DescribeMixin, 55 + ParamMixin, 56 + PrivateMixin, 57 + ProtectedMixin, 58 + PublicMixin, 59 + StaticMixin {} 60 + mixin( 61 + GetterTsDsl, 62 + AbstractMixin, 63 + DecoratorMixin, 64 + [DescribeMixin, { overrideRender: true }], 65 + ParamMixin, 66 + PrivateMixin, 67 + ProtectedMixin, 68 + PublicMixin, 69 + StaticMixin, 70 + );
+60
packages/openapi-ts/src/ts-dsl/if.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + export class IfTsDsl extends TsDsl<ts.IfStatement> { 7 + private conditionInput?: MaybeTsDsl<ExprInput>; 8 + private thenInput?: ReadonlyArray<MaybeTsDsl<ts.Statement>>; 9 + private elseInput?: ReadonlyArray<MaybeTsDsl<ts.Statement>>; 10 + 11 + constructor(condition?: MaybeTsDsl<ExprInput>) { 12 + super(); 13 + if (condition) this.condition(condition); 14 + } 15 + 16 + condition(condition: MaybeTsDsl<ExprInput>): this { 17 + this.conditionInput = condition; 18 + return this; 19 + } 20 + 21 + do(...items: ReadonlyArray<MaybeTsDsl<ts.Statement>>): this { 22 + this.thenInput = items; 23 + return this; 24 + } 25 + 26 + otherwise(...statements: ReadonlyArray<MaybeTsDsl<ts.Statement>>): this { 27 + this.elseInput = statements; 28 + return this; 29 + } 30 + 31 + $render(): ts.IfStatement { 32 + if (!this.conditionInput) throw new Error('Missing condition in if'); 33 + if (!this.thenInput) throw new Error('Missing then block in if'); 34 + 35 + const condition = this.$node(this.conditionInput); 36 + 37 + const thenStmts = this.$node(this.thenInput); 38 + const thenBlock = 39 + thenStmts.length === 1 40 + ? thenStmts[0]! 41 + : ts.factory.createBlock(thenStmts, true); 42 + const thenNode = ts.isBlock(thenBlock) 43 + ? thenBlock 44 + : ts.factory.createBlock([thenBlock], true); 45 + 46 + let elseNode: ts.Statement | undefined; 47 + if (this.elseInput) { 48 + const elseStmts = this.$node(this.elseInput); 49 + const elseBlock = 50 + elseStmts.length === 1 51 + ? elseStmts[0]! 52 + : ts.factory.createBlock(elseStmts, true); 53 + elseNode = ts.isBlock(elseBlock) 54 + ? elseBlock 55 + : ts.factory.createBlock([elseBlock], true); 56 + } 57 + 58 + return ts.factory.createIfStatement(condition, thenNode, elseNode); 59 + } 60 + }
+77
packages/openapi-ts/src/ts-dsl/index.ts
··· 1 + import { AttrTsDsl } from './attr'; 2 + import { BinaryTsDsl } from './binary'; 3 + import { CallTsDsl } from './call'; 4 + import { ClassTsDsl } from './class'; 5 + import { ConstTsDsl } from './const'; 6 + import { DescribeTsDsl } from './describe'; 7 + import { ExprTsDsl } from './expr'; 8 + import { FieldTsDsl } from './field'; 9 + import { GetterTsDsl } from './getter'; 10 + import { IfTsDsl } from './if'; 11 + import { InitTsDsl } from './init'; 12 + import { LiteralTsDsl } from './literal'; 13 + import { MethodTsDsl } from './method'; 14 + import { NewTsDsl } from './new'; 15 + import { NewlineTsDsl } from './newline'; 16 + import { NotTsDsl } from './not'; 17 + import { ObjectTsDsl } from './object'; 18 + import { ParamTsDsl } from './param'; 19 + import { ReturnTsDsl } from './return'; 20 + import { SetterTsDsl } from './setter'; 21 + import { TemplateTsDsl } from './template'; 22 + import { ThrowTsDsl } from './throw'; 23 + import { TypeTsDsl } from './type'; 24 + 25 + const base = { 26 + attr: (...args: ConstructorParameters<typeof AttrTsDsl>) => 27 + new AttrTsDsl(...args), 28 + binary: (...args: ConstructorParameters<typeof BinaryTsDsl>) => 29 + new BinaryTsDsl(...args), 30 + call: (...args: ConstructorParameters<typeof CallTsDsl>) => 31 + new CallTsDsl(...args), 32 + class: (...args: ConstructorParameters<typeof ClassTsDsl>) => 33 + new ClassTsDsl(...args), 34 + const: (...args: ConstructorParameters<typeof ConstTsDsl>) => 35 + new ConstTsDsl(...args), 36 + describe: (...args: ConstructorParameters<typeof DescribeTsDsl>) => 37 + new DescribeTsDsl(...args), 38 + expr: (...args: ConstructorParameters<typeof ExprTsDsl>) => 39 + new ExprTsDsl(...args), 40 + field: (...args: ConstructorParameters<typeof FieldTsDsl>) => 41 + new FieldTsDsl(...args), 42 + getter: (...args: ConstructorParameters<typeof GetterTsDsl>) => 43 + new GetterTsDsl(...args), 44 + if: (...args: ConstructorParameters<typeof IfTsDsl>) => new IfTsDsl(...args), 45 + init: (...args: ConstructorParameters<typeof InitTsDsl>) => 46 + new InitTsDsl(...args), 47 + literal: (...args: ConstructorParameters<typeof LiteralTsDsl>) => 48 + new LiteralTsDsl(...args), 49 + method: (...args: ConstructorParameters<typeof MethodTsDsl>) => 50 + new MethodTsDsl(...args), 51 + new: (...args: ConstructorParameters<typeof NewTsDsl>) => 52 + new NewTsDsl(...args), 53 + newline: (...args: ConstructorParameters<typeof NewlineTsDsl>) => 54 + new NewlineTsDsl(...args), 55 + not: (...args: ConstructorParameters<typeof NotTsDsl>) => 56 + new NotTsDsl(...args), 57 + object: (...args: ConstructorParameters<typeof ObjectTsDsl>) => 58 + new ObjectTsDsl(...args), 59 + param: (...args: ConstructorParameters<typeof ParamTsDsl>) => 60 + new ParamTsDsl(...args), 61 + return: (...args: ConstructorParameters<typeof ReturnTsDsl>) => 62 + new ReturnTsDsl(...args), 63 + setter: (...args: ConstructorParameters<typeof SetterTsDsl>) => 64 + new SetterTsDsl(...args), 65 + template: (...args: ConstructorParameters<typeof TemplateTsDsl>) => 66 + new TemplateTsDsl(...args), 67 + throw: (...args: ConstructorParameters<typeof ThrowTsDsl>) => 68 + new ThrowTsDsl(...args), 69 + type: TypeTsDsl, 70 + }; 71 + 72 + export const $ = Object.assign( 73 + (...args: ConstructorParameters<typeof ExprTsDsl>) => new ExprTsDsl(...args), 74 + base, 75 + ); 76 + 77 + export type { TsDsl } from './base';
+59
packages/openapi-ts/src/ts-dsl/init.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { mixin } from './mixins/apply'; 7 + import { DecoratorMixin } from './mixins/decorator'; 8 + import { DescribeMixin } from './mixins/describe'; 9 + import { 10 + createModifierAccessor, 11 + PrivateMixin, 12 + ProtectedMixin, 13 + PublicMixin, 14 + } from './mixins/modifiers'; 15 + import { ParamMixin } from './mixins/param'; 16 + 17 + export class InitTsDsl extends TsDsl<ts.ConstructorDeclaration> { 18 + private body: Array<MaybeTsDsl<ts.Statement | ts.Expression>> = []; 19 + private modifiers = createModifierAccessor(this); 20 + 21 + constructor(fn?: (i: InitTsDsl) => void) { 22 + super(); 23 + if (fn) fn(this); 24 + } 25 + 26 + /** Adds one or more statements or expressions to the constructor body. */ 27 + do(...items: ReadonlyArray<MaybeTsDsl<ts.Statement | ts.Expression>>): this { 28 + this.body.push(...items); 29 + return this; 30 + } 31 + 32 + /** Builds the `ConstructorDeclaration` node. */ 33 + $render(): ts.ConstructorDeclaration { 34 + const builtParams = this.$node(this._params ?? []); 35 + const builtBody = this.$stmt(this.body); 36 + return ts.factory.createConstructorDeclaration( 37 + [...(this.decorators ?? []), ...this.modifiers.list()], 38 + builtParams, 39 + ts.factory.createBlock(builtBody, true), 40 + ); 41 + } 42 + } 43 + 44 + export interface InitTsDsl 45 + extends DecoratorMixin, 46 + DescribeMixin, 47 + ParamMixin, 48 + PrivateMixin, 49 + ProtectedMixin, 50 + PublicMixin {} 51 + mixin( 52 + InitTsDsl, 53 + DecoratorMixin, 54 + [DescribeMixin, { overrideRender: true }], 55 + ParamMixin, 56 + PrivateMixin, 57 + ProtectedMixin, 58 + PublicMixin, 59 + );
+25
packages/openapi-ts/src/ts-dsl/literal.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import { TsDsl } from './base'; 4 + 5 + export class LiteralTsDsl extends TsDsl<ts.LiteralTypeNode['literal']> { 6 + private value: string | number | boolean; 7 + 8 + constructor(value: string | number | boolean) { 9 + super(); 10 + this.value = value; 11 + } 12 + 13 + $render(): ts.LiteralTypeNode['literal'] { 14 + switch (typeof this.value) { 15 + case 'boolean': 16 + return this.value ? ts.factory.createTrue() : ts.factory.createFalse(); 17 + case 'number': 18 + return ts.factory.createNumericLiteral(this.value); 19 + case 'string': 20 + return ts.factory.createStringLiteral(this.value); 21 + default: 22 + throw new Error(`Unsupported literal: ${String(this.value)}`); 23 + } 24 + } 25 + }
+86
packages/openapi-ts/src/ts-dsl/method.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { mixin } from './mixins/apply'; 7 + import { DecoratorMixin } from './mixins/decorator'; 8 + import { DescribeMixin } from './mixins/describe'; 9 + import { GenericsMixin } from './mixins/generics'; 10 + import { 11 + AbstractMixin, 12 + AsyncMixin, 13 + createModifierAccessor, 14 + PrivateMixin, 15 + ProtectedMixin, 16 + PublicMixin, 17 + StaticMixin, 18 + } from './mixins/modifiers'; 19 + import { OptionalMixin } from './mixins/optional'; 20 + import { ParamMixin } from './mixins/param'; 21 + import { createTypeAccessor } from './mixins/type'; 22 + 23 + export class MethodTsDsl extends TsDsl<ts.MethodDeclaration> { 24 + private body: Array<MaybeTsDsl<ts.Statement | ts.Expression>> = []; 25 + private modifiers = createModifierAccessor(this); 26 + private name: string; 27 + private _returns = createTypeAccessor(this); 28 + 29 + constructor(name: string, fn?: (m: MethodTsDsl) => void) { 30 + super(); 31 + this.name = name; 32 + if (fn) fn(this); 33 + } 34 + 35 + /** Sets the return type. */ 36 + returns = this._returns.method; 37 + 38 + /** Adds one or more statements or expressions to the method body. */ 39 + do(...items: ReadonlyArray<MaybeTsDsl<ts.Statement | ts.Expression>>): this { 40 + this.body.push(...items); 41 + return this; 42 + } 43 + 44 + /** Builds the `MethodDeclaration` node. */ 45 + $render(): ts.MethodDeclaration { 46 + const builtParams = this.$node(this._params ?? []); 47 + const builtBody = this.$stmt(this.body); 48 + return ts.factory.createMethodDeclaration( 49 + [...(this.decorators ?? []), ...this.modifiers.list()], 50 + undefined, 51 + ts.factory.createIdentifier(this.name), 52 + this.questionToken, 53 + this.$generics(), 54 + builtParams, 55 + this._returns.$render(), 56 + ts.factory.createBlock(builtBody, true), 57 + ); 58 + } 59 + } 60 + 61 + export interface MethodTsDsl 62 + extends AbstractMixin, 63 + AsyncMixin, 64 + DecoratorMixin, 65 + DescribeMixin, 66 + GenericsMixin, 67 + OptionalMixin, 68 + ParamMixin, 69 + PrivateMixin, 70 + ProtectedMixin, 71 + PublicMixin, 72 + StaticMixin {} 73 + mixin( 74 + MethodTsDsl, 75 + AbstractMixin, 76 + AsyncMixin, 77 + DecoratorMixin, 78 + [DescribeMixin, { overrideRender: true }], 79 + GenericsMixin, 80 + OptionalMixin, 81 + ParamMixin, 82 + PrivateMixin, 83 + ProtectedMixin, 84 + PublicMixin, 85 + StaticMixin, 86 + );
+19
packages/openapi-ts/src/ts-dsl/mixins/access.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import { AttrTsDsl } from '../attr'; 4 + import type { ExprInput, MaybeTsDsl, TsDsl } from '../base'; 5 + import { CallTsDsl } from '../call'; 6 + 7 + export class AccessMixin { 8 + /** Accesses a property on the current expression (e.g. `this.foo`). */ 9 + attr(this: TsDsl<ts.Expression>, name: string): AttrTsDsl { 10 + return new AttrTsDsl(this, name); 11 + } 12 + /** Calls the current expression as a function (e.g. `fn(arg1, arg2)`). */ 13 + call( 14 + this: TsDsl<ts.Expression>, 15 + ...args: ReadonlyArray<MaybeTsDsl<ExprInput>> 16 + ): CallTsDsl { 17 + return new CallTsDsl(this, ...args); 18 + } 19 + }
+30
packages/openapi-ts/src/ts-dsl/mixins/apply.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-function-type */ 2 + export function mixin( 3 + target: Function, 4 + ...sources: ReadonlyArray<Function | [Function, { overrideRender?: boolean }]> 5 + ) { 6 + const targetProto = target.prototype; 7 + for (const src of sources) { 8 + const [source, options] = src instanceof Array ? src : [src]; 9 + let resolvedSource = source; 10 + if (typeof source === 'function') { 11 + try { 12 + const candidate = source(target); 13 + if (candidate?.prototype) { 14 + resolvedSource = candidate; 15 + } 16 + } catch { 17 + // noop 18 + } 19 + } 20 + const sourceProto = resolvedSource.prototype; 21 + if (!sourceProto) continue; 22 + for (const [key, descriptor] of Object.entries( 23 + Object.getOwnPropertyDescriptors(sourceProto), 24 + )) { 25 + if (key === 'constructor') continue; 26 + if (key === '$render' && !options?.overrideRender) continue; 27 + Object.defineProperty(targetProto, key, descriptor); 28 + } 29 + } 30 + }
+11
packages/openapi-ts/src/ts-dsl/mixins/assignment.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl, TsDsl } from '../base'; 4 + import { BinaryTsDsl } from '../binary'; 5 + 6 + export class AssignmentMixin { 7 + /** Creates an assignment expression (e.g. `this = expr`). */ 8 + assign(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>): BinaryTsDsl { 9 + return new BinaryTsDsl(this, '=', expr); 10 + } 11 + }
+34
packages/openapi-ts/src/ts-dsl/mixins/decorator.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput } from '../base'; 4 + import { TsDsl } from '../base'; 5 + import { ObjectTsDsl } from '../object'; 6 + 7 + export class DecoratorMixin extends TsDsl { 8 + protected decorators?: Array<ts.Decorator>; 9 + 10 + /** Adds a decorator (e.g. `@sealed({ in: 'root' })`). */ 11 + decorator<T extends this>( 12 + this: T, 13 + name: ExprInput | false | null, 14 + fn?: (o: ObjectTsDsl) => void, 15 + ): T { 16 + if (!name) return this; 17 + 18 + const expr = this.$expr(name); 19 + let call: ts.Expression = expr; 20 + 21 + // if callback provided, build object argument 22 + if (fn) { 23 + const obj = new ObjectTsDsl(fn); 24 + call = ts.factory.createCallExpression(expr, undefined, [obj.$render()]); 25 + } 26 + 27 + (this.decorators ??= []).push(ts.factory.createDecorator(call)); 28 + return this; 29 + } 30 + 31 + $render(): ts.Node { 32 + throw new Error('noop'); 33 + } 34 + }
+29
packages/openapi-ts/src/ts-dsl/mixins/describe.ts
··· 1 + import type { ITsDsl } from '../base'; 2 + import { DescribeTsDsl } from '../describe'; 3 + 4 + export function DescribeMixin< 5 + TBase extends new (...args: ReadonlyArray<any>) => ITsDsl, 6 + >(Base: TBase) { 7 + const Mixin = class extends Base { 8 + protected _desc?: DescribeTsDsl; 9 + 10 + describe( 11 + lines?: string | ReadonlyArray<string>, 12 + fn?: (d: DescribeTsDsl) => void, 13 + ): this { 14 + this._desc = new DescribeTsDsl(lines, fn); 15 + return this; 16 + } 17 + }; 18 + 19 + const originalFn = Base.prototype.$render; 20 + 21 + Mixin.prototype.$render = function (...args: Parameters<ITsDsl['$render']>) { 22 + const node = originalFn.apply(this, args); 23 + return this._desc ? this._desc.apply(node) : node; 24 + }; 25 + 26 + return Mixin; 27 + } 28 + 29 + export type DescribeMixin = InstanceType<ReturnType<typeof DescribeMixin>>;
+44
packages/openapi-ts/src/ts-dsl/mixins/generics.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import { type MaybeTsDsl, TsDsl } from '../base'; 4 + import { TypeParamTsDsl } from '../type'; 5 + 6 + export class GenericsMixin extends TsDsl { 7 + protected _generics?: Array<string | MaybeTsDsl<ts.TypeParameterDeclaration>>; 8 + 9 + /** Adds a single generic type argument (e.g. `T` in `Array<T>`). */ 10 + generic(name: string, fn?: (t: TypeParamTsDsl) => void): this { 11 + const g = new TypeParamTsDsl(name, fn); 12 + if (!this._generics) this._generics = []; 13 + this._generics.push(g); 14 + return this; 15 + } 16 + 17 + /** Adds generic type arguments (e.g. `Map<string, T>`). */ 18 + generics( 19 + ...args: ReadonlyArray<string | MaybeTsDsl<ts.TypeParameterDeclaration>> 20 + ): this { 21 + this._generics = [...args]; 22 + return this; 23 + } 24 + 25 + protected $generics(): 26 + | ReadonlyArray<ts.TypeParameterDeclaration> 27 + | undefined { 28 + return this._generics?.map((g) => { 29 + if (typeof g === 'string') { 30 + return ts.factory.createTypeParameterDeclaration( 31 + undefined, 32 + ts.factory.createIdentifier(g), 33 + undefined, 34 + undefined, 35 + ); 36 + } 37 + return this.$node(g); 38 + }); 39 + } 40 + 41 + $render(): ts.Node { 42 + throw new Error('noop'); 43 + } 44 + }
+71
packages/openapi-ts/src/ts-dsl/mixins/modifiers.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { TsDsl } from '../base'; 4 + 5 + export function createModifierAccessor<Parent extends TsDsl>(parent: Parent) { 6 + const modifiers: Array<ts.Modifier> = []; 7 + 8 + function _m(kind: ts.ModifierSyntaxKind, condition = true): Parent { 9 + if (condition) { 10 + modifiers.push(ts.factory.createModifier(kind)); 11 + } 12 + return parent; 13 + } 14 + 15 + Object.assign(parent, { _m }); // attaches to parent 16 + 17 + function list() { 18 + return modifiers; 19 + } 20 + 21 + return { list }; 22 + } 23 + 24 + type Target = object & { 25 + _m?(kind: ts.ModifierSyntaxKind, condition?: boolean): unknown; 26 + }; 27 + export class AbstractMixin { 28 + abstract<T extends Target>(this: T, condition: boolean = true): T { 29 + return this._m!(ts.SyntaxKind.AbstractKeyword, condition) as T; 30 + } 31 + } 32 + export class AsyncMixin { 33 + async<T extends Target>(this: T, condition: boolean = true): T { 34 + return this._m!(ts.SyntaxKind.AsyncKeyword, condition) as T; 35 + } 36 + } 37 + export class DefaultMixin { 38 + default<T extends Target>(this: T, condition: boolean = true): T { 39 + return this._m!(ts.SyntaxKind.DefaultKeyword, condition) as T; 40 + } 41 + } 42 + export class ExportMixin { 43 + export<T extends Target>(this: T, condition: boolean = true): T { 44 + return this._m!(ts.SyntaxKind.ExportKeyword, condition) as T; 45 + } 46 + } 47 + export class PrivateMixin { 48 + private<T extends Target>(this: T, condition: boolean = true): T { 49 + return this._m!(ts.SyntaxKind.PrivateKeyword, condition) as T; 50 + } 51 + } 52 + export class ProtectedMixin { 53 + protected<T extends Target>(this: T, condition: boolean = true): T { 54 + return this._m!(ts.SyntaxKind.ProtectedKeyword, condition) as T; 55 + } 56 + } 57 + export class PublicMixin { 58 + public<T extends Target>(this: T, condition: boolean = true): T { 59 + return this._m!(ts.SyntaxKind.PublicKeyword, condition) as T; 60 + } 61 + } 62 + export class ReadonlyMixin { 63 + readonly<T extends Target>(this: T, condition: boolean = true): T { 64 + return this._m!(ts.SyntaxKind.ReadonlyKeyword, condition) as T; 65 + } 66 + } 67 + export class StaticMixin { 68 + static<T extends Target>(this: T, condition: boolean = true): T { 69 + return this._m!(ts.SyntaxKind.StaticKeyword, condition) as T; 70 + } 71 + }
+67
packages/openapi-ts/src/ts-dsl/mixins/operator.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl, TsDsl } from '../base'; 4 + import { BinaryTsDsl } from '../binary'; 5 + 6 + export class OperatorMixin { 7 + /** Logical AND — `this && expr` */ 8 + and(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 9 + return new BinaryTsDsl(this, '&&', expr); 10 + } 11 + /** Nullish coalescing — `this ?? expr` */ 12 + coalesce(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 13 + return new BinaryTsDsl(this, '??', expr); 14 + } 15 + /** Division — `this / expr` */ 16 + div(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 17 + return new BinaryTsDsl(this, '/', expr); 18 + } 19 + /** Strict equality — `this === expr` */ 20 + eq(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 21 + return new BinaryTsDsl(this, '===', expr); 22 + } 23 + /** Greater than — `this > expr` */ 24 + gt(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 25 + return new BinaryTsDsl(this, '>', expr); 26 + } 27 + /** Greater than or equal — `this >= expr` */ 28 + gte(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 29 + return new BinaryTsDsl(this, '>=', expr); 30 + } 31 + /** Loose equality — `this == expr` */ 32 + looseEq(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 33 + return new BinaryTsDsl(this, '==', expr); 34 + } 35 + /** Loose inequality — `this != expr` */ 36 + looseNeq(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 37 + return new BinaryTsDsl(this, '!=', expr); 38 + } 39 + /** Less than — `this < expr` */ 40 + lt(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 41 + return new BinaryTsDsl(this, '<', expr); 42 + } 43 + /** Less than or equal — `this <= expr` */ 44 + lte(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 45 + return new BinaryTsDsl(this, '<=', expr); 46 + } 47 + /** Subtraction — `this - expr` */ 48 + minus(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 49 + return new BinaryTsDsl(this, '-', expr); 50 + } 51 + /** Strict inequality — `this !== expr` */ 52 + neq(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 53 + return new BinaryTsDsl(this, '!==', expr); 54 + } 55 + /** Logical OR — `this || expr` */ 56 + or(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 57 + return new BinaryTsDsl(this, '||', expr); 58 + } 59 + /** Addition — `this + expr` */ 60 + plus(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 61 + return new BinaryTsDsl(this, '+', expr); 62 + } 63 + /** Multiplication — `this * expr` */ 64 + times(this: TsDsl<ts.Expression>, expr: MaybeTsDsl<ExprInput>) { 65 + return new BinaryTsDsl(this, '*', expr); 66 + } 67 + }
+14
packages/openapi-ts/src/ts-dsl/mixins/optional.ts
··· 1 + import ts from 'typescript'; 2 + 3 + export class OptionalMixin { 4 + protected isOptional?: boolean; 5 + protected questionToken?: ts.PunctuationToken<ts.SyntaxKind.QuestionToken>; 6 + 7 + optional<T extends this>(this: T, condition = true): T { 8 + if (condition) { 9 + this.isOptional = true; 10 + this.questionToken = ts.factory.createToken(ts.SyntaxKind.QuestionToken); 11 + } 12 + return this; 13 + } 14 + }
+23
packages/openapi-ts/src/ts-dsl/mixins/param.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { MaybeTsDsl } from '../base'; 4 + import { ParamTsDsl } from '../param'; 5 + 6 + export class ParamMixin { 7 + protected _params?: Array<MaybeTsDsl<ts.ParameterDeclaration>>; 8 + 9 + /** Adds a parameter. */ 10 + param(name: string, fn?: (p: ParamTsDsl) => void): this { 11 + const p = new ParamTsDsl(name, fn); 12 + if (!this._params) this._params = []; 13 + this._params.push(p); 14 + return this; 15 + } 16 + 17 + /** Adds multiple parameters. */ 18 + params(...params: ReadonlyArray<MaybeTsDsl<ts.ParameterDeclaration>>): this { 19 + if (!this._params) this._params = []; 20 + this._params.push(...params); 21 + return this; 22 + } 23 + }
+36
packages/openapi-ts/src/ts-dsl/mixins/type.ts
··· 1 + import type ts from 'typescript'; 2 + 3 + import type { TypeInput } from '../base'; 4 + import type { TsDsl } from '../base'; 5 + import { TypeTsDsl } from '../type'; 6 + 7 + /** Provides `.type()`-like access with internal state management. */ 8 + export function createTypeAccessor<Parent extends TsDsl>(parent: Parent) { 9 + const $type = parent['$type'].bind(parent); 10 + 11 + let _type: ReturnType<typeof TypeTsDsl> | undefined; 12 + let input: TypeInput | undefined; 13 + 14 + function $render(): ts.TypeNode | undefined { 15 + if (_type) { 16 + return _type.$render(); 17 + } 18 + return $type(input); 19 + } 20 + 21 + function method(): ReturnType<typeof TypeTsDsl>; 22 + function method(type: TypeInput): Parent; 23 + function method(type?: TypeInput): ReturnType<typeof TypeTsDsl> | Parent { 24 + if (type === undefined) { 25 + if (!_type) _type = TypeTsDsl(); 26 + return _type; 27 + } 28 + input = type; 29 + return parent; 30 + } 31 + 32 + return { 33 + $render, 34 + method, 35 + }; 36 + }
+11
packages/openapi-ts/src/ts-dsl/mixins/value.ts
··· 1 + import type { ExprInput, MaybeTsDsl } from '../base'; 2 + 3 + export class ValueMixin { 4 + protected initializer?: MaybeTsDsl<ExprInput>; 5 + 6 + /** Sets the initializer expression (e.g. `= expr`). */ 7 + assign<T extends this>(this: T, expr: MaybeTsDsl<ExprInput>): T { 8 + this.initializer = expr; 9 + return this; 10 + } 11 + }
+43
packages/openapi-ts/src/ts-dsl/new.ts
··· 1 + /* eslint-disable @typescript-eslint/no-empty-object-type, @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { ExprInput, MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { mixin } from './mixins/apply'; 7 + import { GenericsMixin } from './mixins/generics'; 8 + 9 + export class NewTsDsl extends TsDsl<ts.NewExpression> { 10 + private classExpr: MaybeTsDsl<ExprInput>; 11 + private argList: Array<MaybeTsDsl<ExprInput>> = []; 12 + 13 + constructor( 14 + classExpr: MaybeTsDsl<ExprInput>, 15 + ...args: ReadonlyArray<MaybeTsDsl<ExprInput>> 16 + ) { 17 + super(); 18 + this.classExpr = classExpr; 19 + if (args.length) this.argList = [...args]; 20 + } 21 + 22 + /** Adds constructor arguments. */ 23 + args(...args: ReadonlyArray<MaybeTsDsl<ExprInput>>): this { 24 + this.argList = [...args]; 25 + return this; 26 + } 27 + 28 + /** Builds the `NewExpression` node. */ 29 + $render(): ts.NewExpression { 30 + const classExprNode = this.$node(this.classExpr); 31 + const argListNodes = this.$node(this.argList).map((arg) => this.$expr(arg)); 32 + const builtTypes = this._generics?.map((arg) => this.$type(arg)); 33 + return ts.factory.createNewExpression( 34 + classExprNode, 35 + // @ts-expect-error --- generics are not officially supported on 'new' expressions yet 36 + builtTypes, 37 + argListNodes, 38 + ); 39 + } 40 + } 41 + 42 + export interface NewTsDsl extends GenericsMixin {} 43 + mixin(NewTsDsl, GenericsMixin);
+9
packages/openapi-ts/src/ts-dsl/newline.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import { TsDsl } from './base'; 4 + 5 + export class NewlineTsDsl extends TsDsl<ts.Identifier> { 6 + $render(): ts.Identifier { 7 + return ts.factory.createIdentifier('\n'); 8 + } 9 + }
+21
packages/openapi-ts/src/ts-dsl/not.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + export class NotTsDsl extends TsDsl<ts.PrefixUnaryExpression> { 7 + private exprInput: MaybeTsDsl<ExprInput>; 8 + 9 + constructor(expr: MaybeTsDsl<ExprInput>) { 10 + super(); 11 + this.exprInput = expr; 12 + } 13 + 14 + $render(): ts.PrefixUnaryExpression { 15 + const expression = this.$node(this.exprInput); 16 + return ts.factory.createPrefixUnaryExpression( 17 + ts.SyntaxKind.ExclamationToken, 18 + expression, 19 + ); 20 + } 21 + }
+56
packages/openapi-ts/src/ts-dsl/object.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput } from './base'; 4 + import { TsDsl } from './base'; 5 + import { ExprTsDsl } from './expr'; 6 + 7 + export class ObjectTsDsl extends TsDsl<ts.ObjectLiteralExpression> { 8 + private props: Array<{ expr: TsDsl<ts.Expression>; name: string }> = []; 9 + private layout: boolean | number = 3; 10 + 11 + constructor(fn?: (o: ObjectTsDsl) => void) { 12 + super(); 13 + if (fn) fn(this); 14 + } 15 + 16 + /** Sets automatic line output with optional threshold (default: 3). */ 17 + auto(threshold: number = 3): this { 18 + this.layout = threshold; 19 + return this; 20 + } 21 + 22 + /** Sets single line output. */ 23 + inline(): this { 24 + this.layout = false; 25 + return this; 26 + } 27 + 28 + /** Sets multi line output. */ 29 + pretty(): this { 30 + this.layout = true; 31 + return this; 32 + } 33 + 34 + /** Adds a property assignment using a callback builder. */ 35 + prop( 36 + name: string, 37 + fn: (p: (expr: ExprInput) => ExprTsDsl) => TsDsl<ts.Expression>, 38 + ): this { 39 + const result = fn((expr: ExprInput) => new ExprTsDsl(expr)); 40 + this.props.push({ expr: result, name }); 41 + return this; 42 + } 43 + 44 + $render(): ts.ObjectLiteralExpression { 45 + const props = this.props.map(({ expr, name }) => 46 + ts.factory.createPropertyAssignment(name, expr.$render()), 47 + ); 48 + 49 + const multiLine = 50 + typeof this.layout === 'number' 51 + ? this.props.length >= this.layout 52 + : this.layout; 53 + 54 + return ts.factory.createObjectLiteralExpression(props, multiLine); 55 + } 56 + }
+37
packages/openapi-ts/src/ts-dsl/param.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import { TsDsl } from './base'; 5 + import { mixin } from './mixins/apply'; 6 + import { DecoratorMixin } from './mixins/decorator'; 7 + import { OptionalMixin } from './mixins/optional'; 8 + import { createTypeAccessor } from './mixins/type'; 9 + import { ValueMixin } from './mixins/value'; 10 + 11 + export class ParamTsDsl extends TsDsl<ts.ParameterDeclaration> { 12 + private name: string; 13 + private _type = createTypeAccessor(this); 14 + 15 + constructor(name: string, fn?: (p: ParamTsDsl) => void) { 16 + super(); 17 + this.name = name; 18 + if (fn) fn(this); 19 + } 20 + 21 + /** Sets the parameter's type. */ 22 + type = this._type.method; 23 + 24 + $render(): ts.ParameterDeclaration { 25 + return ts.factory.createParameterDeclaration( 26 + this.decorators, 27 + undefined, 28 + ts.factory.createIdentifier(this.name), 29 + this.questionToken, 30 + this._type.$render(), 31 + this.$node(this.initializer), 32 + ); 33 + } 34 + } 35 + 36 + export interface ParamTsDsl extends DecoratorMixin, OptionalMixin, ValueMixin {} 37 + mixin(ParamTsDsl, DecoratorMixin, OptionalMixin, ValueMixin);
+18
packages/openapi-ts/src/ts-dsl/return.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + export class ReturnTsDsl extends TsDsl<ts.ReturnStatement> { 7 + private expr?: MaybeTsDsl<ExprInput>; 8 + 9 + constructor(expr?: MaybeTsDsl<ExprInput>) { 10 + super(); 11 + this.expr = expr; 12 + } 13 + 14 + $render(): ts.ReturnStatement { 15 + const exprNode = this.$node(this.expr); 16 + return ts.factory.createReturnStatement(exprNode); 17 + } 18 + }
+69
packages/openapi-ts/src/ts-dsl/setter.ts
··· 1 + /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { MaybeTsDsl } from './base'; 5 + import { TsDsl } from './base'; 6 + import { mixin } from './mixins/apply'; 7 + import { DecoratorMixin } from './mixins/decorator'; 8 + import { DescribeMixin } from './mixins/describe'; 9 + import type { AsyncMixin } from './mixins/modifiers'; 10 + import { 11 + AbstractMixin, 12 + createModifierAccessor, 13 + PrivateMixin, 14 + ProtectedMixin, 15 + PublicMixin, 16 + StaticMixin, 17 + } from './mixins/modifiers'; 18 + import { ParamMixin } from './mixins/param'; 19 + 20 + export class SetterTsDsl extends TsDsl<ts.SetAccessorDeclaration> { 21 + private body: Array<MaybeTsDsl<ts.Statement | ts.Expression>> = []; 22 + private modifiers = createModifierAccessor(this); 23 + private name: string; 24 + 25 + constructor(name: string, fn?: (s: SetterTsDsl) => void) { 26 + super(); 27 + this.name = name; 28 + if (fn) fn(this); 29 + } 30 + 31 + /** Adds one or more expressions/statements to the setter body. */ 32 + do(...items: ReadonlyArray<MaybeTsDsl<ts.Statement | ts.Expression>>): this { 33 + this.body.push(...items); 34 + return this; 35 + } 36 + 37 + $render(): ts.SetAccessorDeclaration { 38 + const builtParams = this.$node(this._params ?? []); 39 + const builtBody = this.$stmt(this.body); 40 + return ts.factory.createSetAccessorDeclaration( 41 + [...(this.decorators ?? []), ...this.modifiers.list()], 42 + this.name, 43 + builtParams, 44 + ts.factory.createBlock(builtBody, true), 45 + ); 46 + } 47 + } 48 + 49 + export interface SetterTsDsl 50 + extends AbstractMixin, 51 + AsyncMixin, 52 + DecoratorMixin, 53 + DescribeMixin, 54 + ParamMixin, 55 + PrivateMixin, 56 + ProtectedMixin, 57 + PublicMixin, 58 + StaticMixin {} 59 + mixin( 60 + SetterTsDsl, 61 + AbstractMixin, 62 + DecoratorMixin, 63 + [DescribeMixin, { overrideRender: true }], 64 + ParamMixin, 65 + PrivateMixin, 66 + ProtectedMixin, 67 + PublicMixin, 68 + StaticMixin, 69 + );
+87
packages/openapi-ts/src/ts-dsl/template.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + export class TemplateTsDsl extends TsDsl< 7 + ts.TemplateExpression | ts.NoSubstitutionTemplateLiteral 8 + > { 9 + private parts: Array<MaybeTsDsl<ExprInput>> = []; 10 + 11 + constructor(value?: MaybeTsDsl<ExprInput>) { 12 + super(); 13 + if (value !== undefined) this.add(value); 14 + } 15 + 16 + add(value: MaybeTsDsl<ExprInput>): this { 17 + this.parts.push(value); 18 + return this; 19 + } 20 + 21 + $render(): ts.TemplateExpression | ts.NoSubstitutionTemplateLiteral { 22 + const parts = this.$node(this.parts); 23 + 24 + const normalized: Array<ExprInput> = []; 25 + // merge consecutive string parts 26 + for (let index = 0; index < parts.length; index++) { 27 + const current = parts[index]!; 28 + if (typeof current === 'string') { 29 + let merged = current; 30 + while ( 31 + index + 1 < parts.length && 32 + typeof parts[index + 1] === 'string' 33 + ) { 34 + merged += parts[index + 1]; 35 + index++; 36 + } 37 + normalized.push(merged); 38 + } else { 39 + normalized.push(current); 40 + } 41 + } 42 + 43 + if (normalized.length === 0 || typeof normalized[0] !== 'string') { 44 + normalized.unshift(''); 45 + } 46 + 47 + if (normalized.length === 1 && typeof normalized[0] === 'string') { 48 + return ts.factory.createNoSubstitutionTemplateLiteral(normalized[0]); 49 + } 50 + 51 + if ( 52 + normalized.length === 2 && 53 + typeof normalized[0] === 'string' && 54 + typeof normalized[1] !== 'string' 55 + ) { 56 + return ts.factory.createTemplateExpression( 57 + ts.factory.createTemplateHead(normalized[0]), 58 + [ 59 + ts.factory.createTemplateSpan( 60 + normalized[1]!, 61 + ts.factory.createTemplateTail(''), 62 + ), 63 + ], 64 + ); 65 + } 66 + 67 + const head = ts.factory.createTemplateHead(normalized.shift() as string); 68 + const spans: Array<ts.TemplateSpan> = []; 69 + 70 + while (normalized.length) { 71 + const expr = normalized.shift() as ts.Expression; 72 + const next = 73 + typeof normalized[0] === 'string' ? (normalized.shift() as string) : ''; 74 + const isLast = normalized.length === 0; 75 + spans.push( 76 + ts.factory.createTemplateSpan( 77 + expr, 78 + isLast 79 + ? ts.factory.createTemplateTail(next) 80 + : ts.factory.createTemplateMiddle(next), 81 + ), 82 + ); 83 + } 84 + 85 + return ts.factory.createTemplateExpression(head, spans); 86 + } 87 + }
+37
packages/openapi-ts/src/ts-dsl/throw.ts
··· 1 + import ts from 'typescript'; 2 + 3 + import type { ExprInput, MaybeTsDsl } from './base'; 4 + import { TsDsl } from './base'; 5 + 6 + export class ThrowTsDsl extends TsDsl<ts.ThrowStatement> { 7 + private error: MaybeTsDsl<ExprInput>; 8 + private msg?: MaybeTsDsl<ExprInput>; 9 + private useNew: boolean; 10 + 11 + constructor(error: MaybeTsDsl<ExprInput>, useNew = true) { 12 + super(); 13 + this.error = error; 14 + this.useNew = useNew; 15 + } 16 + 17 + message(value: MaybeTsDsl<ExprInput>): this { 18 + this.msg = value; 19 + return this; 20 + } 21 + 22 + $render(): ts.ThrowStatement { 23 + const errorNode = this.$node(this.error); 24 + const messageNode = this.$node(this.msg ? [this.msg] : []).map((expr) => 25 + typeof expr === 'string' ? ts.factory.createStringLiteral(expr) : expr, 26 + ); 27 + if (this.useNew) { 28 + return ts.factory.createThrowStatement( 29 + ts.factory.createNewExpression(errorNode, undefined, messageNode), 30 + ); 31 + } 32 + const args = messageNode.length 33 + ? [ts.factory.createCallExpression(errorNode, undefined, messageNode)] 34 + : [errorNode]; 35 + return ts.factory.createThrowStatement(args[0]!); 36 + } 37 + }
+171
packages/openapi-ts/src/ts-dsl/type.ts
··· 1 + /* eslint-disable @typescript-eslint/no-empty-object-type, @typescript-eslint/no-unsafe-declaration-merging */ 2 + import ts from 'typescript'; 3 + 4 + import type { ExprInput, TypeInput } from './base'; 5 + import { TsDsl } from './base'; 6 + import { LiteralTsDsl } from './literal'; 7 + import { mixin } from './mixins/apply'; 8 + import { GenericsMixin } from './mixins/generics'; 9 + import { OptionalMixin } from './mixins/optional'; 10 + 11 + export abstract class BaseTypeTsDsl< 12 + T extends ts.TypeNode | ts.TypeParameterDeclaration, 13 + > extends TsDsl<T> { 14 + protected base?: ts.EntityName; 15 + protected constraint?: TypeInput; 16 + protected defaultValue?: TypeInput; 17 + 18 + constructor(base?: ExprInput<ts.Identifier>) { 19 + super(); 20 + if (base) this.base = this.$expr(base); 21 + } 22 + 23 + default(value: TypeInput): this { 24 + this.defaultValue = value; 25 + return this; 26 + } 27 + 28 + extends(constraint: TypeInput): this { 29 + this.constraint = constraint; 30 + return this; 31 + } 32 + } 33 + 34 + export class TypeReferenceTsDsl extends BaseTypeTsDsl<ts.TypeNode> { 35 + private objectBuilder?: TypeObjectTsDsl; 36 + 37 + constructor( 38 + name?: ExprInput<ts.Identifier>, 39 + fn?: (base: TypeReferenceTsDsl) => void, 40 + ) { 41 + super(name); 42 + if (fn) fn(this); 43 + } 44 + 45 + /** Starts an object type literal (e.g. `{ foo: string }`). */ 46 + object(fn: (o: TypeObjectTsDsl) => void): this { 47 + this.objectBuilder = new TypeObjectTsDsl(fn); 48 + return this; 49 + } 50 + 51 + $render(): ts.TypeNode { 52 + if (this.objectBuilder) { 53 + return ts.factory.createTypeLiteralNode(this.objectBuilder.$render()); 54 + } 55 + if (!this.base) throw new Error('Missing base type'); 56 + const builtTypes = this._generics?.map((arg) => this.$type(arg)); 57 + return ts.factory.createTypeReferenceNode( 58 + this.base, 59 + // @ts-expect-error --- generics are not officially supported on type references yet 60 + builtTypes, 61 + ); 62 + } 63 + } 64 + export interface TypeReferenceTsDsl extends GenericsMixin {} 65 + mixin(TypeReferenceTsDsl, GenericsMixin); 66 + 67 + export class TypeParamTsDsl extends BaseTypeTsDsl<ts.TypeParameterDeclaration> { 68 + constructor( 69 + name?: ExprInput<ts.Identifier>, 70 + fn?: (base: TypeParamTsDsl) => void, 71 + ) { 72 + super(name); 73 + if (fn) fn(this); 74 + } 75 + 76 + $render(): ts.TypeParameterDeclaration { 77 + if (!this.base) throw new Error('Missing type name'); 78 + return ts.factory.createTypeParameterDeclaration( 79 + undefined, 80 + this.base as ts.Identifier, 81 + this.$type(this.constraint), 82 + this.$type(this.defaultValue), 83 + ); 84 + } 85 + } 86 + export interface TypeParamTsDsl extends GenericsMixin {} 87 + mixin(TypeParamTsDsl, GenericsMixin); 88 + 89 + export class TypeLiteralTsDsl extends TsDsl<ts.LiteralTypeNode> { 90 + private literal: LiteralTsDsl; 91 + 92 + constructor(value: string | number | boolean) { 93 + super(); 94 + this.literal = new LiteralTsDsl(value); 95 + } 96 + 97 + $render(): ts.LiteralTypeNode { 98 + const expr = this.literal.$render(); 99 + return ts.factory.createLiteralTypeNode(expr); 100 + } 101 + } 102 + 103 + export class TypeObjectTsDsl { 104 + private props: Array<TypePropTsDsl> = []; 105 + 106 + constructor(fn: (o: TypeObjectTsDsl) => void) { 107 + fn(this); 108 + } 109 + 110 + /** Adds a property signature (returns property builder). */ 111 + prop(name: string, fn: (p: TypePropTsDsl) => void): this { 112 + const propTsDsl = new TypePropTsDsl(name, fn); 113 + this.props.push(propTsDsl); 114 + return this; 115 + } 116 + 117 + $render(): ReadonlyArray<ts.TypeElement> { 118 + return this.props.map((p) => p.$render()); 119 + } 120 + } 121 + 122 + export class TypePropTsDsl { 123 + private name: string; 124 + private typeInput?: TypeInput; 125 + 126 + constructor(name: string, fn: (p: TypePropTsDsl) => void) { 127 + this.name = name; 128 + fn(this); 129 + } 130 + 131 + /** Sets the property type. */ 132 + type(type: TypeInput): this { 133 + this.typeInput = type; 134 + return this; 135 + } 136 + 137 + /** Builds and returns the property signature. */ 138 + $render(): ts.TypeElement { 139 + if (!this.typeInput) { 140 + throw new Error(`Type not specified for property '${this.name}'`); 141 + } 142 + const typeNode = 143 + typeof this.typeInput === 'string' 144 + ? ts.factory.createTypeReferenceNode(this.typeInput) 145 + : (this.typeInput as ts.TypeNode); 146 + return ts.factory.createPropertySignature( 147 + undefined, 148 + ts.factory.createIdentifier(this.name), 149 + this.questionToken, 150 + typeNode, 151 + ); 152 + } 153 + } 154 + 155 + export interface TypePropTsDsl extends OptionalMixin {} 156 + mixin(TypePropTsDsl, OptionalMixin); 157 + 158 + export const TypeTsDsl = Object.assign( 159 + (...args: ConstructorParameters<typeof TypeReferenceTsDsl>) => 160 + new TypeReferenceTsDsl(...args), 161 + { 162 + literal: (...args: ConstructorParameters<typeof TypeLiteralTsDsl>) => 163 + new TypeLiteralTsDsl(...args), 164 + object: (...args: ConstructorParameters<typeof TypeObjectTsDsl>) => 165 + new TypeObjectTsDsl(...args), 166 + param: (...args: ConstructorParameters<typeof TypeParamTsDsl>) => 167 + new TypeParamTsDsl(...args), 168 + ref: (...args: ConstructorParameters<typeof TypeReferenceTsDsl>) => 169 + new TypeReferenceTsDsl(...args), 170 + }, 171 + );
+3 -1
packages/openapi-ts/src/tsc/classes.ts
··· 132 132 extendedClasses, 133 133 name, 134 134 nodes, 135 + typeParameters, 135 136 }: { 136 137 /** 137 138 * Class decorator. ··· 153 154 * Class elements. 154 155 */ 155 156 nodes: ReadonlyArray<ts.ClassElement>; 157 + typeParameters?: ReadonlyArray<ts.TypeParameterDeclaration>; 156 158 }): ts.ClassDeclaration => { 157 159 const modifiers: Array<ts.ModifierLike> = []; 158 160 ··· 191 193 return ts.factory.createClassDeclaration( 192 194 modifiers, 193 195 createIdentifier({ text: name }), 194 - undefined, 196 + typeParameters, 195 197 heritageClauses, 196 198 nodes, 197 199 );
+1
packages/openapi-ts/src/tsc/index.ts
··· 48 48 objectExpression: types.createObjectType, 49 49 ots: utils.ots, 50 50 parameterDeclaration: types.createParameterDeclaration, 51 + prefixUnaryExpression: utils.createPrefixUnaryExpression, 51 52 propertyAccessExpression: types.createPropertyAccessExpression, 52 53 propertyAccessExpressions: transform.createPropertyAccessExpressions, 53 54 propertyAssignment: types.createPropertyAssignment,
+43 -16
packages/openapi-ts/src/tsc/utils.ts
··· 72 72 } 73 73 } 74 74 75 - export const createIdentifier = ({ text }: { text: string }): ts.Identifier => 76 - ts.factory.createIdentifier(text); 75 + export const createIdentifier = ( 76 + args: string | { text: string }, 77 + ): ts.Identifier => 78 + ts.factory.createIdentifier(typeof args === 'string' ? args : args.text); 79 + 80 + type Prefix = '!' | '-'; 81 + 82 + const prefixToOperator = (prefix: Prefix): ts.PrefixUnaryOperator => { 83 + switch (prefix) { 84 + case '!': 85 + return ts.SyntaxKind.ExclamationToken; 86 + case '-': 87 + return ts.SyntaxKind.MinusToken; 88 + } 89 + }; 90 + 91 + export const createPrefixUnaryExpression = ({ 92 + expression, 93 + prefix, 94 + }: { 95 + expression: string | ts.Expression; 96 + prefix: Prefix | ts.PrefixUnaryOperator; 97 + }): ts.PrefixUnaryExpression => { 98 + const operand = 99 + typeof expression === 'string' ? createIdentifier(expression) : expression; 100 + const operator = 101 + typeof prefix === 'string' ? prefixToOperator(prefix) : prefix; 102 + return ts.factory.createPrefixUnaryExpression(operator, operand); 103 + }; 77 104 78 105 export const createThis = (): ts.ThisExpression => ts.factory.createThis(); 79 106 ··· 86 113 87 114 export const createPropertyDeclaration = ({ 88 115 initializer, 89 - modifier, 116 + modifiers, 90 117 name, 91 118 type, 92 119 }: { 93 120 initializer?: ts.Expression; 94 - modifier?: Modifier; 121 + modifiers?: Modifier | ReadonlyArray<Modifier>; 95 122 name: string | ts.PropertyName; 96 123 type?: ts.TypeNode; 97 124 }) => { 98 - const node = ts.factory.createPropertyDeclaration( 99 - modifier ? [createModifier({ keyword: modifier })] : undefined, 125 + const mods = Array.isArray(modifiers) ? modifiers : [modifiers]; 126 + return ts.factory.createPropertyDeclaration( 127 + modifiers ? mods.map((keyword) => createModifier({ keyword })) : undefined, 100 128 name, 101 129 undefined, 102 130 type, 103 131 initializer, 104 132 ); 105 - return node; 106 133 }; 107 134 108 135 /** ··· 116 143 boolean: (value: boolean) => 117 144 value ? ts.factory.createTrue() : ts.factory.createFalse(), 118 145 export: ({ alias, asType = false, name }: ImportExportItemObject) => { 119 - const nameNode = createIdentifier({ text: name! }); 146 + const nameNode = createIdentifier(name!); 120 147 if (alias) { 121 - const aliasNode = createIdentifier({ text: alias }); 148 + const aliasNode = createIdentifier(alias); 122 149 return ts.factory.createExportSpecifier(asType, nameNode, aliasNode); 123 150 } 124 151 return ts.factory.createExportSpecifier(asType, undefined, nameNode); 125 152 }, 126 153 import: ({ alias, asType = false, name }: ImportExportItemObject) => { 127 - const nameNode = createIdentifier({ text: name! }); 154 + const nameNode = createIdentifier(name!); 128 155 if (alias) { 129 - const aliasNode = createIdentifier({ text: alias }); 156 + const aliasNode = createIdentifier(alias); 130 157 return ts.factory.createImportSpecifier(asType, nameNode, aliasNode); 131 158 } 132 159 return ts.factory.createImportSpecifier(asType, undefined, nameNode); ··· 136 163 */ 137 164 number: (value: number) => { 138 165 if (value < 0) { 139 - return ts.factory.createPrefixUnaryExpression( 140 - ts.SyntaxKind.MinusToken, 141 - ts.factory.createNumericLiteral(Math.abs(value)), 142 - ); 166 + return createPrefixUnaryExpression({ 167 + expression: ts.factory.createNumericLiteral(Math.abs(value)), 168 + prefix: '-', 169 + }); 143 170 } 144 171 return ts.factory.createNumericLiteral(value); 145 172 }, ··· 162 189 text = `\`${text.replace(/(?<!\\)`/g, '\\`').replace(/\${/g, '\\${')}\``; 163 190 } 164 191 if (text.startsWith('`')) { 165 - return createIdentifier({ text }); 192 + return createIdentifier(text); 166 193 } 167 194 return createStringLiteral({ text }); 168 195 },
+128 -131
pnpm-lock.yaml
··· 139 139 arktype: 140 140 specifier: 2.1.25 141 141 version: 2.1.25 142 + swr: 143 + specifier: 2.3.6 144 + version: 2.3.6(react@19.0.0) 142 145 typescript: 143 146 specifier: 5.9.3 144 147 version: 5.9.3 ··· 1302 1305 version: 9.17.0(jiti@2.6.1) 1303 1306 nuxt: 1304 1307 specifier: 3.14.1592 1305 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.45)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) 1308 + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.45)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) 1306 1309 ofetch: 1307 1310 specifier: 1.4.1 1308 1311 version: 1.4.1 ··· 12601 12604 engines: {node: '>=16'} 12602 12605 hasBin: true 12603 12606 12607 + swr@2.3.6: 12608 + resolution: {integrity: sha512-wfHRmHWk/isGNMwlLGlZX5Gzz/uTgo0o2IRuTMcf4CPuPFJZlq0rDaKUx+ozB5nBOReNV1kiOyzMfj+MBMikLw==} 12609 + peerDependencies: 12610 + react: ^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 12611 + 12604 12612 symbol-observable@4.0.0: 12605 12613 resolution: {integrity: sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==} 12606 12614 engines: {node: '>=0.10'} ··· 14233 14241 dependencies: 14234 14242 '@ampproject/remapping': 2.3.0 14235 14243 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) 14236 - '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0)) 14244 + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0)) 14237 14245 '@angular-devkit/core': 19.2.0(chokidar@4.0.3) 14238 14246 '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/platform-server@19.2.0(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@19.2.0(@angular/animations@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))))(@angular/ssr@19.2.15(5c03da8199d2fcdf9ff93b70f9349edd))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.6.1)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.14(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.8.3)))(terser@5.39.0)(typescript@5.8.3)(yaml@2.8.1) 14239 14247 '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3) ··· 14284 14292 tslib: 2.8.1 14285 14293 typescript: 5.8.3 14286 14294 webpack: 5.98.0(esbuild@0.25.0) 14287 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 14288 - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) 14295 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) 14296 + webpack-dev-server: 5.2.0(webpack@5.98.0) 14289 14297 webpack-merge: 6.0.1 14290 14298 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) 14291 14299 optionalDependencies: ··· 14321 14329 dependencies: 14322 14330 '@ampproject/remapping': 2.3.0 14323 14331 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) 14324 - '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0)) 14332 + '@angular-devkit/build-webpack': 0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0)) 14325 14333 '@angular-devkit/core': 19.2.0(chokidar@4.0.3) 14326 14334 '@angular/build': 19.2.0(@angular/compiler-cli@19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/platform-server@19.2.0(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(@angular/platform-browser@19.2.0(@angular/animations@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(@angular/common@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))(rxjs@7.8.2))(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1))))(@angular/ssr@19.2.15(5c03da8199d2fcdf9ff93b70f9349edd))(@types/node@22.10.5)(chokidar@4.0.3)(jiti@2.6.1)(karma@6.4.4)(less@4.2.2)(postcss@8.5.2)(tailwindcss@3.4.14(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.8.3)))(terser@5.39.0)(typescript@5.8.3)(yaml@2.8.1) 14327 14335 '@angular/compiler-cli': 19.2.0(@angular/compiler@19.2.0(@angular/core@19.2.0(rxjs@7.8.2)(zone.js@0.15.1)))(typescript@5.8.3) ··· 14372 14380 tslib: 2.8.1 14373 14381 typescript: 5.8.3 14374 14382 webpack: 5.98.0(esbuild@0.25.0) 14375 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 14376 - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) 14383 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) 14384 + webpack-dev-server: 5.2.0(webpack@5.98.0) 14377 14385 webpack-merge: 6.0.1 14378 14386 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) 14379 14387 optionalDependencies: ··· 14460 14468 tslib: 2.8.1 14461 14469 typescript: 5.8.3 14462 14470 webpack: 5.98.0(esbuild@0.25.4) 14463 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 14471 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) 14464 14472 webpack-dev-server: 5.2.2(webpack@5.98.0) 14465 14473 webpack-merge: 6.0.1 14466 14474 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) ··· 14548 14556 tslib: 2.8.1 14549 14557 typescript: 5.9.3 14550 14558 webpack: 5.98.0(esbuild@0.25.4) 14551 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 14559 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) 14552 14560 webpack-dev-server: 5.2.2(webpack@5.98.0) 14553 14561 webpack-merge: 6.0.1 14554 14562 webpack-subresource-integrity: 5.1.0(webpack@5.98.0) ··· 14580 14588 - webpack-cli 14581 14589 - yaml 14582 14590 14583 - '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)))(webpack@5.98.0(esbuild@0.25.0))': 14591 + '@angular-devkit/build-webpack@0.1902.0(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0(esbuild@0.25.0))': 14584 14592 dependencies: 14585 14593 '@angular-devkit/architect': 0.1902.0(chokidar@4.0.3) 14586 14594 rxjs: 7.8.1 14587 14595 webpack: 5.98.0(esbuild@0.25.0) 14588 - webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.0)) 14596 + webpack-dev-server: 5.2.0(webpack@5.98.0) 14589 14597 transitivePeerDependencies: 14590 14598 - chokidar 14591 14599 ··· 18106 18114 18107 18115 '@nuxt/devalue@2.0.2': {} 18108 18116 18117 + '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))': 18118 + dependencies: 18119 + '@nuxt/kit': 3.15.4(magicast@0.3.5) 18120 + '@nuxt/schema': 3.16.2 18121 + execa: 7.2.0 18122 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) 18123 + transitivePeerDependencies: 18124 + - magicast 18125 + - supports-color 18126 + 18109 18127 '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))': 18110 18128 dependencies: 18111 18129 '@nuxt/kit': 3.15.4(magicast@0.3.5) ··· 18122 18140 '@nuxt/schema': 3.16.2 18123 18141 execa: 7.2.0 18124 18142 vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 18125 - transitivePeerDependencies: 18126 - - magicast 18127 - - supports-color 18128 - 18129 - '@nuxt/devtools-kit@1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))': 18130 - dependencies: 18131 - '@nuxt/kit': 3.15.4(magicast@0.3.5) 18132 - '@nuxt/schema': 3.16.2 18133 - execa: 7.2.0 18134 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) 18135 18143 transitivePeerDependencies: 18136 18144 - magicast 18137 18145 - supports-color ··· 18196 18204 - utf-8-validate 18197 18205 - vue 18198 18206 18199 - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': 18207 + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3))': 18200 18208 dependencies: 18201 18209 '@antfu/utils': 0.7.10 18202 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) 18210 + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) 18203 18211 '@nuxt/devtools-wizard': 1.7.0 18204 18212 '@nuxt/kit': 3.15.4(magicast@0.3.5) 18213 + '@vue/devtools-core': 7.6.8(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3)) 18214 + '@vue/devtools-kit': 7.6.8 18215 + birpc: 0.2.19 18216 + consola: 3.4.2 18217 + cronstrue: 2.59.0 18218 + destr: 2.0.5 18219 + error-stack-parser-es: 0.1.5 18220 + execa: 7.2.0 18221 + fast-npm-meta: 0.2.2 18222 + flatted: 3.3.3 18223 + get-port-please: 3.2.0 18224 + hookable: 5.5.3 18225 + image-meta: 0.2.1 18226 + is-installed-globally: 1.0.0 18227 + launch-editor: 2.11.1 18228 + local-pkg: 0.5.1 18229 + magicast: 0.3.5 18230 + nypm: 0.4.1 18231 + ohash: 1.1.6 18232 + pathe: 1.1.2 18233 + perfect-debounce: 1.0.0 18234 + pkg-types: 1.3.1 18235 + rc9: 2.1.2 18236 + scule: 1.3.0 18237 + semver: 7.7.2 18238 + simple-git: 3.28.0 18239 + sirv: 3.0.2 18240 + tinyglobby: 0.2.15 18241 + unimport: 3.14.6(rollup@4.50.0) 18242 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) 18243 + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) 18244 + vite-plugin-vue-inspector: 5.3.2(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) 18245 + which: 3.0.1 18246 + ws: 8.18.3 18247 + transitivePeerDependencies: 18248 + - bufferutil 18249 + - rollup 18250 + - supports-color 18251 + - utf-8-validate 18252 + - vue 18253 + 18254 + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': 18255 + dependencies: 18256 + '@antfu/utils': 0.7.10 18257 + '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) 18258 + '@nuxt/devtools-wizard': 1.7.0 18259 + '@nuxt/kit': 3.15.4(magicast@0.3.5) 18205 18260 '@vue/devtools-core': 7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) 18206 18261 '@vue/devtools-kit': 7.6.8 18207 18262 birpc: 0.2.19 ··· 18280 18336 vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 18281 18337 vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) 18282 18338 vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) 18283 - which: 3.0.1 18284 - ws: 8.18.3 18285 - transitivePeerDependencies: 18286 - - bufferutil 18287 - - rollup 18288 - - supports-color 18289 - - utf-8-validate 18290 - - vue 18291 - 18292 - '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3))': 18293 - dependencies: 18294 - '@antfu/utils': 0.7.10 18295 - '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) 18296 - '@nuxt/devtools-wizard': 1.7.0 18297 - '@nuxt/kit': 3.15.4(magicast@0.3.5) 18298 - '@vue/devtools-core': 7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3)) 18299 - '@vue/devtools-kit': 7.6.8 18300 - birpc: 0.2.19 18301 - consola: 3.4.2 18302 - cronstrue: 2.59.0 18303 - destr: 2.0.5 18304 - error-stack-parser-es: 0.1.5 18305 - execa: 7.2.0 18306 - fast-npm-meta: 0.2.2 18307 - flatted: 3.3.3 18308 - get-port-please: 3.2.0 18309 - hookable: 5.5.3 18310 - image-meta: 0.2.1 18311 - is-installed-globally: 1.0.0 18312 - launch-editor: 2.11.1 18313 - local-pkg: 0.5.1 18314 - magicast: 0.3.5 18315 - nypm: 0.4.1 18316 - ohash: 1.1.6 18317 - pathe: 1.1.2 18318 - perfect-debounce: 1.0.0 18319 - pkg-types: 1.3.1 18320 - rc9: 2.1.2 18321 - scule: 1.3.0 18322 - semver: 7.7.2 18323 - simple-git: 3.28.0 18324 - sirv: 3.0.2 18325 - tinyglobby: 0.2.15 18326 - unimport: 3.14.6(rollup@4.50.0) 18327 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) 18328 - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) 18329 - vite-plugin-vue-inspector: 5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) 18330 18339 which: 3.0.1 18331 18340 ws: 8.18.3 18332 18341 transitivePeerDependencies: ··· 21088 21097 dependencies: 21089 21098 '@vue/devtools-kit': 8.0.3 21090 21099 21100 + '@vue/devtools-core@7.6.8(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3))': 21101 + dependencies: 21102 + '@vue/devtools-kit': 7.7.7 21103 + '@vue/devtools-shared': 7.7.7 21104 + mitt: 3.0.1 21105 + nanoid: 5.1.5 21106 + pathe: 1.1.2 21107 + vite-hot-client: 0.2.4(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)) 21108 + vue: 3.5.13(typescript@5.9.3) 21109 + transitivePeerDependencies: 21110 + - vite 21111 + 21091 21112 '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3))': 21092 21113 dependencies: 21093 21114 '@vue/devtools-kit': 7.7.7 ··· 21108 21129 nanoid: 5.1.5 21109 21130 pathe: 1.1.2 21110 21131 vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)) 21111 - vue: 3.5.13(typescript@5.9.3) 21112 - transitivePeerDependencies: 21113 - - vite 21114 - 21115 - '@vue/devtools-core@7.6.8(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3))': 21116 - dependencies: 21117 - '@vue/devtools-kit': 7.7.7 21118 - '@vue/devtools-shared': 7.7.7 21119 - mitt: 3.0.1 21120 - nanoid: 5.1.5 21121 - pathe: 1.1.2 21122 - vite-hot-client: 0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) 21123 21132 vue: 3.5.13(typescript@5.9.3) 21124 21133 transitivePeerDependencies: 21125 21134 - vite ··· 23196 23205 '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3) 23197 23206 eslint: 9.17.0(jiti@2.6.1) 23198 23207 eslint-import-resolver-node: 0.3.9 23199 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23200 - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23208 + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)) 23209 + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 23201 23210 eslint-plugin-jsx-a11y: 6.10.2(eslint@9.17.0(jiti@2.6.1)) 23202 23211 eslint-plugin-react: 7.37.5(eslint@9.17.0(jiti@2.6.1)) 23203 23212 eslint-plugin-react-hooks: 5.2.0(eslint@9.17.0(jiti@2.6.1)) ··· 23224 23233 transitivePeerDependencies: 23225 23234 - supports-color 23226 23235 23227 - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): 23236 + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)): 23228 23237 dependencies: 23229 23238 '@nolyfill/is-core-module': 1.0.39 23230 23239 debug: 4.4.1 ··· 23235 23244 tinyglobby: 0.2.14 23236 23245 unrs-resolver: 1.11.1 23237 23246 optionalDependencies: 23238 - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23247 + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 23239 23248 transitivePeerDependencies: 23240 23249 - supports-color 23241 23250 23242 - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): 23251 + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)): 23243 23252 dependencies: 23244 23253 debug: 3.2.7 23245 23254 optionalDependencies: 23246 23255 '@typescript-eslint/parser': 8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3) 23247 23256 eslint: 9.17.0(jiti@2.6.1) 23248 23257 eslint-import-resolver-node: 0.3.9 23249 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23258 + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.17.0(jiti@2.6.1)) 23250 23259 transitivePeerDependencies: 23251 23260 - supports-color 23252 23261 23253 - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)): 23262 + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)): 23254 23263 dependencies: 23255 23264 '@rtsao/scc': 1.1.0 23256 23265 array-includes: 3.1.9 ··· 23261 23270 doctrine: 2.1.0 23262 23271 eslint: 9.17.0(jiti@2.6.1) 23263 23272 eslint-import-resolver-node: 0.3.9 23264 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)))(eslint@9.17.0(jiti@2.6.1)) 23273 + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.29.1(eslint@9.17.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.17.0(jiti@2.6.1)) 23265 23274 hasown: 2.0.2 23266 23275 is-core-module: 2.16.1 23267 23276 is-glob: 4.0.3 ··· 26243 26252 - vue-tsc 26244 26253 - xml2js 26245 26254 26246 - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.45)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 26255 + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.45)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): 26247 26256 dependencies: 26248 26257 '@nuxt/devalue': 2.0.2 26249 - '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) 26258 + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.3)) 26250 26259 '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) 26251 26260 '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) 26252 26261 '@nuxt/telemetry': 2.6.6(magicast@0.3.5) ··· 26364 26373 - vue-tsc 26365 26374 - xml2js 26366 26375 26367 - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.45)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): 26376 + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.6.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rolldown@1.0.0-beta.45)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 26368 26377 dependencies: 26369 26378 '@nuxt/devalue': 2.0.2 26370 - '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.3)) 26379 + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1))(vue@3.5.13(typescript@5.9.3)) 26371 26380 '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) 26372 26381 '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) 26373 26382 '@nuxt/telemetry': 2.6.6(magicast@0.3.5) ··· 28525 28534 picocolors: 1.1.1 28526 28535 sax: 1.4.1 28527 28536 28537 + swr@2.3.6(react@19.0.0): 28538 + dependencies: 28539 + dequal: 2.0.3 28540 + react: 19.0.0 28541 + use-sync-external-store: 1.5.0(react@19.0.0) 28542 + 28528 28543 symbol-observable@4.0.0: {} 28529 28544 28530 28545 symbol-tree@3.2.4: {} ··· 29462 29477 vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) 29463 29478 vite-hot-client: 2.1.0(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)) 29464 29479 29480 + vite-hot-client@0.2.4(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): 29481 + dependencies: 29482 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) 29483 + 29465 29484 vite-hot-client@0.2.4(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 29466 29485 dependencies: 29467 29486 vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) ··· 29469 29488 vite-hot-client@0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): 29470 29489 dependencies: 29471 29490 vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 29472 - 29473 - vite-hot-client@0.2.4(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): 29474 - dependencies: 29475 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) 29476 29491 29477 29492 vite-hot-client@2.1.0(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 29478 29493 dependencies: ··· 29618 29633 - rollup 29619 29634 - supports-color 29620 29635 29621 - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 29636 + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): 29622 29637 dependencies: 29623 29638 '@antfu/utils': 0.7.10 29624 29639 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) ··· 29629 29644 perfect-debounce: 1.0.0 29630 29645 picocolors: 1.1.1 29631 29646 sirv: 3.0.2 29632 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) 29647 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) 29633 29648 optionalDependencies: 29634 29649 '@nuxt/kit': 3.15.4(magicast@0.3.5) 29635 29650 transitivePeerDependencies: 29636 29651 - rollup 29637 29652 - supports-color 29638 29653 29639 - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): 29654 + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 29640 29655 dependencies: 29641 29656 '@antfu/utils': 0.7.10 29642 29657 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) ··· 29647 29662 perfect-debounce: 1.0.0 29648 29663 picocolors: 1.1.1 29649 29664 sirv: 3.0.2 29650 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 29665 + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) 29651 29666 optionalDependencies: 29652 29667 '@nuxt/kit': 3.15.4(magicast@0.3.5) 29653 29668 transitivePeerDependencies: 29654 29669 - rollup 29655 29670 - supports-color 29656 29671 29657 - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): 29672 + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): 29658 29673 dependencies: 29659 29674 '@antfu/utils': 0.7.10 29660 29675 '@rollup/pluginutils': 5.2.0(rollup@4.50.0) ··· 29665 29680 perfect-debounce: 1.0.0 29666 29681 picocolors: 1.1.1 29667 29682 sirv: 3.0.2 29668 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) 29683 + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 29669 29684 optionalDependencies: 29670 29685 '@nuxt/kit': 3.15.4(magicast@0.3.5) 29671 29686 transitivePeerDependencies: ··· 29702 29717 - supports-color 29703 29718 - vue 29704 29719 29705 - vite-plugin-vue-inspector@5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 29720 + vite-plugin-vue-inspector@5.3.2(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)): 29706 29721 dependencies: 29707 29722 '@babel/core': 7.28.3 29708 29723 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) ··· 29713 29728 '@vue/compiler-dom': 3.5.21 29714 29729 kolorist: 1.8.0 29715 29730 magic-string: 0.30.18 29716 - vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) 29731 + vite: 5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1) 29717 29732 transitivePeerDependencies: 29718 29733 - supports-color 29719 29734 29720 - vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): 29735 + vite-plugin-vue-inspector@5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1)): 29721 29736 dependencies: 29722 29737 '@babel/core': 7.28.3 29723 29738 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) ··· 29728 29743 '@vue/compiler-dom': 3.5.21 29729 29744 kolorist: 1.8.0 29730 29745 magic-string: 0.30.18 29731 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 29746 + vite: 7.1.2(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1) 29732 29747 transitivePeerDependencies: 29733 29748 - supports-color 29734 29749 29735 - vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): 29750 + vite-plugin-vue-inspector@5.3.2(vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1)): 29736 29751 dependencies: 29737 29752 '@babel/core': 7.28.3 29738 29753 '@babel/plugin-proposal-decorators': 7.28.0(@babel/core@7.28.3) ··· 29743 29758 '@vue/compiler-dom': 3.5.21 29744 29759 kolorist: 1.8.0 29745 29760 magic-string: 0.30.18 29746 - vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) 29761 + vite: 7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.1) 29747 29762 transitivePeerDependencies: 29748 29763 - supports-color 29749 29764 ··· 29866 29881 sass: 1.85.0 29867 29882 terser: 5.39.0 29868 29883 yaml: 2.8.1 29869 - 29870 - vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0): 29871 - dependencies: 29872 - esbuild: 0.25.9 29873 - fdir: 6.5.0(picomatch@4.0.3) 29874 - picomatch: 4.0.3 29875 - postcss: 8.5.6 29876 - rollup: 4.50.0 29877 - tinyglobby: 0.2.15 29878 - optionalDependencies: 29879 - '@types/node': 22.10.5 29880 - fsevents: 2.3.3 29881 - jiti: 2.6.1 29882 - less: 4.2.2 29883 - sass: 1.85.0 29884 - terser: 5.43.1 29885 - yaml: 2.8.0 29886 29884 29887 29885 vite@7.1.5(@types/node@22.10.5)(jiti@2.6.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.1): 29888 29886 dependencies: ··· 30223 30221 30224 30222 webidl-conversions@7.0.0: {} 30225 30223 30226 - webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.0)): 30224 + webpack-dev-middleware@7.4.2(webpack@5.98.0): 30227 30225 dependencies: 30228 30226 colorette: 2.0.20 30229 30227 memfs: 4.38.2 ··· 30234 30232 optionalDependencies: 30235 30233 webpack: 5.98.0(esbuild@0.25.0) 30236 30234 30237 - webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.0)): 30235 + webpack-dev-server@5.2.0(webpack@5.98.0): 30238 30236 dependencies: 30239 30237 '@types/bonjour': 3.5.13 30240 30238 '@types/connect-history-api-fallback': 1.5.4 ··· 30261 30259 serve-index: 1.9.1 30262 30260 sockjs: 0.3.24 30263 30261 spdy: 4.0.2 30264 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 30262 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) 30265 30263 ws: 8.18.3 30266 30264 optionalDependencies: 30267 30265 webpack: 5.98.0(esbuild@0.25.0) ··· 30299 30297 serve-index: 1.9.1 30300 30298 sockjs: 0.3.24 30301 30299 spdy: 4.0.2 30302 - webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.0)) 30300 + webpack-dev-middleware: 7.4.2(webpack@5.98.0) 30303 30301 ws: 8.18.3 30304 30302 optionalDependencies: 30305 30303 webpack: 5.98.0(esbuild@0.25.0)