diff --git a/clients/ai-assistants-v1/sdk.ts b/clients/ai-assistants-v1/sdk.ts deleted file mode 100644 index 1aef7d48..00000000 --- a/clients/ai-assistants-v1/sdk.ts +++ /dev/null @@ -1,382 +0,0 @@ -import { ServiceDefinition } from '@grpc/grpc-js'; -import { assistantService, messageService, runService, threadService } from '.'; -import { ClientCallArgs, GeneratedServiceClientCtor, WrappedServiceClientType } from './types'; -import { - CreateThreadRequest, - DeleteThreadRequest, - GetThreadRequest, - ListThreadsRequest, - UpdateThreadRequest, -} from './generated/yandex/cloud/ai/assistants/v1/threads/thread_service'; -import { - CreateAssistantRequest, - DeleteAssistantRequest, - GetAssistantRequest, - ListAssistantsRequest, - ListAssistantVersionsRequest, - UpdateAssistantRequest, -} from './generated/yandex/cloud/ai/assistants/v1/assistant_service'; -import { - CreateMessageRequest, - GetMessageRequest, - ListMessagesRequest, -} from './generated/yandex/cloud/ai/assistants/v1/threads/message_service'; -import { DeepPartial } from './generated/typeRegistry'; -import { - CreateRunRequest, - GetLastRunByThreadRequest, - GetRunRequest, - ListenRunRequest, - ListRunsRequest, -} from './generated/yandex/cloud/ai/assistants/v1/runs/run_service'; -import { CallOptions } from 'nice-grpc'; -import { Thread } from './generated/yandex/cloud/ai/assistants/v1/threads/thread'; -import { Assistant } from './generated/yandex/cloud/ai/assistants/v1/assistant'; -import { Run } from './generated/yandex/cloud/ai/assistants/v1/runs/run'; - -type ClientType = ( - clientClass: GeneratedServiceClientCtor, - customEndpoint?: string, -) => WrappedServiceClientType; - -type SessionArg = { client: ClientType }; - -type TypeFromProtoc< - T extends { $type: string }, - NotPartialKey extends keyof Omit = never, -> = { - [Key in NotPartialKey]: T[Key]; -} & DeepPartial; - -type SendMessageProps = TypeFromProtoc; - -type GetMessageProps = TypeFromProtoc; - -type ListMessagesProps = TypeFromProtoc; - -export const initMessageSdk = (session: SessionArg) => { - const messageClient = session.client(messageService.MessageServiceClient); - - const send = (params: SendMessageProps, args?: ClientCallArgs) => { - const p = messageClient.create( - messageService.CreateMessageRequest.fromPartial(params), - args, - ); - - return p; - }; - - const get = (params: GetMessageProps, args?: ClientCallArgs) => { - const p = messageClient.get(messageService.GetMessageRequest.fromPartial(params), args); - return p; - }; - - const list = (params: ListMessagesProps, args?: ClientCallArgs) => { - const p = messageClient.list(messageService.ListMessagesRequest.fromPartial(params), args); - return p; - }; - - return { send, get, list }; -}; - -type MessageSdk = ReturnType; - -type CreateThreadProps = TypeFromProtoc; - -type GetThreadProps = TypeFromProtoc; - -type ListThreadProps = TypeFromProtoc; - -type DeleteThreadProps = TypeFromProtoc; - -type UpdateThreadProps = TypeFromProtoc; - -export const threadWithSdk = >( - session: SessionArg, - thread: T, - { - threadSdk = initThreadSdk(session), - messageSdk = initMessageSdk(session), - }: { - messageSdk?: MessageSdk; - threadSdk?: ThreadSdk; - }, -) => { - const sendMessage = (props: Omit, args?: ClientCallArgs) => { - return messageSdk.send({ threadId: thread.id, ...props }, args); - }; - - const listMessages = (props: Omit, args?: ClientCallArgs) => { - return messageSdk.list({ threadId: thread.id, ...props }, args); - }; - - const getMessage = (props: Omit, args?: ClientCallArgs) => { - return messageSdk.get({ threadId: thread.id, ...props }, args); - }; - - const deleteInnerMethod = (args?: ClientCallArgs) => { - return threadSdk.delete({ threadId: thread.id }, args); - }; - - const updateMethod = (props: Omit, args?: ClientCallArgs) => { - return threadSdk.update({ ...props, threadId: thread.id }, args); - }; - - return Object.assign(thread, { - sendMessage, - listMessages, - getMessage, - delete: deleteInnerMethod, - update: updateMethod, - }); -}; - -export const initThreadSdk = (session: SessionArg) => { - const threadClient = session.client(threadService.ThreadServiceClient); - - const _connectWithSdk = (threadP: Promise) => { - const externalSession = session; - - const withSdk = async (session?: SessionArg | null, messageSdk?: MessageSdk) => { - const thread = await threadP; - return threadWithSdk(session || externalSession, thread, { - threadSdk, - messageSdk, - }); - }; - - return { withSdk }; - }; - - const get = (params: GetThreadProps, args?: ClientCallArgs) => { - const p = threadClient.get(threadService.GetThreadRequest.fromPartial(params), args); - return Object.assign(p, _connectWithSdk(p)); - }; - - const list = (params: ListThreadProps, args?: ClientCallArgs) => { - return threadClient.list(threadService.ListThreadsRequest.fromPartial(params), args); - }; - - const deleteMethod = (params: DeleteThreadProps, args?: ClientCallArgs) => { - return threadClient.delete(threadService.DeleteThreadRequest.fromPartial(params), args); - }; - - const update = (params: UpdateThreadProps, args?: ClientCallArgs) => { - const p = threadClient.update(threadService.UpdateThreadRequest.fromPartial(params), args); - return Object.assign(p, _connectWithSdk(p)); - }; - - const create = (params: CreateThreadProps, args?: ClientCallArgs) => { - const p = threadClient.create(threadService.CreateThreadRequest.fromPartial(params), args); - return Object.assign(p, _connectWithSdk(p)); - }; - - const threadSdk = { create, delete: deleteMethod, get, list, update }; - - return threadSdk; -}; - -type ThreadSdk = ReturnType; - -type CreateAssistantProps = Omit, 'modelUri'> & { - modelId: string; -}; - -type GetAssistantProps = TypeFromProtoc; - -type ListAssistantProps = TypeFromProtoc; - -type DeleteAssistantProps = TypeFromProtoc; - -type ListAssistantVersionsProps = TypeFromProtoc; - -type UpdateAssistantProps = TypeFromProtoc; - -export const assistantWithSdk = >( - session: SessionArg, - assistant: T, - { - assistantSdk = initAssistantSdk(session), - }: { - assistantSdk?: AssistantSdk; - }, -) => { - const deleteMethod = ( - params: Omit, - args?: ClientCallArgs, - ) => { - return assistantSdk.delete({ ...params, assistantId: assistant.id }, args); - }; - - const update = (params: Omit, args?: ClientCallArgs) => { - return assistantSdk.update({ ...params, assistantId: assistant.id }, args); - }; - - return Object.assign(assistant, { update, delete: deleteMethod }); -}; - -export const initAssistantSdk = (session: SessionArg) => { - const assistantClient = session.client(assistantService.AssistantServiceClient); - - const _connectWithSdk = (assistantP: Promise) => { - const externalSession = session; - - const withSdk = async (session?: SessionArg | null) => { - const thread = await assistantP; - return assistantWithSdk(session || externalSession, thread, { - assistantSdk, - }); - }; - - return { withSdk }; - }; - - const create = async (params: CreateAssistantProps, args?: ClientCallArgs) => { - const { modelId, ...restParams } = params; - - const p = assistantClient.create( - assistantService.CreateAssistantRequest.fromPartial({ - ...restParams, - modelUri: `gpt://${params.folderId}/${modelId}`, - }), - args, - ); - - return Object.assign(p, _connectWithSdk(p)); - }; - - const get = (params: GetAssistantProps, args?: ClientCallArgs) => { - const p = assistantClient.get( - assistantService.GetAssistantRequest.fromPartial(params), - args, - ); - return Object.assign(p, _connectWithSdk(p)); - }; - - const list = (params: ListAssistantProps, args?: ClientCallArgs) => { - const p = assistantClient.list( - assistantService.ListAssistantsRequest.fromPartial(params), - args, - ); - - return p; - }; - - const deleteMethod = (params: DeleteAssistantProps, args?: ClientCallArgs) => { - const p = assistantClient.delete( - assistantService.DeleteAssistantRequest.fromPartial(params), - args, - ); - return p; - }; - - const listVersions = (params: ListAssistantVersionsProps, args?: ClientCallArgs) => { - const p = assistantClient.listVersions( - assistantService.ListAssistantVersionsRequest.fromPartial(params), - args, - ); - return p; - }; - - const update = (params: UpdateAssistantProps, args?: ClientCallArgs) => { - const p = assistantClient.update( - assistantService.UpdateAssistantRequest.fromPartial(params), - args, - ); - return Object.assign(p, _connectWithSdk(p)); - }; - - const assistantSdk = { create, get, list, delete: deleteMethod, listVersions, update }; - return assistantSdk; -}; - -type AssistantSdk = ReturnType; - -type GetRunProps = TypeFromProtoc; - -type CreateRunProps = TypeFromProtoc; - -type GetLastRunByThreadProps = TypeFromProtoc; - -type ListRunsProps = TypeFromProtoc; - -type ListenRunProps = TypeFromProtoc; - -export const runWithSdk = >( - session: SessionArg, - run: T, - { - runSdk = initRunSdk(session), - }: { - runSdk?: RunSdk; - }, -) => { - const listen = (params: Omit, args?: ClientCallArgs & CallOptions) => { - return runSdk.listen({ ...params, runId: run.id }, args); - }; - - return Object.assign(run, { listen }); -}; - -export const initRunSdk = (session: SessionArg) => { - const runClient = session.client(runService.RunServiceClient); - - const _connectWithSdk = (runP: Promise) => { - const externalSession = session; - - const withSdk = async (session?: SessionArg | null) => { - const run = await runP; - return runWithSdk(session || externalSession, run, { - runSdk, - }); - }; - - return { withSdk }; - }; - - const create = (params: CreateRunProps, args?: ClientCallArgs) => { - const p = runClient.create(runService.CreateRunRequest.fromPartial(params), args); - return Object.assign(p, _connectWithSdk(p)); - }; - - const get = (params: GetRunProps, args?: ClientCallArgs) => { - const p = runClient.get(runService.GetRunRequest.fromPartial(params), args); - return Object.assign(p, _connectWithSdk(p)); - }; - - const getLastByThread = (params: GetLastRunByThreadProps, args?: ClientCallArgs) => { - const p = runClient.getLastByThread( - runService.GetLastRunByThreadRequest.fromPartial(params), - args, - ); - return Object.assign(p, _connectWithSdk(p)); - }; - - const list = (params: ListRunsProps, args?: ClientCallArgs) => { - const p = runClient.list(runService.ListRunsRequest.fromPartial(params), args); - return p; - }; - - const listen = (params: ListenRunProps, args?: ClientCallArgs & CallOptions) => { - return runClient.listen(runService.ListenRunRequest.fromPartial(params), args); - }; - - const runSdk = { create, get, getLastByThread, list, listen }; - return runSdk; -}; - -type RunSdk = ReturnType; - -export const sdk = (session: SessionArg) => { - const run = initRunSdk(session); - const assistant = initAssistantSdk(session); - const message = initMessageSdk(session); - const thread = initThreadSdk(session); - - return { - run, - assistant, - message, - thread, - }; -}; diff --git a/clients/ai-assistants-v1/sdk/assistantSdk.ts b/clients/ai-assistants-v1/sdk/assistantSdk.ts new file mode 100644 index 00000000..c0d0ee4f --- /dev/null +++ b/clients/ai-assistants-v1/sdk/assistantSdk.ts @@ -0,0 +1,125 @@ +import { assistantService } from '..'; +import { Assistant } from '../generated/yandex/cloud/ai/assistants/v1/assistant'; +import { + CreateAssistantRequest, + DeleteAssistantRequest, + GetAssistantRequest, + ListAssistantsRequest, + ListAssistantVersionsRequest, + UpdateAssistantRequest, +} from '../generated/yandex/cloud/ai/assistants/v1/assistant_service'; +import { ClientCallArgs, SessionArg, TypeFromProtoc } from './types'; + +type CreateAssistantProps = Omit, 'modelUri'> & { + modelId: string; +}; + +type GetAssistantProps = TypeFromProtoc; + +type ListAssistantProps = TypeFromProtoc; + +type DeleteAssistantProps = TypeFromProtoc; + +type ListAssistantVersionsProps = TypeFromProtoc; + +type UpdateAssistantProps = TypeFromProtoc; + +export const assistantWithSdk = >( + session: SessionArg, + assistant: T, + { + assistantSdk = initAssistantSdk(session), + }: { + assistantSdk?: AssistantSdk; + }, +) => { + const deleteMethod = ( + params: Omit, + args?: ClientCallArgs, + ) => { + return assistantSdk.delete({ ...params, assistantId: assistant.id }, args); + }; + + const update = (params: Omit, args?: ClientCallArgs) => { + return assistantSdk.update({ ...params, assistantId: assistant.id }, args); + }; + + return Object.assign(assistant, { update, delete: deleteMethod }); +}; + +export const initAssistantSdk = (session: SessionArg) => { + const assistantClient = session.client(assistantService.AssistantServiceClient); + + const _connectWithSdk = (assistantP: Promise) => { + const externalSession = session; + + const withSdk = async (session?: SessionArg | null) => { + const thread = await assistantP; + return assistantWithSdk(session || externalSession, thread, { + assistantSdk, + }); + }; + + return { withSdk }; + }; + + const create = async (params: CreateAssistantProps, args?: ClientCallArgs) => { + const { modelId, ...restParams } = params; + + const p = assistantClient.create( + assistantService.CreateAssistantRequest.fromPartial({ + ...restParams, + modelUri: `gpt://${params.folderId}/${modelId}`, + }), + args, + ); + + return Object.assign(p, _connectWithSdk(p)); + }; + + const get = (params: GetAssistantProps, args?: ClientCallArgs) => { + const p = assistantClient.get( + assistantService.GetAssistantRequest.fromPartial(params), + args, + ); + return Object.assign(p, _connectWithSdk(p)); + }; + + const list = (params: ListAssistantProps, args?: ClientCallArgs) => { + const p = assistantClient.list( + assistantService.ListAssistantsRequest.fromPartial(params), + args, + ); + + return p; + }; + + const deleteMethod = (params: DeleteAssistantProps, args?: ClientCallArgs) => { + const p = assistantClient.delete( + assistantService.DeleteAssistantRequest.fromPartial(params), + args, + ); + return p; + }; + + const listVersions = (params: ListAssistantVersionsProps, args?: ClientCallArgs) => { + const p = assistantClient.listVersions( + assistantService.ListAssistantVersionsRequest.fromPartial(params), + args, + ); + return p; + }; + + const update = (params: UpdateAssistantProps, args?: ClientCallArgs) => { + const p = assistantClient.update( + assistantService.UpdateAssistantRequest.fromPartial(params), + args, + ); + return Object.assign(p, _connectWithSdk(p)); + }; + + const assistantSdk = { create, get, list, delete: deleteMethod, listVersions, update }; + return assistantSdk; +}; + +export type AssistantSdk = ReturnType; diff --git a/clients/ai-assistants-v1/sdk/index.ts b/clients/ai-assistants-v1/sdk/index.ts new file mode 100644 index 00000000..cf8e5aa2 --- /dev/null +++ b/clients/ai-assistants-v1/sdk/index.ts @@ -0,0 +1,4 @@ +export * from './assistantSdk'; +export * from './messageSdk'; +export * from './runSdk'; +export * from './threadSdk'; diff --git a/clients/ai-assistants-v1/sdk/messageSdk.ts b/clients/ai-assistants-v1/sdk/messageSdk.ts new file mode 100644 index 00000000..1babb718 --- /dev/null +++ b/clients/ai-assistants-v1/sdk/messageSdk.ts @@ -0,0 +1,40 @@ +import { messageService } from '..'; +import { + CreateMessageRequest, + GetMessageRequest, + ListMessagesRequest, +} from '../generated/yandex/cloud/ai/assistants/v1/threads/message_service'; +import { ClientCallArgs, SessionArg, TypeFromProtoc } from './types'; + +export type SendMessageProps = TypeFromProtoc; + +export type GetMessageProps = TypeFromProtoc; + +export type ListMessagesProps = TypeFromProtoc; + +export const initMessageSdk = (session: SessionArg) => { + const messageClient = session.client(messageService.MessageServiceClient); + + const send = (params: SendMessageProps, args?: ClientCallArgs) => { + const p = messageClient.create( + messageService.CreateMessageRequest.fromPartial(params), + args, + ); + + return p; + }; + + const get = (params: GetMessageProps, args?: ClientCallArgs) => { + const p = messageClient.get(messageService.GetMessageRequest.fromPartial(params), args); + return p; + }; + + const list = (params: ListMessagesProps, args?: ClientCallArgs) => { + const p = messageClient.list(messageService.ListMessagesRequest.fromPartial(params), args); + return p; + }; + + return { send, get, list }; +}; + +export type MessageSdk = ReturnType; diff --git a/clients/ai-assistants-v1/sdk/runSdk.ts b/clients/ai-assistants-v1/sdk/runSdk.ts new file mode 100644 index 00000000..a2ea9bd9 --- /dev/null +++ b/clients/ai-assistants-v1/sdk/runSdk.ts @@ -0,0 +1,87 @@ +import { ClientCallArgs, SessionArg, TypeFromProtoc } from './types'; + +import { + CreateRunRequest, + GetLastRunByThreadRequest, + GetRunRequest, + ListenRunRequest, + ListRunsRequest, +} from '../generated/yandex/cloud/ai/assistants/v1/runs/run_service'; +import { Run } from '../generated/yandex/cloud/ai/assistants/v1/runs/run'; +import { CallOptions } from '@grpc/grpc-js'; +import { runService } from '..'; + +type GetRunProps = TypeFromProtoc; + +type CreateRunProps = TypeFromProtoc; + +type GetLastRunByThreadProps = TypeFromProtoc; + +type ListRunsProps = TypeFromProtoc; + +type ListenRunProps = TypeFromProtoc; + +export const runWithSdk = >( + session: SessionArg, + run: T, + { + runSdk = initRunSdk(session), + }: { + runSdk?: RunSdk; + }, +) => { + const listen = (params: Omit, args?: ClientCallArgs & CallOptions) => { + return runSdk.listen({ ...params, runId: run.id }, args); + }; + + return Object.assign(run, { listen }); +}; + +export const initRunSdk = (session: SessionArg) => { + const runClient = session.client(runService.RunServiceClient); + + const _connectWithSdk = (runP: Promise) => { + const externalSession = session; + + const withSdk = async (session?: SessionArg | null) => { + const run = await runP; + return runWithSdk(session || externalSession, run, { + runSdk, + }); + }; + + return { withSdk }; + }; + + const create = (params: CreateRunProps, args?: ClientCallArgs) => { + const p = runClient.create(runService.CreateRunRequest.fromPartial(params), args); + return Object.assign(p, _connectWithSdk(p)); + }; + + const get = (params: GetRunProps, args?: ClientCallArgs) => { + const p = runClient.get(runService.GetRunRequest.fromPartial(params), args); + return Object.assign(p, _connectWithSdk(p)); + }; + + const getLastByThread = (params: GetLastRunByThreadProps, args?: ClientCallArgs) => { + const p = runClient.getLastByThread( + runService.GetLastRunByThreadRequest.fromPartial(params), + args, + ); + return Object.assign(p, _connectWithSdk(p)); + }; + + const list = (params: ListRunsProps, args?: ClientCallArgs) => { + const p = runClient.list(runService.ListRunsRequest.fromPartial(params), args); + return p; + }; + + const listen = (params: ListenRunProps, args?: ClientCallArgs & CallOptions) => { + return runClient.listen(runService.ListenRunRequest.fromPartial(params), args); + }; + + const runSdk = { create, get, getLastByThread, list, listen }; + return runSdk; +}; + +export type RunSdk = ReturnType; diff --git a/clients/ai-assistants-v1/sdk/threadSdk.ts b/clients/ai-assistants-v1/sdk/threadSdk.ts new file mode 100644 index 00000000..b48d5de0 --- /dev/null +++ b/clients/ai-assistants-v1/sdk/threadSdk.ts @@ -0,0 +1,114 @@ +import { threadService } from '..'; +import { Thread } from '../generated/yandex/cloud/ai/assistants/v1/threads/thread'; +import { + CreateThreadRequest, + DeleteThreadRequest, + GetThreadRequest, + ListThreadsRequest, + UpdateThreadRequest, +} from '../generated/yandex/cloud/ai/assistants/v1/threads/thread_service'; +import { + GetMessageProps, + initMessageSdk, + ListMessagesProps, + MessageSdk, + SendMessageProps, +} from './messageSdk'; +import { ClientCallArgs, SessionArg, TypeFromProtoc } from './types'; + +type CreateThreadProps = TypeFromProtoc; + +type GetThreadProps = TypeFromProtoc; + +type ListThreadProps = TypeFromProtoc; + +type DeleteThreadProps = TypeFromProtoc; + +type UpdateThreadProps = TypeFromProtoc; + +export const threadWithSdk = >( + session: SessionArg, + thread: T, + { + threadSdk = initThreadSdk(session), + messageSdk = initMessageSdk(session), + }: { + messageSdk?: MessageSdk; + threadSdk?: ThreadSdk; + }, +) => { + const sendMessage = (props: Omit, args?: ClientCallArgs) => { + return messageSdk.send({ threadId: thread.id, ...props }, args); + }; + + const listMessages = (props: Omit, args?: ClientCallArgs) => { + return messageSdk.list({ threadId: thread.id, ...props }, args); + }; + + const getMessage = (props: Omit, args?: ClientCallArgs) => { + return messageSdk.get({ threadId: thread.id, ...props }, args); + }; + + const deleteInnerMethod = (args?: ClientCallArgs) => { + return threadSdk.delete({ threadId: thread.id }, args); + }; + + const updateMethod = (props: Omit, args?: ClientCallArgs) => { + return threadSdk.update({ ...props, threadId: thread.id }, args); + }; + + return Object.assign(thread, { + sendMessage, + listMessages, + getMessage, + delete: deleteInnerMethod, + update: updateMethod, + }); +}; + +export const initThreadSdk = (session: SessionArg) => { + const threadClient = session.client(threadService.ThreadServiceClient); + + const _connectWithSdk = (threadP: Promise) => { + const externalSession = session; + + const withSdk = async (session?: SessionArg | null, messageSdk?: MessageSdk) => { + const thread = await threadP; + return threadWithSdk(session || externalSession, thread, { + threadSdk, + messageSdk, + }); + }; + + return { withSdk }; + }; + + const get = (params: GetThreadProps, args?: ClientCallArgs) => { + const p = threadClient.get(threadService.GetThreadRequest.fromPartial(params), args); + return Object.assign(p, _connectWithSdk(p)); + }; + + const list = (params: ListThreadProps, args?: ClientCallArgs) => { + return threadClient.list(threadService.ListThreadsRequest.fromPartial(params), args); + }; + + const deleteMethod = (params: DeleteThreadProps, args?: ClientCallArgs) => { + return threadClient.delete(threadService.DeleteThreadRequest.fromPartial(params), args); + }; + + const update = (params: UpdateThreadProps, args?: ClientCallArgs) => { + const p = threadClient.update(threadService.UpdateThreadRequest.fromPartial(params), args); + return Object.assign(p, _connectWithSdk(p)); + }; + + const create = (params: CreateThreadProps, args?: ClientCallArgs) => { + const p = threadClient.create(threadService.CreateThreadRequest.fromPartial(params), args); + return Object.assign(p, _connectWithSdk(p)); + }; + + const threadSdk = { create, delete: deleteMethod, get, list, update }; + + return threadSdk; +}; + +export type ThreadSdk = ReturnType; diff --git a/clients/ai-assistants-v1/types.ts b/clients/ai-assistants-v1/sdk/types.ts similarity index 87% rename from clients/ai-assistants-v1/types.ts rename to clients/ai-assistants-v1/sdk/types.ts index 77497f74..a4fbba89 100644 --- a/clients/ai-assistants-v1/types.ts +++ b/clients/ai-assistants-v1/sdk/types.ts @@ -2,7 +2,8 @@ import { ChannelCredentials, ChannelOptions, Client, ServiceDefinition } from '@ import { ClientError, RawClient } from 'nice-grpc'; import { DeadlineOptions } from 'nice-grpc-client-middleware-deadline'; import { NormalizedServiceDefinition } from 'nice-grpc/lib/service-definitions'; -import { Status } from './generated/google/rpc/status'; +import { Status } from '../generated/google/rpc/status'; +import { DeepPartial } from '../generated/typeRegistry'; type RetryOptions = { /** @@ -121,3 +122,17 @@ export type WrappedServiceClientType = RawClient< NormalizedServiceDefinition, ClientCallArgs >; + +export type ClientType = ( + clientClass: GeneratedServiceClientCtor, + customEndpoint?: string, +) => WrappedServiceClientType; + +export type SessionArg = { client: ClientType }; + +export type TypeFromProtoc< + T extends { $type: string }, + NotPartialKey extends keyof Omit = never, +> = { + [Key in NotPartialKey]: T[Key]; +} & DeepPartial;