@approvio/api 0.0.31 → 0.0.33

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,4 +1,7 @@
1
+ import * as E from "fp-ts/Either";
1
2
  import { isLeft, isRight, left, right } from "fp-ts/Either";
3
+ import { pipe } from "fp-ts/function";
4
+ import * as A from "fp-ts/Array";
2
5
  //#region generated/openapi/model/agent-token-request.ts
3
6
  let AgentTokenRequest;
4
7
  (function(_AgentTokenRequest) {
@@ -252,6 +255,9 @@ function validateGroupScope(object) {
252
255
  groupId: object.groupId
253
256
  });
254
257
  }
258
+ function validateListGroupsParams(object) {
259
+ return validateSharedListParams(object);
260
+ }
255
261
  function validateGroupInfo(object) {
256
262
  if (typeof object !== "object" || object === null) return left("malformed_object");
257
263
  if (!hasOwnProperty(object, "groupId") || !isNonEmptyString(object.groupId)) return left(hasOwnProperty(object, "groupId") ? "invalid_group_id" : "missing_group_id");
@@ -336,6 +342,23 @@ function validateListGroupEntities200Response(object) {
336
342
  }
337
343
  //#endregion
338
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
+ if (typeof object.page !== "number" || object.page < 1) return left("invalid_page");
350
+ result.page = object.page;
351
+ }
352
+ if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
353
+ if (typeof object.limit !== "number" || object.limit < 1) return left("invalid_limit");
354
+ result.limit = object.limit;
355
+ }
356
+ if (hasOwnProperty(object, "search") && object.search !== void 0) {
357
+ if (typeof object.search !== "string" || object.search.trim() === "") return left("invalid_search");
358
+ result.search = object.search;
359
+ }
360
+ return right(result);
361
+ }
339
362
  function validatePagination(object) {
340
363
  if (typeof object !== "object" || object === null) return left("malformed_object");
341
364
  if (!hasOwnProperty(object, "total")) return left("missing_total");
@@ -350,42 +373,6 @@ function validatePagination(object) {
350
373
  limit: object.limit
351
374
  });
352
375
  }
353
- function validateAPIErrorDetailsInner(object) {
354
- if (typeof object !== "object" || object === null) return left("malformed_object");
355
- const result = {};
356
- if (hasOwnProperty(object, "field") && object.field !== void 0) {
357
- if (typeof object.field !== "string") return left("invalid_field");
358
- result.field = object.field;
359
- }
360
- if (hasOwnProperty(object, "message") && object.message !== void 0) {
361
- if (typeof object.message !== "string") return left("invalid_message");
362
- result.message = object.message;
363
- }
364
- return right(result);
365
- }
366
- function validateAPIError(object) {
367
- if (typeof object !== "object" || object === null) return left("malformed_object");
368
- const result = {};
369
- if (hasOwnProperty(object, "code") && object.code !== void 0) {
370
- if (typeof object.code !== "string") return left("invalid_code");
371
- result.code = object.code;
372
- }
373
- if (hasOwnProperty(object, "message") && object.message !== void 0) {
374
- if (typeof object.message !== "string") return left("invalid_message");
375
- result.message = object.message;
376
- }
377
- if (hasOwnProperty(object, "details") && object.details !== void 0) {
378
- if (!isArray(object.details)) return left("invalid_details");
379
- const details = [];
380
- for (const item of object.details) {
381
- const validatedItem = validateAPIErrorDetailsInner(item);
382
- if (isLeft(validatedItem)) return left("invalid_details");
383
- details.push(validatedItem.right);
384
- }
385
- result.details = details;
386
- }
387
- return right(result);
388
- }
389
376
  function validateHealthResponse(object) {
390
377
  if (typeof object !== "object" || object === null) return left("malformed_object");
391
378
  if (!hasOwnProperty(object, "status") || !isNonEmptyString(object.status)) return left(hasOwnProperty(object, "status") ? "invalid_status" : "missing_status");
@@ -710,17 +697,10 @@ function validateListWorkflowTemplates200Response(object) {
710
697
  });
711
698
  }
