@approvio/api 0.0.39 → 0.0.40

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,4 @@
1
- import { a as Workflow, d as ListGroups200Response, f as Pagination, i as ListWorkflows200Response, m as GroupInfo, n as User, p as Group, r as TokenResponse, t as WorkflowCreate, u as UserSummary } from "../workflow-create-YXAJ6Gr8.cjs";
1
+ import { a as Workflow, d as UserSummary, f as ListGroups200Response, h as GroupInfo, i as ListWorkflows200Response, m as Group, n as User, p as Pagination, r as TokenResponse, t as WorkflowCreate } from "../workflow-create-Ng_I-FfX.cjs";
2
2
 
3
3
  //#region mocks/user.fixtures.d.ts
4
4
  declare const MOCK_USER_ID = "e6e08687-2189-4710-91b5-479cd25a9119";
@@ -1,4 +1,4 @@
1
- import { a as Workflow, d as ListGroups200Response, f as Pagination, i as ListWorkflows200Response, m as GroupInfo, n as User, p as Group, r as TokenResponse, t as WorkflowCreate, u as UserSummary } from "../workflow-create-BWzcjT6i.mjs";
1
+ import { a as Workflow, d as UserSummary, f as ListGroups200Response, h as GroupInfo, i as ListWorkflows200Response, m as Group, n as User, p as Pagination, r as TokenResponse, t as WorkflowCreate } from "../workflow-create-DL0bZ2df.mjs";
2
2
 
3
3
  //#region mocks/user.fixtures.d.ts
4
4
  declare const MOCK_USER_ID = "e6e08687-2189-4710-91b5-479cd25a9119";
@@ -29,8 +29,8 @@ fp_ts_Array = __toESM(fp_ts_Array);
29
29
  //#region generated/openapi/model/agent-token-request.ts
30
30
  let AgentTokenRequest;
31
31
  (function(_AgentTokenRequest) {
32
- _AgentTokenRequest.GrantTypeEnum = { UrnietfparamsoauthgrantTypejwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer" };
33
- _AgentTokenRequest.ClientAssertionTypeEnum = { UrnietfparamsoauthclientAssertionTypejwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
32
+ _AgentTokenRequest.GrantTypeEnum = { UrnIetfParamsOauthGrantTypeJwtBearer: "urn:ietf:params:oauth:grant-type:jwt-bearer" };
33
+ _AgentTokenRequest.ClientAssertionTypeEnum = { UrnIetfParamsOauthClientAssertionTypeJwtBearer: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer" };
34
34
  })(AgentTokenRequest || (AgentTokenRequest = {}));
35
35
  //#endregion
36
36
  //#region generated/openapi/model/and-rule.ts
@@ -104,22 +104,19 @@ let WebhookAction;
104
104
  };
105
105
  })(WebhookAction || (WebhookAction = {}));
106
106
  //#endregion
107
- //#region generated/openapi/model/workflow-template.ts
108
- let WorkflowTemplate;
109
- (function(_WorkflowTemplate) {
110
- _WorkflowTemplate.StatusEnum = {
111
- Active: "ACTIVE",
112
- PendingDeprecation: "PENDING_DEPRECATION",
113
- Deprecated: "DEPRECATED"
114
- };
115
- })(WorkflowTemplate || (WorkflowTemplate = {}));
116
- //#endregion
117
107
  //#region generated/openapi/model/workflow-template-scope.ts
118
108
  let WorkflowTemplateScope;
119
109
  (function(_WorkflowTemplateScope) {
120
110
  _WorkflowTemplateScope.TypeEnum = { WorkflowTemplate: "workflow_template" };
121
111
  })(WorkflowTemplateScope || (WorkflowTemplateScope = {}));
122
112
  //#endregion
113
+ //#region generated/openapi/model/workflow-template-status.ts
114
+ const WorkflowTemplateStatus = {
115
+ Active: "ACTIVE",
116
+ PendingDeprecation: "PENDING_DEPRECATION",
117
+ Deprecated: "DEPRECATED"
118
+ };
119
+ //#endregion
123
120
  //#region src/utils/validation.utils.ts
