@rulebricks/sdk 1.2.1 → 1.4.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 +12 -11
- package/Client.js +15 -15
- package/README.md +3 -3
- package/api/errors/BadRequestError.d.ts +1 -1
- package/api/errors/BadRequestError.js +1 -1
- package/api/errors/ForbiddenError.d.ts +2 -3
- package/api/errors/ForbiddenError.js +1 -1
- package/api/errors/InternalServerError.d.ts +1 -1
- package/api/errors/InternalServerError.js +1 -1
- package/api/errors/NotFoundError.d.ts +1 -1
- package/api/errors/NotFoundError.js +1 -1
- package/api/resources/assets/client/Client.d.ts +13 -120
- package/api/resources/assets/client/Client.js +17 -526
- package/api/resources/assets/client/index.d.ts +1 -1
- package/api/resources/assets/client/index.js +0 -15
- package/api/resources/assets/index.d.ts +1 -0
- package/api/resources/assets/index.js +1 -0
- package/api/resources/assets/resources/flows/client/Client.d.ts +42 -0
- package/api/resources/assets/resources/flows/client/Client.js +116 -0
- package/api/resources/assets/resources/flows/client/index.d.ts +1 -0
- package/api/resources/assets/resources/flows/index.d.ts +1 -0
- package/{dist/serialization/resources/values/types → api/resources/assets/resources/flows}/index.js +1 -1
- package/api/resources/assets/resources/folders/client/Client.d.ts +74 -0
- package/api/resources/assets/resources/folders/client/Client.js +248 -0
- package/api/resources/assets/resources/folders/client/requests/index.d.ts +2 -0
- package/api/resources/assets/resources/folders/index.d.ts +1 -0
- package/{dist/api/resources/values/types → api/resources/assets/resources/folders}/index.js +1 -1
- package/api/resources/assets/resources/index.d.ts +5 -0
- package/api/resources/assets/resources/index.js +34 -0
- package/api/resources/assets/resources/rules/client/Client.d.ts +94 -0
- package/api/resources/assets/resources/rules/client/Client.js +332 -0
- package/{dist/api/resources/assets/client/requests/ListRulesRequest.d.ts → api/resources/assets/resources/rules/client/requests/RulesListRequest.d.ts} +1 -1
- package/{dist/api/resources/assets/client/requests/ExportRuleRequest.d.ts → api/resources/assets/resources/rules/client/requests/RulesPullRequest.d.ts} +1 -1
- package/api/resources/assets/resources/rules/client/requests/index.d.ts +4 -0
- package/api/resources/assets/resources/rules/client/requests/index.js +2 -0
- package/api/resources/assets/resources/rules/index.d.ts +1 -0
- package/api/resources/assets/resources/rules/index.js +17 -0
- package/api/resources/decisions/client/Client.d.ts +7 -6
- package/api/resources/decisions/client/Client.js +13 -12
- package/{dist/api/resources/decisions/client/requests/QueryRequest.d.ts → api/resources/decisions/client/requests/DecisionsQueryRequest.d.ts} +1 -1
- package/api/resources/decisions/client/requests/index.d.ts +1 -1
- package/api/resources/flows/client/Client.d.ts +7 -6
- package/api/resources/flows/client/Client.js +13 -12
- package/api/resources/index.d.ts +1 -3
- package/api/resources/index.js +2 -4
- package/api/resources/rules/client/Client.d.ts +15 -14
- package/api/resources/rules/client/Client.js +35 -34
- package/api/resources/tests/client/Client.d.ts +8 -120
- package/api/resources/tests/client/Client.js +6 -441
- package/api/resources/tests/index.d.ts +1 -0
- package/api/resources/tests/index.js +1 -0
- package/api/resources/tests/resources/flows/client/Client.d.ts +82 -0
- package/api/resources/tests/resources/flows/client/Client.js +257 -0
- package/api/resources/tests/resources/flows/client/index.d.ts +1 -0
- package/api/resources/tests/resources/flows/client/index.js +2 -0
- package/api/resources/tests/resources/flows/index.d.ts +1 -0
- package/api/resources/tests/resources/flows/index.js +17 -0
- package/api/resources/tests/resources/index.d.ts +2 -0
- package/api/resources/tests/resources/index.js +28 -0
- package/api/resources/tests/resources/rules/client/Client.d.ts +82 -0
- package/api/resources/tests/resources/rules/client/Client.js +257 -0
- package/api/resources/tests/resources/rules/client/index.d.ts +1 -0
- package/api/resources/tests/resources/rules/client/index.js +2 -0
- package/api/resources/tests/resources/rules/index.d.ts +1 -0
- package/api/resources/tests/resources/rules/index.js +17 -0
- package/api/resources/users/client/Client.d.ts +12 -35
- package/api/resources/users/client/Client.js +21 -137
- package/api/resources/users/client/requests/UserInviteRequest.d.ts +2 -2
- package/api/resources/users/client/requests/index.d.ts +0 -1
- package/api/resources/users/index.d.ts +1 -0
- package/api/resources/users/index.js +1 -0
- package/api/resources/users/resources/groups/client/Client.d.ts +58 -0
- package/api/resources/users/resources/groups/client/Client.js +181 -0
- package/api/resources/users/resources/groups/client/index.d.ts +1 -0
- package/api/resources/users/resources/groups/client/index.js +17 -0
- package/api/resources/users/resources/groups/client/requests/index.d.ts +1 -0
- package/api/resources/users/resources/groups/client/requests/index.js +2 -0
- package/api/resources/users/resources/groups/index.d.ts +1 -0
- package/api/resources/users/resources/groups/index.js +17 -0
- package/api/resources/users/resources/index.d.ts +2 -0
- package/api/resources/users/resources/index.js +31 -0
- package/api/resources/values/client/Client.d.ts +73 -18
- package/api/resources/values/client/Client.js +101 -39
- package/api/resources/values/client/requests/UpdateValuesRequest.d.ts +81 -4
- package/{dist/api/resources/values/client/requests/DeleteRequest.d.ts → api/resources/values/client/requests/ValuesDeleteRequest.d.ts} +1 -1
- package/api/resources/values/client/requests/ValuesListRequest.d.ts +24 -0
- package/api/resources/values/client/requests/index.d.ts +2 -2
- package/api/resources/values/index.d.ts +0 -1
- package/api/resources/values/index.js +0 -1
- package/api/types/BulkRuleResponseItem.d.ts +2 -2
- package/api/types/DecisionLog.d.ts +4 -4
- package/api/types/DecisionLogDecision.d.ts +2 -2
- package/api/types/DecisionLogResponse.d.ts +2 -2
- package/api/types/DynamicValue.d.ts +13 -15
- package/api/types/DynamicValueListResponse.d.ts +2 -2
- package/api/types/FlowDetail.d.ts +2 -2
- package/api/types/FlowListResponse.d.ts +2 -2
- package/api/types/FolderListResponse.d.ts +2 -2
- package/api/types/ParallelSolveRequest.d.ts +2 -2
- package/api/types/ParallelSolveResponse.d.ts +2 -2
- package/api/types/RuleDetail.d.ts +5 -5
- package/api/types/RuleListResponse.d.ts +2 -2
- package/api/types/SchemaField.d.ts +3 -3
- package/api/types/Test.d.ts +2 -2
- package/api/types/TestListResponse.d.ts +2 -2
- package/api/types/TestTestState.d.ts +3 -3
- package/api/types/UserGroupListResponse.d.ts +2 -2
- package/api/types/UserInviteResponse.d.ts +2 -2
- package/api/types/index.d.ts +0 -6
- package/api/types/index.js +0 -6
- package/dist/Client.d.ts +12 -11
- package/dist/Client.js +15 -15
- package/dist/api/errors/BadRequestError.d.ts +1 -1
- package/dist/api/errors/BadRequestError.js +1 -1
- package/dist/api/errors/ForbiddenError.d.ts +2 -3
- package/dist/api/errors/ForbiddenError.js +1 -1
- package/dist/api/errors/InternalServerError.d.ts +1 -1
- package/dist/api/errors/InternalServerError.js +1 -1
- package/dist/api/errors/NotFoundError.d.ts +1 -1
- package/dist/api/errors/NotFoundError.js +1 -1
- package/dist/api/resources/assets/client/Client.d.ts +13 -120
- package/dist/api/resources/assets/client/Client.js +17 -526
- package/dist/api/resources/assets/client/index.d.ts +1 -1
- package/dist/api/resources/assets/client/index.js +0 -15
- package/dist/api/resources/assets/index.d.ts +1 -0
- package/dist/api/resources/assets/index.js +1 -0
- package/dist/api/resources/assets/resources/flows/client/Client.d.ts +42 -0
- package/dist/api/resources/assets/resources/flows/client/Client.js +116 -0
- package/dist/api/resources/assets/resources/flows/client/index.d.ts +1 -0
- package/dist/api/resources/assets/resources/flows/client/index.js +2 -0
- package/dist/api/resources/assets/resources/flows/index.d.ts +1 -0
- package/dist/api/resources/assets/resources/flows/index.js +17 -0
- package/dist/api/resources/assets/resources/folders/client/Client.d.ts +74 -0
- package/dist/api/resources/assets/resources/folders/client/Client.js +248 -0
- package/dist/api/resources/assets/resources/folders/client/index.d.ts +1 -0
- package/dist/api/resources/assets/resources/folders/client/index.js +17 -0
- package/dist/api/resources/assets/resources/folders/client/requests/index.d.ts +2 -0
- package/dist/api/resources/assets/resources/folders/client/requests/index.js +2 -0
- package/dist/api/resources/assets/resources/folders/index.d.ts +1 -0
- package/dist/api/resources/assets/resources/folders/index.js +17 -0
- package/dist/api/resources/assets/resources/index.d.ts +5 -0
- package/dist/api/resources/assets/resources/index.js +34 -0
- package/dist/api/resources/assets/resources/rules/client/Client.d.ts +94 -0
- package/dist/api/resources/assets/resources/rules/client/Client.js +332 -0
- package/dist/api/resources/assets/resources/rules/client/index.d.ts +1 -0
- package/dist/api/resources/assets/resources/rules/client/index.js +17 -0
- package/{api/resources/assets/client/requests/ListRulesRequest.d.ts → dist/api/resources/assets/resources/rules/client/requests/RulesListRequest.d.ts} +1 -1
- package/{api/resources/assets/client/requests/ExportRuleRequest.d.ts → dist/api/resources/assets/resources/rules/client/requests/RulesPullRequest.d.ts} +1 -1
- package/dist/api/resources/assets/resources/rules/client/requests/index.d.ts +4 -0
- package/dist/api/resources/assets/resources/rules/client/requests/index.js +2 -0
- package/dist/api/resources/assets/resources/rules/index.d.ts +1 -0
- package/dist/api/resources/assets/resources/rules/index.js +17 -0
- package/dist/api/resources/decisions/client/Client.d.ts +7 -6
- package/dist/api/resources/decisions/client/Client.js +13 -12
- package/{api/resources/decisions/client/requests/QueryRequest.d.ts → dist/api/resources/decisions/client/requests/DecisionsQueryRequest.d.ts} +1 -1
- package/dist/api/resources/decisions/client/requests/index.d.ts +1 -1
- package/dist/api/resources/flows/client/Client.d.ts +7 -6
- package/dist/api/resources/flows/client/Client.js +13 -12
- package/dist/api/resources/index.d.ts +1 -3
- package/dist/api/resources/index.js +2 -4
- package/dist/api/resources/rules/client/Client.d.ts +15 -14
- package/dist/api/resources/rules/client/Client.js +35 -34
- package/dist/api/resources/tests/client/Client.d.ts +8 -120
- package/dist/api/resources/tests/client/Client.js +6 -441
- package/dist/api/resources/tests/index.d.ts +1 -0
- package/dist/api/resources/tests/index.js +1 -0
- package/dist/api/resources/tests/resources/flows/client/Client.d.ts +82 -0
- package/dist/api/resources/tests/resources/flows/client/Client.js +257 -0
- package/dist/api/resources/tests/resources/flows/client/index.d.ts +1 -0
- package/dist/api/resources/tests/resources/flows/client/index.js +2 -0
- package/dist/api/resources/tests/resources/flows/index.d.ts +1 -0
- package/dist/api/resources/tests/resources/flows/index.js +17 -0
- package/dist/api/resources/tests/resources/index.d.ts +2 -0
- package/dist/api/resources/tests/resources/index.js +28 -0
- package/dist/api/resources/tests/resources/rules/client/Client.d.ts +82 -0
- package/dist/api/resources/tests/resources/rules/client/Client.js +257 -0
- package/dist/api/resources/tests/resources/rules/client/index.d.ts +1 -0
- package/dist/api/resources/tests/resources/rules/client/index.js +2 -0
- package/dist/api/resources/tests/resources/rules/index.d.ts +1 -0
- package/dist/api/resources/tests/resources/rules/index.js +17 -0
- package/dist/api/resources/users/client/Client.d.ts +12 -35
- package/dist/api/resources/users/client/Client.js +21 -137
- package/dist/api/resources/users/client/requests/UserInviteRequest.d.ts +2 -2
- package/dist/api/resources/users/client/requests/index.d.ts +0 -1
- package/dist/api/resources/users/index.d.ts +1 -0
- package/dist/api/resources/users/index.js +1 -0
- package/dist/api/resources/users/resources/groups/client/Client.d.ts +58 -0
- package/dist/api/resources/users/resources/groups/client/Client.js +181 -0
- package/dist/api/resources/users/resources/groups/client/index.d.ts +1 -0
- package/dist/api/resources/users/resources/groups/client/index.js +17 -0
- package/dist/api/resources/users/resources/groups/client/requests/index.d.ts +1 -0
- package/dist/api/resources/users/resources/groups/client/requests/index.js +2 -0
- package/dist/api/resources/users/resources/groups/index.d.ts +1 -0
- package/dist/api/resources/users/resources/groups/index.js +17 -0
- package/dist/api/resources/users/resources/index.d.ts +2 -0
- package/dist/api/resources/users/resources/index.js +31 -0
- package/dist/api/resources/values/client/Client.d.ts +73 -18
- package/dist/api/resources/values/client/Client.js +101 -39
- package/dist/api/resources/values/client/requests/UpdateValuesRequest.d.ts +81 -4
- package/{api/resources/values/client/requests/DeleteRequest.d.ts → dist/api/resources/values/client/requests/ValuesDeleteRequest.d.ts} +1 -1
- package/dist/api/resources/values/client/requests/ValuesListRequest.d.ts +24 -0
- package/dist/api/resources/values/client/requests/index.d.ts +2 -2
- package/dist/api/resources/values/index.d.ts +0 -1
- package/dist/api/resources/values/index.js +0 -1
- package/dist/api/types/BulkRuleResponseItem.d.ts +2 -2
- package/dist/api/types/DecisionLog.d.ts +4 -4
- package/dist/api/types/DecisionLogDecision.d.ts +2 -2
- package/dist/api/types/DecisionLogResponse.d.ts +2 -2
- package/dist/api/types/DynamicValue.d.ts +13 -15
- package/dist/api/types/DynamicValueListResponse.d.ts +2 -2
- package/dist/api/types/FlowDetail.d.ts +2 -2
- package/dist/api/types/FlowListResponse.d.ts +2 -2
- package/dist/api/types/FolderListResponse.d.ts +2 -2
- package/dist/api/types/ParallelSolveRequest.d.ts +2 -2
- package/dist/api/types/ParallelSolveResponse.d.ts +2 -2
- package/dist/api/types/RuleDetail.d.ts +5 -5
- package/dist/api/types/RuleListResponse.d.ts +2 -2
- package/dist/api/types/SchemaField.d.ts +3 -3
- package/dist/api/types/Test.d.ts +2 -2
- package/dist/api/types/TestListResponse.d.ts +2 -2
- package/dist/api/types/TestTestState.d.ts +3 -3
- package/dist/api/types/UserGroupListResponse.d.ts +2 -2
- package/dist/api/types/UserInviteResponse.d.ts +2 -2
- package/dist/api/types/index.d.ts +0 -6
- package/dist/api/types/index.js +0 -6
- package/dist/environments.d.ts +7 -0
- package/dist/environments.js +9 -0
- package/dist/errors/{RulebricksApiError.d.ts → RulebricksError.d.ts} +1 -1
- package/dist/errors/{RulebricksApiError.js → RulebricksError.js} +4 -4
- package/dist/errors/{RulebricksApiTimeoutError.d.ts → RulebricksTimeoutError.d.ts} +1 -1
- package/dist/errors/RulebricksTimeoutError.js +13 -0
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +5 -5
- package/dist/forge/rule.d.ts +2 -2
- package/dist/forge/rule.js +8 -8
- package/dist/forge/values.d.ts +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -5
- package/dist/serialization/resources/assets/index.d.ts +1 -1
- package/dist/serialization/resources/assets/index.js +1 -1
- package/dist/serialization/resources/assets/resources/folders/client/index.d.ts +1 -0
- package/dist/serialization/resources/assets/resources/folders/client/index.js +17 -0
- package/dist/serialization/resources/assets/resources/folders/client/requests/DeleteFolderRequest.d.ts +12 -0
- package/dist/serialization/resources/assets/{client → resources/folders/client}/requests/DeleteFolderRequest.js +1 -1
- package/dist/serialization/resources/assets/{client → resources/folders/client}/requests/UpsertFolderRequest.d.ts +4 -4
- package/{serialization/resources/assets → dist/serialization/resources/assets/resources/folders}/client/requests/UpsertFolderRequest.js +1 -1
- package/dist/serialization/resources/assets/{client → resources/folders/client}/requests/index.d.ts +0 -2
- package/dist/serialization/resources/assets/resources/folders/client/requests/index.js +7 -0
- package/dist/serialization/resources/assets/resources/folders/index.d.ts +1 -0
- package/dist/serialization/resources/assets/resources/folders/index.js +17 -0
- package/dist/serialization/resources/assets/resources/index.d.ts +4 -0
- package/dist/serialization/resources/assets/resources/index.js +33 -0
- package/dist/serialization/resources/assets/resources/rules/client/index.d.ts +1 -0
- package/dist/serialization/resources/assets/resources/rules/client/index.js +17 -0
- package/dist/serialization/resources/assets/resources/rules/client/requests/DeleteRuleRequest.d.ts +12 -0
- package/dist/serialization/resources/assets/{client → resources/rules/client}/requests/DeleteRuleRequest.js +1 -1
- package/dist/serialization/resources/assets/resources/rules/client/requests/ImportRuleRequest.d.ts +12 -0
- package/{serialization/resources/assets → dist/serialization/resources/assets/resources/rules}/client/requests/ImportRuleRequest.js +1 -1
- package/dist/serialization/resources/assets/resources/rules/client/requests/index.d.ts +2 -0
- package/dist/serialization/resources/assets/resources/rules/client/requests/index.js +7 -0
- package/dist/serialization/resources/assets/resources/rules/index.d.ts +1 -0
- package/dist/serialization/resources/assets/resources/rules/index.js +17 -0
- package/dist/serialization/resources/index.d.ts +2 -4
- package/dist/serialization/resources/index.js +3 -5
- package/dist/serialization/resources/rules/client/bulkSolve.d.ts +3 -3
- package/dist/serialization/resources/users/client/requests/UserInviteRequest.d.ts +2 -2
- package/dist/serialization/resources/users/client/requests/index.d.ts +0 -1
- package/dist/serialization/resources/users/client/requests/index.js +1 -3
- package/dist/serialization/resources/users/index.d.ts +1 -0
- package/dist/serialization/resources/users/index.js +1 -0
- package/dist/serialization/resources/users/resources/groups/client/index.d.ts +1 -0
- package/dist/serialization/resources/users/resources/groups/client/index.js +17 -0
- package/dist/serialization/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.d.ts +4 -4
- package/dist/serialization/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.js +1 -1
- package/dist/serialization/resources/users/resources/groups/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/users/resources/groups/client/requests/index.js +5 -0
- package/dist/serialization/resources/users/resources/groups/index.d.ts +1 -0
- package/dist/serialization/resources/users/resources/groups/index.js +17 -0
- package/dist/serialization/resources/users/resources/index.d.ts +2 -0
- package/dist/serialization/resources/users/resources/index.js +31 -0
- package/dist/serialization/resources/users/types/UserInviteRequestRole.d.ts +2 -2
- package/dist/serialization/resources/values/client/requests/UpdateValuesRequest.d.ts +3 -4
- package/dist/serialization/resources/values/client/requests/UpdateValuesRequest.js +1 -2
- package/dist/serialization/resources/values/index.d.ts +0 -1
- package/dist/serialization/resources/values/index.js +0 -1
- package/dist/serialization/types/BulkRuleResponseItem.d.ts +2 -2
- package/dist/serialization/types/BulkRuleResponseItemError.d.ts +2 -2
- package/dist/serialization/types/CreateTestRequest.d.ts +2 -2
- package/dist/serialization/types/DecisionLog.d.ts +2 -2
- package/dist/serialization/types/DecisionLogDecision.d.ts +2 -2
- package/dist/serialization/types/DecisionLogDecisionConditionsItemValue.d.ts +2 -2
- package/dist/serialization/types/DecisionLogRequest.d.ts +2 -2
- package/dist/serialization/types/DecisionLogResponse.d.ts +2 -2
- package/dist/serialization/types/DynamicRequestPayload.d.ts +2 -2
- package/dist/serialization/types/DynamicResponsePayload.d.ts +2 -2
- package/dist/serialization/types/DynamicValue.d.ts +10 -18
- package/dist/serialization/types/DynamicValue.js +8 -14
- package/dist/serialization/types/DynamicValueListResponse.d.ts +2 -2
- package/dist/serialization/types/Error_.d.ts +2 -2
- package/dist/serialization/types/FlowBase.d.ts +2 -2
- package/dist/serialization/types/FlowDetail.d.ts +2 -2
- package/dist/serialization/types/FlowExecutionError.d.ts +2 -2
- package/dist/serialization/types/FlowListResponse.d.ts +2 -2
- package/dist/serialization/types/Folder.d.ts +2 -2
- package/dist/serialization/types/FolderListResponse.d.ts +2 -2
- package/dist/serialization/types/ParallelSolveRequest.d.ts +2 -2
- package/dist/serialization/types/ParallelSolveRequestValue.d.ts +2 -2
- package/dist/serialization/types/ParallelSolveResponse.d.ts +2 -2
- package/dist/serialization/types/RuleBase.d.ts +2 -2
- package/dist/serialization/types/RuleDetail.d.ts +2 -2
- package/dist/serialization/types/RuleExport.d.ts +2 -2
- package/dist/serialization/types/RuleListResponse.d.ts +2 -2
- package/dist/serialization/types/RuleUsage.d.ts +2 -2
- package/dist/serialization/types/SchemaField.d.ts +2 -2
- package/dist/serialization/types/SchemaFieldDefaultValue.d.ts +2 -2
- package/dist/serialization/types/SchemaFieldType.d.ts +2 -2
- package/dist/serialization/types/SuccessMessage.d.ts +2 -2
- package/dist/serialization/types/Test.d.ts +2 -2
- package/dist/serialization/types/TestListResponse.d.ts +2 -2
- package/dist/serialization/types/TestTestState.d.ts +2 -2
- package/dist/serialization/types/TestTestStateConditionsItemValue.d.ts +2 -2
- package/dist/serialization/types/TestTestStateEvaluationError.d.ts +2 -2
- package/dist/serialization/types/UsageStatistics.d.ts +2 -2
- package/dist/serialization/types/UserGroup.d.ts +2 -2
- package/dist/serialization/types/UserGroupListResponse.d.ts +2 -2
- package/dist/serialization/types/UserInviteResponse.d.ts +2 -2
- package/dist/serialization/types/UserInviteResponseUser.d.ts +2 -2
- package/dist/serialization/types/ValueLimits.d.ts +2 -2
- package/dist/serialization/types/index.d.ts +0 -6
- package/dist/serialization/types/index.js +0 -6
- package/environments.d.ts +7 -0
- package/environments.js +9 -0
- package/errors/{RulebricksApiError.d.ts → RulebricksError.d.ts} +1 -1
- package/errors/{RulebricksApiError.js → RulebricksError.js} +4 -4
- package/errors/{RulebricksApiTimeoutError.d.ts → RulebricksTimeoutError.d.ts} +1 -1
- package/errors/RulebricksTimeoutError.js +13 -0
- package/errors/index.d.ts +2 -2
- package/errors/index.js +5 -5
- package/forge/rule.d.ts +2 -2
- package/forge/rule.js +8 -8
- package/forge/values.d.ts +2 -2
- package/index.d.ts +4 -3
- package/index.js +7 -5
- package/package.json +1 -1
- package/serialization/resources/assets/index.d.ts +1 -1
- package/serialization/resources/assets/index.js +1 -1
- package/serialization/resources/assets/resources/folders/client/index.d.ts +1 -0
- package/serialization/resources/assets/resources/folders/client/index.js +17 -0
- package/serialization/resources/assets/resources/folders/client/requests/DeleteFolderRequest.d.ts +12 -0
- package/serialization/resources/assets/{client → resources/folders/client}/requests/DeleteFolderRequest.js +1 -1
- package/serialization/resources/assets/{client → resources/folders/client}/requests/UpsertFolderRequest.d.ts +4 -4
- package/{dist/serialization/resources/assets → serialization/resources/assets/resources/folders}/client/requests/UpsertFolderRequest.js +1 -1
- package/serialization/resources/assets/{client → resources/folders/client}/requests/index.d.ts +0 -2
- package/serialization/resources/assets/resources/folders/client/requests/index.js +7 -0
- package/serialization/resources/assets/resources/folders/index.d.ts +1 -0
- package/serialization/resources/assets/resources/folders/index.js +17 -0
- package/serialization/resources/assets/resources/index.d.ts +4 -0
- package/serialization/resources/assets/resources/index.js +33 -0
- package/serialization/resources/assets/resources/rules/client/index.d.ts +1 -0
- package/serialization/resources/assets/resources/rules/client/index.js +17 -0
- package/serialization/resources/assets/resources/rules/client/requests/DeleteRuleRequest.d.ts +12 -0
- package/serialization/resources/assets/{client → resources/rules/client}/requests/DeleteRuleRequest.js +1 -1
- package/serialization/resources/assets/resources/rules/client/requests/ImportRuleRequest.d.ts +12 -0
- package/{dist/serialization/resources/assets → serialization/resources/assets/resources/rules}/client/requests/ImportRuleRequest.js +1 -1
- package/serialization/resources/assets/resources/rules/client/requests/index.d.ts +2 -0
- package/serialization/resources/assets/resources/rules/client/requests/index.js +7 -0
- package/serialization/resources/assets/resources/rules/index.d.ts +1 -0
- package/serialization/resources/assets/resources/rules/index.js +17 -0
- package/serialization/resources/index.d.ts +2 -4
- package/serialization/resources/index.js +3 -5
- package/serialization/resources/rules/client/bulkSolve.d.ts +3 -3
- package/serialization/resources/users/client/requests/UserInviteRequest.d.ts +2 -2
- package/serialization/resources/users/client/requests/index.d.ts +0 -1
- package/serialization/resources/users/client/requests/index.js +1 -3
- package/serialization/resources/users/index.d.ts +1 -0
- package/serialization/resources/users/index.js +1 -0
- package/serialization/resources/users/resources/groups/client/index.d.ts +1 -0
- package/serialization/resources/users/resources/groups/client/index.js +17 -0
- package/serialization/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.d.ts +4 -4
- package/serialization/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.js +1 -1
- package/serialization/resources/users/resources/groups/client/requests/index.d.ts +1 -0
- package/serialization/resources/users/resources/groups/client/requests/index.js +5 -0
- package/serialization/resources/users/resources/groups/index.d.ts +1 -0
- package/serialization/resources/users/resources/groups/index.js +17 -0
- package/serialization/resources/users/resources/index.d.ts +2 -0
- package/serialization/resources/users/resources/index.js +31 -0
- package/serialization/resources/users/types/UserInviteRequestRole.d.ts +2 -2
- package/serialization/resources/values/client/requests/UpdateValuesRequest.d.ts +3 -4
- package/serialization/resources/values/client/requests/UpdateValuesRequest.js +1 -2
- package/serialization/resources/values/index.d.ts +0 -1
- package/serialization/resources/values/index.js +0 -1
- package/serialization/types/BulkRuleResponseItem.d.ts +2 -2
- package/serialization/types/BulkRuleResponseItemError.d.ts +2 -2
- package/serialization/types/CreateTestRequest.d.ts +2 -2
- package/serialization/types/DecisionLog.d.ts +2 -2
- package/serialization/types/DecisionLogDecision.d.ts +2 -2
- package/serialization/types/DecisionLogDecisionConditionsItemValue.d.ts +2 -2
- package/serialization/types/DecisionLogRequest.d.ts +2 -2
- package/serialization/types/DecisionLogResponse.d.ts +2 -2
- package/serialization/types/DynamicRequestPayload.d.ts +2 -2
- package/serialization/types/DynamicResponsePayload.d.ts +2 -2
- package/serialization/types/DynamicValue.d.ts +10 -18
- package/serialization/types/DynamicValue.js +8 -14
- package/serialization/types/DynamicValueListResponse.d.ts +2 -2
- package/serialization/types/Error_.d.ts +2 -2
- package/serialization/types/FlowBase.d.ts +2 -2
- package/serialization/types/FlowDetail.d.ts +2 -2
- package/serialization/types/FlowExecutionError.d.ts +2 -2
- package/serialization/types/FlowListResponse.d.ts +2 -2
- package/serialization/types/Folder.d.ts +2 -2
- package/serialization/types/FolderListResponse.d.ts +2 -2
- package/serialization/types/ParallelSolveRequest.d.ts +2 -2
- package/serialization/types/ParallelSolveRequestValue.d.ts +2 -2
- package/serialization/types/ParallelSolveResponse.d.ts +2 -2
- package/serialization/types/RuleBase.d.ts +2 -2
- package/serialization/types/RuleDetail.d.ts +2 -2
- package/serialization/types/RuleExport.d.ts +2 -2
- package/serialization/types/RuleListResponse.d.ts +2 -2
- package/serialization/types/RuleUsage.d.ts +2 -2
- package/serialization/types/SchemaField.d.ts +2 -2
- package/serialization/types/SchemaFieldDefaultValue.d.ts +2 -2
- package/serialization/types/SchemaFieldType.d.ts +2 -2
- package/serialization/types/SuccessMessage.d.ts +2 -2
- package/serialization/types/Test.d.ts +2 -2
- package/serialization/types/TestListResponse.d.ts +2 -2
- package/serialization/types/TestTestState.d.ts +2 -2
- package/serialization/types/TestTestStateConditionsItemValue.d.ts +2 -2
- package/serialization/types/TestTestStateEvaluationError.d.ts +2 -2
- package/serialization/types/UsageStatistics.d.ts +2 -2
- package/serialization/types/UserGroup.d.ts +2 -2
- package/serialization/types/UserGroupListResponse.d.ts +2 -2
- package/serialization/types/UserInviteResponse.d.ts +2 -2
- package/serialization/types/UserInviteResponseUser.d.ts +2 -2
- package/serialization/types/ValueLimits.d.ts +2 -2
- package/serialization/types/index.d.ts +0 -6
- package/serialization/types/index.js +0 -6
- package/api/resources/assets/client/requests/index.d.ts +0 -6
- package/api/resources/values/client/requests/ListRequest.d.ts +0 -13
- package/api/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -4
- package/api/resources/values/types/index.d.ts +0 -1
- package/api/resources/values/types/index.js +0 -17
- package/api/types/BooleanValue.d.ts +0 -8
- package/api/types/DynamicValueBase.d.ts +0 -14
- package/api/types/ListValue.d.ts +0 -8
- package/api/types/ListValueValueItem.d.ts +0 -4
- package/api/types/NumberValue.d.ts +0 -8
- package/api/types/NumberValue.js +0 -5
- package/api/types/StringValue.d.ts +0 -8
- package/api/types/StringValue.js +0 -5
- package/dist/api/resources/assets/client/requests/ExportRuleRequest.js +0 -5
- package/dist/api/resources/assets/client/requests/ListRulesRequest.js +0 -5
- package/dist/api/resources/assets/client/requests/index.d.ts +0 -6
- package/dist/api/resources/decisions/client/requests/QueryRequest.js +0 -5
- package/dist/api/resources/values/client/requests/DeleteRequest.js +0 -5
- package/dist/api/resources/values/client/requests/ListRequest.d.ts +0 -13
- package/dist/api/resources/values/client/requests/ListRequest.js +0 -5
- package/dist/api/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -4
- package/dist/api/resources/values/types/UpdateValuesRequestValuesValue.js +0 -5
- package/dist/api/resources/values/types/index.d.ts +0 -1
- package/dist/api/types/BooleanValue.d.ts +0 -8
- package/dist/api/types/BooleanValue.js +0 -5
- package/dist/api/types/DynamicValueBase.d.ts +0 -14
- package/dist/api/types/DynamicValueBase.js +0 -5
- package/dist/api/types/ListValue.d.ts +0 -8
- package/dist/api/types/ListValue.js +0 -5
- package/dist/api/types/ListValueValueItem.d.ts +0 -4
- package/dist/api/types/ListValueValueItem.js +0 -5
- package/dist/api/types/NumberValue.d.ts +0 -8
- package/dist/api/types/NumberValue.js +0 -5
- package/dist/api/types/StringValue.d.ts +0 -8
- package/dist/api/types/StringValue.js +0 -5
- package/dist/errors/RulebricksApiTimeoutError.js +0 -13
- package/dist/serialization/resources/assets/client/requests/DeleteFolderRequest.d.ts +0 -12
- package/dist/serialization/resources/assets/client/requests/DeleteRuleRequest.d.ts +0 -12
- package/dist/serialization/resources/assets/client/requests/ImportRuleRequest.d.ts +0 -12
- package/dist/serialization/resources/assets/client/requests/index.js +0 -11
- package/dist/serialization/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -10
- package/dist/serialization/resources/values/types/UpdateValuesRequestValuesValue.js +0 -36
- package/dist/serialization/resources/values/types/index.d.ts +0 -1
- package/dist/serialization/types/BooleanValue.d.ts +0 -13
- package/dist/serialization/types/BooleanValue.js +0 -36
- package/dist/serialization/types/DynamicValueBase.d.ts +0 -16
- package/dist/serialization/types/DynamicValueBase.js +0 -37
- package/dist/serialization/types/ListValue.d.ts +0 -14
- package/dist/serialization/types/ListValue.js +0 -37
- package/dist/serialization/types/ListValueValueItem.d.ts +0 -10
- package/dist/serialization/types/ListValueValueItem.js +0 -37
- package/dist/serialization/types/NumberValue.d.ts +0 -13
- package/dist/serialization/types/NumberValue.js +0 -36
- package/dist/serialization/types/StringValue.d.ts +0 -13
- package/dist/serialization/types/StringValue.js +0 -36
- package/errors/RulebricksApiTimeoutError.js +0 -13
- package/serialization/resources/assets/client/requests/DeleteFolderRequest.d.ts +0 -12
- package/serialization/resources/assets/client/requests/DeleteRuleRequest.d.ts +0 -12
- package/serialization/resources/assets/client/requests/ImportRuleRequest.d.ts +0 -12
- package/serialization/resources/assets/client/requests/index.js +0 -11
- package/serialization/resources/values/types/UpdateValuesRequestValuesValue.d.ts +0 -10
- package/serialization/resources/values/types/UpdateValuesRequestValuesValue.js +0 -36
- package/serialization/resources/values/types/index.d.ts +0 -1
- package/serialization/resources/values/types/index.js +0 -17
- package/serialization/types/BooleanValue.d.ts +0 -13
- package/serialization/types/BooleanValue.js +0 -36
- package/serialization/types/DynamicValueBase.d.ts +0 -16
- package/serialization/types/DynamicValueBase.js +0 -37
- package/serialization/types/ListValue.d.ts +0 -14
- package/serialization/types/ListValue.js +0 -37
- package/serialization/types/ListValueValueItem.d.ts +0 -10
- package/serialization/types/ListValueValueItem.js +0 -37
- package/serialization/types/NumberValue.d.ts +0 -13
- package/serialization/types/NumberValue.js +0 -36
- package/serialization/types/StringValue.d.ts +0 -13
- package/serialization/types/StringValue.js +0 -36
- /package/api/resources/assets/{client/requests → resources/flows/client}/index.js +0 -0
- /package/{dist/serialization/resources/assets → api/resources/assets/resources/folders}/client/index.d.ts +0 -0
- /package/{dist/serialization/resources/assets → api/resources/assets/resources/folders}/client/index.js +0 -0
- /package/api/resources/assets/{client → resources/folders/client}/requests/DeleteFolderRequest.d.ts +0 -0
- /package/api/resources/assets/{client → resources/folders/client}/requests/DeleteFolderRequest.js +0 -0
- /package/api/resources/assets/{client → resources/folders/client}/requests/UpsertFolderRequest.d.ts +0 -0
- /package/api/resources/assets/{client → resources/folders/client}/requests/UpsertFolderRequest.js +0 -0
- /package/{dist/api/resources/assets → api/resources/assets/resources/folders}/client/requests/index.js +0 -0
- /package/{serialization/resources/assets → api/resources/assets/resources/rules}/client/index.d.ts +0 -0
- /package/{serialization/resources/assets → api/resources/assets/resources/rules}/client/index.js +0 -0
- /package/api/resources/assets/{client → resources/rules/client}/requests/DeleteRuleRequest.d.ts +0 -0
- /package/api/resources/assets/{client → resources/rules/client}/requests/DeleteRuleRequest.js +0 -0
- /package/api/resources/assets/{client → resources/rules/client}/requests/ImportRuleRequest.d.ts +0 -0
- /package/api/resources/assets/{client → resources/rules/client}/requests/ImportRuleRequest.js +0 -0
- /package/api/resources/assets/{client/requests/ExportRuleRequest.js → resources/rules/client/requests/RulesListRequest.js} +0 -0
- /package/api/resources/assets/{client/requests/ListRulesRequest.js → resources/rules/client/requests/RulesPullRequest.js} +0 -0
- /package/api/resources/decisions/client/requests/{QueryRequest.js → DecisionsQueryRequest.js} +0 -0
- /package/api/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.d.ts +0 -0
- /package/api/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.js +0 -0
- /package/api/resources/values/client/requests/{DeleteRequest.js → ValuesDeleteRequest.js} +0 -0
- /package/api/resources/values/client/requests/{ListRequest.js → ValuesListRequest.js} +0 -0
- /package/dist/api/resources/assets/{client → resources/folders/client}/requests/DeleteFolderRequest.d.ts +0 -0
- /package/dist/api/resources/assets/{client → resources/folders/client}/requests/DeleteFolderRequest.js +0 -0
- /package/dist/api/resources/assets/{client → resources/folders/client}/requests/UpsertFolderRequest.d.ts +0 -0
- /package/dist/api/resources/assets/{client → resources/folders/client}/requests/UpsertFolderRequest.js +0 -0
- /package/dist/api/resources/assets/{client → resources/rules/client}/requests/DeleteRuleRequest.d.ts +0 -0
- /package/dist/api/resources/assets/{client → resources/rules/client}/requests/DeleteRuleRequest.js +0 -0
- /package/dist/api/resources/assets/{client → resources/rules/client}/requests/ImportRuleRequest.d.ts +0 -0
- /package/dist/api/resources/assets/{client → resources/rules/client}/requests/ImportRuleRequest.js +0 -0
- /package/{api/resources/values/types/UpdateValuesRequestValuesValue.js → dist/api/resources/assets/resources/rules/client/requests/RulesListRequest.js} +0 -0
- /package/{api/types/BooleanValue.js → dist/api/resources/assets/resources/rules/client/requests/RulesPullRequest.js} +0 -0
- /package/{api/types/DynamicValueBase.js → dist/api/resources/decisions/client/requests/DecisionsQueryRequest.js} +0 -0
- /package/dist/api/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.d.ts +0 -0
- /package/dist/api/resources/users/{client → resources/groups/client}/requests/CreateUserGroupRequest.js +0 -0
- /package/{api/types/ListValue.js → dist/api/resources/values/client/requests/ValuesDeleteRequest.js} +0 -0
- /package/{api/types/ListValueValueItem.js → dist/api/resources/values/client/requests/ValuesListRequest.js} +0 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.Rules = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../../../environments"));
|
|
43
|
+
const core = __importStar(require("../../../../../../core"));
|
|
44
|
+
const Rulebricks = __importStar(require("../../../../../index"));
|
|
45
|
+
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
46
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
47
|
+
const errors = __importStar(require("../../../../../../errors/index"));
|
|
48
|
+
class Rules {
|
|
49
|
+
constructor(_options) {
|
|
50
|
+
this._options = _options;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Delete a specific rule by its ID.
|
|
54
|
+
*
|
|
55
|
+
* @param {Rulebricks.assets.DeleteRuleRequest} request
|
|
56
|
+
* @param {Rules.RequestOptions} requestOptions - Request-specific configuration.
|
|
57
|
+
*
|
|
58
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
59
|
+
* @throws {@link Rulebricks.NotFoundError}
|
|
60
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* await client.assets.rules.delete({
|
|
64
|
+
* id: "id"
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
delete(request, requestOptions) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const _response = yield core.fetcher({
|
|
71
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, "admin/rules/delete"),
|
|
72
|
+
method: "DELETE",
|
|
73
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
74
|
+
contentType: "application/json",
|
|
75
|
+
requestType: "json",
|
|
76
|
+
body: serializers.assets.DeleteRuleRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
77
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
78
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
79
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
80
|
+
});
|
|
81
|
+
if (_response.ok) {
|
|
82
|
+
return serializers.SuccessMessage.parseOrThrow(_response.body, {
|
|
83
|
+
unrecognizedObjectKeys: "passthrough",
|
|
84
|
+
allowUnrecognizedUnionMembers: true,
|
|
85
|
+
allowUnrecognizedEnumValues: true,
|
|
86
|
+
breadcrumbsPrefix: ["response"],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (_response.error.reason === "status-code") {
|
|
90
|
+
switch (_response.error.statusCode) {
|
|
91
|
+
case 400:
|
|
92
|
+
throw new Rulebricks.BadRequestError(_response.error.body);
|
|
93
|
+
case 404:
|
|
94
|
+
throw new Rulebricks.NotFoundError(_response.error.body);
|
|
95
|
+
case 500:
|
|
96
|
+
throw new Rulebricks.InternalServerError(_response.error.body);
|
|
97
|
+
default:
|
|
98
|
+
throw new errors.RulebricksError({
|
|
99
|
+
statusCode: _response.error.statusCode,
|
|
100
|
+
body: _response.error.body,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
switch (_response.error.reason) {
|
|
105
|
+
case "non-json":
|
|
106
|
+
throw new errors.RulebricksError({
|
|
107
|
+
statusCode: _response.error.statusCode,
|
|
108
|
+
body: _response.error.rawBody,
|
|
109
|
+
});
|
|
110
|
+
case "timeout":
|
|
111
|
+
throw new errors.RulebricksTimeoutError("Timeout exceeded when calling DELETE /admin/rules/delete.");
|
|
112
|
+
case "unknown":
|
|
113
|
+
throw new errors.RulebricksError({
|
|
114
|
+
message: _response.error.errorMessage,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Export a specific rule by its ID.
|
|
121
|
+
*
|
|
122
|
+
* @param {Rulebricks.assets.RulesPullRequest} request
|
|
123
|
+
* @param {Rules.RequestOptions} requestOptions - Request-specific configuration.
|
|
124
|
+
*
|
|
125
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
126
|
+
* @throws {@link Rulebricks.NotFoundError}
|
|
127
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* await client.assets.rules.pull({
|
|
131
|
+
* id: "id"
|
|
132
|
+
* })
|
|
133
|
+
*/
|
|
134
|
+
pull(request, requestOptions) {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const { id } = request;
|
|
138
|
+
const _queryParams = {};
|
|
139
|
+
_queryParams["id"] = id;
|
|
140
|
+
const _response = yield core.fetcher({
|
|
141
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, "admin/rules/export"),
|
|
142
|
+
method: "GET",
|
|
143
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
144
|
+
contentType: "application/json",
|
|
145
|
+
queryParameters: _queryParams,
|
|
146
|
+
requestType: "json",
|
|
147
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
148
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
149
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
150
|
+
});
|
|
151
|
+
if (_response.ok) {
|
|
152
|
+
return serializers.RuleExport.parseOrThrow(_response.body, {
|
|
153
|
+
unrecognizedObjectKeys: "passthrough",
|
|
154
|
+
allowUnrecognizedUnionMembers: true,
|
|
155
|
+
allowUnrecognizedEnumValues: true,
|
|
156
|
+
breadcrumbsPrefix: ["response"],
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (_response.error.reason === "status-code") {
|
|
160
|
+
switch (_response.error.statusCode) {
|
|
161
|
+
case 400:
|
|
162
|
+
throw new Rulebricks.BadRequestError(_response.error.body);
|
|
163
|
+
case 404:
|
|
164
|
+
throw new Rulebricks.NotFoundError(_response.error.body);
|
|
165
|
+
case 500:
|
|
166
|
+
throw new Rulebricks.InternalServerError(_response.error.body);
|
|
167
|
+
default:
|
|
168
|
+
throw new errors.RulebricksError({
|
|
169
|
+
statusCode: _response.error.statusCode,
|
|
170
|
+
body: _response.error.body,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
switch (_response.error.reason) {
|
|
175
|
+
case "non-json":
|
|
176
|
+
throw new errors.RulebricksError({
|
|
177
|
+
statusCode: _response.error.statusCode,
|
|
178
|
+
body: _response.error.rawBody,
|
|
179
|
+
});
|
|
180
|
+
case "timeout":
|
|
181
|
+
throw new errors.RulebricksTimeoutError("Timeout exceeded when calling GET /admin/rules/export.");
|
|
182
|
+
case "unknown":
|
|
183
|
+
throw new errors.RulebricksError({
|
|
184
|
+
message: _response.error.errorMessage,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Import a rule into the user's account.
|
|
191
|
+
*
|
|
192
|
+
* @param {Rulebricks.assets.ImportRuleRequest} request
|
|
193
|
+
* @param {Rules.RequestOptions} requestOptions - Request-specific configuration.
|
|
194
|
+
*
|
|
195
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
196
|
+
* @throws {@link Rulebricks.ForbiddenError}
|
|
197
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* await client.assets.rules.push({
|
|
201
|
+
* rule: {
|
|
202
|
+
* "key": "value"
|
|
203
|
+
* }
|
|
204
|
+
* })
|
|
205
|
+
*/
|
|
206
|
+
push(request, requestOptions) {
|
|
207
|
+
var _a, _b;
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
const _response = yield core.fetcher({
|
|
210
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, "admin/rules/import"),
|
|
211
|
+
method: "POST",
|
|
212
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
213
|
+
contentType: "application/json",
|
|
214
|
+
requestType: "json",
|
|
215
|
+
body: serializers.assets.ImportRuleRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
216
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
217
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
218
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
219
|
+
});
|
|
220
|
+
if (_response.ok) {
|
|
221
|
+
return serializers.RuleExport.parseOrThrow(_response.body, {
|
|
222
|
+
unrecognizedObjectKeys: "passthrough",
|
|
223
|
+
allowUnrecognizedUnionMembers: true,
|
|
224
|
+
allowUnrecognizedEnumValues: true,
|
|
225
|
+
breadcrumbsPrefix: ["response"],
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
if (_response.error.reason === "status-code") {
|
|
229
|
+
switch (_response.error.statusCode) {
|
|
230
|
+
case 400:
|
|
231
|
+
throw new Rulebricks.BadRequestError(_response.error.body);
|
|
232
|
+
case 403:
|
|
233
|
+
throw new Rulebricks.ForbiddenError(_response.error.body);
|
|
234
|
+
case 500:
|
|
235
|
+
throw new Rulebricks.InternalServerError(_response.error.body);
|
|
236
|
+
default:
|
|
237
|
+
throw new errors.RulebricksError({
|
|
238
|
+
statusCode: _response.error.statusCode,
|
|
239
|
+
body: _response.error.body,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
switch (_response.error.reason) {
|
|
244
|
+
case "non-json":
|
|
245
|
+
throw new errors.RulebricksError({
|
|
246
|
+
statusCode: _response.error.statusCode,
|
|
247
|
+
body: _response.error.rawBody,
|
|
248
|
+
});
|
|
249
|
+
case "timeout":
|
|
250
|
+
throw new errors.RulebricksTimeoutError("Timeout exceeded when calling POST /admin/rules/import.");
|
|
251
|
+
case "unknown":
|
|
252
|
+
throw new errors.RulebricksError({
|
|
253
|
+
message: _response.error.errorMessage,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* List all rules in the organization. Optionally filter by folder name or ID.
|
|
260
|
+
*
|
|
261
|
+
* @param {Rulebricks.assets.RulesListRequest} request
|
|
262
|
+
* @param {Rules.RequestOptions} requestOptions - Request-specific configuration.
|
|
263
|
+
*
|
|
264
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
265
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* await client.assets.rules.list()
|
|
269
|
+
*/
|
|
270
|
+
list(request = {}, requestOptions) {
|
|
271
|
+
var _a, _b;
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
const { folder } = request;
|
|
274
|
+
const _queryParams = {};
|
|
275
|
+
if (folder != null) {
|
|
276
|
+
_queryParams["folder"] = folder;
|
|
277
|
+
}
|
|
278
|
+
const _response = yield core.fetcher({
|
|
279
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, "admin/rules/list"),
|
|
280
|
+
method: "GET",
|
|
281
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
282
|
+
contentType: "application/json",
|
|
283
|
+
queryParameters: _queryParams,
|
|
284
|
+
requestType: "json",
|
|
285
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
286
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
287
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
288
|
+
});
|
|
289
|
+
if (_response.ok) {
|
|
290
|
+
return serializers.RuleListResponse.parseOrThrow(_response.body, {
|
|
291
|
+
unrecognizedObjectKeys: "passthrough",
|
|
292
|
+
allowUnrecognizedUnionMembers: true,
|
|
293
|
+
allowUnrecognizedEnumValues: true,
|
|
294
|
+
breadcrumbsPrefix: ["response"],
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
if (_response.error.reason === "status-code") {
|
|
298
|
+
switch (_response.error.statusCode) {
|
|
299
|
+
case 400:
|
|
300
|
+
throw new Rulebricks.BadRequestError(_response.error.body);
|
|
301
|
+
case 500:
|
|
302
|
+
throw new Rulebricks.InternalServerError(_response.error.body);
|
|
303
|
+
default:
|
|
304
|
+
throw new errors.RulebricksError({
|
|
305
|
+
statusCode: _response.error.statusCode,
|
|
306
|
+
body: _response.error.body,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
switch (_response.error.reason) {
|
|
311
|
+
case "non-json":
|
|
312
|
+
throw new errors.RulebricksError({
|
|
313
|
+
statusCode: _response.error.statusCode,
|
|
314
|
+
body: _response.error.rawBody,
|
|
315
|
+
});
|
|
316
|
+
case "timeout":
|
|
317
|
+
throw new errors.RulebricksTimeoutError("Timeout exceeded when calling GET /admin/rules/list.");
|
|
318
|
+
case "unknown":
|
|
319
|
+
throw new errors.RulebricksError({
|
|
320
|
+
message: _response.error.errorMessage,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
_getCustomAuthorizationHeaders() {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
328
|
+
return { "x-api-key": apiKeyValue };
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
exports.Rules = Rules;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests";
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client"), exports);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as environments from "../../../../environments";
|
|
4
5
|
import * as core from "../../../../core";
|
|
5
|
-
import * as
|
|
6
|
+
import * as Rulebricks from "../../../index";
|
|
6
7
|
export declare namespace Decisions {
|
|
7
8
|
interface Options {
|
|
8
|
-
environment
|
|
9
|
+
environment?: core.Supplier<environments.RulebricksEnvironment | string>;
|
|
9
10
|
/** Specify a custom URL to connect the client to. */
|
|
10
11
|
baseUrl?: core.Supplier<string>;
|
|
11
12
|
apiKey: core.Supplier<string>;
|
|
@@ -30,18 +31,18 @@ export declare class Decisions {
|
|
|
30
31
|
/**
|
|
31
32
|
* Retrieve logs for a specific user and rule, with optional date range and pagination.
|
|
32
33
|
*
|
|
33
|
-
* @param {
|
|
34
|
+
* @param {Rulebricks.DecisionsQueryRequest} request
|
|
34
35
|
* @param {Decisions.RequestOptions} requestOptions - Request-specific configuration.
|
|
35
36
|
*
|
|
36
|
-
* @throws {@link
|
|
37
|
-
* @throws {@link
|
|
37
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
38
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
38
39
|
*
|
|
39
40
|
* @example
|
|
40
41
|
* await client.decisions.query({
|
|
41
42
|
* slug: "slug"
|
|
42
43
|
* })
|
|
43
44
|
*/
|
|
44
|
-
query(request:
|
|
45
|
+
query(request: Rulebricks.DecisionsQueryRequest, requestOptions?: Decisions.RequestOptions): Promise<Rulebricks.DecisionLogResponse>;
|
|
45
46
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
46
47
|
"x-api-key": string;
|
|
47
48
|
}>;
|
|
@@ -39,8 +39,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Decisions = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../environments"));
|
|
42
43
|
const core = __importStar(require("../../../../core"));
|
|
43
|
-
const
|
|
44
|
+
const Rulebricks = __importStar(require("../../../index"));
|
|
44
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
45
46
|
const serializers = __importStar(require("../../../../serialization/index"));
|
|
46
47
|
const errors = __importStar(require("../../../../errors/index"));
|
|
@@ -54,11 +55,11 @@ class Decisions {
|
|
|
54
55
|
/**
|
|
55
56
|
* Retrieve logs for a specific user and rule, with optional date range and pagination.
|
|
56
57
|
*
|
|
57
|
-
* @param {
|
|
58
|
+
* @param {Rulebricks.DecisionsQueryRequest} request
|
|
58
59
|
* @param {Decisions.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
60
|
*
|
|
60
|
-
* @throws {@link
|
|
61
|
-
* @throws {@link
|
|
61
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
62
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
62
63
|
*
|
|
63
64
|
* @example
|
|
64
65
|
* await client.decisions.query({
|
|
@@ -66,7 +67,7 @@ class Decisions {
|
|
|
66
67
|
* })
|
|
67
68
|
*/
|
|
68
69
|
query(request, requestOptions) {
|
|
69
|
-
var _a;
|
|
70
|
+
var _a, _b;
|
|
70
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
72
|
const { slug, from: from_, to, cursor, limit } = request;
|
|
72
73
|
const _queryParams = {};
|
|
@@ -84,7 +85,7 @@ class Decisions {
|
|
|
84
85
|
_queryParams["limit"] = limit.toString();
|
|
85
86
|
}
|
|
86
87
|
const _response = yield core.fetcher({
|
|
87
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)), "
|
|
88
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, "decisions/query"),
|
|
88
89
|
method: "GET",
|
|
89
90
|
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
90
91
|
contentType: "application/json",
|
|
@@ -105,11 +106,11 @@ class Decisions {
|
|
|
105
106
|
if (_response.error.reason === "status-code") {
|
|
106
107
|
switch (_response.error.statusCode) {
|
|
107
108
|
case 400:
|
|
108
|
-
throw new
|
|
109
|
+
throw new Rulebricks.BadRequestError(_response.error.body);
|
|
109
110
|
case 500:
|
|
110
|
-
throw new
|
|
111
|
+
throw new Rulebricks.InternalServerError(_response.error.body);
|
|
111
112
|
default:
|
|
112
|
-
throw new errors.
|
|
113
|
+
throw new errors.RulebricksError({
|
|
113
114
|
statusCode: _response.error.statusCode,
|
|
114
115
|
body: _response.error.body,
|
|
115
116
|
});
|
|
@@ -117,14 +118,14 @@ class Decisions {
|
|
|
117
118
|
}
|
|
118
119
|
switch (_response.error.reason) {
|
|
119
120
|
case "non-json":
|
|
120
|
-
throw new errors.
|
|
121
|
+
throw new errors.RulebricksError({
|
|
121
122
|
statusCode: _response.error.statusCode,
|
|
122
123
|
body: _response.error.rawBody,
|
|
123
124
|
});
|
|
124
125
|
case "timeout":
|
|
125
|
-
throw new errors.
|
|
126
|
+
throw new errors.RulebricksTimeoutError("Timeout exceeded when calling GET /decisions/query.");
|
|
126
127
|
case "unknown":
|
|
127
|
-
throw new errors.
|
|
128
|
+
throw new errors.RulebricksError({
|
|
128
129
|
message: _response.error.errorMessage,
|
|
129
130
|
});
|
|
130
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type DecisionsQueryRequest } from "./DecisionsQueryRequest";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as environments from "../../../../environments";
|
|
4
5
|
import * as core from "../../../../core";
|
|
5
|
-
import * as
|
|
6
|
+
import * as Rulebricks from "../../../index";
|
|
6
7
|
export declare namespace Flows {
|
|
7
8
|
interface Options {
|
|
8
|
-
environment
|
|
9
|
+
environment?: core.Supplier<environments.RulebricksEnvironment | string>;
|
|
9
10
|
/** Specify a custom URL to connect the client to. */
|
|
10
11
|
baseUrl?: core.Supplier<string>;
|
|
11
12
|
apiKey: core.Supplier<string>;
|
|
@@ -31,11 +32,11 @@ export declare class Flows {
|
|
|
31
32
|
* Execute a flow by its slug.
|
|
32
33
|
*
|
|
33
34
|
* @param {string} slug - The unique identifier for the resource.
|
|
34
|
-
* @param {
|
|
35
|
+
* @param {Rulebricks.DynamicRequestPayload} request
|
|
35
36
|
* @param {Flows.RequestOptions} requestOptions - Request-specific configuration.
|
|
36
37
|
*
|
|
37
|
-
* @throws {@link
|
|
38
|
-
* @throws {@link
|
|
38
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
39
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
39
40
|
*
|
|
40
41
|
* @example
|
|
41
42
|
* await client.flows.execute("slug", {
|
|
@@ -44,7 +45,7 @@ export declare class Flows {
|
|
|
44
45
|
* "email": "jdoe@acme.co"
|
|
45
46
|
* })
|
|
46
47
|
*/
|
|
47
|
-
execute(slug: string, request:
|
|
48
|
+
execute(slug: string, request: Rulebricks.DynamicRequestPayload, requestOptions?: Flows.RequestOptions): Promise<Rulebricks.DynamicResponsePayload>;
|
|
48
49
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
49
50
|
"x-api-key": string;
|
|
50
51
|
}>;
|
|
@@ -39,8 +39,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Flows = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../environments"));
|
|
42
43
|
const core = __importStar(require("../../../../core"));
|
|
43
|
-
const
|
|
44
|
+
const Rulebricks = __importStar(require("../../../index"));
|
|
44
45
|
const serializers = __importStar(require("../../../../serialization/index"));
|
|
45
46
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
47
|
const errors = __importStar(require("../../../../errors/index"));
|
|
@@ -55,11 +56,11 @@ class Flows {
|
|
|
55
56
|
* Execute a flow by its slug.
|
|
56
57
|
*
|
|
57
58
|
* @param {string} slug - The unique identifier for the resource.
|
|
58
|
-
* @param {
|
|
59
|
+
* @param {Rulebricks.DynamicRequestPayload} request
|
|
59
60
|
* @param {Flows.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
61
|
*
|
|
61
|
-
* @throws {@link
|
|
62
|
-
* @throws {@link
|
|
62
|
+
* @throws {@link Rulebricks.BadRequestError}
|
|
63
|
+
* @throws {@link Rulebricks.InternalServerError}
|
|
63
64
|
*
|
|
64
65
|
* @example
|
|
65
66
|
* await client.flows.execute("slug", {
|
|
@@ -69,10 +70,10 @@ class Flows {
|
|
|
69
70
|
* })
|
|
70
71
|
*/
|
|
71
72
|
execute(slug, request, requestOptions) {
|
|
72
|
-
var _a;
|
|
73
|
+
var _a, _b;
|
|
73
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
75
|
const _response = yield core.fetcher({
|
|
75
|
-
url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment)), `
|
|
76
|
+
url: (0, url_join_1.default)((_b = (_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.RulebricksEnvironment.Default, `flows/${encodeURIComponent(slug)}`),
|
|
76
77
|
method: "POST",
|
|
77
78
|
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
78
79
|
contentType: "application/json",
|
|
@@ -93,11 +94,11 @@ class Flows {
|
|
|
93
94
|
if (_response.error.reason === "status-code") {
|
|
94
95
|
switch (_response.error.statusCode) {
|
|
95
96
|
case 400:
|
|
96
|
-
throw new
|
|
97
|
+
throw new Rulebricks.BadRequestError(_response.error.body);
|
|
97
98
|
case 500:
|
|
98
|
-
throw new
|
|
99
|
+
throw new Rulebricks.InternalServerError(_response.error.body);
|
|
99
100
|
default:
|
|
100
|
-
throw new errors.
|
|
101
|
+
throw new errors.RulebricksError({
|
|
101
102
|
statusCode: _response.error.statusCode,
|
|
102
103
|
body: _response.error.body,
|
|
103
104
|
});
|
|
@@ -105,14 +106,14 @@ class Flows {
|
|
|
105
106
|
}
|
|
106
107
|
switch (_response.error.reason) {
|
|
107
108
|
case "non-json":
|
|
108
|
-
throw new errors.
|
|
109
|
+
throw new errors.RulebricksError({
|
|
109
110
|
statusCode: _response.error.statusCode,
|
|
110
111
|
body: _response.error.rawBody,
|
|
111
112
|
});
|
|
112
113
|
case "timeout":
|
|
113
|
-
throw new errors.
|
|
114
|
+
throw new errors.RulebricksTimeoutError("Timeout exceeded when calling POST /flows/{slug}.");
|
|
114
115
|
case "unknown":
|
|
115
|
-
throw new errors.
|
|
116
|
+
throw new errors.RulebricksError({
|
|
116
117
|
message: _response.error.errorMessage,
|
|
117
118
|
});
|
|
118
119
|
}
|