diff --git a/.github/workflows/router-ci.yaml b/.github/workflows/router-ci.yaml index 93eecd209a..035d7c5661 100644 --- a/.github/workflows/router-ci.yaml +++ b/.github/workflows/router-ci.yaml @@ -49,6 +49,14 @@ jobs: - name: Install tools run: make setup-build-tools + - uses: ./.github/actions/node + + - name: Install Cli Node Dependencies + run: | + pnpm --filter ./cli --filter ./connect --filter ./shared --filter ./composition --filter ./protographic install --frozen-lockfile + pnpm buf generate --template buf.ts.gen.yaml + pnpm --filter ./cli --filter ./connect --filter ./shared --filter ./composition --filter ./protographic run build + - name: Install Bun For Plugin Building uses: oven-sh/setup-bun@v2 with: @@ -132,6 +140,14 @@ jobs: - name: Install tools run: make setup-build-tools + - uses: ./.github/actions/node + + - name: Install Cli Node Dependencies + run: | + pnpm --filter ./cli --filter ./connect --filter ./shared --filter ./composition --filter ./protographic install --frozen-lockfile + pnpm buf generate --template buf.ts.gen.yaml + pnpm --filter ./cli --filter ./connect --filter ./shared --filter ./composition --filter ./protographic run build + - name: Install Bun For Plugin Building uses: oven-sh/setup-bun@v2 with: @@ -307,9 +323,18 @@ jobs: with: cache-dependency-path: | router-tests/go.sum + - name: Install tools run: make setup-build-tools + - uses: ./.github/actions/node + + - name: Install Cli Node Dependencies + run: | + pnpm --filter ./cli --filter ./connect --filter ./shared --filter ./composition --filter ./protographic install --frozen-lockfile + pnpm buf generate --template buf.ts.gen.yaml + pnpm --filter ./cli --filter ./connect --filter ./shared --filter ./composition --filter ./protographic run build + - name: Install Bun For Plugin Building uses: oven-sh/setup-bun@v2 with: diff --git a/cli/src/commands/router/commands/plugin/commands/build.ts b/cli/src/commands/router/commands/plugin/commands/build.ts index 1f7d799fac..ce08265658 100644 --- a/cli/src/commands/router/commands/plugin/commands/build.ts +++ b/cli/src/commands/router/commands/plugin/commands/build.ts @@ -33,12 +33,15 @@ export default (opts: BaseCommandOptions) => { [], ); command.option('--all-platforms', 'Build for all supported platforms', false); + command.option('--skip-tools-installation', 'Skip tool installation', false); command.option( '--force-tools-installation', 'Force tools installation regardless of version check or confirmation', false, ); + command.option('-y, --yes', 'Automatically answer yes to all prompts', false); + command.option('--go-module-path ', 'Go module path to use for the plugin'); command.action(async (directory, options) => { @@ -46,6 +49,7 @@ export default (opts: BaseCommandOptions) => { const pluginDir = resolve(directory); const spinner = Spinner(); const pluginName = path.basename(pluginDir); + const autoConfirmPrompts: boolean = options.yes; const language = getLanguage(pluginDir); if (!language) { @@ -61,7 +65,7 @@ export default (opts: BaseCommandOptions) => { try { // Check and install tools if needed if (!options.skipToolsInstallation) { - await checkAndInstallTools(options.forceToolsInstallation, language); + await checkAndInstallTools(options.forceToolsInstallation, language, autoConfirmPrompts); } // Start the main build process diff --git a/cli/src/commands/router/commands/plugin/commands/generate.ts b/cli/src/commands/router/commands/plugin/commands/generate.ts index d461785a93..fc8cf3187d 100644 --- a/cli/src/commands/router/commands/plugin/commands/generate.ts +++ b/cli/src/commands/router/commands/plugin/commands/generate.ts @@ -28,12 +28,14 @@ export default (opts: BaseCommandOptions) => { false, ); command.option('--go-module-path ', 'Go module path to use for the plugin'); + command.option('-y, --yes', 'Automatically answer yes to all prompts', false); command.action(async (directory, options) => { const startTime = performance.now(); const pluginDir = resolve(directory); const spinner = Spinner(); const pluginName = path.basename(pluginDir); + const autoConfirmPrompts: boolean = options.yes; const language = getLanguage(pluginDir); if (!language) { @@ -48,7 +50,7 @@ export default (opts: BaseCommandOptions) => { try { // Check and install tools if needed if (!options.skipToolsInstallation) { - await checkAndInstallTools(options.forceToolsInstallation, language); + await checkAndInstallTools(options.forceToolsInstallation, language, autoConfirmPrompts); } // Start the generation process diff --git a/cli/src/commands/router/commands/plugin/commands/test.ts b/cli/src/commands/router/commands/plugin/commands/test.ts index 759be29bcf..d635d1c905 100644 --- a/cli/src/commands/router/commands/plugin/commands/test.ts +++ b/cli/src/commands/router/commands/plugin/commands/test.ts @@ -24,12 +24,14 @@ export default (opts: BaseCommandOptions) => { 'Force tools installation regardless of version check or confirmation', false, ); + command.option('-y, --yes', 'Automatically answer yes to all prompts', false); command.action(async (directory, options) => { const startTime = performance.now(); const pluginDir = resolve(directory); const spinner = Spinner({ text: 'Running tests...' }); const pluginName = path.basename(pluginDir); + const autoConfirmPrompts: boolean = options.yes; const language = getLanguage(pluginDir); if (!language) { @@ -42,7 +44,7 @@ export default (opts: BaseCommandOptions) => { try { // Check and install tools if needed if (!options.skipToolsInstallation) { - await checkAndInstallTools(options.forceToolsInstallation, language); + await checkAndInstallTools(options.forceToolsInstallation, language, autoConfirmPrompts); } spinner.start(); diff --git a/cli/src/commands/router/commands/plugin/toolchain.ts b/cli/src/commands/router/commands/plugin/toolchain.ts index e5b35c6c51..5fa8107ddf 100644 --- a/cli/src/commands/router/commands/plugin/toolchain.ts +++ b/cli/src/commands/router/commands/plugin/toolchain.ts @@ -354,22 +354,22 @@ export function validateAndGetGoModulePath(language: string, goModulePath: strin /** * Check if tools need installation and ask the user if needed */ -export async function checkAndInstallTools(force = false, language: string): Promise { +export async function checkAndInstallTools( + force = false, + language: string, + autoConfirmPrompts: boolean, +): Promise { const [needsReinstall, shouldCleanup] = await shouldReinstallTools(force, language); if (!needsReinstall) { return true; } - // Ask user for confirmation to install tools - const installMessage = existsSync(TOOLS_DIR) - ? 'Version changes detected. Install required toolchain?' - : 'Install required toolchain?'; - const toolVersionsForLanguage = LanguageSpecificTools[language]; // Create a more informative message with simple formatting const toolsInfo = Object.entries(toolVersionsForLanguage) + .filter(([tool]) => shouldCleanup || !Object.keys(COMMON_TOOL_VERSIONS).includes(tool)) .map(([tool, { range: version }]) => ` ${pc.cyan('•')} ${pc.bold(tool)}: ${version}`) .join('\n'); @@ -379,22 +379,35 @@ export async function checkAndInstallTools(force = false, language: string): Pro pc.white('The following tools are needed to build the router plugin:') + '\n\n' + toolsInfo + - '\n\n' + - pc.white('You can install them automatically or manually install them yourself') + - '\n' + - pc.white('by following the documentation at https://cosmo-docs.wundergraph.com') + - '\n', + '\n\n', ); - const response = await prompts({ - type: 'confirm', - name: 'installTools', - message: installMessage, - }); + // In case of auto-confirm, skip the prompt + if (autoConfirmPrompts) { + console.log(pc.white('These tools will now be automatically installed') + '\n'); + } else { + console.log( + pc.white('You can install them automatically or manually install them yourself') + + '\n' + + pc.white('by following the documentation at https://cosmo-docs.wundergraph.com') + + '\n', + ); + + // Ask user for confirmation to install tools + const installMessage = existsSync(TOOLS_DIR) + ? 'Version changes detected. Install required toolchain?' + : 'Install required toolchain?'; + + const response = await prompts({ + type: 'confirm', + name: 'installTools', + message: installMessage, + }); - if (!response.installTools) { - console.log(pc.yellow('Tools installation skipped. Build may fail.')); - return false; + if (!response.installTools) { + console.log(pc.yellow('Tools installation skipped. Build may fail.')); + return false; + } } try { diff --git a/demo/Makefile b/demo/Makefile index b765968f35..05483aade7 100644 --- a/demo/Makefile +++ b/demo/Makefile @@ -1,5 +1,6 @@ SHELL := bash -wgc_router = pnpx tsx --env-file ../cli/.env ../cli/src/index.ts router +wgc_router = pnpm dlx tsx --env-file ../cli/.env ../cli/src/index.ts router +wgc_router_ci = pnpm dlx tsx ../cli/src/index.ts router generate: go generate ./... @@ -10,7 +11,7 @@ compose-integration: bump-deps: ./bump-deps.sh -.PHONY: plugin-build plugin-generate plugin-build-bun-binary plugin-build-go-binary plugin-build-integration +.PHONY: plugin-build plugin-generate plugin-build-ci-bun-binary plugin-build-ci-go-binary plugin-build-integration plugin-build: $(wgc_router) plugin build ./pkg/subgraphs/projects --debug --go-module-path github.com/wundergraph/cosmo/demo/pkg/subgraphs/projects @@ -20,14 +21,11 @@ plugin-generate: $(wgc_router) plugin build ./pkg/subgraphs/projects --generate-only --go-module-path github.com/wundergraph/cosmo/demo/pkg/subgraphs/projects $(wgc_router) plugin build ./pkg/subgraphs/courses --generate-only -plugin-build-bun-binary: - cd pkg/subgraphs/courses/ && \ - bun install && bun build src/plugin.ts --compile --outfile bin/$(shell go env GOOS)_$(shell go env GOARCH) && \ - mkdir -p bin/grpc-health-check && \ - cp -r node_modules/grpc-health-check/proto bin/grpc-health-check +plugin-build-ci-bun-binary: + $(wgc_router_ci) plugin build ./pkg/subgraphs/courses --yes -plugin-build-go-binary: - cd pkg/subgraphs/projects/ && go build -o ./bin/$(shell go env GOOS)_$(shell go env GOARCH) ./src +plugin-build-ci-go-binary: + $(wgc_router_ci) plugin build ./pkg/subgraphs/projects --yes plugin-compose: $(wgc_router) compose -i ./graph-with-plugin.yaml -o ./configWithPlugins.json @@ -39,7 +37,7 @@ plugin-build-integration: plugin-build plugin-compose cp -a pkg/subgraphs/courses ../router/plugins/ mv configWithPlugins.json ../router-tests/testenv/testdata/configWithPlugins.json -plugin-build-ci: plugin-build-go-binary plugin-build-bun-binary +plugin-build-ci: plugin-build-ci-go-binary plugin-build-ci-bun-binary rm -rf ../router/plugins/* mkdir -p ../router/plugins/projects/bin mkdir -p ../router/plugins/courses/bin diff --git a/demo/pkg/subgraphs/courses/generated/mapping.json b/demo/pkg/subgraphs/courses/generated/mapping.json index 6e1350ddc8..994f15a039 100644 --- a/demo/pkg/subgraphs/courses/generated/mapping.json +++ b/demo/pkg/subgraphs/courses/generated/mapping.json @@ -53,22 +53,6 @@ } ], "entityMappings": [ - { - "typeName": "Course", - "kind": "entity", - "key": "id", - "rpc": "LookupCourseById", - "request": "LookupCourseByIdRequest", - "response": "LookupCourseByIdResponse" - }, - { - "typeName": "Lesson", - "kind": "entity", - "key": "id", - "rpc": "LookupLessonById", - "request": "LookupLessonByIdRequest", - "response": "LookupLessonByIdResponse" - }, { "typeName": "Employee", "kind": "entity", diff --git a/demo/pkg/subgraphs/courses/generated/service.proto b/demo/pkg/subgraphs/courses/generated/service.proto index f24e97db9a..863a9c5b22 100644 --- a/demo/pkg/subgraphs/courses/generated/service.proto +++ b/demo/pkg/subgraphs/courses/generated/service.proto @@ -5,12 +5,8 @@ import "google/protobuf/wrappers.proto"; // Service definition for CoursesService service CoursesService { - // Lookup Course entity by id - rpc LookupCourseById(LookupCourseByIdRequest) returns (LookupCourseByIdResponse) {} // Lookup Employee entity by id rpc LookupEmployeeById(LookupEmployeeByIdRequest) returns (LookupEmployeeByIdResponse) {} - // Lookup Lesson entity by id - rpc LookupLessonById(LookupLessonByIdRequest) returns (LookupLessonByIdResponse) {} rpc MutationAddCourse(MutationAddCourseRequest) returns (MutationAddCourseResponse) {} rpc MutationAddLesson(MutationAddLessonRequest) returns (MutationAddLessonResponse) {} rpc QueryCourse(QueryCourseRequest) returns (QueryCourseResponse) {} @@ -20,74 +16,6 @@ service CoursesService { rpc QueryThrowErrorCourses(QueryThrowErrorCoursesRequest) returns (QueryThrowErrorCoursesResponse) {} } -// Key message for Course entity lookup -message LookupCourseByIdRequestKey { - // Key field for Course entity lookup. - string id = 1; -} - -// Request message for Course entity lookup. -message LookupCourseByIdRequest { - /* - * List of keys to look up Course entities. - * Order matters - each key maps to one entity in LookupCourseByIdResponse. - */ - repeated LookupCourseByIdRequestKey keys = 1; -} - -// Response message for Course entity lookup. -message LookupCourseByIdResponse { - /* - * List of Course entities in the same order as the keys in LookupCourseByIdRequest. - * Always return the same number of entities as keys. Use null for entities that cannot be found. - * - * Example: - * LookupUserByIdRequest: - * keys: - * - id: 1 - * - id: 2 - * LookupUserByIdResponse: - * result: - * - id: 1 # User with id 1 found - * - null # User with id 2 not found - */ - repeated Course result = 1; -} - -// Key message for Lesson entity lookup -message LookupLessonByIdRequestKey { - // Key field for Lesson entity lookup. - string id = 1; -} - -// Request message for Lesson entity lookup. -message LookupLessonByIdRequest { - /* - * List of keys to look up Lesson entities. - * Order matters - each key maps to one entity in LookupLessonByIdResponse. - */ - repeated LookupLessonByIdRequestKey keys = 1; -} - -// Response message for Lesson entity lookup. -message LookupLessonByIdResponse { - /* - * List of Lesson entities in the same order as the keys in LookupLessonByIdRequest. - * Always return the same number of entities as keys. Use null for entities that cannot be found. - * - * Example: - * LookupUserByIdRequest: - * keys: - * - id: 1 - * - id: 2 - * LookupUserByIdResponse: - * result: - * - id: 1 # User with id 1 found - * - null # User with id 2 not found - */ - repeated Lesson result = 1; -} - // Key message for Employee entity lookup message LookupEmployeeByIdRequestKey { // Key field for Employee entity lookup. @@ -179,6 +107,11 @@ message MutationAddLessonResponse { Lesson add_lesson = 1; } +message Employee { + int32 id = 1; + repeated Course taught_courses = 2; +} + message Course { string id = 1; string title = 2; @@ -194,9 +127,4 @@ message Lesson { google.protobuf.StringValue description = 4; int32 order = 5; Course course = 6; -} - -message Employee { - int32 id = 1; - repeated Course taught_courses = 2; } \ No newline at end of file diff --git a/demo/pkg/subgraphs/courses/generated/service_grpc_pb.d.ts b/demo/pkg/subgraphs/courses/generated/service_grpc_pb.d.ts index c23cc7e58d..c5a9107abb 100644 --- a/demo/pkg/subgraphs/courses/generated/service_grpc_pb.d.ts +++ b/demo/pkg/subgraphs/courses/generated/service_grpc_pb.d.ts @@ -9,9 +9,7 @@ import * as service_pb from "./service_pb"; import * as google_protobuf_wrappers_pb from "google-protobuf/google/protobuf/wrappers_pb"; interface ICoursesServiceService extends grpc.ServiceDefinition { - lookupCourseById: ICoursesServiceService_ILookupCourseById; lookupEmployeeById: ICoursesServiceService_ILookupEmployeeById; - lookupLessonById: ICoursesServiceService_ILookupLessonById; mutationAddCourse: ICoursesServiceService_IMutationAddCourse; mutationAddLesson: ICoursesServiceService_IMutationAddLesson; queryCourse: ICoursesServiceService_IQueryCourse; @@ -21,15 +19,6 @@ interface ICoursesServiceService extends grpc.ServiceDefinition { - path: "/service.CoursesService/LookupCourseById"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} interface ICoursesServiceService_ILookupEmployeeById extends grpc.MethodDefinition { path: "/service.CoursesService/LookupEmployeeById"; requestStream: false; @@ -39,15 +28,6 @@ interface ICoursesServiceService_ILookupEmployeeById extends grpc.MethodDefiniti responseSerialize: grpc.serialize; responseDeserialize: grpc.deserialize; } -interface ICoursesServiceService_ILookupLessonById extends grpc.MethodDefinition { - path: "/service.CoursesService/LookupLessonById"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} interface ICoursesServiceService_IMutationAddCourse extends grpc.MethodDefinition { path: "/service.CoursesService/MutationAddCourse"; requestStream: false; @@ -115,9 +95,7 @@ interface ICoursesServiceService_IQueryThrowErrorCourses extends grpc.MethodDefi export const CoursesServiceService: ICoursesServiceService; export interface ICoursesServiceServer extends grpc.UntypedServiceImplementation { - lookupCourseById: grpc.handleUnaryCall; lookupEmployeeById: grpc.handleUnaryCall; - lookupLessonById: grpc.handleUnaryCall; mutationAddCourse: grpc.handleUnaryCall; mutationAddLesson: grpc.handleUnaryCall; queryCourse: grpc.handleUnaryCall; @@ -128,15 +106,9 @@ export interface ICoursesServiceServer extends grpc.UntypedServiceImplementation } export interface ICoursesServiceClient { - lookupCourseById(request: service_pb.LookupCourseByIdRequest, callback: (error: grpc.ServiceError | null, response: service_pb.LookupCourseByIdResponse) => void): grpc.ClientUnaryCall; - lookupCourseById(request: service_pb.LookupCourseByIdRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.LookupCourseByIdResponse) => void): grpc.ClientUnaryCall; - lookupCourseById(request: service_pb.LookupCourseByIdRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.LookupCourseByIdResponse) => void): grpc.ClientUnaryCall; lookupEmployeeById(request: service_pb.LookupEmployeeByIdRequest, callback: (error: grpc.ServiceError | null, response: service_pb.LookupEmployeeByIdResponse) => void): grpc.ClientUnaryCall; lookupEmployeeById(request: service_pb.LookupEmployeeByIdRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.LookupEmployeeByIdResponse) => void): grpc.ClientUnaryCall; lookupEmployeeById(request: service_pb.LookupEmployeeByIdRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.LookupEmployeeByIdResponse) => void): grpc.ClientUnaryCall; - lookupLessonById(request: service_pb.LookupLessonByIdRequest, callback: (error: grpc.ServiceError | null, response: service_pb.LookupLessonByIdResponse) => void): grpc.ClientUnaryCall; - lookupLessonById(request: service_pb.LookupLessonByIdRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.LookupLessonByIdResponse) => void): grpc.ClientUnaryCall; - lookupLessonById(request: service_pb.LookupLessonByIdRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.LookupLessonByIdResponse) => void): grpc.ClientUnaryCall; mutationAddCourse(request: service_pb.MutationAddCourseRequest, callback: (error: grpc.ServiceError | null, response: service_pb.MutationAddCourseResponse) => void): grpc.ClientUnaryCall; mutationAddCourse(request: service_pb.MutationAddCourseRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.MutationAddCourseResponse) => void): grpc.ClientUnaryCall; mutationAddCourse(request: service_pb.MutationAddCourseRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.MutationAddCourseResponse) => void): grpc.ClientUnaryCall; @@ -162,15 +134,9 @@ export interface ICoursesServiceClient { export class CoursesServiceClient extends grpc.Client implements ICoursesServiceClient { constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public lookupCourseById(request: service_pb.LookupCourseByIdRequest, callback: (error: grpc.ServiceError | null, response: service_pb.LookupCourseByIdResponse) => void): grpc.ClientUnaryCall; - public lookupCourseById(request: service_pb.LookupCourseByIdRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.LookupCourseByIdResponse) => void): grpc.ClientUnaryCall; - public lookupCourseById(request: service_pb.LookupCourseByIdRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.LookupCourseByIdResponse) => void): grpc.ClientUnaryCall; public lookupEmployeeById(request: service_pb.LookupEmployeeByIdRequest, callback: (error: grpc.ServiceError | null, response: service_pb.LookupEmployeeByIdResponse) => void): grpc.ClientUnaryCall; public lookupEmployeeById(request: service_pb.LookupEmployeeByIdRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.LookupEmployeeByIdResponse) => void): grpc.ClientUnaryCall; public lookupEmployeeById(request: service_pb.LookupEmployeeByIdRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.LookupEmployeeByIdResponse) => void): grpc.ClientUnaryCall; - public lookupLessonById(request: service_pb.LookupLessonByIdRequest, callback: (error: grpc.ServiceError | null, response: service_pb.LookupLessonByIdResponse) => void): grpc.ClientUnaryCall; - public lookupLessonById(request: service_pb.LookupLessonByIdRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.LookupLessonByIdResponse) => void): grpc.ClientUnaryCall; - public lookupLessonById(request: service_pb.LookupLessonByIdRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.LookupLessonByIdResponse) => void): grpc.ClientUnaryCall; public mutationAddCourse(request: service_pb.MutationAddCourseRequest, callback: (error: grpc.ServiceError | null, response: service_pb.MutationAddCourseResponse) => void): grpc.ClientUnaryCall; public mutationAddCourse(request: service_pb.MutationAddCourseRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: service_pb.MutationAddCourseResponse) => void): grpc.ClientUnaryCall; public mutationAddCourse(request: service_pb.MutationAddCourseRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: service_pb.MutationAddCourseResponse) => void): grpc.ClientUnaryCall; diff --git a/demo/pkg/subgraphs/courses/generated/service_grpc_pb.js b/demo/pkg/subgraphs/courses/generated/service_grpc_pb.js index c73f40af88..7cedc86570 100644 --- a/demo/pkg/subgraphs/courses/generated/service_grpc_pb.js +++ b/demo/pkg/subgraphs/courses/generated/service_grpc_pb.js @@ -5,28 +5,6 @@ var grpc = require('@grpc/grpc-js'); var service_pb = require('./service_pb.js'); var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js'); -function serialize_service_LookupCourseByIdRequest(arg) { - if (!(arg instanceof service_pb.LookupCourseByIdRequest)) { - throw new Error('Expected argument of type service.LookupCourseByIdRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_service_LookupCourseByIdRequest(buffer_arg) { - return service_pb.LookupCourseByIdRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_service_LookupCourseByIdResponse(arg) { - if (!(arg instanceof service_pb.LookupCourseByIdResponse)) { - throw new Error('Expected argument of type service.LookupCourseByIdResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_service_LookupCourseByIdResponse(buffer_arg) { - return service_pb.LookupCourseByIdResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - function serialize_service_LookupEmployeeByIdRequest(arg) { if (!(arg instanceof service_pb.LookupEmployeeByIdRequest)) { throw new Error('Expected argument of type service.LookupEmployeeByIdRequest'); @@ -49,28 +27,6 @@ function deserialize_service_LookupEmployeeByIdResponse(buffer_arg) { return service_pb.LookupEmployeeByIdResponse.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_service_LookupLessonByIdRequest(arg) { - if (!(arg instanceof service_pb.LookupLessonByIdRequest)) { - throw new Error('Expected argument of type service.LookupLessonByIdRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_service_LookupLessonByIdRequest(buffer_arg) { - return service_pb.LookupLessonByIdRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_service_LookupLessonByIdResponse(arg) { - if (!(arg instanceof service_pb.LookupLessonByIdResponse)) { - throw new Error('Expected argument of type service.LookupLessonByIdResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_service_LookupLessonByIdResponse(buffer_arg) { - return service_pb.LookupLessonByIdResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - function serialize_service_MutationAddCourseRequest(arg) { if (!(arg instanceof service_pb.MutationAddCourseRequest)) { throw new Error('Expected argument of type service.MutationAddCourseRequest'); @@ -228,18 +184,6 @@ function deserialize_service_QueryThrowErrorCoursesResponse(buffer_arg) { // Service definition for CoursesService var CoursesServiceService = exports.CoursesServiceService = { - // Lookup Course entity by id -lookupCourseById: { - path: '/service.CoursesService/LookupCourseById', - requestStream: false, - responseStream: false, - requestType: service_pb.LookupCourseByIdRequest, - responseType: service_pb.LookupCourseByIdResponse, - requestSerialize: serialize_service_LookupCourseByIdRequest, - requestDeserialize: deserialize_service_LookupCourseByIdRequest, - responseSerialize: serialize_service_LookupCourseByIdResponse, - responseDeserialize: deserialize_service_LookupCourseByIdResponse, - }, // Lookup Employee entity by id lookupEmployeeById: { path: '/service.CoursesService/LookupEmployeeById', @@ -252,18 +196,6 @@ lookupEmployeeById: { responseSerialize: serialize_service_LookupEmployeeByIdResponse, responseDeserialize: deserialize_service_LookupEmployeeByIdResponse, }, - // Lookup Lesson entity by id -lookupLessonById: { - path: '/service.CoursesService/LookupLessonById', - requestStream: false, - responseStream: false, - requestType: service_pb.LookupLessonByIdRequest, - responseType: service_pb.LookupLessonByIdResponse, - requestSerialize: serialize_service_LookupLessonByIdRequest, - requestDeserialize: deserialize_service_LookupLessonByIdRequest, - responseSerialize: serialize_service_LookupLessonByIdResponse, - responseDeserialize: deserialize_service_LookupLessonByIdResponse, - }, mutationAddCourse: { path: '/service.CoursesService/MutationAddCourse', requestStream: false, diff --git a/demo/pkg/subgraphs/courses/generated/service_pb.d.ts b/demo/pkg/subgraphs/courses/generated/service_pb.d.ts index 1489741cc7..a138d7aaa8 100644 --- a/demo/pkg/subgraphs/courses/generated/service_pb.d.ts +++ b/demo/pkg/subgraphs/courses/generated/service_pb.d.ts @@ -7,134 +7,6 @@ import * as jspb from "google-protobuf"; import * as google_protobuf_wrappers_pb from "google-protobuf/google/protobuf/wrappers_pb"; -export class LookupCourseByIdRequestKey extends jspb.Message { - getId(): string; - setId(value: string): LookupCourseByIdRequestKey; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LookupCourseByIdRequestKey.AsObject; - static toObject(includeInstance: boolean, msg: LookupCourseByIdRequestKey): LookupCourseByIdRequestKey.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LookupCourseByIdRequestKey, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LookupCourseByIdRequestKey; - static deserializeBinaryFromReader(message: LookupCourseByIdRequestKey, reader: jspb.BinaryReader): LookupCourseByIdRequestKey; -} - -export namespace LookupCourseByIdRequestKey { - export type AsObject = { - id: string, - } -} - -export class LookupCourseByIdRequest extends jspb.Message { - clearKeysList(): void; - getKeysList(): Array; - setKeysList(value: Array): LookupCourseByIdRequest; - addKeys(value?: LookupCourseByIdRequestKey, index?: number): LookupCourseByIdRequestKey; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LookupCourseByIdRequest.AsObject; - static toObject(includeInstance: boolean, msg: LookupCourseByIdRequest): LookupCourseByIdRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LookupCourseByIdRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LookupCourseByIdRequest; - static deserializeBinaryFromReader(message: LookupCourseByIdRequest, reader: jspb.BinaryReader): LookupCourseByIdRequest; -} - -export namespace LookupCourseByIdRequest { - export type AsObject = { - keysList: Array, - } -} - -export class LookupCourseByIdResponse extends jspb.Message { - clearResultList(): void; - getResultList(): Array; - setResultList(value: Array): LookupCourseByIdResponse; - addResult(value?: Course, index?: number): Course; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LookupCourseByIdResponse.AsObject; - static toObject(includeInstance: boolean, msg: LookupCourseByIdResponse): LookupCourseByIdResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LookupCourseByIdResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LookupCourseByIdResponse; - static deserializeBinaryFromReader(message: LookupCourseByIdResponse, reader: jspb.BinaryReader): LookupCourseByIdResponse; -} - -export namespace LookupCourseByIdResponse { - export type AsObject = { - resultList: Array, - } -} - -export class LookupLessonByIdRequestKey extends jspb.Message { - getId(): string; - setId(value: string): LookupLessonByIdRequestKey; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LookupLessonByIdRequestKey.AsObject; - static toObject(includeInstance: boolean, msg: LookupLessonByIdRequestKey): LookupLessonByIdRequestKey.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LookupLessonByIdRequestKey, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LookupLessonByIdRequestKey; - static deserializeBinaryFromReader(message: LookupLessonByIdRequestKey, reader: jspb.BinaryReader): LookupLessonByIdRequestKey; -} - -export namespace LookupLessonByIdRequestKey { - export type AsObject = { - id: string, - } -} - -export class LookupLessonByIdRequest extends jspb.Message { - clearKeysList(): void; - getKeysList(): Array; - setKeysList(value: Array): LookupLessonByIdRequest; - addKeys(value?: LookupLessonByIdRequestKey, index?: number): LookupLessonByIdRequestKey; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LookupLessonByIdRequest.AsObject; - static toObject(includeInstance: boolean, msg: LookupLessonByIdRequest): LookupLessonByIdRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LookupLessonByIdRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LookupLessonByIdRequest; - static deserializeBinaryFromReader(message: LookupLessonByIdRequest, reader: jspb.BinaryReader): LookupLessonByIdRequest; -} - -export namespace LookupLessonByIdRequest { - export type AsObject = { - keysList: Array, - } -} - -export class LookupLessonByIdResponse extends jspb.Message { - clearResultList(): void; - getResultList(): Array; - setResultList(value: Array): LookupLessonByIdResponse; - addResult(value?: Lesson, index?: number): Lesson; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LookupLessonByIdResponse.AsObject; - static toObject(includeInstance: boolean, msg: LookupLessonByIdResponse): LookupLessonByIdResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LookupLessonByIdResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LookupLessonByIdResponse; - static deserializeBinaryFromReader(message: LookupLessonByIdResponse, reader: jspb.BinaryReader): LookupLessonByIdResponse; -} - -export namespace LookupLessonByIdResponse { - export type AsObject = { - resultList: Array, - } -} - export class LookupEmployeeByIdRequestKey extends jspb.Message { getId(): string; setId(value: string): LookupEmployeeByIdRequestKey; @@ -492,6 +364,31 @@ export namespace MutationAddLessonResponse { } } +export class Employee extends jspb.Message { + getId(): number; + setId(value: number): Employee; + clearTaughtCoursesList(): void; + getTaughtCoursesList(): Array; + setTaughtCoursesList(value: Array): Employee; + addTaughtCourses(value?: Course, index?: number): Course; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): Employee.AsObject; + static toObject(includeInstance: boolean, msg: Employee): Employee.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: Employee, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): Employee; + static deserializeBinaryFromReader(message: Employee, reader: jspb.BinaryReader): Employee; +} + +export namespace Employee { + export type AsObject = { + id: number, + taughtCoursesList: Array, + } +} + export class Course extends jspb.Message { getId(): string; setId(value: string): Course; @@ -572,28 +469,3 @@ export namespace Lesson { course?: Course.AsObject, } } - -export class Employee extends jspb.Message { - getId(): number; - setId(value: number): Employee; - clearTaughtCoursesList(): void; - getTaughtCoursesList(): Array; - setTaughtCoursesList(value: Array): Employee; - addTaughtCourses(value?: Course, index?: number): Course; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): Employee.AsObject; - static toObject(includeInstance: boolean, msg: Employee): Employee.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: Employee, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): Employee; - static deserializeBinaryFromReader(message: Employee, reader: jspb.BinaryReader): Employee; -} - -export namespace Employee { - export type AsObject = { - id: number, - taughtCoursesList: Array, - } -} diff --git a/demo/pkg/subgraphs/courses/generated/service_pb.js b/demo/pkg/subgraphs/courses/generated/service_pb.js index 754901662e..602a0ae364 100644 --- a/demo/pkg/subgraphs/courses/generated/service_pb.js +++ b/demo/pkg/subgraphs/courses/generated/service_pb.js @@ -20,15 +20,9 @@ goog.object.extend(proto, google_protobuf_wrappers_pb); goog.exportSymbol('proto.service.Course', null, global); goog.exportSymbol('proto.service.Employee', null, global); goog.exportSymbol('proto.service.Lesson', null, global); -goog.exportSymbol('proto.service.LookupCourseByIdRequest', null, global); -goog.exportSymbol('proto.service.LookupCourseByIdRequestKey', null, global); -goog.exportSymbol('proto.service.LookupCourseByIdResponse', null, global); goog.exportSymbol('proto.service.LookupEmployeeByIdRequest', null, global); goog.exportSymbol('proto.service.LookupEmployeeByIdRequestKey', null, global); goog.exportSymbol('proto.service.LookupEmployeeByIdResponse', null, global); -goog.exportSymbol('proto.service.LookupLessonByIdRequest', null, global); -goog.exportSymbol('proto.service.LookupLessonByIdRequestKey', null, global); -goog.exportSymbol('proto.service.LookupLessonByIdResponse', null, global); goog.exportSymbol('proto.service.MutationAddCourseRequest', null, global); goog.exportSymbol('proto.service.MutationAddCourseResponse', null, global); goog.exportSymbol('proto.service.MutationAddLessonRequest', null, global); @@ -43,132 +37,6 @@ goog.exportSymbol('proto.service.QueryLessonsRequest', null, global); goog.exportSymbol('proto.service.QueryLessonsResponse', null, global); goog.exportSymbol('proto.service.QueryThrowErrorCoursesRequest', null, global); goog.exportSymbol('proto.service.QueryThrowErrorCoursesResponse', null, global); -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.service.LookupCourseByIdRequestKey = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.service.LookupCourseByIdRequestKey, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.service.LookupCourseByIdRequestKey.displayName = 'proto.service.LookupCourseByIdRequestKey'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.service.LookupCourseByIdRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.service.LookupCourseByIdRequest.repeatedFields_, null); -}; -goog.inherits(proto.service.LookupCourseByIdRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.service.LookupCourseByIdRequest.displayName = 'proto.service.LookupCourseByIdRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.service.LookupCourseByIdResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.service.LookupCourseByIdResponse.repeatedFields_, null); -}; -goog.inherits(proto.service.LookupCourseByIdResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.service.LookupCourseByIdResponse.displayName = 'proto.service.LookupCourseByIdResponse'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.service.LookupLessonByIdRequestKey = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.service.LookupLessonByIdRequestKey, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.service.LookupLessonByIdRequestKey.displayName = 'proto.service.LookupLessonByIdRequestKey'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.service.LookupLessonByIdRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.service.LookupLessonByIdRequest.repeatedFields_, null); -}; -goog.inherits(proto.service.LookupLessonByIdRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.service.LookupLessonByIdRequest.displayName = 'proto.service.LookupLessonByIdRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.service.LookupLessonByIdResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.service.LookupLessonByIdResponse.repeatedFields_, null); -}; -goog.inherits(proto.service.LookupLessonByIdResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.service.LookupLessonByIdResponse.displayName = 'proto.service.LookupLessonByIdResponse'; -} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -536,16 +404,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.service.Course = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.service.Course.repeatedFields_, null); +proto.service.Employee = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.service.Employee.repeatedFields_, null); }; -goog.inherits(proto.service.Course, jspb.Message); +goog.inherits(proto.service.Employee, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.service.Course.displayName = 'proto.service.Course'; + proto.service.Employee.displayName = 'proto.service.Employee'; } /** * Generated by JsPbCodeGenerator. @@ -557,16 +425,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.service.Lesson = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); +proto.service.Course = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.service.Course.repeatedFields_, null); }; -goog.inherits(proto.service.Lesson, jspb.Message); +goog.inherits(proto.service.Course, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.service.Lesson.displayName = 'proto.service.Lesson'; + proto.service.Course.displayName = 'proto.service.Course'; } /** * Generated by JsPbCodeGenerator. @@ -578,16 +446,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.service.Employee = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.service.Employee.repeatedFields_, null); +proto.service.Lesson = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.service.Employee, jspb.Message); +goog.inherits(proto.service.Lesson, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.service.Employee.displayName = 'proto.service.Employee'; + proto.service.Lesson.displayName = 'proto.service.Lesson'; } @@ -605,8 +473,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.service.LookupCourseByIdRequestKey.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupCourseByIdRequestKey.toObject(opt_includeInstance, this); +proto.service.LookupEmployeeByIdRequestKey.prototype.toObject = function(opt_includeInstance) { + return proto.service.LookupEmployeeByIdRequestKey.toObject(opt_includeInstance, this); }; @@ -615,11 +483,11 @@ proto.service.LookupCourseByIdRequestKey.prototype.toObject = function(opt_inclu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.service.LookupCourseByIdRequestKey} msg The msg instance to transform. + * @param {!proto.service.LookupEmployeeByIdRequestKey} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupCourseByIdRequestKey.toObject = function(includeInstance, msg) { +proto.service.LookupEmployeeByIdRequestKey.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, "") }; @@ -635,23 +503,23 @@ id: jspb.Message.getFieldWithDefault(msg, 1, "") /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupCourseByIdRequestKey} + * @return {!proto.service.LookupEmployeeByIdRequestKey} */ -proto.service.LookupCourseByIdRequestKey.deserializeBinary = function(bytes) { +proto.service.LookupEmployeeByIdRequestKey.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupCourseByIdRequestKey; - return proto.service.LookupCourseByIdRequestKey.deserializeBinaryFromReader(msg, reader); + var msg = new proto.service.LookupEmployeeByIdRequestKey; + return proto.service.LookupEmployeeByIdRequestKey.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.service.LookupCourseByIdRequestKey} msg The message object to deserialize into. + * @param {!proto.service.LookupEmployeeByIdRequestKey} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupCourseByIdRequestKey} + * @return {!proto.service.LookupEmployeeByIdRequestKey} */ -proto.service.LookupCourseByIdRequestKey.deserializeBinaryFromReader = function(msg, reader) { +proto.service.LookupEmployeeByIdRequestKey.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -675,9 +543,9 @@ proto.service.LookupCourseByIdRequestKey.deserializeBinaryFromReader = function( * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.service.LookupCourseByIdRequestKey.prototype.serializeBinary = function() { +proto.service.LookupEmployeeByIdRequestKey.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.service.LookupCourseByIdRequestKey.serializeBinaryToWriter(this, writer); + proto.service.LookupEmployeeByIdRequestKey.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -685,11 +553,11 @@ proto.service.LookupCourseByIdRequestKey.prototype.serializeBinary = function() /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupCourseByIdRequestKey} message + * @param {!proto.service.LookupEmployeeByIdRequestKey} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupCourseByIdRequestKey.serializeBinaryToWriter = function(message, writer) { +proto.service.LookupEmployeeByIdRequestKey.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f.length > 0) { @@ -705,16 +573,16 @@ proto.service.LookupCourseByIdRequestKey.serializeBinaryToWriter = function(mess * optional string id = 1; * @return {string} */ -proto.service.LookupCourseByIdRequestKey.prototype.getId = function() { +proto.service.LookupEmployeeByIdRequestKey.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.service.LookupCourseByIdRequestKey} returns this + * @return {!proto.service.LookupEmployeeByIdRequestKey} returns this */ -proto.service.LookupCourseByIdRequestKey.prototype.setId = function(value) { +proto.service.LookupEmployeeByIdRequestKey.prototype.setId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -725,7 +593,7 @@ proto.service.LookupCourseByIdRequestKey.prototype.setId = function(value) { * @private {!Array} * @const */ -proto.service.LookupCourseByIdRequest.repeatedFields_ = [1]; +proto.service.LookupEmployeeByIdRequest.repeatedFields_ = [1]; @@ -742,8 +610,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.service.LookupCourseByIdRequest.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupCourseByIdRequest.toObject(opt_includeInstance, this); +proto.service.LookupEmployeeByIdRequest.prototype.toObject = function(opt_includeInstance) { + return proto.service.LookupEmployeeByIdRequest.toObject(opt_includeInstance, this); }; @@ -752,14 +620,14 @@ proto.service.LookupCourseByIdRequest.prototype.toObject = function(opt_includeI * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.service.LookupCourseByIdRequest} msg The msg instance to transform. + * @param {!proto.service.LookupEmployeeByIdRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupCourseByIdRequest.toObject = function(includeInstance, msg) { +proto.service.LookupEmployeeByIdRequest.toObject = function(includeInstance, msg) { var f, obj = { keysList: jspb.Message.toObjectList(msg.getKeysList(), - proto.service.LookupCourseByIdRequestKey.toObject, includeInstance) + proto.service.LookupEmployeeByIdRequestKey.toObject, includeInstance) }; if (includeInstance) { @@ -773,23 +641,23 @@ keysList: jspb.Message.toObjectList(msg.getKeysList(), /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupCourseByIdRequest} + * @return {!proto.service.LookupEmployeeByIdRequest} */ -proto.service.LookupCourseByIdRequest.deserializeBinary = function(bytes) { +proto.service.LookupEmployeeByIdRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupCourseByIdRequest; - return proto.service.LookupCourseByIdRequest.deserializeBinaryFromReader(msg, reader); + var msg = new proto.service.LookupEmployeeByIdRequest; + return proto.service.LookupEmployeeByIdRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.service.LookupCourseByIdRequest} msg The message object to deserialize into. + * @param {!proto.service.LookupEmployeeByIdRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupCourseByIdRequest} + * @return {!proto.service.LookupEmployeeByIdRequest} */ -proto.service.LookupCourseByIdRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.service.LookupEmployeeByIdRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -797,8 +665,8 @@ proto.service.LookupCourseByIdRequest.deserializeBinaryFromReader = function(msg var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.service.LookupCourseByIdRequestKey; - reader.readMessage(value,proto.service.LookupCourseByIdRequestKey.deserializeBinaryFromReader); + var value = new proto.service.LookupEmployeeByIdRequestKey; + reader.readMessage(value,proto.service.LookupEmployeeByIdRequestKey.deserializeBinaryFromReader); msg.addKeys(value); break; default: @@ -814,9 +682,9 @@ proto.service.LookupCourseByIdRequest.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.service.LookupCourseByIdRequest.prototype.serializeBinary = function() { +proto.service.LookupEmployeeByIdRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.service.LookupCourseByIdRequest.serializeBinaryToWriter(this, writer); + proto.service.LookupEmployeeByIdRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -824,57 +692,57 @@ proto.service.LookupCourseByIdRequest.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupCourseByIdRequest} message + * @param {!proto.service.LookupEmployeeByIdRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupCourseByIdRequest.serializeBinaryToWriter = function(message, writer) { +proto.service.LookupEmployeeByIdRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getKeysList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.service.LookupCourseByIdRequestKey.serializeBinaryToWriter + proto.service.LookupEmployeeByIdRequestKey.serializeBinaryToWriter ); } }; /** - * repeated LookupCourseByIdRequestKey keys = 1; - * @return {!Array} + * repeated LookupEmployeeByIdRequestKey keys = 1; + * @return {!Array} */ -proto.service.LookupCourseByIdRequest.prototype.getKeysList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.LookupCourseByIdRequestKey, 1)); +proto.service.LookupEmployeeByIdRequest.prototype.getKeysList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.service.LookupEmployeeByIdRequestKey, 1)); }; /** - * @param {!Array} value - * @return {!proto.service.LookupCourseByIdRequest} returns this + * @param {!Array} value + * @return {!proto.service.LookupEmployeeByIdRequest} returns this */ -proto.service.LookupCourseByIdRequest.prototype.setKeysList = function(value) { +proto.service.LookupEmployeeByIdRequest.prototype.setKeysList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.service.LookupCourseByIdRequestKey=} opt_value + * @param {!proto.service.LookupEmployeeByIdRequestKey=} opt_value * @param {number=} opt_index - * @return {!proto.service.LookupCourseByIdRequestKey} + * @return {!proto.service.LookupEmployeeByIdRequestKey} */ -proto.service.LookupCourseByIdRequest.prototype.addKeys = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.LookupCourseByIdRequestKey, opt_index); +proto.service.LookupEmployeeByIdRequest.prototype.addKeys = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.LookupEmployeeByIdRequestKey, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.service.LookupCourseByIdRequest} returns this + * @return {!proto.service.LookupEmployeeByIdRequest} returns this */ -proto.service.LookupCourseByIdRequest.prototype.clearKeysList = function() { +proto.service.LookupEmployeeByIdRequest.prototype.clearKeysList = function() { return this.setKeysList([]); }; @@ -885,7 +753,7 @@ proto.service.LookupCourseByIdRequest.prototype.clearKeysList = function() { * @private {!Array} * @const */ -proto.service.LookupCourseByIdResponse.repeatedFields_ = [1]; +proto.service.LookupEmployeeByIdResponse.repeatedFields_ = [1]; @@ -902,8 +770,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.service.LookupCourseByIdResponse.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupCourseByIdResponse.toObject(opt_includeInstance, this); +proto.service.LookupEmployeeByIdResponse.prototype.toObject = function(opt_includeInstance) { + return proto.service.LookupEmployeeByIdResponse.toObject(opt_includeInstance, this); }; @@ -912,14 +780,14 @@ proto.service.LookupCourseByIdResponse.prototype.toObject = function(opt_include * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.service.LookupCourseByIdResponse} msg The msg instance to transform. + * @param {!proto.service.LookupEmployeeByIdResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupCourseByIdResponse.toObject = function(includeInstance, msg) { +proto.service.LookupEmployeeByIdResponse.toObject = function(includeInstance, msg) { var f, obj = { resultList: jspb.Message.toObjectList(msg.getResultList(), - proto.service.Course.toObject, includeInstance) + proto.service.Employee.toObject, includeInstance) }; if (includeInstance) { @@ -933,23 +801,23 @@ resultList: jspb.Message.toObjectList(msg.getResultList(), /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupCourseByIdResponse} + * @return {!proto.service.LookupEmployeeByIdResponse} */ -proto.service.LookupCourseByIdResponse.deserializeBinary = function(bytes) { +proto.service.LookupEmployeeByIdResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupCourseByIdResponse; - return proto.service.LookupCourseByIdResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.service.LookupEmployeeByIdResponse; + return proto.service.LookupEmployeeByIdResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.service.LookupCourseByIdResponse} msg The message object to deserialize into. + * @param {!proto.service.LookupEmployeeByIdResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupCourseByIdResponse} + * @return {!proto.service.LookupEmployeeByIdResponse} */ -proto.service.LookupCourseByIdResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.service.LookupEmployeeByIdResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -957,8 +825,8 @@ proto.service.LookupCourseByIdResponse.deserializeBinaryFromReader = function(ms var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.service.Course; - reader.readMessage(value,proto.service.Course.deserializeBinaryFromReader); + var value = new proto.service.Employee; + reader.readMessage(value,proto.service.Employee.deserializeBinaryFromReader); msg.addResult(value); break; default: @@ -974,9 +842,9 @@ proto.service.LookupCourseByIdResponse.deserializeBinaryFromReader = function(ms * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.service.LookupCourseByIdResponse.prototype.serializeBinary = function() { +proto.service.LookupEmployeeByIdResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.service.LookupCourseByIdResponse.serializeBinaryToWriter(this, writer); + proto.service.LookupEmployeeByIdResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -984,57 +852,57 @@ proto.service.LookupCourseByIdResponse.prototype.serializeBinary = function() { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupCourseByIdResponse} message + * @param {!proto.service.LookupEmployeeByIdResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupCourseByIdResponse.serializeBinaryToWriter = function(message, writer) { +proto.service.LookupEmployeeByIdResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getResultList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, - proto.service.Course.serializeBinaryToWriter + proto.service.Employee.serializeBinaryToWriter ); } }; /** - * repeated Course result = 1; - * @return {!Array} + * repeated Employee result = 1; + * @return {!Array} */ -proto.service.LookupCourseByIdResponse.prototype.getResultList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.Course, 1)); +proto.service.LookupEmployeeByIdResponse.prototype.getResultList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.service.Employee, 1)); }; /** - * @param {!Array} value - * @return {!proto.service.LookupCourseByIdResponse} returns this + * @param {!Array} value + * @return {!proto.service.LookupEmployeeByIdResponse} returns this */ -proto.service.LookupCourseByIdResponse.prototype.setResultList = function(value) { +proto.service.LookupEmployeeByIdResponse.prototype.setResultList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** - * @param {!proto.service.Course=} opt_value + * @param {!proto.service.Employee=} opt_value * @param {number=} opt_index - * @return {!proto.service.Course} + * @return {!proto.service.Employee} */ -proto.service.LookupCourseByIdResponse.prototype.addResult = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.Course, opt_index); +proto.service.LookupEmployeeByIdResponse.prototype.addResult = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.Employee, opt_index); }; /** * Clears the list making it empty but non-null. - * @return {!proto.service.LookupCourseByIdResponse} returns this + * @return {!proto.service.LookupEmployeeByIdResponse} returns this */ -proto.service.LookupCourseByIdResponse.prototype.clearResultList = function() { +proto.service.LookupEmployeeByIdResponse.prototype.clearResultList = function() { return this.setResultList([]); }; @@ -1055,8 +923,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.service.LookupLessonByIdRequestKey.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupLessonByIdRequestKey.toObject(opt_includeInstance, this); +proto.service.QueryCoursesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.service.QueryCoursesRequest.toObject(opt_includeInstance, this); }; @@ -1065,13 +933,13 @@ proto.service.LookupLessonByIdRequestKey.prototype.toObject = function(opt_inclu * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.service.LookupLessonByIdRequestKey} msg The msg instance to transform. + * @param {!proto.service.QueryCoursesRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupLessonByIdRequestKey.toObject = function(includeInstance, msg) { +proto.service.QueryCoursesRequest.toObject = function(includeInstance, msg) { var f, obj = { -id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; if (includeInstance) { @@ -1085,33 +953,29 @@ id: jspb.Message.getFieldWithDefault(msg, 1, "") /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupLessonByIdRequestKey} + * @return {!proto.service.QueryCoursesRequest} */ -proto.service.LookupLessonByIdRequestKey.deserializeBinary = function(bytes) { +proto.service.QueryCoursesRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupLessonByIdRequestKey; - return proto.service.LookupLessonByIdRequestKey.deserializeBinaryFromReader(msg, reader); + var msg = new proto.service.QueryCoursesRequest; + return proto.service.QueryCoursesRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.service.LookupLessonByIdRequestKey} msg The message object to deserialize into. + * @param {!proto.service.QueryCoursesRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupLessonByIdRequestKey} + * @return {!proto.service.QueryCoursesRequest} */ -proto.service.LookupLessonByIdRequestKey.deserializeBinaryFromReader = function(msg, reader) { +proto.service.QueryCoursesRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readStringRequireUtf8()); - msg.setId(value); - break; default: reader.skipField(); break; @@ -1125,9 +989,9 @@ proto.service.LookupLessonByIdRequestKey.deserializeBinaryFromReader = function( * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.service.LookupLessonByIdRequestKey.prototype.serializeBinary = function() { +proto.service.QueryCoursesRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.service.LookupLessonByIdRequestKey.serializeBinaryToWriter(this, writer); + proto.service.QueryCoursesRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1135,910 +999,14 @@ proto.service.LookupLessonByIdRequestKey.prototype.serializeBinary = function() /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupLessonByIdRequestKey} message + * @param {!proto.service.QueryCoursesRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.service.LookupLessonByIdRequestKey.serializeBinaryToWriter = function(message, writer) { +proto.service.QueryCoursesRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } }; - - -/** - * optional string id = 1; - * @return {string} - */ -proto.service.LookupLessonByIdRequestKey.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.service.LookupLessonByIdRequestKey} returns this - */ -proto.service.LookupLessonByIdRequestKey.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.service.LookupLessonByIdRequest.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.LookupLessonByIdRequest.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupLessonByIdRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.LookupLessonByIdRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupLessonByIdRequest.toObject = function(includeInstance, msg) { - var f, obj = { -keysList: jspb.Message.toObjectList(msg.getKeysList(), - proto.service.LookupLessonByIdRequestKey.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupLessonByIdRequest} - */ -proto.service.LookupLessonByIdRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupLessonByIdRequest; - return proto.service.LookupLessonByIdRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.LookupLessonByIdRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupLessonByIdRequest} - */ -proto.service.LookupLessonByIdRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.service.LookupLessonByIdRequestKey; - reader.readMessage(value,proto.service.LookupLessonByIdRequestKey.deserializeBinaryFromReader); - msg.addKeys(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.LookupLessonByIdRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.LookupLessonByIdRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupLessonByIdRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupLessonByIdRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKeysList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.service.LookupLessonByIdRequestKey.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated LookupLessonByIdRequestKey keys = 1; - * @return {!Array} - */ -proto.service.LookupLessonByIdRequest.prototype.getKeysList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.LookupLessonByIdRequestKey, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.service.LookupLessonByIdRequest} returns this -*/ -proto.service.LookupLessonByIdRequest.prototype.setKeysList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.service.LookupLessonByIdRequestKey=} opt_value - * @param {number=} opt_index - * @return {!proto.service.LookupLessonByIdRequestKey} - */ -proto.service.LookupLessonByIdRequest.prototype.addKeys = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.LookupLessonByIdRequestKey, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.service.LookupLessonByIdRequest} returns this - */ -proto.service.LookupLessonByIdRequest.prototype.clearKeysList = function() { - return this.setKeysList([]); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.service.LookupLessonByIdResponse.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.LookupLessonByIdResponse.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupLessonByIdResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.LookupLessonByIdResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupLessonByIdResponse.toObject = function(includeInstance, msg) { - var f, obj = { -resultList: jspb.Message.toObjectList(msg.getResultList(), - proto.service.Lesson.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupLessonByIdResponse} - */ -proto.service.LookupLessonByIdResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupLessonByIdResponse; - return proto.service.LookupLessonByIdResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.LookupLessonByIdResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupLessonByIdResponse} - */ -proto.service.LookupLessonByIdResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.service.Lesson; - reader.readMessage(value,proto.service.Lesson.deserializeBinaryFromReader); - msg.addResult(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.LookupLessonByIdResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.LookupLessonByIdResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupLessonByIdResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupLessonByIdResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getResultList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.service.Lesson.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated Lesson result = 1; - * @return {!Array} - */ -proto.service.LookupLessonByIdResponse.prototype.getResultList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.Lesson, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.service.LookupLessonByIdResponse} returns this -*/ -proto.service.LookupLessonByIdResponse.prototype.setResultList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.service.Lesson=} opt_value - * @param {number=} opt_index - * @return {!proto.service.Lesson} - */ -proto.service.LookupLessonByIdResponse.prototype.addResult = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.Lesson, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.service.LookupLessonByIdResponse} returns this - */ -proto.service.LookupLessonByIdResponse.prototype.clearResultList = function() { - return this.setResultList([]); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.LookupEmployeeByIdRequestKey.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupEmployeeByIdRequestKey.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.LookupEmployeeByIdRequestKey} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupEmployeeByIdRequestKey.toObject = function(includeInstance, msg) { - var f, obj = { -id: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupEmployeeByIdRequestKey} - */ -proto.service.LookupEmployeeByIdRequestKey.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupEmployeeByIdRequestKey; - return proto.service.LookupEmployeeByIdRequestKey.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.LookupEmployeeByIdRequestKey} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupEmployeeByIdRequestKey} - */ -proto.service.LookupEmployeeByIdRequestKey.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readStringRequireUtf8()); - msg.setId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.LookupEmployeeByIdRequestKey.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.LookupEmployeeByIdRequestKey.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupEmployeeByIdRequestKey} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupEmployeeByIdRequestKey.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string id = 1; - * @return {string} - */ -proto.service.LookupEmployeeByIdRequestKey.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.service.LookupEmployeeByIdRequestKey} returns this - */ -proto.service.LookupEmployeeByIdRequestKey.prototype.setId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.service.LookupEmployeeByIdRequest.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.LookupEmployeeByIdRequest.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupEmployeeByIdRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.LookupEmployeeByIdRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupEmployeeByIdRequest.toObject = function(includeInstance, msg) { - var f, obj = { -keysList: jspb.Message.toObjectList(msg.getKeysList(), - proto.service.LookupEmployeeByIdRequestKey.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupEmployeeByIdRequest} - */ -proto.service.LookupEmployeeByIdRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupEmployeeByIdRequest; - return proto.service.LookupEmployeeByIdRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.LookupEmployeeByIdRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupEmployeeByIdRequest} - */ -proto.service.LookupEmployeeByIdRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.service.LookupEmployeeByIdRequestKey; - reader.readMessage(value,proto.service.LookupEmployeeByIdRequestKey.deserializeBinaryFromReader); - msg.addKeys(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.LookupEmployeeByIdRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.LookupEmployeeByIdRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupEmployeeByIdRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupEmployeeByIdRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getKeysList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.service.LookupEmployeeByIdRequestKey.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated LookupEmployeeByIdRequestKey keys = 1; - * @return {!Array} - */ -proto.service.LookupEmployeeByIdRequest.prototype.getKeysList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.LookupEmployeeByIdRequestKey, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.service.LookupEmployeeByIdRequest} returns this -*/ -proto.service.LookupEmployeeByIdRequest.prototype.setKeysList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.service.LookupEmployeeByIdRequestKey=} opt_value - * @param {number=} opt_index - * @return {!proto.service.LookupEmployeeByIdRequestKey} - */ -proto.service.LookupEmployeeByIdRequest.prototype.addKeys = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.LookupEmployeeByIdRequestKey, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.service.LookupEmployeeByIdRequest} returns this - */ -proto.service.LookupEmployeeByIdRequest.prototype.clearKeysList = function() { - return this.setKeysList([]); -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.service.LookupEmployeeByIdResponse.repeatedFields_ = [1]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.LookupEmployeeByIdResponse.prototype.toObject = function(opt_includeInstance) { - return proto.service.LookupEmployeeByIdResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.LookupEmployeeByIdResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupEmployeeByIdResponse.toObject = function(includeInstance, msg) { - var f, obj = { -resultList: jspb.Message.toObjectList(msg.getResultList(), - proto.service.Employee.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.LookupEmployeeByIdResponse} - */ -proto.service.LookupEmployeeByIdResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.LookupEmployeeByIdResponse; - return proto.service.LookupEmployeeByIdResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.LookupEmployeeByIdResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.LookupEmployeeByIdResponse} - */ -proto.service.LookupEmployeeByIdResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.service.Employee; - reader.readMessage(value,proto.service.Employee.deserializeBinaryFromReader); - msg.addResult(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.LookupEmployeeByIdResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.LookupEmployeeByIdResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.LookupEmployeeByIdResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.LookupEmployeeByIdResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getResultList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.service.Employee.serializeBinaryToWriter - ); - } -}; - - -/** - * repeated Employee result = 1; - * @return {!Array} - */ -proto.service.LookupEmployeeByIdResponse.prototype.getResultList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.Employee, 1)); -}; - - -/** - * @param {!Array} value - * @return {!proto.service.LookupEmployeeByIdResponse} returns this -*/ -proto.service.LookupEmployeeByIdResponse.prototype.setResultList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; - - -/** - * @param {!proto.service.Employee=} opt_value - * @param {number=} opt_index - * @return {!proto.service.Employee} - */ -proto.service.LookupEmployeeByIdResponse.prototype.addResult = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.service.Employee, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.service.LookupEmployeeByIdResponse} returns this - */ -proto.service.LookupEmployeeByIdResponse.prototype.clearResultList = function() { - return this.setResultList([]); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.QueryCoursesRequest.prototype.toObject = function(opt_includeInstance) { - return proto.service.QueryCoursesRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.QueryCoursesRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.QueryCoursesRequest.toObject = function(includeInstance, msg) { - var f, obj = { - - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.QueryCoursesRequest} - */ -proto.service.QueryCoursesRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.QueryCoursesRequest; - return proto.service.QueryCoursesRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.QueryCoursesRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.QueryCoursesRequest} - */ -proto.service.QueryCoursesRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.QueryCoursesRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.QueryCoursesRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.QueryCoursesRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.QueryCoursesRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; - + /** @@ -3813,75 +2781,265 @@ proto.service.MutationAddLessonResponse.deserializeBinaryFromReader = function(m break; } } - return msg; + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.service.MutationAddLessonResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.service.MutationAddLessonResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.service.MutationAddLessonResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.service.MutationAddLessonResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAddLesson(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.service.Lesson.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Lesson add_lesson = 1; + * @return {?proto.service.Lesson} + */ +proto.service.MutationAddLessonResponse.prototype.getAddLesson = function() { + return /** @type{?proto.service.Lesson} */ ( + jspb.Message.getWrapperField(this, proto.service.Lesson, 1)); +}; + + +/** + * @param {?proto.service.Lesson|undefined} value + * @return {!proto.service.MutationAddLessonResponse} returns this +*/ +proto.service.MutationAddLessonResponse.prototype.setAddLesson = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.service.MutationAddLessonResponse} returns this + */ +proto.service.MutationAddLessonResponse.prototype.clearAddLesson = function() { + return this.setAddLesson(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.service.MutationAddLessonResponse.prototype.hasAddLesson = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.service.Employee.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.service.Employee.prototype.toObject = function(opt_includeInstance) { + return proto.service.Employee.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.service.Employee} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.service.Employee.toObject = function(includeInstance, msg) { + var f, obj = { +id: jspb.Message.getFieldWithDefault(msg, 1, 0), +taughtCoursesList: jspb.Message.toObjectList(msg.getTaughtCoursesList(), + proto.service.Course.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.service.Employee} + */ +proto.service.Employee.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.service.Employee; + return proto.service.Employee.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.service.Employee} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.service.Employee} + */ +proto.service.Employee.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setId(value); + break; + case 2: + var value = new proto.service.Course; + reader.readMessage(value,proto.service.Course.deserializeBinaryFromReader); + msg.addTaughtCourses(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.service.Employee.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.service.Employee.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.service.Employee} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.service.Employee.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f !== 0) { + writer.writeInt32( + 1, + f + ); + } + f = message.getTaughtCoursesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.service.Course.serializeBinaryToWriter + ); + } }; /** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} + * optional int32 id = 1; + * @return {number} */ -proto.service.MutationAddLessonResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.MutationAddLessonResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); +proto.service.Employee.prototype.getId = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.MutationAddLessonResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages + * @param {number} value + * @return {!proto.service.Employee} returns this */ -proto.service.MutationAddLessonResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getAddLesson(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.service.Lesson.serializeBinaryToWriter - ); - } +proto.service.Employee.prototype.setId = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); }; /** - * optional Lesson add_lesson = 1; - * @return {?proto.service.Lesson} + * repeated Course taught_courses = 2; + * @return {!Array} */ -proto.service.MutationAddLessonResponse.prototype.getAddLesson = function() { - return /** @type{?proto.service.Lesson} */ ( - jspb.Message.getWrapperField(this, proto.service.Lesson, 1)); +proto.service.Employee.prototype.getTaughtCoursesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.service.Course, 2)); }; /** - * @param {?proto.service.Lesson|undefined} value - * @return {!proto.service.MutationAddLessonResponse} returns this + * @param {!Array} value + * @return {!proto.service.Employee} returns this */ -proto.service.MutationAddLessonResponse.prototype.setAddLesson = function(value) { - return jspb.Message.setWrapperField(this, 1, value); +proto.service.Employee.prototype.setTaughtCoursesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); }; /** - * Clears the message field making it undefined. - * @return {!proto.service.MutationAddLessonResponse} returns this + * @param {!proto.service.Course=} opt_value + * @param {number=} opt_index + * @return {!proto.service.Course} */ -proto.service.MutationAddLessonResponse.prototype.clearAddLesson = function() { - return this.setAddLesson(undefined); +proto.service.Employee.prototype.addTaughtCourses = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.service.Course, opt_index); }; /** - * Returns whether this field is set. - * @return {boolean} + * Clears the list making it empty but non-null. + * @return {!proto.service.Employee} returns this */ -proto.service.MutationAddLessonResponse.prototype.hasAddLesson = function() { - return jspb.Message.getField(this, 1) != null; +proto.service.Employee.prototype.clearTaughtCoursesList = function() { + return this.setTaughtCoursesList([]); }; @@ -4529,194 +3687,4 @@ proto.service.Lesson.prototype.hasCourse = function() { }; - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.service.Employee.repeatedFields_ = [2]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.service.Employee.prototype.toObject = function(opt_includeInstance) { - return proto.service.Employee.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.service.Employee} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.Employee.toObject = function(includeInstance, msg) { - var f, obj = { -id: jspb.Message.getFieldWithDefault(msg, 1, 0), -taughtCoursesList: jspb.Message.toObjectList(msg.getTaughtCoursesList(), - proto.service.Course.toObject, includeInstance) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.service.Employee} - */ -proto.service.Employee.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.service.Employee; - return proto.service.Employee.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.service.Employee} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.service.Employee} - */ -proto.service.Employee.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setId(value); - break; - case 2: - var value = new proto.service.Course; - reader.readMessage(value,proto.service.Course.deserializeBinaryFromReader); - msg.addTaughtCourses(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.service.Employee.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.service.Employee.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.service.Employee} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.service.Employee.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getId(); - if (f !== 0) { - writer.writeInt32( - 1, - f - ); - } - f = message.getTaughtCoursesList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 2, - f, - proto.service.Course.serializeBinaryToWriter - ); - } -}; - - -/** - * optional int32 id = 1; - * @return {number} - */ -proto.service.Employee.prototype.getId = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.service.Employee} returns this - */ -proto.service.Employee.prototype.setId = function(value) { - return jspb.Message.setProto3IntField(this, 1, value); -}; - - -/** - * repeated Course taught_courses = 2; - * @return {!Array} - */ -proto.service.Employee.prototype.getTaughtCoursesList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.service.Course, 2)); -}; - - -/** - * @param {!Array} value - * @return {!proto.service.Employee} returns this -*/ -proto.service.Employee.prototype.setTaughtCoursesList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 2, value); -}; - - -/** - * @param {!proto.service.Course=} opt_value - * @param {number=} opt_index - * @return {!proto.service.Course} - */ -proto.service.Employee.prototype.addTaughtCourses = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.service.Course, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.service.Employee} returns this - */ -proto.service.Employee.prototype.clearTaughtCoursesList = function() { - return this.setTaughtCoursesList([]); -}; - - goog.object.extend(exports, proto.service); diff --git a/demo/pkg/subgraphs/courses/src/plugin.test.ts b/demo/pkg/subgraphs/courses/src/plugin.test.ts index 38c19ad8fa..fa47d5604e 100644 --- a/demo/pkg/subgraphs/courses/src/plugin.test.ts +++ b/demo/pkg/subgraphs/courses/src/plugin.test.ts @@ -15,9 +15,6 @@ import { MutationAddCourseResponse, MutationAddLessonRequest, MutationAddLessonResponse, - LookupCourseByIdRequest, - LookupCourseByIdRequestKey, - LookupCourseByIdResponse, LookupEmployeeByIdRequest, LookupEmployeeByIdRequestKey, LookupEmployeeByIdResponse, @@ -182,29 +179,6 @@ describe('Courses Plugin', () => { }); describe('Lookups', () => { - it('should lookup courses by ID', async () => { - const request = new LookupCourseByIdRequest(); - const key1 = new LookupCourseByIdRequestKey(); - key1.setId('1'); - const key2 = new LookupCourseByIdRequestKey(); - key2.setId('2'); - request.setKeysList([key1, key2]); - - const call = createMockCall(request); - const { callback, promise } = createMockCallback(); - - plugin.lookupCourseById(call, callback); - - const response = await promise; - const courses = response.getResultList(); - - expect(courses.length).toBe(2); - expect(courses[0].getId()).toBe('1'); - expect(courses[0].getTitle()).toBe('Introduction to TypeScript'); - expect(courses[1].getId()).toBe('2'); - expect(courses[1].getTitle()).toBe('Advanced GraphQL'); - }); - it('should lookup employees by ID and return taught courses', async () => { const request = new LookupEmployeeByIdRequest(); const key1 = new LookupEmployeeByIdRequestKey(); diff --git a/demo/pkg/subgraphs/courses/src/plugin.ts b/demo/pkg/subgraphs/courses/src/plugin.ts index 932bea6eaa..adb47f2008 100644 --- a/demo/pkg/subgraphs/courses/src/plugin.ts +++ b/demo/pkg/subgraphs/courses/src/plugin.ts @@ -14,10 +14,6 @@ import { MutationAddCourseResponse, MutationAddLessonRequest, MutationAddLessonResponse, - LookupCourseByIdRequest, - LookupCourseByIdResponse, - LookupLessonByIdRequest, - LookupLessonByIdResponse, LookupEmployeeByIdRequest, LookupEmployeeByIdResponse, Course, @@ -340,46 +336,6 @@ const pluginImplementation = { callback(null, response); }, - // Federation: Lookup Course by ID - lookupCourseById: ( - call: grpc.ServerUnaryCall, - callback: grpc.sendUnaryData - ) => { - const response = new LookupCourseByIdResponse(); - const results: Course[] = []; - - for (const key of call.request.getKeysList()) { - const id = key.getId(); - const courseData = courses.get(id); - if (courseData) { - results.push(courseDataToCourse(courseData)); - } - } - - response.setResultList(results); - callback(null, response); - }, - - // Federation: Lookup Lesson by ID - lookupLessonById: ( - call: grpc.ServerUnaryCall, - callback: grpc.sendUnaryData - ) => { - const response = new LookupLessonByIdResponse(); - const results: Lesson[] = []; - - for (const key of call.request.getKeysList()) { - const id = key.getId(); - const lessonData = lessons.get(id); - if (lessonData) { - results.push(lessonDataToLesson(lessonData)); - } - } - - response.setResultList(results); - callback(null, response); - }, - // Federation: Lookup Employee by ID lookupEmployeeById: ( call: grpc.ServerUnaryCall,