@approvio/api 0.0.38 → 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.
- package/dist/mocks/index.d.cts +1 -1
- package/dist/mocks/index.d.mts +1 -1
- package/dist/src/index.cjs +100 -26
- package/dist/src/index.d.cts +72 -73
- package/dist/src/index.d.mts +72 -73
- package/dist/src/index.mjs +97 -21
- package/dist/{workflow-create-CUw6ayXE.d.cts → workflow-create-DL0bZ2df.d.mts} +56 -24
- package/dist/{workflow-create-Du4B7X9Z.d.mts → workflow-create-Ng_I-FfX.d.cts} +56 -24
- package/package.json +2 -2
package/dist/mocks/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Workflow, d as
|
|
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";
|
package/dist/mocks/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Workflow, d as
|
|
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";
|
package/dist/src/index.cjs
CHANGED
|
@@ -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 = {
|
|
33
|
-
_AgentTokenRequest.ClientAssertionTypeEnum = {
|
|
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,
|
|
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
|
-
|
|
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
|
};
|
|
@@ -732,6 +749,17 @@ function validateListWorkflowTemplates200Response(object) {
|
|
|
732
749
|
pagination: paginationValidation.right
|
|
733
750
|
});
|
|
734
751
|
}
|
|
752
|
+
let SortBy = /* @__PURE__ */ function(SortBy) {
|
|
753
|
+
SortBy["VERSION"] = "VERSION";
|
|
754
|
+
SortBy["UPDATED_AT"] = "UPDATED_AT";
|
|
755
|
+
SortBy["CREATED_AT"] = "CREATED_AT";
|
|
756
|
+
return SortBy;
|
|
757
|
+
}({});
|
|
758
|
+
let SortDirection = /* @__PURE__ */ function(SortDirection) {
|
|
759
|
+
SortDirection["ASC"] = "ASC";
|
|
760
|
+
SortDirection["DESC"] = "DESC";
|
|
761
|
+
return SortDirection;
|
|
762
|
+
}({});
|
|
735
763
|
function validateListWorkflowTemplatesParams(object) {
|
|
736
764
|
const sharedValidation = validateSharedListParams(object);
|
|
737
765
|
if ((0, fp_ts_Either.isLeft)(sharedValidation)) return (0, fp_ts_Either.left)(sharedValidation.left);
|
|
@@ -750,18 +778,66 @@ function validateListWorkflowTemplatesParams(object) {
|
|
|
750
778
|
if (!isNonEmptyString(object.spaceIdentifier)) return (0, fp_ts_Either.left)("invalid_space_identifier");
|
|
751
779
|
result.spaceIdentifier = object.spaceIdentifier;
|
|
752
780
|
}
|
|
753
|
-
let status = [
|
|
781
|
+
let status = [WorkflowTemplateStatus.Active];
|
|
754
782
|
if (hasOwnProperty(object, "status") && object.status !== void 0) {
|
|
755
783
|
const statusVal = object.status;
|
|
784
|
+
const validatedStatuses = [];
|
|
756
785
|
if (Array.isArray(statusVal)) {
|
|
757
|
-
for (const item of statusVal)
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
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");
|
|
761
798
|
}
|
|
762
799
|
result.status = status;
|
|
800
|
+
if (hasOwnProperty(object, "sortBy") && object.sortBy !== void 0) {
|
|
801
|
+
const sortByVal = object.sortBy;
|
|
802
|
+
const values = [];
|
|
803
|
+
if (Array.isArray(sortByVal)) for (const unsafeSortBy of sortByVal) {
|
|
804
|
+
if (typeof unsafeSortBy !== "string") return (0, fp_ts_Either.left)("invalid_sort_by");
|
|
805
|
+
const sortBy = getStringAsEnum(unsafeSortBy, SortBy);
|
|
806
|
+
if (sortBy === void 0) return (0, fp_ts_Either.left)("invalid_sort_by");
|
|
807
|
+
values.push(sortBy);
|
|
808
|
+
}
|
|
809
|
+
else if (typeof sortByVal === "string") {
|
|
810
|
+
const sortBy = getStringAsEnum(sortByVal, SortBy);
|
|
811
|
+
if (sortBy === void 0) return (0, fp_ts_Either.left)("invalid_sort_by");
|
|
812
|
+
values.push(sortBy);
|
|
813
|
+
} else return (0, fp_ts_Either.left)("invalid_sort_by");
|
|
814
|
+
result.sortBy = values;
|
|
815
|
+
}
|
|
816
|
+
if (hasOwnProperty(object, "sortDirection") && object.sortDirection !== void 0) {
|
|
817
|
+
const sortDirectionVal = object.sortDirection;
|
|
818
|
+
const values = [];
|
|
819
|
+
if (Array.isArray(sortDirectionVal)) for (const item of sortDirectionVal) {
|
|
820
|
+
if (typeof item !== "string") return (0, fp_ts_Either.left)("invalid_sort_direction");
|
|
821
|
+
const sortDirection = getStringAsEnum(item, SortDirection);
|
|
822
|
+
if (sortDirection === void 0) return (0, fp_ts_Either.left)("invalid_sort_direction");
|
|
823
|
+
values.push(sortDirection);
|
|
824
|
+
}
|
|
825
|
+
else if (typeof sortDirectionVal === "string") {
|
|
826
|
+
const sortDirection = getStringAsEnum(sortDirectionVal, SortDirection);
|
|
827
|
+
if (sortDirection === void 0) return (0, fp_ts_Either.left)("invalid_sort_direction");
|
|
828
|
+
values.push(sortDirection);
|
|
829
|
+
} else return (0, fp_ts_Either.left)("invalid_sort_direction");
|
|
830
|
+
if (result.sortBy === void 0 || result.sortBy.length === 0) return (0, fp_ts_Either.left)("sort_direction_without_sort_by");
|
|
831
|
+
if (values.length > result.sortBy.length) return (0, fp_ts_Either.left)("sort_direction_length_mismatch");
|
|
832
|
+
result.sortDirection = values;
|
|
833
|
+
}
|
|
763
834
|
return (0, fp_ts_Either.right)(result);
|
|
764
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
|
+
}
|
|
765
841
|
//#endregion
|
|
766
842
|
//#region src/validators/workflow.validators.ts
|
|
767
843
|
function validateWorkflowCreate(object) {
|
|
@@ -1451,6 +1527,8 @@ Object.defineProperty(exports, "OrgScope", {
|
|
|
1451
1527
|
return OrgScope;
|
|
1452
1528
|
}
|
|
1453
1529
|
});
|
|
1530
|
+
exports.SortBy = SortBy;
|
|
1531
|
+
exports.SortDirection = SortDirection;
|
|
1454
1532
|
Object.defineProperty(exports, "SpaceScope", {
|
|
1455
1533
|
enumerable: true,
|
|
1456
1534
|
get: function() {
|
|
@@ -1481,18 +1559,13 @@ Object.defineProperty(exports, "WebhookAction", {
|
|
|
1481
1559
|
return WebhookAction;
|
|
1482
1560
|
}
|
|
1483
1561
|
});
|
|
1484
|
-
Object.defineProperty(exports, "WorkflowTemplate", {
|
|
1485
|
-
enumerable: true,
|
|
1486
|
-
get: function() {
|
|
1487
|
-
return WorkflowTemplate;
|
|
1488
|
-
}
|
|
1489
|
-
});
|
|
1490
1562
|
Object.defineProperty(exports, "WorkflowTemplateScope", {
|
|
1491
1563
|
enumerable: true,
|
|
1492
1564
|
get: function() {
|
|
1493
1565
|
return WorkflowTemplateScope;
|
|
1494
1566
|
}
|
|
1495
1567
|
});
|
|
1568
|
+
exports.WorkflowTemplateStatus = WorkflowTemplateStatus;
|
|
1496
1569
|
exports.isAPIError = isAPIError;
|
|
1497
1570
|
exports.validateAPIError = validateAPIError;
|
|
1498
1571
|
exports.validateAddGroupEntitiesRequest = validateAddGroupEntitiesRequest;
|
|
@@ -1504,6 +1577,7 @@ exports.validateAgentRegistrationResponse = validateAgentRegistrationResponse;
|
|
|
1504
1577
|
exports.validateAgentTokenRequest = validateAgentTokenRequest;
|
|
1505
1578
|
exports.validateAgentTokenResponse = validateAgentTokenResponse;
|
|
1506
1579
|
exports.validateCanVoteResponse = validateCanVoteResponse;
|
|
1580
|
+
exports.validateConcurrencyControl = validateConcurrencyControl;
|
|
1507
1581
|
exports.validateGetEntityInfo200Response = validateGetEntityInfo200Response;
|
|
1508
1582
|
exports.validateGetWorkflowParams = validateGetWorkflowParams;
|
|
1509
1583
|
exports.validateGetWorkflowVotes200Response = validateGetWorkflowVotes200Response;
|