@approvio/api 0.0.32 → 0.0.34

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.
@@ -1,5 +1,5 @@
1
1
  import * as E from "fp-ts/Either";
2
- import { isLeft, isRight, left, right } from "fp-ts/Either";
2
+ import { isLeft, isRight, left, mapLeft, right } from "fp-ts/Either";
3
3
  import { pipe } from "fp-ts/function";
4
4
  import * as A from "fp-ts/Array";
5
5
  //#region generated/openapi/model/agent-token-request.ts
@@ -255,6 +255,9 @@ function validateGroupScope(object) {
255
255
  groupId: object.groupId
256
256
  });
257
257
  }
258
+ function validateListGroupsParams(object) {
259
+ return validateSharedListParams(object);
260
+ }
258
261
  function validateGroupInfo(object) {
259
262
  if (typeof object !== "object" || object === null) return left("malformed_object");
260
263
  if (!hasOwnProperty(object, "groupId") || !isNonEmptyString(object.groupId)) return left(hasOwnProperty(object, "groupId") ? "invalid_group_id" : "missing_group_id");
@@ -339,6 +342,33 @@ function validateListGroupEntities200Response(object) {
339
342
  }
340
343
  //#endregion
341
344
  //#region src/validators/common.validators.ts
345
+ function validateSharedListParams(object) {
346
+ if (typeof object !== "object" || object === null) return left("malformed_object");
347
+ const result = {};
348
+ if (hasOwnProperty(object, "page") && object.page !== void 0) {
349
+ let page = object.page;
350
+ if (typeof page === "string" && page.trim() !== "") {
351
+ const parsed = Number(page);
352
+ if (!isNaN(parsed)) page = parsed;
353
+ }
354
+ if (typeof page !== "number" || !Number.isInteger(page) || page < 1) return left("invalid_page");
355
+ result.page = page;
356
+ }
357
+ if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
358
+ let limit = object.limit;
359
+ if (typeof limit === "string" && limit.trim() !== "") {
360
+ const parsed = Number(limit);
361
+ if (!isNaN(parsed)) limit = parsed;
362
+ }
363
+ if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1) return left("invalid_limit");
364
+ result.limit = limit;
365
+ }
366
+ if (hasOwnProperty(object, "search") && object.search !== void 0) {
367
+ if (typeof object.search !== "string" || object.search.trim() === "") return left("invalid_search");
368
+ result.search = object.search;
369
+ }
370
+ return right(result);
371
+ }
342
372
  function validatePagination(object) {
343
373
  if (typeof object !== "object" || object === null) return left("malformed_object");
344
374
  if (!hasOwnProperty(object, "total")) return left("missing_total");
@@ -677,17 +707,10 @@ function validateListWorkflowTemplates200Response(object) {
677
707
  });
678
708
  }
