@bfra.me/api-core 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -0
- package/LICENSE +18 -0
- package/README.md +18 -0
- package/dist/chunk-7NM3WYHE.js +32 -0
- package/dist/chunk-7NM3WYHE.js.map +1 -0
- package/dist/chunk-7QVYU63E.js +7 -0
- package/dist/chunk-7QVYU63E.js.map +1 -0
- package/dist/chunk-HKKQOEV3.js +786 -0
- package/dist/chunk-HKKQOEV3.js.map +1 -0
- package/dist/errors/fetchError.d.ts +13 -0
- package/dist/errors/fetchError.js +8 -0
- package/dist/errors/fetchError.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +59 -0
- package/dist/lib/index.js +16 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/eslint.config.ts +25 -0
- package/package.json +67 -0
- package/src/errors/fetchError.ts +29 -0
- package/src/index.ts +134 -0
- package/src/lib/getJSONSchemaDefaults.ts +77 -0
- package/src/lib/index.ts +7 -0
- package/src/lib/parseResponse.ts +28 -0
- package/src/lib/prepareAuth.ts +107 -0
- package/src/lib/prepareParams.ts +439 -0
- package/src/lib/prepareServer.ts +52 -0
- package/src/types.ts +28 -0
- package/test-utils/CHANGELOG.md +11 -0
- package/test-utils/datasets/real-world-apis.json +8507 -0
- package/test-utils/datasets/refresh-dataset +336 -0
- package/test-utils/definitions/alby.json +5391 -0
- package/test-utils/definitions/auth-quirks.json +62 -0
- package/test-utils/definitions/basiq.json +104 -0
- package/test-utils/definitions/metrotransit.json +318 -0
- package/test-utils/definitions/nested-defaults.json +107 -0
- package/test-utils/definitions/operationid-quirks.json +36 -0
- package/test-utils/definitions/optional-payload.json +57 -0
- package/test-utils/definitions/payloads.json +58 -0
- package/test-utils/definitions/response-title-quirks.json +77 -0
- package/test-utils/definitions/simple.json +291 -0
- package/test-utils/fetch-mock.ts +81 -0
- package/test-utils/fixtures/hello.jp.txt +1 -0
- package/test-utils/fixtures/hello.txt +1 -0
- package/test-utils/fixtures/owlbert-shrub.png +0 -0
- package/test-utils/fixtures/owlbert.png +0 -0
- package/test-utils/index.ts +2 -0
- package/test-utils/load-spec.ts +8 -0
- package/test-utils/node_modules/.bin/tsc +17 -0
- package/test-utils/node_modules/.bin/tsserver +17 -0
- package/test-utils/package.json +20 -0
- package/test-utils/sdks/README.md +3 -0
- package/test-utils/sdks/alby/README.md +23 -0
- package/test-utils/sdks/alby/package.json +55 -0
- package/test-utils/sdks/alby/src/index.ts +18 -0
- package/test-utils/sdks/alby/src/schemas/AmqpExternalRulePatch.ts +92 -0
- package/test-utils/sdks/alby/src/schemas/AmqpExternalRulePost.ts +93 -0
- package/test-utils/sdks/alby/src/schemas/AmqpExternalRuleResponse.ts +143 -0
- package/test-utils/sdks/alby/src/schemas/AmqpRulePatch.ts +76 -0
- package/test-utils/sdks/alby/src/schemas/AmqpRulePost.ts +85 -0
- package/test-utils/sdks/alby/src/schemas/AmqpRuleResponse.ts +124 -0
- package/test-utils/sdks/alby/src/schemas/AppPatch.ts +68 -0
- package/test-utils/sdks/alby/src/schemas/AppPkcs12.ts +22 -0
- package/test-utils/sdks/alby/src/schemas/AppPost.ts +71 -0
- package/test-utils/sdks/alby/src/schemas/AppResponse.ts +69 -0
- package/test-utils/sdks/alby/src/schemas/AwsAccessKeys.ts +28 -0
- package/test-utils/sdks/alby/src/schemas/AwsAccessKeysResponse.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/AwsAssumeRole.ts +23 -0
- package/test-utils/sdks/alby/src/schemas/AwsKinesisRulePatch.ts +90 -0
- package/test-utils/sdks/alby/src/schemas/AwsKinesisRulePost.ts +103 -0
- package/test-utils/sdks/alby/src/schemas/AwsKinesisRuleResponse.ts +142 -0
- package/test-utils/sdks/alby/src/schemas/AwsLambdaRulePatch.ts +90 -0
- package/test-utils/sdks/alby/src/schemas/AwsLambdaRulePost.ts +90 -0
- package/test-utils/sdks/alby/src/schemas/AwsLambdaRuleResponse.ts +132 -0
- package/test-utils/sdks/alby/src/schemas/AwsSqsRulePatch.ts +86 -0
- package/test-utils/sdks/alby/src/schemas/AwsSqsRulePost.ts +98 -0
- package/test-utils/sdks/alby/src/schemas/AwsSqsRuleResponse.ts +137 -0
- package/test-utils/sdks/alby/src/schemas/AzureFunctionRulePatch.ts +96 -0
- package/test-utils/sdks/alby/src/schemas/AzureFunctionRulePost.ts +106 -0
- package/test-utils/sdks/alby/src/schemas/AzureFunctionRuleResponse.ts +145 -0
- package/test-utils/sdks/alby/src/schemas/CloudflareWorkerRulePatch.ts +74 -0
- package/test-utils/sdks/alby/src/schemas/CloudflareWorkerRulePost.ts +83 -0
- package/test-utils/sdks/alby/src/schemas/CloudflareWorkerRuleResponse.ts +125 -0
- package/test-utils/sdks/alby/src/schemas/DeleteAppsAppIdNamespacesNamespaceId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/DeleteAppsAppIdQueuesQueueId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/DeleteAppsAppIdRulesRuleId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/DeleteAppsId.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/Error.ts +39 -0
- package/test-utils/sdks/alby/src/schemas/GetAccountsAccountIdApps.ts +29 -0
- package/test-utils/sdks/alby/src/schemas/GetAppsAppIdKeys.ts +29 -0
- package/test-utils/sdks/alby/src/schemas/GetAppsAppIdNamespaces.ts +29 -0
- package/test-utils/sdks/alby/src/schemas/GetAppsAppIdQueues.ts +29 -0
- package/test-utils/sdks/alby/src/schemas/GetAppsAppIdRules.ts +29 -0
- package/test-utils/sdks/alby/src/schemas/GetAppsAppIdRulesRuleId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/GoogleCloudFunctionRulePatch.ts +100 -0
- package/test-utils/sdks/alby/src/schemas/GoogleCloudFunctionRulePost.ts +100 -0
- package/test-utils/sdks/alby/src/schemas/GoogleCloudFunctionRuleResponse.ts +150 -0
- package/test-utils/sdks/alby/src/schemas/HttpRulePatch.ts +89 -0
- package/test-utils/sdks/alby/src/schemas/HttpRulePost.ts +100 -0
- package/test-utils/sdks/alby/src/schemas/HttpRuleResponse.ts +138 -0
- package/test-utils/sdks/alby/src/schemas/IftttRulePatch.ts +59 -0
- package/test-utils/sdks/alby/src/schemas/IftttRulePost.ts +62 -0
- package/test-utils/sdks/alby/src/schemas/IftttRuleResponse.ts +101 -0
- package/test-utils/sdks/alby/src/schemas/KeyPatch.ts +34 -0
- package/test-utils/sdks/alby/src/schemas/KeyPost.ts +39 -0
- package/test-utils/sdks/alby/src/schemas/KeyResponse.ts +63 -0
- package/test-utils/sdks/alby/src/schemas/Me.ts +98 -0
- package/test-utils/sdks/alby/src/schemas/NamespacePatch.ts +49 -0
- package/test-utils/sdks/alby/src/schemas/NamespacePost.ts +59 -0
- package/test-utils/sdks/alby/src/schemas/NamespaceResponse.ts +70 -0
- package/test-utils/sdks/alby/src/schemas/PatchAppsAppIdKeysKeyId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/PatchAppsAppIdNamespacesNamespaceId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/PatchAppsAppIdRulesRuleId.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/PatchAppsId.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/PostAccountsAccountIdApps.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/PostAppsAppIdKeys.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/PostAppsAppIdKeysKeyIdRevoke.ts +26 -0
- package/test-utils/sdks/alby/src/schemas/PostAppsAppIdNamespaces.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/PostAppsAppIdQueues.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/PostAppsAppIdRules.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/PostAppsIdPkcs12.ts +20 -0
- package/test-utils/sdks/alby/src/schemas/Queue.ts +43 -0
- package/test-utils/sdks/alby/src/schemas/QueueResponse.ts +185 -0
- package/test-utils/sdks/alby/src/schemas/RulePatch.ts +46 -0
- package/test-utils/sdks/alby/src/schemas/RulePost.ts +49 -0
- package/test-utils/sdks/alby/src/schemas/RuleResponse.ts +46 -0
- package/test-utils/sdks/alby/src/schemas/RuleSource.ts +30 -0
- package/test-utils/sdks/alby/src/schemas/UnsupportedRuleResponse.ts +98 -0
- package/test-utils/sdks/alby/src/schemas/ZapierRulePatch.ts +74 -0
- package/test-utils/sdks/alby/src/schemas/ZapierRulePost.ts +83 -0
- package/test-utils/sdks/alby/src/schemas/ZapierRuleResponse.ts +122 -0
- package/test-utils/sdks/alby/src/schemas.ts +77 -0
- package/test-utils/sdks/alby/src/sdk.ts +381 -0
- package/test-utils/sdks/alby/src/types.ts +84 -0
- package/test-utils/sdks/alby/tsconfig.json +12 -0
- package/test-utils/sdks/metrotransit/README.md +22 -0
- package/test-utils/sdks/metrotransit/package.json +55 -0
- package/test-utils/sdks/metrotransit/src/index.ts +12 -0
- package/test-utils/sdks/metrotransit/src/schemas/Agency.ts +19 -0
- package/test-utils/sdks/metrotransit/src/schemas/AlertMessage.ts +18 -0
- package/test-utils/sdks/metrotransit/src/schemas/Departure.ts +78 -0
- package/test-utils/sdks/metrotransit/src/schemas/Direction.ts +19 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripAgencies.ts +12 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripDirectionsRouteId.ts +28 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripRouteIdDirectionIdPlaceCode.ts +30 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripRoutes.ts +12 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripStopId.ts +20 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripStopsRouteIdDirectionId.ts +34 -0
- package/test-utils/sdks/metrotransit/src/schemas/GetNextripVehiclesRouteId.ts +28 -0
- package/test-utils/sdks/metrotransit/src/schemas/NexTripResult.ts +34 -0
- package/test-utils/sdks/metrotransit/src/schemas/Place.ts +21 -0
- package/test-utils/sdks/metrotransit/src/schemas/ProblemDetails.ts +40 -0
- package/test-utils/sdks/metrotransit/src/schemas/Route.ts +25 -0
- package/test-utils/sdks/metrotransit/src/schemas/Stop.ts +27 -0
- package/test-utils/sdks/metrotransit/src/schemas/Vehicle.ts +61 -0
- package/test-utils/sdks/metrotransit/src/schemas.ts +18 -0
- package/test-utils/sdks/metrotransit/src/sdk.ts +107 -0
- package/test-utils/sdks/metrotransit/src/types.ts +23 -0
- package/test-utils/sdks/metrotransit/tsconfig.json +12 -0
- package/test-utils/sdks/operationid-quirks/README.md +22 -0
- package/test-utils/sdks/operationid-quirks/package.json +50 -0
- package/test-utils/sdks/operationid-quirks/src/index.ts +9 -0
- package/test-utils/sdks/operationid-quirks/src/sdk.ts +107 -0
- package/test-utils/sdks/operationid-quirks/tsconfig.json +12 -0
- package/test-utils/sdks/optional-payload/README.md +14 -0
- package/test-utils/sdks/optional-payload/package.json +55 -0
- package/test-utils/sdks/optional-payload/src/index.ts +9 -0
- package/test-utils/sdks/optional-payload/src/schemas/UpdatePetWithForm.ts +35 -0
- package/test-utils/sdks/optional-payload/src/schemas.ts +2 -0
- package/test-utils/sdks/optional-payload/src/sdk.ts +82 -0
- package/test-utils/sdks/optional-payload/src/types.ts +5 -0
- package/test-utils/sdks/optional-payload/tsconfig.json +12 -0
- package/test-utils/sdks/petstore/LICENSE +97 -0
- package/test-utils/sdks/petstore/README.md +23 -0
- package/test-utils/sdks/petstore/package.json +56 -0
- package/test-utils/sdks/petstore/src/index.ts +17 -0
- package/test-utils/sdks/petstore/src/schemas/ApiResponse.ts +18 -0
- package/test-utils/sdks/petstore/src/schemas/Category.ts +15 -0
- package/test-utils/sdks/petstore/src/schemas/CreateUsersWithArrayInput.ts +10 -0
- package/test-utils/sdks/petstore/src/schemas/CreateUsersWithListInput.ts +10 -0
- package/test-utils/sdks/petstore/src/schemas/DeleteOrder.ts +22 -0
- package/test-utils/sdks/petstore/src/schemas/DeletePet.ts +31 -0
- package/test-utils/sdks/petstore/src/schemas/DeleteUser.ts +20 -0
- package/test-utils/sdks/petstore/src/schemas/FindPetsByStatus.ts +38 -0
- package/test-utils/sdks/petstore/src/schemas/FindPetsByTags.ts +32 -0
- package/test-utils/sdks/petstore/src/schemas/GetInventory.ts +13 -0
- package/test-utils/sdks/petstore/src/schemas/GetOrderById.ts +23 -0
- package/test-utils/sdks/petstore/src/schemas/GetPetById.ts +21 -0
- package/test-utils/sdks/petstore/src/schemas/GetUserByName.ts +20 -0
- package/test-utils/sdks/petstore/src/schemas/LoginUser.ts +32 -0
- package/test-utils/sdks/petstore/src/schemas/Order.ts +37 -0
- package/test-utils/sdks/petstore/src/schemas/Pet.ts +53 -0
- package/test-utils/sdks/petstore/src/schemas/Tag.ts +15 -0
- package/test-utils/sdks/petstore/src/schemas/UpdatePetWithForm.ts +35 -0
- package/test-utils/sdks/petstore/src/schemas/UpdateUser.ts +20 -0
- package/test-utils/sdks/petstore/src/schemas/UploadFile.ts +36 -0
- package/test-utils/sdks/petstore/src/schemas/User.ts +35 -0
- package/test-utils/sdks/petstore/src/schemas.ts +22 -0
- package/test-utils/sdks/petstore/src/sdk.ts +248 -0
- package/test-utils/sdks/petstore/src/types.ts +29 -0
- package/test-utils/sdks/petstore/tsconfig.json +12 -0
- package/test-utils/sdks/readme/README.md +23 -0
- package/test-utils/sdks/readme/package.json +55 -0
- package/test-utils/sdks/readme/src/index.ts +13 -0
- package/test-utils/sdks/readme/src/schemas/Apply.ts +61 -0
- package/test-utils/sdks/readme/src/schemas/Category.ts +24 -0
- package/test-utils/sdks/readme/src/schemas/Changelog.ts +36 -0
- package/test-utils/sdks/readme/src/schemas/CondensedProjectData.ts +25 -0
- package/test-utils/sdks/readme/src/schemas/CreateCategory.ts +21 -0
- package/test-utils/sdks/readme/src/schemas/CreateCustomPage.ts +22 -0
- package/test-utils/sdks/readme/src/schemas/CreateDoc.ts +40 -0
- package/test-utils/sdks/readme/src/schemas/CreateVersion.ts +33 -0
- package/test-utils/sdks/readme/src/schemas/CustomPage.ts +33 -0
- package/test-utils/sdks/readme/src/schemas/DeleteApiSpecification.ts +39 -0
- package/test-utils/sdks/readme/src/schemas/DeleteCategory.ts +37 -0
- package/test-utils/sdks/readme/src/schemas/DeleteChangelog.ts +20 -0
- package/test-utils/sdks/readme/src/schemas/DeleteCustomPage.ts +39 -0
- package/test-utils/sdks/readme/src/schemas/DeleteDoc.ts +53 -0
- package/test-utils/sdks/readme/src/schemas/DeleteVersion.ts +42 -0
- package/test-utils/sdks/readme/src/schemas/DocSchemaPost.ts +135 -0
- package/test-utils/sdks/readme/src/schemas/DocSchemaPut.ts +62 -0
- package/test-utils/sdks/readme/src/schemas/DocSchemaResponse.ts +54 -0
- package/test-utils/sdks/readme/src/schemas/ErrorApikeyEmpty.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorApikeyMismatch.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorApikeyNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorCategoryInvalid.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorCategoryNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorCustompageInvalid.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorCustompageNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorDocInvalid.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorDocNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorRegistryNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecFileEmpty.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecIdDuplicate.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecIdInvalid.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecInvalid.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecInvalidSchema.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecTimeout.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorSpecVersionNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionCantDemoteStable.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionCantRemoveStable.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionDuplicate.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionEmpty.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionForkEmpty.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionForkNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/ErrorVersionNotfound.ts +49 -0
- package/test-utils/sdks/readme/src/schemas/GetApiRegistry.ts +27 -0
- package/test-utils/sdks/readme/src/schemas/GetApiSchema.ts +10 -0
- package/test-utils/sdks/readme/src/schemas/GetApiSpecification.ts +74 -0
- package/test-utils/sdks/readme/src/schemas/GetCategories.ts +57 -0
- package/test-utils/sdks/readme/src/schemas/GetCategory.ts +37 -0
- package/test-utils/sdks/readme/src/schemas/GetCategoryDocs.ts +37 -0
- package/test-utils/sdks/readme/src/schemas/GetChangelog.ts +20 -0
- package/test-utils/sdks/readme/src/schemas/GetChangelogs.ts +43 -0
- package/test-utils/sdks/readme/src/schemas/GetCustomPage.ts +39 -0
- package/test-utils/sdks/readme/src/schemas/GetCustomPages.ts +60 -0
- package/test-utils/sdks/readme/src/schemas/GetDoc.ts +53 -0
- package/test-utils/sdks/readme/src/schemas/GetOpenRoles.ts +12 -0
- package/test-utils/sdks/readme/src/schemas/GetProductionDoc.ts +53 -0
- package/test-utils/sdks/readme/src/schemas/GetProject.ts +22 -0
- package/test-utils/sdks/readme/src/schemas/GetVersion.ts +42 -0
- package/test-utils/sdks/readme/src/schemas/GetVersions.ts +22 -0
- package/test-utils/sdks/readme/src/schemas/JobOpening.ts +52 -0
- package/test-utils/sdks/readme/src/schemas/SearchDocs.ts +53 -0
- package/test-utils/sdks/readme/src/schemas/UpdateApiSpecification.ts +67 -0
- package/test-utils/sdks/readme/src/schemas/UpdateCategory.ts +37 -0
- package/test-utils/sdks/readme/src/schemas/UpdateChangelog.ts +20 -0
- package/test-utils/sdks/readme/src/schemas/UpdateCustomPage.ts +39 -0
- package/test-utils/sdks/readme/src/schemas/UpdateDoc.ts +53 -0
- package/test-utils/sdks/readme/src/schemas/UpdateVersion.ts +42 -0
- package/test-utils/sdks/readme/src/schemas/UploadApiSpecification.ts +64 -0
- package/test-utils/sdks/readme/src/schemas/Version.ts +40 -0
- package/test-utils/sdks/readme/src/schemas.ts +70 -0
- package/test-utils/sdks/readme/src/sdk.ts +477 -0
- package/test-utils/sdks/readme/src/types.ts +120 -0
- package/test-utils/sdks/readme/tsconfig.json +12 -0
- package/test-utils/sdks/response-title-quirks/README.md +14 -0
- package/test-utils/sdks/response-title-quirks/package.json +55 -0
- package/test-utils/sdks/response-title-quirks/src/index.ts +9 -0
- package/test-utils/sdks/response-title-quirks/src/schemas/GetAnything.ts +60 -0
- package/test-utils/sdks/response-title-quirks/src/schemas.ts +2 -0
- package/test-utils/sdks/response-title-quirks/src/sdk.ts +76 -0
- package/test-utils/sdks/response-title-quirks/src/types.ts +5 -0
- package/test-utils/sdks/response-title-quirks/tsconfig.json +12 -0
- package/test-utils/sdks/simple/README.md +14 -0
- package/test-utils/sdks/simple/package.json +55 -0
- package/test-utils/sdks/simple/src/index.ts +10 -0
- package/test-utils/sdks/simple/src/schemas/Category.ts +15 -0
- package/test-utils/sdks/simple/src/schemas/FindPetsByStatus.ts +38 -0
- package/test-utils/sdks/simple/src/schemas/Pet.ts +53 -0
- package/test-utils/sdks/simple/src/schemas/Tag.ts +15 -0
- package/test-utils/sdks/simple/src/schemas.ts +5 -0
- package/test-utils/sdks/simple/src/sdk.ts +81 -0
- package/test-utils/sdks/simple/src/types.ts +8 -0
- package/test-utils/sdks/simple/tsconfig.json +12 -0
- package/test-utils/sdks/star-trek/README.md +22 -0
- package/test-utils/sdks/star-trek/package.json +55 -0
- package/test-utils/sdks/star-trek/src/index.ts +9 -0
- package/test-utils/sdks/star-trek/src/schemas/AnimalBase.ts +41 -0
- package/test-utils/sdks/star-trek/src/schemas/AnimalBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/AnimalFull.ts +41 -0
- package/test-utils/sdks/star-trek/src/schemas/AnimalFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/AstronomicalObjectBase.ts +27 -0
- package/test-utils/sdks/star-trek/src/schemas/AstronomicalObjectBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/AstronomicalObjectFull.ts +32 -0
- package/test-utils/sdks/star-trek/src/schemas/AstronomicalObjectFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/AstronomicalObjectHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/AstronomicalObjectType.ts +36 -0
- package/test-utils/sdks/star-trek/src/schemas/BloodType.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/BookBase.ts +120 -0
- package/test-utils/sdks/star-trek/src/schemas/BookBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/BookCollectionBase.ts +51 -0
- package/test-utils/sdks/star-trek/src/schemas/BookCollectionBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/BookCollectionFull.ts +98 -0
- package/test-utils/sdks/star-trek/src/schemas/BookCollectionFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/BookFull.ts +182 -0
- package/test-utils/sdks/star-trek/src/schemas/BookFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/BookSeriesBase.ts +57 -0
- package/test-utils/sdks/star-trek/src/schemas/BookSeriesBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/BookSeriesFull.ts +81 -0
- package/test-utils/sdks/star-trek/src/schemas/BookSeriesFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterBase.ts +104 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterFull.ts +152 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterRelation.ts +17 -0
- package/test-utils/sdks/star-trek/src/schemas/CharacterSpecies.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicCollectionBase.ts +71 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicCollectionBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicCollectionFull.ts +123 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicCollectionFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicSeriesBase.ts +75 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicSeriesBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicSeriesFull.ts +99 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicSeriesFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicStripBase.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicStripBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicStripFull.ts +85 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicStripFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicsBase.ts +75 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicsBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicsFull.ts +127 -0
- package/test-utils/sdks/star-trek/src/schemas/ComicsFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/CompanyBase.ts +89 -0
- package/test-utils/sdks/star-trek/src/schemas/CompanyBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/CompanyFull.ts +89 -0
- package/test-utils/sdks/star-trek/src/schemas/CompanyFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/CompanyHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/ConflictBase.ts +49 -0
- package/test-utils/sdks/star-trek/src/schemas/ConflictBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ConflictFull.ts +78 -0
- package/test-utils/sdks/star-trek/src/schemas/ConflictFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/ContentLanguage.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/ContentRating.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ContentRatingSystem.ts +35 -0
- package/test-utils/sdks/star-trek/src/schemas/Country.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/ElementBase.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/ElementBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ElementFull.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/ElementFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/EpisodeBase.ts +82 -0
- package/test-utils/sdks/star-trek/src/schemas/EpisodeBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/EpisodeFull.ts +125 -0
- package/test-utils/sdks/star-trek/src/schemas/EpisodeFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/Error.ts +17 -0
- package/test-utils/sdks/star-trek/src/schemas/FoodBase.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/FoodBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/FoodFull.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/FoodFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/Gender.ts +11 -0
- package/test-utils/sdks/star-trek/src/schemas/Genre.ts +17 -0
- package/test-utils/sdks/star-trek/src/schemas/GetAnimal.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetAnimalSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetAstronomicalobject.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetAstronomicalobjectSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetBook.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetBookSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetBookcollection.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetBookcollectionSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetBookseries.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetBookseriesSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetCharacter.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetCharacterSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComiccollection.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComiccollectionSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComics.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComicsSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComicseries.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComicseriesSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComicstrip.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetComicstripSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetCompany.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetCompanySearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetConflict.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetConflictSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetElement.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetElementSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetEpisode.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetEpisodeSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetFood.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetFoodSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetLiterature.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetLiteratureSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetLocation.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetLocationSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMagazine.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMagazineSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMagazineseries.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMagazineseriesSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMaterial.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMaterialSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMedicalcondition.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMedicalconditionSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMovie.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetMovieSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetOccupation.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetOccupationSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetOrganization.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetOrganizationSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetPerformer.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetPerformerSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSeason.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSeasonSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSeries.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSeriesSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSoundtrack.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSoundtrackSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSpacecraft.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSpacecraftSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSpacecraftclass.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSpacecraftclassSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSpecies.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetSpeciesSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetStaff.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetStaffSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTechnology.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTechnologySearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTitle.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTitleSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTradingcard.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTradingcardSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTradingcarddeck.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTradingcarddeckSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTradingcardset.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetTradingcardsetSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetVideogame.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetVideogameSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetVideorelease.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetVideoreleaseSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/GetWeapon.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/GetWeaponSearch.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/LiteratureBase.ts +45 -0
- package/test-utils/sdks/star-trek/src/schemas/LiteratureBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/LiteratureFull.ts +45 -0
- package/test-utils/sdks/star-trek/src/schemas/LiteratureFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/LocationBase.ts +113 -0
- package/test-utils/sdks/star-trek/src/schemas/LocationBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/LocationFull.ts +113 -0
- package/test-utils/sdks/star-trek/src/schemas/LocationFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineBase.ts +53 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineFull.ts +72 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineSeriesBase.ts +41 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineSeriesBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineSeriesFull.ts +60 -0
- package/test-utils/sdks/star-trek/src/schemas/MagazineSeriesFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/MaritalStatus.ts +17 -0
- package/test-utils/sdks/star-trek/src/schemas/MaterialBase.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/MaterialBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/MaterialFull.ts +61 -0
- package/test-utils/sdks/star-trek/src/schemas/MaterialFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/MedicalConditionBase.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/MedicalConditionBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/MedicalConditionFull.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/MedicalConditionFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/MovieBase.ts +87 -0
- package/test-utils/sdks/star-trek/src/schemas/MovieBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/MovieFull.ts +139 -0
- package/test-utils/sdks/star-trek/src/schemas/MovieFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/OccupationBase.ts +33 -0
- package/test-utils/sdks/star-trek/src/schemas/OccupationBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/OccupationFull.ts +40 -0
- package/test-utils/sdks/star-trek/src/schemas/OccupationFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/OrganizationBase.ts +69 -0
- package/test-utils/sdks/star-trek/src/schemas/OrganizationBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/OrganizationFull.ts +76 -0
- package/test-utils/sdks/star-trek/src/schemas/OrganizationFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/OrganizationHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/PerformerBase.ts +98 -0
- package/test-utils/sdks/star-trek/src/schemas/PerformerBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/PerformerFull.ts +136 -0
- package/test-utils/sdks/star-trek/src/schemas/PerformerFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/Platform.ts +17 -0
- package/test-utils/sdks/star-trek/src/schemas/PostAnimalSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostAstronomicalobjectSearch.ts +53 -0
- package/test-utils/sdks/star-trek/src/schemas/PostBookSearch.ts +141 -0
- package/test-utils/sdks/star-trek/src/schemas/PostBookcollectionSearch.ts +85 -0
- package/test-utils/sdks/star-trek/src/schemas/PostBookseriesSearch.ts +83 -0
- package/test-utils/sdks/star-trek/src/schemas/PostCharacterSearch.ts +69 -0
- package/test-utils/sdks/star-trek/src/schemas/PostComiccollectionSearch.ts +89 -0
- package/test-utils/sdks/star-trek/src/schemas/PostComicsSearch.ts +93 -0
- package/test-utils/sdks/star-trek/src/schemas/PostComicseriesSearch.ts +93 -0
- package/test-utils/sdks/star-trek/src/schemas/PostComicstripSearch.ts +75 -0
- package/test-utils/sdks/star-trek/src/schemas/PostCompanySearch.ts +113 -0
- package/test-utils/sdks/star-trek/src/schemas/PostConflictSearch.ts +75 -0
- package/test-utils/sdks/star-trek/src/schemas/PostElementSearch.ts +77 -0
- package/test-utils/sdks/star-trek/src/schemas/PostEpisodeSearch.ts +113 -0
- package/test-utils/sdks/star-trek/src/schemas/PostFoodSearch.ts +85 -0
- package/test-utils/sdks/star-trek/src/schemas/PostLiteratureSearch.ts +69 -0
- package/test-utils/sdks/star-trek/src/schemas/PostLocationSearch.ts +137 -0
- package/test-utils/sdks/star-trek/src/schemas/PostMagazineSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostMagazineseriesSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostMaterialSearch.ts +85 -0
- package/test-utils/sdks/star-trek/src/schemas/PostMedicalconditionSearch.ts +49 -0
- package/test-utils/sdks/star-trek/src/schemas/PostMovieSearch.ts +75 -0
- package/test-utils/sdks/star-trek/src/schemas/PostOccupationSearch.ts +57 -0
- package/test-utils/sdks/star-trek/src/schemas/PostOrganizationSearch.ts +93 -0
- package/test-utils/sdks/star-trek/src/schemas/PostPerformerSearch.ts +133 -0
- package/test-utils/sdks/star-trek/src/schemas/PostSeasonSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostSeriesSearch.ts +89 -0
- package/test-utils/sdks/star-trek/src/schemas/PostSoundtrackSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostSpacecraftSearch.ts +45 -0
- package/test-utils/sdks/star-trek/src/schemas/PostSpacecraftclassSearch.ts +53 -0
- package/test-utils/sdks/star-trek/src/schemas/PostSpeciesSearch.ts +93 -0
- package/test-utils/sdks/star-trek/src/schemas/PostStaffSearch.ts +301 -0
- package/test-utils/sdks/star-trek/src/schemas/PostTechnologySearch.ts +125 -0
- package/test-utils/sdks/star-trek/src/schemas/PostTitleSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostTradingcardSearch.ts +53 -0
- package/test-utils/sdks/star-trek/src/schemas/PostTradingcarddeckSearch.ts +49 -0
- package/test-utils/sdks/star-trek/src/schemas/PostTradingcardsetSearch.ts +119 -0
- package/test-utils/sdks/star-trek/src/schemas/PostVideogameSearch.ts +55 -0
- package/test-utils/sdks/star-trek/src/schemas/PostVideoreleaseSearch.ts +65 -0
- package/test-utils/sdks/star-trek/src/schemas/PostWeaponSearch.ts +73 -0
- package/test-utils/sdks/star-trek/src/schemas/ProductionRunUnit.ts +11 -0
- package/test-utils/sdks/star-trek/src/schemas/Reference.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/ReferenceType.ts +11 -0
- package/test-utils/sdks/star-trek/src/schemas/ResponsePage.ts +42 -0
- package/test-utils/sdks/star-trek/src/schemas/ResponseSort.ts +16 -0
- package/test-utils/sdks/star-trek/src/schemas/ResponseSortClause.ts +25 -0
- package/test-utils/sdks/star-trek/src/schemas/ResponseSortDirection.ts +11 -0
- package/test-utils/sdks/star-trek/src/schemas/SeasonBase.ts +32 -0
- package/test-utils/sdks/star-trek/src/schemas/SeasonBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/SeasonFull.ts +38 -0
- package/test-utils/sdks/star-trek/src/schemas/SeasonFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/SeasonHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/SeriesBase.ts +60 -0
- package/test-utils/sdks/star-trek/src/schemas/SeriesBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/SeriesFull.ts +72 -0
- package/test-utils/sdks/star-trek/src/schemas/SeriesFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/SeriesHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/SoundtrackBase.ts +30 -0
- package/test-utils/sdks/star-trek/src/schemas/SoundtrackBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/SoundtrackFull.ts +59 -0
- package/test-utils/sdks/star-trek/src/schemas/SoundtrackFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftBase.ts +39 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftClassBase.ts +48 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftClassBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftClassFull.ts +60 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftClassFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftClassHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftFull.ts +45 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/SpacecraftType.ts +17 -0
- package/test-utils/sdks/star-trek/src/schemas/SpeciesBase.ts +73 -0
- package/test-utils/sdks/star-trek/src/schemas/SpeciesBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/SpeciesFull.ts +79 -0
- package/test-utils/sdks/star-trek/src/schemas/SpeciesFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/SpeciesHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/StaffBase.ts +266 -0
- package/test-utils/sdks/star-trek/src/schemas/StaffBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/StaffFull.ts +323 -0
- package/test-utils/sdks/star-trek/src/schemas/StaffFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/StaffHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/TechnologyBase.ts +101 -0
- package/test-utils/sdks/star-trek/src/schemas/TechnologyBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/TechnologyFull.ts +101 -0
- package/test-utils/sdks/star-trek/src/schemas/TechnologyFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/TitleBase.ts +41 -0
- package/test-utils/sdks/star-trek/src/schemas/TitleBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/TitleFull.ts +48 -0
- package/test-utils/sdks/star-trek/src/schemas/TitleFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardBase.ts +38 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardDeckBase.ts +28 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardDeckBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardDeckFull.ts +34 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardDeckFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardDeckHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardFull.ts +38 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardSetBase.ts +62 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardSetBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardSetFull.ts +86 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardSetFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/TradingCardSetHeader.ts +21 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoGameBase.ts +48 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoGameBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoGameFull.ts +84 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoGameFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoReleaseBase.ts +127 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoReleaseBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoReleaseFormat.ts +23 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoReleaseFull.ts +155 -0
- package/test-utils/sdks/star-trek/src/schemas/VideoReleaseFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas/WeaponBase.ts +49 -0
- package/test-utils/sdks/star-trek/src/schemas/WeaponBaseResponse.ts +20 -0
- package/test-utils/sdks/star-trek/src/schemas/WeaponFull.ts +49 -0
- package/test-utils/sdks/star-trek/src/schemas/WeaponFullResponse.ts +12 -0
- package/test-utils/sdks/star-trek/src/schemas.ts +314 -0
- package/test-utils/sdks/star-trek/src/sdk.ts +1032 -0
- package/test-utils/sdks/star-trek/src/types.ts +490 -0
- package/test-utils/sdks/star-trek/tsconfig.json +12 -0
- package/test-utils/tsconfig.json +9 -0
- package/tsconfig.eslint.json +8 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +31 -0
@@ -0,0 +1,439 @@
|
|
1
|
+
import type {ReadStream} from 'node:fs'
|
2
|
+
import type {Operation} from 'oas/operation'
|
3
|
+
import type {ParameterObject, SchemaObject} from 'oas/types'
|
4
|
+
|
5
|
+
import stream from 'node:stream'
|
6
|
+
|
7
|
+
import caseless from 'caseless'
|
8
|
+
// `get-stream` is included in our bundle, see `tsup.config.ts`
|
9
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
10
|
+
import {getStreamAsBuffer} from 'get-stream'
|
11
|
+
import lodashMerge from 'lodash.merge'
|
12
|
+
import removeUndefinedObjects from 'remove-undefined-objects'
|
13
|
+
|
14
|
+
import getJSONSchemaDefaults from './getJSONSchemaDefaults.js'
|
15
|
+
|
16
|
+
// These headers are normally only defined by the OpenAPI definition but we allow the user to
|
17
|
+
// manually supply them in their `metadata` parameter if they wish.
|
18
|
+
const specialHeaders = ['accept', 'authorization']
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Extract all available parameters from an operations Parameter Object into a digestable array
|
22
|
+
* that we can use to apply to the request.
|
23
|
+
*
|
24
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject}
|
25
|
+
* @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterObject}
|
26
|
+
*/
|
27
|
+
function digestParameters(parameters: ParameterObject[]): Record<string, ParameterObject> {
|
28
|
+
return parameters.reduce((prev, param) => {
|
29
|
+
if ('$ref' in param || 'allOf' in param || 'anyOf' in param || 'oneOf' in param) {
|
30
|
+
throw new Error(
|
31
|
+
"The OpenAPI document for this operation wasn't dereferenced before processing.",
|
32
|
+
)
|
33
|
+
} else if (param.name in prev) {
|
34
|
+
throw new Error(
|
35
|
+
`The operation you are using has the same parameter, ${param.name}, spread across multiple entry points. We unfortunately can't handle this right now.`,
|
36
|
+
)
|
37
|
+
}
|
38
|
+
|
39
|
+
return Object.assign(prev, {[param.name]: param})
|
40
|
+
}, {})
|
41
|
+
}
|
42
|
+
|
43
|
+
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isempty
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
45
|
+
function isEmpty(obj: any) {
|
46
|
+
return [Object, Array].includes((obj || {}).constructor) && !Object.entries(obj || {}).length
|
47
|
+
}
|
48
|
+
|
49
|
+
function isObject(thing: unknown) {
|
50
|
+
if (thing instanceof stream.Readable) {
|
51
|
+
return false
|
52
|
+
}
|
53
|
+
|
54
|
+
return typeof thing === 'object' && thing !== null && !Array.isArray(thing)
|
55
|
+
}
|
56
|
+
|
57
|
+
function isPrimitive(obj: unknown) {
|
58
|
+
return obj === null || typeof obj === 'number' || typeof obj === 'string'
|
59
|
+
}
|
60
|
+
|
61
|
+
function merge(src: unknown, target: unknown) {
|
62
|
+
if (Array.isArray(target)) {
|
63
|
+
// @todo we need to add support for merging array defaults with array body/metadata arguments
|
64
|
+
return target
|
65
|
+
} else if (!isObject(target)) {
|
66
|
+
return target
|
67
|
+
}
|
68
|
+
|
69
|
+
return lodashMerge(src, target)
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Ingest a file path or readable stream into a common object that we can later use to process it
|
74
|
+
* into a parameters object for making an API request.
|
75
|
+
*
|
76
|
+
*/
|
77
|
+
async function processFile(
|
78
|
+
paramName: string | undefined,
|
79
|
+
file: ReadStream | string,
|
80
|
+
): Promise<{base64?: string; buffer?: Buffer; filename: string; paramName?: string} | undefined> {
|
81
|
+
const fs = await import('node:fs')
|
82
|
+
const path = await import('node:path')
|
83
|
+
const {default: DatauriParser} = await import('datauri/parser.js')
|
84
|
+
const {default: datauri} = await import('datauri/sync.js')
|
85
|
+
if (typeof file === 'string') {
|
86
|
+
// In order to support relative pathed files, we need to attempt to resolve them.
|
87
|
+
const resolvedFile = path.resolve(file)
|
88
|
+
|
89
|
+
return new Promise((resolve, reject) => {
|
90
|
+
fs.stat(resolvedFile, async err => {
|
91
|
+
if (err) {
|
92
|
+
if (err.code === 'ENOENT') {
|
93
|
+
// It's less than ideal for us to handle files that don't exist like this but because
|
94
|
+
// `file` is a string it might actually be the full text contents of the file and not
|
95
|
+
// actually a path.
|
96
|
+
//
|
97
|
+
// We also can't really regex to see if `file` *looks*` like a path because one should be
|
98
|
+
// able to pass in a relative `owlbert.png` (instead of `./owlbert.png`) and though that
|
99
|
+
// doesn't *look* like a path, it is one that should still work.
|
100
|
+
return resolve(undefined)
|
101
|
+
}
|
102
|
+
|
103
|
+
return reject(err)
|
104
|
+
}
|
105
|
+
|
106
|
+
const fileMetadata = await datauri(resolvedFile)
|
107
|
+
const payloadFilename = encodeURIComponent(path.basename(resolvedFile))
|
108
|
+
|
109
|
+
return resolve({
|
110
|
+
paramName,
|
111
|
+
base64: fileMetadata?.content?.replace(';base64', `;name=${payloadFilename};base64`),
|
112
|
+
filename: payloadFilename,
|
113
|
+
buffer: fileMetadata.buffer,
|
114
|
+
})
|
115
|
+
})
|
116
|
+
})
|
117
|
+
} else if (file instanceof stream.Readable) {
|
118
|
+
return getStreamAsBuffer(file).then(buffer => {
|
119
|
+
const filePath = file.path as string
|
120
|
+
const parser = new DatauriParser()
|
121
|
+
const base64 = parser.format(filePath, buffer).content
|
122
|
+
const payloadFilename = encodeURIComponent(path.basename(filePath))
|
123
|
+
|
124
|
+
return {
|
125
|
+
paramName,
|
126
|
+
base64: base64?.replace(';base64', `;name=${payloadFilename};base64`),
|
127
|
+
filename: payloadFilename,
|
128
|
+
buffer,
|
129
|
+
}
|
130
|
+
})
|
131
|
+
}
|
132
|
+
|
133
|
+
return Promise.reject(
|
134
|
+
new TypeError(
|
135
|
+
paramName
|
136
|
+
? `The data supplied for the \`${paramName}\` request body parameter is not a file handler that we support.`
|
137
|
+
: 'The data supplied for the request body payload is not a file handler that we support.',
|
138
|
+
),
|
139
|
+
)
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* With potentially supplied body and/or metadata we need to run through them against a given API
|
144
|
+
* operation to see what's what and prepare any available parameters to be used in an API request
|
145
|
+
* with `@readme/oas-to-har`.
|
146
|
+
*
|
147
|
+
*/
|
148
|
+
export default async function prepareParams(
|
149
|
+
operation: Operation,
|
150
|
+
body?: unknown,
|
151
|
+
metadata?: Record<string, unknown>,
|
152
|
+
) {
|
153
|
+
let metadataIntersected = false
|
154
|
+
const digestedParameters = digestParameters(operation.getParameters())
|
155
|
+
const jsonSchema = operation.getParametersAsJSONSchema()
|
156
|
+
|
157
|
+
/**
|
158
|
+
* It might be common for somebody to run `sdk.findPetsByStatus({ status: 'available' }, {})`, in
|
159
|
+
* which case we want to filter out the second (metadata) parameter and treat the first parameter
|
160
|
+
* as the metadata instead. If we don't do this, their supplied `status` metadata will be treated
|
161
|
+
* as a body parameter, and because there's no `status` body parameter, and no supplied metadata
|
162
|
+
* (because it's an empty object), the request won't send a payload.
|
163
|
+
*
|
164
|
+
* @see {@link https://github.com/readmeio/api/issues/449}
|
165
|
+
*/
|
166
|
+
// eslint-disable-next-line no-param-reassign
|
167
|
+
metadata = removeUndefinedObjects(metadata)
|
168
|
+
|
169
|
+
if (!jsonSchema && (body !== undefined || metadata !== undefined)) {
|
170
|
+
let throwNoParamsError = true
|
171
|
+
|
172
|
+
// If this operation doesn't have any parameters for us to transform to JSON Schema but they've
|
173
|
+
// sent us either an `Accept` or `Authorization` header (or both) we should let them do that.
|
174
|
+
// We should, however, only do this check for the `body` parameter as if they've sent this
|
175
|
+
// request both `body` and `metadata` we can reject it outright as the operation won't have any
|
176
|
+
// body data.
|
177
|
+
if (body !== undefined) {
|
178
|
+
if (typeof body === 'object' && body !== null && !Array.isArray(body)) {
|
179
|
+
if (Object.keys(body).length <= 2) {
|
180
|
+
const bodyParams = caseless(body)
|
181
|
+
|
182
|
+
if (specialHeaders.some(header => bodyParams.has(header))) {
|
183
|
+
throwNoParamsError = false
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
if (throwNoParamsError) {
|
190
|
+
throw new Error(
|
191
|
+
"You supplied metadata and/or body data for this operation but it doesn't have any documented parameters or request payloads. If you think this is an error please contact support for the API you're using.",
|
192
|
+
)
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
const jsonSchemaDefaults = jsonSchema ? getJSONSchemaDefaults(jsonSchema) : {}
|
197
|
+
|
198
|
+
const params: {
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
200
|
+
body?: any
|
201
|
+
cookie?: Record<string, boolean | number | string>
|
202
|
+
files?: Record<string, Buffer>
|
203
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
204
|
+
formData?: any
|
205
|
+
header?: Record<string, boolean | number | string>
|
206
|
+
path?: Record<string, boolean | number | string>
|
207
|
+
query?: Record<string, boolean | number | string>
|
208
|
+
server?: {
|
209
|
+
selected: number
|
210
|
+
variables: Record<string, number | string>
|
211
|
+
}
|
212
|
+
} = jsonSchemaDefaults
|
213
|
+
|
214
|
+
// If a body argument was supplied we need to do a bit of work to see if it's actually a body
|
215
|
+
// argument or metadata because the library lets you supply either a body, metadata, or body with
|
216
|
+
// metadata.
|
217
|
+
if (typeof body !== 'undefined') {
|
218
|
+
if (Array.isArray(body) || isPrimitive(body)) {
|
219
|
+
// If the body param is an array or a primitive then we know it's absolutely a body because
|
220
|
+
// metadata can only ever be undefined or an object.
|
221
|
+
params.body = merge(params.body, body)
|
222
|
+
} else if (typeof metadata === 'undefined') {
|
223
|
+
// No metadata was explicitly provided so we need to analyze the body to determine if it's a
|
224
|
+
// body or should be actually be treated as metadata.
|
225
|
+
const headerParams = caseless({})
|
226
|
+
Object.entries(digestedParameters).forEach(([paramName, param]) => {
|
227
|
+
// Headers are sent case-insensitive so we need to make sure that we're properly
|
228
|
+
// matching them when detecting what our incoming payload looks like.
|
229
|
+
if (param.in === 'header') {
|
230
|
+
headerParams.set(paramName, '')
|
231
|
+
}
|
232
|
+
})
|
233
|
+
|
234
|
+
// `Accept` and `Authorization` headers can't be defined as normal parameters but we should
|
235
|
+
// always allow the user to supply them if they wish.
|
236
|
+
specialHeaders.forEach(header => {
|
237
|
+
if (!headerParams.has(header)) {
|
238
|
+
headerParams.set(header, '')
|
239
|
+
}
|
240
|
+
})
|
241
|
+
|
242
|
+
const intersection = Object.keys(body as NonNullable<unknown>).filter(value => {
|
243
|
+
if (Object.keys(digestedParameters).includes(value)) {
|
244
|
+
return true
|
245
|
+
} else if (headerParams.has(value)) {
|
246
|
+
return true
|
247
|
+
}
|
248
|
+
|
249
|
+
return false
|
250
|
+
}).length
|
251
|
+
|
252
|
+
// If more than 25% of the body intersects with the parameters that we've got on hand, then
|
253
|
+
// we should treat it as a metadata object and organize into parameters.
|
254
|
+
if (intersection && intersection / Object.keys(body as NonNullable<unknown>).length > 0.25) {
|
255
|
+
/* eslint-disable no-param-reassign */
|
256
|
+
metadataIntersected = true
|
257
|
+
metadata = merge(params.body, body) as Record<string, unknown>
|
258
|
+
body = undefined
|
259
|
+
/* eslint-enable no-param-reassign */
|
260
|
+
} else {
|
261
|
+
// For all other cases, we should just treat the supplied body as a body.
|
262
|
+
params.body = merge(params.body, body)
|
263
|
+
}
|
264
|
+
} else {
|
265
|
+
// Body and metadata were both supplied.
|
266
|
+
params.body = merge(params.body, body)
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
if (!operation.hasRequestBody()) {
|
271
|
+
// If this operation doesn't have any documented request body then we shouldn't be sending
|
272
|
+
// anything.
|
273
|
+
delete params.body
|
274
|
+
} else {
|
275
|
+
if (!('body' in params)) params.body = {}
|
276
|
+
|
277
|
+
// We need to retrieve the request body for this operation to search for any `binary` format
|
278
|
+
// data that the user wants to send so we know what we need to prepare for the final API
|
279
|
+
// request.
|
280
|
+
const payloadJsonSchema = jsonSchema.find(js => js.type === 'body')
|
281
|
+
if (payloadJsonSchema) {
|
282
|
+
if (!params.files) params.files = {}
|
283
|
+
|
284
|
+
const conversions = []
|
285
|
+
|
286
|
+
// @todo add support for `type: array`, `oneOf` and `anyOf`
|
287
|
+
if (payloadJsonSchema.schema?.properties) {
|
288
|
+
Object.entries(payloadJsonSchema.schema?.properties)
|
289
|
+
.filter(([, schema]: [string, SchemaObject]) => schema?.format === 'binary')
|
290
|
+
.filter(([prop]) => Object.keys(params.body).includes(prop))
|
291
|
+
.forEach(([prop]) => {
|
292
|
+
conversions.push(processFile(prop, params.body[prop]))
|
293
|
+
})
|
294
|
+
} else if (payloadJsonSchema.schema?.type === 'string') {
|
295
|
+
if (payloadJsonSchema.schema?.format === 'binary') {
|
296
|
+
conversions.push(processFile(undefined, params.body))
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
await Promise.all(conversions)
|
301
|
+
.then(fileMetadata => fileMetadata.filter(Boolean))
|
302
|
+
.then(fm => {
|
303
|
+
fm.forEach(fileMetadata => {
|
304
|
+
if (!fileMetadata) {
|
305
|
+
// If we don't have any metadata here it's because the file we have is likely
|
306
|
+
// the full string content of the file so since we don't have any filenames to
|
307
|
+
// work with we shouldn't do any additional handling to the `body` or `files`
|
308
|
+
// parameters.
|
309
|
+
return
|
310
|
+
}
|
311
|
+
|
312
|
+
if (fileMetadata.paramName) {
|
313
|
+
params.body[fileMetadata.paramName] = fileMetadata.base64
|
314
|
+
} else {
|
315
|
+
params.body = fileMetadata.base64
|
316
|
+
}
|
317
|
+
|
318
|
+
if (fileMetadata.buffer && params?.files) {
|
319
|
+
params.files[fileMetadata.filename] = fileMetadata.buffer
|
320
|
+
}
|
321
|
+
})
|
322
|
+
})
|
323
|
+
}
|
324
|
+
}
|
325
|
+
|
326
|
+
// Form data should be placed within `formData` instead of `body` for it to properly get picked
|
327
|
+
// up by `fetch-har`.
|
328
|
+
if (operation.isFormUrlEncoded()) {
|
329
|
+
params.formData = merge(params.formData, params.body)
|
330
|
+
delete params.body
|
331
|
+
}
|
332
|
+
|
333
|
+
// Only spend time trying to organize metadata into parameters if we were able to digest
|
334
|
+
// parameters out of the operation schema. If we couldn't digest anything, but metadata was
|
335
|
+
// supplied then we wouldn't know how to send it in the request!
|
336
|
+
if (typeof metadata !== 'undefined') {
|
337
|
+
if (!('cookie' in params)) params.cookie = {}
|
338
|
+
if (!('header' in params)) params.header = {}
|
339
|
+
if (!('path' in params)) params.path = {}
|
340
|
+
if (!('query' in params)) params.query = {}
|
341
|
+
|
342
|
+
Object.entries(digestedParameters).forEach(([paramName, param]) => {
|
343
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
344
|
+
let value: any
|
345
|
+
let metadataHeaderParam
|
346
|
+
if (typeof metadata === 'object' && !isEmpty(metadata)) {
|
347
|
+
if (paramName in metadata) {
|
348
|
+
value = metadata[paramName]
|
349
|
+
metadataHeaderParam = paramName
|
350
|
+
} else if (param.in === 'header') {
|
351
|
+
// Headers are sent case-insensitive so we need to make sure that we're properly
|
352
|
+
// matching them when detecting what our incoming payload looks like.
|
353
|
+
metadataHeaderParam =
|
354
|
+
Object.keys(metadata).find(k => k.toLowerCase() === paramName.toLowerCase()) || ''
|
355
|
+
value = metadata[metadataHeaderParam]
|
356
|
+
}
|
357
|
+
}
|
358
|
+
|
359
|
+
if (value === undefined) {
|
360
|
+
return
|
361
|
+
}
|
362
|
+
|
363
|
+
/* eslint-disable no-param-reassign */
|
364
|
+
switch (param.in) {
|
365
|
+
case 'path':
|
366
|
+
;(params.path as NonNullable<typeof params.path>)[paramName] = value
|
367
|
+
if (metadata?.[paramName]) delete metadata[paramName]
|
368
|
+
break
|
369
|
+
case 'query':
|
370
|
+
;(params.query as NonNullable<typeof params.query>)[paramName] = value
|
371
|
+
if (metadata?.[paramName]) delete metadata[paramName]
|
372
|
+
break
|
373
|
+
case 'header':
|
374
|
+
;(params.header as NonNullable<typeof params.header>)[paramName.toLowerCase()] = value
|
375
|
+
if (metadataHeaderParam && metadata?.[metadataHeaderParam])
|
376
|
+
delete metadata[metadataHeaderParam]
|
377
|
+
break
|
378
|
+
case 'cookie':
|
379
|
+
;(params.cookie as NonNullable<typeof params.cookie>)[paramName] = value
|
380
|
+
if (metadata?.[paramName]) delete metadata[paramName]
|
381
|
+
break
|
382
|
+
default: // no-op
|
383
|
+
}
|
384
|
+
/* eslint-enable no-param-reassign */
|
385
|
+
|
386
|
+
// Because a user might have sent just a metadata object, we want to make sure that we filter
|
387
|
+
// out anything that they sent that is a parameter from also being sent as part of a form
|
388
|
+
// data payload for `x-www-form-urlencoded` requests.
|
389
|
+
if (metadataIntersected && operation.isFormUrlEncoded()) {
|
390
|
+
if (paramName in params.formData) {
|
391
|
+
delete params.formData[paramName]
|
392
|
+
}
|
393
|
+
}
|
394
|
+
})
|
395
|
+
|
396
|
+
// If there's any leftover metadata that hasn't been moved into form data for this request we
|
397
|
+
// need to move it or else it'll get tossed.
|
398
|
+
if (!isEmpty(metadata)) {
|
399
|
+
if (typeof metadata === 'object') {
|
400
|
+
// If the user supplied an `accept` or `authorization` header themselves we should allow it
|
401
|
+
// through. Normally these headers are automatically handled by `@readme/oas-to-har` but in
|
402
|
+
// the event that maybe the user wants to return XML for an API that normally returns JSON
|
403
|
+
// or specify a custom auth header (maybe we can't handle their auth case right) this is the
|
404
|
+
// only way with this library that they can do that.
|
405
|
+
specialHeaders.forEach(headerName => {
|
406
|
+
const headerParam = Object.keys(metadata || {}).find(m => m.toLowerCase() === headerName)
|
407
|
+
if (headerParam) {
|
408
|
+
// this if-statement below is a typeguard
|
409
|
+
if (typeof metadata === 'object') {
|
410
|
+
// this if-statement below is a typeguard
|
411
|
+
if (typeof params.header === 'object') {
|
412
|
+
params.header[headerName] = metadata[headerParam] as string
|
413
|
+
}
|
414
|
+
// eslint-disable-next-line no-param-reassign
|
415
|
+
delete metadata[headerParam]
|
416
|
+
}
|
417
|
+
}
|
418
|
+
})
|
419
|
+
}
|
420
|
+
|
421
|
+
if (operation.isFormUrlEncoded()) {
|
422
|
+
params.formData = merge(params.formData, metadata)
|
423
|
+
} else {
|
424
|
+
// Any other remaining unused metadata will be unused because we don't know where to place
|
425
|
+
// it in the request.
|
426
|
+
}
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
430
|
+
;(['body', 'cookie', 'files', 'formData', 'header', 'path', 'query'] as const).forEach(
|
431
|
+
(type: keyof typeof params) => {
|
432
|
+
if (type in params && isEmpty(params[type])) {
|
433
|
+
delete params[type]
|
434
|
+
}
|
435
|
+
},
|
436
|
+
)
|
437
|
+
|
438
|
+
return params
|
439
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import type Oas from 'oas'
|
2
|
+
|
3
|
+
function stripTrailingSlash(url: string) {
|
4
|
+
if (url[url.length - 1] === '/') {
|
5
|
+
return url.slice(0, -1)
|
6
|
+
}
|
7
|
+
|
8
|
+
return url
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* With an SDK server config and an instance of OAS we should extract and prepare the server and
|
13
|
+
* any server variables to be supplied to `@readme/oas-to-har`.
|
14
|
+
*
|
15
|
+
*/
|
16
|
+
export default function prepareServer(
|
17
|
+
spec: Oas,
|
18
|
+
url: string,
|
19
|
+
variables: Record<string, number | string> = {},
|
20
|
+
) {
|
21
|
+
let serverIdx: number | undefined
|
22
|
+
const sanitizedUrl = stripTrailingSlash(url)
|
23
|
+
;(spec.api.servers || []).forEach((server, i) => {
|
24
|
+
if (server.url === sanitizedUrl) {
|
25
|
+
serverIdx = i
|
26
|
+
}
|
27
|
+
})
|
28
|
+
|
29
|
+
// If we were able to find the passed in server in the OAS servers, we should use that! If we
|
30
|
+
// couldn't and server variables were passed in we should try our best to handle that, otherwise
|
31
|
+
// we should ignore the passed in server and use whever the default from the OAS is.
|
32
|
+
if (serverIdx !== undefined) {
|
33
|
+
return {
|
34
|
+
selected: serverIdx,
|
35
|
+
variables,
|
36
|
+
}
|
37
|
+
} else if (Object.keys(variables).length) {
|
38
|
+
// @todo we should run `oas.replaceUrl(url)` and pass that unto `@readme/oas-to-har`
|
39
|
+
} else {
|
40
|
+
const server = spec.splitVariables(url)
|
41
|
+
if (server) {
|
42
|
+
return {
|
43
|
+
selected: server.selected,
|
44
|
+
variables: server.variables,
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// @todo we should pass `url` directly into `@readme/oas-to-har` as the base URL
|
49
|
+
}
|
50
|
+
|
51
|
+
return false
|
52
|
+
}
|
package/src/types.ts
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
export type {FromSchema} from 'json-schema-to-ts'
|
2
|
+
|
3
|
+
export interface ConfigOptions {
|
4
|
+
/**
|
5
|
+
* Override the default `fetch` request timeout of 30 seconds. This number should be represented
|
6
|
+
* in milliseconds.
|
7
|
+
*/
|
8
|
+
timeout?: number
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @see {@link https://stackoverflow.com/a/39495173}
|
13
|
+
*/
|
14
|
+
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
|
15
|
+
? Acc[number]
|
16
|
+
: Enumerate<N, [...Acc, Acc['length']]>
|
17
|
+
|
18
|
+
export type HTTPMethodRange<F extends number, T extends number> = Exclude<
|
19
|
+
Enumerate<T>,
|
20
|
+
Enumerate<F>
|
21
|
+
>
|
22
|
+
|
23
|
+
export interface FetchResponse<HTTPStatus, Data> {
|
24
|
+
data: Data
|
25
|
+
headers: Headers
|
26
|
+
res: Response
|
27
|
+
status: HTTPStatus
|
28
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# @api/test-utils
|
2
|
+
|
3
|
+
## 0.1.0
|
4
|
+
### Minor Changes
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
- Add a fork of [`@readme/api-core`](https://github.com/readmeio/api/tree/main/packages/core) as `@bfra.me/api-core`:
|
9
|
+
- Use `git subtree` to add `@readme/api-core` and `@api/test-utils` as forks
|
10
|
+
- Patch `@bfra.me/api-core` with readmeio/api#820, to fix issues bundling `@readme/api-core` for the browser
|
11
|
+
- Adjust forked packages to build, lint, and test within the `@bfra.me/works` monorepo (by [@marcusrbrown](https://github.com/marcusrbrown) with [#443](https://github.com/bfra-me/works/pull/443))
|