Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connector script and its execution #386

Merged
merged 4 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENCRYPT_CRYPTO_SECRET_KEY="0123456789abcdef0123456789abcdef"
# API Backend
# ================================================
ENV=dev
DISTRIBUTION=selfhosted
DISTRIBUTION=selfhosted # selfhosted or managed
OAUTH_REDIRECT_BASE=http://localhost:3000
SENTRY_DSN=
# ================================================
Expand Down Expand Up @@ -73,7 +73,6 @@ NEXT_PUBLIC_BACKEND_DOMAIN=http://localhost:3000 # https://api.panora.dev/
NEXT_PUBLIC_MAGIC_LINK_DOMAIN=http://localhost:81
NEXT_PUBLIC_POSTHOG_KEY=<ph_project_api_key>
NEXT_PUBLIC_POSTHOG_HOST=<ph_instance_address>
NEXT_PUBLIC_DISTRIBUTION="managed" #managed or self-host

NEXT_PUBLIC_STYTCH_PROJECT_ID="project-test"
NEXT_PUBLIC_STYTCH_SECRET="example"
Expand Down
Empty file.
44 changes: 27 additions & 17 deletions docs/open-source/contributors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,46 @@ We made a docker file that builds Panora from sources, specifically to help you

<Steps>

<Step title="Copy env variables">```bash cp .env.example .env ```</Step>
<Step title="Copy env variables">
```bash
cp .env.example .env
```
</Step>

<Step title="Rules for env variables">
1. You don't need Stytch variables if you selfhost, it's only used in cloud version of Panora so you can discard the stytch variables.
2. To provide 3rd party variables you have the option to manage a 3rd party oAuth app by yourself by setting the credentials as such:

(You must create by hand inside the 3rd party a custom oAuth2 app and paste the credentials using the following form)

`PROVIDER_VERTICAL_SOFTWAREMODE_ATTRIBUTE`
where
PROVIDER is any 3rd party name
VERTICAL is for example { CRM, TICKETING, MARKETINGAUTOMATION, ...}
SOFTWAREMODE is { CLOUD, ONPREMISE }
ATTRIBUTE is for example { CLIENT_ID, CLIENT_SECRET, SUBDOMAIN, ... }

i.e `HUBSPOT_CRM_CLOUD_CLIENT_ID`
`PROVIDER_VERTICAL_SOFTWAREMODE_ATTRIBUTE`
where
```
PROVIDER is any 3rd party name
VERTICAL is for example { CRM, TICKETING, MARKETINGAUTOMATION, ...}
SOFTWAREMODE is { CLOUD, ONPREMISE }
ATTRIBUTE is for example { CLIENT_ID, CLIENT_SECRET, SUBDOMAIN, ... }
```
i.e `HUBSPOT_CRM_CLOUD_CLIENT_ID`

</Step>

<Step title="Removed previously installed dependencies">
```bash rm -rf node_modules .pnpm-store ./packages/api/dist
./packages/api/node_modules ./apps/webapp/node_modules
./apps/frontend_snippet/node_modules ```
```bash
rm -rf node_modules .pnpm-store ./packages/api/dist ./packages/api/node_modules ./apps/webapp/node_modules ./apps/frontend_snippet/node_modules
```
</Step>

<Step title="Mac Users only:">
```bash echo -e "node-linker=hoisted\npackage-import-method=clone-or-copy" >
.npmrc ```
```bash
echo -e "node-linker=hoisted\npackage-import-method=clone-or-copy" > .npmrc
```
</Step>

<Step title="Start the Dockerfile">
```bash docker compose -f docker-compose.dev.yml up```
```bash
docker compose -f docker-compose.dev.yml up
```
</Step>
That's all! You can find the backend and other services running at their usual location. Editing code locally will immediately reflect.
</Steps>
Expand Down Expand Up @@ -204,9 +212,11 @@ Check other implementations under `/crm/contacts/services` to fill the core func
## 2. Enable your new service

To make sure the service is enabled, dependencies and imports must be added.
We built a script that does it in seconds.
We built a script that does it in seconds. You can execute the given command from the root directory of Panora.

`pnpm run validate-connectors --vertical="crm" --objectType="contact"`
```bash
cd packages/api && pnpm install && pnpm run validate-connectors --vertical="crm" --objectType="contact"
```

The script will automatically scan the `/crm/contact/services` folder and detect any new service folder so all dependencies and imports are updated across the codebase.

Expand Down
4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"ci": "pnpm run lint && pnpm run build",
"copy-types-to-shared": "cp ./exports.ts ../shared/index.ts",
"prisma:seed": "ts-node ./scripts/seed.webapp.ts",
"validate-connectors": "node ./scripts/connectorUpdate.js",
"prebuild-oauth-connector": "node ./scripts/oauthConnector.js"
"validate-connectors": "node --experimental-detect-module ./scripts/connectorUpdate.js",
"prebuild-oauth-connector": "node --experimental-detect-module ./scripts/oauthConnector.js"
},
"dependencies": {
"@nestjs/bull": "^10.0.1",
Expand Down
5 changes: 2 additions & 3 deletions packages/api/scripts/connectorUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,5 @@ if (import.meta.url === process.argv[1]) {
}

const argv = yargs(hideBin(process.argv)).argv;

const baseDir = `../src/${argv.vertical.toLowerCase()}/${argv.object.toLowerCase()}/services`;
updateObjectTypes(baseDir, argv.object, argv.vertical);
const baseDir = `../src/${argv.vertical.toLowerCase()}/${argv.objectType.toLowerCase()}/services`;
updateObjectTypes(baseDir, argv.objectType, argv.vertical);
Loading