@rulebricks/sdk 1.0.0
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 +26 -0
- package/Client.js +47 -0
- package/LICENSE.txt +21 -0
- package/README.md +83 -0
- package/api/errors/BadRequestError.d.ts +7 -0
- package/api/errors/BadRequestError.js +47 -0
- package/api/errors/ForbiddenError.d.ts +7 -0
- package/api/errors/ForbiddenError.js +47 -0
- package/api/errors/InternalServerError.d.ts +7 -0
- package/api/errors/InternalServerError.js +47 -0
- package/api/errors/NotFoundError.d.ts +7 -0
- package/api/errors/NotFoundError.js +47 -0
- package/api/errors/index.d.ts +1 -0
- package/api/errors/index.js +24 -0
- package/api/index.d.ts +1 -0
- package/api/index.js +23 -0
- package/api/resources/assets/client/Client.d.ts +100 -0
- package/api/resources/assets/client/Client.js +611 -0
- package/api/resources/assets/client/index.d.ts +1 -0
- package/api/resources/assets/client/index.js +21 -0
- package/api/resources/assets/client/requests/DeleteFolderRequest.d.ts +1 -0
- package/api/resources/assets/client/requests/DeleteFolderRequest.js +5 -0
- package/api/resources/assets/client/requests/DeleteRuleRequest.d.ts +1 -0
- package/api/resources/assets/client/requests/DeleteRuleRequest.js +5 -0
- package/api/resources/assets/client/requests/ExportRuleRequest.d.ts +1 -0
- package/api/resources/assets/client/requests/ExportRuleRequest.js +5 -0
- package/api/resources/assets/client/requests/ImportRuleRequest.d.ts +1 -0
- package/api/resources/assets/client/requests/ImportRuleRequest.js +5 -0
- package/api/resources/assets/client/requests/ListRulesRequest.d.ts +1 -0
- package/api/resources/assets/client/requests/ListRulesRequest.js +5 -0
- package/api/resources/assets/client/requests/UpsertFolderRequest.d.ts +1 -0
- package/api/resources/assets/client/requests/UpsertFolderRequest.js +5 -0
- package/api/resources/assets/client/requests/index.d.ts +1 -0
- package/api/resources/assets/client/requests/index.js +2 -0
- package/api/resources/assets/index.d.ts +1 -0
- package/api/resources/assets/index.js +22 -0
- package/api/resources/assets/types/DeleteFolderResponse.d.ts +1 -0
- package/api/resources/assets/types/DeleteFolderResponse.js +5 -0
- package/api/resources/assets/types/DeleteRuleResponse.d.ts +1 -0
- package/api/resources/assets/types/DeleteRuleResponse.js +5 -0
- package/api/resources/assets/types/ListFlowsResponseItem.d.ts +1 -0
- package/api/resources/assets/types/ListFlowsResponseItem.js +5 -0
- package/api/resources/assets/types/ListFoldersResponseItem.d.ts +1 -0
- package/api/resources/assets/types/ListFoldersResponseItem.js +5 -0
- package/api/resources/assets/types/ListRulesResponseItem.d.ts +1 -0
- package/api/resources/assets/types/ListRulesResponseItem.js +5 -0
- package/api/resources/assets/types/ListRulesResponseItemFolder.d.ts +1 -0
- package/api/resources/assets/types/ListRulesResponseItemFolder.js +5 -0
- package/api/resources/assets/types/UpsertFolderResponse.d.ts +1 -0
- package/api/resources/assets/types/UpsertFolderResponse.js +5 -0
- package/api/resources/assets/types/UsageResponse.d.ts +1 -0
- package/api/resources/assets/types/UsageResponse.js +5 -0
- package/api/resources/assets/types/index.d.ts +1 -0
- package/api/resources/assets/types/index.js +28 -0
- package/api/resources/decisions/client/Client.d.ts +19 -0
- package/api/resources/decisions/client/Client.js +146 -0
- package/api/resources/decisions/client/index.d.ts +1 -0
- package/api/resources/decisions/client/index.js +21 -0
- package/api/resources/decisions/client/requests/QueryRequest.d.ts +1 -0
- package/api/resources/decisions/client/requests/QueryRequest.js +5 -0
- package/api/resources/decisions/client/requests/index.d.ts +1 -0
- package/api/resources/decisions/client/requests/index.js +2 -0
- package/api/resources/decisions/index.d.ts +1 -0
- package/api/resources/decisions/index.js +22 -0
- package/api/resources/decisions/types/QueryResponse.d.ts +1 -0
- package/api/resources/decisions/types/QueryResponse.js +5 -0
- package/api/resources/decisions/types/index.d.ts +1 -0
- package/api/resources/decisions/types/index.js +21 -0
- package/api/resources/flows/client/Client.d.ts +21 -0
- package/api/resources/flows/client/Client.js +133 -0
- package/api/resources/flows/client/index.d.ts +1 -0
- package/api/resources/flows/client/index.js +2 -0
- package/api/resources/flows/index.d.ts +1 -0
- package/api/resources/flows/index.js +21 -0
- package/api/resources/index.d.ts +8 -0
- package/api/resources/index.js +54 -0
- package/api/resources/rules/client/Client.d.ts +60 -0
- package/api/resources/rules/client/Client.js +272 -0
- package/api/resources/rules/client/index.d.ts +1 -0
- package/api/resources/rules/client/index.js +2 -0
- package/api/resources/rules/index.d.ts +1 -0
- package/api/resources/rules/index.js +21 -0
- package/api/resources/tests/client/Client.d.ts +82 -0
- package/api/resources/tests/client/Client.js +439 -0
- package/api/resources/tests/client/index.d.ts +1 -0
- package/api/resources/tests/client/index.js +21 -0
- package/api/resources/tests/client/requests/CreateFlowTestRequest.d.ts +1 -0
- package/api/resources/tests/client/requests/CreateFlowTestRequest.js +5 -0
- package/api/resources/tests/client/requests/CreateRuleTestRequest.d.ts +1 -0
- package/api/resources/tests/client/requests/CreateRuleTestRequest.js +5 -0
- package/api/resources/tests/client/requests/index.d.ts +1 -0
- package/api/resources/tests/client/requests/index.js +2 -0
- package/api/resources/tests/index.d.ts +1 -0
- package/api/resources/tests/index.js +22 -0
- package/api/resources/tests/types/CreateFlowTestResponse.d.ts +1 -0
- package/api/resources/tests/types/CreateFlowTestResponse.js +5 -0
- package/api/resources/tests/types/CreateRuleTestResponse.d.ts +1 -0
- package/api/resources/tests/types/CreateRuleTestResponse.js +5 -0
- package/api/resources/tests/types/DeleteFlowTestResponse.d.ts +1 -0
- package/api/resources/tests/types/DeleteFlowTestResponse.js +5 -0
- package/api/resources/tests/types/DeleteRuleTestResponse.d.ts +1 -0
- package/api/resources/tests/types/DeleteRuleTestResponse.js +5 -0
- package/api/resources/tests/types/ListFlowTestsResponseItem.d.ts +1 -0
- package/api/resources/tests/types/ListFlowTestsResponseItem.js +5 -0
- package/api/resources/tests/types/ListRuleTestsResponseItem.d.ts +1 -0
- package/api/resources/tests/types/ListRuleTestsResponseItem.js +5 -0
- package/api/resources/tests/types/index.d.ts +1 -0
- package/api/resources/tests/types/index.js +26 -0
- package/api/resources/users/client/Client.d.ts +62 -0
- package/api/resources/users/client/Client.js +269 -0
- package/api/resources/users/client/index.d.ts +1 -0
- package/api/resources/users/client/index.js +21 -0
- package/api/resources/users/client/requests/CreateGroupRequest.d.ts +1 -0
- package/api/resources/users/client/requests/CreateGroupRequest.js +5 -0
- package/api/resources/users/client/requests/InviteRequest.d.ts +1 -0
- package/api/resources/users/client/requests/InviteRequest.js +5 -0
- package/api/resources/users/client/requests/index.d.ts +1 -0
- package/api/resources/users/client/requests/index.js +2 -0
- package/api/resources/users/index.d.ts +1 -0
- package/api/resources/users/index.js +22 -0
- package/api/resources/users/types/CreateGroupResponse.d.ts +1 -0
- package/api/resources/users/types/CreateGroupResponse.js +5 -0
- package/api/resources/users/types/InviteRequestRole.d.ts +5 -0
- package/api/resources/users/types/InviteRequestRole.js +10 -0
- package/api/resources/users/types/InviteResponse.d.ts +1 -0
- package/api/resources/users/types/InviteResponse.js +5 -0
- package/api/resources/users/types/ListGroupsResponseItem.d.ts +1 -0
- package/api/resources/users/types/ListGroupsResponseItem.js +5 -0
- package/api/resources/users/types/index.d.ts +1 -0
- package/api/resources/users/types/index.js +24 -0
- package/api/resources/values/client/Client.d.ts +37 -0
- package/api/resources/values/client/Client.js +255 -0
- package/api/resources/values/client/index.d.ts +1 -0
- package/api/resources/values/client/index.js +21 -0
- package/api/resources/values/client/requests/DeleteDynamicValueRequest.d.ts +1 -0
- package/api/resources/values/client/requests/DeleteDynamicValueRequest.js +5 -0
- package/api/resources/values/client/requests/ListDynamicValuesRequest.d.ts +1 -0
- package/api/resources/values/client/requests/ListDynamicValuesRequest.js +5 -0
- package/api/resources/values/client/requests/index.d.ts +1 -0
- package/api/resources/values/client/requests/index.js +2 -0
- package/api/resources/values/index.d.ts +1 -0
- package/api/resources/values/index.js +22 -0
- package/api/resources/values/types/DeleteDynamicValueResponse.d.ts +1 -0
- package/api/resources/values/types/DeleteDynamicValueResponse.js +5 -0
- package/api/resources/values/types/ListDynamicValuesResponseItem.d.ts +1 -0
- package/api/resources/values/types/ListDynamicValuesResponseItem.js +5 -0
- package/api/resources/values/types/ListDynamicValuesResponseItemType.d.ts +7 -0
- package/api/resources/values/types/ListDynamicValuesResponseItemType.js +12 -0
- package/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +1 -0
- package/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +5 -0
- package/api/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +1 -0
- package/api/resources/values/types/ListDynamicValuesResponseItemValue.js +5 -0
- package/api/resources/values/types/UpdateRequestValue.d.ts +1 -0
- package/api/resources/values/types/UpdateRequestValue.js +5 -0
- package/api/resources/values/types/UpdateResponseItem.d.ts +1 -0
- package/api/resources/values/types/UpdateResponseItem.js +5 -0
- package/api/resources/values/types/UpdateResponseItemType.d.ts +7 -0
- package/api/resources/values/types/UpdateResponseItemType.js +12 -0
- package/api/resources/values/types/UpdateResponseItemValue.d.ts +1 -0
- package/api/resources/values/types/UpdateResponseItemValue.js +5 -0
- package/api/resources/values/types/index.d.ts +1 -0
- package/api/resources/values/types/index.js +29 -0
- package/api/types/BadRequestErrorBody.d.ts +1 -0
- package/api/types/BadRequestErrorBody.js +5 -0
- package/api/types/ForbiddenErrorBody.d.ts +1 -0
- package/api/types/ForbiddenErrorBody.js +5 -0
- package/api/types/InternalServerErrorBody.d.ts +1 -0
- package/api/types/InternalServerErrorBody.js +5 -0
- package/api/types/NotFoundErrorBody.d.ts +1 -0
- package/api/types/NotFoundErrorBody.js +5 -0
- package/api/types/index.d.ts +1 -0
- package/api/types/index.js +24 -0
- package/banner.png +0 -0
- package/core/fetcher/APIResponse.d.ts +1 -0
- package/core/fetcher/APIResponse.js +2 -0
- package/core/fetcher/Fetcher.d.ts +3 -0
- package/core/fetcher/Fetcher.js +161 -0
- package/core/fetcher/Supplier.d.ts +4 -0
- package/core/fetcher/Supplier.js +32 -0
- package/core/fetcher/getHeader.d.ts +2 -0
- package/core/fetcher/getHeader.js +12 -0
- package/core/fetcher/index.d.ts +9 -0
- package/core/fetcher/index.js +9 -0
- package/core/index.d.ts +2 -0
- package/core/index.js +39 -0
- package/core/schemas/Schema.d.ts +19 -0
- package/core/schemas/Schema.js +21 -0
- package/core/schemas/builders/date/date.d.ts +4 -0
- package/core/schemas/builders/date/date.js +63 -0
- package/core/schemas/builders/date/index.d.ts +3 -0
- package/core/schemas/builders/date/index.js +5 -0
- package/core/schemas/builders/enum/enum.d.ts +3 -0
- package/core/schemas/builders/enum/enum.js +39 -0
- package/core/schemas/builders/enum/index.d.ts +3 -0
- package/core/schemas/builders/enum/index.js +5 -0
- package/core/schemas/builders/index.d.ts +1 -0
- package/core/schemas/builders/index.js +33 -0
- package/core/schemas/builders/lazy/index.d.ts +5 -0
- package/core/schemas/builders/lazy/index.js +7 -0
- package/core/schemas/builders/lazy/lazy.d.ts +13 -0
- package/core/schemas/builders/lazy/lazy.js +46 -0
- package/core/schemas/builders/lazy/lazyObject.d.ts +8 -0
- package/core/schemas/builders/lazy/lazyObject.js +31 -0
- package/core/schemas/builders/list/index.d.ts +3 -0
- package/core/schemas/builders/list/index.js +5 -0
- package/core/schemas/builders/list/list.d.ts +7 -0
- package/core/schemas/builders/list/list.js +78 -0
- package/core/schemas/builders/literals/booleanLiteral.d.ts +3 -0
- package/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/core/schemas/builders/literals/index.d.ts +5 -0
- package/core/schemas/builders/literals/index.js +7 -0
- package/core/schemas/builders/literals/stringLiteral.d.ts +3 -0
- package/core/schemas/builders/literals/stringLiteral.js +29 -0
- package/core/schemas/builders/object/index.d.ts +9 -0
- package/core/schemas/builders/object/index.js +11 -0
- package/core/schemas/builders/object/object.d.ts +27 -0
- package/core/schemas/builders/object/object.js +268 -0
- package/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +2 -0
- package/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/core/schemas/builders/object/property.d.ts +7 -0
- package/core/schemas/builders/object/property.js +16 -0
- package/core/schemas/builders/object/types.d.ts +1 -0
- package/core/schemas/builders/object/types.js +2 -0
- package/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +23 -0
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +73 -0
- package/core/schemas/builders/object-like/index.d.ts +4 -0
- package/core/schemas/builders/object-like/index.js +6 -0
- package/core/schemas/builders/object-like/types.d.ts +1 -0
- package/core/schemas/builders/object-like/types.js +2 -0
- package/core/schemas/builders/primitives/any.d.ts +3 -0
- package/core/schemas/builders/primitives/any.js +6 -0
- package/core/schemas/builders/primitives/boolean.d.ts +3 -0
- package/core/schemas/builders/primitives/boolean.js +25 -0
- package/core/schemas/builders/primitives/index.d.ts +6 -0
- package/core/schemas/builders/primitives/index.js +13 -0
- package/core/schemas/builders/primitives/number.d.ts +3 -0
- package/core/schemas/builders/primitives/number.js +25 -0
- package/core/schemas/builders/primitives/string.d.ts +3 -0
- package/core/schemas/builders/primitives/string.js +25 -0
- package/core/schemas/builders/primitives/unknown.d.ts +3 -0
- package/core/schemas/builders/primitives/unknown.js +6 -0
- package/core/schemas/builders/record/index.d.ts +3 -0
- package/core/schemas/builders/record/index.js +5 -0
- package/core/schemas/builders/record/record.d.ts +7 -0
- package/core/schemas/builders/record/record.js +116 -0
- package/core/schemas/builders/record/types.d.ts +1 -0
- package/core/schemas/builders/record/types.js +2 -0
- package/core/schemas/builders/schema-utils/JsonError.d.ts +5 -0
- package/core/schemas/builders/schema-utils/JsonError.js +12 -0
- package/core/schemas/builders/schema-utils/ParseError.d.ts +5 -0
- package/core/schemas/builders/schema-utils/ParseError.js +12 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +54 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +95 -0
- package/core/schemas/builders/schema-utils/index.d.ts +9 -0
- package/core/schemas/builders/schema-utils/index.js +11 -0
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +2 -0
- package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
- package/core/schemas/builders/set/index.d.ts +3 -0
- package/core/schemas/builders/set/index.js +5 -0
- package/core/schemas/builders/set/set.d.ts +7 -0
- package/core/schemas/builders/set/set.js +63 -0
- package/core/schemas/builders/undiscriminated-union/index.d.ts +3 -0
- package/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/core/schemas/builders/undiscriminated-union/types.d.ts +1 -0
- package/core/schemas/builders/undiscriminated-union/types.js +2 -0
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +7 -0
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +61 -0
- package/core/schemas/builders/union/discriminant.d.ts +5 -0
- package/core/schemas/builders/union/discriminant.js +10 -0
- package/core/schemas/builders/union/index.d.ts +5 -0
- package/core/schemas/builders/union/index.js +7 -0
- package/core/schemas/builders/union/types.d.ts +1 -0
- package/core/schemas/builders/union/types.js +2 -0
- package/core/schemas/builders/union/union.d.ts +8 -0
- package/core/schemas/builders/union/union.js +152 -0
- package/core/schemas/index.d.ts +1 -0
- package/core/schemas/index.js +21 -0
- package/core/schemas/utils/MaybePromise.d.ts +1 -0
- package/core/schemas/utils/MaybePromise.js +2 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
- package/core/schemas/utils/createIdentitySchemaCreator.d.ts +7 -0
- package/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
- package/core/schemas/utils/entries.d.ts +2 -0
- package/core/schemas/utils/entries.js +7 -0
- package/core/schemas/utils/filterObject.d.ts +2 -0
- package/core/schemas/utils/filterObject.js +14 -0
- package/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +2 -0
- package/core/schemas/utils/getErrorMessageForIncorrectType.js +24 -0
- package/core/schemas/utils/isPlainObject.d.ts +2 -0
- package/core/schemas/utils/isPlainObject.js +18 -0
- package/core/schemas/utils/keys.d.ts +2 -0
- package/core/schemas/utils/keys.js +7 -0
- package/core/schemas/utils/maybeSkipValidation.d.ts +2 -0
- package/core/schemas/utils/maybeSkipValidation.js +47 -0
- package/core/schemas/utils/partition.d.ts +2 -0
- package/core/schemas/utils/partition.js +16 -0
- package/dist/Client.d.ts +26 -0
- package/dist/Client.js +47 -0
- package/dist/api/errors/BadRequestError.d.ts +7 -0
- package/dist/api/errors/BadRequestError.js +47 -0
- package/dist/api/errors/ForbiddenError.d.ts +7 -0
- package/dist/api/errors/ForbiddenError.js +47 -0
- package/dist/api/errors/InternalServerError.d.ts +7 -0
- package/dist/api/errors/InternalServerError.js +47 -0
- package/dist/api/errors/NotFoundError.d.ts +7 -0
- package/dist/api/errors/NotFoundError.js +47 -0
- package/dist/api/errors/index.d.ts +1 -0
- package/dist/api/errors/index.js +24 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +23 -0
- package/dist/api/resources/assets/client/Client.d.ts +100 -0
- package/dist/api/resources/assets/client/Client.js +611 -0
- package/dist/api/resources/assets/client/index.d.ts +1 -0
- package/dist/api/resources/assets/client/index.js +21 -0
- package/dist/api/resources/assets/client/requests/DeleteFolderRequest.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/DeleteFolderRequest.js +5 -0
- package/dist/api/resources/assets/client/requests/DeleteRuleRequest.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/DeleteRuleRequest.js +5 -0
- package/dist/api/resources/assets/client/requests/ExportRuleRequest.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/ExportRuleRequest.js +5 -0
- package/dist/api/resources/assets/client/requests/ImportRuleRequest.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/ImportRuleRequest.js +5 -0
- package/dist/api/resources/assets/client/requests/ListRulesRequest.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/ListRulesRequest.js +5 -0
- package/dist/api/resources/assets/client/requests/UpsertFolderRequest.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/UpsertFolderRequest.js +5 -0
- package/dist/api/resources/assets/client/requests/index.d.ts +1 -0
- package/dist/api/resources/assets/client/requests/index.js +2 -0
- package/dist/api/resources/assets/index.d.ts +1 -0
- package/dist/api/resources/assets/index.js +22 -0
- package/dist/api/resources/assets/types/DeleteFolderResponse.d.ts +1 -0
- package/dist/api/resources/assets/types/DeleteFolderResponse.js +5 -0
- package/dist/api/resources/assets/types/DeleteRuleResponse.d.ts +1 -0
- package/dist/api/resources/assets/types/DeleteRuleResponse.js +5 -0
- package/dist/api/resources/assets/types/ListFlowsResponseItem.d.ts +1 -0
- package/dist/api/resources/assets/types/ListFlowsResponseItem.js +5 -0
- package/dist/api/resources/assets/types/ListFoldersResponseItem.d.ts +1 -0
- package/dist/api/resources/assets/types/ListFoldersResponseItem.js +5 -0
- package/dist/api/resources/assets/types/ListRulesResponseItem.d.ts +1 -0
- package/dist/api/resources/assets/types/ListRulesResponseItem.js +5 -0
- package/dist/api/resources/assets/types/ListRulesResponseItemFolder.d.ts +1 -0
- package/dist/api/resources/assets/types/ListRulesResponseItemFolder.js +5 -0
- package/dist/api/resources/assets/types/UpsertFolderResponse.d.ts +1 -0
- package/dist/api/resources/assets/types/UpsertFolderResponse.js +5 -0
- package/dist/api/resources/assets/types/UsageResponse.d.ts +1 -0
- package/dist/api/resources/assets/types/UsageResponse.js +5 -0
- package/dist/api/resources/assets/types/index.d.ts +1 -0
- package/dist/api/resources/assets/types/index.js +28 -0
- package/dist/api/resources/decisions/client/Client.d.ts +19 -0
- package/dist/api/resources/decisions/client/Client.js +146 -0
- package/dist/api/resources/decisions/client/index.d.ts +1 -0
- package/dist/api/resources/decisions/client/index.js +21 -0
- package/dist/api/resources/decisions/client/requests/QueryRequest.d.ts +1 -0
- package/dist/api/resources/decisions/client/requests/QueryRequest.js +5 -0
- package/dist/api/resources/decisions/client/requests/index.d.ts +1 -0
- package/dist/api/resources/decisions/client/requests/index.js +2 -0
- package/dist/api/resources/decisions/index.d.ts +1 -0
- package/dist/api/resources/decisions/index.js +22 -0
- package/dist/api/resources/decisions/types/QueryResponse.d.ts +1 -0
- package/dist/api/resources/decisions/types/QueryResponse.js +5 -0
- package/dist/api/resources/decisions/types/index.d.ts +1 -0
- package/dist/api/resources/decisions/types/index.js +21 -0
- package/dist/api/resources/flows/client/Client.d.ts +21 -0
- package/dist/api/resources/flows/client/Client.js +133 -0
- package/dist/api/resources/flows/client/index.d.ts +1 -0
- package/dist/api/resources/flows/client/index.js +2 -0
- package/dist/api/resources/flows/index.d.ts +1 -0
- package/dist/api/resources/flows/index.js +21 -0
- package/dist/api/resources/index.d.ts +8 -0
- package/dist/api/resources/index.js +54 -0
- package/dist/api/resources/rules/client/Client.d.ts +60 -0
- package/dist/api/resources/rules/client/Client.js +272 -0
- package/dist/api/resources/rules/client/index.d.ts +1 -0
- package/dist/api/resources/rules/client/index.js +2 -0
- package/dist/api/resources/rules/index.d.ts +1 -0
- package/dist/api/resources/rules/index.js +21 -0
- package/dist/api/resources/tests/client/Client.d.ts +82 -0
- package/dist/api/resources/tests/client/Client.js +439 -0
- package/dist/api/resources/tests/client/index.d.ts +1 -0
- package/dist/api/resources/tests/client/index.js +21 -0
- package/dist/api/resources/tests/client/requests/CreateFlowTestRequest.d.ts +1 -0
- package/dist/api/resources/tests/client/requests/CreateFlowTestRequest.js +5 -0
- package/dist/api/resources/tests/client/requests/CreateRuleTestRequest.d.ts +1 -0
- package/dist/api/resources/tests/client/requests/CreateRuleTestRequest.js +5 -0
- package/dist/api/resources/tests/client/requests/index.d.ts +1 -0
- package/dist/api/resources/tests/client/requests/index.js +2 -0
- package/dist/api/resources/tests/index.d.ts +1 -0
- package/dist/api/resources/tests/index.js +22 -0
- package/dist/api/resources/tests/types/CreateFlowTestResponse.d.ts +1 -0
- package/dist/api/resources/tests/types/CreateFlowTestResponse.js +5 -0
- package/dist/api/resources/tests/types/CreateRuleTestResponse.d.ts +1 -0
- package/dist/api/resources/tests/types/CreateRuleTestResponse.js +5 -0
- package/dist/api/resources/tests/types/DeleteFlowTestResponse.d.ts +1 -0
- package/dist/api/resources/tests/types/DeleteFlowTestResponse.js +5 -0
- package/dist/api/resources/tests/types/DeleteRuleTestResponse.d.ts +1 -0
- package/dist/api/resources/tests/types/DeleteRuleTestResponse.js +5 -0
- package/dist/api/resources/tests/types/ListFlowTestsResponseItem.d.ts +1 -0
- package/dist/api/resources/tests/types/ListFlowTestsResponseItem.js +5 -0
- package/dist/api/resources/tests/types/ListRuleTestsResponseItem.d.ts +1 -0
- package/dist/api/resources/tests/types/ListRuleTestsResponseItem.js +5 -0
- package/dist/api/resources/tests/types/index.d.ts +1 -0
- package/dist/api/resources/tests/types/index.js +26 -0
- package/dist/api/resources/users/client/Client.d.ts +62 -0
- package/dist/api/resources/users/client/Client.js +269 -0
- package/dist/api/resources/users/client/index.d.ts +1 -0
- package/dist/api/resources/users/client/index.js +21 -0
- package/dist/api/resources/users/client/requests/CreateGroupRequest.d.ts +1 -0
- package/dist/api/resources/users/client/requests/CreateGroupRequest.js +5 -0
- package/dist/api/resources/users/client/requests/InviteRequest.d.ts +1 -0
- package/dist/api/resources/users/client/requests/InviteRequest.js +5 -0
- package/dist/api/resources/users/client/requests/index.d.ts +1 -0
- package/dist/api/resources/users/client/requests/index.js +2 -0
- package/dist/api/resources/users/index.d.ts +1 -0
- package/dist/api/resources/users/index.js +22 -0
- package/dist/api/resources/users/types/CreateGroupResponse.d.ts +1 -0
- package/dist/api/resources/users/types/CreateGroupResponse.js +5 -0
- package/dist/api/resources/users/types/InviteRequestRole.d.ts +5 -0
- package/dist/api/resources/users/types/InviteRequestRole.js +10 -0
- package/dist/api/resources/users/types/InviteResponse.d.ts +1 -0
- package/dist/api/resources/users/types/InviteResponse.js +5 -0
- package/dist/api/resources/users/types/ListGroupsResponseItem.d.ts +1 -0
- package/dist/api/resources/users/types/ListGroupsResponseItem.js +5 -0
- package/dist/api/resources/users/types/index.d.ts +1 -0
- package/dist/api/resources/users/types/index.js +24 -0
- package/dist/api/resources/values/client/Client.d.ts +37 -0
- package/dist/api/resources/values/client/Client.js +255 -0
- package/dist/api/resources/values/client/index.d.ts +1 -0
- package/dist/api/resources/values/client/index.js +21 -0
- package/dist/api/resources/values/client/requests/DeleteDynamicValueRequest.d.ts +1 -0
- package/dist/api/resources/values/client/requests/DeleteDynamicValueRequest.js +5 -0
- package/dist/api/resources/values/client/requests/ListDynamicValuesRequest.d.ts +1 -0
- package/dist/api/resources/values/client/requests/ListDynamicValuesRequest.js +5 -0
- package/dist/api/resources/values/client/requests/index.d.ts +1 -0
- package/dist/api/resources/values/client/requests/index.js +2 -0
- package/dist/api/resources/values/index.d.ts +1 -0
- package/dist/api/resources/values/index.js +22 -0
- package/dist/api/resources/values/types/DeleteDynamicValueResponse.d.ts +1 -0
- package/dist/api/resources/values/types/DeleteDynamicValueResponse.js +5 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItem.d.ts +1 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItem.js +5 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItemType.d.ts +7 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItemType.js +12 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +1 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +5 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +1 -0
- package/dist/api/resources/values/types/ListDynamicValuesResponseItemValue.js +5 -0
- package/dist/api/resources/values/types/UpdateRequestValue.d.ts +1 -0
- package/dist/api/resources/values/types/UpdateRequestValue.js +5 -0
- package/dist/api/resources/values/types/UpdateResponseItem.d.ts +1 -0
- package/dist/api/resources/values/types/UpdateResponseItem.js +5 -0
- package/dist/api/resources/values/types/UpdateResponseItemType.d.ts +7 -0
- package/dist/api/resources/values/types/UpdateResponseItemType.js +12 -0
- package/dist/api/resources/values/types/UpdateResponseItemValue.d.ts +1 -0
- package/dist/api/resources/values/types/UpdateResponseItemValue.js +5 -0
- package/dist/api/resources/values/types/index.d.ts +1 -0
- package/dist/api/resources/values/types/index.js +29 -0
- package/dist/api/types/BadRequestErrorBody.d.ts +1 -0
- package/dist/api/types/BadRequestErrorBody.js +5 -0
- package/dist/api/types/ForbiddenErrorBody.d.ts +1 -0
- package/dist/api/types/ForbiddenErrorBody.js +5 -0
- package/dist/api/types/InternalServerErrorBody.d.ts +1 -0
- package/dist/api/types/InternalServerErrorBody.js +5 -0
- package/dist/api/types/NotFoundErrorBody.d.ts +1 -0
- package/dist/api/types/NotFoundErrorBody.js +5 -0
- package/dist/api/types/index.d.ts +1 -0
- package/dist/api/types/index.js +24 -0
- package/dist/core/fetcher/APIResponse.d.ts +1 -0
- package/dist/core/fetcher/APIResponse.js +2 -0
- package/dist/core/fetcher/Fetcher.d.ts +3 -0
- package/dist/core/fetcher/Fetcher.js +161 -0
- package/dist/core/fetcher/Supplier.d.ts +4 -0
- package/dist/core/fetcher/Supplier.js +32 -0
- package/dist/core/fetcher/getHeader.d.ts +2 -0
- package/dist/core/fetcher/getHeader.js +12 -0
- package/dist/core/fetcher/index.d.ts +9 -0
- package/dist/core/fetcher/index.js +9 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +39 -0
- package/dist/core/schemas/Schema.d.ts +19 -0
- package/dist/core/schemas/Schema.js +21 -0
- package/dist/core/schemas/builders/date/date.d.ts +4 -0
- package/dist/core/schemas/builders/date/date.js +63 -0
- package/dist/core/schemas/builders/date/index.d.ts +3 -0
- package/dist/core/schemas/builders/date/index.js +5 -0
- package/dist/core/schemas/builders/enum/enum.d.ts +3 -0
- package/dist/core/schemas/builders/enum/enum.js +39 -0
- package/dist/core/schemas/builders/enum/index.d.ts +3 -0
- package/dist/core/schemas/builders/enum/index.js +5 -0
- package/dist/core/schemas/builders/index.d.ts +1 -0
- package/dist/core/schemas/builders/index.js +33 -0
- package/dist/core/schemas/builders/lazy/index.d.ts +5 -0
- package/dist/core/schemas/builders/lazy/index.js +7 -0
- package/dist/core/schemas/builders/lazy/lazy.d.ts +13 -0
- package/dist/core/schemas/builders/lazy/lazy.js +46 -0
- package/dist/core/schemas/builders/lazy/lazyObject.d.ts +8 -0
- package/dist/core/schemas/builders/lazy/lazyObject.js +31 -0
- package/dist/core/schemas/builders/list/index.d.ts +3 -0
- package/dist/core/schemas/builders/list/index.js +5 -0
- package/dist/core/schemas/builders/list/list.d.ts +7 -0
- package/dist/core/schemas/builders/list/list.js +78 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.d.ts +3 -0
- package/dist/core/schemas/builders/literals/booleanLiteral.js +29 -0
- package/dist/core/schemas/builders/literals/index.d.ts +5 -0
- package/dist/core/schemas/builders/literals/index.js +7 -0
- package/dist/core/schemas/builders/literals/stringLiteral.d.ts +3 -0
- package/dist/core/schemas/builders/literals/stringLiteral.js +29 -0
- package/dist/core/schemas/builders/object/index.d.ts +9 -0
- package/dist/core/schemas/builders/object/index.js +11 -0
- package/dist/core/schemas/builders/object/object.d.ts +27 -0
- package/dist/core/schemas/builders/object/object.js +268 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.d.ts +2 -0
- package/dist/core/schemas/builders/object/objectWithoutOptionalProperties.js +8 -0
- package/dist/core/schemas/builders/object/property.d.ts +7 -0
- package/dist/core/schemas/builders/object/property.js +16 -0
- package/dist/core/schemas/builders/object/types.d.ts +1 -0
- package/dist/core/schemas/builders/object/types.js +2 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.d.ts +23 -0
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +73 -0
- package/dist/core/schemas/builders/object-like/index.d.ts +4 -0
- package/dist/core/schemas/builders/object-like/index.js +6 -0
- package/dist/core/schemas/builders/object-like/types.d.ts +1 -0
- package/dist/core/schemas/builders/object-like/types.js +2 -0
- package/dist/core/schemas/builders/primitives/any.d.ts +3 -0
- package/dist/core/schemas/builders/primitives/any.js +6 -0
- package/dist/core/schemas/builders/primitives/boolean.d.ts +3 -0
- package/dist/core/schemas/builders/primitives/boolean.js +25 -0
- package/dist/core/schemas/builders/primitives/index.d.ts +6 -0
- package/dist/core/schemas/builders/primitives/index.js +13 -0
- package/dist/core/schemas/builders/primitives/number.d.ts +3 -0
- package/dist/core/schemas/builders/primitives/number.js +25 -0
- package/dist/core/schemas/builders/primitives/string.d.ts +3 -0
- package/dist/core/schemas/builders/primitives/string.js +25 -0
- package/dist/core/schemas/builders/primitives/unknown.d.ts +3 -0
- package/dist/core/schemas/builders/primitives/unknown.js +6 -0
- package/dist/core/schemas/builders/record/index.d.ts +3 -0
- package/dist/core/schemas/builders/record/index.js +5 -0
- package/dist/core/schemas/builders/record/record.d.ts +7 -0
- package/dist/core/schemas/builders/record/record.js +116 -0
- package/dist/core/schemas/builders/record/types.d.ts +1 -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 +54 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +95 -0
- package/dist/core/schemas/builders/schema-utils/index.d.ts +9 -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 +3 -0
- package/dist/core/schemas/builders/set/index.js +5 -0
- package/dist/core/schemas/builders/set/set.d.ts +7 -0
- package/dist/core/schemas/builders/set/set.js +63 -0
- package/dist/core/schemas/builders/undiscriminated-union/index.d.ts +3 -0
- package/dist/core/schemas/builders/undiscriminated-union/index.js +5 -0
- package/dist/core/schemas/builders/undiscriminated-union/types.d.ts +1 -0
- package/dist/core/schemas/builders/undiscriminated-union/types.js +2 -0
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.d.ts +7 -0
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +61 -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 +5 -0
- package/dist/core/schemas/builders/union/index.js +7 -0
- package/dist/core/schemas/builders/union/types.d.ts +1 -0
- package/dist/core/schemas/builders/union/types.js +2 -0
- package/dist/core/schemas/builders/union/union.d.ts +8 -0
- package/dist/core/schemas/builders/union/union.js +152 -0
- package/dist/core/schemas/index.d.ts +1 -0
- package/dist/core/schemas/index.js +21 -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 +1 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
- package/dist/core/schemas/utils/createIdentitySchemaCreator.d.ts +7 -0
- package/dist/core/schemas/utils/createIdentitySchemaCreator.js +16 -0
- package/dist/core/schemas/utils/entries.d.ts +2 -0
- package/dist/core/schemas/utils/entries.js +7 -0
- package/dist/core/schemas/utils/filterObject.d.ts +2 -0
- package/dist/core/schemas/utils/filterObject.js +14 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.d.ts +2 -0
- package/dist/core/schemas/utils/getErrorMessageForIncorrectType.js +24 -0
- package/dist/core/schemas/utils/isPlainObject.d.ts +2 -0
- package/dist/core/schemas/utils/isPlainObject.js +18 -0
- package/dist/core/schemas/utils/keys.d.ts +2 -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 +47 -0
- package/dist/core/schemas/utils/partition.d.ts +2 -0
- package/dist/core/schemas/utils/partition.js +16 -0
- package/dist/errors/RulebricksApiError.d.ts +10 -0
- package/dist/errors/RulebricksApiError.js +32 -0
- package/dist/errors/RulebricksApiTimeoutError.d.ts +4 -0
- package/dist/errors/RulebricksApiTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.js +7 -0
- package/dist/forge/index.d.ts +4 -0
- package/dist/forge/index.js +31 -0
- package/dist/forge/operators.d.ts +136 -0
- package/dist/forge/operators.js +938 -0
- package/dist/forge/rule.d.ts +129 -0
- package/dist/forge/rule.js +702 -0
- package/dist/forge/types.d.ts +53 -0
- package/dist/forge/types.js +34 -0
- package/dist/forge/values.d.ts +21 -0
- package/dist/forge/values.js +88 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +113 -0
- package/dist/serialization/index.d.ts +1 -0
- package/dist/serialization/index.js +22 -0
- package/dist/serialization/resources/assets/client/exportRule.d.ts +2 -0
- package/dist/serialization/resources/assets/client/exportRule.js +37 -0
- package/dist/serialization/resources/assets/client/importRule.d.ts +2 -0
- package/dist/serialization/resources/assets/client/importRule.js +37 -0
- package/dist/serialization/resources/assets/client/index.d.ts +6 -0
- package/dist/serialization/resources/assets/client/index.js +43 -0
- package/dist/serialization/resources/assets/client/listFlows.d.ts +2 -0
- package/dist/serialization/resources/assets/client/listFlows.js +56 -0
- package/dist/serialization/resources/assets/client/listFolders.d.ts +2 -0
- package/dist/serialization/resources/assets/client/listFolders.js +56 -0
- package/dist/serialization/resources/assets/client/listRules.d.ts +2 -0
- package/dist/serialization/resources/assets/client/listRules.js +56 -0
- package/dist/serialization/resources/assets/client/requests/DeleteFolderRequest.d.ts +2 -0
- package/dist/serialization/resources/assets/client/requests/DeleteFolderRequest.js +39 -0
- package/dist/serialization/resources/assets/client/requests/DeleteRuleRequest.d.ts +2 -0
- package/dist/serialization/resources/assets/client/requests/DeleteRuleRequest.js +39 -0
- package/dist/serialization/resources/assets/client/requests/ImportRuleRequest.d.ts +2 -0
- package/dist/serialization/resources/assets/client/requests/ImportRuleRequest.js +39 -0
- package/dist/serialization/resources/assets/client/requests/UpsertFolderRequest.d.ts +2 -0
- package/dist/serialization/resources/assets/client/requests/UpsertFolderRequest.js +41 -0
- package/dist/serialization/resources/assets/client/requests/index.d.ts +9 -0
- package/dist/serialization/resources/assets/client/requests/index.js +11 -0
- package/dist/serialization/resources/assets/index.d.ts +1 -0
- package/dist/serialization/resources/assets/index.js +22 -0
- package/dist/serialization/resources/assets/types/DeleteFolderResponse.d.ts +2 -0
- package/dist/serialization/resources/assets/types/DeleteFolderResponse.js +42 -0
- package/dist/serialization/resources/assets/types/DeleteRuleResponse.d.ts +2 -0
- package/dist/serialization/resources/assets/types/DeleteRuleResponse.js +39 -0
- package/dist/serialization/resources/assets/types/ListFlowsResponseItem.d.ts +2 -0
- package/dist/serialization/resources/assets/types/ListFlowsResponseItem.js +44 -0
- package/dist/serialization/resources/assets/types/ListFoldersResponseItem.d.ts +2 -0
- package/dist/serialization/resources/assets/types/ListFoldersResponseItem.js +42 -0
- package/dist/serialization/resources/assets/types/ListRulesResponseItem.d.ts +2 -0
- package/dist/serialization/resources/assets/types/ListRulesResponseItem.js +67 -0
- package/dist/serialization/resources/assets/types/ListRulesResponseItemFolder.d.ts +2 -0
- package/dist/serialization/resources/assets/types/ListRulesResponseItemFolder.js +42 -0
- package/dist/serialization/resources/assets/types/UpsertFolderResponse.d.ts +2 -0
- package/dist/serialization/resources/assets/types/UpsertFolderResponse.js +42 -0
- package/dist/serialization/resources/assets/types/UsageResponse.d.ts +2 -0
- package/dist/serialization/resources/assets/types/UsageResponse.js +44 -0
- package/dist/serialization/resources/assets/types/index.d.ts +1 -0
- package/dist/serialization/resources/assets/types/index.js +28 -0
- package/dist/serialization/resources/decisions/index.d.ts +1 -0
- package/dist/serialization/resources/decisions/index.js +21 -0
- package/dist/serialization/resources/decisions/types/QueryResponse.d.ts +2 -0
- package/dist/serialization/resources/decisions/types/QueryResponse.js +42 -0
- package/dist/serialization/resources/decisions/types/index.d.ts +1 -0
- package/dist/serialization/resources/decisions/types/index.js +21 -0
- package/dist/serialization/resources/flows/client/execute.d.ts +3 -0
- package/dist/serialization/resources/flows/client/execute.js +38 -0
- package/dist/serialization/resources/flows/client/index.d.ts +2 -0
- package/dist/serialization/resources/flows/client/index.js +33 -0
- package/dist/serialization/resources/flows/index.d.ts +1 -0
- package/dist/serialization/resources/flows/index.js +21 -0
- package/dist/serialization/resources/index.d.ts +8 -0
- package/dist/serialization/resources/index.js +52 -0
- package/dist/serialization/resources/rules/client/bulkSolve.d.ts +3 -0
- package/dist/serialization/resources/rules/client/bulkSolve.js +38 -0
- package/dist/serialization/resources/rules/client/index.d.ts +4 -0
- package/dist/serialization/resources/rules/client/index.js +35 -0
- package/dist/serialization/resources/rules/client/parallelSolve.d.ts +3 -0
- package/dist/serialization/resources/rules/client/parallelSolve.js +38 -0
- package/dist/serialization/resources/rules/client/solve.d.ts +3 -0
- package/dist/serialization/resources/rules/client/solve.js +38 -0
- package/dist/serialization/resources/rules/index.d.ts +1 -0
- package/dist/serialization/resources/rules/index.js +21 -0
- package/dist/serialization/resources/tests/client/index.d.ts +3 -0
- package/dist/serialization/resources/tests/client/index.js +40 -0
- package/dist/serialization/resources/tests/client/listFlowTests.d.ts +2 -0
- package/dist/serialization/resources/tests/client/listFlowTests.js +56 -0
- package/dist/serialization/resources/tests/client/listRuleTests.d.ts +2 -0
- package/dist/serialization/resources/tests/client/listRuleTests.js +56 -0
- package/dist/serialization/resources/tests/client/requests/CreateFlowTestRequest.d.ts +2 -0
- package/dist/serialization/resources/tests/client/requests/CreateFlowTestRequest.js +42 -0
- package/dist/serialization/resources/tests/client/requests/CreateRuleTestRequest.d.ts +2 -0
- package/dist/serialization/resources/tests/client/requests/CreateRuleTestRequest.js +42 -0
- package/dist/serialization/resources/tests/client/requests/index.d.ts +5 -0
- package/dist/serialization/resources/tests/client/requests/index.js +7 -0
- package/dist/serialization/resources/tests/index.d.ts +1 -0
- package/dist/serialization/resources/tests/index.js +22 -0
- package/dist/serialization/resources/tests/types/CreateFlowTestResponse.d.ts +2 -0
- package/dist/serialization/resources/tests/types/CreateFlowTestResponse.js +47 -0
- package/dist/serialization/resources/tests/types/CreateRuleTestResponse.d.ts +2 -0
- package/dist/serialization/resources/tests/types/CreateRuleTestResponse.js +47 -0
- package/dist/serialization/resources/tests/types/DeleteFlowTestResponse.d.ts +2 -0
- package/dist/serialization/resources/tests/types/DeleteFlowTestResponse.js +47 -0
- package/dist/serialization/resources/tests/types/DeleteRuleTestResponse.d.ts +2 -0
- package/dist/serialization/resources/tests/types/DeleteRuleTestResponse.js +47 -0
- package/dist/serialization/resources/tests/types/ListFlowTestsResponseItem.d.ts +2 -0
- package/dist/serialization/resources/tests/types/ListFlowTestsResponseItem.js +47 -0
- package/dist/serialization/resources/tests/types/ListRuleTestsResponseItem.d.ts +2 -0
- package/dist/serialization/resources/tests/types/ListRuleTestsResponseItem.js +47 -0
- package/dist/serialization/resources/tests/types/index.d.ts +1 -0
- package/dist/serialization/resources/tests/types/index.js +26 -0
- package/dist/serialization/resources/users/client/index.d.ts +2 -0
- package/dist/serialization/resources/users/client/index.js +39 -0
- package/dist/serialization/resources/users/client/listGroups.d.ts +2 -0
- package/dist/serialization/resources/users/client/listGroups.js +56 -0
- package/dist/serialization/resources/users/client/requests/CreateGroupRequest.d.ts +2 -0
- package/dist/serialization/resources/users/client/requests/CreateGroupRequest.js +40 -0
- package/dist/serialization/resources/users/client/requests/InviteRequest.d.ts +2 -0
- package/dist/serialization/resources/users/client/requests/InviteRequest.js +60 -0
- package/dist/serialization/resources/users/client/requests/index.d.ts +5 -0
- package/dist/serialization/resources/users/client/requests/index.js +7 -0
- package/dist/serialization/resources/users/index.d.ts +1 -0
- package/dist/serialization/resources/users/index.js +22 -0
- package/dist/serialization/resources/users/types/CreateGroupResponse.d.ts +2 -0
- package/dist/serialization/resources/users/types/CreateGroupResponse.js +42 -0
- package/dist/serialization/resources/users/types/InviteRequestRole.d.ts +2 -0
- package/dist/serialization/resources/users/types/InviteRequestRole.js +37 -0
- package/dist/serialization/resources/users/types/InviteResponse.d.ts +2 -0
- package/dist/serialization/resources/users/types/InviteResponse.js +39 -0
- package/dist/serialization/resources/users/types/ListGroupsResponseItem.d.ts +2 -0
- package/dist/serialization/resources/users/types/ListGroupsResponseItem.js +42 -0
- package/dist/serialization/resources/users/types/index.d.ts +1 -0
- package/dist/serialization/resources/users/types/index.js +24 -0
- package/dist/serialization/resources/values/client/index.d.ts +3 -0
- package/dist/serialization/resources/values/client/index.js +34 -0
- package/dist/serialization/resources/values/client/listDynamicValues.d.ts +2 -0
- package/dist/serialization/resources/values/client/listDynamicValues.js +56 -0
- package/dist/serialization/resources/values/client/update.d.ts +3 -0
- package/dist/serialization/resources/values/client/update.js +57 -0
- package/dist/serialization/resources/values/index.d.ts +1 -0
- package/dist/serialization/resources/values/index.js +22 -0
- package/dist/serialization/resources/values/types/DeleteDynamicValueResponse.d.ts +2 -0
- package/dist/serialization/resources/values/types/DeleteDynamicValueResponse.js +39 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItem.d.ts +2 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItem.js +66 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemType.d.ts +2 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemType.js +37 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +2 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +44 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +2 -0
- package/dist/serialization/resources/values/types/ListDynamicValuesResponseItemValue.js +42 -0
- package/dist/serialization/resources/values/types/UpdateRequestValue.d.ts +2 -0
- package/dist/serialization/resources/values/types/UpdateRequestValue.js +42 -0
- package/dist/serialization/resources/values/types/UpdateResponseItem.d.ts +2 -0
- package/dist/serialization/resources/values/types/UpdateResponseItem.js +61 -0
- package/dist/serialization/resources/values/types/UpdateResponseItemType.d.ts +2 -0
- package/dist/serialization/resources/values/types/UpdateResponseItemType.js +37 -0
- package/dist/serialization/resources/values/types/UpdateResponseItemValue.d.ts +2 -0
- package/dist/serialization/resources/values/types/UpdateResponseItemValue.js +42 -0
- package/dist/serialization/resources/values/types/index.d.ts +1 -0
- package/dist/serialization/resources/values/types/index.js +29 -0
- package/dist/serialization/types/BadRequestErrorBody.d.ts +2 -0
- package/dist/serialization/types/BadRequestErrorBody.js +39 -0
- package/dist/serialization/types/ForbiddenErrorBody.d.ts +2 -0
- package/dist/serialization/types/ForbiddenErrorBody.js +39 -0
- package/dist/serialization/types/InternalServerErrorBody.d.ts +2 -0
- package/dist/serialization/types/InternalServerErrorBody.js +39 -0
- package/dist/serialization/types/NotFoundErrorBody.d.ts +2 -0
- package/dist/serialization/types/NotFoundErrorBody.js +39 -0
- package/dist/serialization/types/index.d.ts +1 -0
- package/dist/serialization/types/index.js +24 -0
- package/errors/RulebricksApiError.d.ts +10 -0
- package/errors/RulebricksApiError.js +32 -0
- package/errors/RulebricksApiTimeoutError.d.ts +4 -0
- package/errors/RulebricksApiTimeoutError.js +13 -0
- package/errors/index.d.ts +5 -0
- package/errors/index.js +7 -0
- package/forge/index.d.ts +4 -0
- package/forge/index.js +31 -0
- package/forge/operators.d.ts +136 -0
- package/forge/operators.js +938 -0
- package/forge/rule.d.ts +129 -0
- package/forge/rule.js +702 -0
- package/forge/types.d.ts +53 -0
- package/forge/types.js +34 -0
- package/forge/values.d.ts +21 -0
- package/forge/values.js +88 -0
- package/index.d.ts +15 -0
- package/index.js +113 -0
- package/jest.config.js +5 -0
- package/package.json +43 -0
- package/serialization/index.d.ts +1 -0
- package/serialization/index.js +22 -0
- package/serialization/resources/assets/client/exportRule.d.ts +2 -0
- package/serialization/resources/assets/client/exportRule.js +37 -0
- package/serialization/resources/assets/client/importRule.d.ts +2 -0
- package/serialization/resources/assets/client/importRule.js +37 -0
- package/serialization/resources/assets/client/index.d.ts +6 -0
- package/serialization/resources/assets/client/index.js +43 -0
- package/serialization/resources/assets/client/listFlows.d.ts +2 -0
- package/serialization/resources/assets/client/listFlows.js +56 -0
- package/serialization/resources/assets/client/listFolders.d.ts +2 -0
- package/serialization/resources/assets/client/listFolders.js +56 -0
- package/serialization/resources/assets/client/listRules.d.ts +2 -0
- package/serialization/resources/assets/client/listRules.js +56 -0
- package/serialization/resources/assets/client/requests/DeleteFolderRequest.d.ts +2 -0
- package/serialization/resources/assets/client/requests/DeleteFolderRequest.js +39 -0
- package/serialization/resources/assets/client/requests/DeleteRuleRequest.d.ts +2 -0
- package/serialization/resources/assets/client/requests/DeleteRuleRequest.js +39 -0
- package/serialization/resources/assets/client/requests/ImportRuleRequest.d.ts +2 -0
- package/serialization/resources/assets/client/requests/ImportRuleRequest.js +39 -0
- package/serialization/resources/assets/client/requests/UpsertFolderRequest.d.ts +2 -0
- package/serialization/resources/assets/client/requests/UpsertFolderRequest.js +41 -0
- package/serialization/resources/assets/client/requests/index.d.ts +9 -0
- package/serialization/resources/assets/client/requests/index.js +11 -0
- package/serialization/resources/assets/index.d.ts +1 -0
- package/serialization/resources/assets/index.js +22 -0
- package/serialization/resources/assets/types/DeleteFolderResponse.d.ts +2 -0
- package/serialization/resources/assets/types/DeleteFolderResponse.js +42 -0
- package/serialization/resources/assets/types/DeleteRuleResponse.d.ts +2 -0
- package/serialization/resources/assets/types/DeleteRuleResponse.js +39 -0
- package/serialization/resources/assets/types/ListFlowsResponseItem.d.ts +2 -0
- package/serialization/resources/assets/types/ListFlowsResponseItem.js +44 -0
- package/serialization/resources/assets/types/ListFoldersResponseItem.d.ts +2 -0
- package/serialization/resources/assets/types/ListFoldersResponseItem.js +42 -0
- package/serialization/resources/assets/types/ListRulesResponseItem.d.ts +2 -0
- package/serialization/resources/assets/types/ListRulesResponseItem.js +67 -0
- package/serialization/resources/assets/types/ListRulesResponseItemFolder.d.ts +2 -0
- package/serialization/resources/assets/types/ListRulesResponseItemFolder.js +42 -0
- package/serialization/resources/assets/types/UpsertFolderResponse.d.ts +2 -0
- package/serialization/resources/assets/types/UpsertFolderResponse.js +42 -0
- package/serialization/resources/assets/types/UsageResponse.d.ts +2 -0
- package/serialization/resources/assets/types/UsageResponse.js +44 -0
- package/serialization/resources/assets/types/index.d.ts +1 -0
- package/serialization/resources/assets/types/index.js +28 -0
- package/serialization/resources/decisions/index.d.ts +1 -0
- package/serialization/resources/decisions/index.js +21 -0
- package/serialization/resources/decisions/types/QueryResponse.d.ts +2 -0
- package/serialization/resources/decisions/types/QueryResponse.js +42 -0
- package/serialization/resources/decisions/types/index.d.ts +1 -0
- package/serialization/resources/decisions/types/index.js +21 -0
- package/serialization/resources/flows/client/execute.d.ts +3 -0
- package/serialization/resources/flows/client/execute.js +38 -0
- package/serialization/resources/flows/client/index.d.ts +2 -0
- package/serialization/resources/flows/client/index.js +33 -0
- package/serialization/resources/flows/index.d.ts +1 -0
- package/serialization/resources/flows/index.js +21 -0
- package/serialization/resources/index.d.ts +8 -0
- package/serialization/resources/index.js +52 -0
- package/serialization/resources/rules/client/bulkSolve.d.ts +3 -0
- package/serialization/resources/rules/client/bulkSolve.js +38 -0
- package/serialization/resources/rules/client/index.d.ts +4 -0
- package/serialization/resources/rules/client/index.js +35 -0
- package/serialization/resources/rules/client/parallelSolve.d.ts +3 -0
- package/serialization/resources/rules/client/parallelSolve.js +38 -0
- package/serialization/resources/rules/client/solve.d.ts +3 -0
- package/serialization/resources/rules/client/solve.js +38 -0
- package/serialization/resources/rules/index.d.ts +1 -0
- package/serialization/resources/rules/index.js +21 -0
- package/serialization/resources/tests/client/index.d.ts +3 -0
- package/serialization/resources/tests/client/index.js +40 -0
- package/serialization/resources/tests/client/listFlowTests.d.ts +2 -0
- package/serialization/resources/tests/client/listFlowTests.js +56 -0
- package/serialization/resources/tests/client/listRuleTests.d.ts +2 -0
- package/serialization/resources/tests/client/listRuleTests.js +56 -0
- package/serialization/resources/tests/client/requests/CreateFlowTestRequest.d.ts +2 -0
- package/serialization/resources/tests/client/requests/CreateFlowTestRequest.js +42 -0
- package/serialization/resources/tests/client/requests/CreateRuleTestRequest.d.ts +2 -0
- package/serialization/resources/tests/client/requests/CreateRuleTestRequest.js +42 -0
- package/serialization/resources/tests/client/requests/index.d.ts +5 -0
- package/serialization/resources/tests/client/requests/index.js +7 -0
- package/serialization/resources/tests/index.d.ts +1 -0
- package/serialization/resources/tests/index.js +22 -0
- package/serialization/resources/tests/types/CreateFlowTestResponse.d.ts +2 -0
- package/serialization/resources/tests/types/CreateFlowTestResponse.js +47 -0
- package/serialization/resources/tests/types/CreateRuleTestResponse.d.ts +2 -0
- package/serialization/resources/tests/types/CreateRuleTestResponse.js +47 -0
- package/serialization/resources/tests/types/DeleteFlowTestResponse.d.ts +2 -0
- package/serialization/resources/tests/types/DeleteFlowTestResponse.js +47 -0
- package/serialization/resources/tests/types/DeleteRuleTestResponse.d.ts +2 -0
- package/serialization/resources/tests/types/DeleteRuleTestResponse.js +47 -0
- package/serialization/resources/tests/types/ListFlowTestsResponseItem.d.ts +2 -0
- package/serialization/resources/tests/types/ListFlowTestsResponseItem.js +47 -0
- package/serialization/resources/tests/types/ListRuleTestsResponseItem.d.ts +2 -0
- package/serialization/resources/tests/types/ListRuleTestsResponseItem.js +47 -0
- package/serialization/resources/tests/types/index.d.ts +1 -0
- package/serialization/resources/tests/types/index.js +26 -0
- package/serialization/resources/users/client/index.d.ts +2 -0
- package/serialization/resources/users/client/index.js +39 -0
- package/serialization/resources/users/client/listGroups.d.ts +2 -0
- package/serialization/resources/users/client/listGroups.js +56 -0
- package/serialization/resources/users/client/requests/CreateGroupRequest.d.ts +2 -0
- package/serialization/resources/users/client/requests/CreateGroupRequest.js +40 -0
- package/serialization/resources/users/client/requests/InviteRequest.d.ts +2 -0
- package/serialization/resources/users/client/requests/InviteRequest.js +60 -0
- package/serialization/resources/users/client/requests/index.d.ts +5 -0
- package/serialization/resources/users/client/requests/index.js +7 -0
- package/serialization/resources/users/index.d.ts +1 -0
- package/serialization/resources/users/index.js +22 -0
- package/serialization/resources/users/types/CreateGroupResponse.d.ts +2 -0
- package/serialization/resources/users/types/CreateGroupResponse.js +42 -0
- package/serialization/resources/users/types/InviteRequestRole.d.ts +2 -0
- package/serialization/resources/users/types/InviteRequestRole.js +37 -0
- package/serialization/resources/users/types/InviteResponse.d.ts +2 -0
- package/serialization/resources/users/types/InviteResponse.js +39 -0
- package/serialization/resources/users/types/ListGroupsResponseItem.d.ts +2 -0
- package/serialization/resources/users/types/ListGroupsResponseItem.js +42 -0
- package/serialization/resources/users/types/index.d.ts +1 -0
- package/serialization/resources/users/types/index.js +24 -0
- package/serialization/resources/values/client/index.d.ts +3 -0
- package/serialization/resources/values/client/index.js +34 -0
- package/serialization/resources/values/client/listDynamicValues.d.ts +2 -0
- package/serialization/resources/values/client/listDynamicValues.js +56 -0
- package/serialization/resources/values/client/update.d.ts +3 -0
- package/serialization/resources/values/client/update.js +57 -0
- package/serialization/resources/values/index.d.ts +1 -0
- package/serialization/resources/values/index.js +22 -0
- package/serialization/resources/values/types/DeleteDynamicValueResponse.d.ts +2 -0
- package/serialization/resources/values/types/DeleteDynamicValueResponse.js +39 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItem.d.ts +2 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItem.js +66 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItemType.d.ts +2 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItemType.js +37 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.d.ts +2 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItemUsagesItem.js +44 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItemValue.d.ts +2 -0
- package/serialization/resources/values/types/ListDynamicValuesResponseItemValue.js +42 -0
- package/serialization/resources/values/types/UpdateRequestValue.d.ts +2 -0
- package/serialization/resources/values/types/UpdateRequestValue.js +42 -0
- package/serialization/resources/values/types/UpdateResponseItem.d.ts +2 -0
- package/serialization/resources/values/types/UpdateResponseItem.js +61 -0
- package/serialization/resources/values/types/UpdateResponseItemType.d.ts +2 -0
- package/serialization/resources/values/types/UpdateResponseItemType.js +37 -0
- package/serialization/resources/values/types/UpdateResponseItemValue.d.ts +2 -0
- package/serialization/resources/values/types/UpdateResponseItemValue.js +42 -0
- package/serialization/resources/values/types/index.d.ts +1 -0
- package/serialization/resources/values/types/index.js +29 -0
- package/serialization/types/BadRequestErrorBody.d.ts +2 -0
- package/serialization/types/BadRequestErrorBody.js +39 -0
- package/serialization/types/ForbiddenErrorBody.d.ts +2 -0
- package/serialization/types/ForbiddenErrorBody.js +39 -0
- package/serialization/types/InternalServerErrorBody.d.ts +2 -0
- package/serialization/types/InternalServerErrorBody.js +39 -0
- package/serialization/types/NotFoundErrorBody.d.ts +2 -0
- package/serialization/types/NotFoundErrorBody.js +39 -0
- package/serialization/types/index.d.ts +1 -0
- package/serialization/types/index.js +24 -0
- package/tests/client.test.ts +11 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
reject(e);
|
|
10
|
+
} }
|
|
11
|
+
function rejected(value) { try {
|
|
12
|
+
step(generator["throw"](value));
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
} }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.list = void 0;
|
|
23
|
+
const Schema_1 = require("../../Schema");
|
|
24
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
25
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
26
|
+
const schema_utils_1 = require("../schema-utils");
|
|
27
|
+
function list(schema) {
|
|
28
|
+
const baseSchema = {
|
|
29
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return validateAndTransformArray(raw, (item, index) => {
|
|
31
|
+
var _a;
|
|
32
|
+
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}]`] }));
|
|
33
|
+
});
|
|
34
|
+
}),
|
|
35
|
+
json: (parsed, opts) => validateAndTransformArray(parsed, (item, index) => {
|
|
36
|
+
var _a;
|
|
37
|
+
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}]`] }));
|
|
38
|
+
}),
|
|
39
|
+
getType: () => Schema_1.SchemaType.LIST,
|
|
40
|
+
};
|
|
41
|
+
return Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema));
|
|
42
|
+
}
|
|
43
|
+
exports.list = list;
|
|
44
|
+
function validateAndTransformArray(value, transformItem) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (!Array.isArray(value)) {
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
errors: [
|
|
50
|
+
{
|
|
51
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "list"),
|
|
52
|
+
path: [],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const maybeValidItems = yield Promise.all(value.map((item, index) => transformItem(item, index)));
|
|
58
|
+
return maybeValidItems.reduce((acc, item) => {
|
|
59
|
+
if (acc.ok && item.ok) {
|
|
60
|
+
return {
|
|
61
|
+
ok: true,
|
|
62
|
+
value: [...acc.value, item.value],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const errors = [];
|
|
66
|
+
if (!acc.ok) {
|
|
67
|
+
errors.push(...acc.errors);
|
|
68
|
+
}
|
|
69
|
+
if (!item.ok) {
|
|
70
|
+
errors.push(...item.errors);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
errors,
|
|
75
|
+
};
|
|
76
|
+
}, { ok: true, value: [] });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.booleanLiteral = void 0;
|
|
4
|
+
const Schema_1 = require("../../Schema");
|
|
5
|
+
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
7
|
+
function booleanLiteral(literal) {
|
|
8
|
+
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.BOOLEAN_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
|
+
if (value === literal) {
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
value: literal,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
errors: [
|
|
19
|
+
{
|
|
20
|
+
path: breadcrumbsPrefix,
|
|
21
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, `${literal.toString()}`),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return schemaCreator();
|
|
28
|
+
}
|
|
29
|
+
exports.booleanLiteral = booleanLiteral;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export var stringLiteral: typeof stringLiteral_1.stringLiteral;
|
|
3
|
+
export var booleanLiteral: typeof booleanLiteral_1.booleanLiteral;
|
|
4
|
+
import stringLiteral_1 = require("./stringLiteral");
|
|
5
|
+
import booleanLiteral_1 = require("./booleanLiteral");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.booleanLiteral = exports.stringLiteral = void 0;
|
|
4
|
+
var stringLiteral_1 = require("./stringLiteral");
|
|
5
|
+
Object.defineProperty(exports, "stringLiteral", { enumerable: true, get: function () { return stringLiteral_1.stringLiteral; } });
|
|
6
|
+
var booleanLiteral_1 = require("./booleanLiteral");
|
|
7
|
+
Object.defineProperty(exports, "booleanLiteral", { enumerable: true, get: function () { return booleanLiteral_1.booleanLiteral; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringLiteral = void 0;
|
|
4
|
+
const Schema_1 = require("../../Schema");
|
|
5
|
+
const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
|
|
6
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
7
|
+
function stringLiteral(literal) {
|
|
8
|
+
const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.STRING_LITERAL, (value, { breadcrumbsPrefix = [] } = {}) => {
|
|
9
|
+
if (value === literal) {
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
value: literal,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
errors: [
|
|
19
|
+
{
|
|
20
|
+
path: breadcrumbsPrefix,
|
|
21
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, `"${literal}"`),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return schemaCreator();
|
|
28
|
+
}
|
|
29
|
+
exports.stringLiteral = stringLiteral;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export var getObjectUtils: typeof object_1.getObjectUtils;
|
|
3
|
+
export var object: typeof object_1.object;
|
|
4
|
+
export var objectWithoutOptionalProperties: typeof objectWithoutOptionalProperties_1.objectWithoutOptionalProperties;
|
|
5
|
+
export var isProperty: typeof property_1.isProperty;
|
|
6
|
+
export var property: typeof property_1.property;
|
|
7
|
+
import object_1 = require("./object");
|
|
8
|
+
import objectWithoutOptionalProperties_1 = require("./objectWithoutOptionalProperties");
|
|
9
|
+
import property_1 = require("./property");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.property = exports.isProperty = exports.objectWithoutOptionalProperties = exports.object = exports.getObjectUtils = void 0;
|
|
4
|
+
var object_1 = require("./object");
|
|
5
|
+
Object.defineProperty(exports, "getObjectUtils", { enumerable: true, get: function () { return object_1.getObjectUtils; } });
|
|
6
|
+
Object.defineProperty(exports, "object", { enumerable: true, get: function () { return object_1.object; } });
|
|
7
|
+
var objectWithoutOptionalProperties_1 = require("./objectWithoutOptionalProperties");
|
|
8
|
+
Object.defineProperty(exports, "objectWithoutOptionalProperties", { enumerable: true, get: function () { return objectWithoutOptionalProperties_1.objectWithoutOptionalProperties; } });
|
|
9
|
+
var property_1 = require("./property");
|
|
10
|
+
Object.defineProperty(exports, "isProperty", { enumerable: true, get: function () { return property_1.isProperty; } });
|
|
11
|
+
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return property_1.property; } });
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function object(schemas: any): {
|
|
3
|
+
_getRawProperties: () => Promise<any[]>;
|
|
4
|
+
_getParsedProperties: () => Promise<(string | number | symbol)[]>;
|
|
5
|
+
parse: (raw: any, opts: any) => any;
|
|
6
|
+
json: (parsed: any, opts: any) => any;
|
|
7
|
+
getType: () => "object";
|
|
8
|
+
} & schema_utils_1.SchemaUtils<any, any> & object_like_1.ObjectLikeUtils<any, any> & {
|
|
9
|
+
extend: (extension: any) => {
|
|
10
|
+
_getParsedProperties: () => any;
|
|
11
|
+
_getRawProperties: () => any;
|
|
12
|
+
parse: (raw: any, opts: any) => any;
|
|
13
|
+
json: (parsed: any, opts: any) => any;
|
|
14
|
+
getType: () => "object";
|
|
15
|
+
} & schema_utils_1.SchemaUtils<any, any> & object_like_1.ObjectLikeUtils<any, any> & any;
|
|
16
|
+
};
|
|
17
|
+
export function getObjectUtils(schema: any): {
|
|
18
|
+
extend: (extension: any) => {
|
|
19
|
+
_getParsedProperties: () => any;
|
|
20
|
+
_getRawProperties: () => any;
|
|
21
|
+
parse: (raw: any, opts: any) => any;
|
|
22
|
+
json: (parsed: any, opts: any) => any;
|
|
23
|
+
getType: () => "object";
|
|
24
|
+
} & schema_utils_1.SchemaUtils<any, any> & object_like_1.ObjectLikeUtils<any, any> & any;
|
|
25
|
+
};
|
|
26
|
+
import schema_utils_1 = require("../schema-utils");
|
|
27
|
+
import object_like_1 = require("../object-like");
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
reject(e);
|
|
10
|
+
} }
|
|
11
|
+
function rejected(value) { try {
|
|
12
|
+
step(generator["throw"](value));
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
} }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.getObjectUtils = exports.object = void 0;
|
|
23
|
+
const Schema_1 = require("../../Schema");
|
|
24
|
+
const entries_1 = require("../../utils/entries");
|
|
25
|
+
const filterObject_1 = require("../../utils/filterObject");
|
|
26
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
27
|
+
const isPlainObject_1 = require("../../utils/isPlainObject");
|
|
28
|
+
const keys_1 = require("../../utils/keys");
|
|
29
|
+
const maybeSkipValidation_1 = require("../../utils/maybeSkipValidation");
|
|
30
|
+
const partition_1 = require("../../utils/partition");
|
|
31
|
+
const object_like_1 = require("../object-like");
|
|
32
|
+
const schema_utils_1 = require("../schema-utils");
|
|
33
|
+
const property_1 = require("./property");
|
|
34
|
+
function object(schemas) {
|
|
35
|
+
const baseSchema = {
|
|
36
|
+
_getRawProperties: () => Promise.resolve(Object.entries(schemas).map(([parsedKey, propertySchema]) => (0, property_1.isProperty)(propertySchema) ? propertySchema.rawKey : parsedKey)),
|
|
37
|
+
_getParsedProperties: () => Promise.resolve((0, keys_1.keys)(schemas)),
|
|
38
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const rawKeyToProperty = {};
|
|
40
|
+
const requiredKeys = [];
|
|
41
|
+
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_1.entries)(schemas)) {
|
|
42
|
+
const rawKey = (0, property_1.isProperty)(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
|
|
43
|
+
const valueSchema = (0, property_1.isProperty)(schemaOrObjectProperty)
|
|
44
|
+
? schemaOrObjectProperty.valueSchema
|
|
45
|
+
: schemaOrObjectProperty;
|
|
46
|
+
const property = {
|
|
47
|
+
rawKey,
|
|
48
|
+
parsedKey: parsedKey,
|
|
49
|
+
valueSchema,
|
|
50
|
+
};
|
|
51
|
+
rawKeyToProperty[rawKey] = property;
|
|
52
|
+
if (yield isSchemaRequired(valueSchema)) {
|
|
53
|
+
requiredKeys.push(rawKey);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return validateAndTransformObject({
|
|
57
|
+
value: raw,
|
|
58
|
+
requiredKeys,
|
|
59
|
+
getProperty: (rawKey) => {
|
|
60
|
+
const property = rawKeyToProperty[rawKey];
|
|
61
|
+
if (property == null) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
transformedKey: property.parsedKey,
|
|
66
|
+
transform: (propertyValue) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return property.valueSchema.parse(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), rawKey] }));
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
73
|
+
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
74
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
75
|
+
});
|
|
76
|
+
}),
|
|
77
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const requiredKeys = [];
|
|
79
|
+
for (const [parsedKey, schemaOrObjectProperty] of (0, entries_1.entries)(schemas)) {
|
|
80
|
+
const valueSchema = (0, property_1.isProperty)(schemaOrObjectProperty)
|
|
81
|
+
? schemaOrObjectProperty.valueSchema
|
|
82
|
+
: schemaOrObjectProperty;
|
|
83
|
+
if (yield isSchemaRequired(valueSchema)) {
|
|
84
|
+
requiredKeys.push(parsedKey);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return validateAndTransformObject({
|
|
88
|
+
value: parsed,
|
|
89
|
+
requiredKeys,
|
|
90
|
+
getProperty: (parsedKey) => {
|
|
91
|
+
const property = schemas[parsedKey];
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
93
|
+
if (property == null) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
if ((0, property_1.isProperty)(property)) {
|
|
97
|
+
return {
|
|
98
|
+
transformedKey: property.rawKey,
|
|
99
|
+
transform: (propertyValue) => {
|
|
100
|
+
var _a;
|
|
101
|
+
return property.valueSchema.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedKey] }));
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return {
|
|
107
|
+
transformedKey: parsedKey,
|
|
108
|
+
transform: (propertyValue) => {
|
|
109
|
+
var _a;
|
|
110
|
+
return property.json(propertyValue, Object.assign(Object.assign({}, opts), { breadcrumbsPrefix: [...((_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : []), parsedKey] }));
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
unrecognizedObjectKeys: opts === null || opts === void 0 ? void 0 : opts.unrecognizedObjectKeys,
|
|
116
|
+
skipValidation: opts === null || opts === void 0 ? void 0 : opts.skipValidation,
|
|
117
|
+
breadcrumbsPrefix: opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix,
|
|
118
|
+
});
|
|
119
|
+
}),
|
|
120
|
+
getType: () => Schema_1.SchemaType.OBJECT,
|
|
121
|
+
};
|
|
122
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, (0, maybeSkipValidation_1.maybeSkipValidation)(baseSchema)), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), getObjectUtils(baseSchema));
|
|
123
|
+
}
|
|
124
|
+
exports.object = object;
|
|
125
|
+
function validateAndTransformObject({ value, requiredKeys, getProperty, unrecognizedObjectKeys = "fail", skipValidation = false, breadcrumbsPrefix = [], }) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if (!(0, isPlainObject_1.isPlainObject)(value)) {
|
|
128
|
+
return {
|
|
129
|
+
ok: false,
|
|
130
|
+
errors: [
|
|
131
|
+
{
|
|
132
|
+
path: breadcrumbsPrefix,
|
|
133
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(value, "object"),
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const missingRequiredKeys = new Set(requiredKeys);
|
|
139
|
+
const errors = [];
|
|
140
|
+
const transformed = {};
|
|
141
|
+
for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
|
|
142
|
+
const property = getProperty(preTransformedKey);
|
|
143
|
+
if (property != null) {
|
|
144
|
+
missingRequiredKeys.delete(preTransformedKey);
|
|
145
|
+
const value = yield property.transform(preTransformedItemValue);
|
|
146
|
+
if (value.ok) {
|
|
147
|
+
transformed[property.transformedKey] = value.value;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
transformed[preTransformedKey] = preTransformedItemValue;
|
|
151
|
+
errors.push(...value.errors);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
switch (unrecognizedObjectKeys) {
|
|
156
|
+
case "fail":
|
|
157
|
+
errors.push({
|
|
158
|
+
path: [...breadcrumbsPrefix, preTransformedKey],
|
|
159
|
+
message: `Unexpected key "${preTransformedKey}"`,
|
|
160
|
+
});
|
|
161
|
+
break;
|
|
162
|
+
case "strip":
|
|
163
|
+
break;
|
|
164
|
+
case "passthrough":
|
|
165
|
+
transformed[preTransformedKey] = preTransformedItemValue;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
errors.push(...requiredKeys
|
|
171
|
+
.filter((key) => missingRequiredKeys.has(key))
|
|
172
|
+
.map((key) => ({
|
|
173
|
+
path: breadcrumbsPrefix,
|
|
174
|
+
message: `Missing required key "${key}"`,
|
|
175
|
+
})));
|
|
176
|
+
if (errors.length === 0 || skipValidation) {
|
|
177
|
+
return {
|
|
178
|
+
ok: true,
|
|
179
|
+
value: transformed,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return {
|
|
184
|
+
ok: false,
|
|
185
|
+
errors,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function getObjectUtils(schema) {
|
|
191
|
+
return {
|
|
192
|
+
extend: (extension) => {
|
|
193
|
+
const baseSchema = {
|
|
194
|
+
_getParsedProperties: () => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
return [
|
|
196
|
+
...(yield schema._getParsedProperties()),
|
|
197
|
+
...(yield extension._getParsedProperties()),
|
|
198
|
+
];
|
|
199
|
+
}),
|
|
200
|
+
_getRawProperties: () => __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
return [
|
|
202
|
+
...(yield schema._getRawProperties()),
|
|
203
|
+
...(yield extension._getRawProperties()),
|
|
204
|
+
];
|
|
205
|
+
}),
|
|
206
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
return validateAndTransformExtendedObject({
|
|
208
|
+
extensionKeys: yield extension._getRawProperties(),
|
|
209
|
+
value: raw,
|
|
210
|
+
transformBase: (rawBase) => schema.parse(rawBase, opts),
|
|
211
|
+
transformExtension: (rawExtension) => extension.parse(rawExtension, opts),
|
|
212
|
+
});
|
|
213
|
+
}),
|
|
214
|
+
json: (parsed, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
return validateAndTransformExtendedObject({
|
|
216
|
+
extensionKeys: yield extension._getParsedProperties(),
|
|
217
|
+
value: parsed,
|
|
218
|
+
transformBase: (parsedBase) => schema.json(parsedBase, opts),
|
|
219
|
+
transformExtension: (parsedExtension) => extension.json(parsedExtension, opts),
|
|
220
|
+
});
|
|
221
|
+
}),
|
|
222
|
+
getType: () => Schema_1.SchemaType.OBJECT,
|
|
223
|
+
};
|
|
224
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, baseSchema), (0, schema_utils_1.getSchemaUtils)(baseSchema)), (0, object_like_1.getObjectLikeUtils)(baseSchema)), getObjectUtils(baseSchema));
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
exports.getObjectUtils = getObjectUtils;
|
|
229
|
+
function validateAndTransformExtendedObject({ extensionKeys, value, transformBase, transformExtension, }) {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
const extensionPropertiesSet = new Set(extensionKeys);
|
|
232
|
+
const [extensionProperties, baseProperties] = (0, partition_1.partition)((0, keys_1.keys)(value), (key) => extensionPropertiesSet.has(key));
|
|
233
|
+
const transformedBase = yield transformBase((0, filterObject_1.filterObject)(value, baseProperties));
|
|
234
|
+
const transformedExtension = yield transformExtension((0, filterObject_1.filterObject)(value, extensionProperties));
|
|
235
|
+
if (transformedBase.ok && transformedExtension.ok) {
|
|
236
|
+
return {
|
|
237
|
+
ok: true,
|
|
238
|
+
value: Object.assign(Object.assign({}, transformedBase.value), transformedExtension.value),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
return {
|
|
243
|
+
ok: false,
|
|
244
|
+
errors: [
|
|
245
|
+
...(transformedBase.ok ? [] : transformedBase.errors),
|
|
246
|
+
...(transformedExtension.ok ? [] : transformedExtension.errors),
|
|
247
|
+
],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function isSchemaRequired(schema) {
|
|
253
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
254
|
+
return !(yield isSchemaOptional(schema));
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function isSchemaOptional(schema) {
|
|
258
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
switch (yield schema.getType()) {
|
|
260
|
+
case Schema_1.SchemaType.ANY:
|
|
261
|
+
case Schema_1.SchemaType.UNKNOWN:
|
|
262
|
+
case Schema_1.SchemaType.OPTIONAL:
|
|
263
|
+
return true;
|
|
264
|
+
default:
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectWithoutOptionalProperties = void 0;
|
|
4
|
+
const object_1 = require("./object");
|
|
5
|
+
function objectWithoutOptionalProperties(schemas) {
|
|
6
|
+
return (0, object_1.object)(schemas);
|
|
7
|
+
}
|
|
8
|
+
exports.objectWithoutOptionalProperties = objectWithoutOptionalProperties;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isProperty = exports.property = void 0;
|
|
4
|
+
function property(rawKey, valueSchema) {
|
|
5
|
+
return {
|
|
6
|
+
rawKey,
|
|
7
|
+
valueSchema,
|
|
8
|
+
isProperty: true,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
exports.property = property;
|
|
12
|
+
function isProperty(maybeProperty) {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
14
|
+
return maybeProperty.isProperty;
|
|
15
|
+
}
|
|
16
|
+
exports.isProperty = isProperty;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export var __esModule: boolean;
|
|
2
|
+
export function getObjectLikeUtils(schema: any): {
|
|
3
|
+
withParsedProperties: (properties: any) => {
|
|
4
|
+
parse: (raw: any, opts: any) => any;
|
|
5
|
+
json: (parsed: any, opts: any) => any;
|
|
6
|
+
getType: () => any;
|
|
7
|
+
} & schema_utils_1.SchemaUtils<any, any> & any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* object-like utils are defined in one file to resolve issues with circular imports
|
|
11
|
+
*/
|
|
12
|
+
export function withParsedProperties(objectLike: any, properties: any): {
|
|
13
|
+
parse: (raw: any, opts: any) => any;
|
|
14
|
+
json: (parsed: any, opts: any) => any;
|
|
15
|
+
getType: () => any;
|
|
16
|
+
} & schema_utils_1.SchemaUtils<any, any> & {
|
|
17
|
+
withParsedProperties: (properties: any) => {
|
|
18
|
+
parse: (raw: any, opts: any) => any;
|
|
19
|
+
json: (parsed: any, opts: any) => any;
|
|
20
|
+
getType: () => any;
|
|
21
|
+
} & schema_utils_1.SchemaUtils<any, any> & any;
|
|
22
|
+
};
|
|
23
|
+
import schema_utils_1 = require("../schema-utils");
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
reject(e);
|
|
10
|
+
} }
|
|
11
|
+
function rejected(value) { try {
|
|
12
|
+
step(generator["throw"](value));
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
} }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.withParsedProperties = exports.getObjectLikeUtils = void 0;
|
|
23
|
+
const filterObject_1 = require("../../utils/filterObject");
|
|
24
|
+
const getErrorMessageForIncorrectType_1 = require("../../utils/getErrorMessageForIncorrectType");
|
|
25
|
+
const isPlainObject_1 = require("../../utils/isPlainObject");
|
|
26
|
+
const schema_utils_1 = require("../schema-utils");
|
|
27
|
+
function getObjectLikeUtils(schema) {
|
|
28
|
+
return {
|
|
29
|
+
withParsedProperties: (properties) => withParsedProperties(schema, properties),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
exports.getObjectLikeUtils = getObjectLikeUtils;
|
|
33
|
+
/**
|
|
34
|
+
* object-like utils are defined in one file to resolve issues with circular imports
|
|
35
|
+
*/
|
|
36
|
+
function withParsedProperties(objectLike, properties) {
|
|
37
|
+
const objectSchema = {
|
|
38
|
+
parse: (raw, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const parsedObject = yield objectLike.parse(raw, opts);
|
|
40
|
+
if (!parsedObject.ok) {
|
|
41
|
+
return parsedObject;
|
|
42
|
+
}
|
|
43
|
+
const additionalProperties = Object.entries(properties).reduce((processed, [key, value]) => {
|
|
44
|
+
return Object.assign(Object.assign({}, processed), { [key]: typeof value === "function" ? value(parsedObject.value) : value });
|
|
45
|
+
}, {});
|
|
46
|
+
return {
|
|
47
|
+
ok: true,
|
|
48
|
+
value: Object.assign(Object.assign({}, parsedObject.value), additionalProperties),
|
|
49
|
+
};
|
|
50
|
+
}),
|
|
51
|
+
json: (parsed, opts) => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (!(0, isPlainObject_1.isPlainObject)(parsed)) {
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
errors: [
|
|
57
|
+
{
|
|
58
|
+
path: (_a = opts === null || opts === void 0 ? void 0 : opts.breadcrumbsPrefix) !== null && _a !== void 0 ? _a : [],
|
|
59
|
+
message: (0, getErrorMessageForIncorrectType_1.getErrorMessageForIncorrectType)(parsed, "object"),
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// strip out added properties
|
|
65
|
+
const addedPropertyKeys = new Set(Object.keys(properties));
|
|
66
|
+
const parsedWithoutAddedProperties = (0, filterObject_1.filterObject)(parsed, Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)));
|
|
67
|
+
return objectLike.json(parsedWithoutAddedProperties, opts);
|
|
68
|
+
},
|
|
69
|
+
getType: () => objectLike.getType(),
|
|
70
|
+
};
|
|
71
|
+
return Object.assign(Object.assign(Object.assign({}, objectSchema), (0, schema_utils_1.getSchemaUtils)(objectSchema)), getObjectLikeUtils(objectSchema));
|
|
72
|
+
}
|
|
73
|
+
exports.withParsedProperties = withParsedProperties;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withParsedProperties = exports.getObjectLikeUtils = void 0;
|
|
4
|
+
var getObjectLikeUtils_1 = require("./getObjectLikeUtils");
|
|
5
|
+
Object.defineProperty(exports, "getObjectLikeUtils", { enumerable: true, get: function () { return getObjectLikeUtils_1.getObjectLikeUtils; } });
|
|
6
|
+
Object.defineProperty(exports, "withParsedProperties", { enumerable: true, get: function () { return getObjectLikeUtils_1.withParsedProperties; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var __esModule: boolean;
|