@abyss-project/console 1.0.42 → 1.0.43

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.
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
package/dist/index.d.ts CHANGED
@@ -10,7 +10,6 @@ import * as projectAdminApi from './api/project.admin.api';
10
10
  import * as secretApi from './api/secret.api';
11
11
  import * as secretAccessApi from './api/secret-access.api';
12
12
  import * as secretPublicApi from './api/secret-public.api';
13
- export * from './utils/cidr.util';
14
13
  export * from './types';
15
14
  export * from './utils';
16
15
  export * as WorkflowExpression from './workflow-expressions';
package/dist/index.js CHANGED
@@ -43,7 +43,6 @@ const projectAdminApi = __importStar(require("./api/project.admin.api"));
43
43
  const secretApi = __importStar(require("./api/secret.api"));
44
44
  const secretAccessApi = __importStar(require("./api/secret-access.api"));
45
45
  const secretPublicApi = __importStar(require("./api/secret-public.api"));
46
- __exportStar(require("./utils/cidr.util"), exports);
47
46
  __exportStar(require("./types"), exports);
48
47
  __exportStar(require("./utils"), exports);
49
48
  exports.WorkflowExpression = __importStar(require("./workflow-expressions"));
@@ -3,6 +3,9 @@ export declare const WORKFLOW_STEP_TIMEOUT: number;
3
3
  export declare const SLEEP_DURATION_MIN = 0;
4
4
  export declare const SLEEP_DURATION_MAX = 900;
5
5
  export declare const SLEEP_DURATION_DEFAULT = 1;
6
+ export declare const CODE_STEP_TIMEOUT_MIN = 100;
7
+ export declare const CODE_STEP_TIMEOUT_MAX = 60000;
8
+ export declare const CODE_STEP_TIMEOUT_DEFAULT = 5000;
6
9
  export declare const EXPRESSION_TIMEOUT_DEFAULT = 5000;
7
10
  export declare const EXPRESSION_TIMEOUT_MAX = 30000;
8
11
  export declare const EXPRESSION_CPU_TIMEOUT = 10000;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EXPRESSION_MEMORY_LIMIT = exports.EXPRESSION_CPU_TIMEOUT = exports.EXPRESSION_TIMEOUT_MAX = exports.EXPRESSION_TIMEOUT_DEFAULT = exports.SLEEP_DURATION_DEFAULT = exports.SLEEP_DURATION_MAX = exports.SLEEP_DURATION_MIN = exports.WORKFLOW_STEP_TIMEOUT = exports.WORKFLOW_EXECUTION_TIMEOUT = void 0;
3
+ exports.EXPRESSION_MEMORY_LIMIT = exports.EXPRESSION_CPU_TIMEOUT = exports.EXPRESSION_TIMEOUT_MAX = exports.EXPRESSION_TIMEOUT_DEFAULT = exports.CODE_STEP_TIMEOUT_DEFAULT = exports.CODE_STEP_TIMEOUT_MAX = exports.CODE_STEP_TIMEOUT_MIN = exports.SLEEP_DURATION_DEFAULT = exports.SLEEP_DURATION_MAX = exports.SLEEP_DURATION_MIN = exports.WORKFLOW_STEP_TIMEOUT = exports.WORKFLOW_EXECUTION_TIMEOUT = void 0;
4
4
  exports.WORKFLOW_EXECUTION_TIMEOUT = 60 * 60 * 1000;
5
5
  exports.WORKFLOW_STEP_TIMEOUT = 15 * 60 * 1000;
6
6
  exports.SLEEP_DURATION_MIN = 0;
7
7
  exports.SLEEP_DURATION_MAX = 900;
8
8
  exports.SLEEP_DURATION_DEFAULT = 1;
9
+ exports.CODE_STEP_TIMEOUT_MIN = 100;
10
+ exports.CODE_STEP_TIMEOUT_MAX = 60000;
11
+ exports.CODE_STEP_TIMEOUT_DEFAULT = 5000;
9
12
  exports.EXPRESSION_TIMEOUT_DEFAULT = 5000;
10
13
  exports.EXPRESSION_TIMEOUT_MAX = 30000;
11
14
  exports.EXPRESSION_CPU_TIMEOUT = 10000;
