@activepieces/shared
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "@activepieces/shared", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -0,5 +1,5 @@ | ||
export * from "./lib/flows/actions/action"; | ||
export * from "./lib/app-connection/app-connection"; | ||
export * from "./lib/app-connection/dto/read-app-connection-request"; | ||
export * from "./lib/app-connection/dto/upsert-app-connection-request"; | ||
export * from "./lib/collections/config"; | ||
export * from "./lib/common/activepieces-error"; | ||
@@ -13,3 +13,2 @@ export * from "./lib/common/telemetry"; | ||
export * from "./lib/flows/flow-operations"; | ||
export * from "./lib/collections/config"; | ||
export * from './lib/instance'; | ||
@@ -27,3 +26,2 @@ export * from "./lib/app-connection/app-connection"; | ||
export { ExecuteCodeRequest } from './lib/code/dto/code-request'; | ||
export { flowHelper } from "./lib/flows/flow-helper"; | ||
export { AuthenticationResponse } from './lib/authentication/dto/authentication-response'; | ||
@@ -38,9 +36,8 @@ export { SignUpRequest } from './lib/authentication/dto/sign-up-request'; | ||
export { CreateFlowRunRequest } from './lib/flow-run/create-flow-run-request'; | ||
export { Trigger, EmptyTrigger, PieceTriggerSettings, ScheduleTriggerSettings, PieceTrigger, ScheduleTrigger, WebhookTrigger, TriggerType } from './lib/flows/triggers/trigger'; | ||
export { TriggerStrategy, Trigger, EmptyTrigger, PieceTriggerSettings, ScheduleTriggerSettings, PieceTrigger, ScheduleTrigger, WebhookTrigger, TriggerType } from './lib/flows/triggers/trigger'; | ||
export { Collection, CollectionId } from './lib/collections/collection'; | ||
export { CollectionVersion, CollectionVersionState, CollectionVersionId } from './lib/collections/collection-version'; | ||
export { FlowVersion, FlowVersionState, FlowVersionId } from './lib/flows/flow-version'; | ||
export { Flow, FlowId } from './lib/flows/flow'; | ||
export { File, FileId } from './lib/file/file'; | ||
export { getStep } from './lib/flows/flow-helper'; | ||
export * from './lib/flows/flow-helper'; | ||
export { FlowRun, FlowRunId, RunEnvironment } from './lib/flow-run/flow-run'; | ||
@@ -47,0 +44,0 @@ export { ExecutionState } from './lib/flow-run/execution/execution-state'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ApId = exports.apId = exports.CreateFlowRequest = exports.UpdateCollectionRequest = exports.CreateCollectionRequest = exports.ListFlowsRequest = exports.ListCollectionsRequest = exports.ExecutionState = exports.RunEnvironment = exports.getStep = exports.FlowVersionState = exports.CollectionVersionState = exports.TriggerType = exports.WebhookTrigger = exports.ScheduleTrigger = exports.PieceTrigger = exports.ScheduleTriggerSettings = exports.PieceTriggerSettings = exports.EmptyTrigger = exports.Trigger = exports.CreateFlowRunRequest = exports.UserStatus = exports.CodeActionSettings = exports.ActionType = exports.Action = exports.PieceActionSettings = exports.LoopOnItemsAction = exports.PieceAction = exports.CodeAction = exports.PrincipalType = exports.SignInRequest = exports.SignUpRequest = exports.flowHelper = exports.ExecuteCodeRequest = exports.CodeRunStatus = exports.StepOutputStatus = exports.StoreOperation = void 0; | ||
exports.ApId = exports.apId = exports.CreateFlowRequest = exports.UpdateCollectionRequest = exports.CreateCollectionRequest = exports.ListFlowsRequest = exports.ListCollectionsRequest = exports.ExecutionState = exports.RunEnvironment = exports.FlowVersionState = exports.Collection = exports.TriggerType = exports.WebhookTrigger = exports.ScheduleTrigger = exports.PieceTrigger = exports.ScheduleTriggerSettings = exports.PieceTriggerSettings = exports.EmptyTrigger = exports.Trigger = exports.TriggerStrategy = exports.CreateFlowRunRequest = exports.UserStatus = exports.CodeActionSettings = exports.ActionType = exports.Action = exports.PieceActionSettings = exports.PrincipalType = exports.SignInRequest = exports.SignUpRequest = exports.ExecuteCodeRequest = exports.CodeRunStatus = exports.StepOutputStatus = exports.StoreOperation = void 0; | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./lib/flows/actions/action"), exports); | ||
tslib_1.__exportStar(require("./lib/app-connection/app-connection"), exports); | ||
tslib_1.__exportStar(require("./lib/app-connection/dto/read-app-connection-request"), exports); | ||
tslib_1.__exportStar(require("./lib/app-connection/dto/upsert-app-connection-request"), exports); | ||
tslib_1.__exportStar(require("./lib/collections/config"), exports); | ||
tslib_1.__exportStar(require("./lib/common/activepieces-error"), exports); | ||
@@ -17,3 +17,2 @@ tslib_1.__exportStar(require("./lib/common/telemetry"), exports); | ||
tslib_1.__exportStar(require("./lib/flows/flow-operations"), exports); | ||
tslib_1.__exportStar(require("./lib/collections/config"), exports); | ||
tslib_1.__exportStar(require("./lib/instance"), exports); | ||
@@ -34,4 +33,2 @@ tslib_1.__exportStar(require("./lib/app-connection/app-connection"), exports); | ||
Object.defineProperty(exports, "ExecuteCodeRequest", { enumerable: true, get: function () { return code_request_1.ExecuteCodeRequest; } }); | ||
var flow_helper_1 = require("./lib/flows/flow-helper"); | ||
Object.defineProperty(exports, "flowHelper", { enumerable: true, get: function () { return flow_helper_1.flowHelper; } }); | ||
var sign_up_request_1 = require("./lib/authentication/dto/sign-up-request"); | ||
@@ -44,5 +41,2 @@ Object.defineProperty(exports, "SignUpRequest", { enumerable: true, get: function () { return sign_up_request_1.SignUpRequest; } }); | ||
var action_2 = require("./lib/flows/actions/action"); | ||
Object.defineProperty(exports, "CodeAction", { enumerable: true, get: function () { return action_2.CodeAction; } }); | ||
Object.defineProperty(exports, "PieceAction", { enumerable: true, get: function () { return action_2.PieceAction; } }); | ||
Object.defineProperty(exports, "LoopOnItemsAction", { enumerable: true, get: function () { return action_2.LoopOnItemsAction; } }); | ||
Object.defineProperty(exports, "PieceActionSettings", { enumerable: true, get: function () { return action_2.PieceActionSettings; } }); | ||
@@ -57,2 +51,3 @@ Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return action_2.Action; } }); | ||
var trigger_1 = require("./lib/flows/triggers/trigger"); | ||
Object.defineProperty(exports, "TriggerStrategy", { enumerable: true, get: function () { return trigger_1.TriggerStrategy; } }); | ||
Object.defineProperty(exports, "Trigger", { enumerable: true, get: function () { return trigger_1.Trigger; } }); | ||
@@ -66,8 +61,7 @@ Object.defineProperty(exports, "EmptyTrigger", { enumerable: true, get: function () { return trigger_1.EmptyTrigger; } }); | ||
Object.defineProperty(exports, "TriggerType", { enumerable: true, get: function () { return trigger_1.TriggerType; } }); | ||
var collection_version_1 = require("./lib/collections/collection-version"); | ||
Object.defineProperty(exports, "CollectionVersionState", { enumerable: true, get: function () { return collection_version_1.CollectionVersionState; } }); | ||
var collection_1 = require("./lib/collections/collection"); | ||
Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return collection_1.Collection; } }); | ||
var flow_version_1 = require("./lib/flows/flow-version"); | ||
Object.defineProperty(exports, "FlowVersionState", { enumerable: true, get: function () { return flow_version_1.FlowVersionState; } }); | ||
var flow_helper_2 = require("./lib/flows/flow-helper"); | ||
Object.defineProperty(exports, "getStep", { enumerable: true, get: function () { return flow_helper_2.getStep; } }); | ||
tslib_1.__exportStar(require("./lib/flows/flow-helper"), exports); | ||
var flow_run_1 = require("./lib/flow-run/flow-run"); | ||
@@ -74,0 +68,0 @@ Object.defineProperty(exports, "RunEnvironment", { enumerable: true, get: function () { return flow_run_1.RunEnvironment; } }); |
@@ -41,2 +41,3 @@ import { BaseModel } from "../common/base-model"; | ||
type: AppConnectionType.CLOUD_OAUTH2; | ||
client_id: string; | ||
expires_in: number; | ||
@@ -61,6 +62,7 @@ token_type: string; | ||
export declare type OAuth2AppConnection = BaseAppConnection<OAuth2ConnectionValueWithApp>; | ||
export declare type ApiKeyAppConnection = BaseAppConnection<SecretTextConnectionValue>; | ||
export declare type SecretKeyAppConnection = BaseAppConnection<SecretTextConnectionValue>; | ||
export declare type CloudAuth2Connection = BaseAppConnection<CloudOAuth2ConnectionValue>; | ||
export declare type BasicAuthConnection = BaseAppConnection<BasicAuthConnectionValue>; | ||
export declare type AppConnection = BasicAuthConnection | ApiKeyAppConnection | OAuth2AppConnection | CloudAuth2Connection; | ||
export declare type AppConnection = BasicAuthConnection | SecretKeyAppConnection | OAuth2AppConnection | CloudAuth2Connection; | ||
export declare type AppConnectionValue = SecretTextConnectionValue | OAuth2ConnectionValueWithApp | CloudOAuth2ConnectionValue | BasicAuthConnectionValue; | ||
export {}; |
@@ -5,2 +5,3 @@ import { Static } from "@sinclair/typebox"; | ||
value: import("@sinclair/typebox").TObject<{ | ||
client_id: import("@sinclair/typebox").TString<string>; | ||
code: import("@sinclair/typebox").TString<string>; | ||
@@ -29,3 +30,3 @@ code_challenge: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>; | ||
token_url: import("@sinclair/typebox").TString<string>; | ||
props: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TString<string>>>; | ||
props: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TAny>>; | ||
scope: import("@sinclair/typebox").TString<string>; | ||
@@ -66,3 +67,3 @@ code: import("@sinclair/typebox").TString<string>; | ||
token_url: import("@sinclair/typebox").TString<string>; | ||
props: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TString<string>>>; | ||
props: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString<string>, import("@sinclair/typebox").TAny>>; | ||
scope: import("@sinclair/typebox").TString<string>; | ||
@@ -78,2 +79,3 @@ code: import("@sinclair/typebox").TString<string>; | ||
value: import("@sinclair/typebox").TObject<{ | ||
client_id: import("@sinclair/typebox").TString<string>; | ||
code: import("@sinclair/typebox").TString<string>; | ||
@@ -80,0 +82,0 @@ code_challenge: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>; |
@@ -11,2 +11,3 @@ "use strict"; | ||
exports.UpsertCloudOAuth2Request = typebox_1.Type.Object(Object.assign(Object.assign({}, commonAuthProps), { value: typebox_1.Type.Object({ | ||
client_id: typebox_1.Type.String(), | ||
code: typebox_1.Type.String(), | ||
@@ -27,3 +28,3 @@ code_challenge: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
token_url: typebox_1.Type.String({}), | ||
props: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.String())), | ||
props: typebox_1.Type.Optional(typebox_1.Type.Record(typebox_1.Type.String(), typebox_1.Type.Any())), | ||
scope: typebox_1.Type.String(), | ||
@@ -30,0 +31,0 @@ code: typebox_1.Type.String(), |
import { BaseModel } from "../common/base-model"; | ||
import { ProjectId } from "../project/project"; | ||
import { CollectionVersion } from "./collection-version"; | ||
export declare type CollectionId = string; | ||
export interface Collection extends BaseModel<CollectionId> { | ||
displayName: string; | ||
projectId: ProjectId; | ||
version: CollectionVersion | null; | ||
} | ||
export declare const Collection: import("@sinclair/typebox").TObject<{ | ||
projectId: import("@sinclair/typebox").TString<string>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
id: import("@sinclair/typebox").TString<string>; | ||
created: import("@sinclair/typebox").TString<string>; | ||
update: import("@sinclair/typebox").TString<string>; | ||
}>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Collection = void 0; | ||
const base_model_1 = require("../common/base-model"); | ||
const typebox_1 = require("@sinclair/typebox"); | ||
exports.Collection = typebox_1.Type.Object(Object.assign(Object.assign({}, base_model_1.BaseModelSchema), { projectId: typebox_1.Type.String(), displayName: typebox_1.Type.String() })); | ||
//# sourceMappingURL=collection.js.map |
@@ -5,3 +5,2 @@ import { ProjectId } from "../../project/project"; | ||
export declare const ListCollectionsRequest: import("@sinclair/typebox").TObject<{ | ||
projectId: import("@sinclair/typebox").TString<string>; | ||
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>; | ||
@@ -8,0 +7,0 @@ cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>; |
@@ -6,3 +6,2 @@ "use strict"; | ||
exports.ListCollectionsRequest = typebox_1.Type.Object({ | ||
projectId: typebox_1.Type.String({}), | ||
limit: typebox_1.Type.Optional(typebox_1.Type.Number({})), | ||
@@ -9,0 +8,0 @@ cursor: typebox_1.Type.Optional(typebox_1.Type.String({})), |
import { Static } from "@sinclair/typebox"; | ||
import { Config, ConfigType } from "../config"; | ||
export declare const ConfigValidation: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.CHECKBOX>; | ||
value: import("@sinclair/typebox").TBoolean; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.SHORT_TEXT>; | ||
value: import("@sinclair/typebox").TString<string>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.LONG_TEXT>; | ||
value: import("@sinclair/typebox").TString<string>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.NUMBER>; | ||
value: import("@sinclair/typebox").TNumber; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.DICTIONARY>; | ||
value: import("@sinclair/typebox").TObject<{}>; | ||
}>]>; | ||
export declare const UpdateCollectionRequest: import("@sinclair/typebox").TObject<{ | ||
configs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.CHECKBOX>; | ||
value: import("@sinclair/typebox").TBoolean; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.SHORT_TEXT>; | ||
value: import("@sinclair/typebox").TString<string>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.LONG_TEXT>; | ||
value: import("@sinclair/typebox").TString<string>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.NUMBER>; | ||
value: import("@sinclair/typebox").TNumber; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
key: import("@sinclair/typebox").TString<string>; | ||
type: import("@sinclair/typebox").TLiteral<ConfigType.DICTIONARY>; | ||
value: import("@sinclair/typebox").TObject<{}>; | ||
}>]>>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>; | ||
export declare type UpdateCollectionRequest = Static<typeof UpdateCollectionRequest> & { | ||
configs: Config[]; | ||
}; | ||
export declare type UpdateCollectionRequest = Static<typeof UpdateCollectionRequest>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UpdateCollectionRequest = exports.ConfigValidation = void 0; | ||
exports.UpdateCollectionRequest = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
const config_1 = require("../config"); | ||
exports.ConfigValidation = typebox_1.Type.Union([ | ||
typebox_1.Type.Object({ | ||
key: typebox_1.Type.String(), | ||
type: typebox_1.Type.Literal(config_1.ConfigType.CHECKBOX), | ||
value: typebox_1.Type.Boolean(), | ||
}), | ||
typebox_1.Type.Object({ | ||
key: typebox_1.Type.String(), | ||
type: typebox_1.Type.Literal(config_1.ConfigType.SHORT_TEXT), | ||
value: typebox_1.Type.String(), | ||
}), | ||
typebox_1.Type.Object({ | ||
key: typebox_1.Type.String(), | ||
type: typebox_1.Type.Literal(config_1.ConfigType.LONG_TEXT), | ||
value: typebox_1.Type.String(), | ||
}), | ||
typebox_1.Type.Object({ | ||
key: typebox_1.Type.String(), | ||
type: typebox_1.Type.Literal(config_1.ConfigType.NUMBER), | ||
value: typebox_1.Type.Number(), | ||
}), | ||
typebox_1.Type.Object({ | ||
key: typebox_1.Type.String(), | ||
type: typebox_1.Type.Literal(config_1.ConfigType.DICTIONARY), | ||
value: typebox_1.Type.Object({}), | ||
}) | ||
]); | ||
exports.UpdateCollectionRequest = typebox_1.Type.Object({ | ||
configs: typebox_1.Type.Array(exports.ConfigValidation), | ||
displayName: typebox_1.Type.String({}), | ||
}); | ||
//# sourceMappingURL=update-collection-request.js.map |
import { AppConnectionId } from "../app-connection/app-connection"; | ||
import { CollectionId } from "../collections/collection"; | ||
import { CollectionVersionId } from "../collections/collection-version"; | ||
import { FileId } from "../file/file"; | ||
@@ -14,3 +13,3 @@ import { FlowRunId } from "../flow-run/flow-run"; | ||
} | ||
declare type ErrorParams = CollectionNotFoundErrorParams | CollectionVersionNotFoundErrorParams | ConfigNotFoundErrorParams | ExistingUserErrorParams | FileNotFoundErrorParams | FlowNotFoundErrorParams | FlowRunNotFoundErrorParams | FlowVersionNotFoundErrorParams | InstanceNotFoundErrorParams | InvalidBearerTokenParams | InvalidCredentialsErrorParams | JobRemovalFailureErrorParams | PieceNotFoundErrorParams | PieceTriggerNotFoundErrorParams | StepNotFoundErrorParams | AppConnectionNotFoundErrorParams | InvalidClaimParams | InvalidCloudClaimParams | InvalidJwtTokenErrorParams | TaskQuotaExeceededErrorParams | SystemInvalidErrorParams | SystemPropNotDefinedErrorParams; | ||
declare type ErrorParams = CollectionNotFoundErrorParams | ConfigNotFoundErrorParams | ExistingUserErrorParams | FileNotFoundErrorParams | FlowNotFoundErrorParams | FlowRunNotFoundErrorParams | FlowVersionNotFoundErrorParams | InstanceNotFoundErrorParams | InvalidBearerTokenParams | InvalidCredentialsErrorParams | JobRemovalFailureErrorParams | PieceNotFoundErrorParams | PieceTriggerNotFoundErrorParams | StepNotFoundErrorParams | AppConnectionNotFoundErrorParams | InvalidClaimParams | InvalidCloudClaimParams | InvalidJwtTokenErrorParams | TaskQuotaExeceededErrorParams | SystemInvalidErrorParams | SystemPropNotDefinedErrorParams | FlowOperationErrorParams; | ||
export interface BaseErrorParams<T, V> { | ||
@@ -44,5 +43,2 @@ code: T; | ||
}>; | ||
export declare type CollectionVersionNotFoundErrorParams = BaseErrorParams<ErrorCode.COLLECTION_VERSION_NOT_FOUND, { | ||
id: CollectionVersionId; | ||
}>; | ||
export declare type InstanceNotFoundErrorParams = BaseErrorParams<ErrorCode.INSTANCE_NOT_FOUND, { | ||
@@ -90,2 +86,3 @@ id?: InstanceId; | ||
}>; | ||
export declare type FlowOperationErrorParams = BaseErrorParams<ErrorCode.FLOW_OPERATION_INVALID, Record<string, never>>; | ||
export declare type InvalidJwtTokenErrorParams = BaseErrorParams<ErrorCode.INVALID_OR_EXPIRED_JWT_TOKEN, { | ||
@@ -118,5 +115,6 @@ token: string; | ||
INVALID_OR_EXPIRED_JWT_TOKEN = "INVALID_OR_EXPIRED_JWT_TOKEN", | ||
TASK_QUOTA_EXCEEDED = "FLOW_RUN_QUOTA_EXCEEDED", | ||
SYSTEM_PROP_INVALID = "SYSTEM_PROP_INVALID" | ||
TASK_QUOTA_EXCEEDED = "TASK_QUOTA_EXCEEDED", | ||
SYSTEM_PROP_INVALID = "SYSTEM_PROP_INVALID", | ||
FLOW_OPERATION_INVALID = "FLOW_OPERATION_INVALID" | ||
} | ||
export {}; |
@@ -33,5 +33,6 @@ "use strict"; | ||
ErrorCode["INVALID_OR_EXPIRED_JWT_TOKEN"] = "INVALID_OR_EXPIRED_JWT_TOKEN"; | ||
ErrorCode["TASK_QUOTA_EXCEEDED"] = "FLOW_RUN_QUOTA_EXCEEDED"; | ||
ErrorCode["TASK_QUOTA_EXCEEDED"] = "TASK_QUOTA_EXCEEDED"; | ||
ErrorCode["SYSTEM_PROP_INVALID"] = "SYSTEM_PROP_INVALID"; | ||
ErrorCode["FLOW_OPERATION_INVALID"] = "FLOW_OPERATION_INVALID"; | ||
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {})); | ||
//# sourceMappingURL=activepieces-error.js.map |
import { CollectionId } from "../collections/collection"; | ||
import { CollectionVersion, CollectionVersionId } from "../collections/collection-version"; | ||
import { FlowVersion, FlowVersionId } from "../flows/flow-version"; | ||
@@ -8,3 +7,4 @@ import { ProjectId } from "../project/project"; | ||
EXECUTE_PROPERTY = "EXECUTE_PROPERTY", | ||
EXECUTE_TRIGGER_HOOK = "EXECUTE_TRIGGER_HOOK" | ||
EXECUTE_TRIGGER_HOOK = "EXECUTE_TRIGGER_HOOK", | ||
EXTRACT_EVENT_DATA = "EXTRACT_EVENT_DATA" | ||
} | ||
@@ -16,3 +16,7 @@ export declare enum TriggerHookType { | ||
} | ||
export declare type EngineOperation = ExecuteFlowOperation | ExecutePropsOptions | ExecuteTriggerOperation; | ||
export declare type EngineOperation = ExecuteFlowOperation | ExecutePropsOptions | ExecuteTriggerOperation | ExecuteEventParserOperation; | ||
export interface ExecuteEventParserOperation { | ||
pieceName: string; | ||
event: EventPayload; | ||
} | ||
export interface ExecutePropsOptions { | ||
@@ -24,4 +28,4 @@ pieceName: string; | ||
input: Record<string, any>; | ||
collectionVersion: CollectionVersion; | ||
projectId: ProjectId; | ||
collectionId: CollectionId; | ||
apiUrl?: string; | ||
@@ -33,3 +37,2 @@ workerToken?: string; | ||
collectionId: CollectionId; | ||
collectionVersionId: CollectionVersionId; | ||
projectId: ProjectId; | ||
@@ -44,7 +47,31 @@ triggerPayload: unknown; | ||
webhookUrl: string; | ||
collectionVersion: CollectionVersion; | ||
triggerPayload?: unknown; | ||
projectId: ProjectId; | ||
collectionId: CollectionId; | ||
workerToken?: string; | ||
apiUrl?: string; | ||
edition?: string; | ||
webhookSecret?: string; | ||
} | ||
export interface EventPayload { | ||
body: any; | ||
rawBody?: any; | ||
method: string; | ||
headers: Record<string, string>; | ||
queryParams: Record<string, string>; | ||
} | ||
export declare type ParseEventResponse = { | ||
event?: string; | ||
identifierValue?: string; | ||
reply?: { | ||
headers: Record<string, string>; | ||
body: unknown; | ||
}; | ||
}; | ||
export interface AppEventListener { | ||
events: string[]; | ||
identifierValue: string; | ||
} | ||
export interface ExecuteTriggerResponse { | ||
listeners: AppEventListener[]; | ||
} |
@@ -9,2 +9,3 @@ "use strict"; | ||
EngineOperationType["EXECUTE_TRIGGER_HOOK"] = "EXECUTE_TRIGGER_HOOK"; | ||
EngineOperationType["EXTRACT_EVENT_DATA"] = "EXTRACT_EVENT_DATA"; | ||
})(EngineOperationType = exports.EngineOperationType || (exports.EngineOperationType = {})); | ||
@@ -17,2 +18,3 @@ var TriggerHookType; | ||
})(TriggerHookType = exports.TriggerHookType || (exports.TriggerHookType = {})); | ||
; | ||
//# sourceMappingURL=engine-operation.js.map |
import { Static } from '@sinclair/typebox'; | ||
export declare const CreateFlowRunRequest: import("@sinclair/typebox").TObject<{ | ||
flowVersionId: import("@sinclair/typebox").TString<string>; | ||
collectionVersionId: import("@sinclair/typebox").TString<string>; | ||
payload: import("@sinclair/typebox").TAny; | ||
collectionId: import("@sinclair/typebox").TString<string>; | ||
}>; | ||
export declare type CreateFlowRunRequest = Static<typeof CreateFlowRunRequest>; |
@@ -7,5 +7,6 @@ "use strict"; | ||
flowVersionId: typebox_1.Type.String(), | ||
collectionVersionId: typebox_1.Type.String(), | ||
payload: typebox_1.Type.Any(), | ||
// THIS IS CHANGED | ||
collectionId: typebox_1.Type.String(), | ||
}); | ||
//# sourceMappingURL=create-flow-run-request.js.map |
@@ -1,2 +0,1 @@ | ||
import { CollectionVersion } from '../../collections/collection-version'; | ||
import { StepOutput } from './step-output'; | ||
@@ -8,3 +7,2 @@ export declare class ExecutionState { | ||
constructor(); | ||
insertConfigs(collectionVersion: CollectionVersion): void; | ||
insertStep(stepOutput: StepOutput, actionName: string, ancestors: [string, number][]): void; | ||
@@ -11,0 +9,0 @@ updateLastStep(outputOnly: any, actionName: string): void; |
@@ -11,20 +11,2 @@ "use strict"; | ||
} | ||
insertConfigs(collectionVersion) { | ||
let configs = new Map(collectionVersion.configs.map((config) => { | ||
return [config.key, config.value]; | ||
})); | ||
if (configs instanceof Map) { | ||
configs.forEach((value, key) => { | ||
this.configs[key] = value; | ||
}); | ||
} | ||
else if (typeof configs === 'object' && !Array.isArray(configs)) { | ||
Object.entries(configs).forEach(([key, value]) => { | ||
this.configs[key] = value; | ||
}); | ||
} | ||
else { | ||
throw Error(`Invalid configs type: ${typeof configs}`); | ||
} | ||
} | ||
insertStep(stepOutput, actionName, ancestors) { | ||
@@ -31,0 +13,0 @@ const targetMap = this.getTargetMap(ancestors); |
@@ -6,6 +6,6 @@ export declare enum StepOutputStatus { | ||
} | ||
export declare class StepOutput { | ||
export declare class StepOutput<T = any> { | ||
duration?: number; | ||
input?: unknown; | ||
output?: any; | ||
output?: T; | ||
errorMessage?: unknown; | ||
@@ -15,8 +15,12 @@ standardOutput?: unknown; | ||
} | ||
export declare class LoopOnItemsStepOutput extends StepOutput { | ||
export declare class LoopOnItemsStepOutput extends StepOutput<{ | ||
current_item: any; | ||
current_iteration: number; | ||
iterations: Record<string, StepOutput>[]; | ||
}> { | ||
} | ||
export declare class BranchStepOutput extends StepOutput { | ||
output: { | ||
current_item: any; | ||
current_iteration: number; | ||
iterations: Record<string, StepOutput>[]; | ||
condition: boolean; | ||
}; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LoopOnItemsStepOutput = exports.StepOutput = exports.StepOutputStatus = void 0; | ||
exports.BranchStepOutput = exports.LoopOnItemsStepOutput = exports.StepOutput = exports.StepOutputStatus = void 0; | ||
var StepOutputStatus; | ||
@@ -16,2 +16,5 @@ (function (StepOutputStatus) { | ||
exports.LoopOnItemsStepOutput = LoopOnItemsStepOutput; | ||
class BranchStepOutput extends StepOutput { | ||
} | ||
exports.BranchStepOutput = BranchStepOutput; | ||
//# sourceMappingURL=step-output.js.map |
@@ -5,3 +5,2 @@ import { BaseModel } from '../common/base-model'; | ||
import { FileId } from '../file/file'; | ||
import { CollectionVersionId } from '../collections/collection-version'; | ||
import { CollectionId } from '../collections/collection'; | ||
@@ -18,3 +17,2 @@ import { ApId } from '../common/id-generator'; | ||
flowVersionId: FlowVersionId; | ||
collectionVersionId: CollectionVersionId; | ||
flowDisplayName: string; | ||
@@ -21,0 +19,0 @@ collectionDisplayName: string; |
@@ -5,3 +5,4 @@ import { Static } from '@sinclair/typebox'; | ||
PIECE = "PIECE", | ||
LOOP_ON_ITEMS = "LOOP_ON_ITEMS" | ||
LOOP_ON_ITEMS = "LOOP_ON_ITEMS", | ||
BRANCH = "BRANCH" | ||
} | ||
@@ -15,3 +16,3 @@ export declare const CodeActionSettings: import("@sinclair/typebox").TObject<{ | ||
export declare type CodeActionSettings = Static<typeof CodeActionSettings>; | ||
export declare const CodeAction: import("@sinclair/typebox").TObject<{ | ||
export declare const CodeActionSchema: import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.CODE>; | ||
@@ -27,5 +28,3 @@ settings: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>; | ||
export declare type CodeAction = Static<typeof CodeAction>; | ||
export declare const PieceActionSettings: import("@sinclair/typebox").TObject<{ | ||
@@ -39,3 +38,3 @@ pieceName: import("@sinclair/typebox").TString<string>; | ||
export declare type PieceActionSettings = Static<typeof PieceActionSettings>; | ||
export declare const PieceAction: import("@sinclair/typebox").TObject<{ | ||
export declare const PieceActionSchema: import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.PIECE>; | ||
@@ -52,5 +51,3 @@ settings: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>; | ||
export declare type PieceAction = Static<typeof PieceAction>; | ||
export declare enum StoreOperation { | ||
@@ -63,3 +60,3 @@ PUT = "PUT", | ||
}; | ||
export declare const LoopOnItemsAction: import("@sinclair/typebox").TObject<{ | ||
export declare const LoopOnItemsActionSchema: import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.LOOP_ON_ITEMS>; | ||
@@ -69,12 +66,52 @@ settings: import("@sinclair/typebox").TObject<{ | ||
}>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>; | ||
export declare type LoopOnItemsAction = Static<typeof LoopOnItemsAction> & { | ||
firstLoopAction?: Action; | ||
export declare enum BranchOperator { | ||
TEXT_CONTAINS = "TEXT_CONTAINS", | ||
TEXT_DOES_NOT_CONTAIN = "TEXT_DOES_NOT_CONTAIN", | ||
TEXT_EXACTLY_MATCHES = "TEXT_EXACTLY_MATCHES", | ||
TEXT_DOES_NOT_EXACTLY_MATCH = "TEXT_DOES_NOT_EXACTLY_MATCH", | ||
TEXT_STARTS_WITH = "TEXT_START_WITH", | ||
TEXT_DOES_NOT_START_WITH = "TEXT_DOES_NOT_START_WITH", | ||
TEXT_ENDS_WITH = "TEXT_ENDS_WITH", | ||
TEXT_DOES_NOT_END_WITH = "TEXT_DOES_NOT_END_WITH", | ||
NUMBER_IS_GREATER_THAN = "NUMBER_IS_GREATER_THAN", | ||
NUMBER_IS_LESS_THAN = "NUMBER_IS_LESS_THAN", | ||
BOOLEAN_IS_TRUE = "BOOLEAN_IS_TRUE", | ||
BOOLEAN_IS_FALSE = "BOOLEAN_IS_FALSE", | ||
EXISTS = "EXISTS", | ||
DOES_NOT_EXIST = "DOES_NOT_EXIST" | ||
} | ||
export declare const singleValueConditions: BranchOperator[]; | ||
export declare const BranchCondition: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<BranchOperator>[]>>; | ||
}>]>; | ||
export declare type BranchCondition = Static<typeof BranchCondition>; | ||
export declare type BranchActionSettings = { | ||
conditions: BranchCondition[][]; | ||
}; | ||
export declare const Action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
export declare const BranchActionSchema: import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.BRANCH>; | ||
settings: import("@sinclair/typebox").TObject<{ | ||
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<BranchOperator>[]>>; | ||
}>]>>>; | ||
}>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>; | ||
export declare const Action: import("@sinclair/typebox").TRecursive<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.CODE>; | ||
@@ -90,4 +127,5 @@ settings: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
}>]>, import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.PIECE>; | ||
@@ -104,4 +142,5 @@ settings: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
}>]>, import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.LOOP_ON_ITEMS>; | ||
@@ -111,10 +150,43 @@ settings: import("@sinclair/typebox").TObject<{ | ||
}>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>]>; | ||
export declare type Action = Static<typeof Action> & { | ||
}>, import("@sinclair/typebox").TObject<{ | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
}>]>, import("@sinclair/typebox").TIntersect<[import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<ActionType.BRANCH>; | ||
settings: import("@sinclair/typebox").TObject<{ | ||
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<BranchOperator>[]>>; | ||
}>]>>>; | ||
}>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
onSuccessAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
onFailureAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TSelf>; | ||
}>]>]>>; | ||
export declare type Action = Static<typeof Action>; | ||
export declare type BranchAction = Static<typeof BranchActionSchema> & { | ||
nextAction?: Action; | ||
onFailureAction?: Action; | ||
onSuccessAction?: Action; | ||
}; | ||
export declare type LoopOnItemsAction = Static<typeof LoopOnItemsActionSchema> & { | ||
nextAction?: Action; | ||
firstLoopAction?: Action; | ||
}; | ||
export declare type PieceAction = Static<typeof PieceActionSchema> & { | ||
nextAction?: Action; | ||
}; | ||
export declare type CodeAction = Static<typeof CodeActionSchema> & { | ||
nextAction?: Action; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Action = exports.LoopOnItemsAction = exports.StoreOperation = exports.PieceAction = exports.PieceActionSettings = exports.CodeAction = exports.CodeActionSettings = exports.ActionType = void 0; | ||
exports.Action = exports.BranchActionSchema = exports.BranchCondition = exports.singleValueConditions = exports.BranchOperator = exports.LoopOnItemsActionSchema = exports.StoreOperation = exports.PieceActionSchema = exports.PieceActionSettings = exports.CodeActionSchema = exports.CodeActionSettings = exports.ActionType = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
@@ -11,2 +11,3 @@ const pieces_1 = require("../../pieces"); | ||
ActionType["LOOP_ON_ITEMS"] = "LOOP_ON_ITEMS"; | ||
ActionType["BRANCH"] = "BRANCH"; | ||
})(ActionType = exports.ActionType || (exports.ActionType = {})); | ||
@@ -17,3 +18,2 @@ const commonActionProps = { | ||
displayName: typebox_1.Type.String({}), | ||
nextAction: typebox_1.Type.Optional(typebox_1.Type.Any({})) | ||
}; | ||
@@ -27,3 +27,3 @@ // Code Action | ||
}); | ||
exports.CodeAction = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.CODE), settings: exports.CodeActionSettings })); | ||
exports.CodeActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.CODE), settings: exports.CodeActionSettings })); | ||
// Piece Action | ||
@@ -37,3 +37,3 @@ exports.PieceActionSettings = typebox_1.Type.Object({ | ||
}); | ||
exports.PieceAction = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.PIECE), settings: exports.PieceActionSettings })); | ||
exports.PieceActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.PIECE), settings: exports.PieceActionSettings })); | ||
// Storage Action | ||
@@ -45,11 +45,67 @@ var StoreOperation; | ||
})(StoreOperation = exports.StoreOperation || (exports.StoreOperation = {})); | ||
exports.LoopOnItemsAction = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.LOOP_ON_ITEMS), settings: typebox_1.Type.Object({ | ||
exports.LoopOnItemsActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.LOOP_ON_ITEMS), settings: typebox_1.Type.Object({ | ||
items: typebox_1.Type.Array(typebox_1.Type.Any({})), | ||
}), firstLoopAction: typebox_1.Type.Optional(typebox_1.Type.Any({})) })); | ||
}) })); | ||
// Loop Items | ||
var BranchOperator; | ||
(function (BranchOperator) { | ||
BranchOperator["TEXT_CONTAINS"] = "TEXT_CONTAINS"; | ||
BranchOperator["TEXT_DOES_NOT_CONTAIN"] = "TEXT_DOES_NOT_CONTAIN"; | ||
BranchOperator["TEXT_EXACTLY_MATCHES"] = "TEXT_EXACTLY_MATCHES"; | ||
BranchOperator["TEXT_DOES_NOT_EXACTLY_MATCH"] = "TEXT_DOES_NOT_EXACTLY_MATCH"; | ||
BranchOperator["TEXT_STARTS_WITH"] = "TEXT_START_WITH"; | ||
BranchOperator["TEXT_DOES_NOT_START_WITH"] = "TEXT_DOES_NOT_START_WITH"; | ||
BranchOperator["TEXT_ENDS_WITH"] = "TEXT_ENDS_WITH"; | ||
BranchOperator["TEXT_DOES_NOT_END_WITH"] = "TEXT_DOES_NOT_END_WITH"; | ||
BranchOperator["NUMBER_IS_GREATER_THAN"] = "NUMBER_IS_GREATER_THAN"; | ||
BranchOperator["NUMBER_IS_LESS_THAN"] = "NUMBER_IS_LESS_THAN"; | ||
BranchOperator["BOOLEAN_IS_TRUE"] = "BOOLEAN_IS_TRUE"; | ||
BranchOperator["BOOLEAN_IS_FALSE"] = "BOOLEAN_IS_FALSE"; | ||
BranchOperator["EXISTS"] = "EXISTS"; | ||
BranchOperator["DOES_NOT_EXIST"] = "DOES_NOT_EXIST"; | ||
})(BranchOperator = exports.BranchOperator || (exports.BranchOperator = {})); | ||
exports.singleValueConditions = [ | ||
BranchOperator.EXISTS, | ||
BranchOperator.DOES_NOT_EXIST, | ||
BranchOperator.BOOLEAN_IS_TRUE, | ||
BranchOperator.BOOLEAN_IS_FALSE | ||
]; | ||
exports.BranchCondition = typebox_1.Type.Union([ | ||
typebox_1.Type.Object({ | ||
firstValue: typebox_1.Type.String({}), | ||
secondValue: typebox_1.Type.String({}), | ||
operator: typebox_1.Type.Optional(typebox_1.Type.Union([...Object.values(BranchOperator). | ||
filter(c => exports.singleValueConditions.find(sc => sc === c) === undefined).map(c => { | ||
return typebox_1.Type.Literal(c); | ||
})])) | ||
}), | ||
typebox_1.Type.Object({ | ||
firstValue: typebox_1.Type.String({}), | ||
operator: typebox_1.Type.Optional(typebox_1.Type.Union([...Object.values(BranchOperator). | ||
filter(c => exports.singleValueConditions.find(sc => sc === c) !== undefined).map(c => { | ||
return typebox_1.Type.Literal(c); | ||
})])) | ||
}) | ||
]); | ||
exports.BranchActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.BRANCH), settings: typebox_1.Type.Object({ | ||
conditions: typebox_1.Type.Array(typebox_1.Type.Array(exports.BranchCondition)), | ||
}) })); | ||
// Union of all actions | ||
exports.Action = typebox_1.Type.Union([ | ||
exports.CodeAction, | ||
exports.PieceAction, | ||
exports.LoopOnItemsAction | ||
]); | ||
exports.Action = typebox_1.Type.Recursive(action => typebox_1.Type.Union([ | ||
typebox_1.Type.Intersect([exports.CodeActionSchema, typebox_1.Type.Object({ | ||
nextAction: typebox_1.Type.Optional(action), | ||
})]), | ||
typebox_1.Type.Intersect([exports.PieceActionSchema, typebox_1.Type.Object({ | ||
nextAction: typebox_1.Type.Optional(action), | ||
})]), | ||
typebox_1.Type.Intersect([exports.LoopOnItemsActionSchema, typebox_1.Type.Object({ | ||
nextAction: typebox_1.Type.Optional(action), | ||
firstLoopAction: typebox_1.Type.Optional(action) | ||
})]), | ||
typebox_1.Type.Intersect([exports.BranchActionSchema, typebox_1.Type.Object({ | ||
nextAction: typebox_1.Type.Optional(action), | ||
onSuccessAction: typebox_1.Type.Optional(action), | ||
onFailureAction: typebox_1.Type.Optional(action) | ||
})]) | ||
])); | ||
//# sourceMappingURL=action.js.map |
@@ -6,3 +6,4 @@ import { FlowOperationRequest } from './flow-operations'; | ||
declare function isValid(flowVersion: FlowVersion): boolean; | ||
export declare function getStep(flowVersion: FlowVersion, stepName: string): Action | Trigger | undefined; | ||
declare function getAllSteps(flowVersion: FlowVersion): (Action | Trigger)[]; | ||
declare function getStep(flowVersion: FlowVersion, stepName: string): Action | Trigger | undefined; | ||
export declare const flowHelper: { | ||
@@ -12,4 +13,5 @@ isValid: typeof isValid; | ||
getStep: typeof getStep; | ||
getAllSteps: typeof getAllSteps; | ||
clone: (flowVersion: FlowVersion) => FlowVersion; | ||
}; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.flowHelper = exports.getStep = void 0; | ||
exports.flowHelper = void 0; | ||
const flow_operations_1 = require("./flow-operations"); | ||
@@ -8,2 +8,3 @@ const action_1 = require("./actions/action"); | ||
const compiler_1 = require("@sinclair/typebox/compiler"); | ||
const activepieces_error_1 = require("../common/activepieces-error"); | ||
const actionSchemaValidator = compiler_1.TypeCompiler.Compile(action_1.Action); | ||
@@ -21,40 +22,115 @@ const triggerSchemaValidation = compiler_1.TypeCompiler.Compile(trigger_1.Trigger); | ||
function deleteAction(flowVersion, request) { | ||
let parentStep = flowVersion.trigger; | ||
while (parentStep.nextAction !== undefined && | ||
parentStep.nextAction.name !== request.name) { | ||
parentStep = parentStep.nextAction; | ||
const steps = getAllSteps(flowVersion); | ||
let deleted = false; | ||
for (let i = 0; i < steps.length; i++) { | ||
const parentStep = steps[i]; | ||
if (parentStep.nextAction && parentStep.nextAction.name === request.name) { | ||
const stepToUpdate = parentStep.nextAction; | ||
parentStep.nextAction = stepToUpdate.nextAction; | ||
deleted = true; | ||
} | ||
if (parentStep.type === action_1.ActionType.BRANCH) { | ||
if (parentStep.onFailureAction && parentStep.onFailureAction.name === request.name) { | ||
const stepToUpdate = parentStep.onFailureAction; | ||
parentStep.onFailureAction = stepToUpdate.nextAction; | ||
deleted = true; | ||
} | ||
if (parentStep.onSuccessAction && parentStep.onSuccessAction.name === request.name) { | ||
const stepToUpdate = parentStep.onSuccessAction; | ||
parentStep.onSuccessAction = stepToUpdate.nextAction; | ||
deleted = true; | ||
} | ||
} | ||
} | ||
if (parentStep.nextAction !== undefined) { | ||
const stepToUpdate = parentStep.nextAction; | ||
parentStep.nextAction = stepToUpdate.nextAction; | ||
if (!deleted) { | ||
throw new activepieces_error_1.ActivepiecesError({ | ||
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID, | ||
params: {} | ||
}, `Action ${request.name} not found`); | ||
} | ||
} | ||
function getStep(flowVersion, stepName) { | ||
let currentStep = flowVersion.trigger; | ||
while (currentStep !== undefined && currentStep.name !== stepName) { | ||
currentStep = currentStep.nextAction; | ||
function traverseFlowInternal(step) { | ||
const steps = []; | ||
while (step !== undefined && step !== null) { | ||
steps.push(step); | ||
if (step.type === action_1.ActionType.BRANCH) { | ||
steps.push(...traverseFlowInternal(step.onFailureAction)); | ||
steps.push(...traverseFlowInternal(step.onSuccessAction)); | ||
} | ||
step = step.nextAction; | ||
} | ||
return currentStep; | ||
return steps; | ||
} | ||
exports.getStep = getStep; | ||
function getAllSteps(flowVersion) { | ||
return traverseFlowInternal(flowVersion.trigger); | ||
} | ||
function getStep(flowVersion, stepName) { | ||
return getAllSteps(flowVersion).find((step) => step.name === stepName); | ||
} | ||
function updateAction(flowVersion, request) { | ||
let parentStep = flowVersion.trigger; | ||
while (parentStep.nextAction !== undefined && | ||
parentStep.nextAction.name !== request.name) { | ||
parentStep = parentStep.nextAction; | ||
const steps = getAllSteps(flowVersion); | ||
let updated = false; | ||
for (let i = 0; i < steps.length; i++) { | ||
const parentStep = steps[i]; | ||
if (parentStep.nextAction && parentStep.nextAction.name === request.name) { | ||
const { nextAction, onSuccessAction, onFailureAction } = extractActions(parentStep.nextAction); | ||
parentStep.nextAction = createAction(request, nextAction, onFailureAction, onSuccessAction); | ||
updated = true; | ||
} | ||
if (parentStep.type === action_1.ActionType.BRANCH) { | ||
if (parentStep.onFailureAction && parentStep.onFailureAction.name === request.name) { | ||
const { nextAction, onSuccessAction, onFailureAction } = extractActions(parentStep.onFailureAction); | ||
parentStep.onFailureAction = createAction(request, nextAction, onFailureAction, onSuccessAction); | ||
updated = true; | ||
} | ||
if (parentStep.onSuccessAction && parentStep.onSuccessAction.name === request.name) { | ||
const { nextAction, onSuccessAction, onFailureAction } = extractActions(parentStep.onSuccessAction); | ||
parentStep.onSuccessAction = createAction(request, nextAction, onFailureAction, onSuccessAction); | ||
updated = true; | ||
} | ||
} | ||
} | ||
if (parentStep.nextAction !== undefined) { | ||
const stepToUpdate = parentStep.nextAction; | ||
parentStep.nextAction = createAction(request, stepToUpdate.nextAction); | ||
if (!updated) { | ||
throw new activepieces_error_1.ActivepiecesError({ | ||
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID, | ||
params: {} | ||
}, `Action ${request.name} not found`); | ||
} | ||
} | ||
function extractActions(step) { | ||
const nextAction = step.nextAction; | ||
const onSuccessAction = step.type === action_1.ActionType.BRANCH ? step.onSuccessAction : undefined; | ||
const onFailureAction = step.type === action_1.ActionType.BRANCH ? step.onFailureAction : undefined; | ||
return { nextAction, onSuccessAction, onFailureAction }; | ||
} | ||
function addAction(flowVersion, request) { | ||
let currentStep = flowVersion.trigger; | ||
while ((currentStep === null || currentStep === void 0 ? void 0 : currentStep.nextAction) !== undefined && | ||
currentStep.name !== request.parentAction) { | ||
currentStep = currentStep.nextAction; | ||
const parentStep = getAllSteps(flowVersion).find(step => step.name === request.parentStep); | ||
if (parentStep === undefined) { | ||
throw new activepieces_error_1.ActivepiecesError({ | ||
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID, | ||
params: {} | ||
}, `Parent step ${request.parentStep} not found`); | ||
} | ||
currentStep.nextAction = createAction(request.action, currentStep.nextAction); | ||
if (parentStep.type === action_1.ActionType.BRANCH && request.stepLocationRelativeToParent !== undefined && request.stepLocationRelativeToParent !== null) { | ||
if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.INSIDE_TRUE_BRANCH) { | ||
parentStep.onSuccessAction = createAction(request.action, parentStep.onSuccessAction); | ||
} | ||
else if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.INSIDE_FALSE_BRANCH) { | ||
parentStep.onFailureAction = createAction(request.action, parentStep.onFailureAction); | ||
} | ||
else if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.AFTER) { | ||
parentStep.nextAction = createAction(request.action, parentStep.nextAction); | ||
} | ||
else { | ||
throw new activepieces_error_1.ActivepiecesError({ | ||
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID, | ||
params: {} | ||
}, `Branch ${request.stepLocationRelativeToParent} not found`); | ||
} | ||
} | ||
else { | ||
parentStep.nextAction = createAction(request.action, parentStep.nextAction); | ||
} | ||
} | ||
function createAction(request, nextAction) { | ||
function createAction(request, nextAction, onFailureAction, onSuccessAction) { | ||
var _a; | ||
@@ -69,4 +145,10 @@ const baseProperties = { | ||
switch (request.type) { | ||
case action_1.ActionType.BRANCH: | ||
action = Object.assign(Object.assign({}, baseProperties), { onFailureAction: onFailureAction, onSuccessAction: onSuccessAction, type: action_1.ActionType.BRANCH, settings: request.settings }); | ||
break; | ||
case action_1.ActionType.LOOP_ON_ITEMS: | ||
action = Object.assign(Object.assign({}, baseProperties), { type: action_1.ActionType.LOOP_ON_ITEMS, settings: request.settings }); | ||
action = Object.assign(Object.assign({}, baseProperties), { | ||
// Required to do when loops is supported | ||
// firstLoopAction: request.firstLoopAction, | ||
type: action_1.ActionType.LOOP_ON_ITEMS, settings: request.settings }); | ||
break; | ||
@@ -137,2 +219,3 @@ case action_1.ActionType.PIECE: | ||
getStep: getStep, | ||
getAllSteps: getAllSteps, | ||
clone: (flowVersion) => { | ||
@@ -139,0 +222,0 @@ return JSON.parse(JSON.stringify(flowVersion)); |
import { Static } from "@sinclair/typebox"; | ||
export declare enum FlowOperationType { | ||
CHANGE_NAME = "CHANGE_NAME", | ||
IMPORT_FLOW = "IMPORT_FLOW", | ||
UPDATE_TRIGGER = "UPDATE_TRIGGER", | ||
ADD_ACTION = "ADD_ACTION", | ||
UPDATE_ACTION = "UPDATE_ACTION", | ||
DELETE_ACTION = "DELETE_ACTION", | ||
IMPORT_FLOW = "IMPORT_FLOW" | ||
DELETE_ACTION = "DELETE_ACTION" | ||
} | ||
export declare const ImportFlowRequest: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
trigger: import("@sinclair/typebox").TAny; | ||
}>; | ||
export declare type ImportFlowRequest = Static<typeof ImportFlowRequest>; | ||
export declare enum StepLocationRelativeToParent { | ||
INSIDE_TRUE_BRANCH = "INSIDE_TRUE_BRANCH", | ||
INSIDE_FALSE_BRANCH = "INSIDE_FALSE_BRANCH", | ||
AFTER = "AFTER", | ||
INSIDE_LOOP = "INSIDE_LOOP" | ||
} | ||
export declare const ChangeNameRequest: import("@sinclair/typebox").TObject<{ | ||
@@ -34,3 +35,2 @@ displayName: import("@sinclair/typebox").TString<string>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -41,7 +41,5 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.LOOP_ON_ITEMS>; | ||
}>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -59,7 +57,22 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.PIECE>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.BRANCH>; | ||
settings: import("@sinclair/typebox").TObject<{ | ||
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>]>>>; | ||
}>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>]>; | ||
export declare type UpdateActionRequest = Static<typeof UpdateActionRequest>; | ||
export declare const AddActionRequest: import("@sinclair/typebox").TObject<{ | ||
parentAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>; | ||
parentStep: import("@sinclair/typebox").TString<string>; | ||
stepLocationRelativeToParent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof StepLocationRelativeToParent>>; | ||
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
@@ -76,3 +89,2 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.CODE>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -83,7 +95,5 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.LOOP_ON_ITEMS>; | ||
}>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -101,3 +111,17 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.PIECE>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.BRANCH>; | ||
settings: import("@sinclair/typebox").TObject<{ | ||
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>]>>>; | ||
}>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>]>; | ||
@@ -155,8 +179,2 @@ }>; | ||
export declare const FlowOperationRequest: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<FlowOperationType.IMPORT_FLOW>; | ||
request: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
trigger: import("@sinclair/typebox").TAny; | ||
}>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<FlowOperationType.CHANGE_NAME>; | ||
@@ -184,3 +202,2 @@ request: import("@sinclair/typebox").TObject<{ | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -191,7 +208,5 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.LOOP_ON_ITEMS>; | ||
}>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -209,3 +224,17 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.PIECE>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.BRANCH>; | ||
settings: import("@sinclair/typebox").TObject<{ | ||
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>]>>>; | ||
}>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>]>; | ||
@@ -215,3 +244,4 @@ }>, import("@sinclair/typebox").TObject<{ | ||
request: import("@sinclair/typebox").TObject<{ | ||
parentAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString<string>>; | ||
parentStep: import("@sinclair/typebox").TString<string>; | ||
stepLocationRelativeToParent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<typeof StepLocationRelativeToParent>>; | ||
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
@@ -228,3 +258,2 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.CODE>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -235,7 +264,5 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.LOOP_ON_ITEMS>; | ||
}>; | ||
firstLoopAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
@@ -253,3 +280,17 @@ type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.PIECE>; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
type: import("@sinclair/typebox").TLiteral<import("./actions/action").ActionType.BRANCH>; | ||
settings: import("@sinclair/typebox").TObject<{ | ||
conditions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
secondValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>, import("@sinclair/typebox").TObject<{ | ||
firstValue: import("@sinclair/typebox").TString<string>; | ||
operator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<import("./actions/action").BranchOperator>[]>>; | ||
}>]>>>; | ||
}>; | ||
name: import("@sinclair/typebox").TString<string>; | ||
valid: import("@sinclair/typebox").TBoolean; | ||
displayName: import("@sinclair/typebox").TString<string>; | ||
}>]>; | ||
@@ -256,0 +297,0 @@ }>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FlowOperationRequest = exports.UpdateTriggerRequest = exports.UpdateScheduleTrigger = exports.AddActionRequest = exports.UpdateActionRequest = exports.DeleteActionRequest = exports.ChangeNameRequest = exports.ImportFlowRequest = exports.FlowOperationType = void 0; | ||
exports.FlowOperationRequest = exports.UpdateTriggerRequest = exports.UpdateScheduleTrigger = exports.AddActionRequest = exports.UpdateActionRequest = exports.DeleteActionRequest = exports.ChangeNameRequest = exports.StepLocationRelativeToParent = exports.FlowOperationType = void 0; | ||
const action_1 = require("./actions/action"); | ||
@@ -10,2 +10,3 @@ const trigger_1 = require("./triggers/trigger"); | ||
FlowOperationType["CHANGE_NAME"] = "CHANGE_NAME"; | ||
FlowOperationType["IMPORT_FLOW"] = "IMPORT_FLOW"; | ||
FlowOperationType["UPDATE_TRIGGER"] = "UPDATE_TRIGGER"; | ||
@@ -15,8 +16,10 @@ FlowOperationType["ADD_ACTION"] = "ADD_ACTION"; | ||
FlowOperationType["DELETE_ACTION"] = "DELETE_ACTION"; | ||
FlowOperationType["IMPORT_FLOW"] = "IMPORT_FLOW"; | ||
})(FlowOperationType = exports.FlowOperationType || (exports.FlowOperationType = {})); | ||
exports.ImportFlowRequest = typebox_1.Type.Object({ | ||
displayName: typebox_1.Type.String({}), | ||
trigger: typebox_1.Type.Any({}), | ||
}); | ||
var StepLocationRelativeToParent; | ||
(function (StepLocationRelativeToParent) { | ||
StepLocationRelativeToParent["INSIDE_TRUE_BRANCH"] = "INSIDE_TRUE_BRANCH"; | ||
StepLocationRelativeToParent["INSIDE_FALSE_BRANCH"] = "INSIDE_FALSE_BRANCH"; | ||
StepLocationRelativeToParent["AFTER"] = "AFTER"; | ||
StepLocationRelativeToParent["INSIDE_LOOP"] = "INSIDE_LOOP"; | ||
})(StepLocationRelativeToParent = exports.StepLocationRelativeToParent || (exports.StepLocationRelativeToParent = {})); | ||
exports.ChangeNameRequest = typebox_1.Type.Object({ | ||
@@ -28,5 +31,6 @@ displayName: typebox_1.Type.String({}), | ||
}); | ||
exports.UpdateActionRequest = typebox_1.Type.Union([action_1.CodeAction, action_1.LoopOnItemsAction, action_1.PieceAction]); | ||
exports.UpdateActionRequest = typebox_1.Type.Union([action_1.CodeActionSchema, action_1.LoopOnItemsActionSchema, action_1.PieceActionSchema, action_1.BranchActionSchema]); | ||
exports.AddActionRequest = typebox_1.Type.Object({ | ||
parentAction: typebox_1.Type.Optional(typebox_1.Type.String()), | ||
parentStep: typebox_1.Type.String(), | ||
stepLocationRelativeToParent: typebox_1.Type.Optional(typebox_1.Type.Enum(StepLocationRelativeToParent)), | ||
action: exports.UpdateActionRequest | ||
@@ -40,6 +44,2 @@ }); | ||
typebox_1.Type.Object({ | ||
type: typebox_1.Type.Literal(FlowOperationType.IMPORT_FLOW), | ||
request: exports.ImportFlowRequest | ||
}), | ||
typebox_1.Type.Object({ | ||
type: typebox_1.Type.Literal(FlowOperationType.CHANGE_NAME), | ||
@@ -46,0 +46,0 @@ request: exports.ChangeNameRequest |
import { Static } from '@sinclair/typebox'; | ||
import { Action } from '../actions/action'; | ||
export declare enum TriggerStrategy { | ||
POLLING = "POLLING", | ||
WEBHOOK = "WEBHOOK", | ||
APP_WEBHOOK = "APP_WEBHOOK" | ||
} | ||
export declare enum TriggerType { | ||
@@ -99,4 +103,2 @@ SCHEDULE = "SCHEDULE", | ||
}>]>; | ||
export declare type Trigger = Static<typeof Trigger> & { | ||
nextAction?: Action; | ||
}; | ||
export declare type Trigger = Static<typeof Trigger>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Trigger = exports.PieceTrigger = exports.PieceTriggerSettings = exports.ScheduleTrigger = exports.ScheduleTriggerSettings = exports.WebhookTrigger = exports.EmptyTrigger = exports.TriggerType = void 0; | ||
exports.Trigger = exports.PieceTrigger = exports.PieceTriggerSettings = exports.ScheduleTrigger = exports.ScheduleTriggerSettings = exports.WebhookTrigger = exports.EmptyTrigger = exports.TriggerType = exports.TriggerStrategy = void 0; | ||
const typebox_1 = require("@sinclair/typebox"); | ||
@@ -8,2 +8,8 @@ const format_1 = require("@sinclair/typebox/format"); | ||
const pieces_1 = require("../../pieces"); | ||
var TriggerStrategy; | ||
(function (TriggerStrategy) { | ||
TriggerStrategy["POLLING"] = "POLLING"; | ||
TriggerStrategy["WEBHOOK"] = "WEBHOOK"; | ||
TriggerStrategy["APP_WEBHOOK"] = "APP_WEBHOOK"; | ||
})(TriggerStrategy = exports.TriggerStrategy || (exports.TriggerStrategy = {})); | ||
var TriggerType; | ||
@@ -20,3 +26,3 @@ (function (TriggerType) { | ||
displayName: typebox_1.Type.String({}), | ||
nextAction: typebox_1.Type.Optional(typebox_1.Type.Any({})) | ||
nextAction: typebox_1.Type.Optional(typebox_1.Type.Any()) | ||
}; | ||
@@ -23,0 +29,0 @@ exports.EmptyTrigger = typebox_1.Type.Object(Object.assign(Object.assign({}, commonProps), { type: typebox_1.Type.Literal(TriggerType.EMPTY), settings: typebox_1.Type.Object({}) })); |
import { BaseModel } from "../../common/base-model"; | ||
import { CollectionId } from "../../collections/collection"; | ||
import { CollectionVersionId } from "../../collections/collection-version"; | ||
import { FlowVersionId } from "../../flows/flow-version"; | ||
@@ -12,3 +11,2 @@ import { ProjectId } from "../../project/project"; | ||
collectionId: CollectionId; | ||
collectionVersionId: CollectionVersionId; | ||
flowIdToVersionId: Record<FlowId, FlowVersionId>; | ||
@@ -15,0 +13,0 @@ status: InstanceStatus; |
@@ -7,4 +7,4 @@ import { Static } from "@sinclair/typebox"; | ||
input: import("@sinclair/typebox").TAny; | ||
collectionVersionId: import("@sinclair/typebox").TString<string>; | ||
collectionId: import("@sinclair/typebox").TString<string>; | ||
}>; | ||
export declare type PieceOptionRequest = Static<typeof PieceOptionRequest>; |
@@ -11,4 +11,4 @@ "use strict"; | ||
input: typebox_1.Type.Any({}), | ||
collectionVersionId: typebox_1.Type.String({}) | ||
collectionId: typebox_1.Type.String({}), | ||
}); | ||
//# sourceMappingURL=piece-option-request.js.map |
@@ -0,1 +1,2 @@ | ||
import { TriggerStrategy } from "../../flows/triggers/trigger"; | ||
export declare type PieceBase = { | ||
@@ -12,4 +13,8 @@ name: string; | ||
description: string; | ||
sampleData: unknown; | ||
props: Record<string, unknown>; | ||
}; | ||
export declare type TriggerBase = ActionBase; | ||
export declare type TriggerBase = ActionBase & { | ||
type: TriggerStrategy; | ||
}; | ||
export declare type PieceMetadata = PieceBase & { | ||
@@ -16,0 +21,0 @@ actions: Record<string, ActionBase>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
170268
2552
167