-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google FS API New #234
Draft
pellicceama
wants to merge
8
commits into
main
Choose a base branch
from
fs-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Google FS API New #234
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ac4bf5c
completing sharepoint adapter and making download work for unified fs…
pellicceama a03380c
adding back debug
pellicceama a8cf031
typecheck
pellicceama 86ad77e
handling no input for filters
pellicceama 0bd61a4
removing old filters
pellicceama 9ba2182
updating docs
pellicceama 4954c52
merging stably runs in manual release
pellicceama bb215af
WIP google fs API
pellicceama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,8 @@ | ||
// import {clerkClient} from '@clerk/nextjs/server' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this related? |
||
// import Image from 'next/image' | ||
import {defConnectors} from '@openint/app-config/connectors/connectors.def' | ||
import {kAccessToken} from '@openint/app-config/constants' | ||
import {envRequired} from '@openint/app-config/env' | ||
import type {ConnectorDef} from '@openint/cdk' | ||
import { | ||
extractConnectorName, | ||
getViewerId, | ||
makeId, | ||
NangoConnect, | ||
} from '@openint/cdk' | ||
import {zConnectPageParams} from '@openint/engine-backend/router/customerRouter' | ||
import {makeUlid} from '@openint/util' | ||
import {createServerComponentHelpers} from '@/lib-server/server-component-helpers' | ||
import {SetCookieAndRedirect} from './(oauth)/redirect/SetCookieAndRedirect' | ||
import {kConnectSession, type ConnectSession} from './shared' | ||
|
||
export const metadata = { | ||
title: 'OpenInt Connect', | ||
title: 'OpenInt Connect (Deprecated)', | ||
} | ||
|
||
/** | ||
* Workaround for searchParams being empty on production. Will ahve to check | ||
* @see https://github.com/vercel/next.js/issues/43077#issuecomment-1383742153 | ||
*/ | ||
export const dynamic = 'force-dynamic' | ||
|
||
// Should we allow page to optionally load without token for performance then add token async | ||
// Perhaps it would even be an advantage to have the page simply be static? | ||
// Though that would result in waterfall loading of integrations | ||
|
||
/** https://beta.nextjs.org/docs/api-reference/file-conventions/page#searchparams-optional */ | ||
export default async function ConnectPageContainer({ | ||
searchParams, | ||
}: { | ||
// Only accessible in PageComponent rather than layout component | ||
// @see https://github.com/vercel/next.js/issues/43704 | ||
searchParams: Record<string, string | string[] | undefined> | ||
}) { | ||
const {token, ...params} = zConnectPageParams.parse(searchParams) | ||
const {ssg, viewer} = await createServerComponentHelpers({ | ||
searchParams: {[kAccessToken]: token}, | ||
}) | ||
if (viewer.role !== 'customer') { | ||
return ( | ||
<div>Authenticated user only. Your role is {getViewerId(viewer)}</div> | ||
) | ||
} | ||
|
||
// Implement shorthand for specifying only connectorConfigId by connectorName | ||
let connectorConfigId = params.connectorConfigId | ||
if (!connectorConfigId && params.connectorNames) { | ||
let ints = await ssg.listConnectorConfigInfos.fetch({ | ||
connectorName: params.connectorNames, | ||
}) | ||
if (params.connectorConfigDisplayName) { | ||
ints = ints.filter( | ||
(int) => int.displayName === params.connectorConfigDisplayName, | ||
) | ||
} | ||
if (ints.length === 1 && ints[0]?.id) { | ||
connectorConfigId = ints[0]?.id | ||
} else if (ints.length < 1) { | ||
return ( | ||
<div>No connector config for {params.connectorNames} configured</div> | ||
) | ||
} else if (ints.length > 1) { | ||
console.warn( | ||
`${ints.length} connector configs found for ${params.connectorNames}`, | ||
) | ||
} | ||
} | ||
|
||
// Special case when we are handling a single oauth connector config | ||
if (connectorConfigId) { | ||
const connectorName = extractConnectorName(connectorConfigId) | ||
const intDef = defConnectors[ | ||
connectorName as keyof typeof defConnectors | ||
] as ConnectorDef | ||
|
||
if (intDef.metadata?.nangoProvider) { | ||
const connectionId = makeId('conn', connectorName, makeUlid()) | ||
const url = await NangoConnect.getOauthConnectUrl({ | ||
public_key: envRequired.NEXT_PUBLIC_NANGO_PUBLIC_KEY, | ||
connection_id: connectionId, | ||
provider_config_key: connectorConfigId, | ||
// Consider using hookdeck so we can work with any number of urls | ||
// redirect_uri: joinPath(getServerUrl(null), '/connect/callback'), | ||
}) | ||
return ( | ||
<SetCookieAndRedirect | ||
cookies={[ | ||
{ | ||
key: kConnectSession, | ||
value: JSON.stringify({ | ||
connectionId, | ||
token, | ||
} satisfies ConnectSession), | ||
// https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7%7Cthe | ||
// Need sameSite to be lax in order for this to work | ||
options: {maxAge: 3600, sameSite: 'lax'}, | ||
}, | ||
]} | ||
redirectUrl={url} | ||
/> | ||
) | ||
} | ||
} | ||
|
||
await Promise.all([ | ||
// clerkClient.organizations.getOrganization({organizationId: viewer.orgId}), | ||
// Switch to using react suspense / server fetch for this instead of prefetch | ||
ssg.listConnectorConfigInfos.prefetch({ | ||
id: connectorConfigId, | ||
connectorName: params.connectorNames, | ||
}), | ||
params.showExisting ? ssg.listConnections.prefetch({}) : Promise.resolve(), | ||
]) | ||
|
||
export default async function ConnectPageContainer() { | ||
return ( | ||
<div className="h-screen w-screen p-6"> | ||
/connect is deprecated. Please use /connect/portal instead | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ | |
"dependencies": { | ||
"@openint/cdk": "workspace:*", | ||
"@openint/util": "workspace:*", | ||
"@opensdks/runtime": "^0.0.19" | ||
"@opensdks/runtime": "^0.0.19", | ||
"@opensdks/sdk-google": "*" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm we should probably version this at least with |
||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our deployment is not guaranteed to take 5 mins. Could be longer sometimes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack