Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(server): multi region module base w/ a test (mocked) mutation #3406

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

fabis94
Copy link
Contributor

@fabis94 fabis94 commented Oct 29, 2024

No description provided.

@@ -25,7 +25,6 @@ generates:
User: '@/modules/core/helpers/graphTypes#UserGraphQLReturn'
ActiveUserMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
UserEmailMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
UserWorkspaceMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GQL type no longer exists

@@ -77,7 +78,8 @@ const getEnabledModuleNames = () => {
'serverinvites',
'stats',
'webhooks',
'workspacesCore'
'workspacesCore',
'multiregion'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before, the module itself is enabled always (for simplicity), but then functionality checks inside of it can use the feature flag

@@ -93,7 +95,13 @@ async function getSpeckleModules() {
const moduleNames = getEnabledModuleNames()

for (const dir of moduleNames) {
loadedModules.push(require(`./${dir}`))
const moduleIndex = await import(`./${dir}/index`)
const moduleDefinition = 'init' in moduleIndex ? moduleIndex : moduleIndex.default
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally supporting export default {} in module index files, no longer having to do any of this export = {} bullshit

@@ -185,7 +193,10 @@ const graphComponents = (): Pick<ApolloServerOptions<any>, 'resolvers'> & {
// first pass load of resolvers
const resolversPath = path.join(fullPath, 'graph', 'resolvers')
if (fs.existsSync(resolversPath)) {
resolverObjs = [...resolverObjs, ...values(autoloadFromDirectory(resolversPath))]
const newResolverObjs = values(autoloadFromDirectory(resolversPath)).map((o) =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly supporting export default {} in GQL resolver modules

@@ -0,0 +1,12 @@
export type RegionServerConfig = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated based on Iain's proposed schema

@@ -0,0 +1,5 @@
import { Resolvers } from '@/modules/core/graph/generated/graphql'

// TODO: Real implementation? Need to discuss questions regarding data model & region config first
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got my answers earlier today, so I should be unblocked for this

Copy link
Contributor

📸 Preview service has generated an image.

Copy link
Contributor

📸 Preview service has generated an image.

@fabis94 fabis94 merged commit 55d0d10 into main Oct 30, 2024
25 of 27 checks passed
@fabis94 fabis94 deleted the fabians/multi-region-base branch October 30, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants