repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
supaglue | github_2023 | typescript | 515 | supaglue-labs | lucasmarshall | @@ -3,11 +3,12 @@ import { CustomerExpandedSafe } from '@supaglue/core/types/customer';
import { useSWRWithApplication } from './useSWRWithApplication';
export function useCustomers() {
- const { data, isLoading, error } = useSWRWithApplication<CustomerExpandedSafe[]>('/api/internal/customers');
+ const { data, i... | ```suggestion
...rest,
``` |
supaglue | github_2023 | others | 519 | supaglue-labs | albertyfwu | @@ -56,5 +56,11 @@
"posthog-node": "^2.5.4",
"sync-worker": "workspace:^",
"workspace": "^0.0.1-preview.1"
+ },
+ "resolutions": { | do a lot of libraries depend on these? have we tried bumping those libraries instead of using resolutions? |
supaglue | github_2023 | typescript | 510 | supaglue-labs | lucasmarshall | @@ -136,15 +146,40 @@ export class SyncService {
}: SyncInfoFilter): Promise<SyncInfo[]> {
const customerId = externalCustomerId ? getCustomerIdPk(applicationId, externalCustomerId) : undefined;
const connections = await this.#connectionService.listSafe(applicationId, customerId, providerName);
- const ... | Can we throw a more descriptive error? |
supaglue | github_2023 | typescript | 508 | supaglue-labs | asdfryan | @@ -1,34 +1,22 @@
import { authOptions } from '@/pages/api/auth/[...nextauth]';
-import { getAuth } from '@clerk/nextjs/server';
import { type GetServerSideProps } from 'next';
import { getServerSession, Session } from 'next-auth';
-import { API_HOST, IS_CLOUD, ORGANIZATION_ID, SG_INTERNAL_TOKEN } from './api';
+imp... | I think this will break it for cloud. Did you test with cloud = true? |
supaglue | github_2023 | others | 508 | supaglue-labs | lucasmarshall | @@ -0,0 +1,4 @@
+NEXTAUTH_URL=http://localhost:3000
+SUPAGLUE_JWT_SECRET=some-secret
+SUPAGLUE_INTERNAL_TOKEN=some-internal-token
+SUPAGLUE_API_HOST=http://localhost:8080 | We should add to the development docs that you need to copy this |
supaglue | github_2023 | others | 508 | supaglue-labs | lucasmarshall | @@ -16,7 +16,9 @@ cp docker-compose.override.dev.yml docker-compose.override.yml
### Running
```shell
-docker-compose up
+cp apps/mgmt-ui/.env.sample apps/mgmt-ui/.env | Still need to run `docker compose up` |
supaglue | github_2023 | typescript | 505 | supaglue-labs | lucasmarshall | @@ -92,6 +92,34 @@ export class SyncService {
return sync;
}
+ // TODO: Remove when customers are migrated
+ public async deleteAllSchedulesAndWorkflows(): Promise<void> {
+ // eslint-disable-next-line no-console
+ console.log('deleting schedules...'); | Can we use the logger instead? |
supaglue | github_2023 | typescript | 505 | supaglue-labs | asdfryan | @@ -19,6 +19,12 @@ export default function init(app: Router): void {
await connectionService.backfillRemoteIds(req.supaglueApplication.id);
return res.status(200).send();
});
+ // TODO: Remove once all customers are backfilled / migrated
+ v1Router.post('/_clear_connections_and_syncs', async (req: Reques... | If we're going to have them truncate everything, we can delete the backfill endpoint above IMO |
supaglue | github_2023 | others | 501 | supaglue-labs | lucasmarshall | @@ -0,0 +1,9 @@
+# Security Policy
+
+## Supported Versions
+
+We recommend using the latest version of Supaglue to ensure you get all security updates.
+
+## Reporting a Vulnerability
+
+Please report any security vulnerabilities to security@supaglue.com. | ```suggestion
Please report any security vulnerabilities to [security@supaglue.com](mailto:security@supaglue.com).
``` |
supaglue | github_2023 | others | 496 | supaglue-labs | tomkit | @@ -0,0 +1,6 @@
+name: include_deleted_at | `include_deleted_data` or `include_deleted_at`? |
supaglue | github_2023 | typescript | 494 | supaglue-labs | tomkit | @@ -185,17 +186,43 @@ class HubSpotClient extends AbstractCrmRemoteClient {
passThrough.emit('error', err);
});
+ // Archived Accounts
+ // TODO: this doesn't respect the `updatedAfter` parameter because we can't use the search API for archived accounts
+ (async () => {
+ let after = undefin... | nit: should we just use named parameters if we need to leave a comment? |
supaglue | github_2023 | others | 492 | supaglue-labs | tomkit | @@ -79,155 +79,165 @@ model Connection {
}
model CrmAccount {
- id String @id @default(uuid())
- remoteId String @map("remote_id")
- customerId String @map("customer_id")
- connectionId String @map("connection_id")
- name ... | do we use `was` here because we are referring to the remote resource? |
supaglue | github_2023 | others | 492 | supaglue-labs | tomkit | @@ -79,155 +79,165 @@ model Connection {
}
model CrmAccount {
- id String @id @default(uuid())
- remoteId String @map("remote_id")
- customerId String @map("customer_id")
- connectionId String @map("connection_id")
- name ... | i wonder if the precision here (calling out "detected") causes more cognitive overhead in consuming this if developers don't care to distinguish between remote vs our timestamp, i.e. the more ergonomic API is to actually be imprecise and just call it "remote_deleted_at" for the end-user. internally it makes sense |
supaglue | github_2023 | typescript | 492 | supaglue-labs | tomkit | @@ -52,6 +52,16 @@ export const fromRemoteAccountToDbAccountParams = (
customerId: string,
remoteAccount: RemoteAccount
) => {
+ const lastModifiedAt = | we use `modified` here to differentiate between `update` (non-deleted update only)? |
supaglue | github_2023 | typescript | 478 | supaglue-labs | tomkit | @@ -352,6 +455,65 @@ class HubSpotClient extends AbstractCrmRemoteClient {
return await retry(helper, ASYNC_RETRY_OPTIONS);
}
+ async #listContactsIncrementalImpl(updatedAfter: Date, after?: string): Promise<HubspotPaginatedContacts> {
+ const helper = async () => {
+ try {
+ await this.maybeR... | is the contact property name here diff than others? there's no `hs_` prefix |
supaglue | github_2023 | typescript | 461 | supaglue-labs | tomkit | @@ -0,0 +1,47 @@
+import { Sync, SyncState, SyncType } from '@supaglue/core/types/sync';
+import { PrismaClient, Sync as SyncModel } from '@supaglue/db';
+
+function fromSyncModel(model: SyncModel): Sync {
+ // `strategy` looks like { type: 'full then incremental', ...otherProps }
+
+ const { type, ...otherStrategyPr... | is it intentional to have the same methods in sync-worker and api? |
supaglue | github_2023 | typescript | 461 | supaglue-labs | tomkit | @@ -0,0 +1,80 @@
+import { CommonModel } from './common';
+
+type BaseSync = {
+ id: string;
+ connectionId: string;
+};
+
+export type FullThenIncrementalSync = BaseSync & {
+ type: 'full then incremental'; | nit: snakecase in case we need to use this as a constant/enum somewhere that doesn't allow spaces? |
supaglue | github_2023 | typescript | 461 | supaglue-labs | tomkit | @@ -0,0 +1,80 @@
+import { CommonModel } from './common';
+
+type BaseSync = {
+ id: string;
+ connectionId: string;
+};
+
+export type FullThenIncrementalSync = BaseSync & {
+ type: 'full then incremental';
+ state: FullThenIncrementalSyncState;
+};
+
+/**
+ * This sync type will:
+ * 1. Sync records in reverse ch... | Rather than encode the strategy description into the type name, thoughts on calling them Strategy1, Strategy2, and then having a comment code-block describing them?
I'm having a bit of trouble keeping track of forward/reverse and their permutations |
supaglue | github_2023 | typescript | 461 | supaglue-labs | tomkit | @@ -0,0 +1,80 @@
+import { CommonModel } from './common';
+
+type BaseSync = {
+ id: string;
+ connectionId: string;
+};
+
+export type FullThenIncrementalSync = BaseSync & {
+ type: 'full then incremental';
+ state: FullThenIncrementalSyncState;
+};
+
+/**
+ * This sync type will:
+ * 1. Sync records in reverse ch... | Similar to the comment above, thoughts on calling it something like Strategy1Phase1, Strategy1Phase2, and then describe it in comments? |
supaglue | github_2023 | typescript | 461 | supaglue-labs | tomkit | @@ -1,62 +1,254 @@
+import { CommonModel } from '@supaglue/core/types/common';
import { CRM_COMMON_MODELS } from '@supaglue/core/types/crm';
-import { proxyActivities, uuid4 } from '@temporalio/workflow';
+import { FullThenIncrementalSync, ReverseThenForwardSync } from '@supaglue/core/types/sync';
+import { Applicatio... | I guess another part of the strategy is whether to try to complete k objects as fast as possible first or to make slower progress across all objects we support? |
supaglue | github_2023 | typescript | 473 | supaglue-labs | albertyfwu | @@ -14,8 +15,22 @@ import {
RemoteOpportunity,
RemoteOpportunityCreateParams,
RemoteOpportunityUpdateParams,
+ RemoteUser,
} from '../../../types';
+export const fromSalesforceUserToRemoteUser = (record: Record<string, any>): RemoteUser => {
+ return {
+ remoteId: record.Id,
+ name: record.Name,
+ ... | they are supported. use `SystemModstamp` or `LastModifiedAt` |
supaglue | github_2023 | typescript | 473 | supaglue-labs | albertyfwu | @@ -105,7 +108,7 @@ const propertiesToFetch = {
'StageName',
'CloseDate',
'CreatedDate',
- 'LastModifiedDate',
+ 'SystemModStam', | typo. test this? |
supaglue | github_2023 | typescript | 473 | supaglue-labs | albertyfwu | @@ -116,7 +119,7 @@ const propertiesToFetch = {
'LastName',
'ConvertedDate',
'CreatedDate',
- 'LastModifiedDate',
+ 'SystemModStam', | typo |
supaglue | github_2023 | typescript | 473 | supaglue-labs | albertyfwu | @@ -129,6 +132,7 @@ const propertiesToFetch = {
'Email',
'IsDeleted',
],
+ user: ['Id', 'Name', 'Email', 'IsActive'], | add `SystemModStamp` |
supaglue | github_2023 | javascript | 462 | supaglue-labs | tomkit | @@ -13,8 +13,6 @@ const SENTRY_ENABLED = !(
Sentry.init({
dsn: SENTRY_DSN || 'https://c9b7660599b7410e972b290a1e62dd5f@o4504573112745984.ingest.sentry.io/4504878650753024',
- // Adjust this value in production, or use tracesSampler for greater control
- tracesSampleRate: 1.0, | curious what impact this has? |
supaglue | github_2023 | typescript | 460 | supaglue-labs | albertyfwu | @@ -53,6 +53,23 @@ export async function deleteWebhook(applicationId: string): Promise<void> {
});
}
+export async function createRemoteIntegration(
+ applicationId: string,
+ data: CRMIntegrationCreateParams
+): Promise<Integration> {
+ const result = await fetch(`/api/internal/integrations/create`, {
+ me... | who checks that the user is allowed to create integrations for this `applicationId`? This is in the FE code and not in the next.js lambdas. Can't anybody hit this endpoint, pass in an applicationId, and do this even for orgs they don't own? |
supaglue | github_2023 | typescript | 460 | supaglue-labs | albertyfwu | @@ -40,7 +53,7 @@ export default function IntegrationCard(props: { integration: Integration; integ
<Button
variant="text"
onClick={() => {
- router.push(`/configuration/integrations/${category}/${providerName}`);
+ router.push(`/applications/${applicationId... | in the future maybe we can create another hook that automatically prepends this for simplicity |
supaglue | github_2023 | typescript | 454 | supaglue-labs | tomkit | @@ -0,0 +1,253 @@
+/* eslint-disable @typescript-eslint/no-floating-promises */
+import AddIcon from '@mui/icons-material/Add';
+import DeleteIcon from '@mui/icons-material/Delete';
+
+import { createOrUpdateWebhook, deleteWebhook } from '@/client';
+import { useActiveApplication } from '@/hooks/useActiveApplication';
... | I think nextjs should just refecth and the hook above will cause the component state to refresh rather than calling it ourselves |
supaglue | github_2023 | typescript | 400 | supaglue-labs | tomkit | @@ -0,0 +1,38 @@
+import { IS_CLOUD } from '@/pages/api';
+import { useClerk } from '@clerk/nextjs';
+import MUILogout from '@mui/icons-material/Logout';
+import { ListItemIcon, MenuItem } from '@mui/material';
+import { signOut } from 'next-auth/react';
+
+const LogoutImpl = ({ handleLogout }: { handleLogout: () => vo... | nit: this could be a ternary |
supaglue | github_2023 | typescript | 400 | supaglue-labs | albertyfwu | @@ -0,0 +1,20 @@
+import { camelcaseKeys } from '@/utils/camelcase';
+import { Application } from '@supaglue/core/types/application';
+import useSWR from 'swr';
+import { fetcher } from '.';
+import { useActiveApplicationId } from './useActiveApplicationId';
+
+export function useActiveApplication() {
+ const applicat... | is it possible to have this be non-nullable and make sure only to call this from components in the tree that MUST be scoped under application? It seems annoying to have all components check if active application exists, even if you know that must be the case, since it's something like `/applications/{applicationId}/cus... |
supaglue | github_2023 | typescript | 400 | supaglue-labs | tomkit | @@ -0,0 +1,55 @@
+import { getAuth, withClerkMiddleware } from '@clerk/nextjs/server';
+import type { NextRequest } from 'next/server';
+import { NextResponse } from 'next/server';
+import { IS_CLOUD } from './pages/api';
+
+// Set the paths that don't require the user to be signed in
+const publicPaths = ['/sign-in*',... | nit: add a comment about non-cloud users trying to access cloud paths |
supaglue | github_2023 | typescript | 400 | supaglue-labs | tomkit | @@ -0,0 +1,55 @@
+import { getAuth, withClerkMiddleware } from '@clerk/nextjs/server';
+import type { NextRequest } from 'next/server';
+import { NextResponse } from 'next/server';
+import { IS_CLOUD } from './pages/api';
+
+// Set the paths that don't require the user to be signed in
+const publicPaths = ['/sign-in*',... | nit: assign conditional to a variable for readability |
supaglue | github_2023 | typescript | 400 | supaglue-labs | tomkit | @@ -154,26 +155,37 @@ theme = {
const drawerWidth = 256;
export default function App({ Component, pageProps: { session, activeApplication, ...pageProps } }: AppProps) {
- if (!activeApplication) {
- return null;
+ if (!IS_CLOUD) {
+ if (!activeApplication) {
+ return null;
+ }
+ return (
+ <... | nit: does SessionProvider need to be the top-most parent? or can it be deeper so there's less duplicated providers between cloud vs non-cloud? |
supaglue | github_2023 | typescript | 400 | supaglue-labs | albertyfwu | @@ -151,7 +151,7 @@ export default function IntegrationTabPanel(props: IntegrationDetailTabPanelProp
ei.id === newIntegration.id ? newIntegration : ei
);
- updateRemoteIntegration(activeApplication.id, newIntegration);
+ updateRemoteIntegration(activeA... | is there a way to avoid doing this everywhere? |
supaglue | github_2023 | typescript | 415 | supaglue-labs | asdfryan | @@ -29,9 +29,15 @@ export abstract class AbstractRemoteClient extends EventEmitter implements Remot
return super.emit(event, ...args);
}
+ protected async maybeRefreshAuth(): Promise<void> {
+ return;
+ }
+
protected abstract getAuthHeadersForPassthroughRequest(): Record<string, string>;
public a... | I think we should override the HubspotClient instead |
supaglue | github_2023 | others | 409 | supaglue-labs | asdfryan | @@ -125,31 +125,33 @@ Go to
## Upgrading
-### Upgrading to 0.5.x
+### Upgrading to 0.6.x
-We have some backward-incompatible changes in 0.5.x. You will need to run the following process to upgrade.
+We have some backward-incompatible changes in 0.6.x. You will need to run the following process to upgrade.
```... | Isn't our schema `api` not `public`? |
supaglue | github_2023 | typescript | 412 | supaglue-labs | tomkit | @@ -1,33 +1,24 @@
-import type { PrismaClient } from '@supaglue/db';
import { NotFoundError } from '../errors';
-import { fromSgUserModel } from '../mappers/index';
import { SgUser } from '../types/index';
-export class SgUserService {
- #prisma: PrismaClient;
-
- constructor(prisma: PrismaClient) {
- this.#pr... | nit: co-locate with core/lib/constants.ts ? |
supaglue | github_2023 | typescript | 408 | supaglue-labs | albertyfwu | @@ -30,3 +30,9 @@ export type ApplicationCreateParams = {
orgId: string;
};
export type ApplicationUpdateParams = Partial<BaseApplication>;
+
+export type WebhookPayloadType = 'CONNECTION_SUCCESS' | 'CONNECTION_ERROR' | 'SYNC_SUCCESS' | 'SYNC_ERROR';
+
+export type WebhookPayload = {
+ customerId: string;
+} & Re... | can we actually type this? this is an important part of our API |
supaglue | github_2023 | others | 397 | supaglue-labs | albertyfwu | @@ -57,12 +58,10 @@ Go to the "Configurations" tab to configure the integrations your customers will
</BrowserWindow>
-Click on "Configure" and enter OAuth2 credentials for your HubSpot or Salesforce Connected Apps.
-
-You can find the credentials by following these guides:
+Click on "Configure" and enter OAuth2 c... | can you use relative links instead? otherwise, when moving this to versioned docs, it will link to the `next` docs |
supaglue | github_2023 | others | 397 | supaglue-labs | albertyfwu | @@ -57,12 +58,10 @@ Go to the "Configurations" tab to configure the integrations your customers will
</BrowserWindow>
-Click on "Configure" and enter OAuth2 credentials for your HubSpot or Salesforce Connected Apps.
-
-You can find the credentials by following these guides:
+Click on "Configure" and enter OAuth2 c... | same here |
supaglue | github_2023 | others | 397 | supaglue-labs | albertyfwu | @@ -92,22 +95,38 @@ Create a Supaglue customer using the [Management API](/api/mgmt#tag/Customers/op
You will need four pieces of information when hitting this endpoint:
-- **customer_id (unique)**: the primary key you use in your application to uniquely identify this customer.
+- **customer_id**: the primary key ... | should this be `customer_id`? also, we should refer to `{{customerId}}` |
supaglue | github_2023 | typescript | 399 | supaglue-labs | albertyfwu | @@ -33,6 +33,7 @@ export default async function handler(
},
body: JSON.stringify({
name: req.body.name,
+ orgId: ORGANIZATION_ID, | did you test this? doesn't this need to be `org_id`? |
supaglue | github_2023 | typescript | 370 | supaglue-labs | albertyfwu | @@ -284,6 +306,7 @@ async function seedCRMIntegrations() {
}
async function main() {
+ await seedOrganiziation(); | typo: should be `Organization` |
supaglue | github_2023 | typescript | 354 | supaglue-labs | lucasmarshall | @@ -43,4 +43,17 @@ export async function updateRemoteIntegration(applicationId: string, data: Integ
return r;
}
+export async function addApplication(name: string): Promise<Application> {
+ const result = await fetch(`/api/internal/applications`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'app... | Don't we need to include an auth token here? |
supaglue | github_2023 | others | 355 | supaglue-labs | asdfryan | @@ -23,7 +23,7 @@ model SgUser {
model Application {
id String @id @default(uuid())
- name String
+ name String @unique | We need to think more about this IMO.
In a multi-tenant offering, the name should be unique within an organization only. |
supaglue | github_2023 | typescript | 339 | supaglue-labs | tomkit | @@ -1,10 +1,17 @@
-export const APPLICATION_ID = 'a4398523-03a2-42dd-9681-c91e3e2efaf4';
-
export const fetcher = <T>(input: RequestInfo, init: RequestInit): Promise<T> => {
+ return fetch(input, init).then<T>((res) => res.json());
+}; | what's the diff between context/fetcher and hooks/fetcher? |
supaglue | github_2023 | typescript | 339 | supaglue-labs | tomkit | @@ -21,8 +22,29 @@ export const getServerSideProps: GetServerSideProps = async ({ req, res }) => {
};
}
+ // Get applications to set active application | is this the same call as `apps/mgmt-ui/src/pages/api/internal/applications/index.ts:9` ? |
supaglue | github_2023 | typescript | 339 | supaglue-labs | tomkit | @@ -0,0 +1,77 @@
+import { useActiveApplication } from '@/context/activeApplication';
+import { useApplications } from '@/hooks/useApplications';
+import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
+import { Box } from '@mui/material';
+import Button from '@mui/material/Button';
+import Menu fro... | the css is a mess right now, but it's between sx and tailwindcss, can you convert inline style prop to one of those |
supaglue | github_2023 | typescript | 349 | supaglue-labs | albertyfwu | @@ -93,14 +96,34 @@ export default function init(app: Router): void {
...originalParams,
closeDate: stringOrNullOrUndefinedToDate(originalParams.closeDate),
};
- const account = await opportunityService.update(customerId, connectionId, opportunityUpdateParams);
- return res.status(200... | nit: `results.map(snakecaseKeys)` |
supaglue | github_2023 | typescript | 336 | supaglue-labs | tomkit | @@ -0,0 +1,16 @@
+import { InternalServerError } from '@supaglue/core/errors'; | nit: `customer_id.ts` |
supaglue | github_2023 | typescript | 333 | supaglue-labs | asdfryan | @@ -14,6 +15,7 @@ export default function init(app: Router): void {
auth(v1Router);
apiKey(v1Router);
+ application(v1Router); | This is awkward because this uses the same `internalMiddlware` which identifies the `supaglueApplication`.
I think you should probably either create a new middleware that does the shared token authentication but does not identify the `supaglueApplication` or restructure all the routes to be nested under `application... |
supaglue | github_2023 | typescript | 327 | supaglue-labs | tomkit | @@ -2,19 +2,21 @@ import { UnauthorizedError } from '@supaglue/core/errors';
import { NextFunction, Request, Response } from 'express';
import { getDependencyContainer } from '../dependency_container';
-const { connectionService, integrationService } = getDependencyContainer();
+const { customerService, connectionS... | is `getSafeByCustomerIdAndIntegrationId` already using customerId as `externalIdentifier` ? |
supaglue | github_2023 | others | 323 | supaglue-labs | albertyfwu | @@ -84,7 +84,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
- push: false
+ push: ${{ !env.ACT }} | is this this? https://github.com/nektos/act |
supaglue | github_2023 | typescript | 322 | supaglue-labs | asdfryan | @@ -113,21 +59,14 @@ function TabPanel(props: TabPanelProps) {
);
}
-function a11yProps(index: number) {
- return {
- id: `vertical-tab-${index}`,
- 'aria-controls': `vertical-tabpanel-${index}`,
- };
-}
-
export default function VerticalTabs() { | Can you rename as there are no longer vertical tabs? |
supaglue | github_2023 | typescript | 322 | supaglue-labs | asdfryan | @@ -113,21 +59,14 @@ function TabPanel(props: TabPanelProps) {
);
}
-function a11yProps(index: number) {
- return {
- id: `vertical-tab-${index}`,
- 'aria-controls': `vertical-tabpanel-${index}`,
- };
-}
-
export default function VerticalTabs() {
const router = useRouter();
const { tab = [] } = rou... | I found this code difficult to understand.
I think it will be more readable if you just pass in `providerName` in the props instead |
supaglue | github_2023 | typescript | 322 | supaglue-labs | asdfryan | @@ -1,31 +1,154 @@
-import { Grid } from '@mui/material';
-import IntegrationCard from './IntegrationCard';
-import { Integration, IntegrationCardInfo } from './VerticalTabs';
+/* eslint-disable @typescript-eslint/no-floating-promises */
+import { updateRemoteIntegration } from '@/client';
+import { useApplication } fr... | Could you set types? i.e. `useState<string>` |
supaglue | github_2023 | typescript | 322 | supaglue-labs | asdfryan | @@ -0,0 +1,94 @@
+import HubspotIcon from '@/assets/connector_icons/hubspot.png';
+import SalesforceIcon from '@/assets/connector_icons/salesforce.png';
+import { useIntegrations } from '@/hooks/useIntegrations';
+import Box from '@mui/material/Box';
+import Image from 'next/image';
+import { useRouter } from 'next/rou... | Copying just in case you missed it on the previous version.
I found this code fairly difficult to read. I think it would help if you pass in `providerName` as a prop. |
supaglue | github_2023 | typescript | 322 | supaglue-labs | asdfryan | @@ -12,7 +13,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
});
if (!result.ok) {
- return res.status(500).json({ error: 'Failed to fetch' });
+ return res.status(500).json(null); | Why are we no longer passing an error? |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -3,42 +3,43 @@ import { NotFoundError } from '../errors';
import { decrypt, encrypt } from '../lib/crypt';
import { fromConnectionModelToConnectionSafe, fromConnectionModelToConnectionUnsafe } from '../mappers';
import type { ConnectionCredentialsDecrypted, ConnectionSafe, ConnectionUnsafe } from '../types';
+imp... | can you update `integration` here too? |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -3,42 +3,43 @@ import { NotFoundError } from '../errors';
import { decrypt, encrypt } from '../lib/crypt';
import { fromConnectionModelToConnectionSafe, fromConnectionModelToConnectionUnsafe } from '../mappers';
import type { ConnectionCredentialsDecrypted, ConnectionSafe, ConnectionUnsafe } from '../types';
+imp... | ditto |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -3,42 +3,43 @@ import { NotFoundError } from '../errors';
import { decrypt, encrypt } from '../lib/crypt';
import { fromConnectionModelToConnectionSafe, fromConnectionModelToConnectionUnsafe } from '../mappers';
import type { ConnectionCredentialsDecrypted, ConnectionSafe, ConnectionUnsafe } from '../types';
+imp... | when do we need to use this endpoint? Should we provide a more scoped endpoint that doesn't just list all connections in an application? |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -33,8 +33,8 @@ export class IntegrationService {
}
// TODO: paginate
- public async list(): Promise<Integration[]> {
- const integrations = await this.#prisma.integration.findMany();
+ public async list(applicationId: string): Promise<Integration[]> {
+ const integrations = await this.#prisma.integra... | nit: `return integrations.map(fromIntegrationModel)` |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -18,9 +18,11 @@ export default function init(app: Router) {
res: Response<GetSyncHistoryResponse>
) => {
const { next, previous, results } = await syncHistoryService.list({
- connectionId: req.customerConnection.id,
- paginationParams: req.query,
- model: req.query.model,
+ ... | why do we need sync history and sync info to move under `mgmt`? the advantage of keeping it under `crm` is that the developer can pass in the same headers they already pass in for the common model endpoints |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -7,12 +8,23 @@ import { Client, ScheduleAlreadyRunning } from '@temporalio/client';
export class SyncService {
#temporalClient: Client;
+ #connectionService: ConnectionService;
- public constructor(temporalClient: Client) {
+ public constructor(temporalClient: Client, connectionService: ConnectionService)... | what do you think about nesting `customerId?: string` and `providerName?: string` under something like `filters`? Seems cleaner when you want to just filter by provider and not customer. |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -7,12 +8,23 @@ import { Client, ScheduleAlreadyRunning } from '@temporalio/client';
export class SyncService {
#temporalClient: Client;
+ #connectionService: ConnectionService;
- public constructor(temporalClient: Client) {
+ public constructor(temporalClient: Client, connectionService: ConnectionService)... | not super critical right now, but i wonder if there is some bulk endpoint for temporal here. it looks like we could issue 100s, 1000s, etc. of requests to temporal at the same time. |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -18,9 +18,11 @@ export default function init(app: Router) {
res: Response<GetSyncHistoryResponse>
) => {
const { next, previous, results } = await syncHistoryService.list({
- connectionId: req.customerConnection.id,
- paginationParams: req.query,
- model: req.query.model,
+ ... | can `query` be undefined here? why do we need `?.`? |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -11,10 +16,14 @@ export default function init(app: Router): void {
router.get(
'/',
async (
- req: Request<GetSyncInfosPathParams, GetSyncInfosResponse, GetSyncInfosRequest>,
+ req: Request<GetSyncInfosPathParams, GetSyncInfosResponse, GetSyncInfosRequest, GetSyncInfosQueryParams>,
res:... | smae question here about `query?.` |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -0,0 +1,38 @@
+import { getDependencyContainer } from '@/dependency_container';
+import { snakecaseKeys } from '@supaglue/core/lib/snakecase';
+import {
+ GetSyncHistoryPathParams,
+ GetSyncHistoryQueryParams,
+ GetSyncHistoryRequest,
+ GetSyncHistoryResponse,
+} from '@supaglue/schemas/mgmt';
+import { Request,... | same q here about `query?`. |
supaglue | github_2023 | typescript | 318 | supaglue-labs | albertyfwu | @@ -0,0 +1,39 @@
+import { getDependencyContainer } from '@/dependency_container';
+import { snakecaseKeys } from '@supaglue/core/lib/snakecase';
+import {
+ GetSyncInfosPathParams,
+ GetSyncInfosQueryParams,
+ GetSyncInfosRequest,
+ GetSyncInfosResponse,
+} from '@supaglue/schemas/mgmt';
+import { Request, Respons... | same q about `query?`. |
supaglue | github_2023 | others | 319 | supaglue-labs | tomkit | @@ -37,15 +36,14 @@ delete:
examples:
Example:
value:
- id: 0258cbc6-6020-430a-848e-aafacbadf4af
application_id: d8ceb3ff-8b7f-4fa7-b8de-849292f6ca69
name: MyCompany Inc
email: contact@mycompany.com
... | nit: `external_identifier` to string match on the field name on Customers |
supaglue | github_2023 | others | 235 | supaglue-labs | tomkit | @@ -1,6 +1,6 @@
# ActiveCampaign
-### Third-party provider information
+## Overview | The convention I've been using is to separate header from other headers by two levels so it's more visually apparent |
supaglue | github_2023 | others | 235 | supaglue-labs | tomkit | @@ -7,13 +7,12 @@ slug: /
## What is Supaglue?
-Supaglue is an open source unified API for CRMs. It handles authentication, caches and normalizes data from multiple CRM platforms, and provides a single set of API endpoints for reading and writing to those CRMs. Developers at B2B companies can use Supaglue to strea... | Should we talk about self-hosted or cloud instead of removing ? |
supaglue | github_2023 | others | 235 | supaglue-labs | tomkit | @@ -23,17 +22,17 @@ Supaglue is an open source unified API for CRMs. It handles authentication, cach
- **High performance**: query against synced data in your own cloud with no rate limits.
- **Open source**: self-host and run Supaglue for free.
- **Privacy-first**: prevent sensitive customer data from leaving your ... | There are additional steps here |
supaglue | github_2023 | others | 317 | supaglue-labs | albertyfwu | @@ -0,0 +1,41 @@
+oneOf:
+ - type: object
+ title: Sync Finished Event
+ properties:
+ type: | do we want to include `required:` to be more stricter? |
supaglue | github_2023 | others | 317 | supaglue-labs | albertyfwu | @@ -0,0 +1,55 @@
+oneOf:
+ - type: object
+ title: Sync Finished Event
+ properties:
+ type:
+ enum:
+ - SYNC_SUCCESS
+ - SYNC_ERROR
+ payload:
+ type: object
+ properties:
+ connectionId: | i think we are using camelcase as convention for other endpoints |
supaglue | github_2023 | others | 317 | supaglue-labs | albertyfwu | @@ -1,4 +1,4 @@
-openapi: 3.0.3
+openapi: 3.1.0 | were there no issues with express-openapi-validator? it looked like 3.1.0 isn't supported |
supaglue | github_2023 | others | 317 | supaglue-labs | tomkit | @@ -61,3 +61,20 @@ components:
$ref: ./components/schemas/create_update_integration.yaml
webhook:
$ref: ./components/schemas/objects/webhook.yaml
+ webhook-payload:
+ $ref: './components/schemas/webhook-payload.yaml'
+webhooks: | move into paths? |
supaglue | github_2023 | typescript | 310 | supaglue-labs | albertyfwu | @@ -216,44 +216,50 @@ const getFullName = (firstName?: string, lastName?: string): string | null => {
export const toHubspotAccountCreateParams = (params: RemoteAccountCreateParams): Record<string, string> => {
const phoneParams = toHubspotPhoneCreateParams(params.phoneNumbers);
- return {
- name: params.name... | is this necessary? |
supaglue | github_2023 | typescript | 310 | supaglue-labs | albertyfwu | @@ -216,44 +216,50 @@ const getFullName = (firstName?: string, lastName?: string): string | null => {
export const toHubspotAccountCreateParams = (params: RemoteAccountCreateParams): Record<string, string> => {
const phoneParams = toHubspotPhoneCreateParams(params.phoneNumbers);
- return {
- name: params.name... | can we avoid casting? |
supaglue | github_2023 | others | 311 | supaglue-labs | tomkit | @@ -45,7 +45,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
-version: 0.0.3
+version: 0.0.4 | how do we correlate this with our platform version ? |
supaglue | github_2023 | others | 311 | supaglue-labs | tomkit | @@ -74,13 +74,7 @@ helm upgrade --install --namespace supaglue --create-namespace \
--set "temporal.cassandra.config.heap_new_size=400M" \
--set "global.postgresql.auth.password=$POSTGRES_PASSWORD" \
--set api.oauthReturnUrl=$OAUTH_RETURN_URL \
- --set "deploymentId=$DEPLOYMENT_ID" \
- --set "api.image.tag=t... | Should we have an export for the image tag |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | The quickstart/dev flow doesn't stand up the management portal -- there are also more steps (see development.md) for standing up the mgmt-ui |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | The guides are in now under /references/... |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | `upsertCustomer` |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | This is important behavior for the developer to know in this step |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | This link doesn't work here b/c the customerId is different |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | Same problem with customerId |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -9,13 +9,6 @@ slug: /
Supaglue is an open source unified API for CRMs. It handles authentication, caches and normalizes data from multiple CRM platforms, and provides a single set of API endpoints for reading and writing to those CRMs. Developers at B2B companies can use Supaglue to streamline and scale the work ... | Is this shown anywhere now? |
supaglue | github_2023 | others | 309 | supaglue-labs | tomkit | @@ -5,121 +5,209 @@ sidebar_position: 3
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import BrowserWindow from '@site/src/components/BrowserWindow';
+import ThemedImage from '@theme/ThemedImage';
# Getting Started
-Use this guide to get up and running with Supaglue with your application... | we provide the reference curl here: i think we should also provide sample Customer (Step 4) and EmbeddedLink (step 5) examples in this guide so it's more streamlined, otherwise that's potential drop-off points |
supaglue | github_2023 | others | 296 | supaglue-labs | tomkit | @@ -0,0 +1,129 @@
+# GKE Runbook
+
+## Prerequisites
+
+Install kubectl, watch, gcloud cli, helm
+
+```shell
+brew install kubectl watch helm
+brew install --cask google-cloud-sdk
+```
+
+Set up a GKE cluster in your region using the console
+
+Set up your environment variables:
+
+```shell
+export DEPLOYMENT_ID=<a uni... | i guess this is actually a fallback/default since it can be specified in the embedded link too |
supaglue | github_2023 | typescript | 296 | supaglue-labs | asdfryan | @@ -161,27 +161,36 @@ export async function cryptoHash(text: string): Promise<{ original: string; hash
}
async function seedApplication() {
- const { hashed: hashedApiKey } = await cryptoHash(SUPAGLUE_QUICKSTART_API_KEY!);
+ let webhook = {};
+ if (process.env.NODE_ENV === 'development') {
+ webhook = { | IMO We should just remove the webhook seed (set it to null) for all cases. |
supaglue | github_2023 | typescript | 296 | supaglue-labs | asdfryan | @@ -182,15 +170,15 @@ async function seedApplication() {
name: 'My App',
config: {
api_key: '',
- webhook,
+ webhook: {}, | According to our types it looks like the `webhook` field should either be `null` or a complete `WebhookConfig` -- so I think this should be null? |
supaglue | github_2023 | typescript | 299 | supaglue-labs | asdfryan | @@ -221,6 +221,8 @@ class HubSpotClient extends AbstractCrmRemoteClient {
public async listOpportunities(): Promise<Readable> {
const passThrough = new PassThrough({ objectMode: true });
+ throw new Error('listopps err'); | remove? |
supaglue | github_2023 | others | 298 | supaglue-labs | lucasmarshall | @@ -30,3 +30,26 @@ Ensure your `SUPAGLUE_INTERNAL_TOKEN` matches between `.env` and `apps/mgmt-ui/.
```shell
yarn workspace mgmt-ui dev
```
+
+### Environment variables
+
+`.env`:
+
+- `SUPAGLUE_DEPLOYMENT_ID`: used for developers to opt-in to identifying themselves for analytics
+- `SUPAGLUE_API_ENCRYPTION_KEY`: us... | Should mention that these are only valid in non-hosted envs. |
supaglue | github_2023 | typescript | 295 | supaglue-labs | lucasmarshall | @@ -1,25 +1,33 @@
+import crypto from 'crypto';
import fs from 'fs';
import os from 'os';
import path from 'path';
import { v4 as uuidv4 } from 'uuid';
+const sgDeploymentId = process.env.SUPAGLUE_DEPLOYMENT_ID;
const configPath = path.join(os.homedir(), '.supaglue', 'session.json');
let distinctIdentifier: str... | ```suggestion
// The distinctIdentifier "session" lives from the time a developer runs docker compose to the time that they delete `session.json` from their home directory on the filesystem. Locally, it persists across docker compose up/down/restart and updates.
``` |
supaglue | github_2023 | typescript | 291 | supaglue-labs | tomkit | @@ -78,6 +80,20 @@ export default function IntegrationDetailTabPanel(props: IntegrationDetailTabPan
}}
/>
</Stack>
+
+ <Stack className="gap-2">
+ <Typography variant="subtitle1">Sync frequency</Typography>
+ <TextField
+ value={syncPeriodSecs}
+ ... | `type="number"` |
supaglue | github_2023 | typescript | 291 | supaglue-labs | tomkit | @@ -78,6 +80,20 @@ export default function IntegrationDetailTabPanel(props: IntegrationDetailTabPan
}}
/>
</Stack>
+
+ <Stack className="gap-2">
+ <Typography variant="subtitle1">Sync frequency</Typography>
+ <TextField
+ value={syncPeriodSecs}
+ ... | `parseInt(..., 10)`
I think the radix shouild be explicit |
supaglue | github_2023 | typescript | 291 | supaglue-labs | tomkit | @@ -78,6 +80,21 @@ export default function IntegrationDetailTabPanel(props: IntegrationDetailTabPan
}}
/>
</Stack>
+
+ <Stack className="gap-2">
+ <Typography variant="subtitle1">Sync frequency</Typography>
+ <TextField
+ value={syncPeriodSecs}
+ ... | nit: we can we explicit with the radix = `10`
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt |
supaglue | github_2023 | others | 252 | supaglue-labs | george-xing | @@ -0,0 +1,110 @@
+---
+sidebar_position: 3
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import BrowserWindow from '@site/src/components/BrowserWindow';
+
+# Getting Started
+
+Use this guide to get up and running with Supaglue with your application.
+
+Here's a quick overview of the ... | Make this not specific to self-hosting |
supaglue | github_2023 | others | 252 | supaglue-labs | george-xing | @@ -0,0 +1,110 @@
+---
+sidebar_position: 3
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+import BrowserWindow from '@site/src/components/BrowserWindow';
+
+# Getting Started
+
+Use this guide to get up and running with Supaglue with your application.
+
+Here's a quick overview of the ... | where do they get the application_id? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.