124
121
  function hasOwnProperty(obj, prop) {
125
122
  return Object.hasOwn(obj, prop);
@@ -133,6 +130,15 @@ function isNumber(value) {
133
130
  function isArray(value) {
134
131
  return Array.isArray(value);
135
132
  }
133
+ function isStringBigInt(value) {
134
+ if (typeof value !== "string") return false;
135
+ try {
136
+ BigInt(value);
137
+ } catch {
138
+ return false;
139
+ }
140
+ return true;
141
+ }
136
142
  //#endregion
137
143
  //#region src/validators/auth.validators.ts
138
144
  function validateTokenResponse(object) {
@@ -558,7 +564,7 @@ function validateWorkflowTemplate(object) {
558
564
  if (!hasOwnProperty(object, "name") || !isNonEmptyString(object.name)) return (0, fp_ts_Either.left)("invalid_name");
559
565
  if (!hasOwnProperty(object, "version") || !isNonEmptyString(object.version)) return (0, fp_ts_Either.left)("invalid_version");
560
566
  if (!hasOwnProperty(object, "status") || typeof object.status !== "string") return (0, fp_ts_Either.left)("invalid_status");
561
- const status = getStringAsEnum(object.status, WorkflowTemplate.StatusEnum);
567
+ const status = getStringAsEnum(object.status, WorkflowTemplateStatus);
562
568
  if (!status) return (0, fp_ts_Either.left)("invalid_status");
563
569
  if (!hasOwnProperty(object, "allowVotingOnDeprecatedTemplate") || typeof object.allowVotingOnDeprecatedTemplate !== "boolean") return (0, fp_ts_Either.left)("invalid_allow_voting");
564
570
  if (!hasOwnProperty(object, "approvalRule")) return (0, fp_ts_Either.left)("missing_approval_rule");
@@ -567,6 +573,9 @@ function validateWorkflowTemplate(object) {
567
573
  if (!hasOwnProperty(object, "spaceId") || !isNonEmptyString(object.spaceId)) return (0, fp_ts_Either.left)("invalid_space_id");
568
574
  if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
569
575
  if (!hasOwnProperty(object, "updatedAt") || !isNonEmptyString(object.updatedAt)) return (0, fp_ts_Either.left)("invalid_updated_at");
576
+ if (!hasOwnProperty(object, "concurrencyControl")) return (0, fp_ts_Either.left)("invalid_concurrency_control");
577
+ const concurrencyControlValidation = validateConcurrencyControl(object.concurrencyControl);
578
+ if ((0, fp_ts_Either.isLeft)(concurrencyControlValidation)) return (0, fp_ts_Either.left)("invalid_concurrency_control");
570
579
  const result = {
571
580
  id: object.id,
572
581
  name: object.name,
@@ -576,7 +585,8 @@ function validateWorkflowTemplate(object) {
576
585
  approvalRule: approvalRuleValidation.right,
577
586
  spaceId: object.spaceId,
578
587
  createdAt: object.createdAt,
579
- updatedAt: object.updatedAt
588
+ updatedAt: object.updatedAt,
589
+ concurrencyControl: concurrencyControlValidation.right
580
590
  };
581
591
  if (hasOwnProperty(object, "description") && object.description !== void 0) {
582
592
  if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
@@ -642,7 +652,10 @@ function validateWorkflowTemplateCreate(object) {
642
652
  }
643
653
  function validateWorkflowTemplateUpdate(object) {
644
654
  if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("malformed_object");
645
- const result = {};
655
+ if (!hasOwnProperty(object, "concurrencyControl")) return (0, fp_ts_Either.left)("invalid_concurrency_control");
656
+ const concurrencyControlValidation = validateConcurrencyControl(object.concurrencyControl);
657
+ if ((0, fp_ts_Either.isLeft)(concurrencyControlValidation)) return (0, fp_ts_Either.left)("invalid_concurrency_control");
658
+ const result = { concurrencyControl: concurrencyControlValidation.right };
646
659
  if (hasOwnProperty(object, "description") && object.description !== void 0) {
647
660
  if (typeof object.description !== "string") return (0, fp_ts_Either.left)("invalid_description");
648
661
  result.description = object.description;
@@ -702,10 +715,14 @@ function validateWorkflowTemplateSummary(object) {
702
715
  if (!hasOwnProperty(object, "version") || !isNonEmptyString(object.version)) return (0, fp_ts_Either.left)("invalid_version");
703
716
  if (!hasOwnProperty(object, "createdAt") || !isNonEmptyString(object.createdAt)) return (0, fp_ts_Either.left)("invalid_created_at");
704
717
  if (!hasOwnProperty(object, "updatedAt") || !isNonEmptyString(object.updatedAt)) return (0, fp_ts_Either.left)("invalid_updated_at");
718
+ if (!hasOwnProperty(object, "status") || typeof object.status !== "string") return (0, fp_ts_Either.left)("invalid_status");
719
+ const status = getStringAsEnum(object.status, WorkflowTemplateStatus);
720
+ if (!status) return (0, fp_ts_Either.left)("invalid_status");
705
721
  const result = {
706
722
  id: object.id,
707
723
  name: object.name,
708
724
  version: object.version,
725
+ status,
709
726
  createdAt: object.createdAt,
710
727
  updatedAt: object.updatedAt
711
728
  };
@@ -761,14 +778,23 @@ function validateListWorkflowTemplatesParams(object) {
761
778
  if (!isNonEmptyString(object.spaceIdentifier)) return (0, fp_ts_Either.left)("invalid_space_identifier");
762
779
  result.spaceIdentifier = object.spaceIdentifier;
763
780
  }
764
- let status = ["ACTIVE"];
781
+ let status = [WorkflowTemplateStatus.Active];
765
782
  if (hasOwnProperty(object, "status") && object.status !== void 0) {
766
783
  const statusVal = object.status;
784
+ const validatedStatuses = [];
767
785
  if (Array.isArray(statusVal)) {
768
- for (const item of statusVal) if (typeof item !== "string") return (0, fp_ts_Either.left)("invalid_status");
769
- status = statusVal;
770
- } else if (typeof statusVal === "string") status = [statusVal];
771
- else return (0, fp_ts_Either.left)("invalid_status");
786
+ for (const item of statusVal) {
787
+ if (typeof item !== "string") return (0, fp_ts_Either.left)("invalid_status");
788
+ const validatedStatus = getStringAsEnum(item, WorkflowTemplateStatus);
789
+ if (!validatedStatus) return (0, fp_ts_Either.left)("invalid_status");
790
+ validatedStatuses.push(validatedStatus);
791
+ }
792
+ status = validatedStatuses;
793
+ } else if (typeof statusVal === "string") {
794
+ const validatedStatus = getStringAsEnum(statusVal, WorkflowTemplateStatus);
795
+ if (!validatedStatus) return (0, fp_ts_Either.left)("invalid_status");
796
+ status = [validatedStatus];
797
+ } else return (0, fp_ts_Either.left)("invalid_status");
772
798
  }
773
799
  result.status = status;
774
800
  if (hasOwnProperty(object, "sortBy") && object.sortBy !== void 0) {
@@ -807,6 +833,11 @@ function validateListWorkflowTemplatesParams(object) {
807
833
  }
808
834
  return (0, fp_ts_Either.right)(result);
809
835
  }
836
+ function validateConcurrencyControl(object) {
837
+ if (typeof object !== "object" || object === null) return (0, fp_ts_Either.left)("invalid_concurrency_control");
838
+ if (!hasOwnProperty(object, "version") || !isStringBigInt(object.version)) return (0, fp_ts_Either.left)("invalid_concurrency_control");
839
+ return (0, fp_ts_Either.right)({ version: object.version });
840
+ }
810
841
  //#endregion
811
842
  //#region src/validators/workflow.validators.ts
812
843
  function validateWorkflowCreate(object) {
@@ -1528,18 +1559,13 @@ Object.defineProperty(exports, "WebhookAction", {
1528
1559
  return WebhookAction;
1529
1560
  }
1530
1561
  });
1531
- Object.defineProperty(exports, "WorkflowTemplate", {
1532
- enumerable: true,
1533
- get: function() {
1534
- return WorkflowTemplate;
1535
- }
1536
- });
1537
1562
  Object.defineProperty(exports, "WorkflowTemplateScope", {
1538
1563
  enumerable: true,
1539
1564
  get: function() {
1540
1565
  return WorkflowTemplateScope;
1541
1566
  }
1542
1567
  });
1568
+ exports.WorkflowTemplateStatus = WorkflowTemplateStatus;
1543
1569
  exports.isAPIError = isAPIError;
1544
1570
  exports.validateAPIError = validateAPIError;
1545
1571
  exports.validateAddGroupEntitiesRequest = validateAddGroupEntitiesRequest;
@@ -1551,6 +1577,7 @@ exports.validateAgentRegistrationResponse = validateAgentRegistrationResponse;
1551
1577
  exports.validateAgentTokenRequest = validateAgentTokenRequest;
1552
1578
  exports.validateAgentTokenResponse = validateAgentTokenResponse;
1553
1579
  exports.validateCanVoteResponse = validateCanVoteResponse;
1580
+ exports.validateConcurrencyControl = validateConcurrencyControl;
1554
1581
  exports.validateGetEntityInfo200Response = validateGetEntityInfo200Response;
1555
1582
  exports.validateGetWorkflowParams = validateGetWorkflowParams;
1556
1583
  exports.validateGetWorkflowVotes200Response = validateGetWorkflowVotes200Response;