@@ -25,6 +25,10 @@ export interface ISwitchCondition {
25
25
  export interface ISwitchStepConfig {
26
26
  expression: string;
27
27
  }
28
+ export interface ICodeStepConfig {
29
+ code: string;
30
+ timeout?: number;
31
+ }
28
32
  export interface ICallWebhookActionConfig {
29
33
  actionType: WorkflowActionType.CALL_WEBHOOK;
30
34
  url: string;
@@ -40,7 +44,7 @@ export interface IInviteToProjectActionConfig {
40
44
  permissions: string[];
41
45
  }
42
46
  export type IActionStepConfig = ICallWebhookActionConfig | IInviteToProjectActionConfig;
43
- export type StepConfig = IFilterStepConfig | ISleepStepConfig | ISwitchStepConfig | IActionStepConfig;
47
+ export type StepConfig = IFilterStepConfig | ISleepStepConfig | ISwitchStepConfig | ICodeStepConfig | IActionStepConfig;
44
48
  export interface IWorkflowSettings {
45
49
  maxExecutionsPerHour?: number;
46
50
  maxExecutionsPerDay?: number;
@@ -16,7 +16,8 @@ export declare enum WorkflowStepType {
16
16
  FILTER = "FILTER",
17
17
  SLEEP = "SLEEP",
18
18
  SWITCH = "SWITCH",
19
- ACTION = "ACTION"
19
+ ACTION = "ACTION",
20
+ CODE = "CODE"
20
21
  }
21
22
  export declare enum WorkflowActionType {
22
23
  CALL_WEBHOOK = "CALL_WEBHOOK",
@@ -24,6 +24,7 @@ var WorkflowStepType;
24
24
  WorkflowStepType["SLEEP"] = "SLEEP";
25
25
  WorkflowStepType["SWITCH"] = "SWITCH";
26
26
  WorkflowStepType["ACTION"] = "ACTION";
27
+ WorkflowStepType["CODE"] = "CODE";
27
28
  })(WorkflowStepType || (exports.WorkflowStepType = WorkflowStepType = {}));
28
29
  var WorkflowActionType;
29
30
  (function (WorkflowActionType) {
@@ -1,4 +1,3 @@
1
1
  export * from './error.utils';
2
- export * from './reference-resolver.utils';
3
2
  export * from './ip-address-validator.utils';
4
- export * from './webhook-trigger.utils';
3
+ export * from './cidr.util';
@@ -15,6 +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
18
  __exportStar(require("./ip-address-validator.utils"), exports);
20
- __exportStar(require("./webhook-trigger.utils"), exports);
19
+ __exportStar(require("./cidr.util"), exports);
@@ -1,2 +0,0 @@
1
- import { WorkflowTriggerData, IWorkflowTrigger } from '../types';
2
- export declare const matchesTriggerFilters: (trigger: IWorkflowTrigger, triggerData: WorkflowTriggerData) => boolean;
@@ -1,54 +1 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.matchesTriggerFilters = void 0;
4
- const matchesTriggerFilters = (trigger, triggerData) => {
5
- if (!trigger.filters || trigger.filters.length === 0) {
6
- return true;
7
- }
8
- return trigger.filters.every((filter) => {
9
- if (filter.expression) {
10
- try {
11
- const context = { trigger: triggerData };
12
- const result = evaluateSimpleExpression(filter.expression, context);
13
- return Boolean(result);
14
- }
15
- catch (error) {
16
- console.error('Expression evaluation error:', error);
17
- return false;
18
- }
19
- }
20
- return true;
21
- });
22
- };
23
- exports.matchesTriggerFilters = matchesTriggerFilters;
24
- function evaluateSimpleExpression(expression, context) {
25
- let evaluated = expression;
26
- const pattern = /\{\{([^}]+)\}\}/g;
27
- const matches = [...expression.matchAll(pattern)];
28
- for (const match of matches) {
29
- const [fullMatch, path] = match;
30
- const value = getNestedValue(context, path.trim());
31
- const valueStr = typeof value === 'string'
32
- ? `"${value.replace(/"/g, '\\"')}"`
33
- : JSON.stringify(value);
34
- evaluated = evaluated.replace(fullMatch, valueStr);
35
- }
36
- try {
37
- return new Function(`return ${evaluated}`)();
38
- }
39
- catch (error) {
40
- console.error('Failed to evaluate expression:', evaluated, error);
41
- return false;
42
- }
43
- }
44
- function getNestedValue(obj, path) {
45
- const segments = path.split('.');
46
- let current = obj;
47
- for (const segment of segments) {
48
- if (current === null || current === undefined) {
49
- return undefined;
50
- }
51
- current = current[segment];
52
- }
53
- return current;
54
- }
@@ -1,5 +1,5 @@
1
1
  export { DataSourceType } from './types';
2
- export type { WorkflowContext, StepExecution, WorkflowStep, TriggerInfo, } from './types';
3
- export { buildResolverContext, resolvePathValue, interpolateTemplate, } from './resolver';
2
+ export type { WorkflowContext } from './types';
3
+ export { buildResolverContext, resolvePathValue, interpolateTemplate } from './resolver';
4
4
  export declare function hasTemplates(str: string): boolean;
5
5
  export declare function extractTemplates(str: string): string[];
@@ -14,6 +14,6 @@ exports.hasTemplates = hasTemplates;
14
14
  function extractTemplates(str) {
15
15
  const pattern = /\{\{(.+?)\}\}/g;
16
16
  const matches = [...str.matchAll(pattern)];
17
- return matches.map(m => m[1].trim());
17
+ return matches.map((m) => m[1].trim());
18
18
  }
19
19
  exports.extractTemplates = extractTemplates;
@@ -14,28 +14,28 @@ function buildResolverContext(workflowContext) {
14
14
  context.triggers = workflowContext.triggers;
15
15
  }
16
16
  if (workflowContext.stepExecutions) {
17
- const steps = {};
17
+ const stepExecutions = {};
18
18
  for (const [stepId, execution] of Object.entries(workflowContext.stepExecutions)) {
19
19
  const step = (_a = workflowContext.steps) === null || _a === void 0 ? void 0 : _a.find((s) => s.id === stepId);
20
20
  const stepKey = (step === null || step === void 0 ? void 0 : step.name) || stepId;
21
- steps[stepKey] = execution.outputData;
21
+ stepExecutions[stepKey] = execution.outputData;
22
22
  }
23
- context.steps = steps;
23
+ context.stepExecutions = stepExecutions;
24
24
  }
25
- if (workflowContext.variables) {
26
- context.variables = workflowContext.variables;
25
+ if (workflowContext.steps) {
26
+ context.steps = workflowContext.steps;
27
27
  }
28
28
  if (workflowContext.ipAddresses) {
29
- context.ipAddress = workflowContext.ipAddresses;
29
+ context.ipAddresses = workflowContext.ipAddresses;
30
30
  }
31
31
  if (workflowContext.domains) {
32
- context.domain = workflowContext.domains;
32
+ context.domains = workflowContext.domains;
33
33
  }
34
34
  if (workflowContext.applications) {
35
- context.app = workflowContext.applications;
35
+ context.applications = workflowContext.applications;
36
36
  }
37
37
  if (workflowContext.secrets) {
38
- context.secret = workflowContext.secrets;
38
+ context.secrets = workflowContext.secrets;
39
39
  }
40
40
  if (workflowContext.project) {
41
41
  context.project = workflowContext.project;
@@ -43,6 +43,12 @@ function buildResolverContext(workflowContext) {
43
43
  if (workflowContext.workflow) {
44
44
  context.workflow = workflowContext.workflow;
45
45
  }
46
+ if (workflowContext.workflowExecution) {
47
+ context.workflowExecution = workflowContext.workflowExecution;
48
+ }
49
+ if (workflowContext.abyss) {
50
+ context.abyss = workflowContext.abyss;
51
+ }
46
52
  return context;
47
53
  }
48
54
  exports.buildResolverContext = buildResolverContext;
@@ -1,56 +1,36 @@
1
- import type { WorkflowStatus, WorkflowTemplate, WorkflowTriggerType } from '../types/enum/workflow.enum';
2
- import type { IWorkflowSettings } from '../types';
1
+ import type { IProject, IWorkflow, IWorkflowTrigger, IWorkflowStep, IWorkflowStepExecution, IWorkflowExecution, IIpAddress, IDomainVerification, ISecret } from '../types';
3
2
  export declare enum DataSourceType {
4
3
  WORKFLOW_TRIGGER = "trigger",
5
4
  WORKFLOW_STEPS = "steps",
6
- WORKFLOW_VARIABLES = "variables",
7
5
  IP_ADDRESSES = "ipAddress",
8
6
  DOMAINS = "domain",
9
7
  APPLICATIONS = "app",
10
8
  SECRETS = "secret",
11
9
  PROJECT = "project",
12
- WORKFLOW = "workflow"
10
+ WORKFLOW = "workflow",
11
+ ABYSS = "abyss"
13
12
  }
14
13
  export interface WorkflowContext {
15
- project: {
16
- id: string;
14
+ project: Pick<IProject, 'id'> & {
17
15
  name: string;
18
16
  };
19
- workflow: {
17
+ workflow: Pick<IWorkflow, 'id' | 'name' | 'description' | 'template' | 'status' | 'settings'>;
18
+ workflowExecution?: Pick<IWorkflowExecution, 'id' | 'status' | 'startedAt' | 'completedAt' | 'context' | 'metadata'>;
19
+ trigger?: IWorkflowTrigger & {
20
+ data: unknown;
21
+ };
22
+ triggers?: Record<string, IWorkflowTrigger>;
23
+ stepExecutions?: Record<string, IWorkflowStepExecution>;
24
+ steps?: IWorkflowStep[];
25
+ ipAddresses?: Record<string, IIpAddress>;
26
+ domains?: Record<string, IDomainVerification>;
27
+ applications?: Record<string, Record<string, {
20
28
  id: string;
21
29
  name: string;
22
- description: string | null;
23
- template: WorkflowTemplate | null;
24
- status: WorkflowStatus;
25
- settings: IWorkflowSettings;
26
- };
27
- trigger?: Record<string, unknown>;
28
- triggers?: Record<string, Record<string, unknown>>;
29
- stepExecutions?: Record<string, StepExecution>;
30
- variables?: Record<string, unknown>;
31
- steps?: WorkflowStep[];
32
- ipAddresses?: Record<string, Record<string, unknown>>;
33
- domains?: Record<string, Record<string, unknown>>;
34
- applications?: Record<string, Record<string, unknown>>;
35
- secrets?: Record<string, string>;
36
- }
37
- export interface StepExecution {
38
- stepId: string;
39
- outputData: unknown;
40
- status: 'success' | 'failed' | 'running' | 'pending';
41
- startedAt?: Date;
42
- completedAt?: Date;
43
- error?: string;
44
- }
45
- export interface WorkflowStep {
46
- id: string;
47
- name: string;
48
- type: string;
49
- config?: Record<string, unknown>;
50
- }
51
- export interface TriggerInfo {
52
- id: string;
53
- name: string;
54
- type: WorkflowTriggerType;
55
- isActive: boolean;
30
+ }>>;
31
+ secrets?: Record<string, Pick<ISecret, 'id' | 'key' | 'name'>>;
32
+ abyss?: Record<string, {
33
+ api: string;
34
+ site?: string;
35
+ }>;
56
36
  }
@@ -5,11 +5,11 @@ var DataSourceType;
5
5
  (function (DataSourceType) {
6
6
  DataSourceType["WORKFLOW_TRIGGER"] = "trigger";
7
7
  DataSourceType["WORKFLOW_STEPS"] = "steps";
8
- DataSourceType["WORKFLOW_VARIABLES"] = "variables";
9
8
  DataSourceType["IP_ADDRESSES"] = "ipAddress";
10
9
  DataSourceType["DOMAINS"] = "domain";
11
10
  DataSourceType["APPLICATIONS"] = "app";
12
11
  DataSourceType["SECRETS"] = "secret";
13
12
  DataSourceType["PROJECT"] = "project";
14
13
  DataSourceType["WORKFLOW"] = "workflow";
14
+ DataSourceType["ABYSS"] = "abyss";
15
15
  })(DataSourceType || (exports.DataSourceType = DataSourceType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/console",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "Core package to interact with AbyssConsole",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",