@approvio/api 0.0.34 → 0.0.35
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/dist/src/index.cjs +7 -5
- package/dist/src/index.d.cts +26 -11
- package/dist/src/index.d.mts +26 -11
- package/dist/src/index.mjs +7 -5
- package/package.json +1 -1
package/dist/src/index.cjs
CHANGED
|
@@ -438,6 +438,11 @@ function getStringAsEnum(str, enumType) {
|
|
|
438
438
|
if (Object.values(enumType).includes(str)) return str;
|
|
439
439
|
}
|
|
440
440
|
//#endregion
|
|
441
|
+
//#region src/utils/types.ts
|
|
442
|
+
function prefixLeft(prefix, value) {
|
|
443
|
+
return `${prefix}_${value}`;
|
|
444
|
+
}
|
|
445
|
+
//#endregion
|
|
441
446
|
//#region src/validators/workflow-templates.validators.ts
|
|
442
447
|
function validateEmailAction(object) {
|
|
443
448
|
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
@@ -685,11 +690,8 @@ function validateWorkflowTemplateScope(object) {
|
|
|
685
690
|
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
686
691
|
if (!hasOwnProperty(object, "type") || object.type !== "workflow_template") return (0, fp_ts_Either.left)("invalid_type");
|
|
687
692
|
if (!hasOwnProperty(object, "workflowTemplateId") || !isNonEmptyString(object.workflowTemplateId)) return (0, fp_ts_Either.left)("invalid_workflow_template_id");
|
|
688
|
-
if (!hasOwnProperty(object, "type") || typeof object.type !== "string") return (0, fp_ts_Either.left)("invalid_type");
|
|
689
|
-
const type = getStringAsEnum(object.type, WorkflowTemplateScope.TypeEnum);
|
|
690
|
-
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
691
693
|
return (0, fp_ts_Either.right)({
|
|
692
|
-
type,
|
|
694
|
+
type: object.type,
|
|
693
695
|
workflowTemplateId: object.workflowTemplateId
|
|
694
696
|
});
|
|
695
697
|
}
|
|
@@ -719,7 +721,7 @@ function validateListWorkflowTemplates200Response(object) {
|
|
|
719
721
|
const data = [];
|
|
720
722
|
for (const item of object.data) {
|
|
721
723
|
const validatedItem = validateWorkflowTemplateSummary(item);
|
|
722
|
-
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("
|
|
724
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)(prefixLeft("data_item", validatedItem.left));
|
|
723
725
|
data.push(validatedItem.right);
|
|
724
726
|
}
|
|
725
727
|
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
package/dist/src/index.d.cts
CHANGED
|
@@ -1434,16 +1434,6 @@ declare function validateRoleRemovalRequest(object: unknown): Either<RoleOperati
|
|
|
1434
1434
|
type ListUsersParamsValidationError = "malformed_object" | "invalid_page" | "invalid_limit" | "invalid_search";
|
|
1435
1435
|
declare function validateListUsersParams(object: unknown): Either<ListUsersParamsValidationError, ListUsersParams>;
|
|
1436
1436
|
//#endregion
|
|
1437
|
-
//#region src/validators/workflow-templates.validators.d.ts
|
|
1438
|
-
type ValidationError = "malformed_object" | "invalid_type" | "invalid_recipients" | "invalid_recipients_element" | "invalid_url" | "invalid_method" | "invalid_headers" | "invalid_headers_element" | "invalid_workflow_action_type" | "invalid_group_id" | "invalid_min_count" | "invalid_require_high_privilege" | "invalid_rules" | "invalid_rules_element" | "invalid_approval_rule_type" | "invalid_id" | "invalid_name" | "invalid_version" | "invalid_status" | "invalid_allow_voting" | "missing_approval_rule" | "invalid_approval_rule" | "invalid_space_id" | "invalid_created_at" | "invalid_updated_at" | "invalid_description" | "invalid_metadata" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours" | "invalid_cancel_workflows" | "invalid_workflow_template_id" | "invalid_data" | "invalid_data_element" | "missing_pagination" | "invalid_pagination" | "invalid_page" | "invalid_limit" | "invalid_space_identifier" | "invalid_search";
|
|
1439
|
-
declare function validateWorkflowTemplate(object: unknown): Either<ValidationError, WorkflowTemplate>;
|
|
1440
|
-
declare function validateWorkflowTemplateCreate(object: unknown): Either<ValidationError, WorkflowTemplateCreate>;
|
|
1441
|
-
declare function validateWorkflowTemplateUpdate(object: unknown): Either<ValidationError, WorkflowTemplateUpdate>;
|
|
1442
|
-
declare function validateWorkflowTemplateDeprecate(object: unknown): Either<ValidationError, WorkflowTemplateDeprecate>;
|
|
1443
|
-
declare function validateWorkflowTemplateScope(object: unknown): Either<ValidationError, WorkflowTemplateScope>;
|
|
1444
|
-
declare function validateListWorkflowTemplates200Response(object: unknown): Either<ValidationError, ListWorkflowTemplates200Response>;
|
|
1445
|
-
declare function validateListWorkflowTemplatesParams(object: unknown): Either<ValidationError, ListWorkflowTemplatesParams>;
|
|
1446
|
-
//#endregion
|
|
1447
1437
|
//#region src/validators/common.validators.d.ts
|
|
1448
1438
|
type PaginationValidationError = "malformed_object" | "missing_total" | "invalid_total" | "missing_page" | "invalid_page" | "missing_limit" | "invalid_limit";
|
|
1449
1439
|
type ListParamsValidationError = "malformed_object" | "invalid_page" | "invalid_limit" | "invalid_search";
|
|
@@ -1460,6 +1450,31 @@ declare function validateHealthResponse(object: unknown): Either<HealthResponseV
|
|
|
1460
1450
|
type GetEntityInfo200ResponseValidationError = "malformed_object" | "missing_entity_type" | "invalid_entity_type" | "missing_groups" | "invalid_groups";
|
|
1461
1451
|
declare function validateGetEntityInfo200Response(object: unknown): Either<GetEntityInfo200ResponseValidationError, GetEntityInfo200Response>;
|
|
1462
1452
|
//#endregion
|
|
1453
|
+
//#region src/utils/types.d.ts
|
|
1454
|
+
/**
|
|
1455
|
+
* Create a union type with a prefix
|
|
1456
|
+
* @example
|
|
1457
|
+
* type MyUnion = PrefixUnion<"workflow", "name_empty" | "name_too_long"> // "workflow_name_empty" | "workflow_name_too_long"
|
|
1458
|
+
*/
|
|
1459
|
+
type PrefixUnion<TPrefix extends string, TUnion extends string> = `${TPrefix}_${TUnion}`;
|
|
1460
|
+
//#endregion
|
|
1461
|
+
//#region src/validators/workflow-templates.validators.d.ts
|
|
1462
|
+
type WorkflowTemplateValidationError = "malformed_object" | "invalid_id" | "invalid_name" | "invalid_version" | "invalid_status" | "invalid_allow_voting" | "missing_approval_rule" | "invalid_approval_rule" | "invalid_space_id" | "invalid_created_at" | "invalid_updated_at" | "invalid_description" | "invalid_metadata" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours";
|
|
1463
|
+
declare function validateWorkflowTemplate(object: unknown): Either<WorkflowTemplateValidationError, WorkflowTemplate>;
|
|
1464
|
+
type WorkflowTemplateCreateValidationError = "malformed_object" | "invalid_name" | "missing_approval_rule" | "invalid_approval_rule" | "invalid_space_id" | "invalid_description" | "invalid_metadata" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours";
|
|
1465
|
+
declare function validateWorkflowTemplateCreate(object: unknown): Either<WorkflowTemplateCreateValidationError, WorkflowTemplateCreate>;
|
|
1466
|
+
type WorkflowTemplateUpdateValidationError = "malformed_object" | "invalid_description" | "invalid_metadata" | "invalid_approval_rule" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours" | "invalid_cancel_workflows";
|
|
1467
|
+
declare function validateWorkflowTemplateUpdate(object: unknown): Either<WorkflowTemplateUpdateValidationError, WorkflowTemplateUpdate>;
|
|
1468
|
+
type WorkflowTemplateDeprecateValidationError = "malformed_object" | "invalid_cancel_workflows";
|
|
1469
|
+
declare function validateWorkflowTemplateDeprecate(object: unknown): Either<WorkflowTemplateDeprecateValidationError, WorkflowTemplateDeprecate>;
|
|
1470
|
+
type WorkflowTemplateScopeValidationError = "malformed_object" | "invalid_type" | "invalid_workflow_template_id";
|
|
1471
|
+
declare function validateWorkflowTemplateScope(object: unknown): Either<WorkflowTemplateScopeValidationError, WorkflowTemplateScope>;
|
|
1472
|
+
type WorkflowTemplateSummaryValidationError = "malformed_object" | "invalid_id" | "invalid_name" | "invalid_version" | "invalid_created_at" | "invalid_updated_at" | "invalid_description";
|
|
1473
|
+
type ListWorkflowTemplates200ResponseValidationError = "malformed_object" | "invalid_data" | "invalid_pagination" | "missing_pagination" | PrefixUnion<"data_item", WorkflowTemplateSummaryValidationError>;
|
|
1474
|
+
declare function validateListWorkflowTemplates200Response(object: unknown): Either<ListWorkflowTemplates200ResponseValidationError, ListWorkflowTemplates200Response>;
|
|
1475
|
+
type ListWorkflowTemplatesParamsValidationError = ListParamsValidationError | "invalid_space_identifier";
|
|
1476
|
+
declare function validateListWorkflowTemplatesParams(object: unknown): Either<ListWorkflowTemplatesParamsValidationError, ListWorkflowTemplatesParams>;
|
|
1477
|
+
//#endregion
|
|
1463
1478
|
//#region src/validators/spaces.validators.d.ts
|
|
1464
1479
|
type SpaceValidationError = "malformed_object" | "missing_id" | "invalid_id" | "missing_name" | "invalid_name" | "invalid_description" | "missing_created_at" | "invalid_created_at" | "missing_updated_at" | "invalid_updated_at";
|
|
1465
1480
|
type SpaceCreateValidationError = "malformed_object" | "missing_name" | "invalid_name" | "invalid_description";
|
|
@@ -1532,4 +1547,4 @@ type APIErrorValidationError = "malformed_object" | "missing_code" | "invalid_co
|
|
|
1532
1547
|
declare function validateAPIError(object: unknown): Either<APIErrorValidationError, APIError>;
|
|
1533
1548
|
declare function isAPIError(object: unknown): object is APIError;
|
|
1534
1549
|
//#endregion
|
|
1535
|
-
export { APIError, APIErrorDetailsInner, APIErrorDetailsInnerValidationError, APIErrorValidationError, AddGroupEntitiesRequest, AddGroupEntitiesRequestValidationError, AgentChallengeRequest, AgentChallengeRequestValidationError, AgentChallengeResponse, AgentChallengeResponseValidationError, AgentGet200Response, AgentGet200ResponseValidationError, AgentRegistrationRequest, AgentRegistrationRequestValidationError, AgentRegistrationResponse, AgentRegistrationResponseValidationError, AgentSummary, AgentSummaryValidationError, AgentTokenRequest, AgentTokenRequestValidationError, AgentTokenResponse, AgentTokenResponseValidationError, AndRule, ApprovalRule, CanVoteResponse, CanVoteResponseValidationError, EmailAction, EntityMembershipAdd, EntityMembershipAddValidationError, EntityMembershipRemove, EntityMembershipRemoveValidationError, EntityReference, EntityReferenceValidationError, GetEntityInfo200Response, GetEntityInfo200ResponseValidationError, GetWorkflowParams, GetWorkflowParamsValidationError, GetWorkflowVotes200Response, GetWorkflowVotes200ResponseValidationError, Group, GroupCreate, GroupCreateValidationError, GroupInfo, GroupInfoValidationError, GroupMembership, GroupMembershipValidationError, GroupRequirementRule, GroupScope, GroupScopeValidationError, GroupValidationError, HealthResponse, HealthResponseValidationError, InitiateCliLogin200Response, InitiateCliLogin200ResponseValidationError, InitiateCliLoginRequest, InitiateCliLoginRequestValidationError, ListAgents200Response, ListAgents200ResponseValidationError, ListAgentsParams, ListAgentsParamsValidationError, ListGroupEntities200Response, ListGroupEntities200ResponseValidationError, ListGroups200Response, ListGroups200ResponseValidationError, ListGroupsParams, ListGroupsParamsValidationError, ListOrganizationAdminsForOrg200Response, ListOrganizationAdminsForOrg200ResponseValidationError, ListParamsValidationError, ListRoleTemplates200Response, ListRoleTemplates200ResponseValidationError, ListSpaces200Response, ListSpaces200ResponseValidationError, ListSpacesParams, ListSpacesParamsValidationError, ListUsers200Response, ListUsers200ResponseValidationError, ListUsersParams, ListUsersParamsValidationError, ListWorkflowTemplates200Response, ListWorkflowTemplatesParams, ListWorkflows200Response, ListWorkflows200ResponseValidationError, ListWorkflowsParams, ListWorkflowsParamsValidationError, OidcCallbackRequest, OidcCallbackRequestValidationError, OrRule, OrgScope, OrganizationAdmin, OrganizationAdminCreate, OrganizationAdminCreateValidationError, OrganizationAdminRemove, OrganizationAdminRemoveValidationError, OrganizationAdminValidationError, Pagination, PaginationValidationError, PrivilegedTokenExchangeRequest, PrivilegedTokenExchangeRequestValidationError, PrivilegedTokenResponse, PrivilegedTokenResponseValidationError, RefreshTokenRequest, RefreshTokenRequestValidationError, RemoveGroupEntitiesRequest, RemoveGroupEntitiesRequestValidationError, RoleAssignmentRequest, RoleOperationItem, RoleOperationItemValidationError, RoleOperationRequest, RoleOperationRequestValidationError, RoleRemovalRequest, RoleScope, RoleScopeValidationError, RoleTemplate, RoleTemplateValidationError, Space, SpaceCreate, SpaceCreateValidationError, SpaceScope, SpaceScopeValidationError, SpaceValidationError, TokenRequest, TokenRequestValidationError, TokenResponse, TokenResponseValidationError, User, UserCreate, UserCreateValidationError, UserSummary, UserSummaryValidationError, UserValidationError, ValidatedListParams,
|
|
1550
|
+
export { APIError, APIErrorDetailsInner, APIErrorDetailsInnerValidationError, APIErrorValidationError, AddGroupEntitiesRequest, AddGroupEntitiesRequestValidationError, AgentChallengeRequest, AgentChallengeRequestValidationError, AgentChallengeResponse, AgentChallengeResponseValidationError, AgentGet200Response, AgentGet200ResponseValidationError, AgentRegistrationRequest, AgentRegistrationRequestValidationError, AgentRegistrationResponse, AgentRegistrationResponseValidationError, AgentSummary, AgentSummaryValidationError, AgentTokenRequest, AgentTokenRequestValidationError, AgentTokenResponse, AgentTokenResponseValidationError, AndRule, ApprovalRule, CanVoteResponse, CanVoteResponseValidationError, EmailAction, EntityMembershipAdd, EntityMembershipAddValidationError, EntityMembershipRemove, EntityMembershipRemoveValidationError, EntityReference, EntityReferenceValidationError, GetEntityInfo200Response, GetEntityInfo200ResponseValidationError, GetWorkflowParams, GetWorkflowParamsValidationError, GetWorkflowVotes200Response, GetWorkflowVotes200ResponseValidationError, Group, GroupCreate, GroupCreateValidationError, GroupInfo, GroupInfoValidationError, GroupMembership, GroupMembershipValidationError, GroupRequirementRule, GroupScope, GroupScopeValidationError, GroupValidationError, HealthResponse, HealthResponseValidationError, InitiateCliLogin200Response, InitiateCliLogin200ResponseValidationError, InitiateCliLoginRequest, InitiateCliLoginRequestValidationError, ListAgents200Response, ListAgents200ResponseValidationError, ListAgentsParams, ListAgentsParamsValidationError, ListGroupEntities200Response, ListGroupEntities200ResponseValidationError, ListGroups200Response, ListGroups200ResponseValidationError, ListGroupsParams, ListGroupsParamsValidationError, ListOrganizationAdminsForOrg200Response, ListOrganizationAdminsForOrg200ResponseValidationError, ListParamsValidationError, ListRoleTemplates200Response, ListRoleTemplates200ResponseValidationError, ListSpaces200Response, ListSpaces200ResponseValidationError, ListSpacesParams, ListSpacesParamsValidationError, ListUsers200Response, ListUsers200ResponseValidationError, ListUsersParams, ListUsersParamsValidationError, ListWorkflowTemplates200Response, ListWorkflowTemplates200ResponseValidationError, ListWorkflowTemplatesParams, ListWorkflowTemplatesParamsValidationError, ListWorkflows200Response, ListWorkflows200ResponseValidationError, ListWorkflowsParams, ListWorkflowsParamsValidationError, OidcCallbackRequest, OidcCallbackRequestValidationError, OrRule, OrgScope, OrganizationAdmin, OrganizationAdminCreate, OrganizationAdminCreateValidationError, OrganizationAdminRemove, OrganizationAdminRemoveValidationError, OrganizationAdminValidationError, Pagination, PaginationValidationError, PrivilegedTokenExchangeRequest, PrivilegedTokenExchangeRequestValidationError, PrivilegedTokenResponse, PrivilegedTokenResponseValidationError, RefreshTokenRequest, RefreshTokenRequestValidationError, RemoveGroupEntitiesRequest, RemoveGroupEntitiesRequestValidationError, RoleAssignmentRequest, RoleOperationItem, RoleOperationItemValidationError, RoleOperationRequest, RoleOperationRequestValidationError, RoleRemovalRequest, RoleScope, RoleScopeValidationError, RoleTemplate, RoleTemplateValidationError, Space, SpaceCreate, SpaceCreateValidationError, SpaceScope, SpaceScopeValidationError, SpaceValidationError, TokenRequest, TokenRequestValidationError, TokenResponse, TokenResponseValidationError, User, UserCreate, UserCreateValidationError, UserSummary, UserSummaryValidationError, UserValidationError, ValidatedListParams, VoteApprove, VoteApproveValidationError, VoteVeto, VoteVetoValidationError, VoteWithdraw, VoteWithdrawValidationError, WebhookAction, Workflow, WorkflowAction, WorkflowCreate, WorkflowCreateValidationError, WorkflowRef, WorkflowRefValidationError, WorkflowTemplate, WorkflowTemplateCreate, WorkflowTemplateCreateValidationError, WorkflowTemplateDeprecate, WorkflowTemplateDeprecateValidationError, WorkflowTemplateScope, WorkflowTemplateScopeValidationError, WorkflowTemplateSummary, WorkflowTemplateUpdate, WorkflowTemplateUpdateValidationError, WorkflowTemplateValidationError, WorkflowValidationError, WorkflowVote, WorkflowVoteRequest, WorkflowVoteRequestValidationError, WorkflowVoteRequestVoteType, WorkflowVoteRequestVoteTypeValidationError, WorkflowVoteValidationError, isAPIError, validateAPIError, validateAddGroupEntitiesRequest, validateAgentChallengeRequest, validateAgentChallengeResponse, validateAgentGet200Response, validateAgentRegistrationRequest, validateAgentRegistrationResponse, validateAgentTokenRequest, validateAgentTokenResponse, validateCanVoteResponse, validateGetEntityInfo200Response, validateGetWorkflowParams, validateGetWorkflowVotes200Response, validateGroupCreate, validateGroupInfo, validateGroupScope, validateHealthResponse, validateInitiateCliLogin200Response, validateInitiateCliLoginRequest, validateListAgents200Response, validateListAgentsParams, validateListGroupEntities200Response, validateListGroups200Response, validateListGroupsParams, validateListOrganizationAdminsForOrg200Response, validateListRoleTemplates200Response, validateListSpaces200Response, validateListSpacesParams, validateListUsers200Response, validateListUsersParams, validateListWorkflowTemplates200Response, validateListWorkflowTemplatesParams, validateListWorkflows200Response, validateListWorkflowsParams, validateOidcCallbackRequest, validateOrganizationAdminCreate, validateOrganizationAdminRemove, validatePagination, validatePrivilegedTokenExchangeRequest, validatePrivilegedTokenResponse, validateRefreshTokenRequest, validateRemoveGroupEntitiesRequest, validateRoleAssignmentRequest, validateRoleRemovalRequest, validateSharedListParams, validateSpaceCreate, validateSpaceScope, validateTokenRequest, validateTokenResponse, validateUser, validateUserCreate, validateWorkflowCreate, validateWorkflowTemplate, validateWorkflowTemplateCreate, validateWorkflowTemplateDeprecate, validateWorkflowTemplateScope, validateWorkflowTemplateUpdate, validateWorkflowVoteRequest };
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1434,16 +1434,6 @@ declare function validateRoleRemovalRequest(object: unknown): Either<RoleOperati
|
|
|
1434
1434
|
type ListUsersParamsValidationError = "malformed_object" | "invalid_page" | "invalid_limit" | "invalid_search";
|
|
1435
1435
|
declare function validateListUsersParams(object: unknown): Either<ListUsersParamsValidationError, ListUsersParams>;
|
|
1436
1436
|
//#endregion
|
|
1437
|
-
//#region src/validators/workflow-templates.validators.d.ts
|
|
1438
|
-
type ValidationError = "malformed_object" | "invalid_type" | "invalid_recipients" | "invalid_recipients_element" | "invalid_url" | "invalid_method" | "invalid_headers" | "invalid_headers_element" | "invalid_workflow_action_type" | "invalid_group_id" | "invalid_min_count" | "invalid_require_high_privilege" | "invalid_rules" | "invalid_rules_element" | "invalid_approval_rule_type" | "invalid_id" | "invalid_name" | "invalid_version" | "invalid_status" | "invalid_allow_voting" | "missing_approval_rule" | "invalid_approval_rule" | "invalid_space_id" | "invalid_created_at" | "invalid_updated_at" | "invalid_description" | "invalid_metadata" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours" | "invalid_cancel_workflows" | "invalid_workflow_template_id" | "invalid_data" | "invalid_data_element" | "missing_pagination" | "invalid_pagination" | "invalid_page" | "invalid_limit" | "invalid_space_identifier" | "invalid_search";
|
|
1439
|
-
declare function validateWorkflowTemplate(object: unknown): Either<ValidationError, WorkflowTemplate>;
|
|
1440
|
-
declare function validateWorkflowTemplateCreate(object: unknown): Either<ValidationError, WorkflowTemplateCreate>;
|
|
1441
|
-
declare function validateWorkflowTemplateUpdate(object: unknown): Either<ValidationError, WorkflowTemplateUpdate>;
|
|
1442
|
-
declare function validateWorkflowTemplateDeprecate(object: unknown): Either<ValidationError, WorkflowTemplateDeprecate>;
|
|
1443
|
-
declare function validateWorkflowTemplateScope(object: unknown): Either<ValidationError, WorkflowTemplateScope>;
|
|
1444
|
-
declare function validateListWorkflowTemplates200Response(object: unknown): Either<ValidationError, ListWorkflowTemplates200Response>;
|
|
1445
|
-
declare function validateListWorkflowTemplatesParams(object: unknown): Either<ValidationError, ListWorkflowTemplatesParams>;
|
|
1446
|
-
//#endregion
|
|
1447
1437
|
//#region src/validators/common.validators.d.ts
|
|
1448
1438
|
type PaginationValidationError = "malformed_object" | "missing_total" | "invalid_total" | "missing_page" | "invalid_page" | "missing_limit" | "invalid_limit";
|
|
1449
1439
|
type ListParamsValidationError = "malformed_object" | "invalid_page" | "invalid_limit" | "invalid_search";
|
|
@@ -1460,6 +1450,31 @@ declare function validateHealthResponse(object: unknown): Either<HealthResponseV
|
|
|
1460
1450
|
type GetEntityInfo200ResponseValidationError = "malformed_object" | "missing_entity_type" | "invalid_entity_type" | "missing_groups" | "invalid_groups";
|
|
1461
1451
|
declare function validateGetEntityInfo200Response(object: unknown): Either<GetEntityInfo200ResponseValidationError, GetEntityInfo200Response>;
|
|
1462
1452
|
//#endregion
|
|
1453
|
+
//#region src/utils/types.d.ts
|
|
1454
|
+
/**
|
|
1455
|
+
* Create a union type with a prefix
|
|
1456
|
+
* @example
|
|
1457
|
+
* type MyUnion = PrefixUnion<"workflow", "name_empty" | "name_too_long"> // "workflow_name_empty" | "workflow_name_too_long"
|
|
1458
|
+
*/
|
|
1459
|
+
type PrefixUnion<TPrefix extends string, TUnion extends string> = `${TPrefix}_${TUnion}`;
|
|
1460
|
+
//#endregion
|
|
1461
|
+
//#region src/validators/workflow-templates.validators.d.ts
|
|
1462
|
+
type WorkflowTemplateValidationError = "malformed_object" | "invalid_id" | "invalid_name" | "invalid_version" | "invalid_status" | "invalid_allow_voting" | "missing_approval_rule" | "invalid_approval_rule" | "invalid_space_id" | "invalid_created_at" | "invalid_updated_at" | "invalid_description" | "invalid_metadata" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours";
|
|
1463
|
+
declare function validateWorkflowTemplate(object: unknown): Either<WorkflowTemplateValidationError, WorkflowTemplate>;
|
|
1464
|
+
type WorkflowTemplateCreateValidationError = "malformed_object" | "invalid_name" | "missing_approval_rule" | "invalid_approval_rule" | "invalid_space_id" | "invalid_description" | "invalid_metadata" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours";
|
|
1465
|
+
declare function validateWorkflowTemplateCreate(object: unknown): Either<WorkflowTemplateCreateValidationError, WorkflowTemplateCreate>;
|
|
1466
|
+
type WorkflowTemplateUpdateValidationError = "malformed_object" | "invalid_description" | "invalid_metadata" | "invalid_approval_rule" | "invalid_actions" | "invalid_actions_element" | "invalid_default_expires_in_hours" | "invalid_cancel_workflows";
|
|
1467
|
+
declare function validateWorkflowTemplateUpdate(object: unknown): Either<WorkflowTemplateUpdateValidationError, WorkflowTemplateUpdate>;
|
|
1468
|
+
type WorkflowTemplateDeprecateValidationError = "malformed_object" | "invalid_cancel_workflows";
|
|
1469
|
+
declare function validateWorkflowTemplateDeprecate(object: unknown): Either<WorkflowTemplateDeprecateValidationError, WorkflowTemplateDeprecate>;
|
|
1470
|
+
type WorkflowTemplateScopeValidationError = "malformed_object" | "invalid_type" | "invalid_workflow_template_id";
|
|
1471
|
+
declare function validateWorkflowTemplateScope(object: unknown): Either<WorkflowTemplateScopeValidationError, WorkflowTemplateScope>;
|
|
1472
|
+
type WorkflowTemplateSummaryValidationError = "malformed_object" | "invalid_id" | "invalid_name" | "invalid_version" | "invalid_created_at" | "invalid_updated_at" | "invalid_description";
|
|
1473
|
+
type ListWorkflowTemplates200ResponseValidationError = "malformed_object" | "invalid_data" | "invalid_pagination" | "missing_pagination" | PrefixUnion<"data_item", WorkflowTemplateSummaryValidationError>;
|
|
1474
|
+
declare function validateListWorkflowTemplates200Response(object: unknown): Either<ListWorkflowTemplates200ResponseValidationError, ListWorkflowTemplates200Response>;
|
|
1475
|
+
type ListWorkflowTemplatesParamsValidationError = ListParamsValidationError | "invalid_space_identifier";
|
|
1476
|
+
declare function validateListWorkflowTemplatesParams(object: unknown): Either<ListWorkflowTemplatesParamsValidationError, ListWorkflowTemplatesParams>;
|
|
1477
|
+
//#endregion
|
|
1463
1478
|
//#region src/validators/spaces.validators.d.ts
|
|
1464
1479
|
type SpaceValidationError = "malformed_object" | "missing_id" | "invalid_id" | "missing_name" | "invalid_name" | "invalid_description" | "missing_created_at" | "invalid_created_at" | "missing_updated_at" | "invalid_updated_at";
|
|
1465
1480
|
type SpaceCreateValidationError = "malformed_object" | "missing_name" | "invalid_name" | "invalid_description";
|
|
@@ -1532,4 +1547,4 @@ type APIErrorValidationError = "malformed_object" | "missing_code" | "invalid_co
|
|
|
1532
1547
|
declare function validateAPIError(object: unknown): Either<APIErrorValidationError, APIError>;
|
|
1533
1548
|
declare function isAPIError(object: unknown): object is APIError;
|
|
1534
1549
|
//#endregion
|
|
1535
|
-
export { APIError, APIErrorDetailsInner, APIErrorDetailsInnerValidationError, APIErrorValidationError, AddGroupEntitiesRequest, AddGroupEntitiesRequestValidationError, AgentChallengeRequest, AgentChallengeRequestValidationError, AgentChallengeResponse, AgentChallengeResponseValidationError, AgentGet200Response, AgentGet200ResponseValidationError, AgentRegistrationRequest, AgentRegistrationRequestValidationError, AgentRegistrationResponse, AgentRegistrationResponseValidationError, AgentSummary, AgentSummaryValidationError, AgentTokenRequest, AgentTokenRequestValidationError, AgentTokenResponse, AgentTokenResponseValidationError, AndRule, ApprovalRule, CanVoteResponse, CanVoteResponseValidationError, EmailAction, EntityMembershipAdd, EntityMembershipAddValidationError, EntityMembershipRemove, EntityMembershipRemoveValidationError, EntityReference, EntityReferenceValidationError, GetEntityInfo200Response, GetEntityInfo200ResponseValidationError, GetWorkflowParams, GetWorkflowParamsValidationError, GetWorkflowVotes200Response, GetWorkflowVotes200ResponseValidationError, Group, GroupCreate, GroupCreateValidationError, GroupInfo, GroupInfoValidationError, GroupMembership, GroupMembershipValidationError, GroupRequirementRule, GroupScope, GroupScopeValidationError, GroupValidationError, HealthResponse, HealthResponseValidationError, InitiateCliLogin200Response, InitiateCliLogin200ResponseValidationError, InitiateCliLoginRequest, InitiateCliLoginRequestValidationError, ListAgents200Response, ListAgents200ResponseValidationError, ListAgentsParams, ListAgentsParamsValidationError, ListGroupEntities200Response, ListGroupEntities200ResponseValidationError, ListGroups200Response, ListGroups200ResponseValidationError, ListGroupsParams, ListGroupsParamsValidationError, ListOrganizationAdminsForOrg200Response, ListOrganizationAdminsForOrg200ResponseValidationError, ListParamsValidationError, ListRoleTemplates200Response, ListRoleTemplates200ResponseValidationError, ListSpaces200Response, ListSpaces200ResponseValidationError, ListSpacesParams, ListSpacesParamsValidationError, ListUsers200Response, ListUsers200ResponseValidationError, ListUsersParams, ListUsersParamsValidationError, ListWorkflowTemplates200Response, ListWorkflowTemplatesParams, ListWorkflows200Response, ListWorkflows200ResponseValidationError, ListWorkflowsParams, ListWorkflowsParamsValidationError, OidcCallbackRequest, OidcCallbackRequestValidationError, OrRule, OrgScope, OrganizationAdmin, OrganizationAdminCreate, OrganizationAdminCreateValidationError, OrganizationAdminRemove, OrganizationAdminRemoveValidationError, OrganizationAdminValidationError, Pagination, PaginationValidationError, PrivilegedTokenExchangeRequest, PrivilegedTokenExchangeRequestValidationError, PrivilegedTokenResponse, PrivilegedTokenResponseValidationError, RefreshTokenRequest, RefreshTokenRequestValidationError, RemoveGroupEntitiesRequest, RemoveGroupEntitiesRequestValidationError, RoleAssignmentRequest, RoleOperationItem, RoleOperationItemValidationError, RoleOperationRequest, RoleOperationRequestValidationError, RoleRemovalRequest, RoleScope, RoleScopeValidationError, RoleTemplate, RoleTemplateValidationError, Space, SpaceCreate, SpaceCreateValidationError, SpaceScope, SpaceScopeValidationError, SpaceValidationError, TokenRequest, TokenRequestValidationError, TokenResponse, TokenResponseValidationError, User, UserCreate, UserCreateValidationError, UserSummary, UserSummaryValidationError, UserValidationError, ValidatedListParams,
|
|
1550
|
+
export { APIError, APIErrorDetailsInner, APIErrorDetailsInnerValidationError, APIErrorValidationError, AddGroupEntitiesRequest, AddGroupEntitiesRequestValidationError, AgentChallengeRequest, AgentChallengeRequestValidationError, AgentChallengeResponse, AgentChallengeResponseValidationError, AgentGet200Response, AgentGet200ResponseValidationError, AgentRegistrationRequest, AgentRegistrationRequestValidationError, AgentRegistrationResponse, AgentRegistrationResponseValidationError, AgentSummary, AgentSummaryValidationError, AgentTokenRequest, AgentTokenRequestValidationError, AgentTokenResponse, AgentTokenResponseValidationError, AndRule, ApprovalRule, CanVoteResponse, CanVoteResponseValidationError, EmailAction, EntityMembershipAdd, EntityMembershipAddValidationError, EntityMembershipRemove, EntityMembershipRemoveValidationError, EntityReference, EntityReferenceValidationError, GetEntityInfo200Response, GetEntityInfo200ResponseValidationError, GetWorkflowParams, GetWorkflowParamsValidationError, GetWorkflowVotes200Response, GetWorkflowVotes200ResponseValidationError, Group, GroupCreate, GroupCreateValidationError, GroupInfo, GroupInfoValidationError, GroupMembership, GroupMembershipValidationError, GroupRequirementRule, GroupScope, GroupScopeValidationError, GroupValidationError, HealthResponse, HealthResponseValidationError, InitiateCliLogin200Response, InitiateCliLogin200ResponseValidationError, InitiateCliLoginRequest, InitiateCliLoginRequestValidationError, ListAgents200Response, ListAgents200ResponseValidationError, ListAgentsParams, ListAgentsParamsValidationError, ListGroupEntities200Response, ListGroupEntities200ResponseValidationError, ListGroups200Response, ListGroups200ResponseValidationError, ListGroupsParams, ListGroupsParamsValidationError, ListOrganizationAdminsForOrg200Response, ListOrganizationAdminsForOrg200ResponseValidationError, ListParamsValidationError, ListRoleTemplates200Response, ListRoleTemplates200ResponseValidationError, ListSpaces200Response, ListSpaces200ResponseValidationError, ListSpacesParams, ListSpacesParamsValidationError, ListUsers200Response, ListUsers200ResponseValidationError, ListUsersParams, ListUsersParamsValidationError, ListWorkflowTemplates200Response, ListWorkflowTemplates200ResponseValidationError, ListWorkflowTemplatesParams, ListWorkflowTemplatesParamsValidationError, ListWorkflows200Response, ListWorkflows200ResponseValidationError, ListWorkflowsParams, ListWorkflowsParamsValidationError, OidcCallbackRequest, OidcCallbackRequestValidationError, OrRule, OrgScope, OrganizationAdmin, OrganizationAdminCreate, OrganizationAdminCreateValidationError, OrganizationAdminRemove, OrganizationAdminRemoveValidationError, OrganizationAdminValidationError, Pagination, PaginationValidationError, PrivilegedTokenExchangeRequest, PrivilegedTokenExchangeRequestValidationError, PrivilegedTokenResponse, PrivilegedTokenResponseValidationError, RefreshTokenRequest, RefreshTokenRequestValidationError, RemoveGroupEntitiesRequest, RemoveGroupEntitiesRequestValidationError, RoleAssignmentRequest, RoleOperationItem, RoleOperationItemValidationError, RoleOperationRequest, RoleOperationRequestValidationError, RoleRemovalRequest, RoleScope, RoleScopeValidationError, RoleTemplate, RoleTemplateValidationError, Space, SpaceCreate, SpaceCreateValidationError, SpaceScope, SpaceScopeValidationError, SpaceValidationError, TokenRequest, TokenRequestValidationError, TokenResponse, TokenResponseValidationError, User, UserCreate, UserCreateValidationError, UserSummary, UserSummaryValidationError, UserValidationError, ValidatedListParams, VoteApprove, VoteApproveValidationError, VoteVeto, VoteVetoValidationError, VoteWithdraw, VoteWithdrawValidationError, WebhookAction, Workflow, WorkflowAction, WorkflowCreate, WorkflowCreateValidationError, WorkflowRef, WorkflowRefValidationError, WorkflowTemplate, WorkflowTemplateCreate, WorkflowTemplateCreateValidationError, WorkflowTemplateDeprecate, WorkflowTemplateDeprecateValidationError, WorkflowTemplateScope, WorkflowTemplateScopeValidationError, WorkflowTemplateSummary, WorkflowTemplateUpdate, WorkflowTemplateUpdateValidationError, WorkflowTemplateValidationError, WorkflowValidationError, WorkflowVote, WorkflowVoteRequest, WorkflowVoteRequestValidationError, WorkflowVoteRequestVoteType, WorkflowVoteRequestVoteTypeValidationError, WorkflowVoteValidationError, isAPIError, validateAPIError, validateAddGroupEntitiesRequest, validateAgentChallengeRequest, validateAgentChallengeResponse, validateAgentGet200Response, validateAgentRegistrationRequest, validateAgentRegistrationResponse, validateAgentTokenRequest, validateAgentTokenResponse, validateCanVoteResponse, validateGetEntityInfo200Response, validateGetWorkflowParams, validateGetWorkflowVotes200Response, validateGroupCreate, validateGroupInfo, validateGroupScope, validateHealthResponse, validateInitiateCliLogin200Response, validateInitiateCliLoginRequest, validateListAgents200Response, validateListAgentsParams, validateListGroupEntities200Response, validateListGroups200Response, validateListGroupsParams, validateListOrganizationAdminsForOrg200Response, validateListRoleTemplates200Response, validateListSpaces200Response, validateListSpacesParams, validateListUsers200Response, validateListUsersParams, validateListWorkflowTemplates200Response, validateListWorkflowTemplatesParams, validateListWorkflows200Response, validateListWorkflowsParams, validateOidcCallbackRequest, validateOrganizationAdminCreate, validateOrganizationAdminRemove, validatePagination, validatePrivilegedTokenExchangeRequest, validatePrivilegedTokenResponse, validateRefreshTokenRequest, validateRemoveGroupEntitiesRequest, validateRoleAssignmentRequest, validateRoleRemovalRequest, validateSharedListParams, validateSpaceCreate, validateSpaceScope, validateTokenRequest, validateTokenResponse, validateUser, validateUserCreate, validateWorkflowCreate, validateWorkflowTemplate, validateWorkflowTemplateCreate, validateWorkflowTemplateDeprecate, validateWorkflowTemplateScope, validateWorkflowTemplateUpdate, validateWorkflowVoteRequest };
|
package/dist/src/index.mjs
CHANGED
|
@@ -414,6 +414,11 @@ function getStringAsEnum(str, enumType) {
|
|
|
414
414
|
if (Object.values(enumType).includes(str)) return str;
|
|
415
415
|
}
|
|
416
416
|
//#endregion
|
|
417
|
+
//#region src/utils/types.ts
|
|
418
|
+
function prefixLeft(prefix, value) {
|
|
419
|
+
return `${prefix}_${value}`;
|
|
420
|
+
}
|
|
421
|
+
//#endregion
|
|
417
422
|
//#region src/validators/workflow-templates.validators.ts
|
|
418
423
|
function validateEmailAction(object) {
|
|
419
424
|
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
@@ -661,11 +666,8 @@ function validateWorkflowTemplateScope(object) {
|
|
|
661
666
|
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
662
667
|
if (!hasOwnProperty(object, "type") || object.type !== "workflow_template") return left("invalid_type");
|
|
663
668
|
if (!hasOwnProperty(object, "workflowTemplateId") || !isNonEmptyString(object.workflowTemplateId)) return left("invalid_workflow_template_id");
|
|
664
|
-
if (!hasOwnProperty(object, "type") || typeof object.type !== "string") return left("invalid_type");
|
|
665
|
-
const type = getStringAsEnum(object.type, WorkflowTemplateScope.TypeEnum);
|
|
666
|
-
if (!type) return left("invalid_type");
|
|
667
669
|
return right({
|
|
668
|
-
type,
|
|
670
|
+
type: object.type,
|
|
669
671
|
workflowTemplateId: object.workflowTemplateId
|
|
670
672
|
});
|
|
671
673
|
}
|
|
@@ -695,7 +697,7 @@ function validateListWorkflowTemplates200Response(object) {
|
|
|
695
697
|
const data = [];
|
|
696
698
|
for (const item of object.data) {
|
|
697
699
|
const validatedItem = validateWorkflowTemplateSummary(item);
|
|
698
|
-
if (isLeft(validatedItem)) return left("
|
|
700
|
+
if (isLeft(validatedItem)) return left(prefixLeft("data_item", validatedItem.left));
|
|
699
701
|
data.push(validatedItem.right);
|
|
700
702
|
}
|
|
701
703
|
if (!hasOwnProperty(object, "pagination")) return left("missing_pagination");
|