Zipper-Inc / zipper-functions

The code for zipper.dev and zipper.run. Write and run typescript functions in your browser without having to write any auth, FE, API code.
https://zipper.dev
MIT License
6 stars 2 forks source link

connector-v2 -- main as base #692

Open miguel-nascimento opened 10 months ago

miguel-nascimento commented 10 months ago

Using main branch as base this time. Made using rebase, this PR is only to use the GitHub UI in order to compare both PR

Connectors v2

Connectors v2 went through many tests until we got a MVP. This document explains the different ways we tried, the things we thought about at each step, and where we are headed.

Connectors as Code

The idea with connectors as code was to put all possible settings directly into the code, creating objects like slackConfig or githubConfig.

These would have information about the connector like clientId, botScopes, and userScopes. This way, we could easily change the values in the code to set up any connector.

To save and get these values, we used ts-morph, but that caused some problems. Users could change the connector config to non-literal values.

For example:

export const slackConnectorConfig: Partial<SlackUserAuth> = {
  clientId: Deno.env.get(“slackConfigClientId”),
  botScopes: [“channels:read”],
  userScopes: [],
};

In order to grab value from .env, or grab any dynamic value, we would need to run the code. And tools like ts-morph cant do this. This invalidates the connector-as-code approach.

We need to run and get the config.

Connectors as Handler (Current Version)

The connectors as a handler approach is similar to connectors as code, but now we use the handler to run the applet and get the config.

This solves the problem of non-literal values and handles OAuth-related issues by using other applets to get links, like slack-install-link.

This way, connectors can work in different ways based on actions, like just giving back the configurations or doing OAuth, for example, case “get-auth-url” or case “get-config”.

There are some concerns with this method, though. Some connectors might need code execution and HTTP calls, which could take a long time or might fail. If zipper.run has downtimes, the connectors won’t work.

Other issues include:

Current things missing:

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zipper-run ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2024 6:36pm
miguel-nascimento commented 10 months ago

After the base change, applet run isn't working. Probably due to a change in the boot.