@fern-api/venus-api-sdk 0.13.4 → 0.14.1-1-g78e09da
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/Client.d.ts +7 -3
- package/api/resources/commons/types/OrganizationId.d.ts +1 -1
- package/api/resources/commons/types/OrganizationId.js +1 -2
- package/api/resources/commons/types/UserId.d.ts +1 -1
- package/api/resources/commons/types/UserId.js +1 -2
- package/api/resources/index.js +17 -7
- package/api/resources/organization/client/Client.d.ts +8 -1
- package/api/resources/organization/client/Client.js +66 -109
- package/api/resources/organization/client/addUser.d.ts +1 -1
- package/api/resources/organization/client/addUser.js +17 -7
- package/api/resources/organization/client/create.d.ts +1 -1
- package/api/resources/organization/client/create.js +17 -7
- package/api/resources/organization/client/get.d.ts +1 -1
- package/api/resources/organization/client/get.js +17 -7
- package/api/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +1 -1
- package/api/resources/organization/client/getMyOrganizationFromScopedToken.js +17 -7
- package/api/resources/organization/client/getOrgIdsFromToken.d.ts +1 -1
- package/api/resources/organization/client/getOrgIdsFromToken.js +17 -7
- package/api/resources/organization/client/index.js +17 -7
- package/api/resources/organization/client/inviteUser.d.ts +1 -1
- package/api/resources/organization/client/inviteUser.js +17 -7
- package/api/resources/organization/client/isMember.d.ts +1 -1
- package/api/resources/organization/client/isMember.js +17 -7
- package/api/resources/organization/client/removeUser.d.ts +1 -1
- package/api/resources/organization/client/removeUser.js +17 -7
- package/api/resources/organization/client/requests/CreateOrganizationRequest.d.ts +2 -0
- package/api/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +6 -0
- package/api/resources/organization/client/update.d.ts +1 -1
- package/api/resources/organization/client/update.js +17 -7
- package/api/resources/organization/types/CreateOrganizationResponse.d.ts +12 -0
- package/api/resources/organization/types/CreateOrganizationResponse.js +5 -0
- package/api/resources/organization/types/index.d.ts +1 -0
- package/api/resources/organization/types/index.js +1 -0
- package/api/resources/registry/client/Client.d.ts +4 -0
- package/api/resources/registry/client/Client.js +29 -40
- package/api/resources/registry/client/generateRegistryTokens.d.ts +1 -1
- package/api/resources/registry/client/generateRegistryTokens.js +17 -7
- package/api/resources/registry/client/hasRegistryPermission.d.ts +1 -1
- package/api/resources/registry/client/hasRegistryPermission.js +17 -7
- package/api/resources/registry/client/index.js +17 -7
- package/api/resources/registry/client/revokeToken.d.ts +1 -1
- package/api/resources/registry/client/revokeToken.js +17 -7
- package/api/resources/registry/types/RegistryToken.d.ts +1 -1
- package/api/resources/user/client/Client.d.ts +4 -0
- package/api/resources/user/client/Client.js +23 -25
- package/api/resources/user/client/getMyOrganizations.d.ts +1 -1
- package/api/resources/user/client/getMyOrganizations.js +17 -7
- package/api/resources/user/client/getMyself.d.ts +1 -1
- package/api/resources/user/client/getMyself.js +17 -7
- package/api/resources/user/client/index.js +17 -7
- package/core/auth/BearerToken.d.ts +1 -1
- package/core/fetcher/APIResponse.d.ts +1 -1
- package/core/fetcher/Fetcher.d.ts +3 -3
- package/core/fetcher/Fetcher.js +6 -5
- package/core/fetcher/Supplier.d.ts +1 -1
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/createRequestUrl.js +1 -2
- package/core/fetcher/getFetchFn.js +18 -9
- package/core/fetcher/getHeader.js +1 -2
- package/core/fetcher/getRequestBody.js +5 -5
- package/core/fetcher/getResponseBody.js +4 -2
- package/core/fetcher/makeRequest.d.ts +1 -1
- package/core/fetcher/requestWithRetries.js +17 -9
- package/core/fetcher/signals.d.ts +0 -1
- package/core/fetcher/signals.js +2 -3
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
- package/core/index.js +17 -7
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/runtime/runtime.d.ts +1 -1
- package/core/runtime/runtime.js +51 -41
- package/core/schemas/Schema.d.ts +7 -5
- package/core/schemas/Schema.js +2 -0
- package/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/core/schemas/builders/bigint/bigint.js +22 -19
- package/core/schemas/builders/date/date.js +1 -2
- package/core/schemas/builders/enum/enum.js +1 -2
- package/core/schemas/builders/lazy/lazy.d.ts +1 -1
- package/core/schemas/builders/lazy/lazy.js +3 -4
- package/core/schemas/builders/lazy/lazyObject.js +1 -2
- package/core/schemas/builders/list/list.js +1 -2
- package/core/schemas/builders/literals/booleanLiteral.js +1 -2
- package/core/schemas/builders/literals/stringLiteral.js +1 -2
- package/core/schemas/builders/object/object.d.ts +1 -1
- package/core/schemas/builders/object/object.js +31 -3
- package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
- package/core/schemas/builders/object/property.js +2 -3
- package/core/schemas/builders/object/types.d.ts +16 -11
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
- package/core/schemas/builders/object-like/types.d.ts +1 -1
- package/core/schemas/builders/record/record.js +2 -4
- package/core/schemas/builders/record/types.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
- package/core/schemas/builders/set/set.js +1 -2
- package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
- package/core/schemas/builders/union/discriminant.js +1 -2
- package/core/schemas/builders/union/types.d.ts +6 -6
- package/core/schemas/builders/union/union.d.ts +1 -1
- package/core/schemas/builders/union/union.js +1 -2
- package/core/schemas/utils/MaybePromise.d.ts +1 -1
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
- package/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
- package/core/schemas/utils/entries.d.ts +1 -1
- package/core/schemas/utils/entries.js +1 -2
- package/core/schemas/utils/filterObject.d.ts +1 -1
- package/core/schemas/utils/filterObject.js +1 -2
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
- package/core/schemas/utils/isPlainObject.js +1 -2
- package/core/schemas/utils/keys.d.ts +1 -1
- package/core/schemas/utils/keys.js +1 -2
- package/core/schemas/utils/maybeSkipValidation.js +1 -2
- package/core/schemas/utils/partition.js +1 -2
- package/dist/Client.d.ts +7 -3
- package/dist/api/resources/commons/types/OrganizationId.d.ts +1 -1
- package/dist/api/resources/commons/types/OrganizationId.js +1 -2
- package/dist/api/resources/commons/types/UserId.d.ts +1 -1
- package/dist/api/resources/commons/types/UserId.js +1 -2
- package/dist/api/resources/index.js +17 -7
- package/dist/api/resources/organization/client/Client.d.ts +8 -1
- package/dist/api/resources/organization/client/Client.js +66 -109
- package/dist/api/resources/organization/client/addUser.d.ts +1 -1
- package/dist/api/resources/organization/client/addUser.js +17 -7
- package/dist/api/resources/organization/client/create.d.ts +1 -1
- package/dist/api/resources/organization/client/create.js +17 -7
- package/dist/api/resources/organization/client/get.d.ts +1 -1
- package/dist/api/resources/organization/client/get.js +17 -7
- package/dist/api/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +1 -1
- package/dist/api/resources/organization/client/getMyOrganizationFromScopedToken.js +17 -7
- package/dist/api/resources/organization/client/getOrgIdsFromToken.d.ts +1 -1
- package/dist/api/resources/organization/client/getOrgIdsFromToken.js +17 -7
- package/dist/api/resources/organization/client/index.js +17 -7
- package/dist/api/resources/organization/client/inviteUser.d.ts +1 -1
- package/dist/api/resources/organization/client/inviteUser.js +17 -7
- package/dist/api/resources/organization/client/isMember.d.ts +1 -1
- package/dist/api/resources/organization/client/isMember.js +17 -7
- package/dist/api/resources/organization/client/removeUser.d.ts +1 -1
- package/dist/api/resources/organization/client/removeUser.js +17 -7
- package/dist/api/resources/organization/client/requests/CreateOrganizationRequest.d.ts +2 -0
- package/dist/api/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +6 -0
- package/dist/api/resources/organization/client/update.d.ts +1 -1
- package/dist/api/resources/organization/client/update.js +17 -7
- package/dist/api/resources/organization/types/CreateOrganizationResponse.d.ts +12 -0
- package/dist/api/resources/organization/types/CreateOrganizationResponse.js +5 -0
- package/dist/api/resources/organization/types/index.d.ts +1 -0
- package/dist/api/resources/organization/types/index.js +1 -0
- package/dist/api/resources/registry/client/Client.d.ts +4 -0
- package/dist/api/resources/registry/client/Client.js +29 -40
- package/dist/api/resources/registry/client/generateRegistryTokens.d.ts +1 -1
- package/dist/api/resources/registry/client/generateRegistryTokens.js +17 -7
- package/dist/api/resources/registry/client/hasRegistryPermission.d.ts +1 -1
- package/dist/api/resources/registry/client/hasRegistryPermission.js +17 -7
- package/dist/api/resources/registry/client/index.js +17 -7
- package/dist/api/resources/registry/client/revokeToken.d.ts +1 -1
- package/dist/api/resources/registry/client/revokeToken.js +17 -7
- package/dist/api/resources/registry/types/RegistryToken.d.ts +1 -1
- package/dist/api/resources/user/client/Client.d.ts +4 -0
- package/dist/api/resources/user/client/Client.js +23 -25
- package/dist/api/resources/user/client/getMyOrganizations.d.ts +1 -1
- package/dist/api/resources/user/client/getMyOrganizations.js +17 -7
- package/dist/api/resources/user/client/getMyself.d.ts +1 -1
- package/dist/api/resources/user/client/getMyself.js +17 -7
- package/dist/api/resources/user/client/index.js +17 -7
- package/dist/core/auth/BearerToken.d.ts +1 -1
- package/dist/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.d.ts +3 -3
- package/dist/core/fetcher/Fetcher.js +6 -5
- package/dist/core/fetcher/Supplier.d.ts +1 -1
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/core/fetcher/createRequestUrl.js +1 -2
- package/dist/core/fetcher/getFetchFn.js +18 -9
- package/dist/core/fetcher/getHeader.js +1 -2
- package/dist/core/fetcher/getRequestBody.js +5 -5
- package/dist/core/fetcher/getResponseBody.js +4 -2
- package/dist/core/fetcher/makeRequest.d.ts +1 -1
- package/dist/core/fetcher/requestWithRetries.js +17 -9
- package/dist/core/fetcher/signals.d.ts +0 -1
- package/dist/core/fetcher/signals.js +2 -3
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
- package/dist/core/index.js +17 -7
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/runtime.d.ts +1 -1
- package/dist/core/runtime/runtime.js +51 -41
- package/dist/core/schemas/Schema.d.ts +7 -5
- package/dist/core/schemas/Schema.js +2 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/dist/core/schemas/builders/bigint/bigint.js +22 -19
- package/dist/core/schemas/builders/date/date.js +1 -2
- package/dist/core/schemas/builders/enum/enum.js +1 -2
- package/dist/core/schemas/builders/lazy/lazy.d.ts +1 -1
- package/dist/core/schemas/builders/lazy/lazy.js +3 -4
- package/dist/core/schemas/builders/lazy/lazyObject.js +1 -2
- package/dist/core/schemas/builders/list/list.js +1 -2
- package/dist/core/schemas/builders/literals/booleanLiteral.js +1 -2
- package/dist/core/schemas/builders/literals/stringLiteral.js +1 -2
- package/dist/core/schemas/builders/object/object.d.ts +1 -1
- package/dist/core/schemas/builders/object/object.js +31 -3
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +3 -3
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +1 -2
- package/dist/core/schemas/builders/object/property.js +2 -3
- package/dist/core/schemas/builders/object/types.d.ts +16 -11
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +2 -3
- package/dist/core/schemas/builders/object-like/types.d.ts +1 -1
- package/dist/core/schemas/builders/record/record.js +2 -4
- package/dist/core/schemas/builders/record/types.d.ts +2 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +67 -4
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +1 -2
- package/dist/core/schemas/builders/set/set.js +1 -2
- package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -4
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +1 -2
- package/dist/core/schemas/builders/union/discriminant.js +1 -2
- package/dist/core/schemas/builders/union/types.d.ts +6 -6
- package/dist/core/schemas/builders/union/union.d.ts +1 -1
- package/dist/core/schemas/builders/union/union.js +1 -2
- package/dist/core/schemas/utils/MaybePromise.d.ts +1 -1
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +4 -4
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +1 -2
- package/dist/core/schemas/utils/entries.d.ts +1 -1
- package/dist/core/schemas/utils/entries.js +1 -2
- package/dist/core/schemas/utils/filterObject.d.ts +1 -1
- package/dist/core/schemas/utils/filterObject.js +1 -2
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +1 -2
- package/dist/core/schemas/utils/isPlainObject.js +1 -2
- package/dist/core/schemas/utils/keys.d.ts +1 -1
- package/dist/core/schemas/utils/keys.js +1 -2
- package/dist/core/schemas/utils/maybeSkipValidation.js +1 -2
- package/dist/core/schemas/utils/partition.js +1 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +19 -8
- package/dist/serialization/resources/commons/types/OrganizationId.js +17 -7
- package/dist/serialization/resources/commons/types/UserId.js +17 -7
- package/dist/serialization/resources/index.js +17 -7
- package/dist/serialization/resources/organization/client/addUser.js +17 -7
- package/dist/serialization/resources/organization/client/create.js +17 -7
- package/dist/serialization/resources/organization/client/get.js +17 -7
- package/dist/serialization/resources/organization/client/getMyOrganizationFromScopedToken.js +17 -7
- package/dist/serialization/resources/organization/client/getOrgIdsFromToken.js +17 -7
- package/dist/serialization/resources/organization/client/index.js +17 -7
- package/dist/serialization/resources/organization/client/inviteUser.js +17 -7
- package/dist/serialization/resources/organization/client/isMember.js +17 -7
- package/dist/serialization/resources/organization/client/removeUser.js +17 -7
- package/dist/serialization/resources/organization/client/requests/AddUserToOrgRequest.js +17 -7
- package/dist/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +1 -0
- package/dist/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +18 -7
- package/dist/serialization/resources/organization/client/requests/InviteUserToOrgRequest.js +17 -7
- package/dist/serialization/resources/organization/client/requests/RemoveUserFromOrgRequest.js +17 -7
- package/dist/serialization/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +2 -0
- package/dist/serialization/resources/organization/client/requests/UpdateOrganizationRequest.js +19 -7
- package/dist/serialization/resources/organization/client/update.js +17 -7
- package/dist/serialization/resources/organization/types/CreateOrganizationResponse.d.ts +13 -0
- package/dist/serialization/resources/organization/types/CreateOrganizationResponse.js +44 -0
- package/dist/serialization/resources/organization/types/LightweightUser.js +17 -7
- package/dist/serialization/resources/organization/types/Organization.js +17 -7
- package/dist/serialization/resources/organization/types/index.d.ts +1 -0
- package/dist/serialization/resources/organization/types/index.js +1 -0
- package/dist/serialization/resources/registry/client/generateRegistryTokens.js +17 -7
- package/dist/serialization/resources/registry/client/hasRegistryPermission.js +17 -7
- package/dist/serialization/resources/registry/client/index.js +17 -7
- package/dist/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.js +17 -7
- package/dist/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.js +17 -7
- package/dist/serialization/resources/registry/client/requests/RevokeTokenRequest.js +17 -7
- package/dist/serialization/resources/registry/client/revokeToken.js +17 -7
- package/dist/serialization/resources/registry/types/MavenRegistryToken.js +17 -7
- package/dist/serialization/resources/registry/types/NpmRegistryToken.js +17 -7
- package/dist/serialization/resources/registry/types/PypiRegistryToken.js +17 -7
- package/dist/serialization/resources/registry/types/RegistryToken.js +17 -7
- package/dist/serialization/resources/registry/types/RegistryTokens.js +17 -7
- package/dist/serialization/resources/user/types/OrganizationsPage.js +17 -7
- package/dist/serialization/resources/user/types/User.js +17 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +19 -8
- package/{jest.config.js → jest.config.mjs} +4 -1
- package/package.json +16 -17
- package/scripts/rename-to-esm-files.js +115 -0
- package/serialization/resources/commons/types/OrganizationId.js +17 -7
- package/serialization/resources/commons/types/UserId.js +17 -7
- package/serialization/resources/index.js +17 -7
- package/serialization/resources/organization/client/addUser.js +17 -7
- package/serialization/resources/organization/client/create.js +17 -7
- package/serialization/resources/organization/client/get.js +17 -7
- package/serialization/resources/organization/client/getMyOrganizationFromScopedToken.js +17 -7
- package/serialization/resources/organization/client/getOrgIdsFromToken.js +17 -7
- package/serialization/resources/organization/client/index.js +17 -7
- package/serialization/resources/organization/client/inviteUser.js +17 -7
- package/serialization/resources/organization/client/isMember.js +17 -7
- package/serialization/resources/organization/client/removeUser.js +17 -7
- package/serialization/resources/organization/client/requests/AddUserToOrgRequest.js +17 -7
- package/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +1 -0
- package/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +18 -7
- package/serialization/resources/organization/client/requests/InviteUserToOrgRequest.js +17 -7
- package/serialization/resources/organization/client/requests/RemoveUserFromOrgRequest.js +17 -7
- package/serialization/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +2 -0
- package/serialization/resources/organization/client/requests/UpdateOrganizationRequest.js +19 -7
- package/serialization/resources/organization/client/update.js +17 -7
- package/serialization/resources/organization/types/CreateOrganizationResponse.d.ts +13 -0
- package/serialization/resources/organization/types/CreateOrganizationResponse.js +44 -0
- package/serialization/resources/organization/types/LightweightUser.js +17 -7
- package/serialization/resources/organization/types/Organization.js +17 -7
- package/serialization/resources/organization/types/index.d.ts +1 -0
- package/serialization/resources/organization/types/index.js +1 -0
- package/serialization/resources/registry/client/generateRegistryTokens.js +17 -7
- package/serialization/resources/registry/client/hasRegistryPermission.js +17 -7
- package/serialization/resources/registry/client/index.js +17 -7
- package/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.js +17 -7
- package/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.js +17 -7
- package/serialization/resources/registry/client/requests/RevokeTokenRequest.js +17 -7
- package/serialization/resources/registry/client/revokeToken.js +17 -7
- package/serialization/resources/registry/types/MavenRegistryToken.js +17 -7
- package/serialization/resources/registry/types/NpmRegistryToken.js +17 -7
- package/serialization/resources/registry/types/PypiRegistryToken.js +17 -7
- package/serialization/resources/registry/types/RegistryToken.js +17 -7
- package/serialization/resources/registry/types/RegistryTokens.js +17 -7
- package/serialization/resources/user/types/OrganizationsPage.js +17 -7
- package/serialization/resources/user/types/User.js +17 -7
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.Error = void 0;
|
|
30
40
|
const FernVenusApi = __importStar(require("../../../index"));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as FernVenusApi from "../../../index";
|
|
5
|
-
export
|
|
5
|
+
export type RegistryToken = FernVenusApi.RegistryToken.Npm | FernVenusApi.RegistryToken.Maven | FernVenusApi.RegistryToken.Pypi;
|
|
6
6
|
export declare namespace RegistryToken {
|
|
7
7
|
interface Npm extends FernVenusApi.NpmRegistryToken {
|
|
8
8
|
type: "npm";
|
|
@@ -6,6 +6,8 @@ import * as FernVenusApi from "../../../index";
|
|
|
6
6
|
export declare namespace User {
|
|
7
7
|
interface Options {
|
|
8
8
|
environment: core.Supplier<string>;
|
|
9
|
+
/** Specify a custom URL to connect the client to. */
|
|
10
|
+
baseUrl?: core.Supplier<string>;
|
|
9
11
|
token?: core.Supplier<core.BearerToken | undefined>;
|
|
10
12
|
}
|
|
11
13
|
interface RequestOptions {
|
|
@@ -15,6 +17,8 @@ export declare namespace User {
|
|
|
15
17
|
maxRetries?: number;
|
|
16
18
|
/** A hook to abort the request. */
|
|
17
19
|
abortSignal?: AbortSignal;
|
|
20
|
+
/** Additional headers to include in the request. */
|
|
21
|
+
headers?: Record<string, string>;
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
export declare class User {
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
39
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
40
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -55,17 +65,11 @@ class User {
|
|
|
55
65
|
*/
|
|
56
66
|
getMyself(requestOptions) {
|
|
57
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
var _a;
|
|
58
69
|
const _response = yield core.fetcher({
|
|
59
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "/users"),
|
|
70
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)), "/users"),
|
|
60
71
|
method: "GET",
|
|
61
|
-
headers: {
|
|
62
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
63
|
-
"X-Fern-Language": "JavaScript",
|
|
64
|
-
"X-Fern-SDK-Name": "@fern-api/venus-api-sdk",
|
|
65
|
-
"X-Fern-SDK-Version": "0.13.4",
|
|
66
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
67
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
68
|
-
},
|
|
72
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@fern-api/venus-api-sdk", "X-Fern-SDK-Version": "0.14.1-1-g78e09da", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
69
73
|
contentType: "application/json",
|
|
70
74
|
requestType: "json",
|
|
71
75
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -100,20 +104,14 @@ class User {
|
|
|
100
104
|
*/
|
|
101
105
|
getMyOrganizations(request, requestOptions) {
|
|
102
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
var _a;
|
|
103
108
|
const { pageId } = request;
|
|
104
109
|
const _queryParams = {};
|
|
105
110
|
_queryParams["pageId"] = pageId.toString();
|
|
106
111
|
const _response = yield core.fetcher({
|
|
107
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "/users/organizations"),
|
|
112
|
+
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)), "/users/organizations"),
|
|
108
113
|
method: "GET",
|
|
109
|
-
headers: {
|
|
110
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
111
|
-
"X-Fern-Language": "JavaScript",
|
|
112
|
-
"X-Fern-SDK-Name": "@fern-api/venus-api-sdk",
|
|
113
|
-
"X-Fern-SDK-Version": "0.13.4",
|
|
114
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
115
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
116
|
-
},
|
|
114
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@fern-api/venus-api-sdk", "X-Fern-SDK-Version": "0.14.1-1-g78e09da", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
117
115
|
contentType: "application/json",
|
|
118
116
|
queryParameters: _queryParams,
|
|
119
117
|
requestType: "json",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as FernVenusApi from "../../../index";
|
|
5
5
|
import * as core from "../../../../core";
|
|
6
|
-
export
|
|
6
|
+
export type Error = FernVenusApi.user.getMyOrganizations.Error._Unknown;
|
|
7
7
|
export declare namespace Error {
|
|
8
8
|
interface _Unknown extends _Utils {
|
|
9
9
|
error: void;
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.Error = void 0;
|
|
30
40
|
const FernVenusApi = __importStar(require("../../../index"));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as FernVenusApi from "../../../index";
|
|
5
5
|
import * as core from "../../../../core";
|
|
6
|
-
export
|
|
6
|
+
export type Error = FernVenusApi.user.getMyself.Error._Unknown;
|
|
7
7
|
export declare namespace Error {
|
|
8
8
|
interface _Unknown extends _Utils {
|
|
9
9
|
error: void;
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.Error = void 0;
|
|
30
40
|
const FernVenusApi = __importStar(require("../../../index"));
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.getMyOrganizations = exports.getMyself = void 0;
|
|
30
40
|
__exportStar(require("./requests"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type APIResponse<Success, Failure> = SuccessfulResponse<Success> | FailedResponse<Failure>;
|
|
2
2
|
export interface SuccessfulResponse<T> {
|
|
3
3
|
ok: true;
|
|
4
4
|
body: T;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { APIResponse } from "./APIResponse";
|
|
2
|
-
export
|
|
2
|
+
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
3
3
|
export declare namespace Fetcher {
|
|
4
4
|
interface Args {
|
|
5
5
|
url: string;
|
|
6
6
|
method: string;
|
|
7
7
|
contentType?: string;
|
|
8
8
|
headers?: Record<string, string | undefined>;
|
|
9
|
-
queryParameters?: Record<string, string | string[] | object | object[]>;
|
|
9
|
+
queryParameters?: Record<string, string | string[] | object | object[] | null>;
|
|
10
10
|
body?: unknown;
|
|
11
11
|
timeoutMs?: number;
|
|
12
12
|
maxRetries?: number;
|
|
13
13
|
withCredentials?: boolean;
|
|
14
14
|
abortSignal?: AbortSignal;
|
|
15
15
|
requestType?: "json" | "file" | "bytes";
|
|
16
|
-
responseType?: "json" | "blob" | "sse" | "streaming" | "text";
|
|
16
|
+
responseType?: "json" | "blob" | "sse" | "streaming" | "text" | "arrayBuffer";
|
|
17
17
|
duplex?: "half";
|
|
18
18
|
}
|
|
19
19
|
type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
|
package/core/fetcher/Fetcher.js
CHANGED
|
@@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.fetcher =
|
|
12
|
+
exports.fetcher = void 0;
|
|
13
|
+
exports.fetcherImpl = fetcherImpl;
|
|
14
|
+
const json_1 = require("../json");
|
|
13
15
|
const createRequestUrl_1 = require("./createRequestUrl");
|
|
14
16
|
const getFetchFn_1 = require("./getFetchFn");
|
|
15
17
|
const getRequestBody_1 = require("./getRequestBody");
|
|
@@ -30,7 +32,7 @@ function fetcherImpl(args) {
|
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
const url = (0, createRequestUrl_1.createRequestUrl)(args.url, args.queryParameters);
|
|
33
|
-
|
|
35
|
+
const requestBody = yield (0, getRequestBody_1.getRequestBody)({
|
|
34
36
|
body: args.body,
|
|
35
37
|
type: args.requestType === "json" ? "json" : "other",
|
|
36
38
|
});
|
|
@@ -39,7 +41,7 @@ function fetcherImpl(args) {
|
|
|
39
41
|
const response = yield (0, requestWithRetries_1.requestWithRetries)(() => __awaiter(this, void 0, void 0, function* () {
|
|
40
42
|
return (0, makeRequest_1.makeRequest)(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
|
|
41
43
|
}), args.maxRetries);
|
|
42
|
-
|
|
44
|
+
const responseBody = yield (0, getResponseBody_1.getResponseBody)(response, args.responseType);
|
|
43
45
|
if (response.status >= 200 && response.status < 400) {
|
|
44
46
|
return {
|
|
45
47
|
ok: true,
|
|
@@ -89,11 +91,10 @@ function fetcherImpl(args) {
|
|
|
89
91
|
ok: false,
|
|
90
92
|
error: {
|
|
91
93
|
reason: "unknown",
|
|
92
|
-
errorMessage:
|
|
94
|
+
errorMessage: (0, json_1.toJson)(error),
|
|
93
95
|
},
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
98
|
});
|
|
97
99
|
}
|
|
98
|
-
exports.fetcherImpl = fetcherImpl;
|
|
99
100
|
exports.fetcher = fetcherImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[]>): string;
|
|
1
|
+
export declare function createRequestUrl(baseUrl: string, queryParameters?: Record<string, string | string[] | object | object[] | null>): string;
|
|
@@ -3,11 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createRequestUrl =
|
|
6
|
+
exports.createRequestUrl = createRequestUrl;
|
|
7
7
|
const qs_1 = __importDefault(require("qs"));
|
|
8
8
|
function createRequestUrl(baseUrl, queryParameters) {
|
|
9
9
|
return Object.keys(queryParameters !== null && queryParameters !== void 0 ? queryParameters : {}).length > 0
|
|
10
10
|
? `${baseUrl}?${qs_1.default.stringify(queryParameters, { arrayFormat: "repeat" })}`
|
|
11
11
|
: baseUrl;
|
|
12
12
|
}
|
|
13
|
-
exports.createRequestUrl = createRequestUrl;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,7 +42,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.getFetchFn =
|
|
45
|
+
exports.getFetchFn = getFetchFn;
|
|
36
46
|
const runtime_1 = require("../runtime");
|
|
37
47
|
/**
|
|
38
48
|
* Returns a fetch function based on the runtime
|
|
@@ -56,4 +66,3 @@ function getFetchFn() {
|
|
|
56
66
|
return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
|
|
57
67
|
});
|
|
58
68
|
}
|
|
59
|
-
exports.getFetchFn = getFetchFn;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHeader =
|
|
3
|
+
exports.getHeader = getHeader;
|
|
4
4
|
function getHeader(headers, header) {
|
|
5
5
|
for (const [headerKey, headerValue] of Object.entries(headers)) {
|
|
6
6
|
if (headerKey.toLowerCase() === header.toLowerCase()) {
|
|
@@ -9,4 +9,3 @@ function getHeader(headers, header) {
|
|
|
9
9
|
}
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
-
exports.getHeader = getHeader;
|
|
@@ -9,15 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getRequestBody =
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
exports.getRequestBody = getRequestBody;
|
|
13
|
+
const json_1 = require("../json");
|
|
14
|
+
function getRequestBody(_a) {
|
|
15
|
+
return __awaiter(this, arguments, void 0, function* ({ body, type }) {
|
|
15
16
|
if (type.includes("json")) {
|
|
16
|
-
return
|
|
17
|
+
return (0, json_1.toJson)(body);
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
19
20
|
return body;
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
exports.getRequestBody = getRequestBody;
|
|
@@ -9,13 +9,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getResponseBody =
|
|
12
|
+
exports.getResponseBody = getResponseBody;
|
|
13
13
|
const chooseStreamWrapper_1 = require("./stream-wrappers/chooseStreamWrapper");
|
|
14
14
|
function getResponseBody(response, responseType) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
if (response.body != null && responseType === "blob") {
|
|
17
17
|
return yield response.blob();
|
|
18
18
|
}
|
|
19
|
+
else if (response.body != null && responseType === "arrayBuffer") {
|
|
20
|
+
return yield response.arrayBuffer();
|
|
21
|
+
}
|
|
19
22
|
else if (response.body != null && responseType === "sse") {
|
|
20
23
|
return response.body;
|
|
21
24
|
}
|
|
@@ -49,4 +52,3 @@ function getResponseBody(response, responseType) {
|
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
|
-
exports.getResponseBody = getResponseBody;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number
|
|
1
|
+
export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
|
|
@@ -9,17 +9,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.requestWithRetries =
|
|
13
|
-
const INITIAL_RETRY_DELAY =
|
|
14
|
-
const MAX_RETRY_DELAY =
|
|
12
|
+
exports.requestWithRetries = requestWithRetries;
|
|
13
|
+
const INITIAL_RETRY_DELAY = 1000; // in milliseconds
|
|
14
|
+
const MAX_RETRY_DELAY = 60000; // in milliseconds
|
|
15
15
|
const DEFAULT_MAX_RETRIES = 2;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const JITTER_FACTOR = 0.2; // 20% random jitter
|
|
17
|
+
function addJitter(delay) {
|
|
18
|
+
// Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR
|
|
19
|
+
const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
|
|
20
|
+
return delay * jitterMultiplier;
|
|
21
|
+
}
|
|
22
|
+
function requestWithRetries(requestFn_1) {
|
|
23
|
+
return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
18
24
|
let response = yield requestFn();
|
|
19
25
|
for (let i = 0; i < maxRetries; ++i) {
|
|
20
|
-
if ([408,
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
27
|
+
// Calculate base delay using exponential backoff (in milliseconds)
|
|
28
|
+
const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
|
|
29
|
+
// Add jitter to the delay
|
|
30
|
+
const delayWithJitter = addJitter(baseDelay);
|
|
31
|
+
yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
|
|
23
32
|
response = yield requestFn();
|
|
24
33
|
}
|
|
25
34
|
else {
|
|
@@ -29,4 +38,3 @@ function requestWithRetries(requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
|
29
38
|
return response;
|
|
30
39
|
});
|
|
31
40
|
}
|
|
32
|
-
exports.requestWithRetries = requestWithRetries;
|
package/core/fetcher/signals.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getTimeoutSignal = getTimeoutSignal;
|
|
4
|
+
exports.anySignal = anySignal;
|
|
4
5
|
const TIMEOUT = "timeout";
|
|
5
6
|
function getTimeoutSignal(timeoutMs) {
|
|
6
7
|
const controller = new AbortController();
|
|
7
8
|
const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
|
|
8
9
|
return { signal: controller.signal, abortId };
|
|
9
10
|
}
|
|
10
|
-
exports.getTimeoutSignal = getTimeoutSignal;
|
|
11
11
|
/**
|
|
12
12
|
* Returns an abort signal that is getting aborted when
|
|
13
13
|
* at least one of the specified abort signals is aborted.
|
|
@@ -34,4 +34,3 @@ function anySignal(...args) {
|
|
|
34
34
|
}
|
|
35
35
|
return controller.signal;
|
|
36
36
|
}
|
|
37
|
-
exports.anySignal = anySignal;
|
|
@@ -76,21 +76,23 @@ class NodePre18StreamWrapper {
|
|
|
76
76
|
this.encoding = encoding;
|
|
77
77
|
}
|
|
78
78
|
text() {
|
|
79
|
-
var e_1, _a;
|
|
80
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
var _a, e_1, _b, _c;
|
|
81
81
|
const chunks = [];
|
|
82
82
|
const encoder = new TextEncoder();
|
|
83
83
|
this.readableStream.setEncoding((this.encoding || "utf-8"));
|
|
84
84
|
try {
|
|
85
|
-
for (var
|
|
86
|
-
|
|
85
|
+
for (var _d = true, _e = __asyncValues(this.readableStream), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
86
|
+
_c = _f.value;
|
|
87
|
+
_d = false;
|
|
88
|
+
const chunk = _c;
|
|
87
89
|
chunks.push(encoder.encode(chunk));
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
91
93
|
finally {
|
|
92
94
|
try {
|
|
93
|
-
if (
|
|
95
|
+
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
94
96
|
}
|
|
95
97
|
finally { if (e_1) throw e_1.error; }
|
|
96
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StreamWrapper } from "./chooseStreamWrapper";
|
|
2
|
-
|
|
2
|
+
type EventCallback = (data?: any) => void;
|
|
3
3
|
export declare class UndiciStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<UndiciStreamWrapper<ReadFormat> | WritableStream<ReadFormat>, ReadFormat> {
|
|
4
4
|
private readableStream;
|
|
5
5
|
private reader;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,7 +42,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.chooseStreamWrapper =
|
|
45
|
+
exports.chooseStreamWrapper = chooseStreamWrapper;
|
|
36
46
|
const runtime_1 = require("../../runtime");
|
|
37
47
|
function chooseStreamWrapper(responseBody) {
|
|
38
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -47,4 +57,3 @@ function chooseStreamWrapper(responseBody) {
|
|
|
47
57
|
}
|
|
48
58
|
});
|
|
49
59
|
}
|
|
50
|
-
exports.chooseStreamWrapper = chooseStreamWrapper;
|