Skip to content

Commit

Permalink
Merge branch 'main' into azure-openai
Browse files Browse the repository at this point in the history
  • Loading branch information
abuaboud committed Feb 21, 2024
2 parents aa549a9 + 0a9b7ab commit 5067e45
Show file tree
Hide file tree
Showing 965 changed files with 24,956 additions and 9,822 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,15 @@
"contributions": [
"plugin"
]
},
{
"login": "Verlich",
"name": "Ahmad(Ed)",
"avatar_url": "https://avatars.githubusercontent.com/u/30838131?v=4",
"profile": "https://github.com/Verlich",
"contributions": [
"plugin"
]
}
],
"commitType": "docs"
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/codespaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ gh codespace ports visibility 3000:public -c $CODESPACE_NAME
gh codespace ports visibility 4200:public -c $CODESPACE_NAME
export BACKEND_URL=$(gh codespace ports -c $CODESPACE_NAME --json sourcePort,browseUrl | jq -r '.[] | select(.sourcePort == 3000) | .browseUrl')
sed -i "s|apiUrl: 'http://localhost:3000/v1'|apiUrl: '${BACKEND_URL}/v1'|g" /workspace/packages/ui/common/src/lib/environments/environment.ts
sed -i "s|AP_WEBHOOK_URL=\"http://localhost:3000\"|AP_WEBHOOK_URL=\"${BACKEND_URL}\"|g" /workspace/packages/backend/.env
sed -i "s|AP_WEBHOOK_URL=\"http://localhost:3000\"|AP_WEBHOOK_URL=\"${BACKEND_URL}\"|g" /workspace/packages/server/api/.env
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"extensions": [
"dbaeumer.vscode-eslint",
"Angular.ng-template",
"nrwl.angular-console",
"cipchk.cssrem",
"huizhou.githd",
"GitHub.copilot",
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/automate-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Automate Deploy

on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- main

jobs:
Release:
if: contains(github.event.pull_request.labels.*.name, 'auto-deploy') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Set RELEASE env var from package.json
run: echo RELEASE=$(node --print "require('./package.json').version") >> $GITHUB_ENV

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
build-args: |
ENVIRONMENT=cloud
platforms: |
linux/amd64
push: true
tags: |
ghcr.io/activepieces/activepieces-cloud:${{ env.RELEASE }}.${{ github.sha }}
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/ops.key
chmod 600 ~/.ssh/ops.key
cat >>~/.ssh/config <<END
Host ops
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/ops.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.DEV_OPS_USERNAME }}
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_HOST: ${{ secrets.DEV_OPS_HOST }}

- name: Deploy Web
run: |
ssh ops -t -t 'bash -ic "cd mrsk && kamal deploy --version ${{ env.RELEASE }}.${{ github.sha }} --config-file=config/web.yml --skip-push; exit"'
- name: Deploy Workers
run: |
ssh ops -t -t 'bash -ic "cd mrsk && kamal deploy --version ${{ env.RELEASE }}.${{ github.sha }} --config-file=config/workers.yml --skip-push; exit"'
2 changes: 1 addition & 1 deletion .github/workflows/build-cloud-nx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
parallel-commands-on-agents: |
npx nx affected --target=lint --parallel=3
npx nx affected --target=build -c production --parallel=3
npx nx run-many --target=test --projects=engine,shared,backend --parallel=3
npx nx run-many --target=test --projects=engine,shared,server-api --parallel=3
agents:
name: Nx Cloud - Agents
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/crowdin.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ tmp
.nx/
/out-tsc
firebase-admin-sdk.json
cache
dev
cache
.env

# SDK Build
builds
Expand All @@ -23,7 +24,7 @@ node_modules
*.launch
.settings/
*.sublime-workspace

