Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@activepieces/shared

Package Overview
Dependencies
Maintainers
3
Versions
221
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@activepieces/shared - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

src/lib/common/index.d.ts

2

package.json
{
"name": "@activepieces/shared",
"version": "0.2.0",
"version": "0.3.0",
"type": "commonjs",

@@ -5,0 +5,0 @@ "dependencies": {

@@ -5,2 +5,3 @@ export * from "./lib/flows/actions/action";

export * from "./lib/app-connection/dto/upsert-app-connection-request";
export * from "./lib/common";
export * from "./lib/common/activepieces-error";

@@ -18,3 +19,2 @@ export * from "./lib/common/telemetry";

export * from "./lib/flow-run/execution/execution-output";
export { StoreOperation } from "./lib/flows/actions/action";
export { StepOutputStatus } from "./lib/flow-run/execution/step-output";

@@ -21,0 +21,0 @@ export * from "./lib/instance";

"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.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;
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.LoopOnItemsActionSettings = exports.PieceActionSettings = exports.PrincipalType = exports.SignInRequest = exports.SignUpRequest = exports.ExecuteCodeRequest = exports.CodeRunStatus = exports.StepOutputStatus = void 0;
const tslib_1 = require("tslib");

@@ -9,2 +9,3 @@ tslib_1.__exportStar(require("./lib/flows/actions/action"), exports);

tslib_1.__exportStar(require("./lib/app-connection/dto/upsert-app-connection-request"), exports);
tslib_1.__exportStar(require("./lib/common"), exports);
tslib_1.__exportStar(require("./lib/common/activepieces-error"), exports);

@@ -22,4 +23,2 @@ tslib_1.__exportStar(require("./lib/common/telemetry"), exports);

tslib_1.__exportStar(require("./lib/flow-run/execution/execution-output"), exports);
var action_1 = require("./lib/flows/actions/action");
Object.defineProperty(exports, "StoreOperation", { enumerable: true, get: function () { return action_1.StoreOperation; } });
var step_output_1 = require("./lib/flow-run/execution/step-output");

@@ -40,7 +39,8 @@ Object.defineProperty(exports, "StepOutputStatus", { enumerable: true, get: function () { return step_output_1.StepOutputStatus; } });

Object.defineProperty(exports, "PrincipalType", { enumerable: true, get: function () { return principal_type_1.PrincipalType; } });
var action_2 = require("./lib/flows/actions/action");
Object.defineProperty(exports, "PieceActionSettings", { enumerable: true, get: function () { return action_2.PieceActionSettings; } });
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return action_2.Action; } });
Object.defineProperty(exports, "ActionType", { enumerable: true, get: function () { return action_2.ActionType; } });
Object.defineProperty(exports, "CodeActionSettings", { enumerable: true, get: function () { return action_2.CodeActionSettings; } });
var action_1 = require("./lib/flows/actions/action");
Object.defineProperty(exports, "PieceActionSettings", { enumerable: true, get: function () { return action_1.PieceActionSettings; } });
Object.defineProperty(exports, "LoopOnItemsActionSettings", { enumerable: true, get: function () { return action_1.LoopOnItemsActionSettings; } });
Object.defineProperty(exports, "Action", { enumerable: true, get: function () { return action_1.Action; } });
Object.defineProperty(exports, "ActionType", { enumerable: true, get: function () { return action_1.ActionType; } });
Object.defineProperty(exports, "CodeActionSettings", { enumerable: true, get: function () { return action_1.CodeActionSettings; } });
var user_1 = require("./lib/user/user");

@@ -47,0 +47,0 @@ Object.defineProperty(exports, "UserStatus", { enumerable: true, get: function () { return user_1.UserStatus; } });

@@ -8,5 +8,4 @@ "use strict";

payload: typebox_1.Type.Any(),
// THIS IS CHANGED
collectionId: typebox_1.Type.String(),
});
//# sourceMappingURL=create-flow-run-request.js.map
import { StepOutput } from './step-output';
export declare class ExecutionState {
configs: Record<string, unknown>;
steps: Record<string, StepOutput>;

@@ -8,5 +7,5 @@ lastStepState: Record<string, unknown>;

insertStep(stepOutput: StepOutput, actionName: string, ancestors: [string, number][]): void;
updateLastStep(outputOnly: any, actionName: string): void;
updateLastStep(outputOnly: unknown, actionName: string): void;
private static deepClone;
private getTargetMap;
}

@@ -7,3 +7,2 @@ "use strict";

