@fern-api/venus-api-sdk 0.10.0 → 0.10.1-1-ged0356b
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 +14 -6
- package/Client.js +8 -9
- package/api/resources/commons/types/OrganizationId.d.ts +1 -1
- package/api/resources/commons/types/UserId.d.ts +1 -1
- package/api/resources/organization/client/Client.d.ts +116 -13
- package/api/resources/organization/client/Client.js +513 -236
- package/api/resources/organization/client/addUser.d.ts +1 -1
- package/api/resources/organization/client/addUser.js +27 -4
- package/api/resources/organization/client/create.d.ts +1 -1
- package/api/resources/organization/client/create.js +27 -4
- package/api/resources/organization/client/get.d.ts +1 -1
- package/api/resources/organization/client/get.js +26 -3
- package/api/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +1 -1
- package/api/resources/organization/client/getMyOrganizationFromScopedToken.js +26 -3
- package/api/resources/organization/client/getOrgIdsFromToken.d.ts +1 -1
- package/api/resources/organization/client/getOrgIdsFromToken.js +25 -2
- package/api/resources/organization/client/inviteUser.d.ts +1 -1
- package/api/resources/organization/client/inviteUser.js +27 -4
- package/api/resources/organization/client/isMember.d.ts +1 -1
- package/api/resources/organization/client/isMember.js +25 -2
- package/api/resources/organization/client/removeUser.d.ts +1 -1
- package/api/resources/organization/client/removeUser.js +27 -4
- package/api/resources/organization/client/requests/AddUserToOrgRequest.d.ts +8 -1
- package/api/resources/organization/client/requests/CreateOrganizationRequest.d.ts +15 -1
- package/api/resources/organization/client/requests/GetMyOrganizationFromScopedToken.d.ts +6 -0
- package/api/resources/organization/client/requests/GetOrganizationRequest.d.ts +6 -0
- package/api/resources/organization/client/requests/InviteUserToOrgRequest.d.ts +8 -1
- package/api/resources/organization/client/requests/RemoveUserFromOrgRequest.d.ts +8 -1
- package/api/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +31 -0
- package/api/resources/organization/client/requests/index.d.ts +7 -7
- package/api/resources/organization/client/update.d.ts +1 -1
- package/api/resources/organization/client/update.js +26 -3
- package/api/resources/organization/types/Organization.d.ts +1 -1
- package/api/resources/registry/client/Client.d.ts +48 -7
- package/api/resources/registry/client/Client.js +198 -87
- package/api/resources/registry/client/generateRegistryTokens.d.ts +1 -1
- package/api/resources/registry/client/generateRegistryTokens.js +27 -4
- package/api/resources/registry/client/hasRegistryPermission.d.ts +1 -1
- package/api/resources/registry/client/hasRegistryPermission.js +27 -4
- package/api/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +11 -1
- package/api/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +7 -1
- package/api/resources/registry/client/requests/RevokeTokenRequest.d.ts +8 -1
- package/api/resources/registry/client/requests/index.d.ts +3 -3
- package/api/resources/registry/client/revokeToken.d.ts +1 -1
- package/api/resources/registry/client/revokeToken.js +27 -4
- package/api/resources/registry/types/RegistryToken.d.ts +5 -28
- package/api/resources/registry/types/RegistryToken.js +0 -51
- package/api/resources/registry/types/RegistryTokens.d.ts +1 -1
- package/api/resources/user/client/Client.d.ts +30 -6
- package/api/resources/user/client/Client.js +107 -43
- package/api/resources/user/client/getMyOrganizations.d.ts +1 -1
- package/api/resources/user/client/getMyOrganizations.js +25 -2
- package/api/resources/user/client/getMyself.d.ts +1 -1
- package/api/resources/user/client/getMyself.js +25 -2
- package/api/resources/user/client/requests/GetUserOrganizationsRequest.d.ts +6 -0
- package/api/resources/user/client/requests/index.d.ts +1 -1
- package/api/resources/user/types/OrganizationsPage.d.ts +1 -1
- package/api/resources/user/types/User.d.ts +1 -1
- package/core/fetcher/APIResponse.d.ts +1 -0
- package/core/fetcher/Fetcher.d.ts +9 -2
- package/core/fetcher/Fetcher.js +78 -64
- package/core/fetcher/Supplier.js +11 -2
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +13 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +59 -0
- package/core/fetcher/getHeader.d.ts +1 -0
- package/core/fetcher/getHeader.js +12 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +23 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +52 -0
- package/core/fetcher/index.d.ts +4 -2
- package/core/fetcher/index.js +3 -1
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +42 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +32 -0
- package/core/fetcher/signals.d.ts +12 -0
- package/core/fetcher/signals.js +37 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
- package/core/index.d.ts +3 -2
- package/core/index.js +6 -5
- package/core/runtime/index.d.ts +1 -0
- package/core/runtime/index.js +5 -0
- package/core/runtime/runtime.d.ts +9 -0
- package/core/runtime/runtime.js +93 -0
- package/core/schemas/Schema.d.ts +44 -5
- package/core/schemas/Schema.js +3 -0
- package/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/core/schemas/builders/bigint/bigint.js +50 -0
- package/core/schemas/builders/bigint/index.d.ts +1 -0
- package/core/schemas/builders/bigint/index.js +5 -0
- package/core/schemas/builders/date/date.js +22 -14
- package/core/schemas/builders/enum/enum.js +17 -7
- package/core/schemas/builders/index.d.ts +2 -0
- package/core/schemas/builders/index.js +2 -0
- package/core/schemas/builders/lazy/index.d.ts +2 -1
- package/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/core/schemas/builders/lazy/lazy.js +6 -9
- package/core/schemas/builders/lazy/lazyObject.js +2 -11
- package/core/schemas/builders/list/list.js +16 -14
- package/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/core/schemas/builders/literals/index.d.ts +1 -0
- package/core/schemas/builders/literals/index.js +3 -1
- package/core/schemas/builders/literals/stringLiteral.js +4 -3
- package/core/schemas/builders/object/index.d.ts +5 -2
- package/core/schemas/builders/object/index.js +3 -1
- package/core/schemas/builders/object/object.js +65 -63
- package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/core/schemas/builders/object/types.d.ts +2 -2
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +9 -17
- package/core/schemas/builders/object-like/index.d.ts +1 -1
- package/core/schemas/builders/primitives/boolean.js +4 -3
- package/core/schemas/builders/primitives/number.js +4 -3
- package/core/schemas/builders/primitives/string.js +4 -3
- package/core/schemas/builders/record/index.d.ts +1 -1
- package/core/schemas/builders/record/record.js +36 -32
- package/core/schemas/builders/record/types.d.ts +2 -3
- package/core/schemas/builders/schema-utils/JsonError.js +0 -1
- package/core/schemas/builders/schema-utils/ParseError.js +0 -1
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +16 -16
- package/core/schemas/builders/schema-utils/index.d.ts +2 -1
- package/core/schemas/builders/set/set.js +10 -10
- package/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
- package/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +40 -0
- package/core/schemas/builders/union/index.d.ts +3 -2
- package/core/schemas/builders/union/union.js +61 -31
- package/core/schemas/index.d.ts +1 -1
- package/core/schemas/utils/createIdentitySchemaCreator.js +2 -4
- package/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +28 -0
- package/core/schemas/utils/isPlainObject.d.ts +0 -1
- package/core/schemas/utils/isPlainObject.js +1 -2
- package/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/core/schemas/utils/maybeSkipValidation.js +28 -0
- package/dist/Client.d.ts +31 -0
- package/dist/Client.js +27 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +17 -0
- package/dist/api/resources/commons/index.d.ts +1 -0
- package/dist/api/resources/commons/index.js +17 -0
- package/dist/api/resources/commons/types/OrganizationId.d.ts +8 -0
- package/dist/api/resources/commons/types/OrganizationId.js +10 -0
- package/dist/api/resources/commons/types/UserId.d.ts +8 -0
- package/dist/api/resources/commons/types/UserId.js +10 -0
- package/dist/api/resources/commons/types/index.d.ts +2 -0
- package/dist/api/resources/commons/types/index.js +18 -0
- package/dist/api/resources/index.d.ts +11 -0
- package/dist/api/resources/index.js +40 -0
- package/dist/api/resources/organization/client/Client.d.ts +130 -0
- package/dist/api/resources/organization/client/Client.js +582 -0
- package/dist/api/resources/organization/client/addUser.d.ts +32 -0
- package/dist/api/resources/organization/client/addUser.js +67 -0
- package/dist/api/resources/organization/client/create.d.ts +32 -0
- package/dist/api/resources/organization/client/create.js +67 -0
- package/dist/api/resources/organization/client/get.d.ts +27 -0
- package/dist/api/resources/organization/client/get.js +57 -0
- package/dist/api/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +27 -0
- package/dist/api/resources/organization/client/getMyOrganizationFromScopedToken.js +57 -0
- package/dist/api/resources/organization/client/getOrgIdsFromToken.d.ts +22 -0
- package/dist/api/resources/organization/client/getOrgIdsFromToken.js +47 -0
- package/dist/api/resources/organization/client/index.d.ts +10 -0
- package/dist/api/resources/organization/client/index.js +39 -0
- package/dist/api/resources/organization/client/inviteUser.d.ts +32 -0
- package/dist/api/resources/organization/client/inviteUser.js +67 -0
- package/dist/api/resources/organization/client/isMember.d.ts +22 -0
- package/dist/api/resources/organization/client/isMember.js +47 -0
- package/dist/api/resources/organization/client/removeUser.d.ts +32 -0
- package/dist/api/resources/organization/client/removeUser.js +67 -0
- package/dist/api/resources/organization/client/requests/AddUserToOrgRequest.d.ts +15 -0
- package/dist/api/resources/organization/client/requests/AddUserToOrgRequest.js +5 -0
- package/dist/api/resources/organization/client/requests/CreateOrganizationRequest.d.ts +23 -0
- package/dist/api/resources/organization/client/requests/CreateOrganizationRequest.js +5 -0
- package/dist/api/resources/organization/client/requests/GetMyOrganizationFromScopedToken.d.ts +12 -0
- package/dist/api/resources/organization/client/requests/GetMyOrganizationFromScopedToken.js +5 -0
- package/dist/api/resources/organization/client/requests/GetOrganizationRequest.d.ts +12 -0
- package/dist/api/resources/organization/client/requests/GetOrganizationRequest.js +5 -0
- package/dist/api/resources/organization/client/requests/InviteUserToOrgRequest.d.ts +15 -0
- package/dist/api/resources/organization/client/requests/InviteUserToOrgRequest.js +5 -0
- package/dist/api/resources/organization/client/requests/RemoveUserFromOrgRequest.d.ts +15 -0
- package/dist/api/resources/organization/client/requests/RemoveUserFromOrgRequest.js +5 -0
- package/dist/api/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +49 -0
- package/dist/api/resources/organization/client/requests/UpdateOrganizationRequest.js +5 -0
- package/dist/api/resources/organization/client/requests/index.d.ts +7 -0
- package/dist/api/resources/organization/client/requests/index.js +2 -0
- package/dist/api/resources/organization/client/update.d.ts +27 -0
- package/dist/api/resources/organization/client/update.js +57 -0
- package/dist/api/resources/organization/index.d.ts +2 -0
- package/dist/api/resources/organization/index.js +18 -0
- package/dist/api/resources/organization/types/LightweightUser.d.ts +9 -0
- package/dist/api/resources/organization/types/LightweightUser.js +5 -0
- package/dist/api/resources/organization/types/Organization.d.ts +35 -0
- package/dist/api/resources/organization/types/Organization.js +5 -0
- package/dist/api/resources/organization/types/index.d.ts +2 -0
- package/dist/api/resources/organization/types/index.js +18 -0
- package/dist/api/resources/registry/client/Client.d.ts +59 -0
- package/dist/api/resources/registry/client/Client.js +246 -0
- package/dist/api/resources/registry/client/generateRegistryTokens.d.ts +32 -0
- package/dist/api/resources/registry/client/generateRegistryTokens.js +67 -0
- package/dist/api/resources/registry/client/hasRegistryPermission.d.ts +32 -0
- package/dist/api/resources/registry/client/hasRegistryPermission.js +67 -0
- package/dist/api/resources/registry/client/index.d.ts +4 -0
- package/dist/api/resources/registry/client/index.js +33 -0
- package/dist/api/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +18 -0
- package/dist/api/resources/registry/client/requests/CheckRegistryPermissionRequest.js +5 -0
- package/dist/api/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +13 -0
- package/dist/api/resources/registry/client/requests/GenerateRegistryTokensRequest.js +5 -0
- package/dist/api/resources/registry/client/requests/RevokeTokenRequest.d.ts +15 -0
- package/dist/api/resources/registry/client/requests/RevokeTokenRequest.js +5 -0
- package/dist/api/resources/registry/client/requests/index.d.ts +3 -0
- package/dist/api/resources/registry/client/requests/index.js +2 -0
- package/dist/api/resources/registry/client/revokeToken.d.ts +32 -0
- package/dist/api/resources/registry/client/revokeToken.js +67 -0
- package/dist/api/resources/registry/index.d.ts +2 -0
- package/dist/api/resources/registry/index.js +18 -0
- package/dist/api/resources/registry/types/MavenRegistryToken.d.ts +7 -0
- package/dist/api/resources/registry/types/MavenRegistryToken.js +5 -0
- package/dist/api/resources/registry/types/NpmRegistryToken.d.ts +6 -0
- package/dist/api/resources/registry/types/NpmRegistryToken.js +5 -0
- package/dist/api/resources/registry/types/PypiRegistryToken.d.ts +7 -0
- package/dist/api/resources/registry/types/PypiRegistryToken.js +5 -0
- package/dist/api/resources/registry/types/RegistryToken.d.ts +16 -0
- package/dist/api/resources/registry/types/RegistryToken.js +5 -0
- package/dist/api/resources/registry/types/RegistryTokens.d.ts +9 -0
- package/dist/api/resources/registry/types/RegistryTokens.js +5 -0
- package/dist/api/resources/registry/types/index.d.ts +5 -0
- package/dist/api/resources/registry/types/index.js +21 -0
- package/dist/api/resources/user/client/Client.d.ts +41 -0
- package/dist/api/resources/user/client/Client.js +151 -0
- package/dist/api/resources/user/client/getMyOrganizations.d.ts +22 -0
- package/dist/api/resources/user/client/getMyOrganizations.js +47 -0
- package/dist/api/resources/user/client/getMyself.d.ts +22 -0
- package/dist/api/resources/user/client/getMyself.js +47 -0
- package/dist/api/resources/user/client/index.d.ts +3 -0
- package/dist/api/resources/user/client/index.js +32 -0
- package/dist/api/resources/user/client/requests/GetUserOrganizationsRequest.d.ts +12 -0
- package/dist/api/resources/user/client/requests/GetUserOrganizationsRequest.js +5 -0
- package/dist/api/resources/user/client/requests/index.d.ts +1 -0
- package/dist/api/resources/user/client/requests/index.js +2 -0
- package/dist/api/resources/user/index.d.ts +2 -0
- package/dist/api/resources/user/index.js +18 -0
- package/dist/api/resources/user/types/OrganizationsPage.d.ts +8 -0
- package/dist/api/resources/user/types/OrganizationsPage.js +5 -0
- package/dist/api/resources/user/types/User.d.ts +10 -0
- package/dist/api/resources/user/types/User.js +5 -0
- package/dist/api/resources/user/types/index.d.ts +2 -0
- package/dist/api/resources/user/types/index.js +18 -0
- package/dist/core/auth/BasicAuth.d.ts +8 -0
- package/dist/core/auth/BasicAuth.js +26 -0
- package/dist/core/auth/BearerToken.d.ts +5 -0
- package/dist/core/auth/BearerToken.js +15 -0
- package/dist/core/auth/index.d.ts +2 -0
- package/dist/core/auth/index.js +7 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/Fetcher.d.ts +39 -0
- package/dist/core/fetcher/Fetcher.js +99 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +22 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +13 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +59 -0
- package/dist/core/fetcher/getHeader.d.ts +1 -0
- package/dist/core/fetcher/getHeader.js +12 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +23 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +52 -0
- package/dist/core/fetcher/index.d.ts +5 -0
- package/dist/core/fetcher/index.js +9 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +42 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +32 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +37 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +22 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +124 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +50 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +33 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +9 -0
- package/dist/core/runtime/runtime.js +93 -0
- package/dist/core/schemas/Schema.d.ts +85 -0
- package/dist/core/schemas/Schema.js +22 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +2 -0
- package/dist/core/schemas/builders/bigint/bigint.js +50 -0
- package/dist/core/schemas/builders/bigint/index.d.ts +1 -0
- package/dist/core/schemas/builders/bigint/index.js +5 -0
- package/dist/core/schemas/builders/date/date.d.ts +2 -0
- package/dist/core/schemas/builders/date/date.js +63 -0
- package/dist/core/schemas/builders/date/index.d.ts +1 -0
- package/dist/core/schemas/builders/date/index.js +5 -0
- package/dist/core/schemas/builders/enum/enum.d.ts +2 -0
- package/dist/core/schemas/builders/enum/enum.js +39 -0
- package/dist/core/schemas/builders/enum/index.d.ts +1 -0
- package/dist/core/schemas/builders/enum/index.js +5 -0
- package/dist/core/schemas/builders/index.d.ts +14 -0
- package/dist/core/schemas/builders/index.js +30 -0
- package/dist/core/schemas/builders/lazy/index.d.ts +3 -0
- package/dist/core/schemas/builders/lazy/index.js +7 -0
- package/dist/core/schemas/builders/lazy/lazy.d.ts +5 -0
- package/dist/core/schemas/builders/lazy/lazy.js +25 -0
- package/dist/core/schemas/builders/lazy/lazyObject.d.ts +3 -0
- package/dist/core/schemas/builders/lazy/lazyObject.js +12 -0
- package/dist/core/schemas/builders/list/index.d.ts +1 -0
- package/dist/core/schemas/builders/list/index.js +5 -0
- package/dist/core/schemas/builders/list/list.d.ts +2 -0
- package/dist/core/schemas/builders/list/list.js +55 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +2 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/dist/core/schemas/builders/literals/index.d.ts +2 -0
- package/dist/core/schemas/builders/literals/index.js +7 -0
- package/dist/core/schemas/builders/literals/stringLiteral.d.ts +2 -0
- package/dist/core/schemas/builders/literals/stringLiteral.js +29 -0
- package/dist/core/schemas/builders/object/index.d.ts +6 -0
- package/dist/core/schemas/builders/object/index.js +11 -0
- package/dist/core/schemas/builders/object/object.d.ts +3 -0
- package/dist/core/schemas/builders/object/object.js +233 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +6 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/dist/core/schemas/builders/object/property.d.ts +8 -0
- package/dist/core/schemas/builders/object/property.js +16 -0
- package/dist/core/schemas/builders/object/types.d.ts +26 -0
- package/dist/core/schemas/builders/object/types.js +2 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +9 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +54 -0
- package/dist/core/schemas/builders/object-like/index.d.ts +2 -0
- package/dist/core/schemas/builders/object-like/index.js +6 -0
- package/dist/core/schemas/builders/object-like/types.d.ts +7 -0
- package/dist/core/schemas/builders/object-like/types.js +2 -0
- package/dist/core/schemas/builders/primitives/any.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/any.js +6 -0
- package/dist/core/schemas/builders/primitives/boolean.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/boolean.js +25 -0
- package/dist/core/schemas/builders/primitives/index.d.ts +5 -0
- package/dist/core/schemas/builders/primitives/index.js +13 -0
- package/dist/core/schemas/builders/primitives/number.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/number.js +25 -0
- package/dist/core/schemas/builders/primitives/string.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/string.js +25 -0
- package/dist/core/schemas/builders/primitives/unknown.d.ts +1 -0
- package/dist/core/schemas/builders/primitives/unknown.js +6 -0
- package/dist/core/schemas/builders/record/index.d.ts +2 -0
- package/dist/core/schemas/builders/record/index.js +5 -0
- package/dist/core/schemas/builders/record/record.d.ts +3 -0
- package/dist/core/schemas/builders/record/record.js +95 -0
- package/dist/core/schemas/builders/record/types.d.ts +4 -0
- package/dist/core/schemas/builders/record/types.js +2 -0
- package/dist/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
- package/dist/core/schemas/builders/schema-utils/JsonError.js +12 -0
- package/dist/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
- package/dist/core/schemas/builders/schema-utils/ParseError.js +12 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +17 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +82 -0
- package/dist/core/schemas/builders/schema-utils/index.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/index.js +11 -0
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
- package/dist/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
- package/dist/core/schemas/builders/set/index.d.ts +1 -0
- package/dist/core/schemas/builders/set/index.js +5 -0
- package/dist/core/schemas/builders/set/set.d.ts +2 -0
- package/dist/core/schemas/builders/set/set.js +44 -0
- package/dist/core/schemas/builders/undiscriminated-union/index.d.ts +2 -0
- package/dist/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +4 -0
- package/dist/core/schemas/builders/undiscriminated-union/types.js +2 -0
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +3 -0
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +40 -0
- package/dist/core/schemas/builders/union/discriminant.d.ts +5 -0
- package/dist/core/schemas/builders/union/discriminant.js +10 -0
- package/dist/core/schemas/builders/union/index.d.ts +4 -0
- package/dist/core/schemas/builders/union/index.js +7 -0
- package/dist/core/schemas/builders/union/types.d.ts +13 -0
- package/dist/core/schemas/builders/union/types.js +2 -0
- package/dist/core/schemas/builders/union/union.d.ts +4 -0
- package/dist/core/schemas/builders/union/union.js +130 -0
- package/dist/core/schemas/index.d.ts +2 -0
- package/dist/core/schemas/index.js +17 -0
- package/dist/core/schemas/utils/MaybePromise.d.ts +1 -0
- package/dist/core/schemas/utils/MaybePromise.js +2 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
- package/dist/core/schemas/utils/createIdentitySchemaCreator.d.ts +2 -0
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
- package/dist/core/schemas/utils/entries.d.ts +1 -0
- package/dist/core/schemas/utils/entries.js +7 -0
- package/dist/core/schemas/utils/filterObject.d.ts +1 -0
- package/dist/core/schemas/utils/filterObject.js +14 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +1 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +28 -0
- package/dist/core/schemas/utils/isPlainObject.d.ts +1 -0
- package/dist/core/schemas/utils/isPlainObject.js +18 -0
- package/dist/core/schemas/utils/keys.d.ts +1 -0
- package/dist/core/schemas/utils/keys.js +7 -0
- package/dist/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/dist/core/schemas/utils/maybeSkipValidation.js +28 -0
- package/dist/core/schemas/utils/partition.d.ts +1 -0
- package/dist/core/schemas/utils/partition.js +16 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -0
- package/dist/serialization/index.d.ts +1 -0
- package/dist/serialization/index.js +17 -0
- package/dist/serialization/resources/commons/index.d.ts +1 -0
- package/dist/serialization/resources/commons/index.js +17 -0
- package/dist/serialization/resources/commons/types/OrganizationId.d.ts +10 -0
- package/dist/serialization/resources/commons/types/OrganizationId.js +35 -0
- package/dist/serialization/resources/commons/types/UserId.d.ts +10 -0
- package/dist/serialization/resources/commons/types/UserId.js +37 -0
- package/dist/serialization/resources/commons/types/index.d.ts +2 -0
- package/dist/serialization/resources/commons/types/index.js +18 -0
- package/dist/serialization/resources/index.d.ts +10 -0
- package/dist/serialization/resources/index.js +39 -0
- package/dist/serialization/resources/organization/client/addUser.d.ts +16 -0
- package/dist/serialization/resources/organization/client/addUser.js +61 -0
- package/dist/serialization/resources/organization/client/create.d.ts +16 -0
- package/dist/serialization/resources/organization/client/create.js +61 -0
- package/dist/serialization/resources/organization/client/get.d.ts +13 -0
- package/dist/serialization/resources/organization/client/get.js +58 -0
- package/dist/serialization/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +13 -0
- package/dist/serialization/resources/organization/client/getMyOrganizationFromScopedToken.js +58 -0
- package/dist/serialization/resources/organization/client/getOrgIdsFromToken.d.ts +11 -0
- package/dist/serialization/resources/organization/client/getOrgIdsFromToken.js +32 -0
- package/dist/serialization/resources/organization/client/index.d.ts +10 -0
- package/dist/serialization/resources/organization/client/index.js +39 -0
- package/dist/serialization/resources/organization/client/inviteUser.d.ts +16 -0
- package/dist/serialization/resources/organization/client/inviteUser.js +61 -0
- package/dist/serialization/resources/organization/client/isMember.d.ts +9 -0
- package/dist/serialization/resources/organization/client/isMember.js +31 -0
- package/dist/serialization/resources/organization/client/removeUser.d.ts +16 -0
- package/dist/serialization/resources/organization/client/removeUser.js +61 -0
- package/dist/serialization/resources/organization/client/requests/AddUserToOrgRequest.d.ts +15 -0
- package/dist/serialization/resources/organization/client/requests/AddUserToOrgRequest.js +36 -0
- package/dist/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +15 -0
- package/dist/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +36 -0
- package/dist/serialization/resources/organization/client/requests/InviteUserToOrgRequest.d.ts +14 -0
- package/dist/serialization/resources/organization/client/requests/InviteUserToOrgRequest.js +35 -0
- package/dist/serialization/resources/organization/client/requests/RemoveUserFromOrgRequest.d.ts +14 -0
- package/dist/serialization/resources/organization/client/requests/RemoveUserFromOrgRequest.js +35 -0
- package/dist/serialization/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +24 -0
- package/dist/serialization/resources/organization/client/requests/UpdateOrganizationRequest.js +45 -0
- package/dist/serialization/resources/organization/client/requests/index.d.ts +5 -0
- package/dist/serialization/resources/organization/client/requests/index.js +13 -0
- package/dist/serialization/resources/organization/client/update.d.ts +13 -0
- package/dist/serialization/resources/organization/client/update.js +58 -0
- package/dist/serialization/resources/organization/index.d.ts +2 -0
- package/dist/serialization/resources/organization/index.js +18 -0
- package/dist/serialization/resources/organization/types/LightweightUser.d.ts +15 -0
- package/dist/serialization/resources/organization/types/LightweightUser.js +36 -0
- package/dist/serialization/resources/organization/types/Organization.d.ts +30 -0
- package/dist/serialization/resources/organization/types/Organization.js +51 -0
- package/dist/serialization/resources/organization/types/index.d.ts +2 -0
- package/dist/serialization/resources/organization/types/index.js +18 -0
- package/dist/serialization/resources/registry/client/generateRegistryTokens.d.ts +16 -0
- package/dist/serialization/resources/registry/client/generateRegistryTokens.js +61 -0
- package/dist/serialization/resources/registry/client/hasRegistryPermission.d.ts +20 -0
- package/dist/serialization/resources/registry/client/hasRegistryPermission.js +62 -0
- package/dist/serialization/resources/registry/client/index.d.ts +4 -0
- package/dist/serialization/resources/registry/client/index.js +33 -0
- package/dist/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +15 -0
- package/dist/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.js +36 -0
- package/dist/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +13 -0
- package/dist/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.js +34 -0
- package/dist/serialization/resources/registry/client/requests/RevokeTokenRequest.d.ts +14 -0
- package/dist/serialization/resources/registry/client/requests/RevokeTokenRequest.js +35 -0
- package/dist/serialization/resources/registry/client/requests/index.d.ts +3 -0
- package/dist/serialization/resources/registry/client/requests/index.js +9 -0
- package/dist/serialization/resources/registry/client/revokeToken.d.ts +16 -0
- package/dist/serialization/resources/registry/client/revokeToken.js +61 -0
- package/dist/serialization/resources/registry/index.d.ts +2 -0
- package/dist/serialization/resources/registry/index.js +18 -0
- package/dist/serialization/resources/registry/types/MavenRegistryToken.d.ts +13 -0
- package/dist/serialization/resources/registry/types/MavenRegistryToken.js +34 -0
- package/dist/serialization/resources/registry/types/NpmRegistryToken.d.ts +12 -0
- package/dist/serialization/resources/registry/types/NpmRegistryToken.js +33 -0
- package/dist/serialization/resources/registry/types/PypiRegistryToken.d.ts +13 -0
- package/dist/serialization/resources/registry/types/PypiRegistryToken.js +34 -0
- package/dist/serialization/resources/registry/types/RegistryToken.d.ts +22 -0
- package/dist/serialization/resources/registry/types/RegistryToken.js +43 -0
- package/dist/serialization/resources/registry/types/RegistryTokens.d.ts +17 -0
- package/dist/serialization/resources/registry/types/RegistryTokens.js +38 -0
- package/dist/serialization/resources/registry/types/index.d.ts +5 -0
- package/dist/serialization/resources/registry/types/index.js +21 -0
- package/dist/serialization/resources/user/index.d.ts +1 -0
- package/dist/serialization/resources/user/index.js +17 -0
- package/dist/serialization/resources/user/types/OrganizationsPage.d.ts +14 -0
- package/dist/serialization/resources/user/types/OrganizationsPage.js +35 -0
- package/dist/serialization/resources/user/types/User.d.ts +16 -0
- package/dist/serialization/resources/user/types/User.js +37 -0
- package/dist/serialization/resources/user/types/index.d.ts +2 -0
- package/dist/serialization/resources/user/types/index.js +18 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/jest.config.js +5 -0
- package/package.json +28 -18
- package/serialization/resources/commons/types/OrganizationId.d.ts +2 -2
- package/serialization/resources/commons/types/OrganizationId.js +2 -2
- package/serialization/resources/commons/types/UserId.d.ts +2 -2
- package/serialization/resources/commons/types/UserId.js +2 -2
- package/serialization/resources/organization/client/addUser.d.ts +2 -2
- package/serialization/resources/organization/client/addUser.js +18 -4
- package/serialization/resources/organization/client/create.d.ts +2 -2
- package/serialization/resources/organization/client/create.js +18 -4
- package/serialization/resources/organization/client/get.d.ts +2 -2
- package/serialization/resources/organization/client/get.js +17 -3
- package/serialization/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +2 -2
- package/serialization/resources/organization/client/getMyOrganizationFromScopedToken.js +17 -3
- package/serialization/resources/organization/client/getOrgIdsFromToken.d.ts +4 -3
- package/serialization/resources/organization/client/getOrgIdsFromToken.js +2 -1
- package/serialization/resources/organization/client/inviteUser.d.ts +2 -2
- package/serialization/resources/organization/client/inviteUser.js +18 -4
- package/serialization/resources/organization/client/isMember.d.ts +1 -1
- package/serialization/resources/organization/client/removeUser.d.ts +2 -2
- package/serialization/resources/organization/client/removeUser.js +18 -4
- package/serialization/resources/organization/client/requests/AddUserToOrgRequest.d.ts +6 -4
- package/serialization/resources/organization/client/requests/AddUserToOrgRequest.js +4 -2
- package/serialization/resources/organization/client/requests/CreateOrganizationRequest.d.ts +4 -3
- package/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +2 -1
- package/serialization/resources/organization/client/requests/InviteUserToOrgRequest.d.ts +4 -3
- package/serialization/resources/organization/client/requests/InviteUserToOrgRequest.js +2 -1
- package/serialization/resources/organization/client/requests/RemoveUserFromOrgRequest.d.ts +4 -3
- package/serialization/resources/organization/client/requests/RemoveUserFromOrgRequest.js +2 -1
- package/serialization/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +2 -2
- package/serialization/resources/organization/client/update.d.ts +2 -2
- package/serialization/resources/organization/client/update.js +17 -3
- package/serialization/resources/organization/types/LightweightUser.d.ts +2 -2
- package/serialization/resources/organization/types/Organization.d.ts +6 -4
- package/serialization/resources/organization/types/Organization.js +4 -2
- package/serialization/resources/registry/client/generateRegistryTokens.d.ts +2 -2
- package/serialization/resources/registry/client/generateRegistryTokens.js +18 -4
- package/serialization/resources/registry/client/hasRegistryPermission.d.ts +2 -2
- package/serialization/resources/registry/client/hasRegistryPermission.js +18 -4
- package/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +6 -4
- package/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.js +4 -2
- package/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +4 -3
- package/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.js +2 -1
- package/serialization/resources/registry/client/requests/RevokeTokenRequest.d.ts +4 -3
- package/serialization/resources/registry/client/requests/RevokeTokenRequest.js +2 -1
- package/serialization/resources/registry/client/revokeToken.d.ts +2 -2
- package/serialization/resources/registry/client/revokeToken.js +18 -4
- package/serialization/resources/registry/types/MavenRegistryToken.d.ts +2 -2
- package/serialization/resources/registry/types/NpmRegistryToken.d.ts +2 -2
- package/serialization/resources/registry/types/PypiRegistryToken.d.ts +2 -2
- package/serialization/resources/registry/types/RegistryToken.d.ts +8 -5
- package/serialization/resources/registry/types/RegistryToken.js +8 -17
- package/serialization/resources/registry/types/RegistryTokens.d.ts +8 -5
- package/serialization/resources/registry/types/RegistryTokens.js +6 -3
- package/serialization/resources/user/types/OrganizationsPage.d.ts +4 -3
- package/serialization/resources/user/types/OrganizationsPage.js +2 -1
- package/serialization/resources/user/types/User.d.ts +4 -3
- package/serialization/resources/user/types/User.js +2 -1
- package/version.d.ts +1 -0
- package/version.js +4 -0
- package/core/schemas/utils/OptionalRecord.d.ts +0 -1
- /package/core/schemas/{utils/OptionalRecord.js → builders/undiscriminated-union/types.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.chooseStreamWrapper = void 0;
|
|
36
|
+
const runtime_1 = require("../../runtime");
|
|
37
|
+
function chooseStreamWrapper(responseBody) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (runtime_1.RUNTIME.type === "node" && runtime_1.RUNTIME.parsedVersion != null && runtime_1.RUNTIME.parsedVersion >= 18) {
|
|
40
|
+
return new (yield Promise.resolve().then(() => __importStar(require("./Node18UniversalStreamWrapper")))).Node18UniversalStreamWrapper(responseBody);
|
|
41
|
+
}
|
|
42
|
+
else if (runtime_1.RUNTIME.type !== "node" && typeof fetch === "function") {
|
|
43
|
+
return new (yield Promise.resolve().then(() => __importStar(require("./UndiciStreamWrapper")))).UndiciStreamWrapper(responseBody);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return new (yield Promise.resolve().then(() => __importStar(require("./NodePre18StreamWrapper")))).NodePre18StreamWrapper(responseBody);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.chooseStreamWrapper = chooseStreamWrapper;
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -15,6 +15,9 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
18
21
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
22
|
if (mod && mod.__esModule) return mod;
|
|
20
23
|
var result = {};
|
|
@@ -22,11 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
25
|
__setModuleDefault(result, mod);
|
|
23
26
|
return result;
|
|
24
27
|
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.serialization = void 0;
|
|
30
|
-
exports.serialization = __importStar(require("./schemas"));
|
|
31
|
-
__exportStar(require("./auth"), exports);
|
|
32
30
|
__exportStar(require("./fetcher"), exports);
|
|
31
|
+
__exportStar(require("./auth"), exports);
|
|
32
|
+
__exportStar(require("./runtime"), exports);
|
|
33
|
+
exports.serialization = __importStar(require("./schemas"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RUNTIME } from "./runtime";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
3
|
+
*/
|
|
4
|
+
export declare const RUNTIME: Runtime;
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd";
|
|
7
|
+
version?: string;
|
|
8
|
+
parsedVersion?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b, _c, _d, _e;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RUNTIME = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
7
|
+
*/
|
|
8
|
+
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
9
|
+
/**
|
|
10
|
+
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
11
|
+
*/
|
|
12
|
+
const isWebWorker = typeof self === "object" &&
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
|
|
15
|
+
(((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" ||
|
|
16
|
+
((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" ||
|
|
17
|
+
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope");
|
|
18
|
+
/**
|
|
19
|
+
* A constant that indicates whether the environment the code is running is Deno.
|
|
20
|
+
*/
|
|
21
|
+
const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
22
|
+
/**
|
|
23
|
+
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
24
|
+
*/
|
|
25
|
+
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
26
|
+
/**
|
|
27
|
+
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
28
|
+
*/
|
|
29
|
+
const isNode = typeof process !== "undefined" &&
|
|
30
|
+
Boolean(process.version) &&
|
|
31
|
+
Boolean((_d = process.versions) === null || _d === void 0 ? void 0 : _d.node) &&
|
|
32
|
+
// Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
33
|
+
!isDeno &&
|
|
34
|
+
!isBun;
|
|
35
|
+
/**
|
|
36
|
+
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
37
|
+
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
38
|
+
*/
|
|
39
|
+
const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
|
|
40
|
+
/**
|
|
41
|
+
* A constant that indicates whether the environment the code is running is Cloudflare.
|
|
42
|
+
* https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent
|
|
43
|
+
*/
|
|
44
|
+
const isCloudflare = typeof globalThis !== "undefined" && ((_e = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _e === void 0 ? void 0 : _e.userAgent) === "Cloudflare-Workers";
|
|
45
|
+
/**
|
|
46
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
47
|
+
*/
|
|
48
|
+
exports.RUNTIME = evaluateRuntime();
|
|
49
|
+
function evaluateRuntime() {
|
|
50
|
+
if (isBrowser) {
|
|
51
|
+
return {
|
|
52
|
+
type: "browser",
|
|
53
|
+
version: window.navigator.userAgent,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (isCloudflare) {
|
|
57
|
+
return {
|
|
58
|
+
type: "workerd",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (isWebWorker) {
|
|
62
|
+
return {
|
|
63
|
+
type: "web-worker",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (isDeno) {
|
|
67
|
+
return {
|
|
68
|
+
type: "deno",
|
|
69
|
+
version: Deno.version.deno,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (isBun) {
|
|
73
|
+
return {
|
|
74
|
+
type: "bun",
|
|
75
|
+
version: Bun.version,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (isNode) {
|
|
79
|
+
return {
|
|
80
|
+
type: "node",
|
|
81
|
+
version: process.versions.node,
|
|
82
|
+
parsedVersion: Number(process.versions.node.split(".")[0]),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (isReactNative) {
|
|
86
|
+
return {
|
|
87
|
+
type: "react-native",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
type: "unknown",
|
|
92
|
+
};
|
|
93
|
+
}
|
package/core/schemas/Schema.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { SchemaUtils } from "./builders";
|
|
2
|
-
import { MaybePromise } from "./utils/MaybePromise";
|
|
3
2
|
export declare type Schema<Raw = unknown, Parsed = unknown> = BaseSchema<Raw, Parsed> & SchemaUtils<Raw, Parsed>;
|
|
4
3
|
export declare type inferRaw<S extends Schema> = S extends Schema<infer Raw, any> ? Raw : never;
|
|
5
4
|
export declare type inferParsed<S extends Schema> = S extends Schema<any, infer Parsed> ? Parsed : never;
|
|
6
5
|
export interface BaseSchema<Raw, Parsed> {
|
|
7
|
-
parse: (raw: unknown, opts?: SchemaOptions) =>
|
|
8
|
-
json: (parsed: unknown, opts?: SchemaOptions) =>
|
|
9
|
-
getType: () => SchemaType |
|
|
6
|
+
parse: (raw: unknown, opts?: SchemaOptions) => MaybeValid<Parsed>;
|
|
7
|
+
json: (parsed: unknown, opts?: SchemaOptions) => MaybeValid<Raw>;
|
|
8
|
+
getType: () => SchemaType | SchemaType;
|
|
10
9
|
}
|
|
11
10
|
export declare const SchemaType: {
|
|
11
|
+
readonly BIGINT: "bigint";
|
|
12
12
|
readonly DATE: "date";
|
|
13
13
|
readonly ENUM: "enum";
|
|
14
14
|
readonly LIST: "list";
|
|
15
15
|
readonly STRING_LITERAL: "stringLiteral";
|
|
16
|
+
readonly BOOLEAN_LITERAL: "booleanLiteral";
|
|
16
17
|
readonly OBJECT: "object";
|
|
17
18
|
readonly ANY: "any";
|
|
18
19
|
readonly BOOLEAN: "boolean";
|
|
@@ -22,6 +23,7 @@ export declare const SchemaType: {
|
|
|
22
23
|
readonly RECORD: "record";
|
|
23
24
|
readonly SET: "set";
|
|
24
25
|
readonly UNION: "union";
|
|
26
|
+
readonly UNDISCRIMINATED_UNION: "undiscriminatedUnion";
|
|
25
27
|
readonly OPTIONAL: "optional";
|
|
26
28
|
};
|
|
27
29
|
export declare type SchemaType = typeof SchemaType[keyof typeof SchemaType];
|
|
@@ -40,7 +42,44 @@ export interface ValidationError {
|
|
|
40
42
|
}
|
|
41
43
|
export interface SchemaOptions {
|
|
42
44
|
/**
|
|
45
|
+
* how to handle unrecognized keys in objects
|
|
46
|
+
*
|
|
47
|
+
* @default "fail"
|
|
48
|
+
*/
|
|
49
|
+
unrecognizedObjectKeys?: "fail" | "passthrough" | "strip";
|
|
50
|
+
/**
|
|
51
|
+
* whether to fail when an unrecognized discriminant value is
|
|
52
|
+
* encountered in a union
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
allowUnrecognizedUnionMembers?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* whether to fail when an unrecognized enum value is encountered
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
allowUnrecognizedEnumValues?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* whether to allow data that doesn't conform to the schema.
|
|
65
|
+
* invalid data is passed through without transformation.
|
|
66
|
+
*
|
|
67
|
+
* when this is enabled, .parse() and .json() will always
|
|
68
|
+
* return `ok: true`. `.parseOrThrow()` and `.jsonOrThrow()`
|
|
69
|
+
* will never fail.
|
|
70
|
+
*
|
|
43
71
|
* @default false
|
|
44
72
|
*/
|
|
45
|
-
|
|
73
|
+
skipValidation?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* each validation failure contains a "path" property, which is
|
|
76
|
+
* the breadcrumbs to the offending node in the JSON. you can supply
|
|
77
|
+
* a prefix that is prepended to all the errors' paths. this can be
|
|
78
|
+
* helpful for zurg's internal debug logging.
|
|
79
|
+
*/
|
|
80
|
+
breadcrumbsPrefix?: string[];
|
|
81
|
+
/**
|
|
82
|
+
* whether to send 'null' for optional properties explicitly set to 'undefined'.
|
|
83
|
+
*/
|
|
84
|
+
omitUndefined?: boolean;
|
|
46
85
|
}
|
package/core/schemas/Schema.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SchemaType = void 0;
|
|
4
4
|
exports.SchemaType = {
|
|
5
|
+
BIGINT: "bigint",
|
|
5
6
|
DATE: "date",
|
|
6
7
|
ENUM: "enum",
|
|
7
8
|
LIST: "list",
|
|
8
9
|
STRING_LITERAL: "stringLiteral",
|
|
10
|
+
BOOLEAN_LITERAL: "booleanLiteral",
|
|
9
11
|
OBJECT: "object",
|
|
10
12
|
ANY: "any",
|
|
11
13
|
BOOLEAN: "boolean",
|
|
@@ -15,5 +17,6 @@ exports.SchemaType = {
|
|
|
15
17
|
RECORD: "record",
|
|
16
18
|
SET: "set",
|
|
17
19
|
UNION: "union",
|
|
20
|
+
UNDISCRIMINATED_UNION: "undiscriminatedUnion",
|
|
18
21
|
OPTIONAL: "optional",
|
|
19
22
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bigint = void 0;
|
|
4
|
+
const Schema_1 = require("../../Schema");
|
|
5
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
7
|
+
const schema_utils_1 = require("../schema-utils");
|
|
8
|
+
function bigint() {
|
|
9
|
+
const baseSchema = {
|
|
10
|
+
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
11
|
+
if (typeof raw !== "string") {
|
|
12
|
+
return {
|
|
13
|
+
ok: false,
|
|
14
|
+
errors: [
|
|
15
|
+
{
|
|
16
|
+
path: breadcrumbsPrefix,
|
|
17
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "string"),
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
ok: true,
|
|
24
|
+
value: BigInt(raw),
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
json: (bigint, { breadcrumbsPrefix = [] } = {}) => {
|
|
28
|
+
if (typeof bigint === "bigint") {
|
|
29
|
+
return {
|
|
30
|
+
ok: true,
|
|
31
|
+
value: bigint.toString(),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return {
|
|
36
|
+
ok: false,
|
|
37
|
+
errors: [
|
|
38
|
+
{
|
|
39
|
+
path: breadcrumbsPrefix,
|
|
40
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(bigint, "bigint"),
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
getType: () => Schema_1.SchemaType.BIGINT,
|
|
47
|
+
};
|
|
48
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
49
|
+
}
|
|
50
|
+
exports.bigint = bigint;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { bigint } from "./bigint";
|
|
@@ -2,31 +2,42 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.date = void 0;
|
|
4
4
|
const Schema_1 = require("../../Schema");
|
|
5
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
5
7
|
const schema_utils_1 = require("../schema-utils");
|
|
6
8
|
// https://stackoverflow.com/questions/12756159/regex-and-iso8601-formatted-datetime
|
|
7
9
|
const ISO_8601_REGEX = /^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
|
8
10
|
function date() {
|
|
9
11
|
const baseSchema = {
|
|
10
|
-
parse: (raw) => {
|
|
11
|
-
if (typeof raw
|
|
12
|
+
parse: (raw, { breadcrumbsPrefix = [] } = {}) => {
|
|
13
|
+
if (typeof raw !== "string") {
|
|
12
14
|
return {
|
|
13
|
-
ok:
|
|
14
|
-
|
|
15
|
+
ok: false,
|
|
16
|
+
errors: [
|
|
17
|
+
{
|
|
18
|
+
path: breadcrumbsPrefix,
|
|
19
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "string"),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
15
22
|
};
|
|
16
23
|
}
|
|
17
|
-
|
|
24
|
+
if (!ISO_8601_REGEX.test(raw)) {
|
|
18
25
|
return {
|
|
19
26
|
ok: false,
|
|
20
27
|
errors: [
|
|
21
28
|
{
|
|
22
|
-
path:
|
|
23
|
-
message:
|
|
29
|
+
path: breadcrumbsPrefix,
|
|
30
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(raw, "ISO 8601 date string"),
|
|
24
31
|
},
|
|
25
32
|
],
|
|
26
33
|
};
|
|
27
34
|
}
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
value: new Date(raw),
|
|
38
|
+
};
|
|
28
39
|
},
|
|
29
|
-
json: (date) => {
|
|
40
|
+
json: (date, { breadcrumbsPrefix = [] } = {}) => {
|
|
30
41
|
if (date instanceof Date) {
|
|
31
42
|
return {
|
|
32
43
|
ok: true,
|
|
@@ -38,8 +49,8 @@ function date() {
|
|
|
38
49
|
ok: false,
|
|
39
50
|
errors: [
|
|
40
51
|
{
|
|
41
|
-
path:
|
|
42
|
-
message:
|
|
52
|
+
path: breadcrumbsPrefix,
|
|
53
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(date, "Date object"),
|
|
43
54
|
},
|
|
44
55
|
],
|
|
45
56
|
};
|
|
@@ -47,9 +58,6 @@ function date() {
|
|
|
47
58
|
},
|
|
48
59
|
getType: () => Schema_1.SchemaType.DATE,
|
|
49
60
|
};
|
|
50
|
-
return {
|
|
51
|
-
...baseSchema,
|
|
52
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
53
|
-
};
|
|
61
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
54
62
|
}
|
|
55
63
|
exports.date = date;
|
|
@@ -3,26 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.enum_ = void 0;
|
|
4
4
|
const Schema_1 = require("../../Schema");
|
|
5
5
|
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
7
|
function enum_(values) {
|
|
7
8
|
const validValues = new Set(values);
|
|
8
|
-
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.ENUM, (value, {
|
|
9
|
-
if (typeof value
|
|
9
|
+
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.ENUM, (value, { allowUnrecognizedEnumValues, breadcrumbsPrefix = [] } = {}) => {
|
|
10
|
+
if (typeof value !== "string") {
|
|
10
11
|
return {
|
|
11
|
-
ok:
|
|
12
|
-
|
|
12
|
+
ok: false,
|
|
13
|
+
errors: [
|
|
14
|
+
{
|
|
15
|
+
path: breadcrumbsPrefix,
|
|
16
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "string"),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
13
19
|
};
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
if (!validValues.has(value) && !allowUnrecognizedEnumValues) {
|
|
16
22
|
return {
|
|
17
23
|
ok: false,
|
|
18
24
|
errors: [
|
|
19
25
|
{
|
|
20
|
-
path:
|
|
21
|
-
message:
|
|
26
|
+
path: breadcrumbsPrefix,
|
|
27
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "enum"),
|
|
22
28
|
},
|
|
23
29
|
],
|
|
24
30
|
};
|
|
25
31
|
}
|
|
32
|
+
return {
|
|
33
|
+
ok: true,
|
|
34
|
+
value: value,
|
|
35
|
+
};
|
|
26
36
|
});
|
|
27
37
|
return schemaCreator();
|
|
28
38
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./bigint";
|
|
1
2
|
export * from "./date";
|
|
2
3
|
export * from "./enum";
|
|
3
4
|
export * from "./lazy";
|
|
@@ -9,4 +10,5 @@ export * from "./primitives";
|
|
|
9
10
|
export * from "./record";
|
|
10
11
|
export * from "./schema-utils";
|
|
11
12
|
export * from "./set";
|
|
13
|
+
export * from "./undiscriminated-union";
|
|
12
14
|
export * from "./union";
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bigint"), exports);
|
|
17
18
|
__exportStar(require("./date"), exports);
|
|
18
19
|
__exportStar(require("./enum"), exports);
|
|
19
20
|
__exportStar(require("./lazy"), exports);
|
|
@@ -25,4 +26,5 @@ __exportStar(require("./primitives"), exports);
|
|
|
25
26
|
__exportStar(require("./record"), exports);
|
|
26
27
|
__exportStar(require("./schema-utils"), exports);
|
|
27
28
|
__exportStar(require("./set"), exports);
|
|
29
|
+
__exportStar(require("./undiscriminated-union"), exports);
|
|
28
30
|
__exportStar(require("./union"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseSchema, Schema } from "../../Schema";
|
|
2
|
-
export declare type SchemaGetter<SchemaType extends Schema<any, any>> = () => SchemaType
|
|
2
|
+
export declare type SchemaGetter<SchemaType extends Schema<any, any>> = () => SchemaType;
|
|
3
3
|
export declare function lazy<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): Schema<Raw, Parsed>;
|
|
4
4
|
export declare function constructLazyBaseSchema<Raw, Parsed>(getter: SchemaGetter<Schema<Raw, Parsed>>): BaseSchema<Raw, Parsed>;
|
|
5
|
-
export declare function getMemoizedSchema<SchemaType extends Schema<any, any>>(getter: SchemaGetter<SchemaType>):
|
|
5
|
+
export declare function getMemoizedSchema<SchemaType extends Schema<any, any>>(getter: SchemaGetter<SchemaType>): SchemaType;
|
|
@@ -4,24 +4,21 @@ exports.getMemoizedSchema = exports.constructLazyBaseSchema = exports.lazy = voi
|
|
|
4
4
|
const schema_utils_1 = require("../schema-utils");
|
|
5
5
|
function lazy(getter) {
|
|
6
6
|
const baseSchema = constructLazyBaseSchema(getter);
|
|
7
|
-
return {
|
|
8
|
-
...baseSchema,
|
|
9
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
10
|
-
};
|
|
7
|
+
return Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
11
8
|
}
|
|
12
9
|
exports.lazy = lazy;
|
|
13
10
|
function constructLazyBaseSchema(getter) {
|
|
14
11
|
return {
|
|
15
|
-
parse:
|
|
16
|
-
json:
|
|
17
|
-
getType:
|
|
12
|
+
parse: (raw, opts) => getMemoizedSchema(getter).parse(raw, opts),
|
|
13
|
+
json: (parsed, opts) => getMemoizedSchema(getter).json(parsed, opts),
|
|
14
|
+
getType: () => getMemoizedSchema(getter).getType(),
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
17
|
exports.constructLazyBaseSchema = constructLazyBaseSchema;
|
|
21
|
-
|
|
18
|
+
function getMemoizedSchema(getter) {
|
|
22
19
|
const castedGetter = getter;
|
|
23
20
|
if (castedGetter.__zurg_memoized == null) {
|
|
24
|
-
castedGetter.__zurg_memoized =
|
|
21
|
+
castedGetter.__zurg_memoized = getter();
|
|
25
22
|
}
|
|
26
23
|
return castedGetter.__zurg_memoized;
|
|
27
24
|
}
|
|
@@ -6,16 +6,7 @@ const object_like_1 = require("../object-like");
|
|
|
6
6
|
const schema_utils_1 = require("../schema-utils");
|
|
7
7
|
const lazy_1 = require("./lazy");
|
|
8
8
|
function lazyObject(getter) {
|
|
9
|
-
const baseSchema = {
|
|
10
|
-
|
|
11
|
-
_getRawProperties: async () => (await (0, lazy_1.getMemoizedSchema)(getter))._getRawProperties(),
|
|
12
|
-
_getParsedProperties: async () => (await (0, lazy_1.getMemoizedSchema)(getter))._getParsedProperties(),
|
|
13
|
-
};
|
|
14
|
-
return {
|
|
15
|
-
...baseSchema,
|
|
16
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
17
|
-
...(0, object_like_1.getObjectLikeUtils)(baseSchema),
|
|
18
|
-
...(0, object_1.getObjectUtils)(baseSchema),
|
|
19
|
-
};
|
|
9
|
+
const baseSchema = Object.assign(Object.assign({}, (0, lazy_1.constructLazyBaseSchema)(getter)), { _getRawProperties: () => (0, lazy_1.getMemoizedSchema)(getter)._getRawProperties(), _getParsedProperties: () => (0, lazy_1.getMemoizedSchema)(getter)._getParsedProperties() });
|
|
10
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), (0, object_1.getObjectUtils)(baseSchema));
|
|
20
11
|
}
|
|
21
12
|
exports.lazyObject = lazyObject;
|
|
@@ -2,33 +2,38 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.list = void 0;
|
|
4
4
|
const Schema_1 = require("../../Schema");
|
|
5
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
6
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
5
7
|
const schema_utils_1 = require("../schema-utils");
|
|
6
8
|
function list(schema) {
|
|
7
9
|
const baseSchema = {
|
|
8
|
-
parse:
|
|
9
|
-
|
|
10
|
+
parse: (raw, opts) => validateAndTransformArray(raw, (item, index) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return schema.parse(item, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `[${index}]`] }));
|
|
13
|
+
}),
|
|
14
|
+
json: (parsed, opts) => validateAndTransformArray(parsed, (item, index) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return schema.json(item, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), `[${index}]`] }));
|
|
17
|
+
}),
|
|
10
18
|
getType: () => Schema_1.SchemaType.LIST,
|
|
11
19
|
};
|
|
12
|
-
return {
|
|
13
|
-
...baseSchema,
|
|
14
|
-
...(0, schema_utils_1.getSchemaUtils)(baseSchema),
|
|
15
|
-
};
|
|
20
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
16
21
|
}
|
|
17
22
|
exports.list = list;
|
|
18
|
-
|
|
23
|
+
function validateAndTransformArray(value, transformItem) {
|
|
19
24
|
if (!Array.isArray(value)) {
|
|
20
25
|
return {
|
|
21
26
|
ok: false,
|
|
22
27
|
errors: [
|
|
23
28
|
{
|
|
24
|
-
message:
|
|
29
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "list"),
|
|
25
30
|
path: [],
|
|
26
31
|
},
|
|
27
32
|
],
|
|
28
33
|
};
|
|
29
34
|
}
|
|
30
|
-
const maybeValidItems =
|
|
31
|
-
return maybeValidItems.reduce((acc, item
|
|
35
|
+
const maybeValidItems = value.map((item, index) => transformItem(item, index));
|
|
36
|
+
return maybeValidItems.reduce((acc, item) => {
|
|
32
37
|
if (acc.ok && item.ok) {
|
|
33
38
|
return {
|
|
34
39
|
ok: true,
|
|
@@ -40,10 +45,7 @@ async function validateAndTransformArray(value, transformItem) {
|
|
|
40
45
|
errors.push(...acc.errors);
|
|
41
46
|
}
|
|
42
47
|
if (!item.ok) {
|
|
43
|
-
errors.push(...item.errors
|
|
44
|
-
path: [`[${index}]`, ...error.path],
|
|
45
|
-
message: error.message,
|
|
46
|
-
})));
|
|
48
|
+
errors.push(...item.errors);
|
|
47
49
|
}
|
|
48
50
|
return {
|
|
49
51
|
ok: false,
|