712
699
  function validateListWorkflowTemplatesParams(object) {
713
- if (typeof object !== "object" || object === null) return left("malformed_object");
714
- const result = {};
715
- if (hasOwnProperty(object, "page") && object.page !== void 0) {
716
- if (typeof object.page !== "number") return left("invalid_page");
717
- result.page = object.page;
718
- }
719
- if (hasOwnProperty(object, "limit") && object.limit !== void 0) {
720
- if (typeof object.limit !== "number") return left("invalid_limit");
721
- result.limit = object.limit;
722
- }
723
- if (hasOwnProperty(object, "spaceIdentifier") && object.spaceIdentifier !== void 0) {
700
+ const sharedValidation = validateSharedListParams(object);
701
+ if (isLeft(sharedValidation)) return left(sharedValidation.left);
702
+ const result = sharedValidation.right;
703
+ if (typeof object === "object" && object !== null && hasOwnProperty(object, "spaceIdentifier") && object.spaceIdentifier !== void 0) {
724
704
  if (!isNonEmptyString(object.spaceIdentifier)) return left("invalid_space_identifier");
725
705
  result.spaceIdentifier = object.spaceIdentifier;
726
706
  }
@@ -1120,6 +1100,9 @@ function validateRoleAssignmentRequest(object) {
1120
1100
  function validateRoleRemovalRequest(object) {
1121
1101
  return validateRoleAssignmentRequest(object);
1122
1102
  }
1103
+ function validateListUsersParams(object) {
1104
+ return validateSharedListParams(object);
1105
+ }
1123
1106
  //#endregion
1124
1107
  //#region src/validators/spaces.validators.ts
1125
1108
  function validateSpace(object) {
@@ -1184,6 +1167,9 @@ function validateSpaceScope(object) {
1184
1167
  spaceId: object.spaceId
1185
1168
  });
1186
1169
  }
1170
+ function validateListSpacesParams(object) {
1171
+ return validateSharedListParams(object);
1172
+ }
1187
1173
  //#endregion
1188
1174
  //#region src/validators/agents.validators.ts
1189
1175
  function validateAgentSummary(object) {
@@ -1353,4 +1339,39 @@ function validateListRoleTemplates200Response(object) {
1353
1339
  return right({ roles });
1354
1340
  }
1355
1341
  //#endregion
1356
- export { AgentTokenRequest, AndRule, EmailAction, GroupRequirementRule, GroupScope, OrRule, OrgScope, SpaceScope, VoteApprove, VoteVeto, VoteWithdraw, WebhookAction, WorkflowTemplate, WorkflowTemplateScope, 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 };
1342
+ //#region src/validators/api-error.validators.ts
1343
+ function validateAPIErrorDetailsInner(object) {
1344
+ if (typeof object !== "object" || object === null) return left("malformed_details");
1345
+ if (!hasOwnProperty(object, "field")) return left("missing_code");
1346
+ if (!isNonEmptyString(object.field)) return left("invalid_code");
1347
+ if (!hasOwnProperty(object, "message")) return left("missing_message");
1348
+ if (!isNonEmptyString(object.message)) return left("invalid_message");
1349
+ return right({
1350
+ field: object.field,
1351
+ message: object.message
1352
+ });
1353
+ }
1354
+ function validateAPIError(object) {
1355
+ if (typeof object !== "object" || object === null) return left("malformed_object");
1356
+ if (!hasOwnProperty(object, "code")) return left("missing_code");
1357
+ if (!isNonEmptyString(object.code)) return left("invalid_code");
1358
+ if (!hasOwnProperty(object, "message")) return left("missing_message");
1359
+ if (!isNonEmptyString(object.message)) return left("invalid_message");
1360
+ let details = void 0;
1361
+ if (hasOwnProperty(object, "details")) {
1362
+ if (!Array.isArray(object.details)) return left("malformed_object");
1363
+ const eitherDetails = pipe(object.details, A.map(validateAPIErrorDetailsInner), A.sequence(E.Applicative));
1364
+ if (E.isLeft(eitherDetails)) return eitherDetails;
1365
+ details = eitherDetails.right;
1366
+ }
1367
+ return right({
1368
+ code: object.code,
1369
+ message: object.message,
1370
+ details
1371
+ });
1372
+ }
1373
+ function isAPIError(object) {
1374
+ return E.isRight(validateAPIError(object));
1375
+ }
1376
+ //#endregion
1377
+ 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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.29
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.31",
5
+ "version": "0.0.33",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "./dist/src/index.cjs",