constructor() {
this.configs = {};
this.steps = {};

@@ -10,0 +9,0 @@ this.lastStepState = {};

@@ -15,11 +15,10 @@ export declare enum StepOutputStatus {

export declare class LoopOnItemsStepOutput extends StepOutput<{
current_item: any;
current_iteration: number;
item: unknown;
index: number;
iterations: Record<string, StepOutput>[];
}> {
}
export declare class BranchStepOutput extends StepOutput {
output: {
condition: boolean;
};
export declare class BranchStepOutput extends StepOutput<{
condition: boolean;
}> {
}

@@ -48,13 +48,14 @@ import { Static } from '@sinclair/typebox';

}>;
export declare enum StoreOperation {
PUT = "PUT",
GET = "GET"
}
export declare type LoopOnItemsActionSettings = {
items: unknown;
};
export declare const LoopOnItemsActionSettingsWithValidation: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TString<string>;
}>;
export declare type LoopOnItemsActionSettingsWithValidation = Static<typeof LoopOnItemsActionSettings>;
export declare const LoopOnItemsActionSettings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TString<string>;
}>;
export declare type LoopOnItemsActionSettings = Static<typeof LoopOnItemsActionSettings>;
export declare const LoopOnItemsActionSchema: import("@sinclair/typebox").TObject<{
type: import("@sinclair/typebox").TLiteral<ActionType.LOOP_ON_ITEMS>;
settings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>;
items: import("@sinclair/typebox").TString<string>;
}>;

@@ -82,2 +83,12 @@ name: import("@sinclair/typebox").TString<string>;

export declare const singleValueConditions: BranchOperator[];
export declare const BranchActionSettingsWithValidation: 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>[]>>;
}>]>>>;
}>;
export declare const BranchCondition: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{

@@ -92,5 +103,13 @@ firstValue: import("@sinclair/typebox").TString<string>;

export declare type BranchCondition = Static<typeof BranchCondition>;
export declare type BranchActionSettings = {
conditions: BranchCondition[][];
};
export declare const BranchActionSettings: 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>[]>>;
}>]>>>;
}>;
export declare type BranchActionSettings = Static<typeof BranchActionSettings>;
export declare const BranchActionSchema: import("@sinclair/typebox").TObject<{

@@ -142,3 +161,3 @@ type: import("@sinclair/typebox").TLiteral<ActionType.BRANCH>;

settings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>;
items: import("@sinclair/typebox").TString<string>;
}>;

@@ -145,0 +164,0 @@ name: import("@sinclair/typebox").TString<string>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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;
exports.Action = exports.BranchActionSchema = exports.BranchActionSettings = exports.BranchCondition = exports.BranchActionSettingsWithValidation = exports.singleValueConditions = exports.BranchOperator = exports.LoopOnItemsActionSchema = exports.LoopOnItemsActionSettings = exports.LoopOnItemsActionSettingsWithValidation = exports.PieceActionSchema = exports.PieceActionSettings = exports.CodeActionSchema = exports.CodeActionSettings = exports.ActionType = void 0;
const typebox_1 = require("@sinclair/typebox");

@@ -35,12 +35,11 @@ const pieces_1 = require("../../pieces");

exports.PieceActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.PIECE), settings: exports.PieceActionSettings }));
// Storage Action
var StoreOperation;
(function (StoreOperation) {
StoreOperation["PUT"] = "PUT";
StoreOperation["GET"] = "GET";
})(StoreOperation = exports.StoreOperation || (exports.StoreOperation = {}));
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({})),
}) }));
// Loop Items
exports.LoopOnItemsActionSettingsWithValidation = typebox_1.Type.Object({
items: typebox_1.Type.String({ minLength: 1 })
});
exports.LoopOnItemsActionSettings = typebox_1.Type.Object({
items: typebox_1.Type.String()
});
exports.LoopOnItemsActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.LOOP_ON_ITEMS), settings: exports.LoopOnItemsActionSettings }));
// Loop Items
var BranchOperator;

