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 | others | 155 | supaglue-labs | lucasmarshall | @@ -1,36 +1,47 @@
---
-sidebar_position: 8
+sidebar_position: 4
---
# Architecture
-Integration as code for building full-stack integrations with your customers' SaaS platforms.
-
import ThemedImage from '@theme/ThemedImage';
<ThemedImage
alt="Architecture Diagram"
+width="75%"
sources={{
- light: ('/im... | the API isn't the worker layer. We talk about that below. |
supaglue | github_2023 | others | 155 | supaglue-labs | lucasmarshall | @@ -0,0 +1,15 @@
+---
+sidebar_position: 1
+---
+
+# HubSpot
+
+### Third-party provider information
+
+Supaglue interfaces with the HubSpot V3 API using Hubspot's official nodejs client and its getAll() functionality.
+
+### Common Model sync frequencies
+
+_The default sync frequency is 15 minutes (900000 ms)._
+
+Sy... | We should mention that change won't affect existing syncs. |
supaglue | github_2023 | others | 155 | supaglue-labs | lucasmarshall | @@ -0,0 +1,15 @@
+---
+sidebar_position: 2
+---
+
+# Salesforce
+
+### Third-party provider information
+
+Supaglue interfaces with the Salesforce async Bulk 2 API using the jsForce client. | ```suggestion
Supaglue interfaces with the Salesforce async Bulk 2.0 API using the jsForce client.
``` |
supaglue | github_2023 | others | 155 | supaglue-labs | lucasmarshall | @@ -1,39 +1,37 @@
---
-sidebar_position: 10
+sidebar_position: 8
---
# FAQ
-### What is Supaglue?
+## What is Supaglue?
-Supaglue is an embedded integrations solution built for developers. The core differentiators are that it's open-source, code-centric, and ships with customizable React components you can emb... | ```suggestion
Supaglue helps you ship customer-facing CRM integrations 10x faster through its unified API and common data model for CRMs. Because it is open source, Supaglue has several advantages over traditional unified APIs: it has no vendor lock-in, it's privacy-first, and it's fully extensible.
``` |
supaglue | github_2023 | others | 155 | supaglue-labs | lucasmarshall | @@ -1,39 +1,37 @@
---
-sidebar_position: 10
+sidebar_position: 8
---
# FAQ
-### What is Supaglue?
+## What is Supaglue?
-Supaglue is an embedded integrations solution built for developers. The core differentiators are that it's open-source, code-centric, and ships with customizable React components you can emb... | ```suggestion
We use PostHog to anonymized, session-level event data in our API to help us improve the developer experience. We use Sentry for error reporting. You can opt out of tracking by setting SUPAGLUE_DISABLE_ERROR_REPORTING=1 and SUPAGLUE_DISABLE_ANALYTICS=1 in your `.env` file.
``` |
supaglue | github_2023 | others | 155 | supaglue-labs | lucasmarshall | @@ -2,108 +2,135 @@
sidebar_position: 2
---
-# Quickstart
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
-**In less than 5 minutes**, you will use Supaglue to deploy a basic Salesforce integration that allows your customers to sync their Salesforce objects to a sample Next.js application.... | Actually put a GIF here? |
supaglue | github_2023 | others | 155 | supaglue-labs | lucasmarshall | @@ -2,108 +2,135 @@
sidebar_position: 2
---
-# Quickstart
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
-**In less than 5 minutes**, you will use Supaglue to deploy a basic Salesforce integration that allows your customers to sync their Salesforce objects to a sample Next.js application.... | We actually don't have a reason for the users to clone at a specific version anymore, since we run entirely in containers. |
supaglue | github_2023 | typescript | 154 | supaglue-labs | albertyfwu | @@ -39,15 +40,20 @@ class CustomerSalesforceIntegration extends BaseCustomerIntegration {
public async upsert(salesforceObject: string, upsertKey: string, records: Record<string, unknown>[]): Promise<void> {
await this.#connect();
- // TODO: Need to check the response. Resolved Promise doesn't necessarily ... | Thanks for addressing this comment. However, although logging is nice, perhaps we should throw an error and fail the sync if `failedResults.length > 0`? |
supaglue | github_2023 | typescript | 154 | supaglue-labs | albertyfwu | @@ -41,14 +41,30 @@ class PostgresInternalIntegration extends BaseInternalIntegration {
export class SourcePostgresInternalIntegration extends PostgresInternalIntegration {
public async readAllObjectType() {
const source = this.syncConfig.source as PostgresSource;
+ const { customProperties } = this.sync;
... | it looks like `syncConfig.customPropertiesEnabled` is already a boolean. Why do we need `!!`? |
supaglue | github_2023 | typescript | 154 | supaglue-labs | albertyfwu | @@ -1,7 +1,7 @@
/*
* Resume a customer's sync:
*
- * $ supaglue syncs logs --customer-id 1 --sync-config-name Contacts
+ * $ supaglue syncs resume --customer-id 1 --sync-config-name Contacts | nice catch |
supaglue | github_2023 | typescript | 151 | supaglue-labs | khennes | @@ -118,7 +110,16 @@ const FieldCollection = ({ appearance, syncConfig, sync }: FieldCollectionProps)
});
const { trigger: callUpdateSync } = useSWRMutation(`${apiUrl}/syncs/${sync.id}`, updateSync);
- const { upsertKey } = (syncConfig.destination as PostgresDestination).config;
+ const getUpsertKey = (syncCo... | nit: this function could be defined outside the component (maybe in a lib or utils file instead?) |
supaglue | github_2023 | typescript | 151 | supaglue-labs | khennes | @@ -13,3 +17,26 @@ const getDefaultObject = (salesforceObjectConfig: SalesforceObjectConfig): Sales
}
return salesforceObjectConfig.object;
};
+
+export const getUpsertKey = (syncConfig: SyncConfig): string | undefined => {
+ if (syncConfig.type === 'outbound') {
+ return syncConfig.destination.upsertKey;
+ ... | Heads up, custom properties are not supported yet for any syncs except for inbound -> postgres syncs. |
supaglue | github_2023 | typescript | 150 | supaglue-labs | asdfryan | @@ -29,10 +29,18 @@ const getSchema = (syncConfig: SyncConfig): Schema => {
};
const customPropertiesEnabled = (syncConfig: SyncConfig): boolean => {
- if (syncConfig.type === 'outbound') {
- return !!syncConfig.source.config.customPropertiesColumn;
+ if (syncConfig.type === 'inbound' && syncConfig.destination... | PSA: We should not be casting like this anymore and instead be using type guards to get the correct config (this is why outbound syncs are not working in the UI). |
supaglue | github_2023 | typescript | 150 | supaglue-labs | asdfryan | @@ -91,8 +99,8 @@ const FieldCollection = ({ appearance, syncConfig, sync }: FieldCollectionProps)
// Use the customer-defined field mapping if it exists; default to the values supplied by the developer
const initialFieldMapping: CustomerFieldMapping = {};
- (syncConfig.defaultFieldMapping || []).map(({ name, ... | Same here |
supaglue | github_2023 | typescript | 146 | supaglue-labs | asdfryan | @@ -255,29 +263,59 @@ const FieldCollection = ({ appearance, syncConfig, sync }: FieldCollectionProps)
const NewCustomPropertyForm = ({
appearance,
onCreateCustomProperty,
+ onRemoveCustomProperty,
+ onUpdateMappedField,
+ options,
}: {
appearance?: FieldMappingAppearance;
onCreateCustomProperty: (name... | Should it become un-disabled once `customPropertyName` becomes non-empty? |
supaglue | github_2023 | typescript | 146 | supaglue-labs | asdfryan | @@ -90,10 +95,21 @@ const customPropertySubmitInput = _applyTheme((theme: SgTheme) =>
const addCustomPropertyButton = _applyTheme((theme: SgTheme) =>
css({
backgroundColor: theme.colors.background,
- border: 'none',
- color: theme.colors.text,
- marginTop: '1rem',
- textAlign: 'start',
+ border:... | This should probably be theme dependent? |
supaglue | github_2023 | typescript | 146 | supaglue-labs | asdfryan | @@ -90,10 +95,21 @@ const customPropertySubmitInput = _applyTheme((theme: SgTheme) =>
const addCustomPropertyButton = _applyTheme((theme: SgTheme) =>
css({
backgroundColor: theme.colors.background,
- border: 'none',
- color: theme.colors.text,
- marginTop: '1rem',
- textAlign: 'start',
+ border:... | Same here |
supaglue | github_2023 | typescript | 146 | supaglue-labs | lucasmarshall | @@ -293,7 +331,7 @@ const AddCustomPropertyButton = ({
{...props}
type={undefined}
>
- + Add custom property
+ + Field | Is this the correct label? |
supaglue | github_2023 | others | 122 | supaglue-labs | asdfryan | @@ -1,3 +1,140 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+
+.sg-salesforceDisconnectButton { | Isn't this the wrong place to make this change? This should go as a default style |
supaglue | github_2023 | typescript | 122 | supaglue-labs | lucasmarshall | @@ -35,6 +43,7 @@ const IntegrationCardInternal = ({ name, description, configurationUrl, appearan
return (
<Card className="sg-integrationCard" appearance={appearance}>
+ {UserIcon ? UserIcon : null} | `UserIcon` defaults to `null`, so the ternary shouldn't be needed. |
supaglue | github_2023 | typescript | 122 | supaglue-labs | asdfryan | @@ -275,10 +275,9 @@ export default function Users({ contacts, count }: PageProps) {
</header>
<PageTabs className="mb-4" tabs={pageTabs} disabled={false} />
- {activeTab === 'Contacts' && <ContactsTable initialUsers={contacts} initialTotalUsers={count} />}
- {activeTab === 'Leads' && ... | I think this will break the integration since right now we use the tab name to look for the sync config. |
supaglue | github_2023 | others | 130 | supaglue-labs | albertyfwu | @@ -1,3 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+
+/* daisyui wrongly only makes the first header cell sticky, and not the first row cells
+ we don't want any sticky
+ */
+.table th:first-child { | cc @asdfryan is this where the CSS should go? |
supaglue | github_2023 | others | 121 | supaglue-labs | khennes | @@ -31,6 +31,22 @@ model DeveloperConfig {
@@map("developer_configs")
}
+model FieldMapping {
+ id String @id @default(uuid())
+ customerId String @map("customer_id")
+ entityName String @map("entity_name")
+ // Purposely using `integrationType` instead of foreign key `integration... | just to confirm, this would be "salesforce," "hubspot," etc.? |
supaglue | github_2023 | typescript | 119 | supaglue-labs | albertyfwu | @@ -0,0 +1,24 @@
+import {
+ InboundSyncConfig,
+ InternalDestination,
+ OutboundSyncConfig,
+ PostgresDestination,
+ RealtimeInboundSyncConfig,
+ SyncConfig,
+} from '.';
+
+export const isRealtimeInboundSyncConfig = (syncConfig: SyncConfig): syncConfig is RealtimeInboundSyncConfig => { | why do we need these? writing `syncConfig.name === 'realtime_inbound'` works for type narrowing |
supaglue | github_2023 | typescript | 108 | supaglue-labs | albertyfwu | @@ -143,7 +144,12 @@ const server = app.listen(port, (): void => {
connection,
});
- await worker.run();
+ // TODO: remove this testing subscribe call | comment out when we merge? |
supaglue | github_2023 | typescript | 105 | supaglue-labs | albertyfwu | @@ -194,6 +194,8 @@ type BaseSyncUpdateParams = {
enabled: boolean;
syncConfigName: string;
fieldMapping?: Record<string, string>;
+ // Customer-defined fields that are not included in the developer's destination schema
+ customProperties?: Record<string, string>[]; | Can we type this as `Field[]` instead of `Record<string, string>[]`? It looks like that is how it's typed on the FE. |
supaglue | github_2023 | typescript | 105 | supaglue-labs | albertyfwu | @@ -58,7 +58,7 @@ router.post(
router.put(
'/:syncId',
posthogMiddleware('Update Sync'),
- async (req: Request<{ syncId: string }, any, SyncCreateParams>, res: Response<Sync>) => {
+ async (req: Request<{ syncId: string }, any, SyncUpdateParams>, res: Response<Sync>) => { | nice catch |
supaglue | github_2023 | typescript | 110 | supaglue-labs | albertyfwu | @@ -86,7 +96,15 @@ export class DestinationPostgresInternalIntegration extends PostgresInternalInte
// TODO: Do this in batches
for (const mappedRecord of internalRecords) {
- const values = dbFields.map((field) => mappedRecord[field] ?? '');
+ const values = [...normalizedFields].map((field) => m... | why not just `const values = normalizedFields.map(...)`? |
supaglue | github_2023 | typescript | 103 | supaglue-labs | albertyfwu | @@ -1,13 +1,30 @@
-import { createSalesforce, SalesforceCustomerIntegration } from './salesforce';
+import { SyncConfig } from '../../../developer_config/entities';
+import { Sync } from '../../../syncs/entities';
+import {
+ createDestinationSalesforce,
+ createSourceSalesforce,
+ SalesforceCustomerDestinationInteg... | nit: can we use the same ordering in names?
here `source` comes before `salesforce` while it's the opposite way for `SalesforceCustomerSourceIntegration` |
supaglue | github_2023 | typescript | 103 | supaglue-labs | albertyfwu | @@ -102,4 +105,42 @@ export class SalesforceCustomerIntegration extends BaseCustomerIntegration {
}
}
-export const createSalesforce = (customerId: string) => new SalesforceCustomerIntegration(customerId);
+export class SalesforceCustomerSourceIntegration extends SalesforceCustomerIntegration {
+ public async bu... | Ideally we can use generics on the classes so we don't need to do the casting `syncConfig.source as SalesforceSource` here. If we don't do it in this PR, maybe at least leave a TODO for better type safety?
This applies to all such places where we are casting. |
supaglue | github_2023 | typescript | 103 | supaglue-labs | albertyfwu | @@ -0,0 +1,62 @@
+import { SalesforceCustomerIntegration, SyncConfig } from '../../developer_config/entities';
+import { Sync } from '../../syncs/entities';
+
+export function getMapping({ fieldMapping }: Sync, syncConfig: SyncConfig): Record<string, string> {
+ const schema = syncConfig.type === 'inbound' ? syncConfi... | missing newline |
supaglue | github_2023 | typescript | 103 | supaglue-labs | albertyfwu | @@ -0,0 +1,62 @@
+import { SalesforceCustomerIntegration, SyncConfig } from '../../../developer_config/entities'; | Can we move this file outside of the `activities` directory to avoid confusion that these are activities? |
supaglue | github_2023 | typescript | 103 | supaglue-labs | albertyfwu | @@ -55,3 +56,24 @@ export class WebhookInternalIntegration extends BaseInternalIntegration {
}
}
}
+
+export class WebhookDestinationInternalIntegration extends WebhookInternalIntegration {
+ public async sendRequests(records: any[]) {
+ const { sync, syncConfig, syncRunId } = this;
+ const fieldMapping... | missing await |
supaglue | github_2023 | others | 104 | supaglue-labs | albertyfwu | @@ -32,12 +32,14 @@ model DeveloperConfig {
}
model Sync {
- id String @id @default(uuid())
- customerId String @map("customer_id")
- type String
- enabled Boolean
- syncConfigName String @map("sync_config_name")
- fieldMapping Json? @map("field_mapping")
+ id ... | Why do we need a new column for this?
When we run the sync (`do_sync.ts`), we have access to both `SyncConfig` and `Sync`, or more specifically, we have access to both the `schema` from the developer AND the `fieldMapping` from the customer.
Isn't that sufficient information to determine which key/values in `fiel... |
supaglue | github_2023 | typescript | 96 | supaglue-labs | tomkit | @@ -61,42 +59,12 @@ const pageTabs = ['Contacts', 'Leads', 'Accounts', 'Opportunities'];
const SyncConfiguration = () => {
const syncConfigName = useActiveTab(pageTabs[0]);
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- const getSwitch = (syncConfigName: string) => {
- // TUTORIAL: uncomme... | nice |
supaglue | github_2023 | typescript | 89 | supaglue-labs | tomkit | @@ -30,7 +30,7 @@ const contactSchema = sdk.schema({
const contactSyncConfig = sdk.syncConfigs.outbound({
name: 'ContactsOutbound',
destination: sdk.customer.destinations.salesforce({
- objectConfig: sdk.customer.common.salesforce.specifiedObjectConfig('Contact'),
+ objectConfig: sdk.customer.common.salesf... | nice |
supaglue | github_2023 | others | 89 | supaglue-labs | tomkit | @@ -32,14 +32,15 @@ model DeveloperConfig {
}
model Sync {
- id String @id @default(uuid())
- customerId String @map("customer_id")
- type String
- enabled Boolean
- syncConfigName ... | sgtm
postgres allows indexing of jsonb |
supaglue | github_2023 | typescript | 89 | supaglue-labs | khennes | @@ -313,14 +313,22 @@ async function writeRecordsToCustomerIntegration(
// Apply mapping to upsert key
const salesforceUpsertKey = fieldMapping[syncConfig.destination.upsertKey];
- // TODO:
- if (syncConfig.destination.objectConfig.type !== 'specified') {
- throw new Error('Only specified salesforce object... | what is the difference between "specified"? and "selectable"? mind adding a comment? |
supaglue | github_2023 | typescript | 86 | supaglue-labs | tomkit | @@ -27,11 +27,13 @@ const contactSchema = sdk.schema({
],
});
-const contactSyncConfig = sdk.salesforce.inboundSyncConfig({
+const contactSyncConfig = sdk.syncConfigs.inbound({
name: 'Contacts',
- salesforceObject: 'Contact',
+ source: sdk.customer.sources.salesforce({
+ objectConfig: sdk.customer.specifi... | it feels like external developer friction to have to specify it in this way |
supaglue | github_2023 | typescript | 86 | supaglue-labs | tomkit | @@ -27,11 +27,13 @@ const contactSchema = sdk.schema({
],
});
-const contactSyncConfig = sdk.salesforce.inboundSyncConfig({
+const contactSyncConfig = sdk.syncConfigs.inbound({ | rather than the directionality being namespaced in the sdk, should it be specified as a member field of SyncConfig? |
supaglue | github_2023 | typescript | 91 | supaglue-labs | albertyfwu | @@ -142,34 +147,31 @@ const FieldCollection = ({ appearance, syncConfig, sync }: FieldCollectionProps)
</div>
</div>
- {syncConfig.destination.schema.fields.map(({ name }, idx) => {
- const label =
- syncConfig.destination.schema.fields.find(({ name: fieldName }) => fieldName === ... | nit: `label ?? name`? |
supaglue | github_2023 | others | 84 | supaglue-labs | albertyfwu | @@ -53,16 +53,10 @@ sources={{
## Use cases
-:::info
+Supaglue can be used by B2B SaaS companies to provide customer-facing Salesforce integrations as part of their products. | shouldn't we only update the `next` docs? It is still true that outbound syncs are not supported in 0.1.x |
supaglue | github_2023 | typescript | 80 | supaglue-labs | tomkit | @@ -0,0 +1,57 @@
+import * as sdk from '@supaglue/sdk';
+import credentials from '../postgres_credentials';
+
+const contactSchema = sdk.schema({
+ fields: [
+ {
+ name: 'salesforce_id',
+ label: 'id',
+ },
+ {
+ name: 'email',
+ },
+ {
+ name: 'first_name',
+ label: 'first name... | is this the same or diff field mapping from the inbound? should they be shared instead? |
supaglue | github_2023 | typescript | 80 | supaglue-labs | tomkit | @@ -219,3 +245,74 @@ async function writeRecordsToWebhook(
sg.internalIntegrations.webhook.request(destination, syncConfigName, syncId, syncRunId, customerId, record);
}
}
+
+async function readRecordsFromInternalIntegration(
+ sg: Supaglue,
+ { source }: OutboundSyncConfig
+): Promise<Record<string, string>... | thoughts on field mapping being part of the activities sdk? cc @lucasmarshall |
supaglue | github_2023 | typescript | 79 | supaglue-labs | tomkit | @@ -9,21 +9,24 @@ import { useActiveTab } from '../../hooks';
// import { Switch } from '@supaglue/nextjs';
export default function Integration() {
+ const router = useRouter();
+ const type = router.query.type as string;
+ const typeCaps = type ? type.charAt(0).toUpperCase() + type.slice(1) : '';
return (
... | nit: can just do `Integration` or `Integration - Salesforce` for simplicity right now |
supaglue | github_2023 | typescript | 77 | supaglue-labs | albertyfwu | @@ -0,0 +1,52 @@
+/*
+ * Resume a customer's sync:
+ *
+ * $ supaglue syncs logs --customer-id 1 --sync-config-name Contacts
+ *
+ */
+
+import { AxiosError } from 'axios';
+import { ArgumentsCamelCase, Argv } from 'yargs';
+import type { BaseArgs } from '../../cli';
+import { UserFacingError } from '../../errors';
+i... | Down the line maybe we can standardize on `start`/`stop` or `resume`/`pause` for consistency |
supaglue | github_2023 | others | 76 | supaglue-labs | lucasmarshall | @@ -260,6 +260,44 @@ You may have realized that two of the columns in the sample app's Contacts table

</BrowserWindow>
+### Customize Theme
+
+Suppose you want to implement dark mode on your application. The sample app... | This won't work when the package is installed via npm, as `src` is not part of the package. We probably want to add this to the nextjs `package.json` in the `exports` field |
supaglue | github_2023 | typescript | 43 | supaglue-labs | tomkit | @@ -0,0 +1,34 @@
+import { Interpolation, Theme } from '@emotion/react';
+import { SgTheme } from './theme';
+
+type UnwrapBooleanVariant<T> = T extends 'true' | 'false' ? boolean : T;
+
+export type StyleRule = Exclude<Interpolation<Theme>, string | number | boolean>;
+
+type VariantDefinition = Record<string, StyleRu... | quick comment |
supaglue | github_2023 | typescript | 43 | supaglue-labs | tomkit | @@ -0,0 +1,6 @@
+import { SgTheme } from '../types/theme'; | quick comment |
supaglue | github_2023 | typescript | 75 | supaglue-labs | khennes | @@ -199,6 +202,30 @@ export class SyncService {
}
}
+ public async resumeSync({ syncId, note }: { syncId: string; note?: string }): Promise<void> {
+ await this.#prisma.sync.update({
+ data: {
+ enabled: true,
+ },
+ where: {
+ id: syncId,
+ },
+ });
+
+ // TODO: Th... | should we log here? |
supaglue | github_2023 | others | 72 | supaglue-labs | lucasmarshall | @@ -34,6 +34,7 @@ model DeveloperConfig {
model Sync {
id String @id @default(uuid())
customerId String @map("customer_id")
+ type String | Probably should make this nullable? Otherwise the migration will fail for current users. |
supaglue | github_2023 | typescript | 73 | supaglue-labs | khennes | @@ -87,13 +87,19 @@ router.get(
never,
any,
never,
- { syncConfigName?: string; customerId?: string; status?: SyncRunStatus; page?: number; count?: number }
+ { syncConfigName?: string; customerId?: string; status?: SyncRunStatus; page?: string; count?: string }
>,
res: Response... | We should pass in the `radix` argument too since it doesn't necessarily default to 10 |
supaglue | github_2023 | typescript | 73 | supaglue-labs | khennes | @@ -0,0 +1,94 @@
+/*
+ * List the sync configs from the server:
+ *
+ * $ supaglue syncs logs --customer-id 1 --status error
+ *
+ */ | Nice, thanks 👍 |
supaglue | github_2023 | typescript | 68 | supaglue-labs | tomkit | @@ -79,4 +79,25 @@ router.post(
posthogErrorMiddleware('Manually Trigger Sync')
);
+router.get(
+ '/logs',
+ posthogMiddleware('Get Sync Logs'), | If above is accurate, then `Sync` --> `Sync Run` |
supaglue | github_2023 | typescript | 68 | supaglue-labs | tomkit | @@ -79,4 +79,25 @@ router.post(
posthogErrorMiddleware('Manually Trigger Sync')
);
+router.get(
+ '/logs',
+ posthogMiddleware('Get Sync Logs'),
+ async (
+ req: Request<
+ never,
+ any,
+ never,
+ { syncConfigName?: string; customerId?: string; status?: SyncRunStatus; page?: number; cou... | same as above |
supaglue | github_2023 | typescript | 68 | supaglue-labs | tomkit | @@ -79,4 +79,25 @@ router.post(
posthogErrorMiddleware('Manually Trigger Sync')
);
+router.get(
+ '/logs', | We're getting sync run logs, not sync logs, correct? |
supaglue | github_2023 | typescript | 68 | supaglue-labs | albertyfwu | @@ -79,4 +79,25 @@ router.post(
posthogErrorMiddleware('Manually Trigger Sync')
);
+router.get(
+ '/run_logs', | Should we nest the sync runs under `/syncs` instead? e.g. `/syncs/:syncId/runs/:runId`? |
supaglue | github_2023 | typescript | 55 | supaglue-labs | asdfryan | @@ -191,6 +191,27 @@ export class SyncService {
}
}
+ public async deleteSyncsForCustomer(customerId: string): Promise<void> {
+ const syncs = await this.#prisma.sync.findMany({
+ where: { customerId },
+ select: { id: true, enabled: true },
+ });
+
+ // Pause all enabled syncs right away
... | What's the point of this? |
supaglue | github_2023 | typescript | 55 | supaglue-labs | asdfryan | @@ -1,27 +1,44 @@
import { css } from '@emotion/react';
-import { indigo, slate } from '@radix-ui/colors';
+import { indigo, red, slate } from '@radix-ui/colors';
-export default {
- button: css({
- alignItems: 'center',
- borderRadius: '0.5rem',
- color: 'white',
- display: 'flex',
- fontSize: '0.87... | Looking ahead to theming -- I had thought we would use the same `disabled` styling for all variants (primary, danger etc.). Do you have a preference? |
supaglue | github_2023 | typescript | 55 | supaglue-labs | asdfryan | @@ -84,4 +91,11 @@ export class IntegrationService {
return fromModelToSafeIntegration(integration);
}
+
+ public async delete(integrationId: string): Promise<void> {
+ // TODO: Wrap in transaction
+ const integration = await this.#prisma.integration.findUniqueOrThrow({ where: { id: integrationId } });... | Should we parallelize these 2? |
supaglue | github_2023 | typescript | 55 | supaglue-labs | asdfryan | @@ -42,4 +42,28 @@ router.post(
posthogErrorMiddleware('Create Integration')
);
+router.delete(
+ '/:integrationId',
+ posthogMiddleware('Delete Integration'),
+ async (req: Request<{ integrationId: string }>, res: Response<Record<string, never>>) => {
+ const integration = await integrationService.getById(... | Non-blocking: Just for my own curiosity, Is this idempotent? What happens if we call this twice? |
supaglue | github_2023 | others | 66 | supaglue-labs | khennes | @@ -92,11 +92,11 @@ For this tutorial, we've included a sample [Developer Config](/concepts#develope
export default accountSyncConfig;
```
- The `syncConfig` function creates a Sync Config that would allow customers to pull all Account records from their Salesforce instance into the sample app's Postgres da... | should we mention that "every 15 minutes" is customizable? |
supaglue | github_2023 | others | 53 | supaglue-labs | asdfryan | @@ -27,6 +27,8 @@ In this step, we will set up the sample application.
1. Open a new terminal window and install the sample app (note: we've bundled it into our monorepo):
+ NOTE: for your convenience, [setup_env.sh](https://github.com/supaglue-labs/supaglue/blob/v0.1.0/apps/sample-app/scripts/setup_env.sh) help... | We have instructions on this now -- maybe a link to that? |
supaglue | github_2023 | others | 47 | supaglue-labs | lucasmarshall | @@ -18,7 +18,7 @@ For this tutorial, we've provided Salesforce Connected App credentials as part o
:::
-1. `cd` into `/apps/sample-app` and start the sample app locally:
+1. `cd` into `/apps/sample-app` if you are not already there and start the sample app locally: | Can we make the cd command a code block and change the path to `apps/sample-app`? |
supaglue | github_2023 | others | 47 | supaglue-labs | lucasmarshall | @@ -42,12 +42,33 @@ For this tutorial, we've included a sample [Developer Config](/concepts#develope
:::
-1. `cd` into `apps/sample-app` and create `supaglue-config/account.ts`. Paste in the following:
+1. Create `account.ts` inside the `/apps/sample-app/supaglue-config` directory. Paste in the following: | ```suggestion
1. Create `account.ts` inside the `apps/sample-app/supaglue-config` directory. Paste in the following:
``` |
supaglue | github_2023 | others | 27 | supaglue-labs | tomkit | @@ -0,0 +1,39 @@
+---
+sidebar_position: 10
+---
+
+# FAQ
+
+### What is Supaglue?
+
+Supaglue is an embedded integrations solution built for developers. The core differentiators are that it's open-source, code-centric, and ships with customizable React components you can embed into your product.
+
+As a result, you ca... | deeper |
supaglue | github_2023 | others | 27 | supaglue-labs | tomkit | @@ -0,0 +1,39 @@
+---
+sidebar_position: 10
+---
+
+# FAQ
+
+### What is Supaglue?
+
+Supaglue is an embedded integrations solution built for developers. The core differentiators are that it's open-source, code-centric, and ships with customizable React components you can embed into your product.
+
+As a result, you ca... | Slack? |
supaglue | github_2023 | others | 27 | supaglue-labs | tomkit | @@ -0,0 +1,39 @@
+---
+sidebar_position: 10
+---
+
+# FAQ
+
+### What is Supaglue?
+
+Supaglue is an embedded integrations solution built for developers. The core differentiators are that it's open-source, code-centric, and ships with customizable React components you can embed into your product.
+
+As a result, you ca... | Should this also be in a reference section in corresponding components? |
supaglue | github_2023 | others | 40 | supaglue-labs | george-xing | @@ -30,13 +31,14 @@ In the coming weeks we plan to ship:
- Developer logs and sync observability
- Server and client authentication
- Development environments
-- More customizable React components
+- Complete React components
+- More customizable React components (hooks) | @tomkit rephrase to "Hooks for building your own React components"? |
supaglue | github_2023 | others | 31 | supaglue-labs | lucasmarshall | @@ -190,3 +192,13 @@ sdk.config({
defaultFieldMapping: contactMapping,
});
```
+
+## Integrations SDK
+
+Internally, Supaglue uses an evolving Integrations SDK that wraps Salesforce and Supaglue Destinations so we can imperatively write business logic for Syncs, which then later get invoked by developers using the... | What is a "Supaglue Destination"? |
supaglue | github_2023 | typescript | 30 | supaglue-labs | lucasmarshall | @@ -7,6 +7,7 @@ import integration from './integration';
import oauth from './oauth';
import sync from './sync';
+// TODO: ENG-105 version and guard routes | Probably should reference the GitHub issue instead |
supaglue | github_2023 | typescript | 30 | supaglue-labs | lucasmarshall | @@ -1,29 +1,26 @@
export type SupaglueAppearance = {
- theme?: 'light';
- layout?: {
- logoPlacement: 'inside' | 'outside' | 'none';
- logoImageUrl: string;
- };
- variables?: {
- colorPrimary?: string;
- colorDanger?: string;
- colorSuccess?: string;
- colorTextOnPrimaryBackground?: string;
- ... | Same as above. |
supaglue | github_2023 | typescript | 30 | supaglue-labs | asdfryan | @@ -1,29 +1,26 @@
export type SupaglueAppearance = {
- theme?: 'light';
- layout?: {
- logoPlacement: 'inside' | 'outside' | 'none';
- logoImageUrl: string;
- };
- variables?: {
- colorPrimary?: string;
- colorDanger?: string;
- colorSuccess?: string;
- colorTextOnPrimaryBackground?: string;
- ... | I would actually just remove these for now since we're still not sure what the interface will look like and don't want to preview anything we're not sure of. |
supaglue | github_2023 | typescript | 28 | supaglue-labs | tomkit | @@ -172,19 +119,20 @@ async function writeRecordsToDestination({
});
}
-async function writeRecordsToPostgres({
- destination,
- fieldMapping,
- mappedRecords,
- customerId,
-}: {
- destination: PostgresDestination;
- fieldMapping: Record<string, string>;
- mappedRecords: Record<string, unknown>[];
- cust... | nit: could these be put until a util to improve readability |
supaglue | github_2023 | others | 12 | supaglue-labs | tomkit | @@ -5,58 +5,62 @@ slug: /
# Introduction
-:::caution
+## What is Supaglue?
-Supaglue is in Public Alpha. There are currently many missing features, interfaces will likely change, and it is not production-ready yet.
+Supaglue is a developer platform for integrating your application with your customer's Salesforce... | "declarative" |
supaglue | github_2023 | typescript | 21 | supaglue-labs | tomkit | @@ -51,13 +51,12 @@ function AppWrapper({ children }: { children: React.ReactNode }) {
<div className="drawer drawer-mobile">
<input id="my-drawer-2" type="checkbox" className="drawer-toggle" />
<div className="drawer-content bg-base-100">{children}</div>
- <div className="flex f... | Ty, I think I couldn't get this to work with a prior attempt manipulating the classes directly |
supaglue | github_2023 | typescript | 20 | supaglue-labs | khennes | @@ -0,0 +1,14 @@
+export const COLORS = {
+ SLATE_1: 'hsl(206 30.0% 98.8%)',
+ SLATE_3: 'hsl(209 13.3% 95.3%)',
+ SLATE_7: 'hsl(207 11.1% 85.9%)',
+ SLATE_8: 'hsl(205 10.7% 78.0%)',
+ SLATE_9: 'hsl(226 58.6% 51.3%)',
+ SLATE_12: 'hsl(206 24.0% 9.0%)',
+ INDIGO_5: 'hsl(224 87.1% 92.0%)',
+ INDIGO_6: 'hsl(224 81.... | Radix Colors should work out of the box with emotion, so we don't have to hardcode the scales anymore: https://www.radix-ui.com/docs/colors/getting-started/usage#emotion |
supaglue | github_2023 | typescript | 20 | supaglue-labs | tomkit | @@ -53,19 +54,18 @@ export const TriggerSyncButtonInternal = ({
};
return integrationConnected ? (
- <button
- className={classNames('sg-buttonLabel', appearance?.elements?.buttonLabel, styles.button)}
+ <Button
+ className={classNames('sg-triggerSyncButton', appearance?.elements?.button)} | Let's chat about our namespaced nomenclature for classes |
supaglue | github_2023 | typescript | 20 | supaglue-labs | tomkit | @@ -0,0 +1,31 @@
+import createCache from '@emotion/cache'; | I think react file convention here is Pascal case? |
supaglue | github_2023 | others | 3 | supaglue-labs | lucasmarshall | @@ -14,7 +14,9 @@
<a href="https://github.com/supaglue-labs/supaglue"><img title="github stars" src="https://img.shields.io/github/stars/supaglue-labs/supaglue?style=social"></a>
</p>
-[Website](https://supaglue.com?ref=github-readme) • [Getting Started](https://docs.supaglue.com/docs/get-started?ref=github-readm... | This won't work. The links also have to be HTML |
supaglue | github_2023 | others | 3 | supaglue-labs | george-xing | @@ -49,11 +51,11 @@ cp .env.sample .env
docker compose up
```
-Continue on to the docs to go through an [integration tutorial](https://docs.supaglue.com/get-started#tutorial).
+Continue on to the docs to go through an [integration tutorial](https://docs.supaglue.com/tutorial).
## Roadmap
-Check out our [roadma... | replace years with quarters |
supaglue | github_2023 | others | 3 | supaglue-labs | george-xing | @@ -69,17 +69,27 @@ We will use the CLI to deploy our syncs and the Apolla.io sample app to test how
Syncs Created: 4, Updated: 0, Deleted: 0, No Change: 0
```
-### Embed a Supaglue React component
-
-To enable users to configure the integration we just deployed, embed a user-facing Supaglue React component i... | I'm not a fan of "wearing your customer hat" framing, because the developer is not pretending to be a customer. They're just testing their code, the same way any full-stack developer would.
I think something "Let's test the sync we just deployed in our sample app" feels more intuitive, as long as we call out in the ... |
supaglue | github_2023 | others | 3 | supaglue-labs | george-xing | @@ -97,37 +107,35 @@ To enable users to configure the integration we just deployed, embed a user-faci
// ...
```
-### Customer configuration
-
-As a customer, let's connect our Salesforce instance to Apolla.io.
+1. Return to Apolla.io, you should see the new switch component
-1. Navigate to Apolla.io ([http... | available* |
tiny-engine | github_2023 | typescript | 1,217 | opentiny | coderabbitai[bot] | @@ -65,5 +65,6 @@ export const initBlockList = async () => {
setBlockContent(list)
} catch (err) {
// 捕获错误
+ throw new Error('获取block列表失败', err) | _⚠️ Potential issue_
**Fix the Error constructor usage**
The Error constructor doesn't accept a second argument for the original error in the way it's currently implemented. Since this is now TypeScript, use the modern Error cause pattern for proper error chaining.
Apply this diff:
```diff
- throw new Error('获取... |
tiny-engine | github_2023 | typescript | 1,217 | opentiny | coderabbitai[bot] | @@ -449,6 +449,7 @@ const fetchPageDetailIfNeeded = async (page) => {
const pageDetail = await http.fetchPageDetail(page.id)
page.page_content = pageDetail.page_content
} catch (error) {
+ throw new Error(error)
page.page_content = {} | _🛠️ Refactor suggestion_
**Improved Error Handling**
Added proper error propagation with `throw new Error(error)` before falling back to setting `page_content` to an empty object. This change ensures errors are properly propagated up the call stack, making debugging easier while still maintaining the fallback behavi... |
tiny-engine | github_2023 | others | 1,217 | opentiny | coderabbitai[bot] | @@ -323,6 +323,7 @@ export default {
await toClipboard(row.key)
copyTipContent.value = '复制成功'
} catch (e) {
+ throw new Error(e) | _⚠️ Potential issue_
**Error handling improvement with explicit error throw.**
Adding `throw new Error(e)` enhances error propagation in case the clipboard operation fails. However, the error is thrown before setting `copyTipContent` to "复制失败", which means this message won't be displayed to users when an error occurs... |
tiny-engine | github_2023 | others | 1,217 | opentiny | coderabbitai[bot] | @@ -282,9 +298,13 @@ class MysqlConnection {
isOfficial = 0,
isDefault = 0,
tiny_reserved = 0,
- tenant = 1,
- createBy = 86,
- updatedBy = 86
+ component_metadata = null,
+ library_id = 1,
+ tenant_id = 1,
+ renter_id = 1,
+ site_id = 1,
+ created_by = ... | _🛠️ Refactor suggestion_
**Added metadata fields require consistent handling.**
You introduced new fields (`component_metadata`, `library_id`, `tenant_id`, `renter_id`, `site_id`, `created_by`, `last_updated_by`). Ensure that other relevant methods—like `updateComponent`—also handle them if necessary. Otherwise, da... |
tiny-engine | github_2023 | others | 1,217 | opentiny | coderabbitai[bot] | @@ -15,9 +15,9 @@ dotenv.config({ path: `${pathsDotenv}.local` })
const { SQL_HOST, SQL_PORT, SQL_USER, SQL_PASSWORD, SQL_DATABASE } = process.env
// 组件表名称
-const componentsTableName = 'user_components'
+const componentsTableName = 't_component' | _💡 Verification agent_
<details>
<summary>🧩 Analysis chain</summary>
**Confirm table name references throughout the codebase.**
Changing the table name to `'t_component'` is fine, but please ensure that all external references to the old table name (`user_components`) have already been updated as well.
You c... |
tiny-engine | github_2023 | others | 1,217 | opentiny | coderabbitai[bot] | @@ -183,6 +183,7 @@ export default {
// await validate() 如果验证不通过会抛出异常,而不是返回 false
await getServiceForm().validate()
} catch (error) {
+ throw new Error('请先完成表单验证', error)
return | _⚠️ Potential issue_
**Fix Error constructor usage and remove unreachable code.**
There are two issues with the error handling implementation:
1. The Error constructor only accepts a message string as its first parameter. The second parameter `error` will be ignored.
2. The `return` statement after throwing the erro... |
tiny-engine | github_2023 | typescript | 1,223 | opentiny | coderabbitai[bot] | @@ -11,7 +11,7 @@
*/
import * as configurator from '@opentiny/tiny-engine-configurator'
-const widgets = {}
+const widgets: any = {} | _🛠️ Refactor suggestion_
**Prefer a more specific type instead of `any`.**
Using `any` erodes type safety; consider defining an appropriate type or generic type parameter.
<!-- This is an auto-generated comment by CodeRabbit --> |
tiny-engine | github_2023 | others | 1,223 | opentiny | hexqi | @@ -6,11 +6,11 @@
</component>
</template>
-<script>
+<script lang="ts">
import { ref, watch, computed } from 'vue'
import CanvasPlaceholder from './CanvasPlaceholder.vue'
import { getController } from '../render'
-import { getHandler } from './CanvasCollection'
+import { getHandler } from './CanvasCollection.... | ts文件后缀不需要加 |
tiny-engine | github_2023 | others | 1,219 | opentiny | coderabbitai[bot] | @@ -26,7 +26,8 @@
"@opentiny/tiny-engine-common": "workspace:*",
"@opentiny/tiny-engine-meta-register": "workspace:*",
"@opentiny/tiny-engine-utils": "workspace:*",
- "@vueuse/core": "^9.6.0"
+ "@vueuse/core": "^9.6.0",
+ "vue-draggable-next": "2.1.0" | _💡 Verification agent_
<details>
<summary>🧩 Analysis chain</summary>
**LGTM: Added vue-draggable-next dependency to support drag functionality**
The addition of the 'vue-draggable-next' library (v2.1.0) supports the PR objectives of enabling users to reposition plugins via dragging and adjust panel width through d... |
tiny-engine | github_2023 | others | 1,219 | opentiny | coderabbitai[bot] | @@ -99,6 +116,28 @@ export default {
isFullScreen: false
})
+ const { getPluginWidth } = useLayout()
+
+ const firstPanelOffset = computed(() => {
+ return getPluginWidth(props.fixedName)
+ })
+
+ const secondPanelAlign = computed(() => {
+ return props.align.includes('left') ? 'left... | _🛠️ Refactor suggestion_
**Avoid direct DOM queries in `watchEffect`**
Relying on `document.querySelector` might cause timing issues in complex UIs. Using a template ref for `.second-panel` or a reactive approach can reduce risk and simplify testing.
<!-- This is an auto-generated comment by CodeRabbit --> |
tiny-engine | github_2023 | others | 1,219 | opentiny | coderabbitai[bot] | @@ -104,15 +135,39 @@ export default {
const { message } = useModal()
const pluginState = useLayout().getPluginState()
- props.plugins.forEach(({ id, entry, icon }) => {
- components[id] = entry
- iconComponents[id] = icon
- })
+ const {
+ getPluginById,
+ getPluginShown,
+ ... | _💡 Verification agent_
<details>
<summary>🧩 Analysis chain</summary>
**Assess removal from other lists upon alignment change.**
You unshift the plugin into the top list but do not explicitly remove it from the bottom list. Ensure this function won’t produce duplicates if a plugin was already in the other list.
... |
tiny-engine | github_2023 | others | 1,219 | opentiny | coderabbitai[bot] | @@ -1,130 +1,317 @@
+<!-- 右侧插件栏 -->
<template>
- <div id="tiny-right-panel">
- <tiny-tabs v-model="layoutState.settings.render">
- <tiny-tab-item v-for="(setting, index) in settings" :key="index" :title="setting.title" :name="setting.name">
- <component :is="setting.entry"></component>
- <div v-... | _🛠️ Refactor suggestion_
**Consolidate duplicate `.not-selected` definitions.**
`.not-selected` is declared twice, the second time omitting `pointer-events: none;`. This can cause confusion about which style rules apply.
Consider removing one definition or merging them into a single rule:
```diff
-.not-selected... |
tiny-engine | github_2023 | javascript | 1,219 | opentiny | coderabbitai[bot] | @@ -41,6 +62,49 @@ const layoutState = reactive({
},
pageStatus: ''
})
+const getMoveDragBarState = () => {
+ return layoutState.isMoveDragBar
+}
+const changeMoveDragBarState = (state) => {
+ layoutState.isMoveDragBar = state
+}
+const leftMenuShownStorage = useStorage('leftMenuShown', layoutState.plugins.isS... | _🛠️ Refactor suggestion_
**Check for plugin name collisions.**
`registerPluginApi` merges new APIs into `layoutState.plugins.api`. If two plugins register the same key or you have accidental overlap in plugin naming, it can overwrite existing APIs.
Propose storing plugin APIs under unique sub-objects, e.g. `plug... |
tiny-engine | github_2023 | javascript | 1,219 | opentiny | coderabbitai[bot] | @@ -90,16 +151,178 @@ const closePlugin = (forceClose) => {
const isEmptyPage = () => layoutState.pageStatus?.state === PAGE_STATUS.Empty
export default () => {
+ let plugin = []
+
+ try {
+ const storedPlugin = localStorage.getItem('plugin')
+ if (storedPlugin) {
+ plugin = JSON.parse(storedPlugin)
+ ... | _🛠️ Refactor suggestion_
**Add error handling for changePluginShown.**
The `changePluginShown` function assumes that `pluginStorageReactive.value[name]` exists, but doesn't check for this condition. Consider adding validation to prevent runtime errors.
```diff
const changePluginShown = (name) => {
+ if (!pluginSt... |
tiny-engine | github_2023 | javascript | 1,219 | opentiny | hexqi | @@ -20,9 +20,7 @@ import './src/styles/vars.less'
export default {
...metaData,
entry,
- options: {
- commonEvents
- },
+ options: Object.assign({}, commonEvents, metaData.options), | 这里是不是逻辑不对?之前options里面有commonEvents字段,现在相当于把commonEvents展开了 |
tiny-engine | github_2023 | javascript | 1,219 | opentiny | hexqi | @@ -46,7 +46,7 @@ export const META_APP = {
Collections: 'engine.plugins.collections',
Bridge: 'engine.plugins.bridge',
I18n: 'engine.plugins.i18n',
- Page: 'engine.plugins.pagecontroller',
+ Page: 'engine.plugins.pagecontroller', // 页面 JS | 这里的注释写错了吧 |
tiny-engine | github_2023 | javascript | 1,219 | opentiny | hexqi | @@ -26,12 +41,18 @@ const layoutState = reactive({
height: '100%'
},
plugins: {
+ isShow: true,
fixedPanels: [PLUGIN_NAME.Materials],
- render: null,
- pluginEvent: 'all'
+ render: PLUGIN_NAME.Materials,
+ pluginEvent: 'all',
+ api: {}, // 插件需要注册交互API到这里
+ activating: false, // 右侧面版... | plugins和settings可以合并了吧 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.