@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.mjs
CHANGED
|
@@ -21,6 +21,22 @@ let EmailAction;
|
|
|
21
21
|
_EmailAction.TypeEnum = { Email: "EMAIL" };
|
|
22
22
|
})(EmailAction || (EmailAction = {}));
|
|
23
23
|
//#endregion
|
|
24
|
+
//#region generated/openapi/model/get-entity-info-agent-response.ts
|
|
25
|
+
let GetEntityInfoAgentResponse;
|
|
26
|
+
(function(_GetEntityInfoAgentResponse) {
|
|
27
|
+
_GetEntityInfoAgentResponse.EntityTypeEnum = { Agent: "agent" };
|
|
28
|
+
})(GetEntityInfoAgentResponse || (GetEntityInfoAgentResponse = {}));
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region generated/openapi/model/get-entity-info-user-response.ts
|
|
31
|
+
let GetEntityInfoUserResponse;
|
|
32
|
+
(function(_GetEntityInfoUserResponse) {
|
|
33
|
+
_GetEntityInfoUserResponse.EntityTypeEnum = { User: "user" };
|
|
34
|
+
_GetEntityInfoUserResponse.OrgRoleEnum = {
|
|
35
|
+
Admin: "admin",
|
|
36
|
+
Member: "member"
|
|
37
|
+
};
|
|
38
|
+
})(GetEntityInfoUserResponse || (GetEntityInfoUserResponse = {}));
|
|
39
|
+
//#endregion
|
|
24
40
|
//#region generated/openapi/model/group-quota.ts
|
|
25
41
|
let GroupQuota;
|
|
26
42
|
(function(_GroupQuota) {
|
|
@@ -557,74 +573,6 @@ function validateListGroupEntities200Response(object) {
|
|
|
557
573
|
});
|
|
558
574
|
}
|
|
559
575
|
//#endregion
|
|
560
|
-
//#region src/validators/common.validators.ts
|
|
561
|
-
function validateSharedListParams(object) {
|
|
562
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
563
|
-
const result = {};
|
|
564
|
-
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
565
|
-
let page = object.page;
|
|
566
|
-
if (typeof page === "string" && page.trim() !== "") {
|
|
567
|
-
const parsed = Number(page);
|
|
568
|
-
if (!isNaN(parsed)) page = parsed;
|
|
569
|
-
}
|
|
570
|
-
if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return left("invalid_page");
|
|
571
|
-
result.page = page;
|
|
572
|
-
}
|
|
573
|
-
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
574
|
-
let limit = object.limit;
|
|
575
|
-
if (typeof limit === "string" && limit.trim() !== "") {
|
|
576
|
-
const parsed = Number(limit);
|
|
577
|
-
if (!isNaN(parsed)) limit = parsed;
|
|
578
|
-
}
|
|
579
|
-
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return left("invalid_limit");
|
|
580
|
-
result.limit = limit;
|
|
581
|
-
}
|
|
582
|
-
if (hasOwnProperty(object, "search") && object.search !== void 0) {
|
|
583
|
-
if (typeof object.search !== "string") return left("invalid_search");
|
|
584
|
-
result.search = object.search;
|
|
585
|
-
}
|
|
586
|
-
return right(result);
|
|
587
|
-
}
|
|
588
|
-
function validatePagination(object) {
|
|
589
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
590
|
-
if (!hasOwnProperty(object, "total")) return left("missing_total");
|
|
591
|
-
if (!isNumber(object.total) || object.total < 0) return left("invalid_total");
|
|
592
|
-
if (!hasOwnProperty(object, "page")) return left("missing_page");
|
|
593
|
-
if (!isNumber(object.page) || object.page < 0) return left("invalid_page");
|
|
594
|
-
if (!hasOwnProperty(object, "limit")) return left("missing_limit");
|
|
595
|
-
if (!isNumber(object.limit) || object.limit < 1) return left("invalid_limit");
|
|
596
|
-
return right({
|
|
597
|
-
total: object.total,
|
|
598
|
-
page: object.page,
|
|
599
|
-
limit: object.limit
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
function validateHealthResponse(object) {
|
|
603
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
604
|
-
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return left(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
605
|
-
const result = { status: object.status };
|
|
606
|
-
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
607
|
-
if (typeof object.message !== "string") return left("invalid_message");
|
|
608
|
-
result.message = object.message;
|
|
609
|
-
}
|
|
610
|
-
return right(result);
|
|
611
|
-
}
|
|
612
|
-
function validateGetEntityInfo200Response(object) {
|
|
613
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
614
|
-
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return left(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
615
|
-
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return left(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
616
|
-
const groups = [];
|
|
617
|
-
for (const item of object.groups) {
|
|
618
|
-
const validatedItem = validateGroupInfo(item);
|
|
619
|
-
if (isLeft(validatedItem)) return left("invalid_groups");
|
|
620
|
-
groups.push(validatedItem.right);
|
|
621
|
-
}
|
|
622
|
-
return right({
|
|
623
|
-
entityType: object.entityType,
|
|
624
|
-
groups
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
//#endregion
|
|
628
576
|
//#region src/utils/types.ts
|
|
629
577
|
function prefixLeft(prefix, value) {
|
|
630
578
|
return `${prefix}_${value}`;
|
|
@@ -1020,6 +968,251 @@ function validateConcurrencyControl(object) {
|
|
|
1020
968
|
return right({ version: object.version });
|
|
1021
969
|
}
|
|
1022
970
|
//#endregion
|
|
971
|
+
//#region src/validators/users.validators.ts
|
|
972
|
+
function validateUser(object) {
|
|
973
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
974
|
+
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
975
|
+
if (!isNonEmptyString(object.id)) return left("invalid_id");
|
|
976
|
+
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
977
|
+
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
978
|
+
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
979
|
+
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
980
|
+
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
981
|
+
if (!isNonEmptyString(object.orgRole)) return left("invalid_org_role");
|
|
982
|
+
if (!hasOwnProperty(object, "createdAt")) return left("missing_created_at");
|
|
983
|
+
if (!isNonEmptyString(object.createdAt)) return left("invalid_created_at");
|
|
984
|
+
if (!hasOwnProperty(object, "groups")) return left("missing_groups");
|
|
985
|
+
if (!isArray(object.groups)) return left("invalid_groups");
|
|
986
|
+
const groups = [];
|
|
987
|
+
for (const group of object.groups) {
|
|
988
|
+
const validatedGroup = validateGroupInfo(group);
|
|
989
|
+
if (isLeft(validatedGroup)) return left("invalid_groups");
|
|
990
|
+
groups.push(validatedGroup.right);
|
|
991
|
+
}
|
|
992
|
+
if (!hasOwnProperty(object, "roles")) return left("missing_roles");
|
|
993
|
+
if (!isArray(object.roles)) return left("invalid_roles");
|
|
994
|
+
const roles = [];
|
|
995
|
+
for (const role of object.roles) {
|
|
996
|
+
const validatedRole = validateRoleOperationItem(role);
|
|
997
|
+
if (isLeft(validatedRole)) return left("invalid_roles");
|
|
998
|
+
roles.push(validatedRole.right);
|
|
999
|
+
}
|
|
1000
|
+
if (!hasOwnProperty(object, "concurrencyControl")) return left("invalid_concurrency_control");
|
|
1001
|
+
const concurrencyControlValidation = validateConcurrencyControl(object.concurrencyControl);
|
|
1002
|
+
if (isLeft(concurrencyControlValidation)) return left("invalid_concurrency_control");
|
|
1003
|
+
return right({
|
|
1004
|
+
id: object.id,
|
|
1005
|
+
displayName: object.displayName,
|
|
1006
|
+
email: object.email,
|
|
1007
|
+
orgRole: object.orgRole,
|
|
1008
|
+
createdAt: object.createdAt,
|
|
1009
|
+
groups,
|
|
1010
|
+
roles,
|
|
1011
|
+
concurrencyControl: concurrencyControlValidation.right
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
function validateUserCreate(object) {
|
|
1015
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1016
|
+
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1017
|
+
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1018
|
+
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1019
|
+
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1020
|
+
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
1021
|
+
if (!isNonEmptyString(object.orgRole)) return left("invalid_org_role");
|
|
1022
|
+
return right({
|
|
1023
|
+
displayName: object.displayName,
|
|
1024
|
+
email: object.email,
|
|
1025
|
+
orgRole: object.orgRole
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function validateUserSummary(object) {
|
|
1029
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1030
|
+
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
1031
|
+
if (!isNonEmptyString(object.id)) return left("invalid_id");
|
|
1032
|
+
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1033
|
+
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1034
|
+
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1035
|
+
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1036
|
+
return right({
|
|
1037
|
+
id: object.id,
|
|
1038
|
+
displayName: object.displayName,
|
|
1039
|
+
email: object.email
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
function validateListUsers200Response(object) {
|
|
1043
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1044
|
+
if (!hasOwnProperty(object, "users")) return left("missing_users");
|
|
1045
|
+
if (!isArray(object.users)) return left("invalid_users");
|
|
1046
|
+
for (const user of object.users) if (isLeft(validateUserSummary(user))) return left("invalid_users");
|
|
1047
|
+
if (!hasOwnProperty(object, "pagination")) return left("missing_pagination");
|
|
1048
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
1049
|
+
if (isLeft(paginationValidation)) return left("invalid_pagination");
|
|
1050
|
+
const users = [];
|
|
1051
|
+
for (const user of object.users) {
|
|
1052
|
+
const validatedUser = validateUserSummary(user);
|
|
1053
|
+
if (isRight(validatedUser)) users.push(validatedUser.right);
|
|
1054
|
+
}
|
|
1055
|
+
return right({
|
|
1056
|
+
users,
|
|
1057
|
+
pagination: paginationValidation.right
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
function validateRoleScope(object) {
|
|
1061
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1062
|
+
if (!hasOwnProperty(object, "type")) return left("missing_type");
|
|
1063
|
+
if (object.type === "org") return right({ type: "org" });
|
|
1064
|
+
else if (object.type === "space") {
|
|
1065
|
+
if (!hasOwnProperty(object, "spaceId")) return left("missing_space_id");
|
|
1066
|
+
if (!isNonEmptyString(object.spaceId)) return left("invalid_space_id");
|
|
1067
|
+
return right({
|
|
1068
|
+
type: "space",
|
|
1069
|
+
spaceId: object.spaceId
|
|
1070
|
+
});
|
|
1071
|
+
} else if (object.type === "group") {
|
|
1072
|
+
if (!hasOwnProperty(object, "groupId")) return left("missing_group_id");
|
|
1073
|
+
if (!isNonEmptyString(object.groupId)) return left("invalid_group_id");
|
|
1074
|
+
return right({
|
|
1075
|
+
type: "group",
|
|
1076
|
+
groupId: object.groupId
|
|
1077
|
+
});
|
|
1078
|
+
} else if (object.type === "workflow_template") {
|
|
1079
|
+
if (!hasOwnProperty(object, "workflowTemplateId")) return left("missing_workflow_template_id");
|
|
1080
|
+
if (!isNonEmptyString(object.workflowTemplateId)) return left("invalid_workflow_template_id");
|
|
1081
|
+
return right({
|
|
1082
|
+
type: "workflow_template",
|
|
1083
|
+
workflowTemplateId: object.workflowTemplateId
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
return left("invalid_type");
|
|
1087
|
+
}
|
|
1088
|
+
function validateRoleOperationItem(object) {
|
|
1089
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1090
|
+
if (!hasOwnProperty(object, "roleName")) return left("missing_role_name");
|
|
1091
|
+
if (!isNonEmptyString(object.roleName)) return left("invalid_role_name");
|
|
1092
|
+
if (!hasOwnProperty(object, "scope")) return left("missing_scope");
|
|
1093
|
+
const scopeValidation = validateRoleScope(object.scope);
|
|
1094
|
+
if (isLeft(scopeValidation)) return left("invalid_scope");
|
|
1095
|
+
return right({
|
|
1096
|
+
roleName: object.roleName,
|
|
1097
|
+
scope: scopeValidation.right
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
function validateRoleAssignmentRequest(object) {
|
|
1101
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1102
|
+
if (!hasOwnProperty(object, "roles")) return left("missing_roles");
|
|
1103
|
+
if (!isArray(object.roles)) return left("invalid_roles");
|
|
1104
|
+
const roles = [];
|
|
1105
|
+
for (const role of object.roles) {
|
|
1106
|
+
const roleValidation = validateRoleOperationItem(role);
|
|
1107
|
+
if (isLeft(roleValidation)) return left("invalid_roles");
|
|
1108
|
+
roles.push(roleValidation.right);
|
|
1109
|
+
}
|
|
1110
|
+
if (!hasOwnProperty(object, "concurrencyControl")) return left("invalid_concurrency_control");
|
|
1111
|
+
const concurrencyControlValidation = validateConcurrencyControl(object.concurrencyControl);
|
|
1112
|
+
if (isLeft(concurrencyControlValidation)) return left("invalid_concurrency_control");
|
|
1113
|
+
return right({
|
|
1114
|
+
roles,
|
|
1115
|
+
concurrencyControl: concurrencyControlValidation.right
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
function validateRoleRemovalRequest(object) {
|
|
1119
|
+
return validateRoleAssignmentRequest(object);
|
|
1120
|
+
}
|
|
1121
|
+
function validateListUsersParams(object) {
|
|
1122
|
+
return validateSharedListParams(object);
|
|
1123
|
+
}
|
|
1124
|
+
//#endregion
|
|
1125
|
+
//#region src/validators/common.validators.ts
|
|
1126
|
+
function validateSharedListParams(object) {
|
|
1127
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1128
|
+
const result = {};
|
|
1129
|
+
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
1130
|
+
let page = object.page;
|
|
1131
|
+
if (typeof page === "string" && page.trim() !== "") {
|
|
1132
|
+
const parsed = Number(page);
|
|
1133
|
+
if (!isNaN(parsed)) page = parsed;
|
|
1134
|
+
}
|
|
1135
|
+
if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return left("invalid_page");
|
|
1136
|
+
result.page = page;
|
|
1137
|
+
}
|
|
1138
|
+
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
1139
|
+
let limit = object.limit;
|
|
1140
|
+
if (typeof limit === "string" && limit.trim() !== "") {
|
|
1141
|
+
const parsed = Number(limit);
|
|
1142
|
+
if (!isNaN(parsed)) limit = parsed;
|
|
1143
|
+
}
|
|
1144
|
+
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return left("invalid_limit");
|
|
1145
|
+
result.limit = limit;
|
|
1146
|
+
}
|
|
1147
|
+
if (hasOwnProperty(object, "search") && object.search !== void 0) {
|
|
1148
|
+
if (typeof object.search !== "string") return left("invalid_search");
|
|
1149
|
+
result.search = object.search;
|
|
1150
|
+
}
|
|
1151
|
+
return right(result);
|
|
1152
|
+
}
|
|
1153
|
+
function validatePagination(object) {
|
|
1154
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1155
|
+
if (!hasOwnProperty(object, "total")) return left("missing_total");
|
|
1156
|
+
if (!isNumber(object.total) || object.total < 0) return left("invalid_total");
|
|
1157
|
+
if (!hasOwnProperty(object, "page")) return left("missing_page");
|
|
1158
|
+
if (!isNumber(object.page) || object.page < 0) return left("invalid_page");
|
|
1159
|
+
if (!hasOwnProperty(object, "limit")) return left("missing_limit");
|
|
1160
|
+
if (!isNumber(object.limit) || object.limit < 1) return left("invalid_limit");
|
|
1161
|
+
return right({
|
|
1162
|
+
total: object.total,
|
|
1163
|
+
page: object.page,
|
|
1164
|
+
limit: object.limit
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
function validateHealthResponse(object) {
|
|
1168
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1169
|
+
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return left(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
1170
|
+
const result = { status: object.status };
|
|
1171
|
+
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
1172
|
+
if (typeof object.message !== "string") return left("invalid_message");
|
|
1173
|
+
result.message = object.message;
|
|
1174
|
+
}
|
|
1175
|
+
return right(result);
|
|
1176
|
+
}
|
|
1177
|
+
function validateGetEntityInfo200Response(object) {
|
|
1178
|
+
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1179
|
+
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return left(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
1180
|
+
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
1181
|
+
if (!isNonEmptyString(object.id) || !isUUIDv4(object.id)) return left("invalid_id");
|
|
1182
|
+
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return left(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
1183
|
+
const groups = [];
|
|
1184
|
+
for (const item of object.groups) {
|
|
1185
|
+
const validatedItem = validateGroupInfo(item);
|
|
1186
|
+
if (isLeft(validatedItem)) return left("invalid_groups");
|
|
1187
|
+
groups.push(validatedItem.right);
|
|
1188
|
+
}
|
|
1189
|
+
if (!hasOwnProperty(object, "roles")) return left("missing_roles");
|
|
1190
|
+
if (!isArray(object.roles)) return left("invalid_roles");
|
|
1191
|
+
const roles = [];
|
|
1192
|
+
for (const role of object.roles) {
|
|
1193
|
+
const validatedRole = validateRoleOperationItem(role);
|
|
1194
|
+
if (isLeft(validatedRole)) return left("invalid_roles");
|
|
1195
|
+
roles.push(validatedRole.right);
|
|
1196
|
+
}
|
|
1197
|
+
if (object.entityType === "user") {
|
|
1198
|
+
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
1199
|
+
if (object.orgRole !== "admin" && object.orgRole !== "member") return left("invalid_org_role");
|
|
1200
|
+
return right({
|
|
1201
|
+
entityType: "user",
|
|
1202
|
+
id: object.id,
|
|
1203
|
+
groups,
|
|
1204
|
+
roles,
|
|
1205
|
+
orgRole: object.orgRole
|
|
1206
|
+
});
|
|
1207
|
+
} else if (object.entityType === "agent") return right({
|
|
1208
|
+
entityType: "agent",
|
|
1209
|
+
id: object.id,
|
|
1210
|
+
groups,
|
|
1211
|
+
roles
|
|
1212
|
+
});
|
|
1213
|
+
return left("invalid_entity_type");
|
|
1214
|
+
}
|
|
1215
|
+
//#endregion
|
|
1023
1216
|
//#region src/validators/workflow.validators.ts
|
|
1024
1217
|
function validateWorkflowCreate(object) {
|
|
1025
1218
|
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
@@ -1339,132 +1532,6 @@ function validateListWorkflowVotesParams(object) {
|
|
|
1339
1532
|
return right(result);
|
|
1340
1533
|
}
|
|
1341
1534
|
//#endregion
|
|
1342
|
-
//#region src/validators/users.validators.ts
|
|
1343
|
-
function validateUser(object) {
|
|
1344
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1345
|
-
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
1346
|
-
if (!isNonEmptyString(object.id)) return left("invalid_id");
|
|
1347
|
-
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1348
|
-
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1349
|
-
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1350
|
-
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1351
|
-
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
1352
|
-
if (!isNonEmptyString(object.orgRole)) return left("invalid_org_role");
|
|
1353
|
-
if (!hasOwnProperty(object, "createdAt")) return left("missing_created_at");
|
|
1354
|
-
if (!isNonEmptyString(object.createdAt)) return left("invalid_created_at");
|
|
1355
|
-
return right({
|
|
1356
|
-
id: object.id,
|
|
1357
|
-
displayName: object.displayName,
|
|
1358
|
-
email: object.email,
|
|
1359
|
-
orgRole: object.orgRole,
|
|
1360
|
-
createdAt: object.createdAt
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
function validateUserCreate(object) {
|
|
1364
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1365
|
-
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1366
|
-
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1367
|
-
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1368
|
-
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1369
|
-
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
1370
|
-
if (!isNonEmptyString(object.orgRole)) return left("invalid_org_role");
|
|
1371
|
-
return right({
|
|
1372
|
-
displayName: object.displayName,
|
|
1373
|
-
email: object.email,
|
|
1374
|
-
orgRole: object.orgRole
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
function validateUserSummary(object) {
|
|
1378
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1379
|
-
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
1380
|
-
if (!isNonEmptyString(object.id)) return left("invalid_id");
|
|
1381
|
-
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1382
|
-
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1383
|
-
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1384
|
-
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1385
|
-
return right({
|
|
1386
|
-
id: object.id,
|
|
1387
|
-
displayName: object.displayName,
|
|
1388
|
-
email: object.email
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
function validateListUsers200Response(object) {
|
|
1392
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1393
|
-
if (!hasOwnProperty(object, "users")) return left("missing_users");
|
|
1394
|
-
if (!isArray(object.users)) return left("invalid_users");
|
|
1395
|
-
for (const user of object.users) if (isLeft(validateUserSummary(user))) return left("invalid_users");
|
|
1396
|
-
if (!hasOwnProperty(object, "pagination")) return left("missing_pagination");
|
|
1397
|
-
const paginationValidation = validatePagination(object.pagination);
|
|
1398
|
-
if (isLeft(paginationValidation)) return left("invalid_pagination");
|
|
1399
|
-
const users = [];
|
|
1400
|
-
for (const user of object.users) {
|
|
1401
|
-
const validatedUser = validateUserSummary(user);
|
|
1402
|
-
if (isRight(validatedUser)) users.push(validatedUser.right);
|
|
1403
|
-
}
|
|
1404
|
-
return right({
|
|
1405
|
-
users,
|
|
1406
|
-
pagination: paginationValidation.right
|
|
1407
|
-
});
|
|
1408
|
-
}
|
|
1409
|
-
function validateRoleScope(object) {
|
|
1410
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1411
|
-
if (!hasOwnProperty(object, "type")) return left("missing_type");
|
|
1412
|
-
if (object.type === "org") return right({ type: "org" });
|
|
1413
|
-
else if (object.type === "space") {
|
|
1414
|
-
if (!hasOwnProperty(object, "spaceId")) return left("missing_space_id");
|
|
1415
|
-
if (!isNonEmptyString(object.spaceId)) return left("invalid_space_id");
|
|
1416
|
-
return right({
|
|
1417
|
-
type: "space",
|
|
1418
|
-
spaceId: object.spaceId
|
|
1419
|
-
});
|
|
1420
|
-
} else if (object.type === "group") {
|
|
1421
|
-
if (!hasOwnProperty(object, "groupId")) return left("missing_group_id");
|
|
1422
|
-
if (!isNonEmptyString(object.groupId)) return left("invalid_group_id");
|
|
1423
|
-
return right({
|
|
1424
|
-
type: "group",
|
|
1425
|
-
groupId: object.groupId
|
|
1426
|
-
});
|
|
1427
|
-
} else if (object.type === "workflow_template") {
|
|
1428
|
-
if (!hasOwnProperty(object, "workflowTemplateId")) return left("missing_workflow_template_id");
|
|
1429
|
-
if (!isNonEmptyString(object.workflowTemplateId)) return left("invalid_workflow_template_id");
|
|
1430
|
-
return right({
|
|
1431
|
-
type: "workflow_template",
|
|
1432
|
-
workflowTemplateId: object.workflowTemplateId
|
|
1433
|
-
});
|
|
1434
|
-
}
|
|
1435
|
-
return left("invalid_type");
|
|
1436
|
-
}
|
|
1437
|
-
function validateRoleOperationItem(object) {
|
|
1438
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1439
|
-
if (!hasOwnProperty(object, "roleName")) return left("missing_role_name");
|
|
1440
|
-
if (!isNonEmptyString(object.roleName)) return left("invalid_role_name");
|
|
1441
|
-
if (!hasOwnProperty(object, "scope")) return left("missing_scope");
|
|
1442
|
-
const scopeValidation = validateRoleScope(object.scope);
|
|
1443
|
-
if (isLeft(scopeValidation)) return left("invalid_scope");
|
|
1444
|
-
return right({
|
|
1445
|
-
roleName: object.roleName,
|
|
1446
|
-
scope: scopeValidation.right
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
function validateRoleAssignmentRequest(object) {
|
|
1450
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1451
|
-
if (!hasOwnProperty(object, "roles")) return left("missing_roles");
|
|
1452
|
-
if (!isArray(object.roles)) return left("invalid_roles");
|
|
1453
|
-
const roles = [];
|
|
1454
|
-
for (const role of object.roles) {
|
|
1455
|
-
const roleValidation = validateRoleOperationItem(role);
|
|
1456
|
-
if (isLeft(roleValidation)) return left("invalid_roles");
|
|
1457
|
-
roles.push(roleValidation.right);
|
|
1458
|
-
}
|
|
1459
|
-
return right({ roles });
|
|
1460
|
-
}
|
|
1461
|
-
function validateRoleRemovalRequest(object) {
|
|
1462
|
-
return validateRoleAssignmentRequest(object);
|
|
1463
|
-
}
|
|
1464
|
-
function validateListUsersParams(object) {
|
|
1465
|
-
return validateSharedListParams(object);
|
|
1466
|
-
}
|
|
1467
|
-
//#endregion
|
|
1468
1535
|
//#region src/validators/spaces.validators.ts
|
|
1469
1536
|
function validateSpace(object) {
|
|
1470
1537
|
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
@@ -1788,4 +1855,4 @@ function validateListQuotasParams(object) {
|
|
|
1788
1855
|
return right(result);
|
|
1789
1856
|
}
|
|
1790
1857
|
//#endregion
|
|
1791
|
-
export { AgentTokenRequest, AndRule, EmailAction, GroupQuota, GroupQuotaBase, GroupQuotaCreate, GroupRequirementRule, GroupScope, ListWorkflowVotesParams, ListWorkflowsParams, OrRule, OrgQuota, OrgQuotaBase, OrgQuotaCreate, OrgScope, QuotaScope, QuotaType, SortBy, SortDirection, SpaceQuota, SpaceQuotaBase, SpaceQuotaCreate, SpaceScope, UserQuota, UserQuotaBase, UserQuotaCreate, VoteApprove, VoteVeto, VoteWithdraw, WebhookAction, WorkflowQuota, WorkflowQuotaBase, WorkflowQuotaCreate, WorkflowTemplateQuota, WorkflowTemplateQuotaBase, WorkflowTemplateQuotaCreate, WorkflowTemplateScope, WorkflowTemplateStatus, isAPIError, validateAPIError, validateAddGroupEntitiesRequest, validateAgentChallengeRequest, validateAgentChallengeResponse, validateAgentGet200Response, validateAgentRegistrationRequest, validateAgentRegistrationResponse, validateAgentTokenRequest, validateAgentTokenResponse, validateCanVoteResponse, validateConcurrencyControl, validateGetEntityInfo200Response, validateGetWorkflowParams, validateGetWorkflowVotes200Response, validateGroupCreate, validateGroupInfo, validateGroupScope, validateHealthResponse, validateInitiateCliLogin200Response, validateInitiateCliLoginRequest, validateListAgents200Response, validateListAgentsParams, validateListGroupEntities200Response, validateListGroups200Response, validateListGroupsParams, validateListOrganizationAdminsForOrg200Response, validateListQuotasParams, validateListRoleTemplates200Response, validateListSpaces200Response, validateListSpacesParams, validateListUsers200Response, validateListUsersParams, validateListWorkflowTemplates200Response, validateListWorkflowTemplatesParams, validateListWorkflowVotesParams, validateListWorkflows200Response, validateListWorkflowsParams, validateOidcCallbackRequest, validateOrganizationAdminCreate, validateOrganizationAdminRemove, validatePagination, validatePrivilegedTokenExchangeRequest, validatePrivilegedTokenResponse, validateQuotaCreate, validateQuotaUpdate, validateRefreshTokenRequest, validateRemoveGroupEntitiesRequest, validateRoleAssignmentRequest, validateRoleRemovalRequest, validateSharedListParams, validateSpaceCreate, validateSpaceScope, validateTokenRequest, validateTokenResponse, validateUser, validateUserCreate, validateWorkflowCreate, validateWorkflowTemplate, validateWorkflowTemplateCreate, validateWorkflowTemplateDeprecate, validateWorkflowTemplateScope, validateWorkflowTemplateUpdate, validateWorkflowVoteRequest };
|
|
1858
|
+
export { AgentTokenRequest, AndRule, EmailAction, GetEntityInfoAgentResponse, GetEntityInfoUserResponse, GroupQuota, GroupQuotaBase, GroupQuotaCreate, GroupRequirementRule, GroupScope, ListWorkflowVotesParams, ListWorkflowsParams, OrRule, OrgQuota, OrgQuotaBase, OrgQuotaCreate, OrgScope, QuotaScope, QuotaType, SortBy, SortDirection, SpaceQuota, SpaceQuotaBase, SpaceQuotaCreate, SpaceScope, UserQuota, UserQuotaBase, UserQuotaCreate, VoteApprove, VoteVeto, VoteWithdraw, WebhookAction, WorkflowQuota, WorkflowQuotaBase, WorkflowQuotaCreate, WorkflowTemplateQuota, WorkflowTemplateQuotaBase, WorkflowTemplateQuotaCreate, WorkflowTemplateScope, WorkflowTemplateStatus, isAPIError, validateAPIError, validateAddGroupEntitiesRequest, validateAgentChallengeRequest, validateAgentChallengeResponse, validateAgentGet200Response, validateAgentRegistrationRequest, validateAgentRegistrationResponse, validateAgentTokenRequest, validateAgentTokenResponse, validateCanVoteResponse, validateConcurrencyControl, validateGetEntityInfo200Response, validateGetWorkflowParams, validateGetWorkflowVotes200Response, validateGroupCreate, validateGroupInfo, validateGroupScope, validateHealthResponse, validateInitiateCliLogin200Response, validateInitiateCliLoginRequest, validateListAgents200Response, validateListAgentsParams, validateListGroupEntities200Response, validateListGroups200Response, validateListGroupsParams, validateListOrganizationAdminsForOrg200Response, validateListQuotasParams, validateListRoleTemplates200Response, validateListSpaces200Response, validateListSpacesParams, validateListUsers200Response, validateListUsersParams, validateListWorkflowTemplates200Response, validateListWorkflowTemplatesParams, validateListWorkflowVotesParams, validateListWorkflows200Response, validateListWorkflowsParams, validateOidcCallbackRequest, validateOrganizationAdminCreate, validateOrganizationAdminRemove, validatePagination, validatePrivilegedTokenExchangeRequest, validatePrivilegedTokenResponse, validateQuotaCreate, validateQuotaUpdate, validateRefreshTokenRequest, validateRemoveGroupEntitiesRequest, validateRoleAssignmentRequest, validateRoleOperationItem, validateRoleRemovalRequest, validateRoleScope, validateSharedListParams, validateSpaceCreate, validateSpaceScope, validateTokenRequest, validateTokenResponse, validateUser, validateUserCreate, validateWorkflowCreate, validateWorkflowTemplate, validateWorkflowTemplateCreate, validateWorkflowTemplateDeprecate, validateWorkflowTemplateScope, validateWorkflowTemplateUpdate, validateWorkflowVoteRequest };
|