@@ -69,6 +68,6 @@ (function (BranchOperator) {

];
exports.BranchCondition = typebox_1.Type.Union([
const BranchConditionValid = (addMinLength) => typebox_1.Type.Union([
typebox_1.Type.Object({
firstValue: typebox_1.Type.String({}),
secondValue: typebox_1.Type.String({}),
firstValue: addMinLength ? typebox_1.Type.String({ minLength: 1 }) : typebox_1.Type.String(),
secondValue: addMinLength ? typebox_1.Type.String({ minLength: 1 }) : typebox_1.Type.String(),
operator: typebox_1.Type.Optional(typebox_1.Type.Union([...Object.values(BranchOperator).

@@ -80,3 +79,3 @@ filter(c => exports.singleValueConditions.find(sc => sc === c) === undefined).map(c => {

typebox_1.Type.Object({
firstValue: typebox_1.Type.String({}),
firstValue: addMinLength ? typebox_1.Type.String({ minLength: 1 }) : typebox_1.Type.String(),
operator: typebox_1.Type.Optional(typebox_1.Type.Union([...Object.values(BranchOperator).

@@ -88,5 +87,10 @@ filter(c => exports.singleValueConditions.find(sc => sc === c) !== undefined).map(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)),
}) }));
exports.BranchActionSettingsWithValidation = typebox_1.Type.Object({
conditions: typebox_1.Type.Array(typebox_1.Type.Array(BranchConditionValid(true))),
});
exports.BranchCondition = BranchConditionValid(false);
exports.BranchActionSettings = typebox_1.Type.Object({
conditions: typebox_1.Type.Array(typebox_1.Type.Array(BranchConditionValid(false))),
});
exports.BranchActionSchema = typebox_1.Type.Object(Object.assign(Object.assign({}, commonActionProps), { type: typebox_1.Type.Literal(ActionType.BRANCH), settings: exports.BranchActionSettings }));
// Union of all actions

@@ -93,0 +97,0 @@ exports.Action = typebox_1.Type.Recursive(action => typebox_1.Type.Union([

@@ -13,6 +13,6 @@ "use strict";

let valid = true;
let step = flowVersion.trigger;
while (step !== undefined) {
const steps = exports.flowHelper.getAllSteps(flowVersion);
for (let i = 0; i < steps.length; i++) {
const step = steps[i];
valid = valid && step.valid;
step = step.nextAction;
}

@@ -43,2 +43,9 @@ return valid;

}
if (parentStep.type === action_1.ActionType.LOOP_ON_ITEMS) {
if (parentStep.firstLoopAction && parentStep.firstLoopAction.name === request.name) {
const stepToUpdate = parentStep.firstLoopAction;
parentStep.firstLoopAction = stepToUpdate.nextAction;
deleted = true;
}
}
}

@@ -60,2 +67,5 @@ if (!deleted) {

}
if (step.type === action_1.ActionType.LOOP_ON_ITEMS) {
steps.push(...traverseFlowInternal(step.firstLoopAction));
}
step = step.nextAction;

@@ -77,4 +87,4 @@ }

if (parentStep.nextAction && parentStep.nextAction.name === request.name) {
const { nextAction, onSuccessAction, onFailureAction } = extractActions(parentStep.nextAction);
parentStep.nextAction = createAction(request, nextAction, onFailureAction, onSuccessAction);
const actions = extractActions(parentStep.nextAction);
parentStep.nextAction = createAction(request, actions);
updated = true;

@@ -84,12 +94,19 @@ }

if (parentStep.onFailureAction && parentStep.onFailureAction.name === request.name) {
const { nextAction, onSuccessAction, onFailureAction } = extractActions(parentStep.onFailureAction);
parentStep.onFailureAction = createAction(request, nextAction, onFailureAction, onSuccessAction);
const actions = extractActions(parentStep.onFailureAction);
parentStep.onFailureAction = createAction(request, actions);
updated = true;
}
if (parentStep.onSuccessAction && parentStep.onSuccessAction.name === request.name) {
const { nextAction, onSuccessAction, onFailureAction } = extractActions(parentStep.onSuccessAction);
parentStep.onSuccessAction = createAction(request, nextAction, onFailureAction, onSuccessAction);
const actions = extractActions(parentStep.onSuccessAction);
parentStep.onSuccessAction = createAction(request, actions);
updated = true;
}
}
if (parentStep.type === action_1.ActionType.LOOP_ON_ITEMS) {
if (parentStep.firstLoopAction && parentStep.firstLoopAction.name === request.name) {
const actions = extractActions(parentStep.firstLoopAction);
parentStep.firstLoopAction = createAction(request, actions);
updated = true;
}
}
}

@@ -107,3 +124,4 @@ if (!updated) {

const onFailureAction = step.type === action_1.ActionType.BRANCH ? step.onFailureAction : undefined;
return { nextAction, onSuccessAction, onFailureAction };
const firstLoopAction = step.type === action_1.ActionType.LOOP_ON_ITEMS ? step.firstLoopAction : undefined;
return { nextAction, onSuccessAction, onFailureAction, firstLoopAction };
}

@@ -118,11 +136,35 @@ function addAction(flowVersion, request) {

}
if (parentStep.type === action_1.ActionType.BRANCH && request.stepLocationRelativeToParent !== undefined && request.stepLocationRelativeToParent !== null) {
if (parentStep.type === action_1.ActionType.LOOP_ON_ITEMS && request.stepLocationRelativeToParent) {
if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.INSIDE_LOOP) {
parentStep.firstLoopAction = createAction(request.action, {
nextAction: parentStep.firstLoopAction
});
}
else if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.AFTER) {
parentStep.nextAction = createAction(request.action, {
nextAction: parentStep.nextAction
});
}
else {
throw new activepieces_error_1.ActivepiecesError({
code: activepieces_error_1.ErrorCode.FLOW_OPERATION_INVALID,
params: {}
}, `Loop step parent ${request.stepLocationRelativeToParent} not found`);
}
}
else if (parentStep.type === action_1.ActionType.BRANCH && request.stepLocationRelativeToParent) {
if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.INSIDE_TRUE_BRANCH) {
parentStep.onSuccessAction = createAction(request.action, parentStep.onSuccessAction);
parentStep.onSuccessAction = createAction(request.action, {
nextAction: parentStep.onSuccessAction
});
}
else if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.INSIDE_FALSE_BRANCH) {
parentStep.onFailureAction = createAction(request.action, parentStep.onFailureAction);
parentStep.onFailureAction = createAction(request.action, {
nextAction: parentStep.onFailureAction
});
}
else if (request.stepLocationRelativeToParent === flow_operations_1.StepLocationRelativeToParent.AFTER) {
parentStep.nextAction = createAction(request.action, parentStep.nextAction);
parentStep.nextAction = createAction(request.action, {
nextAction: parentStep.nextAction
});
}

@@ -133,10 +175,12 @@ else {

params: {}
}, `Branch ${request.stepLocationRelativeToParent} not found`);
}, `Branch step parernt ${request.stepLocationRelativeToParent} not found`);
}
}
else {
parentStep.nextAction = createAction(request.action, parentStep.nextAction);
parentStep.nextAction = createAction(request.action, {
nextAction: parentStep.nextAction
});
}
}
function createAction(request, nextAction, onFailureAction, onSuccessAction) {
function createAction(request, { nextAction, onSuccessAction, onFailureAction, firstLoopAction }) {
var _a;

@@ -155,6 +199,3 @@ const baseProperties = {

case action_1.ActionType.LOOP_ON_ITEMS:
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 });
action = Object.assign(Object.assign({}, baseProperties), { firstLoopAction: firstLoopAction, type: action_1.ActionType.LOOP_ON_ITEMS, settings: request.settings });
break;

@@ -161,0 +202,0 @@ case action_1.ActionType.PIECE:

@@ -38,3 +38,3 @@ import { Static } from "@sinclair/typebox";

settings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>;
items: import("@sinclair/typebox").TString<string>;
}>;

@@ -90,3 +90,3 @@ name: import("@sinclair/typebox").TString<string>;

settings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>;
items: import("@sinclair/typebox").TString<string>;
}>;

@@ -204,3 +204,3 @@ name: import("@sinclair/typebox").TString<string>;

settings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>;
items: import("@sinclair/typebox").TString<string>;
}>;

@@ -257,3 +257,3 @@ name: import("@sinclair/typebox").TString<string>;

settings: import("@sinclair/typebox").TObject<{
items: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TAny>;
items: import("@sinclair/typebox").TString<string>;
}>;

@@ -260,0 +260,0 @@ name: import("@sinclair/typebox").TString<string>;

@@ -5,3 +5,4 @@ "use strict";

const typebox_1 = require("@sinclair/typebox");
exports.SemVerType = typebox_1.Type.RegEx(/^[0-9]+\.[0-9]+\.[0-9]+$/);
const semVer_1 = require("../../common/utils/semVer");
exports.SemVerType = typebox_1.Type.RegEx(semVer_1.semVerRegex);
exports.GetPieceRequestQuery = typebox_1.Type.Object({

@@ -8,0 +9,0 @@ version: exports.SemVerType,

@@ -8,2 +8,4 @@ import { TriggerStrategy } from "../../flows/triggers/trigger";

version: string;
minimumSupportedRelease?: string;
maximumSupportedRelease?: string;
};

@@ -10,0 +12,0 @@ export declare type 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc