@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.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) {
|
|
@@ -339,8 +355,11 @@ function isStringBigInt(value) {
|
|
|
339
355
|
}
|
|
340
356
|
return true;
|
|
341
357
|
}
|
|
342
|
-
const
|
|
343
|
-
const
|
|
358
|
+
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;
|
|
359
|
+
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;
|
|
360
|
+
const isUUIDv4 = (value) => value.match(UUID_REGEX_V4) !== null;
|
|
361
|
+
const isUUIDv7 = (value) => value.match(UUID_REGEX_V7) !== null;
|
|
362
|
+
const isValidUUID = (value) => isUUIDv7(value) || isUUIDv4(value);
|
|
344
363
|
//#endregion
|
|
345
364
|
//#region src/validators/auth.validators.ts
|
|
346
365
|
function validateTokenResponse(object) {
|
|
@@ -578,74 +597,6 @@ function validateListGroupEntities200Response(object) {
|
|
|
578
597
|
});
|
|
579
598
|
}
|
|
580
599
|
//#endregion
|
|
581
|
-
//#region src/validators/common.validators.ts
|
|
582
|
-
function validateSharedListParams(object) {
|
|
583
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
584
|
-
const result = {};
|
|
585
|
-
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
586
|
-
let page = object.page;
|
|
587
|
-
if (typeof page === "string" && page.trim() !== "") {
|
|
588
|
-
const parsed = Number(page);
|
|
589
|
-
if (!isNaN(parsed)) page = parsed;
|
|
590
|
-
}
|
|
591
|
-
if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return (0, fp_ts_Either.left)("invalid_page");
|
|
592
|
-
result.page = page;
|
|
593
|
-
}
|
|
594
|
-
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
595
|
-
let limit = object.limit;
|
|
596
|
-
if (typeof limit === "string" && limit.trim() !== "") {
|
|
597
|
-
const parsed = Number(limit);
|
|
598
|
-
if (!isNaN(parsed)) limit = parsed;
|
|
599
|
-
}
|
|
600
|
-
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
601
|
-
result.limit = limit;
|
|
602
|
-
}
|
|
603
|
-
if (hasOwnProperty(object, "search") && object.search !== void 0) {
|
|
604
|
-
if (typeof object.search !== "string") return (0, fp_ts_Either.left)("invalid_search");
|
|
605
|
-
result.search = object.search;
|
|
606
|
-
}
|
|
607
|
-
return (0, fp_ts_Either.right)(result);
|
|
608
|
-
}
|
|
609
|
-
function validatePagination(object) {
|
|
610
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
611
|
-
if (!hasOwnProperty(object, "total")) return (0, fp_ts_Either.left)("missing_total");
|
|
612
|
-
if (!isNumber(object.total) || object.total < 0) return (0, fp_ts_Either.left)("invalid_total");
|
|
613
|
-
if (!hasOwnProperty(object, "page")) return (0, fp_ts_Either.left)("missing_page");
|
|
614
|
-
if (!isNumber(object.page) || object.page < 0) return (0, fp_ts_Either.left)("invalid_page");
|
|
615
|
-
if (!hasOwnProperty(object, "limit")) return (0, fp_ts_Either.left)("missing_limit");
|
|
616
|
-
if (!isNumber(object.limit) || object.limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
617
|
-
return (0, fp_ts_Either.right)({
|
|
618
|
-
total: object.total,
|
|
619
|
-
page: object.page,
|
|
620
|
-
limit: object.limit
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
function validateHealthResponse(object) {
|
|
624
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
625
|
-
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
626
|
-
const result = { status: object.status };
|
|
627
|
-
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
628
|
-
if (typeof object.message !== "string") return (0, fp_ts_Either.left)("invalid_message");
|
|
629
|
-
result.message = object.message;
|
|
630
|
-
}
|
|
631
|
-
return (0, fp_ts_Either.right)(result);
|
|
632
|
-
}
|
|
633
|
-
function validateGetEntityInfo200Response(object) {
|
|
634
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
635
|
-
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
636
|
-
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
637
|
-
const groups = [];
|
|
638
|
-
for (const item of object.groups) {
|
|
639
|
-
const validatedItem = validateGroupInfo(item);
|
|
640
|
-
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
641
|
-
groups.push(validatedItem.right);
|
|
642
|
-
}
|
|
643
|
-
return (0, fp_ts_Either.right)({
|
|
644
|
-
entityType: object.entityType,
|
|
645
|
-
groups
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
//#endregion
|
|
649
600
|
//#region src/utils/types.ts
|
|
650
601
|
function prefixLeft(prefix, value) {
|
|
651
602
|
return `${prefix}_${value}`;
|
|
@@ -1041,6 +992,251 @@ function validateConcurrencyControl(object) {
|
|
|
1041
992
|
return (0, fp_ts_Either.right)({ version: object.version });
|
|
1042
993
|
}
|
|
1043
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
|
|
1044
1240
|
//#region src/validators/workflow.validators.ts
|
|
1045
1241
|
function validateWorkflowCreate(object) {
|
|
1046
1242
|
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
@@ -1163,7 +1359,7 @@ function validateListWorkflowsParams(object) {
|
|
|
1163
1359
|
const validatedIncludeGroups = [];
|
|
1164
1360
|
for (const item of includeGroupsVal) {
|
|
1165
1361
|
if (typeof item !== "string") return (0, fp_ts_Either.left)("invalid_include_groups");
|
|
1166
|
-
if (!
|
|
1362
|
+
if (!isValidUUID(item)) return (0, fp_ts_Either.left)("invalid_include_groups");
|
|
1167
1363
|
validatedIncludeGroups.push(item);
|
|
1168
1364
|
}
|
|
1169
1365
|
includeGroups = validatedIncludeGroups;
|
|
@@ -1360,132 +1556,6 @@ function validateListWorkflowVotesParams(object) {
|
|
|
1360
1556
|
return (0, fp_ts_Either.right)(result);
|
|
1361
1557
|
}
|
|
1362
1558
|
//#endregion
|
|
1363
|
-
//#region src/validators/users.validators.ts
|
|
1364
|
-
function validateUser(object) {
|
|
1365
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1366
|
-
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1367
|
-
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1368
|
-
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1369
|
-
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1370
|
-
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1371
|
-
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1372
|
-
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1373
|
-
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1374
|
-
if (!hasOwnProperty(object, "createdAt")) return (0, fp_ts_Either.left)("missing_created_at");
|
|
1375
|
-
if (!isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
1376
|
-
return (0, fp_ts_Either.right)({
|
|
1377
|
-
id: object.id,
|
|
1378
|
-
displayName: object.displayName,
|
|
1379
|
-
email: object.email,
|
|
1380
|
-
orgRole: object.orgRole,
|
|
1381
|
-
createdAt: object.createdAt
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
function validateUserCreate(object) {
|
|
1385
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1386
|
-
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1387
|
-
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1388
|
-
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1389
|
-
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1390
|
-
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1391
|
-
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1392
|
-
return (0, fp_ts_Either.right)({
|
|
1393
|
-
displayName: object.displayName,
|
|
1394
|
-
email: object.email,
|
|
1395
|
-
orgRole: object.orgRole
|
|
1396
|
-
});
|
|
1397
|
-
}
|
|
1398
|
-
function validateUserSummary(object) {
|
|
1399
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1400
|
-
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1401
|
-
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1402
|
-
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1403
|
-
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1404
|
-
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1405
|
-
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1406
|
-
return (0, fp_ts_Either.right)({
|
|
1407
|
-
id: object.id,
|
|
1408
|
-
displayName: object.displayName,
|
|
1409
|
-
email: object.email
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
function validateListUsers200Response(object) {
|
|
1413
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1414
|
-
if (!hasOwnProperty(object, "users")) return (0, fp_ts_Either.left)("missing_users");
|
|
1415
|
-
if (!isArray(object.users)) return (0, fp_ts_Either.left)("invalid_users");
|
|
1416
|
-
for (const user of object.users) if ((0, fp_ts_Either.isLeft)(validateUserSummary(user))) return (0, fp_ts_Either.left)("invalid_users");
|
|
1417
|
-
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1418
|
-
const paginationValidation = validatePagination(object.pagination);
|
|
1419
|
-
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1420
|
-
const users = [];
|
|
1421
|
-
for (const user of object.users) {
|
|
1422
|
-
const validatedUser = validateUserSummary(user);
|
|
1423
|
-
if ((0, fp_ts_Either.isRight)(validatedUser)) users.push(validatedUser.right);
|
|
1424
|
-
}
|
|
1425
|
-
return (0, fp_ts_Either.right)({
|
|
1426
|
-
users,
|
|
1427
|
-
pagination: paginationValidation.right
|
|
1428
|
-
});
|
|
1429
|
-
}
|
|
1430
|
-
function validateRoleScope(object) {
|
|
1431
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1432
|
-
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("missing_type");
|
|
1433
|
-
if (object.type === "org") return (0, fp_ts_Either.right)({ type: "org" });
|
|
1434
|
-
else if (object.type === "space") {
|
|
1435
|
-
if (!hasOwnProperty(object, "spaceId")) return (0, fp_ts_Either.left)("missing_space_id");
|
|
1436
|
-
if (!isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
1437
|
-
return (0, fp_ts_Either.right)({
|
|
1438
|
-
type: "space",
|
|
1439
|
-
spaceId: object.spaceId
|
|
1440
|
-
});
|
|
1441
|
-
} else if (object.type === "group") {
|
|
1442
|
-
if (!hasOwnProperty(object, "groupId")) return (0, fp_ts_Either.left)("missing_group_id");
|
|
1443
|
-
if (!isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)("invalid_group_id");
|
|
1444
|
-
return (0, fp_ts_Either.right)({
|
|
1445
|
-
type: "group",
|
|
1446
|
-
groupId: object.groupId
|
|
1447
|
-
});
|
|
1448
|
-
} else if (object.type === "workflow_template") {
|
|
1449
|
-
if (!hasOwnProperty(object, "workflowTemplateId")) return (0, fp_ts_Either.left)("missing_workflow_template_id");
|
|
1450
|
-
if (!isNonEmptyString(object.workflowTemplateId)) return (0, fp_ts_Either.left)("invalid_workflow_template_id");
|
|
1451
|
-
return (0, fp_ts_Either.right)({
|
|
1452
|
-
type: "workflow_template",
|
|
1453
|
-
workflowTemplateId: object.workflowTemplateId
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
return (0, fp_ts_Either.left)("invalid_type");
|
|
1457
|
-
}
|
|
1458
|
-
function validateRoleOperationItem(object) {
|
|
1459
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1460
|
-
if (!hasOwnProperty(object, "roleName")) return (0, fp_ts_Either.left)("missing_role_name");
|
|
1461
|
-
if (!isNonEmptyString(object.roleName)) return (0, fp_ts_Either.left)("invalid_role_name");
|
|
1462
|
-
if (!hasOwnProperty(object, "scope")) return (0, fp_ts_Either.left)("missing_scope");
|
|
1463
|
-
const scopeValidation = validateRoleScope(object.scope);
|
|
1464
|
-
if ((0, fp_ts_Either.isLeft)(scopeValidation)) return (0, fp_ts_Either.left)("invalid_scope");
|
|
1465
|
-
return (0, fp_ts_Either.right)({
|
|
1466
|
-
roleName: object.roleName,
|
|
1467
|
-
scope: scopeValidation.right
|
|
1468
|
-
});
|
|
1469
|
-
}
|
|
1470
|
-
function validateRoleAssignmentRequest(object) {
|
|
1471
|
-
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1472
|
-
if (!hasOwnProperty(object, "roles")) return (0, fp_ts_Either.left)("missing_roles");
|
|
1473
|
-
if (!isArray(object.roles)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1474
|
-
const roles = [];
|
|
1475
|
-
for (const role of object.roles) {
|
|
1476
|
-
const roleValidation = validateRoleOperationItem(role);
|
|
1477
|
-
if ((0, fp_ts_Either.isLeft)(roleValidation)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1478
|
-
roles.push(roleValidation.right);
|
|
1479
|
-
}
|
|
1480
|
-
return (0, fp_ts_Either.right)({ roles });
|
|
1481
|
-
}
|
|
1482
|
-
function validateRoleRemovalRequest(object) {
|
|
1483
|
-
return validateRoleAssignmentRequest(object);
|
|
1484
|
-
}
|
|
1485
|
-
function validateListUsersParams(object) {
|
|
1486
|
-
return validateSharedListParams(object);
|
|
1487
|
-
}
|
|
1488
|
-
//#endregion
|
|
1489
1559
|
//#region src/validators/spaces.validators.ts
|
|
1490
1560
|
function validateSpace(object) {
|
|
1491
1561
|
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
@@ -1768,7 +1838,7 @@ function validateQuotaCreate(object) {
|
|
|
1768
1838
|
const scope = getStringAsEnum(scopeStr, QuotaScope);
|
|
1769
1839
|
if (!scope) return (0, fp_ts_Either.left)("invalid_scope");
|
|
1770
1840
|
if (!hasOwnProperty(object, "targetId")) return (0, fp_ts_Either.left)("missing_targetId");
|
|
1771
|
-
if (!isNonEmptyString(object.targetId) || !
|
|
1841
|
+
if (!isNonEmptyString(object.targetId) || !isValidUUID(object.targetId)) return (0, fp_ts_Either.left)("invalid_targetId");
|
|
1772
1842
|
const targetId = object.targetId;
|
|
1773
1843
|
const quotaType = getStringAsEnum(quotaTypeStr, QUOTA_TYPE_ENUM_BY_SCOPE[scope]);
|
|
1774
1844
|
if (quotaType === void 0) return (0, fp_ts_Either.left)("invalid_scope_quotaType_combination");
|
|
@@ -1797,7 +1867,7 @@ function validateListQuotasParams(object) {
|
|
|
1797
1867
|
result.scope = scope;
|
|
1798
1868
|
}
|
|
1799
1869
|
if (hasOwnProperty(object, "targetId") && object.targetId !== void 0) {
|
|
1800
|
-
if (!isNonEmptyString(object.targetId) || !
|
|
1870
|
+
if (!isNonEmptyString(object.targetId) || !isValidUUID(object.targetId)) return (0, fp_ts_Either.left)("invalid_targetId");
|
|
1801
1871
|
result.targetId = object.targetId;
|
|
1802
1872
|
}
|
|
1803
1873
|
if (hasOwnProperty(object, "quotaType") && object.quotaType !== void 0) {
|
|
@@ -1827,6 +1897,18 @@ Object.defineProperty(exports, "EmailAction", {
|
|
|
1827
1897
|
return EmailAction;
|
|
1828
1898
|
}
|
|
1829
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
|
+
});
|
|
1830
1912
|
Object.defineProperty(exports, "GroupQuota", {
|
|
1831
1913
|
enumerable: true,
|
|
1832
1914
|
get: function() {
|
|
@@ -2061,7 +2143,9 @@ exports.validateQuotaUpdate = validateQuotaUpdate;
|
|
|
2061
2143
|
exports.validateRefreshTokenRequest = validateRefreshTokenRequest;
|
|
2062
2144
|
exports.validateRemoveGroupEntitiesRequest = validateRemoveGroupEntitiesRequest;
|
|
2063
2145
|
exports.validateRoleAssignmentRequest = validateRoleAssignmentRequest;
|
|
2146
|
+
exports.validateRoleOperationItem = validateRoleOperationItem;
|
|
2064
2147
|
exports.validateRoleRemovalRequest = validateRoleRemovalRequest;
|
|
2148
|
+
exports.validateRoleScope = validateRoleScope;
|
|
2065
2149
|
exports.validateSharedListParams = validateSharedListParams;
|
|
2066
2150
|
exports.validateSpaceCreate = validateSpaceCreate;
|
|
2067
2151
|
exports.validateSpaceScope = validateSpaceScope;
|