From 05c7434a6951b48401ab117931b7e5c87f1e16b7 Mon Sep 17 00:00:00 2001 From: Tai Sakuma Date: Tue, 14 May 2024 16:33:57 -0400 Subject: [PATCH] Adapt the namespace `ctrl` in GraphQL queries --- .../use-continuous-enabled-subscription.ts | 6 +- src/api/use-run-no-subscription.ts | 4 +- src/api/use-state-subscription.ts | 4 +- src/api/use-trace_ids-subscription.ts | 4 +- src/components/exception/Exception.vue | 4 +- .../main/console-frame/ConsoleFrame.vue | 8 +- .../main/trace-frame/TraceFrame.vue | 2 +- .../main/trace-frame/code-editor/source.ts | 2 +- .../main/trace-frame/script-editor/source.ts | 4 +- src/graphql/codegen/generated.ts | 158 +++++++++++------- src/graphql/gql/mutations/Exec.gql | 4 +- src/graphql/gql/mutations/Interrupt.gql | 4 +- src/graphql/gql/mutations/Kill.gql | 4 +- .../gql/mutations/LoadExampleScript.gql | 4 +- src/graphql/gql/mutations/Reset.gql | 4 +- src/graphql/gql/mutations/RunAndContinue.gql | 4 +- src/graphql/gql/mutations/SendPdbCommand.gql | 4 +- src/graphql/gql/mutations/Terminate.gql | 4 +- src/graphql/gql/queries/ContinuousEnabled.gql | 4 +- src/graphql/gql/queries/Exception.gql | 4 +- src/graphql/gql/queries/RunNo.gql | 4 +- src/graphql/gql/queries/Source.gql | 4 +- src/graphql/gql/queries/State.gql | 4 +- src/graphql/gql/queries/TraceIds.gql | 4 +- .../gql/subscriptions/ContinuousEnabled.gql | 2 +- src/graphql/gql/subscriptions/Counter.gql | 2 +- src/graphql/gql/subscriptions/Prompting.gql | 2 +- src/graphql/gql/subscriptions/RunNo.gql | 2 +- src/graphql/gql/subscriptions/State.gql | 2 +- src/graphql/gql/subscriptions/Stdout.gql | 2 +- src/graphql/gql/subscriptions/TraceIds.gql | 2 +- src/views/scratch/ScratchUrql.vue | 4 +- 32 files changed, 168 insertions(+), 102 deletions(-) diff --git a/src/api/use-continuous-enabled-subscription.ts b/src/api/use-continuous-enabled-subscription.ts index b273f67..d866192 100644 --- a/src/api/use-continuous-enabled-subscription.ts +++ b/src/api/use-continuous-enabled-subscription.ts @@ -17,15 +17,15 @@ type ContinuousEnabledSubscription = _ContinuousEnabledSubscription & export function useSubscribeContinuousEnabled(): ContinuousEnabledSubscription { const query = useQContinuousEnabledQuery({ requestPolicy: "network-only" }); - const subscription = useContinuousEnabledSubscription(); + const subscription = useContinuousEnabledSubscription({}); const error = computed(() => subscription.error?.value || query.error?.value); const continuousEnabled = computed(() => error.value ? undefined - : subscription.data?.value?.continuousEnabled || - query.data?.value?.continuousEnabled + : subscription.data?.value?.ctrlContinuousEnabled || + query.data?.value?.ctrl.continuousEnabled ); const ret = { continuousEnabled, error, subscription, query }; diff --git a/src/api/use-run-no-subscription.ts b/src/api/use-run-no-subscription.ts index 4db01f4..ab26507 100644 --- a/src/api/use-run-no-subscription.ts +++ b/src/api/use-run-no-subscription.ts @@ -13,14 +13,14 @@ type RunNoSubscription = _RunNoSubscription & PromiseLike<_RunNoSubscription>; export function useSubscribeRunNo(): RunNoSubscription { const query = useQRunNoQuery({ requestPolicy: "network-only" }); - const subscription = useRunNoSubscription(); + const subscription = useRunNoSubscription({}); const error = computed(() => subscription.error?.value || query.error?.value); const runNo = computed(() => error.value ? undefined - : subscription.data?.value?.runNo || query.data?.value?.runNo + : subscription.data?.value?.ctrlRunNo || query.data?.value?.ctrl.runNo ); const ret = { runNo, error, subscription, query }; diff --git a/src/api/use-state-subscription.ts b/src/api/use-state-subscription.ts index 9f6b812..21dbc90 100644 --- a/src/api/use-state-subscription.ts +++ b/src/api/use-state-subscription.ts @@ -13,14 +13,14 @@ type StateSubscription = _StateSubscription & PromiseLike<_StateSubscription>; export function useSubscribeState(): StateSubscription { const query = useQStateQuery({ requestPolicy: "network-only" }); - const subscription = useStateSubscription(); + const subscription = useStateSubscription({}); const error = computed(() => subscription.error?.value || query.error?.value); const state = computed(() => error.value ? undefined - : subscription.data?.value?.state || query.data?.value?.state + : subscription.data?.value?.ctrlState || query.data?.value?.ctrl.state ); const ret = { state, error, subscription, query }; diff --git a/src/api/use-trace_ids-subscription.ts b/src/api/use-trace_ids-subscription.ts index b7871e4..ccb3144 100644 --- a/src/api/use-trace_ids-subscription.ts +++ b/src/api/use-trace_ids-subscription.ts @@ -16,14 +16,14 @@ type TraceIdsSubscription = _TraceIdsSubscription & PromiseLike<_TraceIdsSubscri export function useSubscribeTraceIds(): TraceIdsSubscription { const query = useQTraceIdsQuery({ requestPolicy: "network-only" }); - const subscription = useTraceIdsSubscription(); + const subscription = useTraceIdsSubscription({}); const error = computed(() => subscription.error?.value || query.error?.value); const traceIds = computed(() => error.value ? undefined - : subscription.data?.value?.traceIds || query.data?.value?.traceIds + : subscription.data?.value?.ctrlTraceIds || query.data?.value?.ctrl.traceIds ); const ret = { traceIds, error, subscription, query }; diff --git a/src/components/exception/Exception.vue b/src/components/exception/Exception.vue index 7026466..9142477 100644 --- a/src/components/exception/Exception.vue +++ b/src/components/exception/Exception.vue @@ -48,8 +48,8 @@ watch(props, (val) => { }); watch(query.data, (val) => { - alert.value = !!val?.exception; - exception.value = val?.exception; + alert.value = !!val?.ctrl.exception; + exception.value = val?.ctrl.exception; }); watch(alert, (val) => { diff --git a/src/components/main/console-frame/ConsoleFrame.vue b/src/components/main/console-frame/ConsoleFrame.vue index c8a7b23..94ca236 100644 --- a/src/components/main/console-frame/ConsoleFrame.vue +++ b/src/components/main/console-frame/ConsoleFrame.vue @@ -16,7 +16,7 @@
{{ data?.stdout }}
+ class="overflow-auto">{{ data?.ctrlStdout }}
@@ -28,15 +28,15 @@ import { ref, nextTick } from "vue"; import { useStdoutSubscription } from "@/graphql/codegen/generated"; const handleSubscription = ( - messages = { stdout: "" }, - response: { stdout: string } + messages = { ctrlStdout: "" }, + response: { ctrlStdout: string } ) => { nextTick(() => { nextTick(() => { if (bottom.value) bottom.value.scrollIntoView(false); }); }); - return { stdout: messages.stdout + response.stdout }; + return { ctrlStdout: messages.ctrlStdout + response.ctrlStdout }; }; const subscription = useStdoutSubscription({}, handleSubscription); const bottom = ref(null as HTMLElement | null); diff --git a/src/components/main/trace-frame/TraceFrame.vue b/src/components/main/trace-frame/TraceFrame.vue index 1fb93a9..a91dc84 100644 --- a/src/components/main/trace-frame/TraceFrame.vue +++ b/src/components/main/trace-frame/TraceFrame.vue @@ -57,7 +57,7 @@ const subscription = usePromptingSubscription({ variables: { traceId: props.traceId }, }); -const prompting = computed(() => subscription.data.value?.prompting); +const prompting = computed(() => subscription.data.value?.ctrlPrompting); const basename = computed(() => { const fileName = prompting?.value?.fileName || ""; diff --git a/src/components/main/trace-frame/code-editor/source.ts b/src/components/main/trace-frame/code-editor/source.ts index 7941de8..befd33a 100644 --- a/src/components/main/trace-frame/code-editor/source.ts +++ b/src/components/main/trace-frame/code-editor/source.ts @@ -6,7 +6,7 @@ import { useSourceQuery } from "@/graphql/codegen/generated"; export async function useSource(fileName: MaybeRef) { // @ts-ignore const query = useSourceQuery({ variables: { fileName } }); - const sourceLines = computed(() => query.data.value?.source); + const sourceLines = computed(() => query.data.value?.ctrl.source); const source = computed(() => sourceLines.value?.join("\n")); await query; return { source }; diff --git a/src/components/main/trace-frame/script-editor/source.ts b/src/components/main/trace-frame/script-editor/source.ts index 83aa970..03461bc 100644 --- a/src/components/main/trace-frame/script-editor/source.ts +++ b/src/components/main/trace-frame/script-editor/source.ts @@ -9,8 +9,8 @@ import { import { useStore } from "@/plugins/pinia/stores/main"; export async function useSource() { - const query = useSourceQuery(); - const savedSourceLines = computed(() => query.data.value?.source || []); + const query = useSourceQuery({}); + const savedSourceLines = computed(() => query.data.value?.ctrl.source || []); const savedSource = computed(() => savedSourceLines.value.join("\n")); const source = ref(""); diff --git a/src/graphql/codegen/generated.ts b/src/graphql/codegen/generated.ts index 1fb0b6a..446eae2 100644 --- a/src/graphql/codegen/generated.ts +++ b/src/graphql/codegen/generated.ts @@ -25,25 +25,30 @@ export type AlertRdb = { export type Mutation = { __typename?: 'Mutation'; + ctrl: MutationCtrl; + rdb: MutationRdb; + schedule: MutationSchedule; +}; + +export type MutationCtrl = { + __typename?: 'MutationCtrl'; exec: Scalars['Boolean']['output']; interrupt: Scalars['Boolean']['output']; kill: Scalars['Boolean']['output']; loadExampleScript: Scalars['Boolean']['output']; - rdb: MutationRdb; reset: Scalars['Boolean']['output']; runAndContinue: Scalars['Boolean']['output']; - schedule: MutationSchedule; sendPdbCommand: Scalars['Boolean']['output']; terminate: Scalars['Boolean']['output']; }; -export type MutationResetArgs = { +export type MutationCtrlResetArgs = { statement?: InputMaybe; }; -export type MutationSendPdbCommandArgs = { +export type MutationCtrlSendPdbCommandArgs = { command: Scalars['String']['input']; promptNo: Scalars['Int']['input']; traceNo: Scalars['Int']['input']; @@ -161,15 +166,20 @@ export type PromptingData = { export type Query = { __typename?: 'Query'; alert: AlertRdb; - continuousEnabled: Scalars['Boolean']['output']; + ctrl: QueryCtrl; dev: QueryDev; - exception?: Maybe; - hello: Scalars['String']['output']; history: QueryRdb; rdb: QueryRdb; - runNo: Scalars['Int']['output']; schedule: QuerySchedule; settings: Scalars['String']['output']; +}; + +export type QueryCtrl = { + __typename?: 'QueryCtrl'; + continuousEnabled: Scalars['Boolean']['output']; + exception?: Maybe; + hello: Scalars['String']['output']; + runNo: Scalars['Int']['output']; source: Array; sourceLine: Scalars['String']['output']; state: Scalars['String']['output']; @@ -177,12 +187,12 @@ export type Query = { }; -export type QuerySourceArgs = { +export type QueryCtrlSourceArgs = { fileName?: InputMaybe; }; -export type QuerySourceLineArgs = { +export type QueryCtrlSourceLineArgs = { fileName?: InputMaybe; lineNo: Scalars['Int']['input']; }; @@ -357,20 +367,20 @@ export type StdoutNodeEdge = { export type Subscription = { __typename?: 'Subscription'; - continuousEnabled: Scalars['Boolean']['output']; - counter: Scalars['Int']['output']; - prompting: PromptingData; - runNo: Scalars['Int']['output']; + ctrlContinuousEnabled: Scalars['Boolean']['output']; + ctrlCounter: Scalars['Int']['output']; + ctrlPrompting: PromptingData; + ctrlRunNo: Scalars['Int']['output']; + ctrlState: Scalars['String']['output']; + ctrlStdout: Scalars['String']['output']; + ctrlTraceIds: Array; scheduleAutoModeMode: Scalars['String']['output']; scheduleAutoModeState: Scalars['String']['output']; scheduleQueueItems: Array; - state: Scalars['String']['output']; - stdout: Scalars['String']['output']; - traceIds: Array; }; -export type SubscriptionPromptingArgs = { +export type SubscriptionCtrlPromptingArgs = { traceId: Scalars['Int']['input']; }; @@ -431,22 +441,22 @@ export type AutoModeTurnOnMutation = { __typename?: 'Mutation', schedule: { __ty export type ExecMutationVariables = Exact<{ [key: string]: never; }>; -export type ExecMutation = { __typename?: 'Mutation', exec: boolean }; +export type ExecMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', exec: boolean } }; export type InterruptMutationVariables = Exact<{ [key: string]: never; }>; -export type InterruptMutation = { __typename?: 'Mutation', interrupt: boolean }; +export type InterruptMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', interrupt: boolean } }; export type KillMutationVariables = Exact<{ [key: string]: never; }>; -export type KillMutation = { __typename?: 'Mutation', kill: boolean }; +export type KillMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', kill: boolean } }; export type LoadExampleScriptMutationVariables = Exact<{ [key: string]: never; }>; -export type LoadExampleScriptMutation = { __typename?: 'Mutation', loadExampleScript: boolean }; +export type LoadExampleScriptMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', loadExampleScript: boolean } }; export type LoadScriptMutationVariables = Exact<{ [key: string]: never; }>; @@ -458,12 +468,12 @@ export type ResetMutationVariables = Exact<{ }>; -export type ResetMutation = { __typename?: 'Mutation', reset: boolean }; +export type ResetMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', reset: boolean } }; export type RunAndContinueMutationVariables = Exact<{ [key: string]: never; }>; -export type RunAndContinueMutation = { __typename?: 'Mutation', runAndContinue: boolean }; +export type RunAndContinueMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', runAndContinue: boolean } }; export type ScheduleAutoModeChangeModeMutationVariables = Exact<{ mode: Scalars['String']['input']; @@ -493,22 +503,22 @@ export type SendPdbCommandMutationVariables = Exact<{ }>; -export type SendPdbCommandMutation = { __typename?: 'Mutation', sendPdbCommand: boolean }; +export type SendPdbCommandMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', sendPdbCommand: boolean } }; export type TerminateMutationVariables = Exact<{ [key: string]: never; }>; -export type TerminateMutation = { __typename?: 'Mutation', terminate: boolean }; +export type TerminateMutation = { __typename?: 'Mutation', ctrl: { __typename?: 'MutationCtrl', terminate: boolean } }; export type QContinuousEnabledQueryVariables = Exact<{ [key: string]: never; }>; -export type QContinuousEnabledQuery = { __typename?: 'Query', continuousEnabled: boolean }; +export type QContinuousEnabledQuery = { __typename?: 'Query', ctrl: { __typename?: 'QueryCtrl', continuousEnabled: boolean } }; export type ExceptionQueryVariables = Exact<{ [key: string]: never; }>; -export type ExceptionQuery = { __typename?: 'Query', exception?: string | null }; +export type ExceptionQuery = { __typename?: 'Query', ctrl: { __typename?: 'QueryCtrl', exception?: string | null } }; export type RdbRunQueryVariables = Exact<{ runNo: Scalars['Int']['input']; @@ -530,7 +540,7 @@ export type RdbRunsQuery = { __typename?: 'Query', rdb: { __typename?: 'QueryRDB export type QRunNoQueryVariables = Exact<{ [key: string]: never; }>; -export type QRunNoQuery = { __typename?: 'Query', runNo: number }; +export type QRunNoQuery = { __typename?: 'Query', ctrl: { __typename?: 'QueryCtrl', runNo: number } }; export type RunsQueryVariables = Exact<{ [key: string]: never; }>; @@ -557,39 +567,39 @@ export type SourceQueryVariables = Exact<{ }>; -export type SourceQuery = { __typename?: 'Query', source: Array }; +export type SourceQuery = { __typename?: 'Query', ctrl: { __typename?: 'QueryCtrl', source: Array } }; export type QStateQueryVariables = Exact<{ [key: string]: never; }>; -export type QStateQuery = { __typename?: 'Query', state: string }; +export type QStateQuery = { __typename?: 'Query', ctrl: { __typename?: 'QueryCtrl', state: string } }; export type QTraceIdsQueryVariables = Exact<{ [key: string]: never; }>; -export type QTraceIdsQuery = { __typename?: 'Query', traceIds: Array }; +export type QTraceIdsQuery = { __typename?: 'Query', ctrl: { __typename?: 'QueryCtrl', traceIds: Array } }; export type ContinuousEnabledSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type ContinuousEnabledSubscription = { __typename?: 'Subscription', continuousEnabled: boolean }; +export type ContinuousEnabledSubscription = { __typename?: 'Subscription', ctrlContinuousEnabled: boolean }; export type CounterSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type CounterSubscription = { __typename?: 'Subscription', counter: number }; +export type CounterSubscription = { __typename?: 'Subscription', ctrlCounter: number }; export type PromptingSubscriptionVariables = Exact<{ traceId: Scalars['Int']['input']; }>; -export type PromptingSubscription = { __typename?: 'Subscription', prompting: { __typename?: 'PromptingData', prompting: number, fileName: string, lineNo: number, traceEvent: string } }; +export type PromptingSubscription = { __typename?: 'Subscription', ctrlPrompting: { __typename?: 'PromptingData', prompting: number, fileName: string, lineNo: number, traceEvent: string } }; export type RunNoSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type RunNoSubscription = { __typename?: 'Subscription', runNo: number }; +export type RunNoSubscription = { __typename?: 'Subscription', ctrlRunNo: number }; export type ScheduleAutoModeModeSubscriptionVariables = Exact<{ [key: string]: never; }>; @@ -609,17 +619,17 @@ export type SScheduleQueueItemsSubscription = { __typename?: 'Subscription', sch export type StateSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type StateSubscription = { __typename?: 'Subscription', state: string }; +export type StateSubscription = { __typename?: 'Subscription', ctrlState: string }; export type StdoutSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type StdoutSubscription = { __typename?: 'Subscription', stdout: string }; +export type StdoutSubscription = { __typename?: 'Subscription', ctrlStdout: string }; export type TraceIdsSubscriptionVariables = Exact<{ [key: string]: never; }>; -export type TraceIdsSubscription = { __typename?: 'Subscription', traceIds: Array }; +export type TraceIdsSubscription = { __typename?: 'Subscription', ctrlTraceIds: Array }; export const AutoModeTurnOffDocument = gql` @@ -650,7 +660,9 @@ export function useAutoModeTurnOnMutation() { }; export const ExecDocument = gql` mutation Exec { - exec + ctrl { + exec + } } `; @@ -659,7 +671,9 @@ export function useExecMutation() { }; export const InterruptDocument = gql` mutation Interrupt { - interrupt + ctrl { + interrupt + } } `; @@ -668,7 +682,9 @@ export function useInterruptMutation() { }; export const KillDocument = gql` mutation Kill { - kill + ctrl { + kill + } } `; @@ -677,7 +693,9 @@ export function useKillMutation() { }; export const LoadExampleScriptDocument = gql` mutation LoadExampleScript { - loadExampleScript + ctrl { + loadExampleScript + } } `; @@ -697,7 +715,9 @@ export function useLoadScriptMutation() { }; export const ResetDocument = gql` mutation Reset($statement: String) { - reset(statement: $statement) + ctrl { + reset(statement: $statement) + } } `; @@ -706,7 +726,9 @@ export function useResetMutation() { }; export const RunAndContinueDocument = gql` mutation RunAndContinue { - runAndContinue + ctrl { + runAndContinue + } } `; @@ -759,7 +781,9 @@ export function useScheduleQueueRemoveMutation() { }; export const SendPdbCommandDocument = gql` mutation SendPdbCommand($command: String!, $promptNo: Int!, $traceNo: Int!) { - sendPdbCommand(command: $command, promptNo: $promptNo, traceNo: $traceNo) + ctrl { + sendPdbCommand(command: $command, promptNo: $promptNo, traceNo: $traceNo) + } } `; @@ -768,7 +792,9 @@ export function useSendPdbCommandMutation() { }; export const TerminateDocument = gql` mutation Terminate { - terminate + ctrl { + terminate + } } `; @@ -777,7 +803,9 @@ export function useTerminateMutation() { }; export const QContinuousEnabledDocument = gql` query QContinuousEnabled { - continuousEnabled + ctrl { + continuousEnabled + } } `; @@ -786,7 +814,9 @@ export function useQContinuousEnabledQuery(options: Omit(options: Omit(options: Omi }; export const RunNoDocument = gql` subscription RunNo { - runNo + ctrlRunNo } `; @@ -1028,7 +1066,7 @@ export function useSScheduleQueueItemsSubscription(options: Omit(options: Omit query.data); const sub = computed(() => subscription.data);