Rebrand to Galaxy, major improvements to Bedrock support, still needs some TLC though
This commit is contained in:
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "galaxy_graphql_schema"
|
||||
version = "0.0.0"
|
||||
edition = "2024"
|
||||
authors.workspace = true
|
||||
publish.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
cynic.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
anyhow.workspace = true
|
||||
cynic-codegen.workspace = true
|
||||
@@ -0,0 +1,139 @@
|
||||
import fetch from 'cross-fetch';
|
||||
import { getIntrospectionQuery, buildClientSchema, GraphQLSchema } from 'graphql';
|
||||
import { filterSchema, pruneSchema } from '@graphql-tools/utils';
|
||||
|
||||
const clientMutations = [
|
||||
'addInviteLinkDomainRestriction',
|
||||
'addObjectGuests',
|
||||
'bulkCreateObjects',
|
||||
'confirmFileArtifactUpload',
|
||||
'createAgentTask',
|
||||
'createAnonymousUser',
|
||||
'createFileArtifactUploadTarget',
|
||||
'createFolder',
|
||||
'createGenericStringObject',
|
||||
'createManagedSecret',
|
||||
'createNotebook',
|
||||
'createTeam',
|
||||
'createWorkflow',
|
||||
'deleteConversation',
|
||||
'deleteInviteLinkDomainRestriction',
|
||||
'deleteManagedSecret',
|
||||
'updateManagedSecret',
|
||||
'deleteObject',
|
||||
'deleteTeamInvite',
|
||||
'emptyTrash',
|
||||
'expireApiKey',
|
||||
'generateApiKey',
|
||||
'generateCodeEmbeddings',
|
||||
'generateCommands',
|
||||
'generateDialogue',
|
||||
'generateMetadataForCommand',
|
||||
'generateUniqueUpgradePromoCode',
|
||||
'giveUpNotebookEditAccess',
|
||||
'grabNotebookEditAccess',
|
||||
'issueTaskIdentityToken',
|
||||
'joinTeamWithTeamDiscovery',
|
||||
'leaveObject',
|
||||
'markAcceptedIntelligentAutosuggestion',
|
||||
'mintCustomToken',
|
||||
'moveObject',
|
||||
'populateMerkleTreeCache',
|
||||
'provideNegativeFeedbackResponseForAiConversation',
|
||||
'purchaseAddonCredits',
|
||||
'recordObjectAction',
|
||||
'removeObjectGuest',
|
||||
'removeObjectLinkPermissions',
|
||||
'removeUserFromTeam',
|
||||
'renameTeam',
|
||||
'resetInviteLinks',
|
||||
'sendOnboardingSurveyResponses',
|
||||
'sendReferralInviteEmails',
|
||||
'setObjectLinkPermissions',
|
||||
'sendTeamInviteEmail',
|
||||
'setIsInviteLinkEnabled',
|
||||
'setTeamDiscoverability',
|
||||
'setTeamMemberRole',
|
||||
'setUserIsOnboarded',
|
||||
'shareBlock',
|
||||
'stripeBillingPortal',
|
||||
'transferGenericStringObjectOwner',
|
||||
'transferNotebookOwner',
|
||||
'transferTeamOwnership',
|
||||
'transferWorkflowOwner',
|
||||
'trashObject',
|
||||
'unshareBlock',
|
||||
'untrashObject',
|
||||
'updateAgentTask',
|
||||
'updateFolder',
|
||||
'updateGenericStringObject',
|
||||
'updateNotebook',
|
||||
'updateMerkleTree',
|
||||
'updateObjectGuests',
|
||||
'updateUserSettings',
|
||||
'updateWorkflow',
|
||||
'updateWorkspaceSettings',
|
||||
'updateOnboardingSurveyStatus',
|
||||
'createSimpleIntegration',
|
||||
];
|
||||
|
||||
const clientQueries = [
|
||||
'cloudObject',
|
||||
'codebaseContextConfig',
|
||||
'getRelevantFragments',
|
||||
'rerankFragments',
|
||||
'listWarpDevImages',
|
||||
'pricingInfo',
|
||||
'managedSecrets',
|
||||
'syncMerkleTree',
|
||||
'updatedCloudObjects',
|
||||
'user',
|
||||
'userGithubInfo',
|
||||
'userRepoAuthStatus',
|
||||
'apiKeys',
|
||||
'getOAuthConnectTxStatus',
|
||||
'getCloudEnvironments',
|
||||
'simpleIntegrations',
|
||||
'getIntegrationsUsingEnvironment',
|
||||
'scheduledAgentHistory',
|
||||
'task',
|
||||
'taskSecrets',
|
||||
'listAIConversations',
|
||||
'suggestCloudEnvironmentImage'
|
||||
];
|
||||
|
||||
const clientSubscriptions = ['warpDriveUpdates'];
|
||||
|
||||
function filterToClient(schema: GraphQLSchema): GraphQLSchema {
|
||||
const filtered = filterSchema({
|
||||
schema,
|
||||
rootFieldFilter: (operation, rootFieldName) => {
|
||||
if (operation === 'Query') {
|
||||
return clientQueries.includes(rootFieldName);
|
||||
} else if (operation === 'Mutation') {
|
||||
return clientMutations.includes(rootFieldName);
|
||||
} else if (operation === 'Subscription') {
|
||||
return clientSubscriptions.includes(rootFieldName);
|
||||
} else {
|
||||
console.error(`Unknown operation ${operation}.${rootFieldName}`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return pruneSchema(filtered);
|
||||
}
|
||||
|
||||
module.exports = async (schemaUrl: string) => {
|
||||
// Adapted from https://the-guild.dev/graphql/codegen/docs/config-reference/schema-field#custom-schema-loader
|
||||
const response = await fetch(schemaUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ query: getIntrospectionQuery() }),
|
||||
});
|
||||
const data = await response.json();
|
||||
const schema = buildClientSchema(data.data);
|
||||
return filterToClient(schema);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
use anyhow::Result;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
// If this file changes, regenerate the Rust sources.
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
|
||||
cynic_codegen::register_schema("warp-server")
|
||||
.from_sdl_file("api/schema.graphql")
|
||||
.expect("Should be able to register schema")
|
||||
.as_default()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
module.exports = {
|
||||
projects: {
|
||||
// Download the GraphQL schema from the staging server.
|
||||
staging: {
|
||||
schema: {
|
||||
'https://staging.warp.dev/graphql/v2': {
|
||||
loader: './api/client-schema.ts'
|
||||
}
|
||||
},
|
||||
extensions: {
|
||||
codegen: {
|
||||
generates: {
|
||||
'api/schema.graphql': {
|
||||
plugins: ['schema-ast']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// Download the GraphQL schema from a local server.
|
||||
local: {
|
||||
schema: {
|
||||
'http://localhost:8080/graphql/v2': {
|
||||
loader: './api/client-schema.ts'
|
||||
}
|
||||
},
|
||||
extensions: {
|
||||
codegen: {
|
||||
generates: {
|
||||
'api/schema.graphql': {
|
||||
plugins: ['schema-ast']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"generate": "graphql-codegen -r ts-node/register"
|
||||
},
|
||||
"dependencies": {
|
||||
"graphql": "^16.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@graphql-codegen/cli": "^5.0.2",
|
||||
"@graphql-tools/utils": "^10.1.2",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"immutable": "3.8.3",
|
||||
"lodash": "4.18.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#[cynic::schema("warp-server")]
|
||||
pub mod schema {}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user