Skip to content

Commit

Permalink
Integrate CreateExtensionCellOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
peraltafederico committed Aug 29, 2024
1 parent 690cce4 commit b56b841
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/client/components/terminal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import './share'
import './gistCell'
import './open'
import {
CreateCellOutputMutation,
CreateExtensionCellOutputMutation,
UpdateCellOutputMutation,
} from '../../../extension/__generated-platform__/graphql'

Expand Down Expand Up @@ -483,12 +483,12 @@ export class TerminalView extends LitElement {
return
}

const data = (e.output.data?.data || {}) as CreateCellOutputMutation &
const data = (e.output.data?.data || {}) as CreateExtensionCellOutputMutation &
UpdateCellOutputMutation
const { escalationButton: escalationButtonEnabled } = e.output
if (data.createCellOutput) {
if (data.createExtensionCellOutput) {
const {
createCellOutput: { id, exitCode, htmlUrl },
createExtensionCellOutput: { id, exitCode, htmlUrl },
} = data
this.cloudId = id
this.shareUrl = htmlUrl || ''
Expand Down
4 changes: 2 additions & 2 deletions src/extension/__generated-platform__/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
*/
const documents = {
"mutation ArchiveCellOutput($id: String!) {\n archiveCellOutput(id: $id) {\n id\n }\n}": types.ArchiveCellOutputDocument,
"mutation CreateCellOutput($input: ReporterInput!) {\n createCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.CreateCellOutputDocument,
"mutation CreateExtensionCellOutput($input: ReporterInput!) {\n createExtensionCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.CreateExtensionCellOutputDocument,
"mutation UnArchiveCellOutput($id: String!) {\n unArchiveCellOutput(id: $id) {\n id\n }\n}": types.UnArchiveCellOutputDocument,
"mutation UpdateCellOutput($id: String!, $input: UpdateCellOutputInput!) {\n updateCellOutput(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.UpdateCellOutputDocument,
};
Expand All @@ -40,7 +40,7 @@ export function graphql(source: "mutation ArchiveCellOutput($id: String!) {\n a
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation CreateCellOutput($input: ReporterInput!) {\n createCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"): (typeof documents)["mutation CreateCellOutput($input: ReporterInput!) {\n createCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"];
export function graphql(source: "mutation CreateExtensionCellOutput($input: ReporterInput!) {\n createExtensionCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"): (typeof documents)["mutation CreateExtensionCellOutput($input: ReporterInput!) {\n createExtensionCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
18 changes: 9 additions & 9 deletions src/extension/__generated-platform__/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,9 +743,9 @@ export type Mutation = {
activeOrganization: Organization;
archiveCellOutput: CellOutput;
createAccessRequest: AccessRequest;
createCellOutput: CellOutput;
createCellOutputBookmark: Bookmark;
createConversationBookmark: Bookmark;
createExtensionCellOutput: CellOutput;
createGroup: Group;
createMarkdownBookmark: Bookmark;
createMessage: Message;
Expand Down Expand Up @@ -809,11 +809,6 @@ export type MutationCreateAccessRequestArgs = {
};


export type MutationCreateCellOutputArgs = {
input: ReporterInput;
};


export type MutationCreateCellOutputBookmarkArgs = {
input: CreateBookmarkInput;
};
Expand All @@ -824,6 +819,11 @@ export type MutationCreateConversationBookmarkArgs = {
};


export type MutationCreateExtensionCellOutputArgs = {
input: ReporterInput;
};


export type MutationCreateGroupArgs = {
input: CreateGroupInput;
};
Expand Down Expand Up @@ -1998,12 +1998,12 @@ export type ArchiveCellOutputMutationVariables = Exact<{

export type ArchiveCellOutputMutation = { __typename?: 'Mutation', archiveCellOutput: { __typename?: 'CellOutput', id: string } };

export type CreateCellOutputMutationVariables = Exact<{
export type CreateExtensionCellOutputMutationVariables = Exact<{
input: ReporterInput;
}>;


export type CreateCellOutputMutation = { __typename?: 'Mutation', createCellOutput: { __typename?: 'CellOutput', id: string, htmlUrl?: string | null, exitCode: number, isSlackReady?: boolean | null } };
export type CreateExtensionCellOutputMutation = { __typename?: 'Mutation', createExtensionCellOutput: { __typename?: 'CellOutput', id: string, htmlUrl?: string | null, exitCode: number, isSlackReady?: boolean | null } };

export type UnArchiveCellOutputMutationVariables = Exact<{
id: Scalars['String']['input'];
Expand All @@ -2022,6 +2022,6 @@ export type UpdateCellOutputMutation = { __typename?: 'Mutation', updateCellOutp


export const ArchiveCellOutputDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ArchiveCellOutput"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"archiveCellOutput"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ArchiveCellOutputMutation, ArchiveCellOutputMutationVariables>;
export const CreateCellOutputDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCellOutput"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ReporterInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCellOutput"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"htmlUrl"}},{"kind":"Field","name":{"kind":"Name","value":"exitCode"}},{"kind":"Field","name":{"kind":"Name","value":"isSlackReady"}}]}}]}}]} as unknown as DocumentNode<CreateCellOutputMutation, CreateCellOutputMutationVariables>;
export const CreateExtensionCellOutputDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateExtensionCellOutput"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ReporterInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createExtensionCellOutput"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"htmlUrl"}},{"kind":"Field","name":{"kind":"Name","value":"exitCode"}},{"kind":"Field","name":{"kind":"Name","value":"isSlackReady"}}]}}]}}]} as unknown as DocumentNode<CreateExtensionCellOutputMutation, CreateExtensionCellOutputMutationVariables>;
export const UnArchiveCellOutputDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UnArchiveCellOutput"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"unArchiveCellOutput"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<UnArchiveCellOutputMutation, UnArchiveCellOutputMutationVariables>;
export const UpdateCellOutputDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCellOutput"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCellOutputInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCellOutput"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"htmlUrl"}},{"kind":"Field","name":{"kind":"Name","value":"exitCode"}},{"kind":"Field","name":{"kind":"Name","value":"isSlackReady"}}]}}]}}]} as unknown as DocumentNode<UpdateCellOutputMutation, UpdateCellOutputMutationVariables>;
6 changes: 3 additions & 3 deletions src/extension/messages/platformRequest/saveCellExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getGitContext, getPlatformAuthSession } from '../../utils'
import { GrpcSerializer } from '../../serializer'
import { InitializeClient } from '../../api/client'
import {
CreateCellOutputDocument,
CreateExtensionCellOutputDocument,
ReporterFrontmatterInput,
} from '../../__generated-platform__/graphql'
import { Cell } from '../../grpc/serializerTypes'
Expand Down Expand Up @@ -86,7 +86,7 @@ export default async function saveCellExecution(

// TODO: Implement the reporter to normalize the data into a valid Platform api payload
const result = await graphClient.mutate({
mutation: CreateCellOutputDocument,
mutation: CreateExtensionCellOutputDocument,
variables: {
input: {
extension: {
Expand Down Expand Up @@ -142,7 +142,7 @@ export default async function saveCellExecution(

log.info('Cell execution saved')

const showEscalationButton = !!result.data?.createCellOutput?.isSlackReady
const showEscalationButton = !!result.data?.createExtensionCellOutput?.isSlackReady
log.info(`showEscalationButton: ${showEscalationButton ? 'enabled' : 'disabled'}`)

TelemetryReporter.sendTelemetryEvent('app.save')
Expand Down
4 changes: 2 additions & 2 deletions src/gql-platform/createCellOutput.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mutation CreateCellOutput($input: ReporterInput!) {
createCellOutput(input: $input) {
mutation CreateExtensionCellOutput($input: ReporterInput!) {
createExtensionCellOutput(input: $input) {
id
htmlUrl
exitCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ vi.mock('../../../../src/extension/cell', async () => {
})

const graphqlHandlers = [
graphql.mutation('CreateCellOutput', () => {
graphql.mutation('CreateExtensionCellOutput', () => {
return HttpResponse.json({
data: {
id: 'cell-id',
Expand Down

0 comments on commit b56b841

Please sign in to comment.