679
709
  function validateListWorkflowTemplatesParams(object) {
680
- if (typeof object !== "object" || object === null) return left("malformed_object");
681
- const result = {};
682
- if (hasOwnProperty(object, "page") && object.page !== void 0) {
683
- if (typeof object.page !== "number") return left("invalid_page");
684
- result.page = object.page;
685
- }
686
- if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
687
- if (typeof object.limit !== "number") return left("invalid_limit");
688
- result.limit = object.limit;
689
- }
690
- if (hasOwnProperty(object, "spaceIdentifier") && object.spaceIdentifier !== void 0) {
710
+ const sharedValidation = validateSharedListParams(object);
711
+ if (isLeft(sharedValidation)) return left(sharedValidation.left);
712
+ const result = sharedValidation.right;
713
+ if (typeof object === "object" && object !== null && hasOwnProperty(object, "spaceIdentifier") && object.spaceIdentifier !== void 0) {
691
714
  if (!isNonEmptyString(object.spaceIdentifier)) return left("invalid_space_identifier");
692
715
  result.spaceIdentifier = object.spaceIdentifier;
693
716
  }
@@ -780,19 +803,10 @@ function validateGetWorkflowParams(object) {
780
803
  return right({ include });
781
804
  }
782
805
  function validateListWorkflowsParams(object) {
806
+ const sharedValidation = pipe(validateSharedListParams(object), mapLeft((error) => error === "invalid_search" ? "malformed_object" : error));
807
+ if (isLeft(sharedValidation)) return left(sharedValidation.left);
808
+ const result = sharedValidation.right;
783
809
  if (typeof object !== "object" || object === null) return left("malformed_object");
784
- let page = void 0;
785
- if (hasOwnProperty(object, "page")) {
786
- const val = object["page"];
787
- if (typeof val !== "number") return left("invalid_page");
788
- page = val;
789
- }
790
- let limit = void 0;
791
- if (hasOwnProperty(object, "limit")) {
792
- const val = object["limit"];
793
- if (typeof val !== "number") return left("invalid_limit");
794
- limit = val;
795
- }
796
810
  let include = void 0;
797
811
  if (hasOwnProperty(object, "include")) {
798
812
  const includeVal = object["include"];
@@ -816,13 +830,10 @@ function validateListWorkflowsParams(object) {
816
830
  if (typeof val !== "string") return left("invalid_workflow_template_identifier");
817
831
  workflowTemplateIdentifier = val;
818
832
  }
819
- return right({
820
- page,
821
- limit,
822
- include,
823
- includeOnlyNonTerminalState,
824
- workflowTemplateIdentifier
825
- });
833
+ if (include !== void 0) result.include = include;
834
+ if (includeOnlyNonTerminalState !== void 0) result.includeOnlyNonTerminalState = includeOnlyNonTerminalState;
835
+ if (workflowTemplateIdentifier !== void 0) result.workflowTemplateIdentifier = workflowTemplateIdentifier;
836
+ return right(result);
826
837
  }
827
838
  function validateListWorkflows200Response(object) {
828
839
  if (typeof object !== "object" || object === null) return left("malformed_object");
@@ -1087,6 +1098,9 @@ function validateRoleAssignmentRequest(object) {
1087
1098
  function validateRoleRemovalRequest(object) {
1088
1099
  return validateRoleAssignmentRequest(object);
1089
1100
  }
1101
+ function validateListUsersParams(object) {
1102
+ return validateSharedListParams(object);
1103
+ }
1090
1104
  //#endregion
1091
1105
  //#region src/validators/spaces.validators.ts
1092
1106
  function validateSpace(object) {
@@ -1151,6 +1165,9 @@ function validateSpaceScope(object) {
1151
1165
  spaceId: object.spaceId
1152
1166
  });
1153
1167
  }
1168
+ function validateListSpacesParams(object) {
1169
+ return validateSharedListParams(object);
1170
+ }
1154
1171
  //#endregion
1155
1172
  //#region src/validators/agents.validators.ts
1156
1173
  function validateAgentSummary(object) {
@@ -1204,21 +1221,10 @@ function validateAgentTokenResponse(object) {
1204
1221
  });
1205
1222
  }
1206
1223
  function validateListAgentsParams(object) {
1207
- if (typeof object !== "object" || object === null) return left("malformed_object");
1208
- let page = void 0;
1209
- if (hasOwnProperty(object, "page") && object.page !== void 0) {
1210
- if (typeof object.page !== "number") return left("invalid_page");
1211
- page = object.page;
1212
- }
1213
- let limit = void 0;
1214
- if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
1215
- if (typeof object.limit !== "number") return left("invalid_limit");
1216
- limit = object.limit;
1217
- }
1218
- return right({
1219
- page,
1220
- limit
1221
- });
1224
+ const sharedValidation = pipe(validateSharedListParams(object), mapLeft((error) => error === "invalid_search" ? "malformed_object" : error));
1225
+ if (isLeft(sharedValidation)) return left(sharedValidation.left);
1226
+ const result = sharedValidation.right;
1227
+ return right(result);
1222
1228
  }
1223
1229
  function validateListAgents200Response(object) {
1224
1230
  if (typeof object !== "object" || object === null) return left("malformed_object");
@@ -1355,4 +1361,4 @@ function isAPIError(object) {
1355
1361
  return E.isRight(validateAPIError(object));
1356
1362
  }
1357
1363
  //#endregion
1358
- export { AgentTokenRequest, AndRule, EmailAction, GroupRequirementRule, GroupScope, OrRule, OrgScope, SpaceScope, VoteApprove, VoteVeto, VoteWithdraw, WebhookAction, WorkflowTemplate, WorkflowTemplateScope, isAPIError, validateAPIError, validateAddGroupEntitiesRequest, validateAgentChallengeRequest, validateAgentChallengeResponse, validateAgentGet200Response, validateAgentRegistrationRequest, validateAgentRegistrationResponse, validateAgentTokenRequest, validateAgentTokenResponse, validateCanVoteResponse, validateGetEntityInfo200Response, validateGetWorkflowParams, validateGetWorkflowVotes200Response, validateGroupCreate, validateGroupInfo, validateGroupScope, validateHealthResponse, validateInitiateCliLogin200Response, validateInitiateCliLoginRequest, validateListAgents200Response, validateListAgentsParams, validateListGroupEntities200Response, validateListGroups200Response, validateListOrganizationAdminsForOrg200Response, validateListRoleTemplates200Response, validateListSpaces200Response, validateListUsers200Response, validateListWorkflowTemplates200Response, validateListWorkflowTemplatesParams, validateListWorkflows200Response, validateListWorkflowsParams, validateOidcCallbackRequest, validateOrganizationAdminCreate, validateOrganizationAdminRemove, validatePagination, validatePrivilegedTokenExchangeRequest, validatePrivilegedTokenResponse, validateRefreshTokenRequest, validateRemoveGroupEntitiesRequest, validateRoleAssignmentRequest, validateRoleRemovalRequest, validateSpaceCreate, validateSpaceScope, validateTokenRequest, validateTokenResponse, validateUser, validateUserCreate, validateWorkflowCreate, validateWorkflowTemplate, validateWorkflowTemplateCreate, validateWorkflowTemplateDeprecate, validateWorkflowTemplateScope, validateWorkflowTemplateUpdate, validateWorkflowVoteRequest };
1364
+ export { AgentTokenRequest, AndRule, EmailAction, GroupRequirementRule, GroupScope, OrRule, OrgScope, SpaceScope, VoteApprove, VoteVeto, VoteWithdraw, WebhookAction, WorkflowTemplate, WorkflowTemplateScope, isAPIError, validateAPIError, validateAddGroupEntitiesRequest, validateAgentChallengeRequest, validateAgentChallengeResponse, validateAgentGet200Response, validateAgentRegistrationRequest, validateAgentRegistrationResponse, validateAgentTokenRequest, validateAgentTokenResponse, validateCanVoteResponse, validateGetEntityInfo200Response, validateGetWorkflowParams, validateGetWorkflowVotes200Response, validateGroupCreate, validateGroupInfo, validateGroupScope, validateHealthResponse, validateInitiateCliLogin200Response, validateInitiateCliLoginRequest, validateListAgents200Response, validateListAgentsParams, validateListGroupEntities200Response, validateListGroups200Response, validateListGroupsParams, validateListOrganizationAdminsForOrg200Response, validateListRoleTemplates200Response, validateListSpaces200Response, validateListSpacesParams, validateListUsers200Response, validateListUsersParams, validateListWorkflowTemplates200Response, validateListWorkflowTemplatesParams, validateListWorkflows200Response, validateListWorkflowsParams, validateOidcCallbackRequest, validateOrganizationAdminCreate, validateOrganizationAdminRemove, validatePagination, validatePrivilegedTokenExchangeRequest, validatePrivilegedTokenResponse, validateRefreshTokenRequest, validateRemoveGroupEntitiesRequest, validateRoleAssignmentRequest, validateRoleRemovalRequest, validateSharedListParams, validateSpaceCreate, validateSpaceScope, validateTokenRequest, validateTokenResponse, validateUser, validateUserCreate, validateWorkflowCreate, validateWorkflowTemplate, validateWorkflowTemplateCreate, validateWorkflowTemplateDeprecate, validateWorkflowTemplateScope, validateWorkflowTemplateUpdate, validateWorkflowVoteRequest };
@@ -24,7 +24,7 @@ declare namespace OrRule {
24
24
  * Workflow Approval System API
25
25
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
26
26
  *
27
- * The version of the OpenAPI document: 0.0.30
27
+ * The version of the OpenAPI document: 0.0.31
28
28
  *
29
29
  *
30
30
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -96,7 +96,7 @@ declare namespace AndRule {
96
96
  * Workflow Approval System API
97
97
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
98
98
  *
99
- * The version of the OpenAPI document: 0.0.30
99
+ * The version of the OpenAPI document: 0.0.31
100
100
  *
101
101
  *
102
102
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -128,7 +128,7 @@ declare namespace EmailAction {
128
128
  * Workflow Approval System API
129
129
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
130
130
  *
131
- * The version of the OpenAPI document: 0.0.30
131
+ * The version of the OpenAPI document: 0.0.31
132
132
  *
133
133
  *
134
134
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -145,7 +145,7 @@ interface GroupInfo {
145
145
  * Workflow Approval System API
146
146
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
147
147
  *
148
- * The version of the OpenAPI document: 0.0.30
148
+ * The version of the OpenAPI document: 0.0.31
149
149
  *
150
150
  *
151
151
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -184,7 +184,7 @@ interface Group {
184
184
  * Workflow Approval System API
185
185
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
186
186
  *
187
- * The version of the OpenAPI document: 0.0.30
187
+ * The version of the OpenAPI document: 0.0.31
188
188
  *
189
189
  *
190
190
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -197,7 +197,7 @@ interface Pagination {
197
197
  */
198
198
  total: number;
199
199
  /**
200
- * Current page number
200
+ * Current page number (1-indexed)
201
201
  */
202
202
  page: number;
203
203
  /**
@@ -217,7 +217,7 @@ interface ListGroups200Response {
217
217
  * Workflow Approval System API
218
218
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
219
219
  *
220
- * The version of the OpenAPI document: 0.0.30
220
+ * The version of the OpenAPI document: 0.0.31
221
221
  *
222
222
  *
223
223
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -244,7 +244,7 @@ interface UserSummary {
244
244
  * Workflow Approval System API
245
245
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
246
246
  *
247
- * The version of the OpenAPI document: 0.0.30
247
+ * The version of the OpenAPI document: 0.0.31
248
248
  *
249
249
  *
250
250
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -419,7 +419,7 @@ interface ListWorkflows200Response {
419
419
  * Workflow Approval System API
420
420
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
421
421
  *
422
- * The version of the OpenAPI document: 0.0.30
422
+ * The version of the OpenAPI document: 0.0.31
423
423
  *
424
424
  *
425
425
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -442,7 +442,7 @@ interface TokenResponse {
442
442
  * Workflow Approval System API
443
443
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
444
444
  *
445
- * The version of the OpenAPI document: 0.0.30
445
+ * The version of the OpenAPI document: 0.0.31
446
446
  *
447
447
  *
448
448
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -477,7 +477,7 @@ interface User {
477
477
  * Workflow Approval System API
478
478
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
479
479
  *
480
- * The version of the OpenAPI document: 0.0.30
480
+ * The version of the OpenAPI document: 0.0.31
481
481
  *
482
482
  *
483
483
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -24,7 +24,7 @@ declare namespace OrRule {
24
24
  * Workflow Approval System API
25
25
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
26
26
  *
27
- * The version of the OpenAPI document: 0.0.30
27
+ * The version of the OpenAPI document: 0.0.31
28
28
  *
29
29
  *
30
30
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -96,7 +96,7 @@ declare namespace AndRule {
96
96
  * Workflow Approval System API
97
97
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
98
98
  *
99
- * The version of the OpenAPI document: 0.0.30
99
+ * The version of the OpenAPI document: 0.0.31
100
100
  *
101
101
  *
102
102
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -128,7 +128,7 @@ declare namespace EmailAction {
128
128
  * Workflow Approval System API
129
129
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
130
130
  *
131
- * The version of the OpenAPI document: 0.0.30
131
+ * The version of the OpenAPI document: 0.0.31
132
132
  *
133
133
  *
134
134
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -145,7 +145,7 @@ interface GroupInfo {
145
145
  * Workflow Approval System API
146
146
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
147
147
  *
148
- * The version of the OpenAPI document: 0.0.30
148
+ * The version of the OpenAPI document: 0.0.31
149
149
  *
150
150
  *
151
151
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -184,7 +184,7 @@ interface Group {
184
184
  * Workflow Approval System API
185
185
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
186
186
  *
187
- * The version of the OpenAPI document: 0.0.30
187
+ * The version of the OpenAPI document: 0.0.31
188
188
  *
189
189
  *
190
190
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -197,7 +197,7 @@ interface Pagination {
197
197
  */
198
198
  total: number;
199
199
  /**
200
- * Current page number
200
+ * Current page number (1-indexed)
201
201
  */
202
202
  page: number;
203
203
  /**
@@ -217,7 +217,7 @@ interface ListGroups200Response {
217
217
  * Workflow Approval System API
218
218
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
219
219
  *
220
- * The version of the OpenAPI document: 0.0.30
220
+ * The version of the OpenAPI document: 0.0.31
221
221
  *
222
222
  *
223
223
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -244,7 +244,7 @@ interface UserSummary {
244
244
  * Workflow Approval System API
245
245
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
246
246
  *
247
- * The version of the OpenAPI document: 0.0.30
247
+ * The version of the OpenAPI document: 0.0.31
248
248
  *
249
249
  *
250
250
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -419,7 +419,7 @@ interface ListWorkflows200Response {
419
419
  * Workflow Approval System API
420
420
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
421
421
  *
422
- * The version of the OpenAPI document: 0.0.30
422
+ * The version of the OpenAPI document: 0.0.31
423
423
  *
424
424
  *
425
425
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -442,7 +442,7 @@ interface TokenResponse {
442
442
  * Workflow Approval System API
443
443
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
444
444
  *
445
- * The version of the OpenAPI document: 0.0.30
445
+ * The version of the OpenAPI document: 0.0.31
446
446
  *
447
447
  *
448
448
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -477,7 +477,7 @@ interface User {
477
477
  * Workflow Approval System API
478
478
  * API for a SaaS platform that allows customers to manage approvals for generic workflows, users, and groups.
479
479
  *
480
- * The version of the OpenAPI document: 0.0.30
480
+ * The version of the OpenAPI document: 0.0.31
481
481
  *
482
482
  *
483
483
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@approvio/api",
3
3
  "author": "Giovanni Baratta",
4
4
  "license": "MIT",
5
- "version": "0.0.32",
5
+ "version": "0.0.34",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "./dist/src/index.cjs",