cache
# IDE - VSCode
.vscode/*
!.vscode/settings.json
Expand All @@ -49,7 +50,6 @@ Thumbs.db
.angular
activepieces-engine.js
.history/
packages/backend/.env

# produced by unsandboxed engine execution
.pnpm-store
Expand Down
4 changes: 2 additions & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
. "$(dirname -- "$0")/_/husky.sh"

# Check if the commit includes changes to the backend's .env file
if git diff --cached --name-only -- packages/backend/.env | grep -q '^packages/backend/.env$'; then
if git diff --cached --name-only -- packages/server/api/.env | grep -q '^packages/server/api/.env$'; then
echo "Error: You're attempting to commit the backend's .env file. Please avoid committing this file."
exit 1
fi

npx --no -- commitlint --edit ${1}
npx --no -- commitlint --edit ${1}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ COPY . .
COPY .npmrc package.json package-lock.json ./
RUN npm ci

RUN npx nx run-many --target=build --projects=backend,ui-core --configuration production --skip-nx-cache
RUN npx nx run-many --target=build --projects=server-api,ui-core --configuration production --skip-nx-cache

# Install backend production dependencies
RUN cd dist/packages/backend && npm install --production --force
RUN cd dist/packages/server/api && npm install --production --force

### STAGE 2: Run ###
FROM base AS run

# Set up backend
WORKDIR /usr/src/app

COPY packages/backend/src/assets/default.cf /usr/local/etc/isolate
COPY packages/server/api/src/assets/default.cf /usr/local/etc/isolate

# Install Nginx and gettext for envsubst
RUN apt-get update && apt-get install -y nginx gettext
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Copyright (c) 2020-2023 Activepieces Inc.
Copyright (c) 2020-2024 Activepieces Inc.

Portions of this software are licensed as follows:

* All content that resides under the "packages/ee/" and "packages/backend/src/app/ee/" directory of this repository, if that directory exists, is licensed under the license defined in packages/ee/LICENSE
* All content that resides under the "packages/ee/" and "packages/server/api/src/app/ee" directory of this repository, if that directory exists, is licensed under the license defined in packages/ee/LICENSE
* All third party components incorporated into the Activepieces Inc Software are licensed under the original license provided by the owner of the applicable component.
* Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ Not into coding but still interested in contributing? Come join our [Discord](ht
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/AdamSelene"><img src="https://avatars.githubusercontent.com/u/79495?v=4?s=100" width="100px;" alt="Olivier Sambourg"/><br /><sub><b>Olivier Sambourg</b></sub></a><br /><a href="#plugin-AdamSelene" title="Plugin/utility libraries">🔌</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Verlich"><img src="https://avatars.githubusercontent.com/u/30838131?v=4?s=100" width="100px;" alt="Ahmad(Ed)"/><br /><sub><b>Ahmad(Ed)</b></sub></a><br /><a href="#plugin-Verlich" title="Plugin/utility libraries">🔌</a></td>
</tr>
</tbody>
</table>
Expand Down
1 change: 0 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ services:
AP_REDIS_HOST: redis
AP_REDIS_PORT: 6379
AP_SIGN_UP_ENABLED: true
privileged: true
ports:
- "3000:3000"
- "4200:4200"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.0'
services:
activepieces:
image: ghcr.io/activepieces/activepieces:0.19.0
image: ghcr.io/activepieces/activepieces:0.20.2
container_name: activepieces
restart: unless-stopped
## Enable the following line if you already use AP_EXECUTION_MODE with SANDBOXED or old activepieces, checking the breaking change documentation for more info.
Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
nginx -g "daemon off;" &

# Start backend server
node --enable-source-maps dist/packages/backend/main.js
node --enable-source-maps dist/packages/server/api/main.js
2 changes: 1 addition & 1 deletion docs/about/license.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Activepieces' **core** is released as open source under the [MIT license](https:

The MIT license is a permissive license that grants users the freedom to use, modify, or distribute the software without any significant restrictions. The only requirement is that you include the license notice along with the software when distributing it.

Using the enterprise features (under the packages/ee and packages/backend/src/app/ee folder) with a self-hosted instance requires an Activepieces license. If you are looking for these features, contact us at [sales@activepieces.com](mailto:sales@activepieces.com).
Using the enterprise features (under the packages/ee and packages/server/api/src/app/ee folder) with a self-hosted instance requires an Activepieces license. If you are looking for these features, contact us at [sales@activepieces.com](mailto:sales@activepieces.com).

**Benefits of Dual Licensing Repo**

Expand Down
4 changes: 2 additions & 2 deletions docs/developers/architecture/repo-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The repository is structured as a monorepo using the NX build system, with TypeS
.
├── packages
│ ├── ui
│ ├── backend
│ ├── server
| ├── ee
│ ├── engine
│ ├── pieces
Expand All @@ -18,7 +18,7 @@ The repository is structured as a monorepo using the NX build system, with TypeS
```

- `ui`: This package contains the user interface, implemented using the Angular framework.
- `backend`: This package contains the API implementation, using the Fastify framework.
- `server`: This package contains the API implementation, using the Fastify framework.
- `ee`: This package contains features that are only available in the paid edition.
- `engine`: This package contains the logic for flow execution within the sandbox.
- `pieces`: This package contains the implementation of triggers and actions for third-party apps.
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/building-pieces/create-action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const gelato = createPiece({

# Testing

By default, the development setup only builds specific components. Open the file `packages/backend/.env` and include "gelato" in the `AP_DEV_PIECES`.
By default, the development setup only builds specific components. Open the file `packages/server/api/.env` and include "gelato" in the `AP_DEV_PIECES`.

For more details, check out the [Piece Development](../development-setup/getting-started) section.

Expand Down
2 changes: 1 addition & 1 deletion docs/developers/building-pieces/create-trigger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const gelato = createPiece({

# Testing

By default, the development setup only builds specific components. Open the file `packages/backend/.env` and include "gelato" in the `AP_DEV_PIECES`.
By default, the development setup only builds specific components. Open the file `packages/server/api/.env` and include "gelato" in the `AP_DEV_PIECES`.

For more details, check out the [Piece Development](../development-setup/getting-started) section.

Expand Down
2 changes: 1 addition & 1 deletion docs/developers/development-setup/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To set up the development environment, you can choose one of the following metho

To avoid making the dev environment slow, not all pieces are functional during development at first. By default, only these pieces are functional at first, as specified in `AP_DEV_PIECES`.

(https://github.com/activepieces/activepieces/blob/main/packages/backend/.env#L4
https://github.com/activepieces/activepieces/blob/main/packages/server/api/.env#L4

To override the default list available at first, define an `AP_DEV_PIECES` environment variable with a comma-separated list of pieces to make available. For example, to make `google-sheets` and `cal-com` available, you can use:

Expand Down
27 changes: 23 additions & 4 deletions docs/developers/piece-reference/flow-control.mdx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: 'Flow Control'
icon: 'joystick'
description: 'Learn How to control flow from inside the piece'
icon: 'Joystick'
description: 'Learn How to Control Flow from Inside the Piece'
---

Flow Controls provide the ability to control the flow of execution from inside a piece. By using the `ctx` parameter in the `run` method of actions, you can perform various operations to control the flow.

## Stop Flow

You can stop the flow and provide a response to the webhook trigger, This can be useful when you want to terminate the execution of the piece and send a specific response back.
You can stop the flow and provide a response to the webhook trigger. This can be useful when you want to terminate the execution of the piece and send a specific response back.

**Example with Response:**

Expand All @@ -28,7 +28,26 @@ context.run.stop({
context.run.stop();
```

## Pause / Delay Flow
## Pause Flow and Wait for Webhook

You can pause flow and return HTTP response, also provide a callback to URL that you can call with certain payload and continue the flow.

**Example:**

```typescript
ctx.run.pause({
pauseMetadata: {
type: PauseType.WEBHOOK,
response: {
callbackUrl: context.generateResumeUrl({
queryParams: {},
}),
},
},
});
```

## Pause Flow and Delay

You can pause or delay the flow until a specific timestamp. Currently, the only supported type of pause is a delay based on a future timestamp.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To make your webhook accessible from the internet, you need to configure the bac

1. Install ngrok.
2. Run the command `ngrok http 3000`.
3. Replace the `AP_WEBHOOK_URL` environment variable in `packages/backend/.env` with the ngrok URL.
3. Replace the `AP_WEBHOOK_URL` environment variable in `packages/server/api/.env` with the ngrok URL.

Once you have completed these configurations, you are good to go!

Expand Down
Loading

0 comments on commit 5067e45

Please sign in to comment.