@approvio/api 0.0.30 → 0.0.31
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 +12 -1
- package/dist/mocks/index.cjs +137 -0
- package/dist/mocks/index.d.cts +44 -0
- package/dist/mocks/index.d.mts +44 -0
- package/dist/mocks/index.mjs +118 -0
- package/dist/src/index.cjs +1494 -0
- package/dist/src/index.d.cts +1434 -0
- package/dist/src/index.d.mts +1434 -0
- package/dist/src/index.mjs +1356 -0
- package/dist/workflow-create-DVgNnx0X.d.mts +506 -0
- package/dist/workflow-create-Dgj7wWZs.d.cts +506 -0
- package/package.json +53 -13
- package/dist/add-group-entities-request.d.ts +0 -21
- package/dist/add-group-entities-request.js +0 -3
- package/dist/add-group-entities-request.js.map +0 -1
- package/dist/agent-challenge-request.d.ts +0 -17
- package/dist/agent-challenge-request.js +0 -14
- package/dist/agent-challenge-request.js.map +0 -1
- package/dist/agent-challenge-response.d.ts +0 -17
- package/dist/agent-challenge-response.js +0 -14
- package/dist/agent-challenge-response.js.map +0 -1
- package/dist/agent-get200-response.d.ts +0 -29
- package/dist/agent-get200-response.js +0 -14
- package/dist/agent-get200-response.js.map +0 -1
- package/dist/agent-registration-request.d.ts +0 -17
- package/dist/agent-registration-request.js +0 -14
- package/dist/agent-registration-request.js.map +0 -1
- package/dist/agent-registration-response.d.ts +0 -33
- package/dist/agent-registration-response.js +0 -14
- package/dist/agent-registration-response.js.map +0 -1
- package/dist/agent-summary.d.ts +0 -21
- package/dist/agent-summary.js +0 -14
- package/dist/agent-summary.js.map +0 -1
- package/dist/agent-token-request.d.ts +0 -35
- package/dist/agent-token-request.js +0 -24
- package/dist/agent-token-request.js.map +0 -1
- package/dist/agent-token-response.d.ts +0 -21
- package/dist/agent-token-response.js +0 -14
- package/dist/agent-token-response.js.map +0 -1
- package/dist/and-rule.d.ts +0 -31
- package/dist/and-rule.js +0 -10
- package/dist/and-rule.js.map +0 -1
- package/dist/api-error-details-inner.d.ts +0 -15
- package/dist/api-error-details-inner.js +0 -14
- package/dist/api-error-details-inner.js.map +0 -1
- package/dist/api-error.d.ts +0 -23
- package/dist/api-error.js +0 -3
- package/dist/api-error.js.map +0 -1
- package/dist/approval-rule.d.ts +0 -23
- package/dist/approval-rule.js +0 -3
- package/dist/approval-rule.js.map +0 -1
- package/dist/can-vote-response.d.ts +0 -29
- package/dist/can-vote-response.js +0 -14
- package/dist/can-vote-response.js.map +0 -1
- package/dist/email-action.d.ts +0 -30
- package/dist/email-action.js +0 -21
- package/dist/email-action.js.map +0 -1
- package/dist/entity-membership-add.d.ts +0 -15
- package/dist/entity-membership-add.js +0 -3
- package/dist/entity-membership-add.js.map +0 -1
- package/dist/entity-membership-remove.d.ts +0 -15
- package/dist/entity-membership-remove.js +0 -3
- package/dist/entity-membership-remove.js.map +0 -1
- package/dist/entity-reference.d.ts +0 -21
- package/dist/entity-reference.js +0 -14
- package/dist/entity-reference.js.map +0 -1
- package/dist/failed-auth-response.d.ts +0 -17
- package/dist/failed-auth-response.js +0 -14
- package/dist/failed-auth-response.js.map +0 -1
- package/dist/get-entity-info-200-response.d.ts +0 -19
- package/dist/get-entity-info-200-response.js +0 -3
- package/dist/get-entity-info-200-response.js.map +0 -1
- package/dist/get-workflow-params.d.ts +0 -17
- package/dist/get-workflow-params.js +0 -14
- package/dist/get-workflow-params.js.map +0 -1
- package/dist/get-workflow-votes-200-response.d.ts +0 -15
- package/dist/get-workflow-votes-200-response.js +0 -3
- package/dist/get-workflow-votes-200-response.js.map +0 -1
- package/dist/group-create.d.ts +0 -21
- package/dist/group-create.js +0 -14
- package/dist/group-create.js.map +0 -1
- package/dist/group-info.d.ts +0 -15
- package/dist/group-info.js +0 -14
- package/dist/group-info.js.map +0 -1
- package/dist/group-membership.d.ts +0 -19
- package/dist/group-membership.js +0 -3
- package/dist/group-membership.js.map +0 -1
- package/dist/group-requirement-rule.d.ts +0 -38
- package/dist/group-requirement-rule.js +0 -21
- package/dist/group-requirement-rule.js.map +0 -1
- package/dist/group-scope.d.ts +0 -30
- package/dist/group-scope.js +0 -21
- package/dist/group-scope.js.map +0 -1
- package/dist/group.d.ts +0 -37
- package/dist/group.js +0 -14
- package/dist/group.js.map +0 -1
- package/dist/health-response.d.ts +0 -21
- package/dist/health-response.js +0 -14
- package/dist/health-response.js.map +0 -1
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -105
- package/dist/index.js.map +0 -1
- package/dist/initiate-cli-login-200-response.d.ts +0 -14
- package/dist/initiate-cli-login-200-response.js +0 -14
- package/dist/initiate-cli-login-200-response.js.map +0 -1
- package/dist/initiate-cli-login-request.d.ts +0 -17
- package/dist/initiate-cli-login-request.js +0 -14
- package/dist/initiate-cli-login-request.js.map +0 -1
- package/dist/list-agents-200-response.d.ts +0 -17
- package/dist/list-agents-200-response.js +0 -3
- package/dist/list-agents-200-response.js.map +0 -1
- package/dist/list-agents-params.d.ts +0 -21
- package/dist/list-agents-params.js +0 -14
- package/dist/list-agents-params.js.map +0 -1
- package/dist/list-group-entities-200-response.d.ts +0 -17
- package/dist/list-group-entities-200-response.js +0 -3
- package/dist/list-group-entities-200-response.js.map +0 -1
- package/dist/list-groups-200-response.d.ts +0 -17
- package/dist/list-groups-200-response.js +0 -3
- package/dist/list-groups-200-response.js.map +0 -1
- package/dist/list-organization-admins-for-org-200-response.d.ts +0 -17
- package/dist/list-organization-admins-for-org-200-response.js +0 -3
- package/dist/list-organization-admins-for-org-200-response.js.map +0 -1
- package/dist/list-role-templates-200-response.d.ts +0 -15
- package/dist/list-role-templates-200-response.js +0 -3
- package/dist/list-role-templates-200-response.js.map +0 -1
- package/dist/list-spaces-200-response.d.ts +0 -17
- package/dist/list-spaces-200-response.js +0 -3
- package/dist/list-spaces-200-response.js.map +0 -1
- package/dist/list-users-200-response.d.ts +0 -17
- package/dist/list-users-200-response.js +0 -3
- package/dist/list-users-200-response.js.map +0 -1
- package/dist/list-workflow-templates-200-response.d.ts +0 -17
- package/dist/list-workflow-templates-200-response.js +0 -3
- package/dist/list-workflow-templates-200-response.js.map +0 -1
- package/dist/list-workflow-templates-params.d.ts +0 -25
- package/dist/list-workflow-templates-params.js +0 -14
- package/dist/list-workflow-templates-params.js.map +0 -1
- package/dist/list-workflows-200-response.d.ts +0 -17
- package/dist/list-workflows-200-response.js +0 -3
- package/dist/list-workflows-200-response.js.map +0 -1
- package/dist/list-workflows-params.d.ts +0 -33
- package/dist/list-workflows-params.js +0 -14
- package/dist/list-workflows-params.js.map +0 -1
- package/dist/models.d.ts +0 -86
- package/dist/models.js +0 -103
- package/dist/models.js.map +0 -1
- package/dist/oidc-callback-request.d.ts +0 -21
- package/dist/oidc-callback-request.js +0 -14
- package/dist/oidc-callback-request.js.map +0 -1
- package/dist/or-rule.d.ts +0 -31
- package/dist/or-rule.js +0 -10
- package/dist/or-rule.js.map +0 -1
- package/dist/org-scope.d.ts +0 -26
- package/dist/org-scope.js +0 -21
- package/dist/org-scope.js.map +0 -1
- package/dist/organization-admin-create.d.ts +0 -17
- package/dist/organization-admin-create.js +0 -14
- package/dist/organization-admin-create.js.map +0 -1
- package/dist/organization-admin-remove.d.ts +0 -17
- package/dist/organization-admin-remove.js +0 -14
- package/dist/organization-admin-remove.js.map +0 -1
- package/dist/organization-admin.d.ts +0 -25
- package/dist/organization-admin.js +0 -14
- package/dist/organization-admin.js.map +0 -1
- package/dist/pagination.d.ts +0 -25
- package/dist/pagination.js +0 -14
- package/dist/pagination.js.map +0 -1
- package/dist/privileged-token-exchange-request.d.ts +0 -29
- package/dist/privileged-token-exchange-request.js +0 -14
- package/dist/privileged-token-exchange-request.js.map +0 -1
- package/dist/privileged-token-response.d.ts +0 -17
- package/dist/privileged-token-response.js +0 -14
- package/dist/privileged-token-response.js.map +0 -1
- package/dist/refresh-token-request.d.ts +0 -17
- package/dist/refresh-token-request.js +0 -14
- package/dist/refresh-token-request.js.map +0 -1
- package/dist/remove-group-entities-request.d.ts +0 -21
- package/dist/remove-group-entities-request.js +0 -3
- package/dist/remove-group-entities-request.js.map +0 -1
- package/dist/role-assignment-request.d.ts +0 -21
- package/dist/role-assignment-request.js +0 -3
- package/dist/role-assignment-request.js.map +0 -1
- package/dist/role-operation-item.d.ts +0 -22
- package/dist/role-operation-item.js +0 -3
- package/dist/role-operation-item.js.map +0 -1
- package/dist/role-operation-request.d.ts +0 -21
- package/dist/role-operation-request.js +0 -3
- package/dist/role-operation-request.js.map +0 -1
- package/dist/role-removal-request.d.ts +0 -21
- package/dist/role-removal-request.js +0 -3
- package/dist/role-removal-request.js.map +0 -1
- package/dist/role-scope.d.ts +0 -24
- package/dist/role-scope.js +0 -3
- package/dist/role-scope.js.map +0 -1
- package/dist/role-template.d.ts +0 -25
- package/dist/role-template.js +0 -14
- package/dist/role-template.js.map +0 -1
- package/dist/space-create.d.ts +0 -21
- package/dist/space-create.js +0 -14
- package/dist/space-create.js.map +0 -1
- package/dist/space-scope.d.ts +0 -30
- package/dist/space-scope.js +0 -21
- package/dist/space-scope.js.map +0 -1
- package/dist/space.d.ts +0 -33
- package/dist/space.js +0 -14
- package/dist/space.js.map +0 -1
- package/dist/successful-auth-response.d.ts +0 -29
- package/dist/successful-auth-response.js +0 -14
- package/dist/successful-auth-response.js.map +0 -1
- package/dist/token-request.d.ts +0 -21
- package/dist/token-request.js +0 -14
- package/dist/token-request.js.map +0 -1
- package/dist/token-response.d.ts +0 -21
- package/dist/token-response.js +0 -14
- package/dist/token-response.js.map +0 -1
- package/dist/user-create.d.ts +0 -25
- package/dist/user-create.js +0 -14
- package/dist/user-create.js.map +0 -1
- package/dist/user-summary.d.ts +0 -25
- package/dist/user-summary.js +0 -14
- package/dist/user-summary.js.map +0 -1
- package/dist/user.d.ts +0 -33
- package/dist/user.js +0 -14
- package/dist/user.js.map +0 -1
- package/dist/vote-approve.d.ts +0 -27
- package/dist/vote-approve.js +0 -21
- package/dist/vote-approve.js.map +0 -1
- package/dist/vote-veto.d.ts +0 -23
- package/dist/vote-veto.js +0 -21
- package/dist/vote-veto.js.map +0 -1
- package/dist/vote-withdraw.d.ts +0 -23
- package/dist/vote-withdraw.js +0 -21
- package/dist/vote-withdraw.js.map +0 -1
- package/dist/webhook-action.d.ts +0 -46
- package/dist/webhook-action.js +0 -26
- package/dist/webhook-action.js.map +0 -1
- package/dist/workflow-action.d.ts +0 -22
- package/dist/workflow-action.js +0 -3
- package/dist/workflow-action.js.map +0 -1
- package/dist/workflow-create.d.ts +0 -29
- package/dist/workflow-create.js +0 -14
- package/dist/workflow-create.js.map +0 -1
- package/dist/workflow-ref.d.ts +0 -18
- package/dist/workflow-ref.js +0 -3
- package/dist/workflow-ref.js.map +0 -1
- package/dist/workflow-template-create.d.ts +0 -40
- package/dist/workflow-template-create.js +0 -3
- package/dist/workflow-template-create.js.map +0 -1
- package/dist/workflow-template-deprecate.d.ts +0 -17
- package/dist/workflow-template-deprecate.js +0 -14
- package/dist/workflow-template-deprecate.js.map +0 -1
- package/dist/workflow-template-scope.d.ts +0 -30
- package/dist/workflow-template-scope.js +0 -21
- package/dist/workflow-template-scope.js.map +0 -1
- package/dist/workflow-template-summary.d.ts +0 -37
- package/dist/workflow-template-summary.js +0 -14
- package/dist/workflow-template-summary.js.map +0 -1
- package/dist/workflow-template-update.d.ts +0 -36
- package/dist/workflow-template-update.js +0 -3
- package/dist/workflow-template-update.js.map +0 -1
- package/dist/workflow-template.d.ts +0 -72
- package/dist/workflow-template.js +0 -12
- package/dist/workflow-template.js.map +0 -1
- package/dist/workflow-vote-request-vote-type.d.ts +0 -19
- package/dist/workflow-vote-request-vote-type.js +0 -3
- package/dist/workflow-vote-request-vote-type.js.map +0 -1
- package/dist/workflow-vote-request.d.ts +0 -19
- package/dist/workflow-vote-request.js +0 -3
- package/dist/workflow-vote-request.js.map +0 -1
- package/dist/workflow-vote.d.ts +0 -37
- package/dist/workflow-vote.js +0 -14
- package/dist/workflow-vote.js.map +0 -1
- package/dist/workflow.d.ts +0 -51
- package/dist/workflow.js +0 -3
- package/dist/workflow.js.map +0 -1
|
@@ -0,0 +1,1494 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let fp_ts_Either = require("fp-ts/Either");
|
|
3
|
+
//#region generated/openapi/model/agent-token-request.ts
|
|
4
|
+
let AgentTokenRequest;
|
|
5
|
+
(function(_AgentTokenRequest) {
|
|
6
|
+
_AgentTokenRequest.GrantTypeEnum = { UrnietfparamsoauthgrantTypejwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer" };
|
|
7
|
+
_AgentTokenRequest.ClientAssertionTypeEnum = { UrnietfparamsoauthclientAssertionTypejwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
|
|
8
|
+
})(AgentTokenRequest || (AgentTokenRequest = {}));
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region generated/openapi/model/and-rule.ts
|
|
11
|
+
let AndRule;
|
|
12
|
+
(function(_AndRule) {
|
|
13
|
+
_AndRule.TypeEnum = { And: "AND" };
|
|
14
|
+
})(AndRule || (AndRule = {}));
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region generated/openapi/model/email-action.ts
|
|
17
|
+
let EmailAction;
|
|
18
|
+
(function(_EmailAction) {
|
|
19
|
+
_EmailAction.TypeEnum = { Email: "EMAIL" };
|
|
20
|
+
})(EmailAction || (EmailAction = {}));
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region generated/openapi/model/group-requirement-rule.ts
|
|
23
|
+
let GroupRequirementRule;
|
|
24
|
+
(function(_GroupRequirementRule) {
|
|
25
|
+
_GroupRequirementRule.TypeEnum = { GroupRequirement: "GROUP_REQUIREMENT" };
|
|
26
|
+
})(GroupRequirementRule || (GroupRequirementRule = {}));
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region generated/openapi/model/group-scope.ts
|
|
29
|
+
let GroupScope;
|
|
30
|
+
(function(_GroupScope) {
|
|
31
|
+
_GroupScope.TypeEnum = { Group: "group" };
|
|
32
|
+
})(GroupScope || (GroupScope = {}));
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region generated/openapi/model/or-rule.ts
|
|
35
|
+
let OrRule;
|
|
36
|
+
(function(_OrRule) {
|
|
37
|
+
_OrRule.TypeEnum = { Or: "OR" };
|
|
38
|
+
})(OrRule || (OrRule = {}));
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region generated/openapi/model/org-scope.ts
|
|
41
|
+
let OrgScope;
|
|
42
|
+
(function(_OrgScope) {
|
|
43
|
+
_OrgScope.TypeEnum = { Org: "org" };
|
|
44
|
+
})(OrgScope || (OrgScope = {}));
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region generated/openapi/model/space-scope.ts
|
|
47
|
+
let SpaceScope;
|
|
48
|
+
(function(_SpaceScope) {
|
|
49
|
+
_SpaceScope.TypeEnum = { Space: "space" };
|
|
50
|
+
})(SpaceScope || (SpaceScope = {}));
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region generated/openapi/model/vote-approve.ts
|
|
53
|
+
let VoteApprove;
|
|
54
|
+
(function(_VoteApprove) {
|
|
55
|
+
_VoteApprove.TypeEnum = { Approve: "APPROVE" };
|
|
56
|
+
})(VoteApprove || (VoteApprove = {}));
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region generated/openapi/model/vote-veto.ts
|
|
59
|
+
let VoteVeto;
|
|
60
|
+
(function(_VoteVeto) {
|
|
61
|
+
_VoteVeto.TypeEnum = { Veto: "VETO" };
|
|
62
|
+
})(VoteVeto || (VoteVeto = {}));
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region generated/openapi/model/vote-withdraw.ts
|
|
65
|
+
let VoteWithdraw;
|
|
66
|
+
(function(_VoteWithdraw) {
|
|
67
|
+
_VoteWithdraw.TypeEnum = { Withdraw: "WITHDRAW" };
|
|
68
|
+
})(VoteWithdraw || (VoteWithdraw = {}));
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region generated/openapi/model/webhook-action.ts
|
|
71
|
+
let WebhookAction;
|
|
72
|
+
(function(_WebhookAction) {
|
|
73
|
+
_WebhookAction.TypeEnum = { Webhook: "WEBHOOK" };
|
|
74
|
+
_WebhookAction.MethodEnum = {
|
|
75
|
+
Post: "POST",
|
|
76
|
+
Put: "PUT",
|
|
77
|
+
Get: "GET"
|
|
78
|
+
};
|
|
79
|
+
})(WebhookAction || (WebhookAction = {}));
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region generated/openapi/model/workflow-template.ts
|
|
82
|
+
let WorkflowTemplate;
|
|
83
|
+
(function(_WorkflowTemplate) {
|
|
84
|
+
_WorkflowTemplate.StatusEnum = {
|
|
85
|
+
Active: "ACTIVE",
|
|
86
|
+
PendingDeprecation: "PENDING_DEPRECATION",
|
|
87
|
+
Deprecated: "DEPRECATED"
|
|
88
|
+
};
|
|
89
|
+
})(WorkflowTemplate || (WorkflowTemplate = {}));
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region generated/openapi/model/workflow-template-scope.ts
|
|
92
|
+
let WorkflowTemplateScope;
|
|
93
|
+
(function(_WorkflowTemplateScope) {
|
|
94
|
+
_WorkflowTemplateScope.TypeEnum = { WorkflowTemplate: "workflow_template" };
|
|
95
|
+
})(WorkflowTemplateScope || (WorkflowTemplateScope = {}));
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/utils/validation.utils.ts
|
|
98
|
+
function hasOwnProperty(obj, prop) {
|
|
99
|
+
return Object.hasOwn(obj, prop);
|
|
100
|
+
}
|
|
101
|
+
function isNonEmptyString(value) {
|
|
102
|
+
return typeof value === "string" && value.length > 0;
|
|
103
|
+
}
|
|
104
|
+
function isNumber(value) {
|
|
105
|
+
return typeof value === "number" && !isNaN(value);
|
|
106
|
+
}
|
|
107
|
+
function isArray(value) {
|
|
108
|
+
return Array.isArray(value);
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/validators/auth.validators.ts
|
|
112
|
+
function validateTokenResponse(object) {
|
|
113
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
114
|
+
if (!hasOwnProperty(object, "accessToken")) return (0, fp_ts_Either.left)("missing_access_token");
|
|
115
|
+
if (!isNonEmptyString(object.accessToken)) return (0, fp_ts_Either.left)("invalid_access_token");
|
|
116
|
+
if (!hasOwnProperty(object, "refreshToken")) return (0, fp_ts_Either.left)("missing_refresh_token");
|
|
117
|
+
if (!isNonEmptyString(object.refreshToken)) return (0, fp_ts_Either.left)("invalid_refresh_token");
|
|
118
|
+
return (0, fp_ts_Either.right)({
|
|
119
|
+
accessToken: object.accessToken,
|
|
120
|
+
refreshToken: object.refreshToken
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function validateAgentRegistrationResponse(object) {
|
|
124
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
125
|
+
if (!hasOwnProperty(object, "agentId")) return (0, fp_ts_Either.left)("missing_agent_id");
|
|
126
|
+
if (!isNonEmptyString(object.agentId)) return (0, fp_ts_Either.left)("invalid_agent_id");
|
|
127
|
+
if (!hasOwnProperty(object, "agentName")) return (0, fp_ts_Either.left)("missing_agent_name");
|
|
128
|
+
if (!isNonEmptyString(object.agentName)) return (0, fp_ts_Either.left)("invalid_agent_name");
|
|
129
|
+
if (!hasOwnProperty(object, "publicKey")) return (0, fp_ts_Either.left)("missing_public_key");
|
|
130
|
+
if (!isNonEmptyString(object.publicKey)) return (0, fp_ts_Either.left)("invalid_public_key");
|
|
131
|
+
if (!hasOwnProperty(object, "privateKey")) return (0, fp_ts_Either.left)("missing_private_key");
|
|
132
|
+
if (!isNonEmptyString(object.privateKey)) return (0, fp_ts_Either.left)("invalid_private_key");
|
|
133
|
+
if (!hasOwnProperty(object, "createdAt")) return (0, fp_ts_Either.left)("missing_created_at");
|
|
134
|
+
if (!isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
135
|
+
return (0, fp_ts_Either.right)({
|
|
136
|
+
agentId: object.agentId,
|
|
137
|
+
agentName: object.agentName,
|
|
138
|
+
publicKey: object.publicKey,
|
|
139
|
+
privateKey: object.privateKey,
|
|
140
|
+
createdAt: object.createdAt
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function validateTokenRequest(object) {
|
|
144
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
145
|
+
if (!hasOwnProperty(object, "code") || !isNonEmptyString(object.code)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "code") ? "invalid_code" : "missing_code");
|
|
146
|
+
if (!hasOwnProperty(object, "state") || !isNonEmptyString(object.state)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "state") ? "invalid_state" : "missing_state");
|
|
147
|
+
return (0, fp_ts_Either.right)({
|
|
148
|
+
code: object.code,
|
|
149
|
+
state: object.state
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function validateRefreshTokenRequest(object) {
|
|
153
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
154
|
+
if (!hasOwnProperty(object, "refreshToken") || !isNonEmptyString(object.refreshToken)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "refreshToken") ? "invalid_refresh_token" : "missing_refresh_token");
|
|
155
|
+
return (0, fp_ts_Either.right)({ refreshToken: object.refreshToken });
|
|
156
|
+
}
|
|
157
|
+
function validatePrivilegedTokenExchangeRequest(object) {
|
|
158
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
159
|
+
if (!hasOwnProperty(object, "code") || !isNonEmptyString(object.code)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "code") ? "invalid_code" : "missing_code");
|
|
160
|
+
if (!hasOwnProperty(object, "state") || !isNonEmptyString(object.state)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "state") ? "invalid_state" : "missing_state");
|
|
161
|
+
if (!hasOwnProperty(object, "operation") || !isNonEmptyString(object.operation)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "operation") ? "invalid_operation" : "missing_operation");
|
|
162
|
+
const result = {
|
|
163
|
+
code: object.code,
|
|
164
|
+
state: object.state,
|
|
165
|
+
operation: object.operation
|
|
166
|
+
};
|
|
167
|
+
if (hasOwnProperty(object, "resourceId") && object.resourceId !== void 0) {
|
|
168
|
+
if (typeof object.resourceId !== "string") return (0, fp_ts_Either.left)("invalid_resource_id");
|
|
169
|
+
result.resourceId = object.resourceId;
|
|
170
|
+
}
|
|
171
|
+
return (0, fp_ts_Either.right)(result);
|
|
172
|
+
}
|
|
173
|
+
function validatePrivilegedTokenResponse(object) {
|
|
174
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
175
|
+
if (!hasOwnProperty(object, "accessToken") || !isNonEmptyString(object.accessToken)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "accessToken") ? "invalid_access_token" : "missing_access_token");
|
|
176
|
+
return (0, fp_ts_Either.right)({ accessToken: object.accessToken });
|
|
177
|
+
}
|
|
178
|
+
function validateInitiateCliLoginRequest(object) {
|
|
179
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
180
|
+
if (!hasOwnProperty(object, "redirectUri") || !isNonEmptyString(object.redirectUri)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "redirectUri") ? "invalid_redirect_uri" : "missing_redirect_uri");
|
|
181
|
+
return (0, fp_ts_Either.right)({ redirectUri: object.redirectUri });
|
|
182
|
+
}
|
|
183
|
+
function validateInitiateCliLogin200Response(object) {
|
|
184
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
185
|
+
if (!hasOwnProperty(object, "authorizationUrl") || !isNonEmptyString(object.authorizationUrl)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "authorizationUrl") ? "invalid_authorization_url" : "missing_authorization_url");
|
|
186
|
+
return (0, fp_ts_Either.right)({ authorizationUrl: object.authorizationUrl });
|
|
187
|
+
}
|
|
188
|
+
function validateOidcCallbackRequest(object) {
|
|
189
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
190
|
+
if (!hasOwnProperty(object, "code") || !isNonEmptyString(object.code)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "code") ? "invalid_code" : "missing_code");
|
|
191
|
+
if (!hasOwnProperty(object, "state") || !isNonEmptyString(object.state)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "state") ? "invalid_state" : "missing_state");
|
|
192
|
+
return (0, fp_ts_Either.right)({
|
|
193
|
+
code: object.code,
|
|
194
|
+
state: object.state
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/validators/groups.validators.ts
|
|
199
|
+
function validateGroup(object) {
|
|
200
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
201
|
+
if (!hasOwnProperty(object, "id") || !isNonEmptyString(object.id)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "id") ? "invalid_id" : "missing_id");
|
|
202
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "name") ? "invalid_name" : "missing_name");
|
|
203
|
+
if (!hasOwnProperty(object, "entitiesCount") || typeof object.entitiesCount !== "number") return (0, fp_ts_Either.left)(hasOwnProperty(object, "entitiesCount") ? "invalid_entities_count" : "missing_entities_count");
|
|
204
|
+
if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "createdAt") ? "invalid_created_at" : "missing_created_at");
|
|
205
|
+
if (!hasOwnProperty(object, "updatedAt") || !isNonEmptyString(object.updatedAt)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "updatedAt") ? "invalid_updated_at" : "missing_updated_at");
|
|
206
|
+
const result = {
|
|
207
|
+
id: object.id,
|
|
208
|
+
name: object.name,
|
|
209
|
+
entitiesCount: object.entitiesCount,
|
|
210
|
+
createdAt: object.createdAt,
|
|
211
|
+
updatedAt: object.updatedAt
|
|
212
|
+
};
|
|
213
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
214
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
215
|
+
result.description = object.description;
|
|
216
|
+
}
|
|
217
|
+
return (0, fp_ts_Either.right)(result);
|
|
218
|
+
}
|
|
219
|
+
function validateGroupCreate(object) {
|
|
220
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
221
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "name") ? "invalid_name" : "missing_name");
|
|
222
|
+
const result = { name: object.name };
|
|
223
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
224
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
225
|
+
result.description = object.description;
|
|
226
|
+
}
|
|
227
|
+
return (0, fp_ts_Either.right)(result);
|
|
228
|
+
}
|
|
229
|
+
function validateListGroups200Response(object) {
|
|
230
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
231
|
+
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
232
|
+
const groups = [];
|
|
233
|
+
for (const item of object.groups) {
|
|
234
|
+
const validatedItem = validateGroup(item);
|
|
235
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
236
|
+
groups.push(validatedItem.right);
|
|
237
|
+
}
|
|
238
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
239
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
240
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
241
|
+
return (0, fp_ts_Either.right)({
|
|
242
|
+
groups,
|
|
243
|
+
pagination: paginationValidation.right
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function validateGroupScope(object) {
|
|
247
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
248
|
+
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("missing_type");
|
|
249
|
+
if (object.type !== "group") return (0, fp_ts_Either.left)("invalid_type");
|
|
250
|
+
if (!hasOwnProperty(object, "groupId") || !isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groupId") ? "invalid_group_id" : "missing_group_id");
|
|
251
|
+
return (0, fp_ts_Either.right)({
|
|
252
|
+
type: "group",
|
|
253
|
+
groupId: object.groupId
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function validateGroupInfo(object) {
|
|
257
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
258
|
+
if (!hasOwnProperty(object, "groupId") || !isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groupId") ? "invalid_group_id" : "missing_group_id");
|
|
259
|
+
if (!hasOwnProperty(object, "groupName") || !isNonEmptyString(object.groupName)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groupName") ? "invalid_group_name" : "missing_group_name");
|
|
260
|
+
return (0, fp_ts_Either.right)({
|
|
261
|
+
groupId: object.groupId,
|
|
262
|
+
groupName: object.groupName
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function validateEntityReference(object) {
|
|
266
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
267
|
+
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
268
|
+
if (!hasOwnProperty(object, "entityId") || !isNonEmptyString(object.entityId)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entityId") ? "invalid_entity_id" : "missing_entity_id");
|
|
269
|
+
return (0, fp_ts_Either.right)({
|
|
270
|
+
entityType: object.entityType,
|
|
271
|
+
entityId: object.entityId
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function validateGroupMembership(object) {
|
|
275
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
276
|
+
if (!hasOwnProperty(object, "entity")) return (0, fp_ts_Either.left)("missing_entity");
|
|
277
|
+
const entityValidation = validateEntityReference(object.entity);
|
|
278
|
+
if ((0, fp_ts_Either.isLeft)(entityValidation)) return (0, fp_ts_Either.left)("invalid_entity");
|
|
279
|
+
if (!hasOwnProperty(object, "addedAt") || !isNonEmptyString(object.addedAt)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "addedAt") ? "invalid_added_at" : "missing_added_at");
|
|
280
|
+
return (0, fp_ts_Either.right)({
|
|
281
|
+
entity: entityValidation.right,
|
|
282
|
+
addedAt: object.addedAt
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function validateEntityMembershipAdd(object) {
|
|
286
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
287
|
+
if (!hasOwnProperty(object, "entity")) return (0, fp_ts_Either.left)("missing_entity");
|
|
288
|
+
const entityValidation = validateEntityReference(object.entity);
|
|
289
|
+
if ((0, fp_ts_Either.isLeft)(entityValidation)) return (0, fp_ts_Either.left)("invalid_entity");
|
|
290
|
+
return (0, fp_ts_Either.right)({ entity: entityValidation.right });
|
|
291
|
+
}
|
|
292
|
+
function validateEntityMembershipRemove(object) {
|
|
293
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
294
|
+
if (!hasOwnProperty(object, "entity")) return (0, fp_ts_Either.left)("missing_entity");
|
|
295
|
+
const entityValidation = validateEntityReference(object.entity);
|
|
296
|
+
if ((0, fp_ts_Either.isLeft)(entityValidation)) return (0, fp_ts_Either.left)("invalid_entity");
|
|
297
|
+
return (0, fp_ts_Either.right)({ entity: entityValidation.right });
|
|
298
|
+
}
|
|
299
|
+
function validateAddGroupEntitiesRequest(object) {
|
|
300
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
301
|
+
if (!hasOwnProperty(object, "entities") || !isArray(object.entities)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entities") ? "invalid_entities" : "missing_entities");
|
|
302
|
+
const entities = [];
|
|
303
|
+
for (const item of object.entities) {
|
|
304
|
+
const validatedItem = validateEntityMembershipAdd(item);
|
|
305
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_entities");
|
|
306
|
+
entities.push(validatedItem.right);
|
|
307
|
+
}
|
|
308
|
+
return (0, fp_ts_Either.right)({ entities });
|
|
309
|
+
}
|
|
310
|
+
function validateRemoveGroupEntitiesRequest(object) {
|
|
311
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
312
|
+
if (!hasOwnProperty(object, "entities") || !isArray(object.entities)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entities") ? "invalid_entities" : "missing_entities");
|
|
313
|
+
const entities = [];
|
|
314
|
+
for (const item of object.entities) {
|
|
315
|
+
const validatedItem = validateEntityMembershipRemove(item);
|
|
316
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_entities");
|
|
317
|
+
entities.push(validatedItem.right);
|
|
318
|
+
}
|
|
319
|
+
return (0, fp_ts_Either.right)({ entities });
|
|
320
|
+
}
|
|
321
|
+
function validateListGroupEntities200Response(object) {
|
|
322
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
323
|
+
if (!hasOwnProperty(object, "entities") || !isArray(object.entities)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entities") ? "invalid_entities" : "missing_entities");
|
|
324
|
+
const entities = [];
|
|
325
|
+
for (const item of object.entities) {
|
|
326
|
+
const validatedItem = validateGroupMembership(item);
|
|
327
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_entities");
|
|
328
|
+
entities.push(validatedItem.right);
|
|
329
|
+
}
|
|
330
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
331
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
332
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
333
|
+
return (0, fp_ts_Either.right)({
|
|
334
|
+
entities,
|
|
335
|
+
pagination: paginationValidation.right
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/validators/common.validators.ts
|
|
340
|
+
function validatePagination(object) {
|
|
341
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
342
|
+
if (!hasOwnProperty(object, "total")) return (0, fp_ts_Either.left)("missing_total");
|
|
343
|
+
if (!isNumber(object.total) || object.total < 0) return (0, fp_ts_Either.left)("invalid_total");
|
|
344
|
+
if (!hasOwnProperty(object, "page")) return (0, fp_ts_Either.left)("missing_page");
|
|
345
|
+
if (!isNumber(object.page) || object.page < 0) return (0, fp_ts_Either.left)("invalid_page");
|
|
346
|
+
if (!hasOwnProperty(object, "limit")) return (0, fp_ts_Either.left)("missing_limit");
|
|
347
|
+
if (!isNumber(object.limit) || object.limit < 1) return (0, fp_ts_Either.left)("invalid_limit");
|
|
348
|
+
return (0, fp_ts_Either.right)({
|
|
349
|
+
total: object.total,
|
|
350
|
+
page: object.page,
|
|
351
|
+
limit: object.limit
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
function validateAPIErrorDetailsInner(object) {
|
|
355
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
356
|
+
const result = {};
|
|
357
|
+
if (hasOwnProperty(object, "field") && object.field !== void 0) {
|
|
358
|
+
if (typeof object.field !== "string") return (0, fp_ts_Either.left)("invalid_field");
|
|
359
|
+
result.field = object.field;
|
|
360
|
+
}
|
|
361
|
+
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
362
|
+
if (typeof object.message !== "string") return (0, fp_ts_Either.left)("invalid_message");
|
|
363
|
+
result.message = object.message;
|
|
364
|
+
}
|
|
365
|
+
return (0, fp_ts_Either.right)(result);
|
|
366
|
+
}
|
|
367
|
+
function validateAPIError(object) {
|
|
368
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
369
|
+
const result = {};
|
|
370
|
+
if (hasOwnProperty(object, "code") && object.code !== void 0) {
|
|
371
|
+
if (typeof object.code !== "string") return (0, fp_ts_Either.left)("invalid_code");
|
|
372
|
+
result.code = object.code;
|
|
373
|
+
}
|
|
374
|
+
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
375
|
+
if (typeof object.message !== "string") return (0, fp_ts_Either.left)("invalid_message");
|
|
376
|
+
result.message = object.message;
|
|
377
|
+
}
|
|
378
|
+
if (hasOwnProperty(object, "details") && object.details !== void 0) {
|
|
379
|
+
if (!isArray(object.details)) return (0, fp_ts_Either.left)("invalid_details");
|
|
380
|
+
const details = [];
|
|
381
|
+
for (const item of object.details) {
|
|
382
|
+
const validatedItem = validateAPIErrorDetailsInner(item);
|
|
383
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_details");
|
|
384
|
+
details.push(validatedItem.right);
|
|
385
|
+
}
|
|
386
|
+
result.details = details;
|
|
387
|
+
}
|
|
388
|
+
return (0, fp_ts_Either.right)(result);
|
|
389
|
+
}
|
|
390
|
+
function validateHealthResponse(object) {
|
|
391
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
392
|
+
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
393
|
+
const result = { status: object.status };
|
|
394
|
+
if (hasOwnProperty(object, "message") && object.message !== void 0) {
|
|
395
|
+
if (typeof object.message !== "string") return (0, fp_ts_Either.left)("invalid_message");
|
|
396
|
+
result.message = object.message;
|
|
397
|
+
}
|
|
398
|
+
return (0, fp_ts_Either.right)(result);
|
|
399
|
+
}
|
|
400
|
+
function validateGetEntityInfo200Response(object) {
|
|
401
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
402
|
+
if (!hasOwnProperty(object, "entityType") || !isNonEmptyString(object.entityType)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "entityType") ? "invalid_entity_type" : "missing_entity_type");
|
|
403
|
+
if (!hasOwnProperty(object, "groups") || !isArray(object.groups)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "groups") ? "invalid_groups" : "missing_groups");
|
|
404
|
+
const groups = [];
|
|
405
|
+
for (const item of object.groups) {
|
|
406
|
+
const validatedItem = validateGroupInfo(item);
|
|
407
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_groups");
|
|
408
|
+
groups.push(validatedItem.right);
|
|
409
|
+
}
|
|
410
|
+
return (0, fp_ts_Either.right)({
|
|
411
|
+
entityType: object.entityType,
|
|
412
|
+
groups
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/utils/enum.ts
|
|
417
|
+
function getStringAsEnum(str, enumType) {
|
|
418
|
+
if (Object.values(enumType).includes(str)) return str;
|
|
419
|
+
}
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/validators/workflow-templates.validators.ts
|
|
422
|
+
function validateEmailAction(object) {
|
|
423
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
424
|
+
if (!hasOwnProperty(object, "type") || object.type !== "EMAIL") return (0, fp_ts_Either.left)("invalid_type");
|
|
425
|
+
if (!hasOwnProperty(object, "recipients") || !Array.isArray(object.recipients)) return (0, fp_ts_Either.left)("invalid_recipients");
|
|
426
|
+
for (const recipient of object.recipients) if (!isNonEmptyString(recipient)) return (0, fp_ts_Either.left)("invalid_recipients_element");
|
|
427
|
+
const type = getStringAsEnum(object.type, EmailAction.TypeEnum);
|
|
428
|
+
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
429
|
+
return (0, fp_ts_Either.right)({
|
|
430
|
+
type,
|
|
431
|
+
recipients: object.recipients
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
function validateWebhookAction(object) {
|
|
435
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
436
|
+
if (!hasOwnProperty(object, "type") || object.type !== "WEBHOOK") return (0, fp_ts_Either.left)("invalid_type");
|
|
437
|
+
if (!hasOwnProperty(object, "url") || !isNonEmptyString(object.url)) return (0, fp_ts_Either.left)("invalid_url");
|
|
438
|
+
const type = getStringAsEnum(object.type, WebhookAction.TypeEnum);
|
|
439
|
+
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
440
|
+
const result = {
|
|
441
|
+
type,
|
|
442
|
+
url: object.url
|
|
443
|
+
};
|
|
444
|
+
if (hasOwnProperty(object, "method") && object.method !== void 0) {
|
|
445
|
+
if (typeof object.method !== "string") return (0, fp_ts_Either.left)("invalid_method");
|
|
446
|
+
const method = getStringAsEnum(object.method, WebhookAction.MethodEnum);
|
|
447
|
+
if (!method) return (0, fp_ts_Either.left)("invalid_method");
|
|
448
|
+
result.method = method;
|
|
449
|
+
}
|
|
450
|
+
if (hasOwnProperty(object, "headers") && object.headers !== void 0) {
|
|
451
|
+
if (typeof object.headers !== "object" || object.headers === null || Array.isArray(object.headers)) return (0, fp_ts_Either.left)("invalid_headers");
|
|
452
|
+
const headers = {};
|
|
453
|
+
for (const [key, value] of Object.entries(object.headers)) {
|
|
454
|
+
if (typeof value !== "string") return (0, fp_ts_Either.left)("invalid_headers_element");
|
|
455
|
+
headers[key] = value;
|
|
456
|
+
}
|
|
457
|
+
result.headers = headers;
|
|
458
|
+
}
|
|
459
|
+
return (0, fp_ts_Either.right)(result);
|
|
460
|
+
}
|
|
461
|
+
function validateWorkflowAction(object) {
|
|
462
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
463
|
+
if (hasOwnProperty(object, "type")) {
|
|
464
|
+
if (object.type === "EMAIL") return validateEmailAction(object);
|
|
465
|
+
if (object.type === "WEBHOOK") return validateWebhookAction(object);
|
|
466
|
+
}
|
|
467
|
+
return (0, fp_ts_Either.left)("invalid_workflow_action_type");
|
|
468
|
+
}
|
|
469
|
+
function validateGroupRequirementRule(object) {
|
|
470
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
471
|
+
if (!hasOwnProperty(object, "type") || object.type !== "GROUP_REQUIREMENT") return (0, fp_ts_Either.left)("invalid_type");
|
|
472
|
+
if (!hasOwnProperty(object, "groupId") || !isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)("invalid_group_id");
|
|
473
|
+
if (!hasOwnProperty(object, "minCount") || typeof object.minCount !== "number" || object.minCount < 1) return (0, fp_ts_Either.left)("invalid_min_count");
|
|
474
|
+
const type = getStringAsEnum(object.type, GroupRequirementRule.TypeEnum);
|
|
475
|
+
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
476
|
+
const result = {
|
|
477
|
+
type,
|
|
478
|
+
groupId: object.groupId,
|
|
479
|
+
minCount: object.minCount
|
|
480
|
+
};
|
|
481
|
+
if (hasOwnProperty(object, "requireHighPrivilege") && object.requireHighPrivilege !== void 0) {
|
|
482
|
+
if (typeof object.requireHighPrivilege !== "boolean") return (0, fp_ts_Either.left)("invalid_require_high_privilege");
|
|
483
|
+
result.requireHighPrivilege = object.requireHighPrivilege;
|
|
484
|
+
}
|
|
485
|
+
return (0, fp_ts_Either.right)(result);
|
|
486
|
+
}
|
|
487
|
+
function validateAndRule(object) {
|
|
488
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
489
|
+
if (!hasOwnProperty(object, "type") || object.type !== "AND") return (0, fp_ts_Either.left)("invalid_type");
|
|
490
|
+
if (!hasOwnProperty(object, "rules") || !Array.isArray(object.rules) || object.rules.length === 0) return (0, fp_ts_Either.left)("invalid_rules");
|
|
491
|
+
const rules = [];
|
|
492
|
+
for (const rule of object.rules) {
|
|
493
|
+
const validatedRule = validateApprovalRule(rule);
|
|
494
|
+
if ((0, fp_ts_Either.isLeft)(validatedRule)) return (0, fp_ts_Either.left)("invalid_rules_element");
|
|
495
|
+
rules.push(validatedRule.right);
|
|
496
|
+
}
|
|
497
|
+
const type = getStringAsEnum(object.type, AndRule.TypeEnum);
|
|
498
|
+
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
499
|
+
return (0, fp_ts_Either.right)({
|
|
500
|
+
type,
|
|
501
|
+
rules
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
function validateOrRule(object) {
|
|
505
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
506
|
+
if (!hasOwnProperty(object, "type") || object.type !== "OR") return (0, fp_ts_Either.left)("invalid_type");
|
|
507
|
+
if (!hasOwnProperty(object, "rules") || !Array.isArray(object.rules) || object.rules.length === 0) return (0, fp_ts_Either.left)("invalid_rules");
|
|
508
|
+
const rules = [];
|
|
509
|
+
for (const rule of object.rules) {
|
|
510
|
+
const validatedRule = validateApprovalRule(rule);
|
|
511
|
+
if ((0, fp_ts_Either.isLeft)(validatedRule)) return (0, fp_ts_Either.left)("invalid_rules_element");
|
|
512
|
+
rules.push(validatedRule.right);
|
|
513
|
+
}
|
|
514
|
+
const type = getStringAsEnum(object.type, OrRule.TypeEnum);
|
|
515
|
+
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
516
|
+
return (0, fp_ts_Either.right)({
|
|
517
|
+
type,
|
|
518
|
+
rules
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function validateApprovalRule(object) {
|
|
522
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
523
|
+
if (hasOwnProperty(object, "type")) {
|
|
524
|
+
if (object.type === "GROUP_REQUIREMENT") return validateGroupRequirementRule(object);
|
|
525
|
+
if (object.type === "AND") return validateAndRule(object);
|
|
526
|
+
if (object.type === "OR") return validateOrRule(object);
|
|
527
|
+
}
|
|
528
|
+
return (0, fp_ts_Either.left)("invalid_approval_rule_type");
|
|
529
|
+
}
|
|
530
|
+
function validateWorkflowTemplate(object) {
|
|
531
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
532
|
+
if (!hasOwnProperty(object, "id") || !isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
533
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)("invalid_name");
|
|
534
|
+
if (!hasOwnProperty(object, "version") || !isNonEmptyString(object.version)) return (0, fp_ts_Either.left)("invalid_version");
|
|
535
|
+
if (!hasOwnProperty(object, "status") || typeof object.status !== "string") return (0, fp_ts_Either.left)("invalid_status");
|
|
536
|
+
const status = getStringAsEnum(object.status, WorkflowTemplate.StatusEnum);
|
|
537
|
+
if (!status) return (0, fp_ts_Either.left)("invalid_status");
|
|
538
|
+
if (!hasOwnProperty(object, "allowVotingOnDeprecatedTemplate") || typeof object.allowVotingOnDeprecatedTemplate !== "boolean") return (0, fp_ts_Either.left)("invalid_allow_voting");
|
|
539
|
+
if (!hasOwnProperty(object, "approvalRule")) return (0, fp_ts_Either.left)("missing_approval_rule");
|
|
540
|
+
const approvalRuleValidation = validateApprovalRule(object.approvalRule);
|
|
541
|
+
if ((0, fp_ts_Either.isLeft)(approvalRuleValidation)) return (0, fp_ts_Either.left)("invalid_approval_rule");
|
|
542
|
+
if (!hasOwnProperty(object, "spaceId") || !isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
543
|
+
if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
544
|
+
if (!hasOwnProperty(object, "updatedAt") || !isNonEmptyString(object.updatedAt)) return (0, fp_ts_Either.left)("invalid_updated_at");
|
|
545
|
+
const result = {
|
|
546
|
+
id: object.id,
|
|
547
|
+
name: object.name,
|
|
548
|
+
version: object.version,
|
|
549
|
+
status,
|
|
550
|
+
allowVotingOnDeprecatedTemplate: object.allowVotingOnDeprecatedTemplate,
|
|
551
|
+
approvalRule: approvalRuleValidation.right,
|
|
552
|
+
spaceId: object.spaceId,
|
|
553
|
+
createdAt: object.createdAt,
|
|
554
|
+
updatedAt: object.updatedAt
|
|
555
|
+
};
|
|
556
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
557
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
558
|
+
result.description = object.description;
|
|
559
|
+
}
|
|
560
|
+
if (hasOwnProperty(object, "metadata") && object.metadata !== void 0) {
|
|
561
|
+
const metadata = object.metadata;
|
|
562
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) return (0, fp_ts_Either.left)("invalid_metadata");
|
|
563
|
+
result.metadata = metadata;
|
|
564
|
+
}
|
|
565
|
+
if (hasOwnProperty(object, "actions") && object.actions !== void 0) {
|
|
566
|
+
if (!Array.isArray(object.actions)) return (0, fp_ts_Either.left)("invalid_actions");
|
|
567
|
+
const actions = [];
|
|
568
|
+
for (const action of object.actions) {
|
|
569
|
+
const validatedAction = validateWorkflowAction(action);
|
|
570
|
+
if ((0, fp_ts_Either.isLeft)(validatedAction)) return (0, fp_ts_Either.left)("invalid_actions_element");
|
|
571
|
+
actions.push(validatedAction.right);
|
|
572
|
+
}
|
|
573
|
+
result.actions = actions;
|
|
574
|
+
}
|
|
575
|
+
if (hasOwnProperty(object, "defaultExpiresInHours") && object.defaultExpiresInHours !== void 0) {
|
|
576
|
+
if (typeof object.defaultExpiresInHours !== "number") return (0, fp_ts_Either.left)("invalid_default_expires_in_hours");
|
|
577
|
+
result.defaultExpiresInHours = object.defaultExpiresInHours;
|
|
578
|
+
}
|
|
579
|
+
return (0, fp_ts_Either.right)(result);
|
|
580
|
+
}
|
|
581
|
+
function validateWorkflowTemplateCreate(object) {
|
|
582
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
583
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)("invalid_name");
|
|
584
|
+
if (!hasOwnProperty(object, "approvalRule")) return (0, fp_ts_Either.left)("missing_approval_rule");
|
|
585
|
+
const approvalRuleValidation = validateApprovalRule(object.approvalRule);
|
|
586
|
+
if ((0, fp_ts_Either.isLeft)(approvalRuleValidation)) return (0, fp_ts_Either.left)("invalid_approval_rule");
|
|
587
|
+
if (!hasOwnProperty(object, "spaceId") || !isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
588
|
+
const result = {
|
|
589
|
+
name: object.name,
|
|
590
|
+
approvalRule: approvalRuleValidation.right,
|
|
591
|
+
spaceId: object.spaceId
|
|
592
|
+
};
|
|
593
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
594
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
595
|
+
result.description = object.description;
|
|
596
|
+
}
|
|
597
|
+
if (hasOwnProperty(object, "metadata") && object.metadata !== void 0) {
|
|
598
|
+
const metadata = object.metadata;
|
|
599
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) return (0, fp_ts_Either.left)("invalid_metadata");
|
|
600
|
+
result.metadata = metadata;
|
|
601
|
+
}
|
|
602
|
+
if (hasOwnProperty(object, "actions") && object.actions !== void 0) {
|
|
603
|
+
if (!Array.isArray(object.actions)) return (0, fp_ts_Either.left)("invalid_actions");
|
|
604
|
+
const actions = [];
|
|
605
|
+
for (const action of object.actions) {
|
|
606
|
+
const validatedAction = validateWorkflowAction(action);
|
|
607
|
+
if ((0, fp_ts_Either.isLeft)(validatedAction)) return (0, fp_ts_Either.left)("invalid_actions_element");
|
|
608
|
+
actions.push(validatedAction.right);
|
|
609
|
+
}
|
|
610
|
+
result.actions = actions;
|
|
611
|
+
}
|
|
612
|
+
if (hasOwnProperty(object, "defaultExpiresInHours") && object.defaultExpiresInHours !== void 0) {
|
|
613
|
+
if (typeof object.defaultExpiresInHours !== "number") return (0, fp_ts_Either.left)("invalid_default_expires_in_hours");
|
|
614
|
+
result.defaultExpiresInHours = object.defaultExpiresInHours;
|
|
615
|
+
}
|
|
616
|
+
return (0, fp_ts_Either.right)(result);
|
|
617
|
+
}
|
|
618
|
+
function validateWorkflowTemplateUpdate(object) {
|
|
619
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
620
|
+
const result = {};
|
|
621
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
622
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
623
|
+
result.description = object.description;
|
|
624
|
+
}
|
|
625
|
+
if (hasOwnProperty(object, "metadata") && object.metadata !== void 0) {
|
|
626
|
+
const metadata = object.metadata;
|
|
627
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) return (0, fp_ts_Either.left)("invalid_metadata");
|
|
628
|
+
result.metadata = metadata;
|
|
629
|
+
}
|
|
630
|
+
if (hasOwnProperty(object, "approvalRule") && object.approvalRule !== void 0) {
|
|
631
|
+
const approvalRuleValidation = validateApprovalRule(object.approvalRule);
|
|
632
|
+
if ((0, fp_ts_Either.isLeft)(approvalRuleValidation)) return (0, fp_ts_Either.left)("invalid_approval_rule");
|
|
633
|
+
result.approvalRule = approvalRuleValidation.right;
|
|
634
|
+
}
|
|
635
|
+
if (hasOwnProperty(object, "actions") && object.actions !== void 0) {
|
|
636
|
+
if (!Array.isArray(object.actions)) return (0, fp_ts_Either.left)("invalid_actions");
|
|
637
|
+
const actions = [];
|
|
638
|
+
for (const action of object.actions) {
|
|
639
|
+
const validatedAction = validateWorkflowAction(action);
|
|
640
|
+
if ((0, fp_ts_Either.isLeft)(validatedAction)) return (0, fp_ts_Either.left)("invalid_actions_element");
|
|
641
|
+
actions.push(validatedAction.right);
|
|
642
|
+
}
|
|
643
|
+
result.actions = actions;
|
|
644
|
+
}
|
|
645
|
+
if (hasOwnProperty(object, "defaultExpiresInHours") && object.defaultExpiresInHours !== void 0) {
|
|
646
|
+
if (typeof object.defaultExpiresInHours !== "number") return (0, fp_ts_Either.left)("invalid_default_expires_in_hours");
|
|
647
|
+
result.defaultExpiresInHours = object.defaultExpiresInHours;
|
|
648
|
+
}
|
|
649
|
+
if (hasOwnProperty(object, "cancelWorkflows") && object.cancelWorkflows !== void 0) {
|
|
650
|
+
if (typeof object.cancelWorkflows !== "boolean") return (0, fp_ts_Either.left)("invalid_cancel_workflows");
|
|
651
|
+
result.cancelWorkflows = object.cancelWorkflows;
|
|
652
|
+
}
|
|
653
|
+
return (0, fp_ts_Either.right)(result);
|
|
654
|
+
}
|
|
655
|
+
function validateWorkflowTemplateDeprecate(object) {
|
|
656
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
657
|
+
const result = {};
|
|
658
|
+
if (hasOwnProperty(object, "cancelWorkflows") && object.cancelWorkflows !== void 0) {
|
|
659
|
+
if (typeof object.cancelWorkflows !== "boolean") return (0, fp_ts_Either.left)("invalid_cancel_workflows");
|
|
660
|
+
result.cancelWorkflows = object.cancelWorkflows;
|
|
661
|
+
}
|
|
662
|
+
return (0, fp_ts_Either.right)(result);
|
|
663
|
+
}
|
|
664
|
+
function validateWorkflowTemplateScope(object) {
|
|
665
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
666
|
+
if (!hasOwnProperty(object, "type") || object.type !== "workflow_template") return (0, fp_ts_Either.left)("invalid_type");
|
|
667
|
+
if (!hasOwnProperty(object, "workflowTemplateId") || !isNonEmptyString(object.workflowTemplateId)) return (0, fp_ts_Either.left)("invalid_workflow_template_id");
|
|
668
|
+
if (!hasOwnProperty(object, "type") || typeof object.type !== "string") return (0, fp_ts_Either.left)("invalid_type");
|
|
669
|
+
const type = getStringAsEnum(object.type, WorkflowTemplateScope.TypeEnum);
|
|
670
|
+
if (!type) return (0, fp_ts_Either.left)("invalid_type");
|
|
671
|
+
return (0, fp_ts_Either.right)({
|
|
672
|
+
type,
|
|
673
|
+
workflowTemplateId: object.workflowTemplateId
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
function validateWorkflowTemplateSummary(object) {
|
|
677
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
678
|
+
if (!hasOwnProperty(object, "id") || !isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
679
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)("invalid_name");
|
|
680
|
+
if (!hasOwnProperty(object, "version") || !isNonEmptyString(object.version)) return (0, fp_ts_Either.left)("invalid_version");
|
|
681
|
+
if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
682
|
+
if (!hasOwnProperty(object, "updatedAt") || !isNonEmptyString(object.updatedAt)) return (0, fp_ts_Either.left)("invalid_updated_at");
|
|
683
|
+
const result = {
|
|
684
|
+
id: object.id,
|
|
685
|
+
name: object.name,
|
|
686
|
+
version: object.version,
|
|
687
|
+
createdAt: object.createdAt,
|
|
688
|
+
updatedAt: object.updatedAt
|
|
689
|
+
};
|
|
690
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
691
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
692
|
+
result.description = object.description;
|
|
693
|
+
}
|
|
694
|
+
return (0, fp_ts_Either.right)(result);
|
|
695
|
+
}
|
|
696
|
+
function validateListWorkflowTemplates200Response(object) {
|
|
697
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
698
|
+
if (!hasOwnProperty(object, "data") || !Array.isArray(object.data)) return (0, fp_ts_Either.left)("invalid_data");
|
|
699
|
+
const data = [];
|
|
700
|
+
for (const item of object.data) {
|
|
701
|
+
const validatedItem = validateWorkflowTemplateSummary(item);
|
|
702
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_data_element");
|
|
703
|
+
data.push(validatedItem.right);
|
|
704
|
+
}
|
|
705
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
706
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
707
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
708
|
+
return (0, fp_ts_Either.right)({
|
|
709
|
+
data,
|
|
710
|
+
pagination: paginationValidation.right
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function validateListWorkflowTemplatesParams(object) {
|
|
714
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
715
|
+
const result = {};
|
|
716
|
+
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
717
|
+
if (typeof object.page !== "number") return (0, fp_ts_Either.left)("invalid_page");
|
|
718
|
+
result.page = object.page;
|
|
719
|
+
}
|
|
720
|
+
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
721
|
+
if (typeof object.limit !== "number") return (0, fp_ts_Either.left)("invalid_limit");
|
|
722
|
+
result.limit = object.limit;
|
|
723
|
+
}
|
|
724
|
+
if (hasOwnProperty(object, "spaceIdentifier") && object.spaceIdentifier !== void 0) {
|
|
725
|
+
if (!isNonEmptyString(object.spaceIdentifier)) return (0, fp_ts_Either.left)("invalid_space_identifier");
|
|
726
|
+
result.spaceIdentifier = object.spaceIdentifier;
|
|
727
|
+
}
|
|
728
|
+
return (0, fp_ts_Either.right)(result);
|
|
729
|
+
}
|
|
730
|
+
//#endregion
|
|
731
|
+
//#region src/validators/workflow.validators.ts
|
|
732
|
+
function validateWorkflowCreate(object) {
|
|
733
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
734
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object["name"])) return (0, fp_ts_Either.left)("missing_name");
|
|
735
|
+
if (!hasOwnProperty(object, "workflowTemplateId") || !isNonEmptyString(object["workflowTemplateId"])) return (0, fp_ts_Either.left)("missing_workflow_template_id");
|
|
736
|
+
let description = void 0;
|
|
737
|
+
if (hasOwnProperty(object, "description")) {
|
|
738
|
+
if (typeof object["description"] !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
739
|
+
description = object["description"];
|
|
740
|
+
}
|
|
741
|
+
let metadata = void 0;
|
|
742
|
+
if (hasOwnProperty(object, "metadata")) {
|
|
743
|
+
if (typeof object["metadata"] !== "object" || object["metadata"] === null) return (0, fp_ts_Either.left)("invalid_metadata");
|
|
744
|
+
metadata = object["metadata"];
|
|
745
|
+
}
|
|
746
|
+
return (0, fp_ts_Either.right)({
|
|
747
|
+
name: object["name"],
|
|
748
|
+
workflowTemplateId: object["workflowTemplateId"],
|
|
749
|
+
description,
|
|
750
|
+
metadata
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
function validateWorkflowRef(object) {
|
|
754
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
755
|
+
let workflowTemplate = void 0;
|
|
756
|
+
if (hasOwnProperty(object, "workflowTemplate")) {
|
|
757
|
+
const templateRes = validateWorkflowTemplate(object["workflowTemplate"]);
|
|
758
|
+
if ((0, fp_ts_Either.isLeft)(templateRes)) return (0, fp_ts_Either.left)("invalid_workflow_template");
|
|
759
|
+
workflowTemplate = templateRes.right;
|
|
760
|
+
}
|
|
761
|
+
return (0, fp_ts_Either.right)({ workflowTemplate });
|
|
762
|
+
}
|
|
763
|
+
function validateWorkflow(object) {
|
|
764
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
765
|
+
if (!hasOwnProperty(object, "id") || !isNonEmptyString(object["id"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "id") ? "invalid_id" : "missing_id");
|
|
766
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object["name"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "name") ? "invalid_name" : "missing_name");
|
|
767
|
+
if (!hasOwnProperty(object, "status") || !isNonEmptyString(object["status"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
|
|
768
|
+
if (!hasOwnProperty(object, "workflowTemplateId") || !isNonEmptyString(object["workflowTemplateId"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "workflowTemplateId") ? "invalid_workflow_template_id" : "missing_workflow_template_id");
|
|
769
|
+
if (!hasOwnProperty(object, "metadata") || typeof object["metadata"] !== "object" || object["metadata"] === null) return (0, fp_ts_Either.left)(hasOwnProperty(object, "metadata") ? "invalid_metadata" : "missing_metadata");
|
|
770
|
+
if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object["createdAt"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "createdAt") ? "invalid_created_at" : "missing_created_at");
|
|
771
|
+
if (!hasOwnProperty(object, "updatedAt") || !isNonEmptyString(object["updatedAt"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "updatedAt") ? "invalid_updated_at" : "missing_updated_at");
|
|
772
|
+
let description = void 0;
|
|
773
|
+
if (hasOwnProperty(object, "description")) {
|
|
774
|
+
if (typeof object["description"] !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
775
|
+
description = object["description"];
|
|
776
|
+
}
|
|
777
|
+
let expiresAt = void 0;
|
|
778
|
+
if (hasOwnProperty(object, "expiresAt")) {
|
|
779
|
+
if (typeof object["expiresAt"] !== "string") return (0, fp_ts_Either.left)("invalid_expires_at");
|
|
780
|
+
expiresAt = object["expiresAt"];
|
|
781
|
+
}
|
|
782
|
+
let ref = void 0;
|
|
783
|
+
if (hasOwnProperty(object, "ref")) {
|
|
784
|
+
const refRes = validateWorkflowRef(object["ref"]);
|
|
785
|
+
if ((0, fp_ts_Either.isLeft)(refRes)) return (0, fp_ts_Either.left)("invalid_ref");
|
|
786
|
+
ref = refRes.right;
|
|
787
|
+
}
|
|
788
|
+
return (0, fp_ts_Either.right)({
|
|
789
|
+
id: object["id"],
|
|
790
|
+
name: object["name"],
|
|
791
|
+
status: object["status"],
|
|
792
|
+
workflowTemplateId: object["workflowTemplateId"],
|
|
793
|
+
metadata: object["metadata"],
|
|
794
|
+
createdAt: object["createdAt"],
|
|
795
|
+
updatedAt: object["updatedAt"],
|
|
796
|
+
description,
|
|
797
|
+
expiresAt,
|
|
798
|
+
ref
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
function validateGetWorkflowParams(object) {
|
|
802
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
803
|
+
let include = void 0;
|
|
804
|
+
if (hasOwnProperty(object, "include")) {
|
|
805
|
+
const includeVal = object["include"];
|
|
806
|
+
if (!isArray(includeVal)) return (0, fp_ts_Either.left)("invalid_include");
|
|
807
|
+
const validatedInclude = [];
|
|
808
|
+
for (const item of includeVal) {
|
|
809
|
+
if (typeof item !== "string") return (0, fp_ts_Either.left)("invalid_include");
|
|
810
|
+
validatedInclude.push(item);
|
|
811
|
+
}
|
|
812
|
+
include = validatedInclude;
|
|
813
|
+
}
|
|
814
|
+
return (0, fp_ts_Either.right)({ include });
|
|
815
|
+
}
|
|
816
|
+
function validateListWorkflowsParams(object) {
|
|
817
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
818
|
+
let page = void 0;
|
|
819
|
+
if (hasOwnProperty(object, "page")) {
|
|
820
|
+
const val = object["page"];
|
|
821
|
+
if (typeof val !== "number") return (0, fp_ts_Either.left)("invalid_page");
|
|
822
|
+
page = val;
|
|
823
|
+
}
|
|
824
|
+
let limit = void 0;
|
|
825
|
+
if (hasOwnProperty(object, "limit")) {
|
|
826
|
+
const val = object["limit"];
|
|
827
|
+
if (typeof val !== "number") return (0, fp_ts_Either.left)("invalid_limit");
|
|
828
|
+
limit = val;
|
|
829
|
+
}
|
|
830
|
+
let include = void 0;
|
|
831
|
+
if (hasOwnProperty(object, "include")) {
|
|
832
|
+
const includeVal = object["include"];
|
|
833
|
+
if (!isArray(includeVal)) return (0, fp_ts_Either.left)("invalid_include");
|
|
834
|
+
const validatedInclude = [];
|
|
835
|
+
for (const item of includeVal) {
|
|
836
|
+
if (typeof item !== "string") return (0, fp_ts_Either.left)("invalid_include");
|
|
837
|
+
validatedInclude.push(item);
|
|
838
|
+
}
|
|
839
|
+
include = validatedInclude;
|
|
840
|
+
}
|
|
841
|
+
let includeOnlyNonTerminalState = void 0;
|
|
842
|
+
if (hasOwnProperty(object, "includeOnlyNonTerminalState")) {
|
|
843
|
+
const val = object["includeOnlyNonTerminalState"];
|
|
844
|
+
if (typeof val !== "boolean") return (0, fp_ts_Either.left)("invalid_include_only_non_terminal_state");
|
|
845
|
+
includeOnlyNonTerminalState = val;
|
|
846
|
+
}
|
|
847
|
+
let workflowTemplateIdentifier = void 0;
|
|
848
|
+
if (hasOwnProperty(object, "workflowTemplateIdentifier")) {
|
|
849
|
+
const val = object["workflowTemplateIdentifier"];
|
|
850
|
+
if (typeof val !== "string") return (0, fp_ts_Either.left)("invalid_workflow_template_identifier");
|
|
851
|
+
workflowTemplateIdentifier = val;
|
|
852
|
+
}
|
|
853
|
+
return (0, fp_ts_Either.right)({
|
|
854
|
+
page,
|
|
855
|
+
limit,
|
|
856
|
+
include,
|
|
857
|
+
includeOnlyNonTerminalState,
|
|
858
|
+
workflowTemplateIdentifier
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
function validateListWorkflows200Response(object) {
|
|
862
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
863
|
+
if (!hasOwnProperty(object, "data") || !isArray(object["data"])) return (0, fp_ts_Either.left)("missing_data");
|
|
864
|
+
const data = [];
|
|
865
|
+
for (const item of object["data"]) {
|
|
866
|
+
const itemRes = validateWorkflow(item);
|
|
867
|
+
if ((0, fp_ts_Either.isLeft)(itemRes)) return (0, fp_ts_Either.left)("invalid_data");
|
|
868
|
+
data.push(itemRes.right);
|
|
869
|
+
}
|
|
870
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
871
|
+
const pageRes = validatePagination(object["pagination"]);
|
|
872
|
+
if ((0, fp_ts_Either.isLeft)(pageRes)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
873
|
+
return (0, fp_ts_Either.right)({
|
|
874
|
+
data,
|
|
875
|
+
pagination: pageRes.right
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
function validateVoteApprove(object) {
|
|
879
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
880
|
+
if (!hasOwnProperty(object, "type") || object["type"] !== "APPROVE") return (0, fp_ts_Either.left)(hasOwnProperty(object, "type") ? "invalid_type" : "missing_type");
|
|
881
|
+
if (!hasOwnProperty(object, "votedForGroups")) return (0, fp_ts_Either.left)("missing_voted_for_groups");
|
|
882
|
+
const votedForGroupsVal = object["votedForGroups"];
|
|
883
|
+
if (!isArray(votedForGroupsVal)) return (0, fp_ts_Either.left)("invalid_voted_for_groups");
|
|
884
|
+
const validatedGroups = [];
|
|
885
|
+
for (const v of votedForGroupsVal) {
|
|
886
|
+
if (typeof v !== "string") return (0, fp_ts_Either.left)("invalid_voted_for_groups");
|
|
887
|
+
validatedGroups.push(v);
|
|
888
|
+
}
|
|
889
|
+
return (0, fp_ts_Either.right)({
|
|
890
|
+
type: "APPROVE",
|
|
891
|
+
votedForGroups: validatedGroups
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
function validateVoteVeto(object) {
|
|
895
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
896
|
+
if (!hasOwnProperty(object, "type") || object["type"] !== "VETO") return (0, fp_ts_Either.left)(hasOwnProperty(object, "type") ? "invalid_type" : "missing_type");
|
|
897
|
+
return (0, fp_ts_Either.right)({ type: "VETO" });
|
|
898
|
+
}
|
|
899
|
+
function validateVoteWithdraw(object) {
|
|
900
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
901
|
+
if (!hasOwnProperty(object, "type") || object["type"] !== "WITHDRAW") return (0, fp_ts_Either.left)(hasOwnProperty(object, "type") ? "invalid_type" : "missing_type");
|
|
902
|
+
return (0, fp_ts_Either.right)({ type: "WITHDRAW" });
|
|
903
|
+
}
|
|
904
|
+
function validateWorkflowVoteRequestVoteType(object) {
|
|
905
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
906
|
+
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("invalid_vote_type");
|
|
907
|
+
if (object["type"] === "APPROVE") {
|
|
908
|
+
const res = validateVoteApprove(object);
|
|
909
|
+
if ((0, fp_ts_Either.isLeft)(res)) return (0, fp_ts_Either.left)("invalid_vote_type");
|
|
910
|
+
return (0, fp_ts_Either.right)(res.right);
|
|
911
|
+
} else if (object["type"] === "VETO") {
|
|
912
|
+
const res = validateVoteVeto(object);
|
|
913
|
+
if ((0, fp_ts_Either.isLeft)(res)) return (0, fp_ts_Either.left)("invalid_vote_type");
|
|
914
|
+
return (0, fp_ts_Either.right)(res.right);
|
|
915
|
+
} else if (object["type"] === "WITHDRAW") {
|
|
916
|
+
const res = validateVoteWithdraw(object);
|
|
917
|
+
if ((0, fp_ts_Either.isLeft)(res)) return (0, fp_ts_Either.left)("invalid_vote_type");
|
|
918
|
+
return (0, fp_ts_Either.right)(res.right);
|
|
919
|
+
}
|
|
920
|
+
return (0, fp_ts_Either.left)("invalid_vote_type");
|
|
921
|
+
}
|
|
922
|
+
function validateWorkflowVoteRequest(object) {
|
|
923
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
924
|
+
let reason = void 0;
|
|
925
|
+
if (hasOwnProperty(object, "reason")) {
|
|
926
|
+
if (typeof object["reason"] !== "string") return (0, fp_ts_Either.left)("invalid_reason");
|
|
927
|
+
reason = object["reason"];
|
|
928
|
+
}
|
|
929
|
+
if (!hasOwnProperty(object, "voteType")) return (0, fp_ts_Either.left)("missing_vote_type");
|
|
930
|
+
const voteTypeRes = validateWorkflowVoteRequestVoteType(object["voteType"]);
|
|
931
|
+
if ((0, fp_ts_Either.isLeft)(voteTypeRes)) return (0, fp_ts_Either.left)("invalid_vote_type");
|
|
932
|
+
return (0, fp_ts_Either.right)({
|
|
933
|
+
reason,
|
|
934
|
+
voteType: voteTypeRes.right
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
function validateWorkflowVote(object) {
|
|
938
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
939
|
+
if (!hasOwnProperty(object, "voterId") || !isNonEmptyString(object["voterId"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "voterId") ? "invalid_voter_id" : "missing_voter_id");
|
|
940
|
+
if (!hasOwnProperty(object, "voterType") || !isNonEmptyString(object["voterType"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "voterType") ? "invalid_voter_type" : "missing_voter_type");
|
|
941
|
+
if (!hasOwnProperty(object, "voteType") || !isNonEmptyString(object["voteType"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "voteType") ? "invalid_vote_type" : "missing_vote_type");
|
|
942
|
+
if (!hasOwnProperty(object, "timestamp") || !isNonEmptyString(object["timestamp"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "timestamp") ? "invalid_timestamp" : "missing_timestamp");
|
|
943
|
+
let reason = void 0;
|
|
944
|
+
if (hasOwnProperty(object, "reason")) {
|
|
945
|
+
const val = object["reason"];
|
|
946
|
+
if (typeof val !== "string") return (0, fp_ts_Either.left)("invalid_reason");
|
|
947
|
+
reason = val;
|
|
948
|
+
}
|
|
949
|
+
let votedForGroups = void 0;
|
|
950
|
+
if (hasOwnProperty(object, "votedForGroups")) {
|
|
951
|
+
const votedForGroupsVal = object["votedForGroups"];
|
|
952
|
+
if (!isArray(votedForGroupsVal)) return (0, fp_ts_Either.left)("invalid_voted_for_groups");
|
|
953
|
+
const validatedGroups = [];
|
|
954
|
+
for (const v of votedForGroupsVal) {
|
|
955
|
+
if (typeof v !== "string") return (0, fp_ts_Either.left)("invalid_voted_for_groups");
|
|
956
|
+
validatedGroups.push(v);
|
|
957
|
+
}
|
|
958
|
+
votedForGroups = validatedGroups;
|
|
959
|
+
}
|
|
960
|
+
return (0, fp_ts_Either.right)({
|
|
961
|
+
voterId: object["voterId"],
|
|
962
|
+
voterType: object["voterType"],
|
|
963
|
+
voteType: object["voteType"],
|
|
964
|
+
timestamp: object["timestamp"],
|
|
965
|
+
reason,
|
|
966
|
+
votedForGroups
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
function validateCanVoteResponse(object) {
|
|
970
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
971
|
+
if (!hasOwnProperty(object, "canVote") || typeof object["canVote"] !== "boolean") return (0, fp_ts_Either.left)(hasOwnProperty(object, "canVote") ? "invalid_can_vote" : "missing_can_vote");
|
|
972
|
+
if (!hasOwnProperty(object, "voteStatus") || !isNonEmptyString(object["voteStatus"])) return (0, fp_ts_Either.left)(hasOwnProperty(object, "voteStatus") ? "invalid_vote_status" : "missing_vote_status");
|
|
973
|
+
let cantVoteReason = void 0;
|
|
974
|
+
if (hasOwnProperty(object, "cantVoteReason")) {
|
|
975
|
+
if (typeof object["cantVoteReason"] !== "string") return (0, fp_ts_Either.left)("invalid_cant_vote_reason");
|
|
976
|
+
cantVoteReason = object["cantVoteReason"];
|
|
977
|
+
}
|
|
978
|
+
let requireHighPrivilege = void 0;
|
|
979
|
+
if (hasOwnProperty(object, "requireHighPrivilege")) {
|
|
980
|
+
if (typeof object["requireHighPrivilege"] !== "boolean") return (0, fp_ts_Either.left)("invalid_require_high_privilege");
|
|
981
|
+
requireHighPrivilege = object["requireHighPrivilege"];
|
|
982
|
+
}
|
|
983
|
+
return (0, fp_ts_Either.right)({
|
|
984
|
+
canVote: object["canVote"],
|
|
985
|
+
voteStatus: object["voteStatus"],
|
|
986
|
+
cantVoteReason,
|
|
987
|
+
requireHighPrivilege
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
function validateGetWorkflowVotes200Response(object) {
|
|
991
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
992
|
+
if (!hasOwnProperty(object, "votes") || !isArray(object["votes"])) return (0, fp_ts_Either.left)("missing_votes");
|
|
993
|
+
const votes = [];
|
|
994
|
+
for (const vote of object["votes"]) {
|
|
995
|
+
const voteRes = validateWorkflowVote(vote);
|
|
996
|
+
if ((0, fp_ts_Either.isLeft)(voteRes)) return (0, fp_ts_Either.left)("invalid_votes");
|
|
997
|
+
votes.push(voteRes.right);
|
|
998
|
+
}
|
|
999
|
+
return (0, fp_ts_Either.right)({ votes });
|
|
1000
|
+
}
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/validators/users.validators.ts
|
|
1003
|
+
function validateUser(object) {
|
|
1004
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1005
|
+
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1006
|
+
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1007
|
+
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1008
|
+
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1009
|
+
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1010
|
+
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1011
|
+
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1012
|
+
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1013
|
+
if (!hasOwnProperty(object, "createdAt")) return (0, fp_ts_Either.left)("missing_created_at");
|
|
1014
|
+
if (!isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
1015
|
+
return (0, fp_ts_Either.right)({
|
|
1016
|
+
id: object.id,
|
|
1017
|
+
displayName: object.displayName,
|
|
1018
|
+
email: object.email,
|
|
1019
|
+
orgRole: object.orgRole,
|
|
1020
|
+
createdAt: object.createdAt
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
function validateUserCreate(object) {
|
|
1024
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1025
|
+
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1026
|
+
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1027
|
+
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1028
|
+
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1029
|
+
if (!hasOwnProperty(object, "orgRole")) return (0, fp_ts_Either.left)("missing_org_role");
|
|
1030
|
+
if (!isNonEmptyString(object.orgRole)) return (0, fp_ts_Either.left)("invalid_org_role");
|
|
1031
|
+
return (0, fp_ts_Either.right)({
|
|
1032
|
+
displayName: object.displayName,
|
|
1033
|
+
email: object.email,
|
|
1034
|
+
orgRole: object.orgRole
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
function validateUserSummary(object) {
|
|
1038
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1039
|
+
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1040
|
+
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1041
|
+
if (!hasOwnProperty(object, "displayName")) return (0, fp_ts_Either.left)("missing_display_name");
|
|
1042
|
+
if (!isNonEmptyString(object.displayName)) return (0, fp_ts_Either.left)("invalid_display_name");
|
|
1043
|
+
if (!hasOwnProperty(object, "email")) return (0, fp_ts_Either.left)("missing_email");
|
|
1044
|
+
if (!isNonEmptyString(object.email)) return (0, fp_ts_Either.left)("invalid_email");
|
|
1045
|
+
return (0, fp_ts_Either.right)({
|
|
1046
|
+
id: object.id,
|
|
1047
|
+
displayName: object.displayName,
|
|
1048
|
+
email: object.email
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
function validateListUsers200Response(object) {
|
|
1052
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1053
|
+
if (!hasOwnProperty(object, "users")) return (0, fp_ts_Either.left)("missing_users");
|
|
1054
|
+
if (!isArray(object.users)) return (0, fp_ts_Either.left)("invalid_users");
|
|
1055
|
+
for (const user of object.users) if ((0, fp_ts_Either.isLeft)(validateUserSummary(user))) return (0, fp_ts_Either.left)("invalid_users");
|
|
1056
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1057
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
1058
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1059
|
+
const users = [];
|
|
1060
|
+
for (const user of object.users) {
|
|
1061
|
+
const validatedUser = validateUserSummary(user);
|
|
1062
|
+
if ((0, fp_ts_Either.isRight)(validatedUser)) users.push(validatedUser.right);
|
|
1063
|
+
}
|
|
1064
|
+
return (0, fp_ts_Either.right)({
|
|
1065
|
+
users,
|
|
1066
|
+
pagination: paginationValidation.right
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
function validateRoleScope(object) {
|
|
1070
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1071
|
+
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("missing_type");
|
|
1072
|
+
if (object.type === "org") return (0, fp_ts_Either.right)({ type: "org" });
|
|
1073
|
+
else if (object.type === "space") {
|
|
1074
|
+
if (!hasOwnProperty(object, "spaceId")) return (0, fp_ts_Either.left)("missing_space_id");
|
|
1075
|
+
if (!isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
1076
|
+
return (0, fp_ts_Either.right)({
|
|
1077
|
+
type: "space",
|
|
1078
|
+
spaceId: object.spaceId
|
|
1079
|
+
});
|
|
1080
|
+
} else if (object.type === "group") {
|
|
1081
|
+
if (!hasOwnProperty(object, "groupId")) return (0, fp_ts_Either.left)("missing_group_id");
|
|
1082
|
+
if (!isNonEmptyString(object.groupId)) return (0, fp_ts_Either.left)("invalid_group_id");
|
|
1083
|
+
return (0, fp_ts_Either.right)({
|
|
1084
|
+
type: "group",
|
|
1085
|
+
groupId: object.groupId
|
|
1086
|
+
});
|
|
1087
|
+
} else if (object.type === "workflow_template") {
|
|
1088
|
+
if (!hasOwnProperty(object, "workflowTemplateId")) return (0, fp_ts_Either.left)("missing_workflow_template_id");
|
|
1089
|
+
if (!isNonEmptyString(object.workflowTemplateId)) return (0, fp_ts_Either.left)("invalid_workflow_template_id");
|
|
1090
|
+
return (0, fp_ts_Either.right)({
|
|
1091
|
+
type: "workflow_template",
|
|
1092
|
+
workflowTemplateId: object.workflowTemplateId
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
return (0, fp_ts_Either.left)("invalid_type");
|
|
1096
|
+
}
|
|
1097
|
+
function validateRoleOperationItem(object) {
|
|
1098
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1099
|
+
if (!hasOwnProperty(object, "roleName")) return (0, fp_ts_Either.left)("missing_role_name");
|
|
1100
|
+
if (!isNonEmptyString(object.roleName)) return (0, fp_ts_Either.left)("invalid_role_name");
|
|
1101
|
+
if (!hasOwnProperty(object, "scope")) return (0, fp_ts_Either.left)("missing_scope");
|
|
1102
|
+
const scopeValidation = validateRoleScope(object.scope);
|
|
1103
|
+
if ((0, fp_ts_Either.isLeft)(scopeValidation)) return (0, fp_ts_Either.left)("invalid_scope");
|
|
1104
|
+
return (0, fp_ts_Either.right)({
|
|
1105
|
+
roleName: object.roleName,
|
|
1106
|
+
scope: scopeValidation.right
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
function validateRoleAssignmentRequest(object) {
|
|
1110
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1111
|
+
if (!hasOwnProperty(object, "roles")) return (0, fp_ts_Either.left)("missing_roles");
|
|
1112
|
+
if (!isArray(object.roles)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1113
|
+
const roles = [];
|
|
1114
|
+
for (const role of object.roles) {
|
|
1115
|
+
const roleValidation = validateRoleOperationItem(role);
|
|
1116
|
+
if ((0, fp_ts_Either.isLeft)(roleValidation)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1117
|
+
roles.push(roleValidation.right);
|
|
1118
|
+
}
|
|
1119
|
+
return (0, fp_ts_Either.right)({ roles });
|
|
1120
|
+
}
|
|
1121
|
+
function validateRoleRemovalRequest(object) {
|
|
1122
|
+
return validateRoleAssignmentRequest(object);
|
|
1123
|
+
}
|
|
1124
|
+
//#endregion
|
|
1125
|
+
//#region src/validators/spaces.validators.ts
|
|
1126
|
+
function validateSpace(object) {
|
|
1127
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1128
|
+
if (!hasOwnProperty(object, "id")) return (0, fp_ts_Either.left)("missing_id");
|
|
1129
|
+
if (!isNonEmptyString(object.id)) return (0, fp_ts_Either.left)("invalid_id");
|
|
1130
|
+
if (!hasOwnProperty(object, "name")) return (0, fp_ts_Either.left)("missing_name");
|
|
1131
|
+
if (!isNonEmptyString(object.name)) return (0, fp_ts_Either.left)("invalid_name");
|
|
1132
|
+
if (!hasOwnProperty(object, "createdAt")) return (0, fp_ts_Either.left)("missing_created_at");
|
|
1133
|
+
if (!isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
|
|
1134
|
+
if (!hasOwnProperty(object, "updatedAt")) return (0, fp_ts_Either.left)("missing_updated_at");
|
|
1135
|
+
if (!isNonEmptyString(object.updatedAt)) return (0, fp_ts_Either.left)("invalid_updated_at");
|
|
1136
|
+
const result = {
|
|
1137
|
+
id: object.id,
|
|
1138
|
+
name: object.name,
|
|
1139
|
+
createdAt: object.createdAt,
|
|
1140
|
+
updatedAt: object.updatedAt
|
|
1141
|
+
};
|
|
1142
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
1143
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
1144
|
+
result.description = object.description;
|
|
1145
|
+
}
|
|
1146
|
+
return (0, fp_ts_Either.right)(result);
|
|
1147
|
+
}
|
|
1148
|
+
function validateSpaceCreate(object) {
|
|
1149
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1150
|
+
if (!hasOwnProperty(object, "name")) return (0, fp_ts_Either.left)("missing_name");
|
|
1151
|
+
if (!isNonEmptyString(object.name)) return (0, fp_ts_Either.left)("invalid_name");
|
|
1152
|
+
const result = { name: object.name };
|
|
1153
|
+
if (hasOwnProperty(object, "description") && object.description !== void 0) {
|
|
1154
|
+
if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
|
|
1155
|
+
result.description = object.description;
|
|
1156
|
+
}
|
|
1157
|
+
return (0, fp_ts_Either.right)(result);
|
|
1158
|
+
}
|
|
1159
|
+
function validateListSpaces200Response(object) {
|
|
1160
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1161
|
+
if (!hasOwnProperty(object, "data")) return (0, fp_ts_Either.left)("missing_data");
|
|
1162
|
+
if (!isArray(object.data)) return (0, fp_ts_Either.left)("invalid_data");
|
|
1163
|
+
const data = [];
|
|
1164
|
+
for (const item of object.data) {
|
|
1165
|
+
const validatedItem = validateSpace(item);
|
|
1166
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_data");
|
|
1167
|
+
data.push(validatedItem.right);
|
|
1168
|
+
}
|
|
1169
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1170
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
1171
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1172
|
+
return (0, fp_ts_Either.right)({
|
|
1173
|
+
data,
|
|
1174
|
+
pagination: paginationValidation.right
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
function validateSpaceScope(object) {
|
|
1178
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1179
|
+
if (!hasOwnProperty(object, "type")) return (0, fp_ts_Either.left)("missing_type");
|
|
1180
|
+
if (object.type !== "space") return (0, fp_ts_Either.left)("invalid_type");
|
|
1181
|
+
if (!hasOwnProperty(object, "spaceId")) return (0, fp_ts_Either.left)("missing_space_id");
|
|
1182
|
+
if (!isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
|
|
1183
|
+
return (0, fp_ts_Either.right)({
|
|
1184
|
+
type: "space",
|
|
1185
|
+
spaceId: object.spaceId
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
//#endregion
|
|
1189
|
+
//#region src/validators/agents.validators.ts
|
|
1190
|
+
function validateAgentSummary(object) {
|
|
1191
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1192
|
+
if (!hasOwnProperty(object, "id") || !isNonEmptyString(object.id)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "id") ? "invalid_id" : "missing_id");
|
|
1193
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "name") ? "invalid_name" : "missing_name");
|
|
1194
|
+
return (0, fp_ts_Either.right)({
|
|
1195
|
+
id: object.id,
|
|
1196
|
+
name: object.name
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
function validateAgentRegistrationRequest(object) {
|
|
1200
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1201
|
+
if (!hasOwnProperty(object, "agentName") || !isNonEmptyString(object.agentName)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "agentName") ? "invalid_agent_name" : "missing_agent_name");
|
|
1202
|
+
return (0, fp_ts_Either.right)({ agentName: object.agentName });
|
|
1203
|
+
}
|
|
1204
|
+
function validateAgentChallengeRequest(object) {
|
|
1205
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1206
|
+
if (!hasOwnProperty(object, "agentName") || !isNonEmptyString(object.agentName)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "agentName") ? "invalid_agent_name" : "missing_agent_name");
|
|
1207
|
+
return (0, fp_ts_Either.right)({ agentName: object.agentName });
|
|
1208
|
+
}
|
|
1209
|
+
function validateAgentChallengeResponse(object) {
|
|
1210
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1211
|
+
if (!hasOwnProperty(object, "challenge") || !isNonEmptyString(object.challenge)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "challenge") ? "invalid_challenge" : "missing_challenge");
|
|
1212
|
+
return (0, fp_ts_Either.right)({ challenge: object.challenge });
|
|
1213
|
+
}
|
|
1214
|
+
function validateAgentTokenRequest(object) {
|
|
1215
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1216
|
+
if (!hasOwnProperty(object, "grantType")) return (0, fp_ts_Either.left)("missing_grant_type");
|
|
1217
|
+
if (typeof object.grantType !== "string") return (0, fp_ts_Either.left)("invalid_grant_type");
|
|
1218
|
+
const grantType = getStringAsEnum(object.grantType, AgentTokenRequest.GrantTypeEnum);
|
|
1219
|
+
if (!grantType) return (0, fp_ts_Either.left)("invalid_grant_type");
|
|
1220
|
+
if (!hasOwnProperty(object, "clientAssertionType")) return (0, fp_ts_Either.left)("missing_client_assertion_type");
|
|
1221
|
+
if (typeof object.clientAssertionType !== "string") return (0, fp_ts_Either.left)("invalid_client_assertion_type");
|
|
1222
|
+
const clientAssertionType = getStringAsEnum(object.clientAssertionType, AgentTokenRequest.ClientAssertionTypeEnum);
|
|
1223
|
+
if (!clientAssertionType) return (0, fp_ts_Either.left)("invalid_client_assertion_type");
|
|
1224
|
+
if (!hasOwnProperty(object, "clientAssertion") || !isNonEmptyString(object.clientAssertion)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "clientAssertion") ? "invalid_client_assertion" : "missing_client_assertion");
|
|
1225
|
+
return (0, fp_ts_Either.right)({
|
|
1226
|
+
grantType,
|
|
1227
|
+
clientAssertionType,
|
|
1228
|
+
clientAssertion: object.clientAssertion
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
function validateAgentTokenResponse(object) {
|
|
1232
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1233
|
+
if (!hasOwnProperty(object, "accessToken") || !isNonEmptyString(object.accessToken)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "accessToken") ? "invalid_access_token" : "missing_access_token");
|
|
1234
|
+
if (!hasOwnProperty(object, "refreshToken") || !isNonEmptyString(object.refreshToken)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "refreshToken") ? "invalid_refresh_token" : "missing_refresh_token");
|
|
1235
|
+
return (0, fp_ts_Either.right)({
|
|
1236
|
+
accessToken: object.accessToken,
|
|
1237
|
+
refreshToken: object.refreshToken
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
function validateListAgentsParams(object) {
|
|
1241
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1242
|
+
let page = void 0;
|
|
1243
|
+
if (hasOwnProperty(object, "page") && object.page !== void 0) {
|
|
1244
|
+
if (typeof object.page !== "number") return (0, fp_ts_Either.left)("invalid_page");
|
|
1245
|
+
page = object.page;
|
|
1246
|
+
}
|
|
1247
|
+
let limit = void 0;
|
|
1248
|
+
if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
|
|
1249
|
+
if (typeof object.limit !== "number") return (0, fp_ts_Either.left)("invalid_limit");
|
|
1250
|
+
limit = object.limit;
|
|
1251
|
+
}
|
|
1252
|
+
return (0, fp_ts_Either.right)({
|
|
1253
|
+
page,
|
|
1254
|
+
limit
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
function validateListAgents200Response(object) {
|
|
1258
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1259
|
+
if (!hasOwnProperty(object, "agents") || !isArray(object.agents)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "agents") ? "invalid_agents" : "missing_agents");
|
|
1260
|
+
const agents = [];
|
|
1261
|
+
for (const item of object.agents) {
|
|
1262
|
+
const validatedItem = validateAgentSummary(item);
|
|
1263
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_agents");
|
|
1264
|
+
agents.push(validatedItem.right);
|
|
1265
|
+
}
|
|
1266
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1267
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
1268
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1269
|
+
return (0, fp_ts_Either.right)({
|
|
1270
|
+
agents,
|
|
1271
|
+
pagination: paginationValidation.right
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
function validateAgentGet200Response(object) {
|
|
1275
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1276
|
+
if (!hasOwnProperty(object, "id") || !isNonEmptyString(object.id)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "id") ? "invalid_id" : "missing_id");
|
|
1277
|
+
if (!hasOwnProperty(object, "agentName") || !isNonEmptyString(object.agentName)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "agentName") ? "invalid_agent_name" : "missing_agent_name");
|
|
1278
|
+
if (!hasOwnProperty(object, "publicKey") || !isNonEmptyString(object.publicKey)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "publicKey") ? "invalid_public_key" : "missing_public_key");
|
|
1279
|
+
if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "createdAt") ? "invalid_created_at" : "missing_created_at");
|
|
1280
|
+
return (0, fp_ts_Either.right)({
|
|
1281
|
+
id: object.id,
|
|
1282
|
+
agentName: object.agentName,
|
|
1283
|
+
publicKey: object.publicKey,
|
|
1284
|
+
createdAt: object.createdAt
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
//#endregion
|
|
1288
|
+
//#region src/validators/organization-admins.validators.ts
|
|
1289
|
+
function validateOrganizationAdmin(object) {
|
|
1290
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1291
|
+
if (!hasOwnProperty(object, "userId") || !isNonEmptyString(object.userId)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "userId") ? "invalid_user_id" : "missing_user_id");
|
|
1292
|
+
if (!hasOwnProperty(object, "email") || !isNonEmptyString(object.email)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "email") ? "invalid_email" : "missing_email");
|
|
1293
|
+
if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "createdAt") ? "invalid_created_at" : "missing_created_at");
|
|
1294
|
+
return (0, fp_ts_Either.right)({
|
|
1295
|
+
userId: object.userId,
|
|
1296
|
+
email: object.email,
|
|
1297
|
+
createdAt: object.createdAt
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
function validateOrganizationAdminCreate(object) {
|
|
1301
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1302
|
+
if (!hasOwnProperty(object, "email") || !isNonEmptyString(object.email)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "email") ? "invalid_email" : "missing_email");
|
|
1303
|
+
return (0, fp_ts_Either.right)({ email: object.email });
|
|
1304
|
+
}
|
|
1305
|
+
function validateOrganizationAdminRemove(object) {
|
|
1306
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1307
|
+
if (!hasOwnProperty(object, "userId") || !isNonEmptyString(object.userId)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "userId") ? "invalid_user_id" : "missing_user_id");
|
|
1308
|
+
return (0, fp_ts_Either.right)({ userId: object.userId });
|
|
1309
|
+
}
|
|
1310
|
+
function validateListOrganizationAdminsForOrg200Response(object) {
|
|
1311
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1312
|
+
if (!hasOwnProperty(object, "data") || !isArray(object.data)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "data") ? "invalid_data" : "missing_data");
|
|
1313
|
+
const data = [];
|
|
1314
|
+
for (const item of object.data) {
|
|
1315
|
+
const validatedItem = validateOrganizationAdmin(item);
|
|
1316
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_data");
|
|
1317
|
+
data.push(validatedItem.right);
|
|
1318
|
+
}
|
|
1319
|
+
if (!hasOwnProperty(object, "pagination")) return (0, fp_ts_Either.left)("missing_pagination");
|
|
1320
|
+
const paginationValidation = validatePagination(object.pagination);
|
|
1321
|
+
if ((0, fp_ts_Either.isLeft)(paginationValidation)) return (0, fp_ts_Either.left)("invalid_pagination");
|
|
1322
|
+
return (0, fp_ts_Either.right)({
|
|
1323
|
+
data,
|
|
1324
|
+
pagination: paginationValidation.right
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/validators/roles.validators.ts
|
|
1329
|
+
function validateRoleTemplate(object) {
|
|
1330
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1331
|
+
if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "name") ? "invalid_name" : "missing_name");
|
|
1332
|
+
if (!hasOwnProperty(object, "scope") || !isNonEmptyString(object.scope)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "scope") ? "invalid_scope" : "missing_scope");
|
|
1333
|
+
if (!hasOwnProperty(object, "permissions") || !isArray(object.permissions)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "permissions") ? "invalid_permissions" : "missing_permissions");
|
|
1334
|
+
const permissions = [];
|
|
1335
|
+
for (const perm of object.permissions) {
|
|
1336
|
+
if (!isNonEmptyString(perm)) return (0, fp_ts_Either.left)("invalid_permissions");
|
|
1337
|
+
permissions.push(perm);
|
|
1338
|
+
}
|
|
1339
|
+
return (0, fp_ts_Either.right)({
|
|
1340
|
+
name: object.name,
|
|
1341
|
+
permissions,
|
|
1342
|
+
scope: object.scope
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
function validateListRoleTemplates200Response(object) {
|
|
1346
|
+
if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
|
|
1347
|
+
if (!hasOwnProperty(object, "roles") || !isArray(object.roles)) return (0, fp_ts_Either.left)(hasOwnProperty(object, "roles") ? "invalid_roles" : "missing_roles");
|
|
1348
|
+
const roles = [];
|
|
1349
|
+
for (const item of object.roles) {
|
|
1350
|
+
const validatedItem = validateRoleTemplate(item);
|
|
1351
|
+
if ((0, fp_ts_Either.isLeft)(validatedItem)) return (0, fp_ts_Either.left)("invalid_roles");
|
|
1352
|
+
roles.push(validatedItem.right);
|
|
1353
|
+
}
|
|
1354
|
+
return (0, fp_ts_Either.right)({ roles });
|
|
1355
|
+
}
|
|
1356
|
+
//#endregion
|
|
1357
|
+
Object.defineProperty(exports, "AgentTokenRequest", {
|
|
1358
|
+
enumerable: true,
|
|
1359
|
+
get: function() {
|
|
1360
|
+
return AgentTokenRequest;
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
Object.defineProperty(exports, "AndRule", {
|
|
1364
|
+
enumerable: true,
|
|
1365
|
+
get: function() {
|
|
1366
|
+
return AndRule;
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
Object.defineProperty(exports, "EmailAction", {
|
|
1370
|
+
enumerable: true,
|
|
1371
|
+
get: function() {
|
|
1372
|
+
return EmailAction;
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
Object.defineProperty(exports, "GroupRequirementRule", {
|
|
1376
|
+
enumerable: true,
|
|
1377
|
+
get: function() {
|
|
1378
|
+
return GroupRequirementRule;
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
Object.defineProperty(exports, "GroupScope", {
|
|
1382
|
+
enumerable: true,
|
|
1383
|
+
get: function() {
|
|
1384
|
+
return GroupScope;
|
|
1385
|
+
}
|
|
1386
|
+
});
|
|
1387
|
+
Object.defineProperty(exports, "OrRule", {
|
|
1388
|
+
enumerable: true,
|
|
1389
|
+
get: function() {
|
|
1390
|
+
return OrRule;
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
Object.defineProperty(exports, "OrgScope", {
|
|
1394
|
+
enumerable: true,
|
|
1395
|
+
get: function() {
|
|
1396
|
+
return OrgScope;
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1399
|
+
Object.defineProperty(exports, "SpaceScope", {
|
|
1400
|
+
enumerable: true,
|
|
1401
|
+
get: function() {
|
|
1402
|
+
return SpaceScope;
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
Object.defineProperty(exports, "VoteApprove", {
|
|
1406
|
+
enumerable: true,
|
|
1407
|
+
get: function() {
|
|
1408
|
+
return VoteApprove;
|
|
1409
|
+
}
|
|
1410
|
+
});
|
|
1411
|
+
Object.defineProperty(exports, "VoteVeto", {
|
|
1412
|
+
enumerable: true,
|
|
1413
|
+
get: function() {
|
|
1414
|
+
return VoteVeto;
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
Object.defineProperty(exports, "VoteWithdraw", {
|
|
1418
|
+
enumerable: true,
|
|
1419
|
+
get: function() {
|
|
1420
|
+
return VoteWithdraw;
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
Object.defineProperty(exports, "WebhookAction", {
|
|
1424
|
+
enumerable: true,
|
|
1425
|
+
get: function() {
|
|
1426
|
+
return WebhookAction;
|
|
1427
|
+
}
|
|
1428
|
+
});
|
|
1429
|
+
Object.defineProperty(exports, "WorkflowTemplate", {
|
|
1430
|
+
enumerable: true,
|
|
1431
|
+
get: function() {
|
|
1432
|
+
return WorkflowTemplate;
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
Object.defineProperty(exports, "WorkflowTemplateScope", {
|
|
1436
|
+
enumerable: true,
|
|
1437
|
+
get: function() {
|
|
1438
|
+
return WorkflowTemplateScope;
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
exports.validateAPIError = validateAPIError;
|
|
1442
|
+
exports.validateAddGroupEntitiesRequest = validateAddGroupEntitiesRequest;
|
|
1443
|
+
exports.validateAgentChallengeRequest = validateAgentChallengeRequest;
|
|
1444
|
+
exports.validateAgentChallengeResponse = validateAgentChallengeResponse;
|
|
1445
|
+
exports.validateAgentGet200Response = validateAgentGet200Response;
|
|
1446
|
+
exports.validateAgentRegistrationRequest = validateAgentRegistrationRequest;
|
|
1447
|
+
exports.validateAgentRegistrationResponse = validateAgentRegistrationResponse;
|
|
1448
|
+
exports.validateAgentTokenRequest = validateAgentTokenRequest;
|
|
1449
|
+
exports.validateAgentTokenResponse = validateAgentTokenResponse;
|
|
1450
|
+
exports.validateCanVoteResponse = validateCanVoteResponse;
|
|
1451
|
+
exports.validateGetEntityInfo200Response = validateGetEntityInfo200Response;
|
|
1452
|
+
exports.validateGetWorkflowParams = validateGetWorkflowParams;
|
|
1453
|
+
exports.validateGetWorkflowVotes200Response = validateGetWorkflowVotes200Response;
|
|
1454
|
+
exports.validateGroupCreate = validateGroupCreate;
|
|
1455
|
+
exports.validateGroupInfo = validateGroupInfo;
|
|
1456
|
+
exports.validateGroupScope = validateGroupScope;
|
|
1457
|
+
exports.validateHealthResponse = validateHealthResponse;
|
|
1458
|
+
exports.validateInitiateCliLogin200Response = validateInitiateCliLogin200Response;
|
|
1459
|
+
exports.validateInitiateCliLoginRequest = validateInitiateCliLoginRequest;
|
|
1460
|
+
exports.validateListAgents200Response = validateListAgents200Response;
|
|
1461
|
+
exports.validateListAgentsParams = validateListAgentsParams;
|
|
1462
|
+
exports.validateListGroupEntities200Response = validateListGroupEntities200Response;
|
|
1463
|
+
exports.validateListGroups200Response = validateListGroups200Response;
|
|
1464
|
+
exports.validateListOrganizationAdminsForOrg200Response = validateListOrganizationAdminsForOrg200Response;
|
|
1465
|
+
exports.validateListRoleTemplates200Response = validateListRoleTemplates200Response;
|
|
1466
|
+
exports.validateListSpaces200Response = validateListSpaces200Response;
|
|
1467
|
+
exports.validateListUsers200Response = validateListUsers200Response;
|
|
1468
|
+
exports.validateListWorkflowTemplates200Response = validateListWorkflowTemplates200Response;
|
|
1469
|
+
exports.validateListWorkflowTemplatesParams = validateListWorkflowTemplatesParams;
|
|
1470
|
+
exports.validateListWorkflows200Response = validateListWorkflows200Response;
|
|
1471
|
+
exports.validateListWorkflowsParams = validateListWorkflowsParams;
|
|
1472
|
+
exports.validateOidcCallbackRequest = validateOidcCallbackRequest;
|
|
1473
|
+
exports.validateOrganizationAdminCreate = validateOrganizationAdminCreate;
|
|
1474
|
+
exports.validateOrganizationAdminRemove = validateOrganizationAdminRemove;
|
|
1475
|
+
exports.validatePagination = validatePagination;
|
|
1476
|
+
exports.validatePrivilegedTokenExchangeRequest = validatePrivilegedTokenExchangeRequest;
|
|
1477
|
+
exports.validatePrivilegedTokenResponse = validatePrivilegedTokenResponse;
|
|
1478
|
+
exports.validateRefreshTokenRequest = validateRefreshTokenRequest;
|
|
1479
|
+
exports.validateRemoveGroupEntitiesRequest = validateRemoveGroupEntitiesRequest;
|
|
1480
|
+
exports.validateRoleAssignmentRequest = validateRoleAssignmentRequest;
|
|
1481
|
+
exports.validateRoleRemovalRequest = validateRoleRemovalRequest;
|
|
1482
|
+
exports.validateSpaceCreate = validateSpaceCreate;
|
|
1483
|
+
exports.validateSpaceScope = validateSpaceScope;
|
|
1484
|
+
exports.validateTokenRequest = validateTokenRequest;
|
|
1485
|
+
exports.validateTokenResponse = validateTokenResponse;
|
|
1486
|
+
exports.validateUser = validateUser;
|
|
1487
|
+
exports.validateUserCreate = validateUserCreate;
|
|
1488
|
+
exports.validateWorkflowCreate = validateWorkflowCreate;
|
|
1489
|
+
exports.validateWorkflowTemplate = validateWorkflowTemplate;
|
|
1490
|
+
exports.validateWorkflowTemplateCreate = validateWorkflowTemplateCreate;
|
|
1491
|
+
exports.validateWorkflowTemplateDeprecate = validateWorkflowTemplateDeprecate;
|
|
1492
|
+
exports.validateWorkflowTemplateScope = validateWorkflowTemplateScope;
|
|
1493
|
+
exports.validateWorkflowTemplateUpdate = validateWorkflowTemplateUpdate;
|
|
1494
|
+
exports.validateWorkflowVoteRequest = validateWorkflowVoteRequest;
|