@abyss-project/console 1.0.1 → 1.0.3
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 +1 -1
- package/dist/api/index.d.ts +1 -2
- package/dist/api/index.js +1 -2
- package/dist/api/ip-address.api.d.ts +6 -0
- package/dist/api/ip-address.api.js +29 -0
- package/dist/api/project.admin.api.d.ts +2 -0
- package/dist/api/project.admin.api.js +9 -0
- package/dist/api/project.api.d.ts +3 -0
- package/dist/api/project.api.js +14 -0
- package/dist/api/workflow.admin.api.d.ts +8 -8
- package/dist/api/workflow.admin.api.js +29 -24
- package/dist/api/workflow.api.d.ts +11 -6
- package/dist/api/workflow.api.js +60 -23
- package/dist/index.d.ts +64 -31
- package/dist/index.js +87 -47
- package/dist/types/constants/index.d.ts +1 -0
- package/dist/types/constants/index.js +17 -0
- package/dist/types/constants/webhook.constants.d.ts +6 -0
- package/dist/types/constants/webhook.constants.js +9 -0
- package/dist/types/dto/index.d.ts +1 -0
- package/dist/types/dto/index.js +1 -0
- package/dist/types/dto/workflow.dto.d.ts +63 -0
- package/dist/types/dto/workflow.dto.js +2 -0
- package/dist/types/enum/api-error.enum.d.ts +27 -3
- package/dist/types/enum/api-error.enum.js +27 -3
- package/dist/types/enum/index.d.ts +1 -0
- package/dist/types/enum/index.js +1 -0
- package/dist/types/enum/workflow.enum.d.ts +82 -0
- package/dist/types/enum/workflow.enum.js +97 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/interface/api/index.d.ts +6 -0
- package/dist/types/interface/api/index.js +6 -0
- package/dist/types/interface/api/requests/ip-address.request.d.ts +32 -0
- package/dist/types/interface/api/requests/ip-address.request.js +2 -0
- package/dist/types/interface/api/requests/project.admin.request.d.ts +3 -0
- package/dist/types/interface/api/requests/project.admin.request.js +2 -0
- package/dist/types/interface/api/requests/project.request.d.ts +6 -0
- package/dist/types/interface/api/requests/project.request.js +2 -0
- package/dist/types/interface/api/requests/workflow-webhook-trigger.request.d.ts +66 -0
- package/dist/types/interface/api/requests/workflow-webhook-trigger.request.js +2 -0
- package/dist/types/interface/api/requests/workflow-webhook.request.d.ts +123 -0
- package/dist/types/interface/api/requests/workflow-webhook.request.js +2 -0
- package/dist/types/interface/api/requests/workflow.admin.request.d.ts +14 -20
- package/dist/types/interface/api/requests/workflow.request.d.ts +83 -46
- package/dist/types/interface/api/responses/ip-address.response.d.ts +21 -0
- package/dist/types/interface/api/responses/ip-address.response.js +2 -0
- package/dist/types/interface/api/responses/project.admin.response.d.ts +4 -0
- package/dist/types/interface/api/responses/project.admin.response.js +2 -0
- package/dist/types/interface/api/responses/project.response.d.ts +10 -0
- package/dist/types/interface/api/responses/project.response.js +2 -0
- package/dist/types/interface/api/responses/workflow-webhook-action.response.d.ts +24 -0
- package/dist/types/interface/api/responses/workflow-webhook-action.response.js +2 -0
- package/dist/types/interface/api/responses/workflow-webhook-public.response.d.ts +7 -0
- package/dist/types/interface/api/responses/workflow-webhook-public.response.js +2 -0
- package/dist/types/interface/api/responses/workflow-webhook-trigger.response.d.ts +41 -0
- package/dist/types/interface/api/responses/workflow-webhook-trigger.response.js +2 -0
- package/dist/types/interface/api/responses/workflow-webhook.response.d.ts +56 -0
- package/dist/types/interface/api/responses/workflow-webhook.response.js +2 -0
- package/dist/types/interface/api/responses/workflow.admin.response.d.ts +4 -3
- package/dist/types/interface/api/responses/workflow.response.d.ts +43 -18
- package/dist/types/interface/index.d.ts +5 -1
- package/dist/types/interface/index.js +5 -1
- package/dist/types/interface/models/domain-verification.model.d.ts +5 -4
- package/dist/types/interface/models/ip-address.model.d.ts +17 -0
- package/dist/types/interface/models/ip-address.model.js +11 -0
- package/dist/types/interface/models/ip-whitelist.model.d.ts +19 -0
- package/dist/types/interface/models/ip-whitelist.model.js +9 -0
- package/dist/types/interface/models/project.model.d.ts +3 -5
- package/dist/types/interface/models/trigger-filter.model.d.ts +0 -0
- package/dist/types/interface/models/trigger-filter.model.js +1 -0
- package/dist/types/interface/models/webhook-action-log.model.d.ts +22 -0
- package/dist/types/interface/models/webhook-action-log.model.js +9 -0
- package/dist/types/interface/models/webhook-trigger-log.model.d.ts +23 -0
- package/dist/types/interface/models/webhook-trigger-log.model.js +9 -0
- package/dist/types/interface/models/workflow-execution.model.d.ts +12 -66
- package/dist/types/interface/models/workflow-execution.model.js +0 -11
- package/dist/types/interface/models/workflow-step-config.model.d.ts +0 -0
- package/dist/types/interface/models/workflow-step-config.model.js +1 -0
- package/dist/types/interface/models/workflow-step-data.model.d.ts +0 -0
- package/dist/types/interface/models/workflow-step-data.model.js +1 -0
- package/dist/types/interface/models/workflow-step-execution.model.d.ts +23 -0
- package/dist/types/interface/models/workflow-step-execution.model.js +2 -0
- package/dist/types/interface/models/workflow-step.model.d.ts +10 -94
- package/dist/types/interface/models/workflow-step.model.js +0 -42
- package/dist/types/interface/models/workflow-trigger-config.model.d.ts +0 -0
- package/dist/types/interface/models/workflow-trigger-config.model.js +1 -0
- package/dist/types/interface/models/workflow-trigger.model.d.ts +35 -0
- package/dist/types/interface/models/workflow-trigger.model.js +2 -0
- package/dist/types/interface/models/workflow-webhook-action.model.d.ts +27 -0
- package/dist/types/interface/models/workflow-webhook-action.model.js +2 -0
- package/dist/types/interface/models/workflow-webhook-incoming-log.model.d.ts +19 -0
- package/dist/types/interface/models/workflow-webhook-incoming-log.model.js +2 -0
- package/dist/types/interface/models/workflow-webhook-outgoing-log.model.d.ts +21 -0
- package/dist/types/interface/models/workflow-webhook-outgoing-log.model.js +2 -0
- package/dist/types/interface/models/workflow-webhook-trigger-allowed-ip.model.d.ts +10 -0
- package/dist/types/interface/models/workflow-webhook-trigger-allowed-ip.model.js +2 -0
- package/dist/types/interface/models/workflow-webhook-trigger.model.d.ts +20 -0
- package/dist/types/interface/models/workflow-webhook-trigger.model.js +2 -0
- package/dist/types/interface/models/workflow-webhook.model.d.ts +27 -0
- package/dist/types/interface/models/workflow-webhook.model.js +2 -0
- package/dist/types/interface/models/workflow.model.d.ts +4 -72
- package/dist/types/interface/models/workflow.model.js +0 -22
- package/dist/utils/__tests__/ip-address-reference.utils.test.d.ts +0 -0
- package/dist/utils/__tests__/ip-address-reference.utils.test.js +1 -0
- package/dist/utils/__tests__/reference-resolver.examples.d.ts +0 -0
- package/dist/utils/__tests__/reference-resolver.examples.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/ip-address-reference.utils.d.ts +0 -0
- package/dist/utils/ip-address-reference.utils.js +1 -0
- package/dist/utils/ip-address-validator.utils.d.ts +14 -0
- package/dist/utils/ip-address-validator.utils.js +119 -0
- package/dist/utils/reference-resolver.utils.d.ts +52 -0
- package/dist/utils/reference-resolver.utils.js +219 -0
- package/package.json +1 -1
- package/USAGE_EXAMPLES.md +0 -257
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,44 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowDelayUnit = exports.WorkflowLogicalOperator = exports.WorkflowConditionOperator = exports.WorkflowActionType = exports.WorkflowStepType = void 0;
|
|
4
|
-
var WorkflowStepType;
|
|
5
|
-
(function (WorkflowStepType) {
|
|
6
|
-
WorkflowStepType["ACTION"] = "ACTION";
|
|
7
|
-
WorkflowStepType["CONDITION"] = "CONDITION";
|
|
8
|
-
WorkflowStepType["FILTER"] = "FILTER";
|
|
9
|
-
WorkflowStepType["DELAY"] = "DELAY";
|
|
10
|
-
})(WorkflowStepType || (exports.WorkflowStepType = WorkflowStepType = {}));
|
|
11
|
-
var WorkflowActionType;
|
|
12
|
-
(function (WorkflowActionType) {
|
|
13
|
-
WorkflowActionType["INVITE_TO_PROJECT"] = "INVITE_TO_PROJECT";
|
|
14
|
-
WorkflowActionType["CALL_WEBHOOK"] = "CALL_WEBHOOK";
|
|
15
|
-
})(WorkflowActionType || (exports.WorkflowActionType = WorkflowActionType = {}));
|
|
16
|
-
var WorkflowConditionOperator;
|
|
17
|
-
(function (WorkflowConditionOperator) {
|
|
18
|
-
WorkflowConditionOperator["EQUALS"] = "EQUALS";
|
|
19
|
-
WorkflowConditionOperator["NOT_EQUALS"] = "NOT_EQUALS";
|
|
20
|
-
WorkflowConditionOperator["CONTAINS"] = "CONTAINS";
|
|
21
|
-
WorkflowConditionOperator["NOT_CONTAINS"] = "NOT_CONTAINS";
|
|
22
|
-
WorkflowConditionOperator["STARTS_WITH"] = "STARTS_WITH";
|
|
23
|
-
WorkflowConditionOperator["ENDS_WITH"] = "ENDS_WITH";
|
|
24
|
-
WorkflowConditionOperator["GREATER_THAN"] = "GREATER_THAN";
|
|
25
|
-
WorkflowConditionOperator["LESS_THAN"] = "LESS_THAN";
|
|
26
|
-
WorkflowConditionOperator["IS_EMPTY"] = "IS_EMPTY";
|
|
27
|
-
WorkflowConditionOperator["IS_NOT_EMPTY"] = "IS_NOT_EMPTY";
|
|
28
|
-
WorkflowConditionOperator["IN_LIST"] = "IN_LIST";
|
|
29
|
-
WorkflowConditionOperator["NOT_IN_LIST"] = "NOT_IN_LIST";
|
|
30
|
-
WorkflowConditionOperator["MATCHES_REGEX"] = "MATCHES_REGEX";
|
|
31
|
-
WorkflowConditionOperator["EMAIL_DOMAIN_VERIFIED"] = "EMAIL_DOMAIN_VERIFIED";
|
|
32
|
-
})(WorkflowConditionOperator || (exports.WorkflowConditionOperator = WorkflowConditionOperator = {}));
|
|
33
|
-
var WorkflowLogicalOperator;
|
|
34
|
-
(function (WorkflowLogicalOperator) {
|
|
35
|
-
WorkflowLogicalOperator["AND"] = "AND";
|
|
36
|
-
WorkflowLogicalOperator["OR"] = "OR";
|
|
37
|
-
})(WorkflowLogicalOperator || (exports.WorkflowLogicalOperator = WorkflowLogicalOperator = {}));
|
|
38
|
-
var WorkflowDelayUnit;
|
|
39
|
-
(function (WorkflowDelayUnit) {
|
|
40
|
-
WorkflowDelayUnit["SECONDS"] = "SECONDS";
|
|
41
|
-
WorkflowDelayUnit["MINUTES"] = "MINUTES";
|
|
42
|
-
WorkflowDelayUnit["HOURS"] = "HOURS";
|
|
43
|
-
WorkflowDelayUnit["DAYS"] = "DAYS";
|
|
44
|
-
})(WorkflowDelayUnit || (exports.WorkflowDelayUnit = WorkflowDelayUnit = {}));
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { WorkflowTriggerType, FilterOperator } from '../../enum/workflow.enum';
|
|
2
|
+
import { IWorkflow } from './workflow.model';
|
|
3
|
+
export interface ITriggerFilter {
|
|
4
|
+
field: string;
|
|
5
|
+
operator: FilterOperator;
|
|
6
|
+
value: any;
|
|
7
|
+
}
|
|
8
|
+
export interface IUserRegistrationTriggerConfig {
|
|
9
|
+
filters?: {
|
|
10
|
+
emailDomains?: string[];
|
|
11
|
+
excludeEmailDomains?: string[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface IWebhookTriggerConfig {
|
|
15
|
+
webhookUrl: string | null;
|
|
16
|
+
signatureSecret: string | null;
|
|
17
|
+
signatureHeader: string | null;
|
|
18
|
+
requiredHeaders: Record<string, string> | null;
|
|
19
|
+
allowedIpAddresses: string[];
|
|
20
|
+
}
|
|
21
|
+
export type TriggerConfig = IUserRegistrationTriggerConfig | IWebhookTriggerConfig | Record<string, any>;
|
|
22
|
+
export interface IWorkflowTrigger {
|
|
23
|
+
id: string;
|
|
24
|
+
workflowId: string;
|
|
25
|
+
type: WorkflowTriggerType;
|
|
26
|
+
name: string;
|
|
27
|
+
variableName: string;
|
|
28
|
+
description: string | null;
|
|
29
|
+
config: TriggerConfig;
|
|
30
|
+
filters: ITriggerFilter[];
|
|
31
|
+
isActive: boolean;
|
|
32
|
+
createdAt?: Date;
|
|
33
|
+
updatedAt?: Date;
|
|
34
|
+
workflow?: IWorkflow;
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IWorkflowStep } from './workflow-step.model';
|
|
2
|
+
import { IWebhookActionLog } from './webhook-action-log.model';
|
|
3
|
+
export interface IWorkflowWebhookAction {
|
|
4
|
+
id: string;
|
|
5
|
+
workflowStepId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
url: string;
|
|
9
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
bodyTemplate: string | null;
|
|
12
|
+
signatureSecret: string;
|
|
13
|
+
signatureHeader: string;
|
|
14
|
+
retryOnFailure: boolean;
|
|
15
|
+
maxRetries: number;
|
|
16
|
+
retryDelayMs: number;
|
|
17
|
+
timeoutMs: number;
|
|
18
|
+
isEnabled: boolean;
|
|
19
|
+
lastExecutedAt: Date | null;
|
|
20
|
+
executionCount: number;
|
|
21
|
+
successCount: number;
|
|
22
|
+
failureCount: number;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
updatedAt: Date;
|
|
25
|
+
workflowStep?: IWorkflowStep;
|
|
26
|
+
logs?: IWebhookActionLog[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IWorkflowWebhookTrigger } from './workflow-webhook.model';
|
|
2
|
+
import { IWorkflowExecution } from './workflow-execution.model';
|
|
3
|
+
export interface IWorkflowWebhookIncomingLog {
|
|
4
|
+
id: string;
|
|
5
|
+
workflowWebhookTriggerId: string;
|
|
6
|
+
workflowExecutionId: string | null;
|
|
7
|
+
requestMethod: string;
|
|
8
|
+
requestHeaders: Record<string, string>;
|
|
9
|
+
requestBody: Record<string, unknown>;
|
|
10
|
+
requestQuery: Record<string, string>;
|
|
11
|
+
requestIp: string;
|
|
12
|
+
signatureValid: boolean;
|
|
13
|
+
responseStatus: number;
|
|
14
|
+
errorMessage: string | null;
|
|
15
|
+
processingTimeMs: number;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
workflowWebhookTrigger?: IWorkflowWebhookTrigger;
|
|
18
|
+
workflowExecution?: IWorkflowExecution;
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IWorkflowWebhookAction } from './workflow-webhook-action.model';
|
|
2
|
+
import { IWorkflowExecutionStep } from './workflow-execution-step.model';
|
|
3
|
+
export interface IWorkflowWebhookOutgoingLog {
|
|
4
|
+
id: string;
|
|
5
|
+
workflowWebhookActionId: string;
|
|
6
|
+
workflowExecutionStepId: string;
|
|
7
|
+
requestUrl: string;
|
|
8
|
+
requestMethod: string;
|
|
9
|
+
requestHeaders: Record<string, string>;
|
|
10
|
+
requestBody: Record<string, unknown> | string | null;
|
|
11
|
+
responseStatus: number | null;
|
|
12
|
+
responseHeaders: Record<string, string> | null;
|
|
13
|
+
responseBody: Record<string, unknown> | string | null;
|
|
14
|
+
errorMessage: string | null;
|
|
15
|
+
attempt: number;
|
|
16
|
+
success: boolean;
|
|
17
|
+
durationMs: number;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
workflowWebhookAction?: IWorkflowWebhookAction;
|
|
20
|
+
workflowExecutionStep?: IWorkflowExecutionStep;
|
|
21
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IWorkflowWebhookTrigger } from './workflow-webhook-trigger.model';
|
|
2
|
+
import { IIpAddress } from './ip-address.model';
|
|
3
|
+
export interface IWorkflowWebhookTriggerAllowedIp {
|
|
4
|
+
id: string;
|
|
5
|
+
workflowWebhookTriggerId: string;
|
|
6
|
+
ipAddressId: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
workflowWebhookTrigger?: IWorkflowWebhookTrigger;
|
|
9
|
+
ipAddress?: IIpAddress;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IWorkflow } from './workflow.model';
|
|
2
|
+
import { IWorkflowWebhookTriggerAllowedIp } from './workflow-webhook-trigger-allowed-ip.model';
|
|
3
|
+
import { IWebhookTriggerLog } from './webhook-trigger-log.model';
|
|
4
|
+
export interface IWorkflowWebhookTrigger {
|
|
5
|
+
id: string;
|
|
6
|
+
workflowId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string | null;
|
|
9
|
+
urlId: string;
|
|
10
|
+
signatureSecret: string;
|
|
11
|
+
signatureHeader: string;
|
|
12
|
+
isEnabled: boolean;
|
|
13
|
+
lastTriggeredAt: Date | null;
|
|
14
|
+
triggerCount: number;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
workflow?: IWorkflow;
|
|
18
|
+
allowedIps?: IWorkflowWebhookTriggerAllowedIp[];
|
|
19
|
+
logs?: IWebhookTriggerLog[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WebhookDirection, WebhookStatus, HttpMethod } from '../../enum/workflow.enum';
|
|
2
|
+
import { IWorkflowExecution } from './workflow-execution.model';
|
|
3
|
+
import { IWorkflowStepExecution } from './workflow-step-execution.model';
|
|
4
|
+
export interface IWorkflowWebhook {
|
|
5
|
+
id: string;
|
|
6
|
+
direction: WebhookDirection;
|
|
7
|
+
workflowExecutionId: string | null;
|
|
8
|
+
workflowStepExecutionId: string | null;
|
|
9
|
+
url: string;
|
|
10
|
+
method: HttpMethod;
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
body: Record<string, any> | null;
|
|
13
|
+
status: WebhookStatus;
|
|
14
|
+
statusCode: number | null;
|
|
15
|
+
response: Record<string, any> | null;
|
|
16
|
+
error: string | null;
|
|
17
|
+
retryCount: number | null;
|
|
18
|
+
processedAt: Date | null;
|
|
19
|
+
signatureHeader: string | null;
|
|
20
|
+
signatureSecret: string | null;
|
|
21
|
+
maxRetries: number;
|
|
22
|
+
retryDelay: number;
|
|
23
|
+
createdAt?: Date;
|
|
24
|
+
updatedAt?: Date;
|
|
25
|
+
workflowExecution?: IWorkflowExecution;
|
|
26
|
+
workflowStepExecution?: IWorkflowStepExecution;
|
|
27
|
+
}
|
|
@@ -1,90 +1,22 @@
|
|
|
1
|
+
import { WorkflowStatus, WorkflowTemplate } from '../../enum/workflow.enum';
|
|
2
|
+
import { IWorkflowSettings } from '../../dto/workflow.dto';
|
|
1
3
|
import { IProject } from './project.model';
|
|
4
|
+
import { IWorkflowTrigger } from './workflow-trigger.model';
|
|
2
5
|
import { IWorkflowStep } from './workflow-step.model';
|
|
3
6
|
import { IWorkflowExecution } from './workflow-execution.model';
|
|
4
|
-
export declare enum WorkflowMode {
|
|
5
|
-
SIMPLE = "SIMPLE",
|
|
6
|
-
ADVANCED = "ADVANCED"
|
|
7
|
-
}
|
|
8
|
-
export declare enum WorkflowStatus {
|
|
9
|
-
DRAFT = "DRAFT",
|
|
10
|
-
ACTIVE = "ACTIVE",
|
|
11
|
-
PAUSED = "PAUSED",
|
|
12
|
-
ARCHIVED = "ARCHIVED"
|
|
13
|
-
}
|
|
14
|
-
export declare enum WorkflowTriggerType {
|
|
15
|
-
USER_REGISTRATION = "USER_REGISTRATION",
|
|
16
|
-
WEBHOOK = "WEBHOOK"
|
|
17
|
-
}
|
|
18
|
-
export declare enum WorkflowTemplate {
|
|
19
|
-
AUTO_INVITE_BY_DOMAIN = "AUTO_INVITE_BY_DOMAIN"
|
|
20
|
-
}
|
|
21
|
-
export interface IWorkflowTriggerConfigBase {
|
|
22
|
-
type: WorkflowTriggerType;
|
|
23
|
-
}
|
|
24
|
-
export interface IUserRegistrationTriggerConfig extends IWorkflowTriggerConfigBase {
|
|
25
|
-
type: WorkflowTriggerType.USER_REGISTRATION;
|
|
26
|
-
filters?: {
|
|
27
|
-
emailDomains?: string[];
|
|
28
|
-
excludeEmailDomains?: string[];
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export interface IWebhookTriggerConfig extends IWorkflowTriggerConfigBase {
|
|
32
|
-
type: WorkflowTriggerType.WEBHOOK;
|
|
33
|
-
webhookUrls?: IWorkflowWebhookUrl[];
|
|
34
|
-
secretKey?: string;
|
|
35
|
-
allowedIps?: string[];
|
|
36
|
-
}
|
|
37
|
-
export interface IWorkflowWebhookUrl {
|
|
38
|
-
id: string;
|
|
39
|
-
url: string;
|
|
40
|
-
isActive: boolean;
|
|
41
|
-
createdAt: Date;
|
|
42
|
-
}
|
|
43
|
-
export type IWorkflowTriggerConfig = IUserRegistrationTriggerConfig | IWebhookTriggerConfig;
|
|
44
|
-
export interface IUserRegistrationTriggerData {
|
|
45
|
-
userId: string;
|
|
46
|
-
email: string;
|
|
47
|
-
emailDomain: string;
|
|
48
|
-
name: string | null;
|
|
49
|
-
familyName: string | null;
|
|
50
|
-
registeredAt: Date;
|
|
51
|
-
}
|
|
52
|
-
export interface IWebhookTriggerData {
|
|
53
|
-
webhookUrlId: string;
|
|
54
|
-
payload: Record<string, unknown>;
|
|
55
|
-
headers?: Record<string, string>;
|
|
56
|
-
sourceIp?: string;
|
|
57
|
-
receivedAt: Date;
|
|
58
|
-
}
|
|
59
|
-
export type IWorkflowTriggerData = IUserRegistrationTriggerData | IWebhookTriggerData;
|
|
60
|
-
export interface IWorkflowSettings {
|
|
61
|
-
maxExecutionsPerHour?: number;
|
|
62
|
-
maxExecutionsPerDay?: number;
|
|
63
|
-
retryOnFailure?: boolean;
|
|
64
|
-
maxRetryAttempts?: number;
|
|
65
|
-
retryDelaySeconds?: number;
|
|
66
|
-
}
|
|
67
7
|
export interface IWorkflow {
|
|
68
8
|
id: string;
|
|
69
9
|
projectId: string;
|
|
70
10
|
name: string;
|
|
71
11
|
description: string | null;
|
|
72
|
-
mode: WorkflowMode;
|
|
73
12
|
template: WorkflowTemplate | null;
|
|
74
13
|
status: WorkflowStatus;
|
|
75
|
-
trigger: IWorkflowTriggerConfig;
|
|
76
14
|
settings: IWorkflowSettings;
|
|
77
15
|
userId: string;
|
|
78
16
|
createdAt?: Date;
|
|
79
17
|
updatedAt?: Date;
|
|
80
18
|
project?: IProject;
|
|
19
|
+
workflowTrigger?: IWorkflowTrigger[];
|
|
81
20
|
workflowStep?: IWorkflowStep[];
|
|
82
21
|
workflowExecution?: IWorkflowExecution[];
|
|
83
22
|
}
|
|
84
|
-
export interface IWorkflowContext {
|
|
85
|
-
workflowId: string;
|
|
86
|
-
executionId: string;
|
|
87
|
-
triggerData: IWorkflowTriggerData;
|
|
88
|
-
stepResults: Record<string, unknown>;
|
|
89
|
-
variables: Record<string, unknown>;
|
|
90
|
-
}
|
|
@@ -1,24 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WorkflowTemplate = exports.WorkflowTriggerType = exports.WorkflowStatus = exports.WorkflowMode = void 0;
|
|
4
|
-
var WorkflowMode;
|
|
5
|
-
(function (WorkflowMode) {
|
|
6
|
-
WorkflowMode["SIMPLE"] = "SIMPLE";
|
|
7
|
-
WorkflowMode["ADVANCED"] = "ADVANCED";
|
|
8
|
-
})(WorkflowMode || (exports.WorkflowMode = WorkflowMode = {}));
|
|
9
|
-
var WorkflowStatus;
|
|
10
|
-
(function (WorkflowStatus) {
|
|
11
|
-
WorkflowStatus["DRAFT"] = "DRAFT";
|
|
12
|
-
WorkflowStatus["ACTIVE"] = "ACTIVE";
|
|
13
|
-
WorkflowStatus["PAUSED"] = "PAUSED";
|
|
14
|
-
WorkflowStatus["ARCHIVED"] = "ARCHIVED";
|
|
15
|
-
})(WorkflowStatus || (exports.WorkflowStatus = WorkflowStatus = {}));
|
|
16
|
-
var WorkflowTriggerType;
|
|
17
|
-
(function (WorkflowTriggerType) {
|
|
18
|
-
WorkflowTriggerType["USER_REGISTRATION"] = "USER_REGISTRATION";
|
|
19
|
-
WorkflowTriggerType["WEBHOOK"] = "WEBHOOK";
|
|
20
|
-
})(WorkflowTriggerType || (exports.WorkflowTriggerType = WorkflowTriggerType = {}));
|
|
21
|
-
var WorkflowTemplate;
|
|
22
|
-
(function (WorkflowTemplate) {
|
|
23
|
-
WorkflowTemplate["AUTO_INVITE_BY_DOMAIN"] = "AUTO_INVITE_BY_DOMAIN";
|
|
24
|
-
})(WorkflowTemplate || (exports.WorkflowTemplate = WorkflowTemplate = {}));
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -15,3 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./error.utils"), exports);
|
|
18
|
+
__exportStar(require("./reference-resolver.utils"), exports);
|
|
19
|
+
__exportStar(require("./ip-address-validator.utils"), exports);
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IpAddressType, Code } from '../types';
|
|
2
|
+
export type IpAddressErrorCode = Code.ipAddressValueRequired | Code.ipAddressInvalidIPv4Format | Code.ipAddressInvalidIPv6Format | Code.ipAddressInvalidIPv4CIDRFormat | Code.ipAddressInvalidIPv6CIDRFormat | Code.ipAddressInvalidDomainFormat | Code.ipAddressInvalidType;
|
|
3
|
+
export interface IpAddressValidationResult {
|
|
4
|
+
isValid: boolean;
|
|
5
|
+
errorCode?: IpAddressErrorCode;
|
|
6
|
+
errorMessage?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const isValidIPv4: (ip: string) => boolean;
|
|
9
|
+
export declare const isValidIPv6: (ip: string) => boolean;
|
|
10
|
+
export declare const isValidIPv4CIDR: (cidr: string) => boolean;
|
|
11
|
+
export declare const isValidIPv6CIDR: (cidr: string) => boolean;
|
|
12
|
+
export declare const isValidDomain: (domain: string) => boolean;
|
|
13
|
+
export declare const validateIpAddressValue: (type: IpAddressType, value: string) => IpAddressValidationResult;
|
|
14
|
+
export declare const detectIpAddressType: (value: string) => IpAddressType | null;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectIpAddressType = exports.validateIpAddressValue = exports.isValidDomain = exports.isValidIPv6CIDR = exports.isValidIPv4CIDR = exports.isValidIPv6 = exports.isValidIPv4 = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const isValidIPv4 = (ip) => {
|
|
6
|
+
const ipv4Regex = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$/;
|
|
7
|
+
return ipv4Regex.test(ip);
|
|
8
|
+
};
|
|
9
|
+
exports.isValidIPv4 = isValidIPv4;
|
|
10
|
+
const isValidIPv6 = (ip) => {
|
|
11
|
+
const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
12
|
+
return ipv6Regex.test(ip);
|
|
13
|
+
};
|
|
14
|
+
exports.isValidIPv6 = isValidIPv6;
|
|
15
|
+
const isValidIPv4CIDR = (cidr) => {
|
|
16
|
+
const cidrRegex = /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}\/(3[0-2]|[12]?[0-9])$/;
|
|
17
|
+
return cidrRegex.test(cidr);
|
|
18
|
+
};
|
|
19
|
+
exports.isValidIPv4CIDR = isValidIPv4CIDR;
|
|
20
|
+
const isValidIPv6CIDR = (cidr) => {
|
|
21
|
+
const parts = cidr.split('/');
|
|
22
|
+
if (parts.length !== 2)
|
|
23
|
+
return false;
|
|
24
|
+
const prefix = parseInt(parts[1], 10);
|
|
25
|
+
if (isNaN(prefix) || prefix < 0 || prefix > 128)
|
|
26
|
+
return false;
|
|
27
|
+
return (0, exports.isValidIPv6)(parts[0]);
|
|
28
|
+
};
|
|
29
|
+
exports.isValidIPv6CIDR = isValidIPv6CIDR;
|
|
30
|
+
const isValidDomain = (domain) => {
|
|
31
|
+
const domainRegex = /^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
|
|
32
|
+
return domainRegex.test(domain) && domain.length <= 253;
|
|
33
|
+
};
|
|
34
|
+
exports.isValidDomain = isValidDomain;
|
|
35
|
+
const validateIpAddressValue = (type, value) => {
|
|
36
|
+
if (!value || value.trim() === '') {
|
|
37
|
+
return {
|
|
38
|
+
isValid: false,
|
|
39
|
+
errorCode: types_1.Code.ipAddressValueRequired,
|
|
40
|
+
errorMessage: 'IP address value is required',
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const trimmedValue = value.trim();
|
|
44
|
+
switch (type) {
|
|
45
|
+
case types_1.IpAddressType.IPV4:
|
|
46
|
+
if (!(0, exports.isValidIPv4)(trimmedValue)) {
|
|
47
|
+
return {
|
|
48
|
+
isValid: false,
|
|
49
|
+
errorCode: types_1.Code.ipAddressInvalidIPv4Format,
|
|
50
|
+
errorMessage: 'Invalid IPv4 address format. Example: 192.168.1.1',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case types_1.IpAddressType.IPV6:
|
|
55
|
+
if (!(0, exports.isValidIPv6)(trimmedValue)) {
|
|
56
|
+
return {
|
|
57
|
+
isValid: false,
|
|
58
|
+
errorCode: types_1.Code.ipAddressInvalidIPv6Format,
|
|
59
|
+
errorMessage: 'Invalid IPv6 address format. Example: 2001:db8::1',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
case types_1.IpAddressType.IPV4_CIDR:
|
|
64
|
+
if (!(0, exports.isValidIPv4CIDR)(trimmedValue)) {
|
|
65
|
+
return {
|
|
66
|
+
isValid: false,
|
|
67
|
+
errorCode: types_1.Code.ipAddressInvalidIPv4CIDRFormat,
|
|
68
|
+
errorMessage: 'Invalid IPv4 CIDR format. Example: 192.168.1.0/24',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case types_1.IpAddressType.IPV6_CIDR:
|
|
73
|
+
if (!(0, exports.isValidIPv6CIDR)(trimmedValue)) {
|
|
74
|
+
return {
|
|
75
|
+
isValid: false,
|
|
76
|
+
errorCode: types_1.Code.ipAddressInvalidIPv6CIDRFormat,
|
|
77
|
+
errorMessage: 'Invalid IPv6 CIDR format. Example: 2001:db8::/32',
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case types_1.IpAddressType.DOMAIN:
|
|
82
|
+
if (!(0, exports.isValidDomain)(trimmedValue)) {
|
|
83
|
+
return {
|
|
84
|
+
isValid: false,
|
|
85
|
+
errorCode: types_1.Code.ipAddressInvalidDomainFormat,
|
|
86
|
+
errorMessage: 'Invalid domain format. Example: example.com',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
return {
|
|
92
|
+
isValid: false,
|
|
93
|
+
errorCode: types_1.Code.ipAddressInvalidType,
|
|
94
|
+
errorMessage: 'Invalid IP address type',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return { isValid: true };
|
|
98
|
+
};
|
|
99
|
+
exports.validateIpAddressValue = validateIpAddressValue;
|
|
100
|
+
const detectIpAddressType = (value) => {
|
|
101
|
+
const trimmedValue = value.trim();
|
|
102
|
+
if ((0, exports.isValidIPv4CIDR)(trimmedValue)) {
|
|
103
|
+
return types_1.IpAddressType.IPV4_CIDR;
|
|
104
|
+
}
|
|
105
|
+
if ((0, exports.isValidIPv6CIDR)(trimmedValue)) {
|
|
106
|
+
return types_1.IpAddressType.IPV6_CIDR;
|
|
107
|
+
}
|
|
108
|
+
if ((0, exports.isValidIPv4)(trimmedValue)) {
|
|
109
|
+
return types_1.IpAddressType.IPV4;
|
|
110
|
+
}
|
|
111
|
+
if ((0, exports.isValidIPv6)(trimmedValue)) {
|
|
112
|
+
return types_1.IpAddressType.IPV6;
|
|
113
|
+
}
|
|
114
|
+
if ((0, exports.isValidDomain)(trimmedValue)) {
|
|
115
|
+
return types_1.IpAddressType.DOMAIN;
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
};
|
|
119
|
+
exports.detectIpAddressType = detectIpAddressType;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface IReferenceResolver<T = any> {
|
|
2
|
+
type: string;
|
|
3
|
+
resolve: (id: string) => Promise<T> | T;
|
|
4
|
+
}
|
|
5
|
+
export interface IResolvedReference<T = any> {
|
|
6
|
+
type: string;
|
|
7
|
+
id: string;
|
|
8
|
+
reference: string;
|
|
9
|
+
value: T;
|
|
10
|
+
resolvedValue: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IValidationResult {
|
|
13
|
+
valid: boolean;
|
|
14
|
+
missingReferences: Array<{
|
|
15
|
+
type: string;
|
|
16
|
+
id: string;
|
|
17
|
+
reference: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare class ReferenceResolverUtils {
|
|
21
|
+
private static resolvers;
|
|
22
|
+
static registerResolver<T>(resolver: IReferenceResolver<T>): void;
|
|
23
|
+
static unregisterResolver(type: string): void;
|
|
24
|
+
static clearResolvers(): void;
|
|
25
|
+
static hasReferences(value: string): boolean;
|
|
26
|
+
static extractReferences(value: string): Array<{
|
|
27
|
+
type: string;
|
|
28
|
+
id: string;
|
|
29
|
+
reference: string;
|
|
30
|
+
}>;
|
|
31
|
+
static extractReferencesFromArray(values: string[]): Array<{
|
|
32
|
+
type: string;
|
|
33
|
+
id: string;
|
|
34
|
+
reference: string;
|
|
35
|
+
}>;
|
|
36
|
+
static extractReferencesFromObject(obj: any): Array<{
|
|
37
|
+
type: string;
|
|
38
|
+
id: string;
|
|
39
|
+
reference: string;
|
|
40
|
+
}>;
|
|
41
|
+
private static uniqueReferences;
|
|
42
|
+
static resolveString(value: string): Promise<string>;
|
|
43
|
+
static resolveArray(values: string[]): Promise<string[]>;
|
|
44
|
+
static resolveObject<T>(obj: T): Promise<T>;
|
|
45
|
+
static validateReferences(value: any): Promise<IValidationResult>;
|
|
46
|
+
static getResolutionInfo(value: string): Promise<IResolvedReference[]>;
|
|
47
|
+
static resolveObjectWithTypes<T>(obj: T, types: string[]): Promise<T>;
|
|
48
|
+
}
|
|
49
|
+
export declare function resolveReferences<T>(value: T): Promise<T>;
|
|
50
|
+
export declare function createResolver<T>(type: string, resolveFn: (id: string) => Promise<T> | T): IReferenceResolver<T>;
|
|
51
|
+
export declare function createMapResolver<T>(type: string, map: Map<string, T>): IReferenceResolver<T>;
|
|
52
|
+
export declare function createAsyncResolver<T>(type: string, fetchFn: (id: string) => Promise<T>): IReferenceResolver<T>;
|