@approvio/api 0.0.46 → 0.0.47
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/README.md +11 -10
- package/dist/mocks/index.cjs +46 -23
- package/dist/mocks/index.d.cts +3 -2
- package/dist/mocks/index.d.mts +3 -2
- package/dist/mocks/index.mjs +46 -24
- package/dist/src/index.cjs +275 -194
- package/dist/src/index.d.cts +124 -215
- package/dist/src/index.d.mts +124 -215
- package/dist/src/index.mjs +262 -195
- package/dist/{workflow-create-CC-JYERf.d.mts → workflow-create-CHJBdnEj.d.cts} +162 -23
- package/dist/{workflow-create-i3n3vy4V.d.cts → workflow-create-DBQ7ekaO.d.mts} +162 -23
- package/package.json +9 -8
package/dist/src/index.cjs
CHANGED
|
@@ -45,6 +45,22 @@ let EmailAction;
|
|
|
45
45
|
_EmailAction.TypeEnum = { Email: "EMAIL" };
|
|
46
46
|
})(EmailAction || (EmailAction = {}));
|
|
47
47
|
//#endregion
|
|
48
|
+
//#region generated/openapi/model/get-entity-info-agent-response.ts
|
|
49
|
+
let GetEntityInfoAgentResponse;
|
|
50
|
+
(function(_GetEntityInfoAgentResponse) {
|
|
51
|
+
_GetEntityInfoAgentResponse.EntityTypeEnum = { Agent: "agent" };
|
|
52
|
+
})(GetEntityInfoAgentResponse || (GetEntityInfoAgentResponse = {}));
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region generated/openapi/model/get-entity-info-user-response.ts
|
|
55
|
+
let GetEntityInfoUserResponse;
|
|
56
|
+
(function(_GetEntityInfoUserResponse) {
|
|
57
|
+
_GetEntityInfoUserResponse.EntityTypeEnum = { User: "user" };
|
|
58
|
+
_GetEntityInfoUserResponse.OrgRoleEnum = {
|
|
59
|
+
Admin: "admin",
|
|
60
|
+
Member: "member"
|
|
61
|
+
};
|
|
62
|
+
})(GetEntityInfoUserResponse || (GetEntityInfoUserResponse = {}));
|
|
63
|
+
//#endregion
|
|
48
64
|
//#region generated/openapi/model/group-quota.ts
|
|
49
65
|
let GroupQuota;
|
|
50
66
|
(function(_GroupQuota) {
|
|
@@ -581,74 +597,6 @@ function validateListGroupEntities200Response(object) {
|
|
|
581
597
|
});
|
|
582
598
|
}
|
|
583
599
|
//#endregion
|
|
584
|
-
//#region src/validators/common.validators.ts
|
|
585
|
-
function validateSharedListParams(object) {
|
|
586
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
587
|
-
const result = {};
|
|
588
|
-
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
589
|
-
let page = object.page;
|
|
590
|
-
if (typeof page === "string" && page.trim() !== "") {
|
|
591
|
-
const parsed = Number(page);
|
|
592
|
-
if (!isNaN(parsed)) page = parsed;
|
|
593
|
-
}
|
|
594
|
-
if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return (0, fp_ts_Either.left)("invalid_page");
|
|
595
|
-
result.page = page;
|
|
596
|
-
}
|
|
597
|
-
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
598
|
-
let limit = object.limit;
|
|
599
|
-
if (typeof limit === "string" && limit.trim() !== "") {
|
|
600
|
-
const parsed = Number(limit);
|
|
601
|
-
if (!isNaN(parsed)) limit = parsed;
|
|
602
|
-
}
|
|
603
|
-
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
604
|
-
result.limit = limit;
|
|
605
|
-
}
|
|
606
|
-
if (hasOwnProperty(object, "search") && object.search !== void 0) {
|
|
607
|
-
if (typeof object.search !== "string") return (0, fp_ts_Either.left)("invalid_search");
|
|
608
|
-
result.search = object.search;
|
|
609
|
-
}
|
|
610
|
-
return (0, fp_ts_Either.right)(result);
|
|
611
|
-
}
|
|
612
|
-
function validatePagination(object) {
|
|
613
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
614
|
-
if (!hasOwnProperty(object, "total")) return (0, fp_ts_Either.left)("missing_total");
|
|
615
|
-
if (!isNumber(object.total) || object.total < 0) return (0, fp_ts_Either.left)("invalid_total");
|
|
616
|
-
if (!hasOwnProperty(object, "page")) return (0, fp_ts_Either.left)("missing_page");
|
|
617
|
-
if (!isNumber(object.page) || object.page < 0) return (0, fp_ts_Either.left)("invalid_page");
|
|
618
|
-
if (!hasOwnProperty(object, "limit")) return (0, fp_ts_Either.left)("missing_limit");
|
|
619
|
-
if (!isNumber(object.limit) || object.limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
620
|
-
return (0, fp_ts_Either.right)({
|
|
621
|
-
total: object.total,
|
|
622
|
-
page: object.page,
|
|
623
|
-
limit: object.limit
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
function validateHealthResponse(object) {
|
|
627
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
628
|
-
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
629
|
-
const result = { status: object.status };
|
|
630
|
-
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
631
|
-
if (typeof object.message !== "string") return (0, fp_ts_Either.left)("invalid_message");
|
|
632
|
-
result.message = object.message;
|
|
633
|
-
}
|
|
634
|
-
return (0, fp_ts_Either.right)(result);
|
|
635
|
-
}
|
|
636
|
-
function validateGetEntityInfo200Response(object) {
|
|
637
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
638
|
-
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
639
|
-
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
640
|
-
const groups = [];
|
|
641
|
-
for (const item of object.groups) {
|
|
642
|
-
const validatedItem = validateGroupInfo(item);
|
|
643
|
-
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
644
|
-
groups.push(validatedItem.right);
|
|
645
|
-
}
|
|
646
|
-
return (0, fp_ts_Either.right)({
|
|
647
|
-
entityType: object.entityType,
|
|
648
|
-
groups
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
//#endregion
|
|
652
600
|
//#region src/utils/types.ts
|
|
653
601
|
function prefixLeft(prefix, value) {
|
|
654
602
|
return `${prefix}_${value}`;
|
|
@@ -1044,6 +992,251 @@ function validateConcurrencyControl(object) {
|
|
|
1044
992
|
return (0, fp_ts_Either.right)({ version: object.version });
|
|
1045
993
|
}
|
|
1046
994
|
//#endregion
|
|
995
|
+
//#region src/validators/users.validators.ts
|
|
996
|
+
function validateUser(object) {
|
|
997
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
998
|
+
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
999
|
+
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1000
|
+
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1001
|
+
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1002
|
+
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1003
|
+
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1004
|
+
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1005
|
+
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1006
|
+
if (!hasOwnProperty(object, "createdAt")) return (0, fp_ts_Either.left)("missing_created_at");
|
|
1007
|
+
if (!isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
1008
|
+
if (!hasOwnProperty(object, "groups")) return (0, fp_ts_Either.left)("missing_groups");
|
|
1009
|
+
if (!isArray(object.groups)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
1010
|
+
const groups = [];
|
|
1011
|
+
for (const group of object.groups) {
|
|
1012
|
+
const validatedGroup = validateGroupInfo(group);
|
|
1013
|
+
if ((0, fp_ts_Either.isLeft)(validatedGroup)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
1014
|
+
groups.push(validatedGroup.right);
|
|
1015
|
+
}
|
|
1016
|
+
if (!hasOwnProperty(object, "roles")) return (0, fp_ts_Either.left)("missing_roles");
|
|
1017
|
+
if (!isArray(object.roles)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1018
|
+
const roles = [];
|
|
1019
|
+
for (const role of object.roles) {
|
|
1020
|
+
const validatedRole = validateRoleOperationItem(role);
|
|
1021
|
+
if ((0, fp_ts_Either.isLeft)(validatedRole)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1022
|
+
roles.push(validatedRole.right);
|
|
1023
|
+
}
|
|
1024
|
+
if (!hasOwnProperty(object, "concurrencyControl")) return (0, fp_ts_Either.left)("invalid_concurrency_control");
|
|
1025
|
+
const concurrencyControlValidation = validateConcurrencyControl(object.concurrencyControl);
|
|
1026
|
+
if ((0, fp_ts_Either.isLeft)(concurrencyControlValidation)) return (0, fp_ts_Either.left)("invalid_concurrency_control");
|
|
1027
|
+
return (0, fp_ts_Either.right)({
|
|
1028
|
+
id: object.id,
|
|
1029
|
+
displayName: object.displayName,
|
|
1030
|
+
email: object.email,
|
|
1031
|
+
orgRole: object.orgRole,
|
|
1032
|
+
createdAt: object.createdAt,
|
|
1033
|
+
groups,
|
|
1034
|
+
roles,
|
|
1035
|
+
concurrencyControl: concurrencyControlValidation.right
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
function validateUserCreate(object) {
|
|
1039
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1040
|
+
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1041
|
+
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1042
|
+
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1043
|
+
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1044
|
+
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1045
|
+
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1046
|
+
return (0, fp_ts_Either.right)({
|
|
1047
|
+
displayName: object.displayName,
|
|
1048
|
+
email: object.email,
|
|
1049
|
+
orgRole: object.orgRole
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function validateUserSummary(object) {
|
|
1053
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1054
|
+
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1055
|
+
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1056
|
+
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1057
|
+
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1058
|
+
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1059
|
+
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1060
|
+
return (0, fp_ts_Either.right)({
|
|
1061
|
+
id: object.id,
|
|
1062
|
+
displayName: object.displayName,
|
|
1063
|
+
email: object.email
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
function validateListUsers200Response(object) {
|
|
1067
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1068
|
+
if (!hasOwnProperty(object, "users")) return (0, fp_ts_Either.left)("missing_users");
|
|
1069
|
+
if (!isArray(object.users)) return (0, fp_ts_Either.left)("invalid_users");
|
|
1070
|
+
for (const user of object.users) if ((0, fp_ts_Either.isLeft)(validateUserSummary(user))) return (0, fp_ts_Either.left)("invalid_users");
|
|
1071
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1072
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
1073
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1074
|
+
const users = [];
|
|
1075
|
+
for (const user of object.users) {
|
|
1076
|
+
const validatedUser = validateUserSummary(user);
|
|
1077
|
+
if ((0, fp_ts_Either.isRight)(validatedUser)) users.push(validatedUser.right);
|
|
1078
|
+
}
|
|
1079
|
+
return (0, fp_ts_Either.right)({
|
|
1080
|
+
users,
|
|
1081
|
+
pagination: paginationValidation.right
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
function validateRoleScope(object) {
|
|
1085
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1086
|
+
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("missing_type");
|
|
1087
|
+
if (object.type === "org") return (0, fp_ts_Either.right)({ type: "org" });
|
|
1088
|
+
else if (object.type === "space") {
|
|
1089
|
+
if (!hasOwnProperty(object, "spaceId")) return (0, fp_ts_Either.left)("missing_space_id");
|
|
1090
|
+
if (!isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
1091
|
+
return (0, fp_ts_Either.right)({
|
|
1092
|
+
type: "space",
|
|
1093
|
+
spaceId: object.spaceId
|
|
1094
|
+
});
|
|
1095
|
+
} else if (object.type === "group") {
|
|
1096
|
+
if (!hasOwnProperty(object, "groupId")) return (0, fp_ts_Either.left)("missing_group_id");
|
|
1097
|
+
if (!isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)("invalid_group_id");
|
|
1098
|
+
return (0, fp_ts_Either.right)({
|
|
1099
|
+
type: "group",
|
|
1100
|
+
groupId: object.groupId
|
|
1101
|
+
});
|
|
1102
|
+
} else if (object.type === "workflow_template") {
|
|
1103
|
+
if (!hasOwnProperty(object, "workflowTemplateId")) return (0, fp_ts_Either.left)("missing_workflow_template_id");
|
|
1104
|
+
if (!isNonEmptyString(object.workflowTemplateId)) return (0, fp_ts_Either.left)("invalid_workflow_template_id");
|
|
1105
|
+
return (0, fp_ts_Either.right)({
|
|
1106
|
+
type: "workflow_template",
|
|
1107
|
+
workflowTemplateId: object.workflowTemplateId
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
return (0, fp_ts_Either.left)("invalid_type");
|
|
1111
|
+
}
|
|
1112
|
+
function validateRoleOperationItem(object) {
|
|
1113
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1114
|
+
if (!hasOwnProperty(object, "roleName")) return (0, fp_ts_Either.left)("missing_role_name");
|
|
1115
|
+
if (!isNonEmptyString(object.roleName)) return (0, fp_ts_Either.left)("invalid_role_name");
|
|
1116
|
+
if (!hasOwnProperty(object, "scope")) return (0, fp_ts_Either.left)("missing_scope");
|
|
1117
|
+
const scopeValidation = validateRoleScope(object.scope);
|
|
1118
|
+
if ((0, fp_ts_Either.isLeft)(scopeValidation)) return (0, fp_ts_Either.left)("invalid_scope");
|
|
1119
|
+
return (0, fp_ts_Either.right)({
|
|
1120
|
+
roleName: object.roleName,
|
|
1121
|
+
scope: scopeValidation.right
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
function validateRoleAssignmentRequest(object) {
|
|
1125
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1126
|
+
if (!hasOwnProperty(object, "roles")) return (0, fp_ts_Either.left)("missing_roles");
|
|
1127
|
+
if (!isArray(object.roles)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1128
|
+
const roles = [];
|
|
1129
|
+
for (const role of object.roles) {
|
|
1130
|
+
const roleValidation = validateRoleOperationItem(role);
|
|
1131
|
+
if ((0, fp_ts_Either.isLeft)(roleValidation)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1132
|
+
roles.push(roleValidation.right);
|
|
1133
|
+
}
|
|
1134
|
+
if (!hasOwnProperty(object, "concurrencyControl")) return (0, fp_ts_Either.left)("invalid_concurrency_control");
|
|
1135
|
+
const concurrencyControlValidation = validateConcurrencyControl(object.concurrencyControl);
|
|
1136
|
+
if ((0, fp_ts_Either.isLeft)(concurrencyControlValidation)) return (0, fp_ts_Either.left)("invalid_concurrency_control");
|
|
1137
|
+
return (0, fp_ts_Either.right)({
|
|
1138
|
+
roles,
|
|
1139
|
+
concurrencyControl: concurrencyControlValidation.right
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
function validateRoleRemovalRequest(object) {
|
|
1143
|
+
return validateRoleAssignmentRequest(object);
|
|
1144
|
+
}
|
|
1145
|
+
function validateListUsersParams(object) {
|
|
1146
|
+
return validateSharedListParams(object);
|
|
1147
|
+
}
|
|
1148
|
+
//#endregion
|
|
1149
|
+
//#region src/validators/common.validators.ts
|
|
1150
|
+
function validateSharedListParams(object) {
|
|
1151
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1152
|
+
const result = {};
|
|
1153
|
+
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
1154
|
+
let page = object.page;
|
|
1155
|
+
if (typeof page === "string" && page.trim() !== "") {
|
|
1156
|
+
const parsed = Number(page);
|
|
1157
|
+
if (!isNaN(parsed)) page = parsed;
|
|
1158
|
+
}
|
|
1159
|
+
if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return (0, fp_ts_Either.left)("invalid_page");
|
|
1160
|
+
result.page = page;
|
|
1161
|
+
}
|
|
1162
|
+
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
1163
|
+
let limit = object.limit;
|
|
1164
|
+
if (typeof limit === "string" && limit.trim() !== "") {
|
|
1165
|
+
const parsed = Number(limit);
|
|
1166
|
+
if (!isNaN(parsed)) limit = parsed;
|
|
1167
|
+
}
|
|
1168
|
+
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
1169
|
+
result.limit = limit;
|
|
1170
|
+
}
|
|
1171
|
+
if (hasOwnProperty(object, "search") && object.search !== void 0) {
|
|
1172
|
+
if (typeof object.search !== "string") return (0, fp_ts_Either.left)("invalid_search");
|
|
1173
|
+
result.search = object.search;
|
|
1174
|
+
}
|
|
1175
|
+
return (0, fp_ts_Either.right)(result);
|
|
1176
|
+
}
|
|
1177
|
+
function validatePagination(object) {
|
|
1178
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1179
|
+
if (!hasOwnProperty(object, "total")) return (0, fp_ts_Either.left)("missing_total");
|
|
1180
|
+
if (!isNumber(object.total) || object.total < 0) return (0, fp_ts_Either.left)("invalid_total");
|
|
1181
|
+
if (!hasOwnProperty(object, "page")) return (0, fp_ts_Either.left)("missing_page");
|
|
1182
|
+
if (!isNumber(object.page) || object.page < 0) return (0, fp_ts_Either.left)("invalid_page");
|
|
1183
|
+
if (!hasOwnProperty(object, "limit")) return (0, fp_ts_Either.left)("missing_limit");
|
|
1184
|
+
if (!isNumber(object.limit) || object.limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
1185
|
+
return (0, fp_ts_Either.right)({
|
|
1186
|
+
total: object.total,
|
|
1187
|
+
page: object.page,
|
|
1188
|
+
limit: object.limit
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
function validateHealthResponse(object) {
|
|
1192
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1193
|
+
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
1194
|
+
const result = { status: object.status };
|
|
1195
|
+
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
1196
|
+
if (typeof object.message !== "string") return (0, fp_ts_Either.left)("invalid_message");
|
|
1197
|
+
result.message = object.message;
|
|
1198
|
+
}
|
|
1199
|
+
return (0, fp_ts_Either.right)(result);
|
|
1200
|
+
}
|
|
1201
|
+
function validateGetEntityInfo200Response(object) {
|
|
1202
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1203
|
+
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
1204
|
+
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1205
|
+
if (!isNonEmptyString(object.id) || !isUUIDv4(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1206
|
+
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
1207
|
+
const groups = [];
|
|
1208
|
+
for (const item of object.groups) {
|
|
1209
|
+
const validatedItem = validateGroupInfo(item);
|
|
1210
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
1211
|
+
groups.push(validatedItem.right);
|
|
1212
|
+
}
|
|
1213
|
+
if (!hasOwnProperty(object, "roles")) return (0, fp_ts_Either.left)("missing_roles");
|
|
1214
|
+
if (!isArray(object.roles)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1215
|
+
const roles = [];
|
|
1216
|
+
for (const role of object.roles) {
|
|
1217
|
+
const validatedRole = validateRoleOperationItem(role);
|
|
1218
|
+
if ((0, fp_ts_Either.isLeft)(validatedRole)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1219
|
+
roles.push(validatedRole.right);
|
|
1220
|
+
}
|
|
1221
|
+
if (object.entityType === "user") {
|
|
1222
|
+
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1223
|
+
if (object.orgRole !== "admin" && object.orgRole !== "member") return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1224
|
+
return (0, fp_ts_Either.right)({
|
|
1225
|
+
entityType: "user",
|
|
1226
|
+
id: object.id,
|
|
1227
|
+
groups,
|
|
1228
|
+
roles,
|
|
1229
|
+
orgRole: object.orgRole
|
|
1230
|
+
});
|
|
1231
|
+
} else if (object.entityType === "agent") return (0, fp_ts_Either.right)({
|
|
1232
|
+
entityType: "agent",
|
|
1233
|
+
id: object.id,
|
|
1234
|
+
groups,
|
|
1235
|
+
roles
|
|
1236
|
+
});
|
|
1237
|
+
return (0, fp_ts_Either.left)("invalid_entity_type");
|
|
1238
|
+
}
|
|
1239
|
+
//#endregion
|
|
1047
1240
|
//#region src/validators/workflow.validators.ts
|
|
1048
1241
|
function validateWorkflowCreate(object) {
|
|
1049
1242
|
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
@@ -1363,132 +1556,6 @@ function validateListWorkflowVotesParams(object) {
|
|
|
1363
1556
|
return (0, fp_ts_Either.right)(result);
|
|
1364
1557
|
}
|
|
1365
1558
|
//#endregion
|
|
1366
|
-
//#region src/validators/users.validators.ts
|
|
1367
|
-
function validateUser(object) {
|
|
1368
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1369
|
-
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1370
|
-
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1371
|
-
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1372
|
-
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1373
|
-
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1374
|
-
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1375
|
-
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1376
|
-
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1377
|
-
if (!hasOwnProperty(object, "createdAt")) return (0, fp_ts_Either.left)("missing_created_at");
|
|
1378
|
-
if (!isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
1379
|
-
return (0, fp_ts_Either.right)({
|
|
1380
|
-
id: object.id,
|
|
1381
|
-
displayName: object.displayName,
|
|
1382
|
-
email: object.email,
|
|
1383
|
-
orgRole: object.orgRole,
|
|
1384
|
-
createdAt: object.createdAt
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
function validateUserCreate(object) {
|
|
1388
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1389
|
-
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1390
|
-
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1391
|
-
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1392
|
-
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1393
|
-
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1394
|
-
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1395
|
-
return (0, fp_ts_Either.right)({
|
|
1396
|
-
displayName: object.displayName,
|
|
1397
|
-
email: object.email,
|
|
1398
|
-
orgRole: object.orgRole
|
|
1399
|
-
});
|
|
1400
|
-
}
|
|
1401
|
-
function validateUserSummary(object) {
|
|
1402
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1403
|
-
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1404
|
-
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1405
|
-
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1406
|
-
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1407
|
-
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1408
|
-
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1409
|
-
return (0, fp_ts_Either.right)({
|
|
1410
|
-
id: object.id,
|
|
1411
|
-
displayName: object.displayName,
|
|
1412
|
-
email: object.email
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
function validateListUsers200Response(object) {
|
|
1416
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1417
|
-
if (!hasOwnProperty(object, "users")) return (0, fp_ts_Either.left)("missing_users");
|
|
1418
|
-
if (!isArray(object.users)) return (0, fp_ts_Either.left)("invalid_users");
|
|
1419
|
-
for (const user of object.users) if ((0, fp_ts_Either.isLeft)(validateUserSummary(user))) return (0, fp_ts_Either.left)("invalid_users");
|
|
1420
|
-
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1421
|
-
const paginationValidation = validatePagination(object.pagination);
|
|
1422
|
-
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1423
|
-
const users = [];
|
|
1424
|
-
for (const user of object.users) {
|
|
1425
|
-
const validatedUser = validateUserSummary(user);
|
|
1426
|
-
if ((0, fp_ts_Either.isRight)(validatedUser)) users.push(validatedUser.right);
|
|
1427
|
-
}
|
|
1428
|
-
return (0, fp_ts_Either.right)({
|
|
1429
|
-
users,
|
|
1430
|
-
pagination: paginationValidation.right
|
|
1431
|
-
});
|
|
1432
|
-
}
|
|
1433
|
-
function validateRoleScope(object) {
|
|
1434
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1435
|
-
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("missing_type");
|
|
1436
|
-
if (object.type === "org") return (0, fp_ts_Either.right)({ type: "org" });
|
|
1437
|
-
else if (object.type === "space") {
|
|
1438
|
-
if (!hasOwnProperty(object, "spaceId")) return (0, fp_ts_Either.left)("missing_space_id");
|
|
1439
|
-
if (!isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
1440
|
-
return (0, fp_ts_Either.right)({
|
|
1441
|
-
type: "space",
|
|
1442
|
-
spaceId: object.spaceId
|
|
1443
|
-
});
|
|
1444
|
-
} else if (object.type === "group") {
|
|
1445
|
-
if (!hasOwnProperty(object, "groupId")) return (0, fp_ts_Either.left)("missing_group_id");
|
|
1446
|
-
if (!isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)("invalid_group_id");
|
|
1447
|
-
return (0, fp_ts_Either.right)({
|
|
1448
|
-
type: "group",
|
|
1449
|
-
groupId: object.groupId
|
|
1450
|
-
});
|
|
1451
|
-
} else if (object.type === "workflow_template") {
|
|
1452
|
-
if (!hasOwnProperty(object, "workflowTemplateId")) return (0, fp_ts_Either.left)("missing_workflow_template_id");
|
|
1453
|
-
if (!isNonEmptyString(object.workflowTemplateId)) return (0, fp_ts_Either.left)("invalid_workflow_template_id");
|
|
1454
|
-
return (0, fp_ts_Either.right)({
|
|
1455
|
-
type: "workflow_template",
|
|
1456
|
-
workflowTemplateId: object.workflowTemplateId
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
return (0, fp_ts_Either.left)("invalid_type");
|
|
1460
|
-
}
|
|
1461
|
-
function validateRoleOperationItem(object) {
|
|
1462
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1463
|
-
if (!hasOwnProperty(object, "roleName")) return (0, fp_ts_Either.left)("missing_role_name");
|
|
1464
|
-
if (!isNonEmptyString(object.roleName)) return (0, fp_ts_Either.left)("invalid_role_name");
|
|
1465
|
-
if (!hasOwnProperty(object, "scope")) return (0, fp_ts_Either.left)("missing_scope");
|
|
1466
|
-
const scopeValidation = validateRoleScope(object.scope);
|
|
1467
|
-
if ((0, fp_ts_Either.isLeft)(scopeValidation)) return (0, fp_ts_Either.left)("invalid_scope");
|
|
1468
|
-
return (0, fp_ts_Either.right)({
|
|
1469
|
-
roleName: object.roleName,
|
|
1470
|
-
scope: scopeValidation.right
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1473
|
-
function validateRoleAssignmentRequest(object) {
|
|
1474
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1475
|
-
if (!hasOwnProperty(object, "roles")) return (0, fp_ts_Either.left)("missing_roles");
|
|
1476
|
-
if (!isArray(object.roles)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1477
|
-
const roles = [];
|
|
1478
|
-
for (const role of object.roles) {
|
|
1479
|
-
const roleValidation = validateRoleOperationItem(role);
|
|
1480
|
-
if ((0, fp_ts_Either.isLeft)(roleValidation)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1481
|
-
roles.push(roleValidation.right);
|
|
1482
|
-
}
|
|
1483
|
-
return (0, fp_ts_Either.right)({ roles });
|
|
1484
|
-
}
|
|
1485
|
-
function validateRoleRemovalRequest(object) {
|
|
1486
|
-
return validateRoleAssignmentRequest(object);
|
|
1487
|
-
}
|
|
1488
|
-
function validateListUsersParams(object) {
|
|
1489
|
-
return validateSharedListParams(object);
|
|
1490
|
-
}
|
|
1491
|
-
//#endregion
|
|
1492
1559
|
//#region src/validators/spaces.validators.ts
|
|
1493
1560
|
function validateSpace(object) {
|
|
1494
1561
|
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
@@ -1830,6 +1897,18 @@ Object.defineProperty(exports, "EmailAction", {
|
|
|
1830
1897
|
return EmailAction;
|
|
1831
1898
|
}
|
|
1832
1899
|
});
|
|
1900
|
+
Object.defineProperty(exports, "GetEntityInfoAgentResponse", {
|
|
1901
|
+
enumerable: true,
|
|
1902
|
+
get: function() {
|
|
1903
|
+
return GetEntityInfoAgentResponse;
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
Object.defineProperty(exports, "GetEntityInfoUserResponse", {
|
|
1907
|
+
enumerable: true,
|
|
1908
|
+
get: function() {
|
|
1909
|
+
return GetEntityInfoUserResponse;
|
|
1910
|
+
}
|
|
1911
|
+
});
|
|
1833
1912
|
Object.defineProperty(exports, "GroupQuota", {
|
|
1834
1913
|
enumerable: true,
|
|
1835
1914
|
get: function() {
|
|
@@ -2064,7 +2143,9 @@ exports.validateQuotaUpdate = validateQuotaUpdate;
|
|
|
2064
2143
|
exports.validateRefreshTokenRequest = validateRefreshTokenRequest;
|
|
2065
2144
|
exports.validateRemoveGroupEntitiesRequest = validateRemoveGroupEntitiesRequest;
|
|
2066
2145
|
exports.validateRoleAssignmentRequest = validateRoleAssignmentRequest;
|
|
2146
|
+
exports.validateRoleOperationItem = validateRoleOperationItem;
|
|
2067
2147
|
exports.validateRoleRemovalRequest = validateRoleRemovalRequest;
|
|
2148
|
+
exports.validateRoleScope = validateRoleScope;
|
|
2068
2149
|
exports.validateSharedListParams = validateSharedListParams;
|
|
2069
2150
|
exports.validateSpaceCreate = validateSpaceCreate;
|
|
2070
2151
|
exports.validateSpaceScope = validateSpaceScope;
|