@fern-api/venus-api-sdk 0.22.4 → 0.22.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +270 -0
- package/dist/cjs/BaseClient.d.ts +17 -4
- package/dist/cjs/BaseClient.js +59 -0
- package/dist/cjs/Client.d.ts +19 -16
- package/dist/cjs/Client.js +15 -50
- package/dist/cjs/api/resources/apiKeys/client/Client.d.ts +16 -17
- package/dist/cjs/api/resources/apiKeys/client/Client.js +41 -34
- package/dist/cjs/api/resources/apiKeys/client/create.js +1 -1
- package/dist/cjs/api/resources/apiKeys/client/getTokenMetadata.js +1 -1
- package/dist/cjs/api/resources/apiKeys/client/getTokensForOrganization.js +1 -1
- package/dist/cjs/api/resources/apiKeys/client/revokeToken.js +1 -1
- package/dist/cjs/api/resources/apiKeys/client/revokeTokenById.js +1 -1
- package/dist/cjs/api/resources/auth/client/Client.d.ts +69 -0
- package/dist/cjs/api/resources/auth/client/Client.js +295 -0
- package/dist/cjs/api/resources/auth/client/getAutopilotToken.d.ts +24 -0
- package/dist/cjs/api/resources/auth/client/getAutopilotToken.js +65 -0
- package/dist/cjs/api/resources/auth/client/getJwt.d.ts +24 -0
- package/dist/cjs/api/resources/auth/client/getJwt.js +65 -0
- package/dist/cjs/api/resources/auth/client/getOrgForGithubOwner.d.ts +19 -0
- package/dist/cjs/api/resources/auth/client/getOrgForGithubOwner.js +55 -0
- package/dist/cjs/api/resources/auth/client/index.d.ts +4 -0
- package/dist/cjs/api/resources/auth/client/index.js +43 -0
- package/dist/cjs/api/resources/auth/client/requests/GetAutopilotTokenRequest.d.ts +22 -0
- package/dist/cjs/api/resources/auth/client/requests/GetAutopilotTokenRequest.js +3 -0
- package/dist/cjs/api/resources/auth/client/requests/GetJwtRequest.d.ts +16 -0
- package/dist/cjs/api/resources/auth/client/requests/GetJwtRequest.js +3 -0
- package/dist/cjs/api/resources/auth/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/auth/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/auth/index.d.ts +2 -0
- package/dist/cjs/api/resources/auth/index.js +18 -0
- package/dist/cjs/api/resources/auth/types/JwtResponse.d.ts +11 -0
- package/dist/cjs/api/resources/auth/types/JwtResponse.js +3 -0
- package/dist/cjs/api/resources/auth/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/auth/types/index.js +17 -0
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/resources/organization/client/Client.d.ts +37 -27
- package/dist/cjs/api/resources/organization/client/Client.js +152 -60
- package/dist/cjs/api/resources/organization/client/addUser.js +1 -1
- package/dist/cjs/api/resources/organization/client/create.js +1 -1
- package/dist/cjs/api/resources/organization/client/delete.js +1 -1
- package/dist/cjs/api/resources/organization/client/get.js +1 -1
- package/dist/cjs/api/resources/organization/client/getByPostmanTeamId.d.ts +24 -0
- package/dist/cjs/api/resources/organization/client/getByPostmanTeamId.js +65 -0
- package/dist/cjs/api/resources/organization/client/getMyOrganizationFromScopedToken.js +1 -1
- package/dist/cjs/api/resources/organization/client/getOrgIdsFromToken.js +1 -1
- package/dist/cjs/api/resources/organization/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/organization/client/index.js +2 -1
- package/dist/cjs/api/resources/organization/client/inviteUser.js +1 -1
- package/dist/cjs/api/resources/organization/client/isMember.js +1 -1
- package/dist/cjs/api/resources/organization/client/removeUser.js +1 -1
- package/dist/cjs/api/resources/organization/client/requests/CreateOrganizationRequest.d.ts +8 -0
- package/dist/cjs/api/resources/organization/client/update.js +1 -1
- package/dist/cjs/api/resources/organization/types/Organization.d.ts +2 -0
- package/dist/cjs/api/resources/registry/client/Client.d.ts +12 -13
- package/dist/cjs/api/resources/registry/client/Client.js +28 -26
- package/dist/cjs/api/resources/registry/client/generateRegistryTokens.d.ts +6 -1
- package/dist/cjs/api/resources/registry/client/generateRegistryTokens.js +11 -1
- package/dist/cjs/api/resources/registry/client/hasRegistryPermission.js +1 -1
- package/dist/cjs/api/resources/registry/client/revokeToken.d.ts +6 -1
- package/dist/cjs/api/resources/registry/client/revokeToken.js +11 -1
- package/dist/cjs/api/resources/user/client/Client.d.ts +12 -13
- package/dist/cjs/api/resources/user/client/Client.js +27 -25
- package/dist/cjs/api/resources/user/client/getMyOrganizations.js +1 -1
- package/dist/cjs/api/resources/user/client/getMyself.js +1 -1
- package/dist/cjs/api/resources/user/client/linkAccounts.js +1 -1
- package/dist/cjs/auth/BearerAuthProvider.d.ts +20 -0
- package/dist/cjs/auth/BearerAuthProvider.js +76 -0
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +5 -0
- package/dist/cjs/core/auth/AuthProvider.d.ts +4 -1
- package/dist/cjs/core/auth/BearerToken.d.ts +3 -1
- package/dist/cjs/core/auth/BearerToken.js +7 -6
- package/dist/cjs/core/auth/NoOpAuthProvider.d.ts +5 -0
- package/dist/cjs/core/auth/NoOpAuthProvider.js +9 -0
- package/dist/cjs/core/auth/index.d.ts +1 -0
- package/dist/cjs/core/auth/index.js +3 -1
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +17 -0
- package/dist/cjs/core/fetcher/BinaryResponse.d.ts +6 -7
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +10 -4
- package/dist/cjs/core/fetcher/Fetcher.js +210 -10
- package/dist/cjs/core/fetcher/getRequestBody.d.ts +1 -1
- package/dist/cjs/core/fetcher/getRequestBody.js +4 -0
- package/dist/cjs/core/fetcher/getResponseBody.js +18 -4
- package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/cjs/core/fetcher/makeRequest.js +0 -2
- package/dist/cjs/core/fetcher/requestWithRetries.js +0 -9
- package/dist/cjs/core/fetcher/signals.d.ts +1 -7
- package/dist/cjs/core/fetcher/signals.js +0 -12
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/core/headers.js +6 -4
- package/dist/cjs/core/index.d.ts +1 -0
- package/dist/cjs/core/index.js +2 -1
- package/dist/cjs/core/logging/exports.d.ts +18 -0
- package/dist/cjs/core/logging/exports.js +45 -0
- package/dist/cjs/core/logging/index.d.ts +1 -0
- package/dist/cjs/core/logging/index.js +17 -0
- package/dist/cjs/core/logging/logger.d.ts +126 -0
- package/dist/cjs/core/logging/logger.js +144 -0
- package/dist/cjs/core/runtime/runtime.js +11 -10
- package/dist/cjs/core/schemas/Schema.d.ts +1 -0
- package/dist/cjs/core/schemas/Schema.js +1 -0
- package/dist/cjs/core/schemas/builders/object/object.js +34 -3
- package/dist/cjs/core/schemas/builders/primitives/index.d.ts +1 -0
- package/dist/cjs/core/schemas/builders/primitives/index.js +3 -1
- package/dist/cjs/core/schemas/builders/primitives/never.d.ts +2 -0
- package/dist/cjs/core/schemas/builders/primitives/never.js +14 -0
- package/dist/cjs/core/url/join.js +0 -1
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/serialization/resources/auth/client/getAutopilotToken.d.ts +10 -0
- package/dist/cjs/serialization/resources/auth/client/getAutopilotToken.js +66 -0
- package/dist/cjs/serialization/resources/auth/client/getJwt.d.ts +10 -0
- package/dist/cjs/serialization/resources/auth/client/getJwt.js +66 -0
- package/dist/cjs/serialization/resources/auth/client/getOrgForGithubOwner.d.ts +8 -0
- package/dist/cjs/serialization/resources/auth/client/getOrgForGithubOwner.js +6 -0
- package/dist/cjs/serialization/resources/auth/client/index.d.ts +4 -0
- package/dist/cjs/serialization/resources/auth/client/index.js +43 -0
- package/dist/cjs/serialization/resources/auth/client/requests/GetAutopilotTokenRequest.d.ts +11 -0
- package/dist/cjs/serialization/resources/auth/client/requests/GetAutopilotTokenRequest.js +43 -0
- package/dist/cjs/serialization/resources/auth/client/requests/GetJwtRequest.d.ts +10 -0
- package/dist/cjs/serialization/resources/auth/client/requests/GetJwtRequest.js +42 -0
- package/dist/cjs/serialization/resources/auth/client/requests/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/auth/client/requests/index.js +7 -0
- package/dist/cjs/serialization/resources/auth/index.d.ts +2 -0
- package/dist/cjs/serialization/resources/auth/index.js +18 -0
- package/dist/cjs/serialization/resources/auth/types/JwtResponse.d.ts +10 -0
- package/dist/cjs/serialization/resources/auth/types/JwtResponse.js +42 -0
- package/dist/cjs/serialization/resources/auth/types/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/auth/types/index.js +17 -0
- package/dist/cjs/serialization/resources/index.d.ts +3 -0
- package/dist/cjs/serialization/resources/index.js +4 -1
- package/dist/cjs/serialization/resources/organization/client/getByPostmanTeamId.d.ts +10 -0
- package/dist/cjs/serialization/resources/organization/client/getByPostmanTeamId.js +66 -0
- package/dist/cjs/serialization/resources/organization/client/index.d.ts +1 -0
- package/dist/cjs/serialization/resources/organization/client/index.js +2 -1
- package/dist/cjs/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +2 -0
- package/dist/cjs/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +2 -0
- package/dist/cjs/serialization/resources/organization/types/Organization.d.ts +1 -0
- package/dist/cjs/serialization/resources/organization/types/Organization.js +1 -0
- package/dist/cjs/serialization/resources/registry/client/generateRegistryTokens.d.ts +4 -1
- package/dist/cjs/serialization/resources/registry/client/generateRegistryTokens.js +3 -0
- package/dist/cjs/serialization/resources/registry/client/revokeToken.d.ts +4 -1
- package/dist/cjs/serialization/resources/registry/client/revokeToken.js +3 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.d.mts +17 -4
- package/dist/esm/BaseClient.mjs +24 -1
- package/dist/esm/Client.d.mts +19 -16
- package/dist/esm/Client.mjs +16 -18
- package/dist/esm/api/resources/apiKeys/client/Client.d.mts +16 -17
- package/dist/esm/api/resources/apiKeys/client/Client.mjs +40 -33
- package/dist/esm/api/resources/apiKeys/client/create.mjs +1 -1
- package/dist/esm/api/resources/apiKeys/client/getTokenMetadata.mjs +1 -1
- package/dist/esm/api/resources/apiKeys/client/getTokensForOrganization.mjs +1 -1
- package/dist/esm/api/resources/apiKeys/client/revokeToken.mjs +1 -1
- package/dist/esm/api/resources/apiKeys/client/revokeTokenById.mjs +1 -1
- package/dist/esm/api/resources/auth/client/Client.d.mts +69 -0
- package/dist/esm/api/resources/auth/client/Client.mjs +258 -0
- package/dist/esm/api/resources/auth/client/getAutopilotToken.d.mts +24 -0
- package/dist/esm/api/resources/auth/client/getAutopilotToken.mjs +29 -0
- package/dist/esm/api/resources/auth/client/getJwt.d.mts +24 -0
- package/dist/esm/api/resources/auth/client/getJwt.mjs +29 -0
- package/dist/esm/api/resources/auth/client/getOrgForGithubOwner.d.mts +19 -0
- package/dist/esm/api/resources/auth/client/getOrgForGithubOwner.mjs +19 -0
- package/dist/esm/api/resources/auth/client/index.d.mts +4 -0
- package/dist/esm/api/resources/auth/client/index.mjs +4 -0
- package/dist/esm/api/resources/auth/client/requests/GetAutopilotTokenRequest.d.mts +22 -0
- package/dist/esm/api/resources/auth/client/requests/GetAutopilotTokenRequest.mjs +2 -0
- package/dist/esm/api/resources/auth/client/requests/GetJwtRequest.d.mts +16 -0
- package/dist/esm/api/resources/auth/client/requests/GetJwtRequest.mjs +2 -0
- package/dist/esm/api/resources/auth/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/auth/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/auth/index.d.mts +2 -0
- package/dist/esm/api/resources/auth/index.mjs +2 -0
- package/dist/esm/api/resources/auth/types/JwtResponse.d.mts +11 -0
- package/dist/esm/api/resources/auth/types/JwtResponse.mjs +2 -0
- package/dist/esm/api/resources/auth/types/index.d.mts +1 -0
- package/dist/esm/api/resources/auth/types/index.mjs +1 -0
- package/dist/esm/api/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/resources/organization/client/Client.d.mts +37 -27
- package/dist/esm/api/resources/organization/client/Client.mjs +151 -59
- package/dist/esm/api/resources/organization/client/addUser.mjs +1 -1
- package/dist/esm/api/resources/organization/client/create.mjs +1 -1
- package/dist/esm/api/resources/organization/client/delete.mjs +1 -1
- package/dist/esm/api/resources/organization/client/get.mjs +1 -1
- package/dist/esm/api/resources/organization/client/getByPostmanTeamId.d.mts +24 -0
- package/dist/esm/api/resources/organization/client/getByPostmanTeamId.mjs +29 -0
- package/dist/esm/api/resources/organization/client/getMyOrganizationFromScopedToken.mjs +1 -1
- package/dist/esm/api/resources/organization/client/getOrgIdsFromToken.mjs +1 -1
- package/dist/esm/api/resources/organization/client/index.d.mts +1 -0
- package/dist/esm/api/resources/organization/client/index.mjs +1 -0
- package/dist/esm/api/resources/organization/client/inviteUser.mjs +1 -1
- package/dist/esm/api/resources/organization/client/isMember.mjs +1 -1
- package/dist/esm/api/resources/organization/client/removeUser.mjs +1 -1
- package/dist/esm/api/resources/organization/client/requests/CreateOrganizationRequest.d.mts +8 -0
- package/dist/esm/api/resources/organization/client/update.mjs +1 -1
- package/dist/esm/api/resources/organization/types/Organization.d.mts +2 -0
- package/dist/esm/api/resources/registry/client/Client.d.mts +12 -13
- package/dist/esm/api/resources/registry/client/Client.mjs +27 -25
- package/dist/esm/api/resources/registry/client/generateRegistryTokens.d.mts +6 -1
- package/dist/esm/api/resources/registry/client/generateRegistryTokens.mjs +11 -1
- package/dist/esm/api/resources/registry/client/hasRegistryPermission.mjs +1 -1
- package/dist/esm/api/resources/registry/client/revokeToken.d.mts +6 -1
- package/dist/esm/api/resources/registry/client/revokeToken.mjs +11 -1
- package/dist/esm/api/resources/user/client/Client.d.mts +12 -13
- package/dist/esm/api/resources/user/client/Client.mjs +26 -24
- package/dist/esm/api/resources/user/client/getMyOrganizations.mjs +1 -1
- package/dist/esm/api/resources/user/client/getMyself.mjs +1 -1
- package/dist/esm/api/resources/user/client/linkAccounts.mjs +1 -1
- package/dist/esm/auth/BearerAuthProvider.d.mts +20 -0
- package/dist/esm/auth/BearerAuthProvider.mjs +39 -0
- package/dist/esm/auth/index.d.mts +1 -0
- package/dist/esm/auth/index.mjs +1 -0
- package/dist/esm/core/auth/AuthProvider.d.mts +4 -1
- package/dist/esm/core/auth/BearerToken.d.mts +3 -1
- package/dist/esm/core/auth/BearerToken.mjs +7 -6
- package/dist/esm/core/auth/NoOpAuthProvider.d.mts +5 -0
- package/dist/esm/core/auth/NoOpAuthProvider.mjs +5 -0
- package/dist/esm/core/auth/index.d.mts +1 -0
- package/dist/esm/core/auth/index.mjs +1 -0
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/fetcher/BinaryResponse.d.mts +6 -7
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +10 -4
- package/dist/esm/core/fetcher/Fetcher.mjs +210 -10
- package/dist/esm/core/fetcher/getRequestBody.d.mts +1 -1
- package/dist/esm/core/fetcher/getRequestBody.mjs +4 -0
- package/dist/esm/core/fetcher/getResponseBody.mjs +18 -4
- package/dist/esm/core/fetcher/makeRequest.d.mts +1 -1
- package/dist/esm/core/fetcher/makeRequest.mjs +0 -2
- package/dist/esm/core/fetcher/requestWithRetries.mjs +0 -9
- package/dist/esm/core/fetcher/signals.d.mts +1 -7
- package/dist/esm/core/fetcher/signals.mjs +0 -12
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/core/headers.mjs +6 -4
- package/dist/esm/core/index.d.mts +1 -0
- package/dist/esm/core/index.mjs +1 -0
- package/dist/esm/core/logging/exports.d.mts +18 -0
- package/dist/esm/core/logging/exports.mjs +9 -0
- package/dist/esm/core/logging/index.d.mts +1 -0
- package/dist/esm/core/logging/index.mjs +1 -0
- package/dist/esm/core/logging/logger.d.mts +126 -0
- package/dist/esm/core/logging/logger.mjs +138 -0
- package/dist/esm/core/runtime/runtime.mjs +11 -10
- package/dist/esm/core/schemas/Schema.d.mts +1 -0
- package/dist/esm/core/schemas/Schema.mjs +1 -0
- package/dist/esm/core/schemas/builders/object/object.mjs +34 -3
- package/dist/esm/core/schemas/builders/primitives/index.d.mts +1 -0
- package/dist/esm/core/schemas/builders/primitives/index.mjs +1 -0
- package/dist/esm/core/schemas/builders/primitives/never.d.mts +2 -0
- package/dist/esm/core/schemas/builders/primitives/never.mjs +11 -0
- package/dist/esm/core/url/join.mjs +0 -1
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/serialization/resources/auth/client/getAutopilotToken.d.mts +10 -0
- package/dist/esm/serialization/resources/auth/client/getAutopilotToken.mjs +30 -0
- package/dist/esm/serialization/resources/auth/client/getJwt.d.mts +10 -0
- package/dist/esm/serialization/resources/auth/client/getJwt.mjs +30 -0
- package/dist/esm/serialization/resources/auth/client/getOrgForGithubOwner.d.mts +8 -0
- package/dist/esm/serialization/resources/auth/client/getOrgForGithubOwner.mjs +3 -0
- package/dist/esm/serialization/resources/auth/client/index.d.mts +4 -0
- package/dist/esm/serialization/resources/auth/client/index.mjs +4 -0
- package/dist/esm/serialization/resources/auth/client/requests/GetAutopilotTokenRequest.d.mts +11 -0
- package/dist/esm/serialization/resources/auth/client/requests/GetAutopilotTokenRequest.mjs +7 -0
- package/dist/esm/serialization/resources/auth/client/requests/GetJwtRequest.d.mts +10 -0
- package/dist/esm/serialization/resources/auth/client/requests/GetJwtRequest.mjs +6 -0
- package/dist/esm/serialization/resources/auth/client/requests/index.d.mts +2 -0
- package/dist/esm/serialization/resources/auth/client/requests/index.mjs +2 -0
- package/dist/esm/serialization/resources/auth/index.d.mts +2 -0
- package/dist/esm/serialization/resources/auth/index.mjs +2 -0
- package/dist/esm/serialization/resources/auth/types/JwtResponse.d.mts +10 -0
- package/dist/esm/serialization/resources/auth/types/JwtResponse.mjs +6 -0
- package/dist/esm/serialization/resources/auth/types/index.d.mts +1 -0
- package/dist/esm/serialization/resources/auth/types/index.mjs +1 -0
- package/dist/esm/serialization/resources/index.d.mts +3 -0
- package/dist/esm/serialization/resources/index.mjs +3 -0
- package/dist/esm/serialization/resources/organization/client/getByPostmanTeamId.d.mts +10 -0
- package/dist/esm/serialization/resources/organization/client/getByPostmanTeamId.mjs +30 -0
- package/dist/esm/serialization/resources/organization/client/index.d.mts +1 -0
- package/dist/esm/serialization/resources/organization/client/index.mjs +1 -0
- package/dist/esm/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.mts +2 -0
- package/dist/esm/serialization/resources/organization/client/requests/CreateOrganizationRequest.mjs +2 -0
- package/dist/esm/serialization/resources/organization/types/Organization.d.mts +1 -0
- package/dist/esm/serialization/resources/organization/types/Organization.mjs +1 -0
- package/dist/esm/serialization/resources/registry/client/generateRegistryTokens.d.mts +4 -1
- package/dist/esm/serialization/resources/registry/client/generateRegistryTokens.mjs +3 -0
- package/dist/esm/serialization/resources/registry/client/revokeToken.d.mts +4 -1
- package/dist/esm/serialization/resources/registry/client/revokeToken.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +8 -3
- package/reference.md +1369 -0
- package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
- package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
- package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
- package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
|
@@ -43,19 +43,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.
|
|
46
|
+
exports.ApiKeysClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
47
48
|
const headers_js_1 = require("../../../../core/headers.js");
|
|
48
49
|
const core = __importStar(require("../../../../core/index.js"));
|
|
49
50
|
const environments = __importStar(require("../../../../environments.js"));
|
|
50
51
|
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
51
52
|
const FernVenusApi = __importStar(require("../../../index.js"));
|
|
52
|
-
class
|
|
53
|
-
constructor(
|
|
54
|
-
this._options =
|
|
53
|
+
class ApiKeysClient {
|
|
54
|
+
constructor(options = {}) {
|
|
55
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
58
|
* @param {FernVenusApi.CreateApiKeyRequest} request
|
|
58
|
-
* @param {
|
|
59
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
60
|
*
|
|
60
61
|
* @example
|
|
61
62
|
* await client.apiKeys.create({
|
|
@@ -72,8 +73,9 @@ class ApiKeys {
|
|
|
72
73
|
}
|
|
73
74
|
__create(request, requestOptions) {
|
|
74
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
76
|
-
const
|
|
76
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
77
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
78
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
77
79
|
const _response = yield core.fetcher({
|
|
78
80
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, "/api-keys/create"),
|
|
79
81
|
method: "POST",
|
|
@@ -88,6 +90,8 @@ class ApiKeys {
|
|
|
88
90
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
89
91
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
90
92
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
93
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
94
|
+
logging: this._options.logging,
|
|
91
95
|
});
|
|
92
96
|
if (_response.ok) {
|
|
93
97
|
return {
|
|
@@ -107,7 +111,7 @@ class ApiKeys {
|
|
|
107
111
|
};
|
|
108
112
|
}
|
|
109
113
|
if (_response.error.reason === "status-code") {
|
|
110
|
-
switch ((
|
|
114
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
111
115
|
case "UnauthorizedError":
|
|
112
116
|
case "OrganizationNotFoundError":
|
|
113
117
|
return {
|
|
@@ -138,7 +142,7 @@ class ApiKeys {
|
|
|
138
142
|
}
|
|
139
143
|
/**
|
|
140
144
|
* @param {FernVenusApi.GetTokenMetadataRequest} request
|
|
141
|
-
* @param {
|
|
145
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
142
146
|
*
|
|
143
147
|
* @example
|
|
144
148
|
* await client.apiKeys.getTokenMetadata({
|
|
@@ -155,8 +159,9 @@ class ApiKeys {
|
|
|
155
159
|
}
|
|
156
160
|
__getTokenMetadata(request, requestOptions) {
|
|
157
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
159
|
-
const
|
|
162
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
163
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
164
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
160
165
|
const _response = yield core.fetcher({
|
|
161
166
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, "/api-keys/metadata"),
|
|
162
167
|
method: "POST",
|
|
@@ -171,6 +176,8 @@ class ApiKeys {
|
|
|
171
176
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
172
177
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
173
178
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
179
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
180
|
+
logging: this._options.logging,
|
|
174
181
|
});
|
|
175
182
|
if (_response.ok) {
|
|
176
183
|
return {
|
|
@@ -190,7 +197,7 @@ class ApiKeys {
|
|
|
190
197
|
};
|
|
191
198
|
}
|
|
192
199
|
if (_response.error.reason === "status-code") {
|
|
193
|
-
switch ((
|
|
200
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
194
201
|
case "UnauthorizedError":
|
|
195
202
|
case "TokenNotFoundError":
|
|
196
203
|
return {
|
|
@@ -221,7 +228,7 @@ class ApiKeys {
|
|
|
221
228
|
}
|
|
222
229
|
/**
|
|
223
230
|
* @param {FernVenusApi.OrganizationId} organizationId
|
|
224
|
-
* @param {
|
|
231
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
225
232
|
*
|
|
226
233
|
* @example
|
|
227
234
|
* await client.apiKeys.getTokensForOrganization("some-org-id")
|
|
@@ -234,8 +241,9 @@ class ApiKeys {
|
|
|
234
241
|
}
|
|
235
242
|
__getTokensForOrganization(organizationId, requestOptions) {
|
|
236
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
238
|
-
const
|
|
244
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
245
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
246
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
239
247
|
const _response = yield core.fetcher({
|
|
240
248
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, `/api-keys/organization/${core.url.encodePathParam(serializers.OrganizationId.jsonOrThrow(organizationId, { omitUndefined: true }))}`),
|
|
241
249
|
method: "GET",
|
|
@@ -244,6 +252,8 @@ class ApiKeys {
|
|
|
244
252
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
245
253
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
246
254
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
255
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
256
|
+
logging: this._options.logging,
|
|
247
257
|
});
|
|
248
258
|
if (_response.ok) {
|
|
249
259
|
return {
|
|
@@ -263,7 +273,7 @@ class ApiKeys {
|
|
|
263
273
|
};
|
|
264
274
|
}
|
|
265
275
|
if (_response.error.reason === "status-code") {
|
|
266
|
-
switch ((
|
|
276
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
267
277
|
case "UnauthorizedError":
|
|
268
278
|
case "OrganizationNotFoundError":
|
|
269
279
|
return {
|
|
@@ -294,7 +304,7 @@ class ApiKeys {
|
|
|
294
304
|
}
|
|
295
305
|
/**
|
|
296
306
|
* @param {FernVenusApi.TokenId} tokenId
|
|
297
|
-
* @param {
|
|
307
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
298
308
|
*
|
|
299
309
|
* @example
|
|
300
310
|
* await client.apiKeys.revokeTokenById("some-token-id")
|
|
@@ -307,8 +317,9 @@ class ApiKeys {
|
|
|
307
317
|
}
|
|
308
318
|
__revokeTokenById(tokenId, requestOptions) {
|
|
309
319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
310
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
311
|
-
const
|
|
320
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
321
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
322
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
312
323
|
const _response = yield core.fetcher({
|
|
313
324
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, `/api-keys/revoke/${core.url.encodePathParam(serializers.TokenId.jsonOrThrow(tokenId, { omitUndefined: true }))}`),
|
|
314
325
|
method: "POST",
|
|
@@ -317,6 +328,8 @@ class ApiKeys {
|
|
|
317
328
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
318
329
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
319
330
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
331
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
332
|
+
logging: this._options.logging,
|
|
320
333
|
});
|
|
321
334
|
if (_response.ok) {
|
|
322
335
|
return {
|
|
@@ -330,7 +343,7 @@ class ApiKeys {
|
|
|
330
343
|
};
|
|
331
344
|
}
|
|
332
345
|
if (_response.error.reason === "status-code") {
|
|
333
|
-
switch ((
|
|
346
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
334
347
|
case "UnauthorizedError":
|
|
335
348
|
case "TokenNotFoundError":
|
|
336
349
|
return {
|
|
@@ -361,7 +374,7 @@ class ApiKeys {
|
|
|
361
374
|
}
|
|
362
375
|
/**
|
|
363
376
|
* @param {FernVenusApi.RevokeApiKeyRequest} request
|
|
364
|
-
* @param {
|
|
377
|
+
* @param {ApiKeysClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
365
378
|
*
|
|
366
379
|
* @example
|
|
367
380
|
* await client.apiKeys.revokeToken({
|
|
@@ -378,8 +391,9 @@ class ApiKeys {
|
|
|
378
391
|
}
|
|
379
392
|
__revokeToken(request, requestOptions) {
|
|
380
393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
381
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
382
|
-
const
|
|
394
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
395
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
396
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
383
397
|
const _response = yield core.fetcher({
|
|
384
398
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, "/api-keys/revoke"),
|
|
385
399
|
method: "POST",
|
|
@@ -394,6 +408,8 @@ class ApiKeys {
|
|
|
394
408
|
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
395
409
|
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
396
410
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
411
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
412
|
+
logging: this._options.logging,
|
|
397
413
|
});
|
|
398
414
|
if (_response.ok) {
|
|
399
415
|
return {
|
|
@@ -407,7 +423,7 @@ class ApiKeys {
|
|
|
407
423
|
};
|
|
408
424
|
}
|
|
409
425
|
if (_response.error.reason === "status-code") {
|
|
410
|
-
switch ((
|
|
426
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
411
427
|
case "UnauthorizedError":
|
|
412
428
|
case "TokenNotFoundError":
|
|
413
429
|
return {
|
|
@@ -436,14 +452,5 @@ class ApiKeys {
|
|
|
436
452
|
};
|
|
437
453
|
});
|
|
438
454
|
}
|
|
439
|
-
_getAuthorizationHeader() {
|
|
440
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
441
|
-
const bearer = yield core.Supplier.get(this._options.token);
|
|
442
|
-
if (bearer != null) {
|
|
443
|
-
return `Bearer ${bearer}`;
|
|
444
|
-
}
|
|
445
|
-
return undefined;
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
455
|
}
|
|
449
|
-
exports.
|
|
456
|
+
exports.ApiKeysClient = ApiKeysClient;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../core/index.js";
|
|
4
|
+
import * as FernVenusApi from "../../../index.js";
|
|
5
|
+
export declare namespace AuthClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class AuthClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<AuthClient.Options>;
|
|
12
|
+
constructor(options?: AuthClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Look up the Fern organization ID for a GitHub owner.
|
|
15
|
+
* This endpoint is unauthenticated and used by Fiddle to look up the
|
|
16
|
+
* centralized protected GitHub orgs mapping.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} githubOwner - The GitHub repo owner (case-insensitive)
|
|
19
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await client.auth.getOrgForGithubOwner("protected-github-owner")
|
|
23
|
+
*/
|
|
24
|
+
getOrgForGithubOwner(githubOwner: string, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<core.APIResponse<FernVenusApi.OrganizationId | undefined, FernVenusApi.auth.getOrgForGithubOwner.Error>>;
|
|
25
|
+
private __getOrgForGithubOwner;
|
|
26
|
+
/**
|
|
27
|
+
* Exchange an autopilot token for a short-lived JWT scoped to an organization.
|
|
28
|
+
* This endpoint is used by automated systems (like Fiddle) to get org-scoped tokens.
|
|
29
|
+
* If a GitHub owner is provided and is in the protected GitHub orgs mapping,
|
|
30
|
+
* the organization ID must match the allowed org for that GitHub owner.
|
|
31
|
+
* The returned token is identical to tokens from getJwt and can be used the same way.
|
|
32
|
+
*
|
|
33
|
+
* @param {FernVenusApi.GetAutopilotTokenRequest} request
|
|
34
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* await client.auth.getAutopilotToken({
|
|
38
|
+
* organizationId: "my-org-id"
|
|
39
|
+
* })
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* await client.auth.getAutopilotToken({
|
|
43
|
+
* organizationId: "wrong-org",
|
|
44
|
+
* githubOwner: "protected-github-owner"
|
|
45
|
+
* })
|
|
46
|
+
*/
|
|
47
|
+
getAutopilotToken(request: FernVenusApi.GetAutopilotTokenRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<core.APIResponse<FernVenusApi.JwtResponse, FernVenusApi.auth.getAutopilotToken.Error>>;
|
|
48
|
+
private __getAutopilotToken;
|
|
49
|
+
/**
|
|
50
|
+
* Exchange a user token for a short-lived JWT scoped to an organization.
|
|
51
|
+
* The user must be a member of the specified organization.
|
|
52
|
+
* The JWT can be used to authenticate requests to other services.
|
|
53
|
+
*
|
|
54
|
+
* @param {FernVenusApi.GetJwtRequest} request
|
|
55
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* await client.auth.getJwt({
|
|
59
|
+
* organizationId: "my-org-id"
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* await client.auth.getJwt({
|
|
64
|
+
* organizationId: "org-user-not-member-of"
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
getJwt(request: FernVenusApi.GetJwtRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<core.APIResponse<FernVenusApi.JwtResponse, FernVenusApi.auth.getJwt.Error>>;
|
|
68
|
+
private __getJwt;
|
|
69
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.AuthClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
48
|
+
const headers_js_1 = require("../../../../core/headers.js");
|
|
49
|
+
const core = __importStar(require("../../../../core/index.js"));
|
|
50
|
+
const environments = __importStar(require("../../../../environments.js"));
|
|
51
|
+
const serializers = __importStar(require("../../../../serialization/index.js"));
|
|
52
|
+
const FernVenusApi = __importStar(require("../../../index.js"));
|
|
53
|
+
class AuthClient {
|
|
54
|
+
constructor(options = {}) {
|
|
55
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Look up the Fern organization ID for a GitHub owner.
|
|
59
|
+
* This endpoint is unauthenticated and used by Fiddle to look up the
|
|
60
|
+
* centralized protected GitHub orgs mapping.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} githubOwner - The GitHub repo owner (case-insensitive)
|
|
63
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* await client.auth.getOrgForGithubOwner("protected-github-owner")
|
|
67
|
+
*/
|
|
68
|
+
getOrgForGithubOwner(githubOwner, requestOptions) {
|
|
69
|
+
return core.HttpResponsePromise.fromPromise(this.__getOrgForGithubOwner(githubOwner, requestOptions));
|
|
70
|
+
}
|
|
71
|
+
__getOrgForGithubOwner(githubOwner, requestOptions) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
74
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
75
|
+
const _response = yield core.fetcher({
|
|
76
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, `/auth/github-owner/${core.url.encodePathParam(githubOwner)}/org`),
|
|
77
|
+
method: "GET",
|
|
78
|
+
headers: _headers,
|
|
79
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
80
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
81
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
82
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
83
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
84
|
+
logging: this._options.logging,
|
|
85
|
+
});
|
|
86
|
+
if (_response.ok) {
|
|
87
|
+
return {
|
|
88
|
+
data: {
|
|
89
|
+
ok: true,
|
|
90
|
+
body: serializers.auth.getOrgForGithubOwner.Response.parseOrThrow(_response.body, {
|
|
91
|
+
unrecognizedObjectKeys: "passthrough",
|
|
92
|
+
allowUnrecognizedUnionMembers: true,
|
|
93
|
+
allowUnrecognizedEnumValues: true,
|
|
94
|
+
skipValidation: true,
|
|
95
|
+
breadcrumbsPrefix: ["response"],
|
|
96
|
+
}),
|
|
97
|
+
headers: _response.headers,
|
|
98
|
+
rawResponse: _response.rawResponse,
|
|
99
|
+
},
|
|
100
|
+
rawResponse: _response.rawResponse,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
data: {
|
|
105
|
+
ok: false,
|
|
106
|
+
error: FernVenusApi.auth.getOrgForGithubOwner.Error._unknown(_response.error),
|
|
107
|
+
rawResponse: _response.rawResponse,
|
|
108
|
+
},
|
|
109
|
+
rawResponse: _response.rawResponse,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Exchange an autopilot token for a short-lived JWT scoped to an organization.
|
|
115
|
+
* This endpoint is used by automated systems (like Fiddle) to get org-scoped tokens.
|
|
116
|
+
* If a GitHub owner is provided and is in the protected GitHub orgs mapping,
|
|
117
|
+
* the organization ID must match the allowed org for that GitHub owner.
|
|
118
|
+
* The returned token is identical to tokens from getJwt and can be used the same way.
|
|
119
|
+
*
|
|
120
|
+
* @param {FernVenusApi.GetAutopilotTokenRequest} request
|
|
121
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* await client.auth.getAutopilotToken({
|
|
125
|
+
* organizationId: "my-org-id"
|
|
126
|
+
* })
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* await client.auth.getAutopilotToken({
|
|
130
|
+
* organizationId: "wrong-org",
|
|
131
|
+
* githubOwner: "protected-github-owner"
|
|
132
|
+
* })
|
|
133
|
+
*/
|
|
134
|
+
getAutopilotToken(request, requestOptions) {
|
|
135
|
+
return core.HttpResponsePromise.fromPromise(this.__getAutopilotToken(request, requestOptions));
|
|
136
|
+
}
|
|
137
|
+
__getAutopilotToken(request, requestOptions) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
140
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
141
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
142
|
+
const _response = yield core.fetcher({
|
|
143
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, "/auth/autopilot-token"),
|
|
144
|
+
method: "POST",
|
|
145
|
+
headers: _headers,
|
|
146
|
+
contentType: "application/json",
|
|
147
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
148
|
+
requestType: "json",
|
|
149
|
+
body: serializers.GetAutopilotTokenRequest.jsonOrThrow(request, {
|
|
150
|
+
unrecognizedObjectKeys: "strip",
|
|
151
|
+
omitUndefined: true,
|
|
152
|
+
}),
|
|
153
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
154
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
155
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
156
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
157
|
+
logging: this._options.logging,
|
|
158
|
+
});
|
|
159
|
+
if (_response.ok) {
|
|
160
|
+
return {
|
|
161
|
+
data: {
|
|
162
|
+
ok: true,
|
|
163
|
+
body: serializers.JwtResponse.parseOrThrow(_response.body, {
|
|
164
|
+
unrecognizedObjectKeys: "passthrough",
|
|
165
|
+
allowUnrecognizedUnionMembers: true,
|
|
166
|
+
allowUnrecognizedEnumValues: true,
|
|
167
|
+
skipValidation: true,
|
|
168
|
+
breadcrumbsPrefix: ["response"],
|
|
169
|
+
}),
|
|
170
|
+
headers: _response.headers,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
172
|
+
},
|
|
173
|
+
rawResponse: _response.rawResponse,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (_response.error.reason === "status-code") {
|
|
177
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
178
|
+
case "UnauthorizedError":
|
|
179
|
+
return {
|
|
180
|
+
data: {
|
|
181
|
+
ok: false,
|
|
182
|
+
error: serializers.auth.getAutopilotToken.Error.parseOrThrow(_response.error.body, {
|
|
183
|
+
unrecognizedObjectKeys: "passthrough",
|
|
184
|
+
allowUnrecognizedUnionMembers: true,
|
|
185
|
+
allowUnrecognizedEnumValues: true,
|
|
186
|
+
skipValidation: true,
|
|
187
|
+
breadcrumbsPrefix: ["response"],
|
|
188
|
+
}),
|
|
189
|
+
rawResponse: _response.rawResponse,
|
|
190
|
+
},
|
|
191
|
+
rawResponse: _response.rawResponse,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
data: {
|
|
197
|
+
ok: false,
|
|
198
|
+
error: FernVenusApi.auth.getAutopilotToken.Error._unknown(_response.error),
|
|
199
|
+
rawResponse: _response.rawResponse,
|
|
200
|
+
},
|
|
201
|
+
rawResponse: _response.rawResponse,
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Exchange a user token for a short-lived JWT scoped to an organization.
|
|
207
|
+
* The user must be a member of the specified organization.
|
|
208
|
+
* The JWT can be used to authenticate requests to other services.
|
|
209
|
+
*
|
|
210
|
+
* @param {FernVenusApi.GetJwtRequest} request
|
|
211
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* await client.auth.getJwt({
|
|
215
|
+
* organizationId: "my-org-id"
|
|
216
|
+
* })
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* await client.auth.getJwt({
|
|
220
|
+
* organizationId: "org-user-not-member-of"
|
|
221
|
+
* })
|
|
222
|
+
*/
|
|
223
|
+
getJwt(request, requestOptions) {
|
|
224
|
+
return core.HttpResponsePromise.fromPromise(this.__getJwt(request, requestOptions));
|
|
225
|
+
}
|
|
226
|
+
__getJwt(request, requestOptions) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
229
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
230
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
231
|
+
const _response = yield core.fetcher({
|
|
232
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FernVenusApiEnvironment.Prod, "/auth/jwt"),
|
|
233
|
+
method: "POST",
|
|
234
|
+
headers: _headers,
|
|
235
|
+
contentType: "application/json",
|
|
236
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
237
|
+
requestType: "json",
|
|
238
|
+
body: serializers.GetJwtRequest.jsonOrThrow(request, {
|
|
239
|
+
unrecognizedObjectKeys: "strip",
|
|
240
|
+
omitUndefined: true,
|
|
241
|
+
}),
|
|
242
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
243
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
244
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
245
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
246
|
+
logging: this._options.logging,
|
|
247
|
+
});
|
|
248
|
+
if (_response.ok) {
|
|
249
|
+
return {
|
|
250
|
+
data: {
|
|
251
|
+
ok: true,
|
|
252
|
+
body: serializers.JwtResponse.parseOrThrow(_response.body, {
|
|
253
|
+
unrecognizedObjectKeys: "passthrough",
|
|
254
|
+
allowUnrecognizedUnionMembers: true,
|
|
255
|
+
allowUnrecognizedEnumValues: true,
|
|
256
|
+
skipValidation: true,
|
|
257
|
+
breadcrumbsPrefix: ["response"],
|
|
258
|
+
}),
|
|
259
|
+
headers: _response.headers,
|
|
260
|
+
rawResponse: _response.rawResponse,
|
|
261
|
+
},
|
|
262
|
+
rawResponse: _response.rawResponse,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
if (_response.error.reason === "status-code") {
|
|
266
|
+
switch ((_k = _response.error.body) === null || _k === void 0 ? void 0 : _k.error) {
|
|
267
|
+
case "UnauthorizedError":
|
|
268
|
+
return {
|
|
269
|
+
data: {
|
|
270
|
+
ok: false,
|
|
271
|
+
error: serializers.auth.getJwt.Error.parseOrThrow(_response.error.body, {
|
|
272
|
+
unrecognizedObjectKeys: "passthrough",
|
|
273
|
+
allowUnrecognizedUnionMembers: true,
|
|
274
|
+
allowUnrecognizedEnumValues: true,
|
|
275
|
+
skipValidation: true,
|
|
276
|
+
breadcrumbsPrefix: ["response"],
|
|
277
|
+
}),
|
|
278
|
+
rawResponse: _response.rawResponse,
|
|
279
|
+
},
|
|
280
|
+
rawResponse: _response.rawResponse,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
data: {
|
|
286
|
+
ok: false,
|
|
287
|
+
error: FernVenusApi.auth.getJwt.Error._unknown(_response.error),
|
|
288
|
+
rawResponse: _response.rawResponse,
|
|
289
|
+
},
|
|
290
|
+
rawResponse: _response.rawResponse,
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
exports.AuthClient = AuthClient;
|