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
1,269
supaglue-labs
tomkit
@@ -4,41 +4,41 @@ const { IndexedValueType } = temporal.api.enums.v1; export const TEMPORAL_CUSTOM_SEARCH_ATTRIBUTES = { SYNC_ID: 'SyncId', + ENTITY_ID: 'EntityId', OBJECT_TYPE: 'ObjectType', OBJECT_NAME: 'ObjectName', APPLICATION_ID: 'ApplicationId', APPLICATION_ENV: 'ApplicationEnv', CUSTOMER_ID...
why remove this? iirc there was some limit to the number of attrs?
supaglue
github_2023
others
1,269
supaglue-labs
lucasmarshall
@@ -0,0 +1,32 @@ +type: object +properties: + entity_id: + type: string + object: + allOf: + - $ref: ./standard_or_custom_object.yaml
Do the docs get generated correctly here?
supaglue
github_2023
others
1,269
supaglue-labs
lucasmarshall
@@ -1,27 +1,48 @@ -type: object -properties: - id: - type: string - object_type: - type: string - enum: - - common - - standard - - custom - object: - type: string - connection_id: - type: string - example: 3217ea51-11c8-43c9-9547-6f197e02e5e4 - sync_config_id: - type: string - ...
Do the docs get generated correctly here?
supaglue
github_2023
others
1,269
supaglue-labs
lucasmarshall
@@ -1,58 +1,69 @@ -type: object -properties: - error_message: - type: string - nullable: true - start_timestamp: - type: string - example: 2023-02-22T19:55:17.559537Z - end_timestamp: - type: string - nullable: true - example: 2023-02-22T20:55:17.559537Z - application_id: - type: string - ...
Do the docs get generated correctly here?
supaglue
github_2023
typescript
1,269
supaglue-labs
lucasmarshall
@@ -0,0 +1,57 @@ +import type { Connection as ConnectionModel, Sync as SyncModel } from '@supaglue/db'; +import type { ObjectType, Sync, SyncDTO, SyncState, SyncStrategyType } from '@supaglue/types/sync'; +import { parseCustomerIdPk } from '../lib'; + +export const fromSyncModel = (model: SyncModel): Sync => { + // `s...
Maybe "incorrectly configured sync" would be a better wording?
supaglue
github_2023
typescript
1,269
supaglue-labs
lucasmarshall
@@ -0,0 +1,49 @@ +import type { ObjectType } from '@supaglue/types/sync'; +import type { SyncRun, SyncRunStatus, SyncRunWithObjectOrEntity } from '@supaglue/types/sync_run'; +import { parseCustomerIdPk } from '../lib/customer_id'; +import type { SyncRunModelExpanded, SyncRunModelExpandedWithObjectAndEntity } from '../t...
Same here, but I don't have a suggestion for what it should be changed to.
supaglue
github_2023
typescript
1,269
supaglue-labs
asdfryan
@@ -4,41 +4,41 @@ const { IndexedValueType } = temporal.api.enums.v1; export const TEMPORAL_CUSTOM_SEARCH_ATTRIBUTES = { SYNC_ID: 'SyncId', + SYNC_TYPE: 'SyncType', OBJECT_TYPE: 'ObjectType', OBJECT_NAME: 'ObjectName', + ENTITY_ID: 'EntityId',
Entity name instead of entity id
supaglue
github_2023
typescript
1,269
supaglue-labs
asdfryan
@@ -325,6 +331,34 @@ function SyncConfigDetailsPanelImpl({ syncConfigId }: SyncConfigDetailsPanelImpl }} /> </Stack> + <Stack className="gap-2"> + <Typography variant="subtitle1">Entities</Typography> + <Autocomplete + ...
multiple entities
supaglue
github_2023
typescript
1,269
supaglue-labs
asdfryan
@@ -45,13 +47,20 @@ export default function SyncsTable(props: SyncsTableProps) { checked={params.row.paused} onChange={async (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => { if (checked) { - const response = await pauseSync( - a...
Check `type` instead
supaglue
github_2023
typescript
1,275
supaglue-labs
lucasmarshall
@@ -109,13 +109,13 @@ export default function init(app: Router): void { const authorizationUri = client.authorizeURL({ redirect_uri: REDIRECT_URI, - scope: oauthScopes, + scope: provider.name === 'salesloft' ? oauthScopes : [],
This doesn't seem correct...
supaglue
github_2023
typescript
1,270
supaglue-labs
asdfryan
@@ -35,6 +39,30 @@ export default function init(app: Router): void { } ); + connectionRouter.get( + '/_provider_user_id', + async ( + req: Request< + GetProviderUserIdPathParams, + GetProviderUserIdResponse, + GetProviderUserIdRequest, + GetProvideruserIdQueryParams + ...
Should we throw a bad request error if the provider is not msft365?
supaglue
github_2023
others
1,270
supaglue-labs
asdfryan
@@ -0,0 +1,36 @@ +get: + operationId: getProviderUserId + summary: Get provider logged in user ID + tags: + - Connections + security: + - ApiKeyAuth: [] + parameters: + - name: provider_name + in: query + required: true + schema: + type: string
We have a provider_name enum. (provider_name.yaml)
supaglue
github_2023
others
1,261
supaglue-labs
albertyfwu
@@ -12,6 +12,11 @@ properties: enum: - full then incremental - full only + auto_start_on_connection: + type: boolean + description: | + If true, the sync will start automatically when the connection is created. + Default: true
did you mean to make `Default` lowercase and part of the openapi spec, or just a comment?
supaglue
github_2023
typescript
1,252
supaglue-labs
tomkit
@@ -0,0 +1,24 @@ +import type { ConnectionUnsafe, Provider } from '@supaglue/types'; +import type { ConnectorAuthConfig } from '../../base'; +import { AbstractEngagementRemoteClient } from '../../categories/engagement/base'; + +class ApolloClient extends AbstractEngagementRemoteClient { + public constructor() { + s...
nit: leave comment about api key only?
supaglue
github_2023
typescript
1,254
supaglue-labs
albertyfwu
@@ -89,6 +91,18 @@ export const fromDestinationModelToSafe = (model: DestinationModel): Destination }, }; } + case 'mongodb': {
oops my bad
supaglue
github_2023
typescript
1,254
supaglue-labs
albertyfwu
@@ -279,7 +279,7 @@ function streamToMongoDBCollection(collection: Collection, client: MongoClient, documents.map((document) => ({ replaceOne: { filter: { - _id: document.id, + _id: document.id ?? document._id,
in what scenario do we have `_id` or `id`? do we set this when pulling from provider?
supaglue
github_2023
typescript
1,253
supaglue-labs
tomkit
@@ -1,19 +1,43 @@ -import type { ConnectionUnsafe, Provider } from '@supaglue/types'; +import type { + ConnectionUnsafe, + Provider, + SendPassthroughRequestRequest, + SendPassthroughRequestResponse, +} from '@supaglue/types'; import type { ConnectorAuthConfig } from '../../base'; import { AbstractEngagementRemot...
HTTP GETs don't have a body so it's not an API convention thing, but related to the HTTP protocol
supaglue
github_2023
typescript
1,253
supaglue-labs
albertyfwu
@@ -1,19 +1,43 @@ -import type { ConnectionUnsafe, Provider } from '@supaglue/types'; +import type { + ConnectionUnsafe, + Provider, + SendPassthroughRequestRequest, + SendPassthroughRequestResponse, +} from '@supaglue/types'; import type { ConnectorAuthConfig } from '../../base'; import { AbstractEngagementRemot...
how do we know that the body has to be JSON? do we want to make that assumption for all providers? If we're going to assume that the body is JSON, we should just change the openAPI spec to say this is object, and not string.
supaglue
github_2023
typescript
1,240
supaglue-labs
tomkit
@@ -99,6 +100,36 @@ export default function SyncsTable(props: SyncsTableProps) { ); }, }, + { + field: '_', + headerName: 'Actions', + width: 120, + sortable: false, + renderCell: (params) => { + // button to trigger sync run + return ( + <Button +...
nit: `size="small"`
supaglue
github_2023
others
1,239
supaglue-labs
albertyfwu
@@ -1,45 +1,65 @@ -allOf: +oneOf:
why is this necessary? is there a bug with the generated code?
supaglue
github_2023
others
1,239
supaglue-labs
albertyfwu
@@ -1,5 +1,6 @@ -allOf: +oneOf:
same comment here
supaglue
github_2023
others
1,239
supaglue-labs
albertyfwu
@@ -0,0 +1,20 @@ +type: object +properties: + host: + type: string + example: mongodb.company.com + database:
port is missing here
supaglue
github_2023
typescript
1,239
supaglue-labs
albertyfwu
@@ -0,0 +1,330 @@ +import type { + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + ConnectionSafeAny, + MongoDBDestination, + NormalizedRawRecord, + ProviderCategory, + ProviderName, +} from '@supaglue/types'; +import type { CRMCommonObjectType } from '@supaglue/types/crm'; ...
not just scoped to this PR, but i noticed this `common object objects` in a bunch of places. could we replace them all with `common object records`?
supaglue
github_2023
others
1,239
supaglue-labs
tomkit
@@ -0,0 +1,58 @@ +--- +description: '' +--- + +# MongoDB + +## Overview + +:::info +Supaglue currently only supports MongoDB Atlas. +::: + +| Feature | Available | +| ------------------------------------ | --------- | +| Syncs: Full refresh | Yes | +| Syncs: Increment...
Can you go through the steps for users to provide a separate account for Supaglue's purposes
supaglue
github_2023
others
1,235
supaglue-labs
tomkit
@@ -11,12 +11,17 @@ description: '' Supaglue interfaces with the Gong V2 API. -| Feature | Available | -| -------------------------- | --------- | -| Auth | No | -| Managed syncs | No | -| Point reads | No | -| Action API ...
why camelcase?
supaglue
github_2023
typescript
1,226
supaglue-labs
albertyfwu
@@ -50,29 +50,14 @@ export class ConnectionAndSyncService { this.#connectionService = connectionService; } - public async triggerSync( - applicationId: string, - objectSyncId: string, - performFullRefresh: boolean - ): Promise<ObjectSync> { - const sync = await this.#prisma.objectSync.findFirst(...
do we want this check? it might be fine to allow triggers while paused
supaglue
github_2023
typescript
1,226
supaglue-labs
albertyfwu
@@ -82,13 +67,49 @@ export class ConnectionAndSyncService { }); // Trigger a run in Temporal - const handle = this.#temporalClient.schedule.getHandle(getRunObjectSyncScheduleId(objectSyncId)); + const handle = this.#temporalClient.schedule.getHandle(getRunObjectSyncScheduleId(objectSync.id)); // ...
nit: `pausedState`
supaglue
github_2023
typescript
1,226
supaglue-labs
albertyfwu
@@ -439,6 +434,10 @@ WHERE c.provider_id = '${syncConfig.providerId}'`); intervals: [newInterval], }, action, + state: { + ...prev.state, + paused: objectSync.paused,
seems to look right. did this work in testing?
supaglue
github_2023
others
1,217
supaglue-labs
albertyfwu
@@ -32,7 +32,7 @@ allOf: - type - config - type: object - title: postgres + title: bigquery
nice catch
supaglue
github_2023
others
1,217
supaglue-labs
albertyfwu
@@ -0,0 +1,66 @@ +--- +description: '' +--- + +# BigQuery + +## Overview + +| Feature | Available | +| ------------------------------------ | --------- | +| Syncs: Full refresh | Yes | +| Syncs: Incremental refresh | Yes | +| Syncs: Supports incrementa...
should we put this in a central place instead?
supaglue
github_2023
others
1,217
supaglue-labs
george-xing
@@ -0,0 +1,66 @@ +--- +description: '' +--- + +# BigQuery + +## Overview + +| Feature | Available | +| ------------------------------------ | --------- | +| Syncs: Full refresh | Yes | +| Syncs: Incremental refresh | Yes | +| Syncs: Supports incrementa...
@lucasmarshall fix references to postgres?
supaglue
github_2023
typescript
1,221
supaglue-labs
albertyfwu
@@ -42,7 +42,12 @@ export default function init(app: Router): void { req.params.connection_id, req.supaglueApplication.id ); - return res.status(200).send(snakecaseKeys(connection)); + + // encrich with user_id, if we can.
typo: enrich
supaglue
github_2023
others
1,222
supaglue-labs
albertyfwu
@@ -140,7 +140,7 @@ model ObjectSync { updatedAt DateTime @updatedAt @map("updated_at") runs ObjectSyncRun[] - @@unique([connectionId, object]) + @@unique([connectionId, object, objectType])
might be better to have `objectType` before `object`, but this works
supaglue
github_2023
typescript
1,202
supaglue-labs
albertyfwu
@@ -1,12 +1,14 @@ import type { Destination as DestinationModel } from '@supaglue/db'; import type { Destination } from '@supaglue/types'; +import { camelcaseKeys } from '@supaglue/utils'; export const fromDestinationModel = (model: DestinationModel): Destination => { + const config = model.config as any; retu...
is there any way to make bigquery camelcasing/snakecasing consistent with the other destinations? why does bigquery need this special mapping?
supaglue
github_2023
typescript
1,202
supaglue-labs
albertyfwu
@@ -0,0 +1,1389 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
what does this setting do? does this create the temp table if it doesn't exist? if so, does this obviate the need for `await client.dataset(dataset).createTable(table, { schema: getCommonObjectSchema(category, commonObjectType) });` ?
supaglue
github_2023
typescript
1,202
supaglue-labs
albertyfwu
@@ -0,0 +1,1389 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
nit: adjust comment text for bigquery
supaglue
github_2023
typescript
1,202
supaglue-labs
albertyfwu
@@ -0,0 +1,1389 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
same question here
supaglue
github_2023
typescript
1,202
supaglue-labs
albertyfwu
@@ -0,0 +1,1389 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
same nit about comment text
supaglue
github_2023
others
1,202
supaglue-labs
tomkit
@@ -7,27 +7,39 @@ allOf: required: - name - oneOf: - - type: object - title: s3 - properties: - type: - type: string - enum: - - s3 - config: - $ref: ./objects/s3_config.yaml - required: - - type - - config - - type: o...
bigquery?
supaglue
github_2023
typescript
1,202
supaglue-labs
tomkit
@@ -0,0 +1,1391 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
Would this work if we evolve our common object schema?
supaglue
github_2023
typescript
1,202
supaglue-labs
tomkit
@@ -0,0 +1,1391 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
Same comment as above: this will cause issues if we evolve our schema and there is a dangling temp table (?)
supaglue
github_2023
typescript
1,202
supaglue-labs
tomkit
@@ -0,0 +1,1391 @@ +import type { TableSchema } from '@google-cloud/bigquery'; +import { BigQuery } from '@google-cloud/bigquery'; +import { ApiError } from '@google-cloud/common'; +import type { + BigQueryDestination, + CommonObjectType, + CommonObjectTypeForCategory, + CommonObjectTypeMapForCategory, + Connectio...
Do we need to potentially remove dangling temp tables?
supaglue
github_2023
typescript
1,197
supaglue-labs
asdfryan
@@ -447,6 +458,348 @@ ${modifiedAfter ? `WHERE SystemModstamp > ${modifiedAfter.toISOString()} ORDER B return await super.sendPassthroughRequest(request); } + public override async getCustomObject(id: string): Promise<CustomObject> { + if (!id.endsWith('__c')) { + // Salesforce doesn't actually enfor...
This should be a 4xx and not a 5xx right?
supaglue
github_2023
typescript
1,197
supaglue-labs
asdfryan
@@ -447,6 +458,348 @@ ${modifiedAfter ? `WHERE SystemModstamp > ${modifiedAfter.toISOString()} ORDER B return await super.sendPassthroughRequest(request); } + public override async getCustomObject(id: string): Promise<CustomObject> { + if (!id.endsWith('__c')) { + // Salesforce doesn't actually enfor...
Nit: else is redundant
supaglue
github_2023
others
1,197
supaglue-labs
asdfryan
@@ -19,6 +19,9 @@ properties: required: - singular - plural + primary_field_key_name:
Can you add a description?
supaglue
github_2023
typescript
1,197
supaglue-labs
asdfryan
@@ -447,6 +458,367 @@ ${modifiedAfter ? `WHERE SystemModstamp > ${modifiedAfter.toISOString()} ORDER B return await super.sendPassthroughRequest(request); } + public override async getCustomObject(id: string): Promise<CustomObject> { + if (!id.endsWith('__c')) { + // Salesforce doesn't actually enfor...
We should document this in the API spec
supaglue
github_2023
typescript
1,197
supaglue-labs
asdfryan
@@ -447,6 +458,367 @@ ${modifiedAfter ? `WHERE SystemModstamp > ${modifiedAfter.toISOString()} ORDER B return await super.sendPassthroughRequest(request); } + public override async getCustomObject(id: string): Promise<CustomObject> { + if (!id.endsWith('__c')) { + // Salesforce doesn't actually enfor...
We should document this in the API spec
supaglue
github_2023
typescript
1,197
supaglue-labs
tomkit
@@ -447,6 +458,372 @@ ${modifiedAfter ? `WHERE SystemModstamp > ${modifiedAfter.toISOString()} ORDER B return await super.sendPassthroughRequest(request); } + public override async getCustomObject(id: string): Promise<CustomObject> { + if (!id.endsWith('__c')) { + // Salesforce doesn't actually enfor...
Are these documented in openapi?
supaglue
github_2023
typescript
1,191
supaglue-labs
lucasmarshall
@@ -54,6 +54,8 @@ export default function ProviderDetailsPanel({ providerName, category, isLoading const [customObjects, setCustomObjects] = useState<ProviderObject[]>([]); const router = useRouter(); + const supportsObjectToSchema = ['salesforce', 'hubspot', 'pipedrive'].includes(providerName);
This should probably be a constant somewhere?
supaglue
github_2023
typescript
1,193
supaglue-labs
lucasmarshall
@@ -54,6 +54,8 @@ export default function ProviderDetailsPanel({ providerName, category, isLoading const [customObjects, setCustomObjects] = useState<ProviderObject[]>([]); const router = useRouter(); + const supportsObjectToSchema = ['salesforce', 'hubspot', 'pipedrive'].includes(providerName);
This should probably be a constant somewhere (also was in another PR)
supaglue
github_2023
typescript
1,185
supaglue-labs
asdfryan
@@ -0,0 +1,80 @@ +import { getDependencyContainer } from '@/dependency_container'; +import { BadRequestError } from '@supaglue/core/errors'; +import { toPaginationInternalParams } from '@supaglue/core/lib'; +import type { + GetSyncsPathParams, + GetSyncsQueryParams, + GetSyncsRequest, + GetSyncsResponse, + Trigger...
IMO it's weird that the query params are `object` and `object_type` given that our representation of an `object` is a complex object with 2 fields -- feels like it should be `name` and `type`, or `object_name` and `object_type`.
supaglue
github_2023
typescript
1,185
supaglue-labs
asdfryan
@@ -0,0 +1,80 @@ +import { getDependencyContainer } from '@/dependency_container'; +import { BadRequestError } from '@supaglue/core/errors'; +import { toPaginationInternalParams } from '@supaglue/core/lib'; +import type { + GetSyncsPathParams, + GetSyncsQueryParams, + GetSyncsRequest, + GetSyncsResponse, + Trigger...
Shouldn't these also be required?
supaglue
github_2023
typescript
1,185
supaglue-labs
asdfryan
@@ -0,0 +1,80 @@ +import { getDependencyContainer } from '@/dependency_container'; +import { BadRequestError } from '@supaglue/core/errors'; +import { toPaginationInternalParams } from '@supaglue/core/lib'; +import type { + GetSyncsPathParams, + GetSyncsQueryParams, + GetSyncsRequest, + GetSyncsResponse, + Trigger...
Why do you need to have the sync_id to trigger and not the object name, type, customer etc.
supaglue
github_2023
typescript
1,185
supaglue-labs
asdfryan
@@ -0,0 +1,22 @@ +import type { ObjectSync as ObjectSyncModel } from '@supaglue/db'; +import type { ObjectSync, ObjectSyncState, ObjectSyncType, ObjectType } from '@supaglue/types/object_sync'; + +export const fromObjectSyncModel = (model: ObjectSyncModel): ObjectSync => { + // `strategy` looks like { type: 'full then...
What happens if you don't do the type assertion here?
supaglue
github_2023
typescript
1,185
supaglue-labs
asdfryan
@@ -47,6 +50,45 @@ export class ConnectionAndSyncService { this.#connectionService = connectionService; } + public async triggerSync( + applicationId: string, + objectSyncId: string, + performFullRefresh: boolean + ): Promise<ObjectSync> { + const sync = await this.#prisma.objectSync.findFirst({...
Shouldn't we also update sync logs? Right now it might leave it in an awkward started but never finished state.
supaglue
github_2023
typescript
1,186
supaglue-labs
albertyfwu
@@ -186,6 +186,43 @@ export async function deleteSyncConfig(applicationId: string, syncConfigId: stri return await toClientEmptyResponse(result); } +export async function createSchema(applicationId: string, data: Omit<Schema, 'id'>): Promise<ClientResponse<Schema>> { + const result = await fetch(`/api/internal/s...
Why not have the same path and just distinguish on `method`?
supaglue
github_2023
typescript
1,180
supaglue-labs
albertyfwu
@@ -21,7 +21,7 @@ export default function ProviderCard({ return ( <Card classes={{ - root: 'h-48 justify-between flex flex-col overflow-y-hidden', + root: 'min-h-48 justify-between flex flex-col overflow-y-hidden',
why does this work but `h-48` doesn't work?
supaglue
github_2023
typescript
1,174
supaglue-labs
asdfryan
@@ -16,44 +19,86 @@ export class RemoteService { this.#providerService = providerService; } - public async getRemoteClient(connectionId: string): Promise<CrmRemoteClient | EngagementRemoteClient> { + // TODO: Abstract some of the logic in these methods into a common method + + public async getCrmRemoteClie...
We don't need this check anymore now that it's required.
supaglue
github_2023
others
1,166
supaglue-labs
albertyfwu
@@ -53,7 +53,7 @@ done jq '.[0:2]' docs/versions.json > docs/versions.json.tmp && mv docs/versions.json.tmp docs/versions.json echo "Building docs..." -yarn workspace docs build > /dev/null +yarn build --filter "...docs" > /dev/null
what's the difference?
supaglue
github_2023
typescript
1,176
supaglue-labs
albertyfwu
@@ -4,7 +4,9 @@ const { IndexedValueType } = temporal.api.enums.v1; export const TEMPORAL_CUSTOM_SEARCH_ATTRIBUTES = { SYNC_ID: 'SyncId', + OBJECT_TYPE: 'ObjectType',
did we purposely leave out `object_name`?
supaglue
github_2023
typescript
1,159
supaglue-labs
albertyfwu
@@ -521,6 +528,29 @@ class PipedriveClient extends AbstractCrmRemoteClient { await this.maybeRefreshAccessToken(); return await super.sendPassthroughRequest(request); } + + public handleErr(err: unknown): unknown {
can you add `override` to make it clear that this is an override?
supaglue
github_2023
typescript
1,160
supaglue-labs
albertyfwu
@@ -151,8 +151,9 @@ DO UPDATE SET (${columnsToUpdateStr}) = (${excludedColumnsToUpdateStr})`, columns, cast: { boolean: (value: boolean) => value.toString(), - object: (value: object) => JSON.stringify(value), + object: (value: object) => JSON.stringify(value).replace(/\\u...
we still need to update the third callsite for cache invalidation, further up in this file
supaglue
github_2023
typescript
1,161
supaglue-labs
albertyfwu
@@ -353,3 +356,16 @@ function SyncConfigDetailsPanelImpl({ syncConfigId }: SyncConfigDetailsPanelImpl </div> ); } + +const getStandardObjectOptions = (provider: Provider | undefined): string[] => { + switch (provider?.name) { + case 'hubspot': { + return [...HUBSPOT_STANDARD_OBJECT_TYPES];
why do we need to make a copy?
supaglue
github_2023
typescript
1,164
supaglue-labs
albertyfwu
@@ -268,7 +268,10 @@ export default function S3DestinationDetailsPanel({ isLoading }: S3DestinationDe > Back </Button> - {isTestSuccessful ? <SaveButton /> : <TestButton />} + <Stack direction="row" className="gap-2"> + <TestButton /> + <SaveBut...
shouldn't we also disable save button before test goes through successfully?
supaglue
github_2023
typescript
1,157
supaglue-labs
albertyfwu
@@ -35,6 +42,29 @@ export default function init(app: Router): void { } ); + connectionRouter.post( + '/:connection_id/_list_properties',
should we make this RESTful? GET and treat properties as first-class? or not because we don't store properties directly in our system?
supaglue
github_2023
typescript
1,157
supaglue-labs
albertyfwu
@@ -360,7 +361,7 @@ class HubSpotClient extends AbstractCrmRemoteClient { } private async getStandardPropertiesToFetch(objectType: string, fieldMappingConfig?: FieldMappingConfig) { - const availableProperties = await this.getObjectTypeProperties(objectType); + const availableProperties = await this.listP...
can you remove `raw`? we moved away from `rawObjects` nomenclature
supaglue
github_2023
typescript
1,157
supaglue-labs
albertyfwu
@@ -29,3 +29,20 @@ export type CategoryOfProviderName<T extends ProviderName> = T extends CRMProvid export type CommonModelForCategory<T extends ProviderCategory> = T extends 'crm' ? CRMCommonModelType : EngagementCommonModelType; + +export type ObjectDef<T extends ProviderCategory> = CommonObject<T> | StandardO...
do we need to do this complicated union? why not just ``` { type: 'common' | 'standard' | 'custom'; name: string; } ```
supaglue
github_2023
others
1,149
supaglue-labs
albertyfwu
@@ -0,0 +1,26 @@ +allOf: + - type: object + properties: + name: + type: string + example: object_name + type: + type: string + enum: + - common + - standard + - custom + enable_sync:
why is this in this endpoint and not on the syncconfig? is this a shortcut/convenience feature?
supaglue
github_2023
typescript
1,149
supaglue-labs
albertyfwu
@@ -52,6 +55,19 @@ export default function init(app: Router): void { } ); + providerRouter.post( + '/:provider_id/add_object',
i thought we have a convention for prefixing non-REST-ful interfaces with underscore. wdyt? also, is an alternative path `'/:provider_id/objects'`?
supaglue
github_2023
typescript
1,149
supaglue-labs
albertyfwu
@@ -48,7 +48,7 @@ export const fromProviderModel = async ({ config: await fromProviderConfigModel(config, { managedOauthConfig: managedOAuthConfigs[name], }), - objects, + objects: objects ? objects : undefined,
nit: `objects ?? undefined`
supaglue
github_2023
typescript
1,149
supaglue-labs
albertyfwu
@@ -65,6 +75,56 @@ export class ProviderService { return fromProviderModel(createdProvider); } + public async addObject( + providerId: string, + applicationId: string, + params: AddObjectToProviderParams + ): Promise<Provider> { + if (params.schemaId && params.schema) {
how is this possible? i thought the openapi spec has `oneOf` for this
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -1,27 +1,39 @@ import { getDependencyContainer } from '@/dependency_container'; import { toPaginationInternalParams } from '@supaglue/core/lib'; import { - GetSyncHistoryPathParams, - GetSyncHistoryQueryParams, - GetSyncHistoryRequest, - GetSyncHistoryResponse, + GetSyncRunsPathParams, + GetSyncRunsQueryPar...
BadRequestError
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -49,6 +50,43 @@ export class ConnectionAndSyncService { this.#connectionService = connectionService; } + public async moveToObjectSyncs(): Promise<void> {
Add a TODO to delete? Plus file ticket
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -49,6 +50,43 @@ export class ConnectionAndSyncService { this.#connectionService = connectionService; } + public async moveToObjectSyncs(): Promise<void> { + // Delete all the current syncs + const syncs = await this.#prisma.sync.findMany({ + select: { + id: true, + }, + }); + ...
Should this be upsert instead? we may need to call this multiple times if something goes wrong.
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -116,110 +153,90 @@ export class ConnectionAndSyncService { credentials: await encrypt(JSON.stringify(params.credentials)), }, }); - if (syncConfig && syncConfig.config.defaultConfig.startSyncOnConnectionCreation) { - // Old syncs - await tx.sync.create({ - ...
upsert
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -116,110 +153,90 @@ export class ConnectionAndSyncService { credentials: await encrypt(JSON.stringify(params.credentials)), }, }); - if (syncConfig && syncConfig.config.defaultConfig.startSyncOnConnectionCreation) { - // Old syncs - await tx.sync.create({ - ...
Should we take this opportunity to rename to just `incremental`?
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -116,110 +153,90 @@ export class ConnectionAndSyncService { credentials: await encrypt(JSON.stringify(params.credentials)), }, }); - if (syncConfig && syncConfig.config.defaultConfig.startSyncOnConnectionCreation) { - // Old syncs - await tx.sync.create({ - ...
Upsert here and elsewhere
supaglue
github_2023
typescript
1,147
supaglue-labs
asdfryan
@@ -130,7 +130,6 @@ function SyncConfigDetailsPanelImpl({ syncConfigId }: SyncConfigDetailsPanelImpl defaultConfig: { periodMs: syncPeriodSecs ? syncPeriodSecs * 1000 : ONE_HOUR_SECONDS, strategy, - startSyncOnConnectionCreation: true,
If we always start, then the syncs will fail if there is a schema that has unmapped fields. Maybe file a ticket?
supaglue
github_2023
others
1,147
supaglue-labs
asdfryan
@@ -0,0 +1,57 @@ +type: object +properties: + error_message: + type: string + nullable: true + start_timestamp: + type: string + example: 2023-02-22T19:55:17.559537Z + end_timestamp: + type: string + nullable: true + example: 2023-02-22T20:55:17.559537Z + application_id: + type: string + ...
Why is this not required?
supaglue
github_2023
others
1,148
supaglue-labs
asdfryan
@@ -155,19 +155,27 @@ Sometimes, your customers may store data in non-standard fields (e.g. custom fie "schema": { "fields": [ { - "name": "the_description", - "mapped_name": "Description" + "name": "description", // field in your system
FYI we've moved out the schema from the sync configuration. (I think our current documentation says it's part of the sync config)
supaglue
github_2023
others
1,148
supaglue-labs
albertyfwu
@@ -85,6 +87,9 @@ This feature is only supported for some destinations, not all. ::: +## Field mappings +[Field mappings](../platform/field-mapping) can be used in the Actions API to reverse-map fields from your system to your customer's fields if you opted to use field mappings for Managed Syncs.
do we need to say `reverse-map`? is `map` sufficient?
supaglue
github_2023
others
1,148
supaglue-labs
albertyfwu
@@ -0,0 +1,43 @@ +--- +description: '' +--- + +# Field mapping + +Sometimes, your customers may store data in non-standard fields (e.g. custom fields). You can optionally specify a `schema` object in the sync configuration so that each of your customers can map their specific source schema to your product's data model:...
did you mean "map one of your customer's standard fields to `primary_address` and one of their custom fields to `revenue`" ?
supaglue
github_2023
others
1,148
supaglue-labs
albertyfwu
@@ -0,0 +1,43 @@ +--- +description: '' +--- + +# Field mapping + +Sometimes, your customers may store data in non-standard fields (e.g. custom fields). You can optionally specify a `schema` object in the sync configuration so that each of your customers can map their specific source schema to your product's data model:...
@asdfryan i think this is going away soon
supaglue
github_2023
typescript
1,146
supaglue-labs
lucasmarshall
@@ -1,25 +1,45 @@ +import { CRMProvider } from '@supaglue/types'; import { ConnectionSafeAny } from '@supaglue/types/connection'; import { CRMCommonModelType, CRMCommonModelTypeMap } from '@supaglue/types/crm'; +import { ProviderService, SchemaService } from '../..'; +import { createFieldMappingConfig } from '../../....
Instead of using a type assertion here, we probably should add a generic type parameter to the `ProviderService.getById` method.
supaglue
github_2023
typescript
1,146
supaglue-labs
albertyfwu
@@ -32,7 +32,8 @@ export interface CrmRemoteClient extends RemoteClient { getCommonObjectRecord<T extends CRMCommonModelType>( commonModelType: T, - id: string + id: string, + fieldMappingConfig: FieldMappingConfig
long term it would be nice to not have to pass this into every remote client. i think we should be able to apply the mappings afterwards, but we can leave that as tech debt. i think it would be much less code to implement per remote client
supaglue
github_2023
typescript
1,146
supaglue-labs
albertyfwu
@@ -969,11 +970,14 @@ class HubSpotClient extends AbstractCrmRemoteClient { }); } - public async getAccount(id: string): Promise<Account> { + public async getAccount(id: string, fieldMappingConfig: FieldMappingConfig): Promise<Account> { const properties = await this.getCommonModelPropertiesToFetch('co...
can't customer pass in custom fields when creating/updating? do those need to be mapped?
supaglue
github_2023
typescript
1,140
supaglue-labs
lucasmarshall
@@ -17,6 +17,7 @@ import { UpdateProviderRequest, UpdateProviderResponse, } from '@supaglue/schemas/v2/mgmt'; +import { ProviderCreateParams } from '@supaglue/types';
```suggestion import type { ProviderCreateParams } from '@supaglue/types'; ```
supaglue
github_2023
typescript
1,139
supaglue-labs
lucasmarshall
@@ -0,0 +1,24 @@ +import { SyncHistoryStatus } from '@supaglue/types';
```suggestion import type { SyncHistoryStatus } from '@supaglue/types'; ```
supaglue
github_2023
typescript
1,139
supaglue-labs
lucasmarshall
@@ -0,0 +1,24 @@ +import { SyncHistoryStatus } from '@supaglue/types'; +import { ObjectSyncRun } from '@supaglue/types/object_sync_run';
```suggestion import type { ObjectSyncRun } from '@supaglue/types/object_sync_run'; ```
supaglue
github_2023
typescript
1,139
supaglue-labs
lucasmarshall
@@ -0,0 +1,24 @@ +import { SyncHistoryStatus } from '@supaglue/types'; +import { ObjectSyncRun } from '@supaglue/types/object_sync_run'; +import { parseCustomerIdPk } from '../lib/customer_id'; +import { ObjectSyncRunModelExpanded } from '../types/object_sync_run';
```suggestion import type { ObjectSyncRunModelExpanded } from '../types/object_sync_run'; ```
supaglue
github_2023
typescript
1,139
supaglue-labs
lucasmarshall
@@ -0,0 +1,162 @@ +import { ObjectSyncRunModelExpanded } from '@supaglue/core/types/object_sync_run'; +import { PrismaClient } from '@supaglue/db';
```suggestion import type { ObjectSyncRunModelExpanded } from '@supaglue/core/types/object_sync_run'; import type { PrismaClient } from '@supaglue/db'; ``` ... etc.
supaglue
github_2023
others
1,135
supaglue-labs
lucasmarshall
@@ -2,7 +2,7 @@ description: '' --- -# Managed syncs +# Managed syncs (reads)
This is a bit confusing. It's both a read (from the provider) and a write (to the developer's db)
supaglue
github_2023
others
1,127
supaglue-labs
tomkit
@@ -0,0 +1,90 @@ +get: + operationId: getSchema + summary: Get schema + tags: + - Schemas + security: + - ApiKeyAuth: [] + responses: + 200: + description: Schema + content: + application/json: + schema: + $ref: ../components/schemas/objects/schema.yaml + exam...
are most of our deletes are empty body / http 204?
supaglue
github_2023
typescript
1,127
supaglue-labs
albertyfwu
@@ -0,0 +1,89 @@ +import { getDependencyContainer } from '@/dependency_container';
nit: if our internal and mgmt endpoints always look identical, we should probably just write the code once and share it
supaglue
github_2023
typescript
1,127
supaglue-labs
albertyfwu
@@ -0,0 +1,19 @@ +export type Schema = { + id: string; + applicationId: string; + name: string; + config: SchemaConfig; +}; + +export type SchemaConfig = { + fields: SchemaField[]; + allowAdditionalFieldMappings: boolean; +}; + +export type SchemaField = { + name: string; // my_first_column + mappedName?: strin...
`applicationId` should not be changeable
supaglue
github_2023
typescript
1,113
supaglue-labs
albertyfwu
@@ -190,46 +199,94 @@ class MsDynamics365Sales extends AbstractCrmRemoteClient { commonModelType: T, params: CRMCommonModelTypeMap<T>['createParams'] ): Promise<string> { - throw new Error('Not implemented'); + await this.maybeRefreshAccessToken(); + switch (commonModelType) { + case 'account...
don't we need to use `?` on every accessor after the first one?
supaglue
github_2023
typescript
1,110
supaglue-labs
albertyfwu
@@ -1284,7 +1284,7 @@ class HubSpotClient extends AbstractCrmRemoteClient { ], sorts: [ { - propertyName: 'lastmodifieddate', + propertyName: 'id',
can you write comments on all of these talking about the reasoning? otherwise we surely will not remember
supaglue
github_2023
typescript
1,108
supaglue-labs
albertyfwu
@@ -481,9 +481,10 @@ CREATE ${temp ? 'TEMP TABLE' : 'TABLE'} IF NOT EXISTS ${temp ? 'temp_crm_account "last_activity_at" TIMESTAMP(3), "lifecycle_stage" TEXT, "owner_id" TEXT, - "raw_data" JSONB, + "raw_data" JSONB - PRIMARY KEY ("_supaglue_application_id", "_supaglue_provider_name", "_supaglue_customer_i...
comments should be updated for each object (not User)
supaglue
github_2023
typescript
1,108
supaglue-labs
albertyfwu
@@ -505,9 +506,10 @@ CREATE ${temp ? 'TEMP TABLE' : 'TABLE'} IF NOT EXISTS ${temp ? 'temp_crm_contact "account_id" TEXT, "owner_id" TEXT, "last_activity_at" TIMESTAMP(3), - "raw_data" JSONB, + "raw_data" JSONB - PRIMARY KEY ("_supaglue_application_id", "_supaglue_provider_name", "_supaglue_customer_id", "...
this should be `Contacts`
supaglue
github_2023
typescript
1,106
supaglue-labs
albertyfwu
@@ -150,7 +150,7 @@ function SyncConfigDetailsPanelImpl({ syncConfigId }: SyncConfigDetailsPanelImpl const supportedStandardDestinations = ['postgres']; const supportedCustomDestinations = ['postgres']; const supportedStandardObjects = ['hubspot', 'salesforce', 'ms_dynamics_365_sales']; - const supportedCusto...
nit: i'd expect `supportedCustomObjects` to contain a list of objects, not providers. what do you think of something like `supportsCustomObjects`?