@approvio/api 0.0.45 → 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 +283 -199
- package/dist/src/index.d.cts +124 -215
- package/dist/src/index.d.mts +124 -215
- package/dist/src/index.mjs +270 -200
- 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) {
|
|
@@ -315,8 +331,11 @@ function isStringBigInt(value) {
|
|
|
315
331
|
}
|
|
316
332
|
return true;
|
|
317
333
|
}
|
|
318
|
-
const
|
|
319
|
-
const
|
|
334
|
+
const UUID_REGEX_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
335
|
+
const UUID_REGEX_V7 = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
336
|
+
const isUUIDv4 = (value) => value.match(UUID_REGEX_V4) !== null;
|
|
337
|
+
const isUUIDv7 = (value) => value.match(UUID_REGEX_V7) !== null;
|
|
338
|
+
const isValidUUID = (value) => isUUIDv7(value) || isUUIDv4(value);
|
|
320
339
|
//#endregion
|
|
321
340
|
//#region src/validators/auth.validators.ts
|
|
322
341
|
function validateTokenResponse(object) {
|
|
@@ -554,74 +573,6 @@ function validateListGroupEntities200Response(object) {
|
|
|
554
573
|
});
|
|
555
574
|
}
|
|
556
575
|
//#endregion
|
|
557
|
-
//#region src/validators/common.validators.ts
|
|
558
|
-
function validateSharedListParams(object) {
|
|
559
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
560
|
-
const result = {};
|
|
561
|
-
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
562
|
-
let page = object.page;
|
|
563
|
-
if (typeof page === "string" && page.trim() !== "") {
|
|
564
|
-
const parsed = Number(page);
|
|
565
|
-
if (!isNaN(parsed)) page = parsed;
|
|
566
|
-
}
|
|
567
|
-
if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return left("invalid_page");
|
|
568
|
-
result.page = page;
|
|
569
|
-
}
|
|
570
|
-
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
571
|
-
let limit = object.limit;
|
|
572
|
-
if (typeof limit === "string" && limit.trim() !== "") {
|
|
573
|
-
const parsed = Number(limit);
|
|
574
|
-
if (!isNaN(parsed)) limit = parsed;
|
|
575
|
-
}
|
|
576
|
-
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return left("invalid_limit");
|
|
577
|
-
result.limit = limit;
|
|
578
|
-
}
|
|
579
|
-
if (hasOwnProperty(object, "search") && object.search !== void 0) {
|
|
580
|
-
if (typeof object.search !== "string") return left("invalid_search");
|
|
581
|
-
result.search = object.search;
|
|
582
|
-
}
|
|
583
|
-
return right(result);
|
|
584
|
-
}
|
|
585
|
-
function validatePagination(object) {
|
|
586
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
587
|
-
if (!hasOwnProperty(object, "total")) return left("missing_total");
|
|
588
|
-
if (!isNumber(object.total) || object.total < 0) return left("invalid_total");
|
|
589
|
-
if (!hasOwnProperty(object, "page")) return left("missing_page");
|
|
590
|
-
if (!isNumber(object.page) || object.page < 0) return left("invalid_page");
|
|
591
|
-
if (!hasOwnProperty(object, "limit")) return left("missing_limit");
|
|
592
|
-
if (!isNumber(object.limit) || object.limit < 1) return left("invalid_limit");
|
|
593
|
-
return right({
|
|
594
|
-
total: object.total,
|
|
595
|
-
page: object.page,
|
|
596
|
-
limit: object.limit
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
function validateHealthResponse(object) {
|
|
600
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
601
|
-
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return left(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
602
|
-
const result = { status: object.status };
|
|
603
|
-
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
604
|
-
if (typeof object.message !== "string") return left("invalid_message");
|
|
605
|
-
result.message = object.message;
|
|
606
|
-
}
|
|
607
|
-
return right(result);
|
|
608
|
-
}
|
|
609
|
-
function validateGetEntityInfo200Response(object) {
|
|
610
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
611
|
-
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return left(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
612
|
-
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return left(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
613
|
-
const groups = [];
|
|
614
|
-
for (const item of object.groups) {
|
|
615
|
-
const validatedItem = validateGroupInfo(item);
|
|
616
|
-
if (isLeft(validatedItem)) return left("invalid_groups");
|
|
617
|
-
groups.push(validatedItem.right);
|
|
618
|
-
}
|
|
619
|
-
return right({
|
|
620
|
-
entityType: object.entityType,
|
|
621
|
-
groups
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
//#endregion
|
|
625
576
|
//#region src/utils/types.ts
|
|
626
577
|
function prefixLeft(prefix, value) {
|
|
627
578
|
return `${prefix}_${value}`;
|
|
@@ -1017,6 +968,251 @@ function validateConcurrencyControl(object) {
|
|
|
1017
968
|
return right({ version: object.version });
|
|
1018
969
|
}
|
|
1019
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
|
|
1020
1216
|
//#region src/validators/workflow.validators.ts
|
|
1021
1217
|
function validateWorkflowCreate(object) {
|
|
1022
1218
|
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
@@ -1139,7 +1335,7 @@ function validateListWorkflowsParams(object) {
|
|
|
1139
1335
|
const validatedIncludeGroups = [];
|
|
1140
1336
|
for (const item of includeGroupsVal) {
|
|
1141
1337
|
if (typeof item !== "string") return left("invalid_include_groups");
|
|
1142
|
-
if (!
|
|
1338
|
+
if (!isValidUUID(item)) return left("invalid_include_groups");
|
|
1143
1339
|
validatedIncludeGroups.push(item);
|
|
1144
1340
|
}
|
|
1145
1341
|
includeGroups = validatedIncludeGroups;
|
|
@@ -1336,132 +1532,6 @@ function validateListWorkflowVotesParams(object) {
|
|
|
1336
1532
|
return right(result);
|
|
1337
1533
|
}
|
|
1338
1534
|
//#endregion
|
|
1339
|
-
//#region src/validators/users.validators.ts
|
|
1340
|
-
function validateUser(object) {
|
|
1341
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1342
|
-
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
1343
|
-
if (!isNonEmptyString(object.id)) return left("invalid_id");
|
|
1344
|
-
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1345
|
-
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1346
|
-
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1347
|
-
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1348
|
-
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
1349
|
-
if (!isNonEmptyString(object.orgRole)) return left("invalid_org_role");
|
|
1350
|
-
if (!hasOwnProperty(object, "createdAt")) return left("missing_created_at");
|
|
1351
|
-
if (!isNonEmptyString(object.createdAt)) return left("invalid_created_at");
|
|
1352
|
-
return right({
|
|
1353
|
-
id: object.id,
|
|
1354
|
-
displayName: object.displayName,
|
|
1355
|
-
email: object.email,
|
|
1356
|
-
orgRole: object.orgRole,
|
|
1357
|
-
createdAt: object.createdAt
|
|
1358
|
-
});
|
|
1359
|
-
}
|
|
1360
|
-
function validateUserCreate(object) {
|
|
1361
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1362
|
-
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1363
|
-
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1364
|
-
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1365
|
-
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1366
|
-
if (!hasOwnProperty(object, "orgRole")) return left("missing_org_role");
|
|
1367
|
-
if (!isNonEmptyString(object.orgRole)) return left("invalid_org_role");
|
|
1368
|
-
return right({
|
|
1369
|
-
displayName: object.displayName,
|
|
1370
|
-
email: object.email,
|
|
1371
|
-
orgRole: object.orgRole
|
|
1372
|
-
});
|
|
1373
|
-
}
|
|
1374
|
-
function validateUserSummary(object) {
|
|
1375
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1376
|
-
if (!hasOwnProperty(object, "id")) return left("missing_id");
|
|
1377
|
-
if (!isNonEmptyString(object.id)) return left("invalid_id");
|
|
1378
|
-
if (!hasOwnProperty(object, "displayName")) return left("missing_display_name");
|
|
1379
|
-
if (!isNonEmptyString(object.displayName)) return left("invalid_display_name");
|
|
1380
|
-
if (!hasOwnProperty(object, "email")) return left("missing_email");
|
|
1381
|
-
if (!isNonEmptyString(object.email)) return left("invalid_email");
|
|
1382
|
-
return right({
|
|
1383
|
-
id: object.id,
|
|
1384
|
-
displayName: object.displayName,
|
|
1385
|
-
email: object.email
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
function validateListUsers200Response(object) {
|
|
1389
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1390
|
-
if (!hasOwnProperty(object, "users")) return left("missing_users");
|
|
1391
|
-
if (!isArray(object.users)) return left("invalid_users");
|
|
1392
|
-
for (const user of object.users) if (isLeft(validateUserSummary(user))) return left("invalid_users");
|
|
1393
|
-
if (!hasOwnProperty(object, "pagination")) return left("missing_pagination");
|
|
1394
|
-
const paginationValidation = validatePagination(object.pagination);
|
|
1395
|
-
if (isLeft(paginationValidation)) return left("invalid_pagination");
|
|
1396
|
-
const users = [];
|
|
1397
|
-
for (const user of object.users) {
|
|
1398
|
-
const validatedUser = validateUserSummary(user);
|
|
1399
|
-
if (isRight(validatedUser)) users.push(validatedUser.right);
|
|
1400
|
-
}
|
|
1401
|
-
return right({
|
|
1402
|
-
users,
|
|
1403
|
-
pagination: paginationValidation.right
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
function validateRoleScope(object) {
|
|
1407
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1408
|
-
if (!hasOwnProperty(object, "type")) return left("missing_type");
|
|
1409
|
-
if (object.type === "org") return right({ type: "org" });
|
|
1410
|
-
else if (object.type === "space") {
|
|
1411
|
-
if (!hasOwnProperty(object, "spaceId")) return left("missing_space_id");
|
|
1412
|
-
if (!isNonEmptyString(object.spaceId)) return left("invalid_space_id");
|
|
1413
|
-
return right({
|
|
1414
|
-
type: "space",
|
|
1415
|
-
spaceId: object.spaceId
|
|
1416
|
-
});
|
|
1417
|
-
} else if (object.type === "group") {
|
|
1418
|
-
if (!hasOwnProperty(object, "groupId")) return left("missing_group_id");
|
|
1419
|
-
if (!isNonEmptyString(object.groupId)) return left("invalid_group_id");
|
|
1420
|
-
return right({
|
|
1421
|
-
type: "group",
|
|
1422
|
-
groupId: object.groupId
|
|
1423
|
-
});
|
|
1424
|
-
} else if (object.type === "workflow_template") {
|
|
1425
|
-
if (!hasOwnProperty(object, "workflowTemplateId")) return left("missing_workflow_template_id");
|
|
1426
|
-
if (!isNonEmptyString(object.workflowTemplateId)) return left("invalid_workflow_template_id");
|
|
1427
|
-
return right({
|
|
1428
|
-
type: "workflow_template",
|
|
1429
|
-
workflowTemplateId: object.workflowTemplateId
|
|
1430
|
-
});
|
|
1431
|
-
}
|
|
1432
|
-
return left("invalid_type");
|
|
1433
|
-
}
|
|
1434
|
-
function validateRoleOperationItem(object) {
|
|
1435
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1436
|
-
if (!hasOwnProperty(object, "roleName")) return left("missing_role_name");
|
|
1437
|
-
if (!isNonEmptyString(object.roleName)) return left("invalid_role_name");
|
|
1438
|
-
if (!hasOwnProperty(object, "scope")) return left("missing_scope");
|
|
1439
|
-
const scopeValidation = validateRoleScope(object.scope);
|
|
1440
|
-
if (isLeft(scopeValidation)) return left("invalid_scope");
|
|
1441
|
-
return right({
|
|
1442
|
-
roleName: object.roleName,
|
|
1443
|
-
scope: scopeValidation.right
|
|
1444
|
-
});
|
|
1445
|
-
}
|
|
1446
|
-
function validateRoleAssignmentRequest(object) {
|
|
1447
|
-
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
1448
|
-
if (!hasOwnProperty(object, "roles")) return left("missing_roles");
|
|
1449
|
-
if (!isArray(object.roles)) return left("invalid_roles");
|
|
1450
|
-
const roles = [];
|
|
1451
|
-
for (const role of object.roles) {
|
|
1452
|
-
const roleValidation = validateRoleOperationItem(role);
|
|
1453
|
-
if (isLeft(roleValidation)) return left("invalid_roles");
|
|
1454
|
-
roles.push(roleValidation.right);
|
|
1455
|
-
}
|
|
1456
|
-
return right({ roles });
|
|
1457
|
-
}
|
|
1458
|
-
function validateRoleRemovalRequest(object) {
|
|
1459
|
-
return validateRoleAssignmentRequest(object);
|
|
1460
|
-
}
|
|
1461
|
-
function validateListUsersParams(object) {
|
|
1462
|
-
return validateSharedListParams(object);
|
|
1463
|
-
}
|
|
1464
|
-
//#endregion
|
|
1465
1535
|
//#region src/validators/spaces.validators.ts
|
|
1466
1536
|
function validateSpace(object) {
|
|
1467
1537
|
if (typeof object !== "object" || object === null) return left("malformed_object");
|
|
@@ -1744,7 +1814,7 @@ function validateQuotaCreate(object) {
|
|
|
1744
1814
|
const scope = getStringAsEnum(scopeStr, QuotaScope);
|
|
1745
1815
|
if (!scope) return left("invalid_scope");
|
|
1746
1816
|
if (!hasOwnProperty(object, "targetId")) return left("missing_targetId");
|
|
1747
|
-
if (!isNonEmptyString(object.targetId) || !
|
|
1817
|
+
if (!isNonEmptyString(object.targetId) || !isValidUUID(object.targetId)) return left("invalid_targetId");
|
|
1748
1818
|
const targetId = object.targetId;
|
|
1749
1819
|
const quotaType = getStringAsEnum(quotaTypeStr, QUOTA_TYPE_ENUM_BY_SCOPE[scope]);
|
|
1750
1820
|
if (quotaType === void 0) return left("invalid_scope_quotaType_combination");
|
|
@@ -1773,7 +1843,7 @@ function validateListQuotasParams(object) {
|
|
|
1773
1843
|
result.scope = scope;
|
|
1774
1844
|
}
|
|
1775
1845
|
if (hasOwnProperty(object, "targetId") && object.targetId !== void 0) {
|
|
1776
|
-
if (!isNonEmptyString(object.targetId) || !
|
|
1846
|
+
if (!isNonEmptyString(object.targetId) || !isValidUUID(object.targetId)) return left("invalid_targetId");
|
|
1777
1847
|
result.targetId = object.targetId;
|
|
1778
1848
|
}
|
|
1779
1849
|
if (hasOwnProperty(object, "quotaType") && object.quotaType !== void 0) {
|
|
@@ -1785,4 +1855,4 @@ function validateListQuotasParams(object) {
|
|
|
1785
1855
|
return right(result);
|
|
1786
1856
|
}
|
|
1787
1857
|
//#endregion
|
|
1788
|
-
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 };
|