wgc 0.94.8 → 0.96.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +4 -1
- package/dist/src/commands/grpc-service/commands/generate.js +6 -1
- package/dist/src/commands/grpc-service/commands/generate.js.map +1 -1
- package/dist/src/commands/router/commands/compose.js +6 -5
- package/dist/src/commands/router/commands/compose.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/commands/build.js +44 -19
- package/dist/src/commands/router/commands/plugin/commands/build.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/commands/generate.js +32 -10
- package/dist/src/commands/router/commands/plugin/commands/generate.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/commands/init.js +79 -48
- package/dist/src/commands/router/commands/plugin/commands/init.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/commands/test.js +36 -7
- package/dist/src/commands/router/commands/plugin/commands/test.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/templates/go.d.ts +9 -0
- package/dist/src/commands/router/commands/plugin/templates/go.js +18 -0
- package/dist/src/commands/router/commands/plugin/templates/go.js.map +1 -0
- package/dist/src/commands/router/commands/plugin/templates/plugin.d.ts +3 -8
- package/dist/src/commands/router/commands/plugin/templates/plugin.js +11 -424
- package/dist/src/commands/router/commands/plugin/templates/plugin.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/templates/project.d.ts +5 -5
- package/dist/src/commands/router/commands/plugin/templates/project.js +14 -200
- package/dist/src/commands/router/commands/plugin/templates/project.js.map +1 -1
- package/dist/src/commands/router/commands/plugin/templates/typescript.d.ts +14 -0
- package/dist/src/commands/router/commands/plugin/templates/typescript.js +28 -0
- package/dist/src/commands/router/commands/plugin/templates/typescript.js.map +1 -0
- package/dist/src/commands/router/commands/plugin/toolchain.d.ts +25 -6
- package/dist/src/commands/router/commands/plugin/toolchain.js +334 -78
- package/dist/src/commands/router/commands/plugin/toolchain.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/commands/init.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/commands/init.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC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AC;YACT,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import os from 'node:os';
|
|
3
|
-
import { Command } from 'commander';
|
|
3
|
+
import { Command, program } from 'commander';
|
|
4
4
|
import { resolve } from 'pathe';
|
|
5
5
|
import Spinner from 'ora';
|
|
6
|
-
import { checkAndInstallTools, installGoDependencies, runGoTests } from '../toolchain.js';
|
|
6
|
+
import { checkAndInstallTools, getLanguage, installGoDependencies, installTsDependencies, runGoTests, runTsTests, } from '../toolchain.js';
|
|
7
7
|
import { renderResultTree } from '../helper.js';
|
|
8
8
|
export default (opts) => {
|
|
9
9
|
const command = new Command('test');
|
|
@@ -16,18 +16,47 @@ export default (opts) => {
|
|
|
16
16
|
const pluginDir = resolve(directory);
|
|
17
17
|
const spinner = Spinner({ text: 'Running tests...' });
|
|
18
18
|
const pluginName = path.basename(pluginDir);
|
|
19
|
+
const language = getLanguage(pluginDir);
|
|
20
|
+
if (!language) {
|
|
21
|
+
renderResultTree(spinner, 'Plugin language detection failed!', false, pluginName, {
|
|
22
|
+
output: pluginDir,
|
|
23
|
+
});
|
|
24
|
+
program.error('');
|
|
25
|
+
}
|
|
19
26
|
try {
|
|
20
|
-
spinner.start();
|
|
21
27
|
// Check and install tools if needed
|
|
22
28
|
if (!options.skipToolsInstallation) {
|
|
23
|
-
await checkAndInstallTools(options.forceToolsInstallation);
|
|
29
|
+
await checkAndInstallTools(options.forceToolsInstallation, language);
|
|
30
|
+
}
|
|
31
|
+
spinner.start();
|
|
32
|
+
switch (language) {
|
|
33
|
+
case 'go': {
|
|
34
|
+
spinner.text = 'Installing Go dependencies...';
|
|
35
|
+
await installGoDependencies(pluginDir, spinner);
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case 'ts': {
|
|
39
|
+
spinner.text = 'Installing Ts dependencies...';
|
|
40
|
+
await installTsDependencies(pluginDir, spinner);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
24
43
|
}
|
|
25
|
-
spinner.text = 'Installing Go dependencies...';
|
|
26
|
-
await installGoDependencies(pluginDir, spinner);
|
|
27
44
|
const srcDir = resolve(pluginDir, 'src');
|
|
28
45
|
spinner.text = 'Running tests...';
|
|
29
46
|
try {
|
|
30
|
-
|
|
47
|
+
let failed = false;
|
|
48
|
+
switch (language) {
|
|
49
|
+
case 'go': {
|
|
50
|
+
const result = await runGoTests(srcDir, spinner, false);
|
|
51
|
+
failed = result.failed;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case 'ts': {
|
|
55
|
+
const result = await runTsTests(pluginDir, spinner);
|
|
56
|
+
failed = result.failed;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
31
60
|
// Calculate elapsed time
|
|
32
61
|
const endTime = performance.now();
|
|
33
62
|
const elapsedTimeMs = endTime - startTime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/commands/test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,OAAO,MAAM,KAAK,CAAC;AAE1B,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,qBA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2
|
+
// This file is auto-generated. Do not edit manually.
|
|
3
|
+
/* eslint-disable no-template-curly-in-string */
|
|
4
|
+
const dockerfile = 'FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder\n\n# Multi-platform build arguments\nARG TARGETOS\nARG TARGETARCH\n\nWORKDIR /build\n\n# Copy go mod files\nCOPY go.mod go.sum ./\nRUN go mod download\n\n# Copy source code\nCOPY . .\n\nRUN --mount=type=cache,target="/root/.cache/go-build" CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o dist/plugin ./src\n\nFROM --platform=$BUILDPLATFORM scratch\n\nCOPY --from=builder /build/dist/plugin ./{originalPluginName}-plugin\n\nENTRYPOINT ["./{originalPluginName}-plugin"]\n';
|
|
5
|
+
const cursorRules = '---\ndescription: {name} Plugin Guide\nglobs: src/**\nalwaysApply: false\n---\n\n# {name} Plugin Development Guide\n\nYou are an expert in developing Cosmo Router plugins. You are given a GraphQL schema, and you need to implement the Go code for the plugin.\nYour goal is to implement the plugin in a way that is easy to understand and maintain. You add tests to ensure the plugin works as expected.\n\nAll make commands need to be run from the plugin directory `{pluginDir}`.\n\n## Plugin Structure\n\nA plugin is structured as follows:\n\n```\nplugins/{originalPluginName}/\n├── Makefile # Build automation\n├── go.mod # Go module definition\n├── go.sum # Go module checksums\n├── src/\n│ ├── schema.graphql # GraphQL schema (API contract)\n│ ├── main.go # Plugin implementation\n│ └── main_test.go # Tests for the plugin\n├── generated/ # Auto-generated files (DO NOT EDIT)\n│ ├── service.proto # Generated Protocol Buffers\n│ ├── service.pb.go # Generated Go structures\n│ ├── service.proto.lock.json # Generated Protobuf lock file\n│ └── service_grpc.pb.go # Generated gRPC service\n└── bin/ # Compiled binaries\n └── plugin # The compiled plugin binary\n```\n\n## Development Workflow\n\n1. When modifying the GraphQL schema in `src/schema.graphql`, you need to regenerate the code with `make generate`.\n2. Look into the generated code in `generated/service.proto` and `generated/service.pb.go` to understand the updated API contract and service methods.\n3. Implement the new RPC methods in `src/main.go`.\n4. Add tests to `src/main_test.go` to ensure the plugin works as expected. You need to run `make test` to ensure the tests pass.\n5. Finally, build the plugin with `make build` to ensure the plugin is working as expected.\n6. Your job is done after successfully building the plugin. Don\'t verify if the binary was created. The build command will take care of that.\n\n**Important**: Never manipulate the files inside `generated` directory yourself. Don\'t touch the `service.proto`, `service.proto.lock.json`, `service.pb.go` and `service_grpc.pb.go` files.\n\nYou can update the Go dependencies by running `make test` to ensure the dependencies are up to date. It runs `go mod tidy` under the hood.\n\n## Implementation Pattern\n\n### Service Integration\n\nIf you need to integrate with other HTTP services, you should prefer to use the `github.com/wundergraph/cosmo/router-plugin/httpclient` package.\nAlways prefer a real integration over mocking. In the tests, you can mock the external service by bootstrapping an http server that returns the expected response.\nIn tests, focus on a well-defined contract and the expected behavior of your service. Structure tests by endpoint, use-cases and use table-driven tests when possible.\n\nHere is an example of how to use the `httpclient` package:\n\n```go\n// Initialize HTTP client for external API calls\n// The base URL is the URL of the external API\nclient := httpclient.New(\n httpclient.WithBaseURL("<replace_with_base_url>"),\n httpclient.WithTimeout(5*time.Second),\n httpclient.WithHeaders(map[string]string{}),\n)\n// A HTTP GET request to the external API\nresp, err := client.Get(ctx, "/<replace_with_path>")\n// A HTTP POST/PUT/DELETE request to the external API with a struct that is marshalled to JSON\nresp, err := client.Post(ctx, "/<replace_with_path>", payload)\n// Passing payload with custom request options\nresp, err := client.Put(ctx, "/<replace_with_path>", payload,\n httpclient.WithHeaders(map[string]string{}),\n)\n// Unmarshal the JSON response into our data structure\ndata, err := httpclient.UnmarshalTo[[]ResponseType](resp)\n// The response offers the following fields:\ntype Response struct {\n\tStatusCode int\n\tHeaders http.Header\n\tBody []byte\n}\n// You can check for success (StatusCode >= 200 && StatusCode < 300)\nresp.IsSuccess()\n```\n';
|
|
6
|
+
const goMod = '\nmodule {modulePath}\n\ngo 1.25.1\n\nrequire (\n github.com/stretchr/testify v1.10.0\n github.com/wundergraph/cosmo/router-plugin v0.0.0-20250824152218-8eebc34c4995 // v0.4.1\n google.golang.org/grpc v1.68.1\n google.golang.org/protobuf v1.36.5\n)\n';
|
|
7
|
+
const mainGo = 'package main\n\nimport (\n "context"\n "log"\n "strconv"\n\n service "github.com/wundergraph/cosmo/plugin/generated"\n\n routerplugin "github.com/wundergraph/cosmo/router-plugin"\n "google.golang.org/grpc"\n)\n\nfunc main() {\n pl, err := routerplugin.NewRouterPlugin(func(s *grpc.Server) {\n s.RegisterService(&service.{serviceName}_ServiceDesc, &{serviceName}{\n nextID: 1,\n })\n }, routerplugin.WithTracing())\n\n if err != nil {\n log.Fatalf("failed to create router plugin: %v", err)\n }\n\n pl.Serve()\n}\n\ntype {serviceName} struct {\n service.Unimplemented{serviceName}Server\n nextID int\n}\n\nfunc (s *{serviceName}) QueryHello(ctx context.Context, req *service.QueryHelloRequest) (*service.QueryHelloResponse, error) {\n response := &service.QueryHelloResponse{\n Hello: &service.World{\n Id: strconv.Itoa(s.nextID),\n Name: req.Name,\n },\n }\n s.nextID++\n return response, nil\n}\n';
|
|
8
|
+
const mainTestGo = 'package main\n\nimport (\n "context"\n "net"\n "testing"\n\n "github.com/stretchr/testify/assert"\n "github.com/stretchr/testify/require"\n service "github.com/wundergraph/cosmo/plugin/generated"\n "google.golang.org/grpc"\n "google.golang.org/grpc/credentials/insecure"\n "google.golang.org/grpc/test/bufconn"\n)\n\nconst bufSize = 1024 * 1024\n\n// testService is a wrapper that holds the gRPC test components\ntype testService struct {\n grpcConn *grpc.ClientConn\n client service.{serviceName}Client\n cleanup func()\n}\n\n// setupTestService creates a local gRPC server for testing\nfunc setupTestService(t *testing.T) *testService {\n // Create a buffer for gRPC connections\n lis := bufconn.Listen(bufSize)\n\n // Create a new gRPC server\n grpcServer := grpc.NewServer()\n\n // Register our service\n service.Register{serviceName}Server(grpcServer, &{serviceName}{\n nextID: 1,\n })\n\n // Start the server\n go func() {\n if err := grpcServer.Serve(lis); err != nil {\n t.Fatalf("failed to serve: %v", err)\n }\n }()\n\n // Create a client connection\n dialer := func(context.Context, string) (net.Conn, error) {\n return lis.Dial()\n }\n conn, err := grpc.Dial(\n "passthrough:///bufnet",\n grpc.WithContextDialer(dialer),\n grpc.WithTransportCredentials(insecure.NewCredentials()),\n )\n require.NoError(t, err)\n\n // Create the service client\n client := service.New{serviceName}Client(conn)\n\n // Return cleanup function\n cleanup := func() {\n conn.Close()\n grpcServer.Stop()\n }\n\n return &testService{\n grpcConn: conn,\n client: client,\n cleanup: cleanup,\n }\n}\n\nfunc TestQueryHello(t *testing.T) {\n // Set up basic service\n svc := setupTestService(t)\n defer svc.cleanup()\n\n tests := []struct {\n name string\n userName string\n wantId string\n wantName string\n wantErr bool\n }{\n {\n name: "valid hello",\n userName: "Alice",\n wantId: "1",\n wantName: "Alice",\n wantErr: false,\n },\n {\n name: "empty name",\n userName: "",\n wantId: "2",\n wantName: "", // Empty name should be preserved\n wantErr: false,\n },\n {\n name: "special characters",\n userName: "John & Jane",\n wantId: "3",\n wantName: "John & Jane",\n wantErr: false,\n },\n }\n\n for _, tt := range tests {\n t.Run(tt.name, func(t *testing.T) {\n req := &service.QueryHelloRequest{\n Name: tt.userName,\n }\n\n resp, err := svc.client.QueryHello(context.Background(), req)\n if tt.wantErr {\n assert.Error(t, err)\n return\n }\n\n assert.NoError(t, err)\n assert.NotNil(t, resp.Hello)\n assert.Equal(t, tt.wantId, resp.Hello.Id)\n assert.Equal(t, tt.wantName, resp.Hello.Name)\n })\n }\n}\n\nfunc TestSequentialIDs(t *testing.T) {\n // Set up basic service\n svc := setupTestService(t)\n defer svc.cleanup()\n\n // The first request should get ID "1"\n firstReq := &service.QueryHelloRequest{Name: "First"}\n firstResp, err := svc.client.QueryHello(context.Background(), firstReq)\n require.NoError(t, err)\n assert.Equal(t, "1", firstResp.Hello.Id)\n\n // The second request should get ID "2"\n secondReq := &service.QueryHelloRequest{Name: "Second"}\n secondResp, err := svc.client.QueryHello(context.Background(), secondReq)\n require.NoError(t, err)\n assert.Equal(t, "2", secondResp.Hello.Id)\n\n // The third request should get ID "3"\n thirdReq := &service.QueryHelloRequest{Name: "Third"}\n thirdResp, err := svc.client.QueryHello(context.Background(), thirdReq)\n require.NoError(t, err)\n assert.Equal(t, "3", thirdResp.Hello.Id)\n}\n';
|
|
9
|
+
const readmePartialMd = '## Getting Started\n\nPlugin structure:\n\n ```\n plugins/{originalPluginName}/\n ├── go.mod # Go module file with dependencies\n ├── go.sum # Go checksums file\n ├── src/\n │ ├── main.go # Main plugin implementation\n │ ├── main_test.go # Tests for the plugin\n │ └── schema.graphql # GraphQL schema defining the API\n ├── generated/ # Generated code (created during build)\n └── bin/ # Compiled binaries (created during build)\n └── plugin # The compiled plugin binary\n ```';
|
|
10
|
+
export default {
|
|
11
|
+
dockerfile,
|
|
12
|
+
cursorRules,
|
|
13
|
+
goMod,
|
|
14
|
+
mainGo,
|
|
15
|
+
mainTestGo,
|
|
16
|
+
readmePartialMd,
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/templates/go.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,qDAAqD;AACrD,gDAAgD;AAEhD,MAAM,UAAU,GACd,giBAAgiB,CAAC;AAEniB,MAAM,WAAW,GACf,y+HAAy+H,CAAC;AAE5+H,MAAM,KAAK,GACT,gQAAgQ,CAAC;AAEnQ,MAAM,MAAM,GACV,o7BAAo7B,CAAC;AAEv7B,MAAM,UAAU,GACd,orHAAorH,CAAC;AAEvrH,MAAM,eAAe,GACnB,imBAAimB,CAAC;AAEpmB,eAAe;IACb,UAAU;IACV,WAAW;IACX,KAAK;IACL,MAAM;IACN,UAAU;IACV,eAAe;CAChB,CAAC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
goMod: string;
|
|
3
|
-
mainGo: string;
|
|
4
|
-
mainGoTest: string;
|
|
5
|
-
readme: string;
|
|
6
|
-
schema: string;
|
|
7
2
|
gitignore: string;
|
|
8
3
|
makefile: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
readmePluginMd: string;
|
|
5
|
+
cursorignore: string;
|
|
6
|
+
schemaGraphql: string;
|
|
12
7
|
};
|
|
13
8
|
export default _default;
|
|
@@ -1,429 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require (
|
|
10
|
-
github.com/stretchr/testify v1.10.0
|
|
11
|
-
github.com/wundergraph/cosmo/router-plugin v0.0.0-20250824152218-8eebc34c4995 // v0.4.1
|
|
12
|
-
google.golang.org/grpc v1.68.1
|
|
13
|
-
google.golang.org/protobuf v1.36.5
|
|
14
|
-
)
|
|
15
|
-
`;
|
|
16
|
-
const makefile = `
|
|
17
|
-
.PHONY: build test generate install-wgc
|
|
18
|
-
|
|
19
|
-
install-wgc:
|
|
20
|
-
\t@which wgc > /dev/null 2>&1 || npm install -g wgc@latest
|
|
21
|
-
|
|
22
|
-
make: build
|
|
23
|
-
|
|
24
|
-
test: install-wgc
|
|
25
|
-
\twgc router plugin test .
|
|
26
|
-
|
|
27
|
-
generate: install-wgc
|
|
28
|
-
\twgc router plugin generate .
|
|
29
|
-
|
|
30
|
-
publish: generate
|
|
31
|
-
\twgc router plugin publish .
|
|
32
|
-
|
|
33
|
-
build: install-wgc
|
|
34
|
-
\twgc router plugin build . --debug
|
|
35
|
-
`;
|
|
36
|
-
const mainGo = `package main
|
|
37
|
-
|
|
38
|
-
import (
|
|
39
|
-
"context"
|
|
40
|
-
"log"
|
|
41
|
-
"strconv"
|
|
42
|
-
|
|
43
|
-
service "github.com/wundergraph/cosmo/plugin/generated"
|
|
44
|
-
|
|
45
|
-
routerplugin "github.com/wundergraph/cosmo/router-plugin"
|
|
46
|
-
"google.golang.org/grpc"
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
func main() {
|
|
50
|
-
pl, err := routerplugin.NewRouterPlugin(func(s *grpc.Server) {
|
|
51
|
-
s.RegisterService(&service.{serviceName}_ServiceDesc, &{serviceName}{
|
|
52
|
-
nextID: 1,
|
|
53
|
-
})
|
|
54
|
-
}, routerplugin.WithTracing())
|
|
55
|
-
|
|
56
|
-
if err != nil {
|
|
57
|
-
log.Fatalf("failed to create router plugin: %v", err)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
pl.Serve()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
type {serviceName} struct {
|
|
64
|
-
service.Unimplemented{serviceName}Server
|
|
65
|
-
nextID int
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
func (s *{serviceName}) QueryHello(ctx context.Context, req *service.QueryHelloRequest) (*service.QueryHelloResponse, error) {
|
|
69
|
-
response := &service.QueryHelloResponse{
|
|
70
|
-
Hello: &service.World{
|
|
71
|
-
Id: strconv.Itoa(s.nextID),
|
|
72
|
-
Name: req.Name,
|
|
73
|
-
},
|
|
74
|
-
}
|
|
75
|
-
s.nextID++
|
|
76
|
-
return response, nil
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
const gitignore = `# Ignore the binary files
|
|
80
|
-
bin/
|
|
81
|
-
`;
|
|
82
|
-
const mainGoTest = `package main
|
|
83
|
-
|
|
84
|
-
import (
|
|
85
|
-
"context"
|
|
86
|
-
"net"
|
|
87
|
-
"testing"
|
|
88
|
-
|
|
89
|
-
"github.com/stretchr/testify/assert"
|
|
90
|
-
"github.com/stretchr/testify/require"
|
|
91
|
-
service "github.com/wundergraph/cosmo/plugin/generated"
|
|
92
|
-
"google.golang.org/grpc"
|
|
93
|
-
"google.golang.org/grpc/credentials/insecure"
|
|
94
|
-
"google.golang.org/grpc/test/bufconn"
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
const bufSize = 1024 * 1024
|
|
98
|
-
|
|
99
|
-
// testService is a wrapper that holds the gRPC test components
|
|
100
|
-
type testService struct {
|
|
101
|
-
grpcConn *grpc.ClientConn
|
|
102
|
-
client service.{serviceName}Client
|
|
103
|
-
cleanup func()
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// setupTestService creates a local gRPC server for testing
|
|
107
|
-
func setupTestService(t *testing.T) *testService {
|
|
108
|
-
// Create a buffer for gRPC connections
|
|
109
|
-
lis := bufconn.Listen(bufSize)
|
|
110
|
-
|
|
111
|
-
// Create a new gRPC server
|
|
112
|
-
grpcServer := grpc.NewServer()
|
|
113
|
-
|
|
114
|
-
// Register our service
|
|
115
|
-
service.Register{serviceName}Server(grpcServer, &{serviceName}{
|
|
116
|
-
nextID: 1,
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
// Start the server
|
|
120
|
-
go func() {
|
|
121
|
-
if err := grpcServer.Serve(lis); err != nil {
|
|
122
|
-
t.Fatalf("failed to serve: %v", err)
|
|
123
|
-
}
|
|
124
|
-
}()
|
|
125
|
-
|
|
126
|
-
// Create a client connection
|
|
127
|
-
dialer := func(context.Context, string) (net.Conn, error) {
|
|
128
|
-
return lis.Dial()
|
|
129
|
-
}
|
|
130
|
-
conn, err := grpc.Dial(
|
|
131
|
-
"passthrough:///bufnet",
|
|
132
|
-
grpc.WithContextDialer(dialer),
|
|
133
|
-
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
134
|
-
)
|
|
135
|
-
require.NoError(t, err)
|
|
136
|
-
|
|
137
|
-
// Create the service client
|
|
138
|
-
client := service.New{serviceName}Client(conn)
|
|
139
|
-
|
|
140
|
-
// Return cleanup function
|
|
141
|
-
cleanup := func() {
|
|
142
|
-
conn.Close()
|
|
143
|
-
grpcServer.Stop()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return &testService{
|
|
147
|
-
grpcConn: conn,
|
|
148
|
-
client: client,
|
|
149
|
-
cleanup: cleanup,
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
func TestQueryHello(t *testing.T) {
|
|
154
|
-
// Set up basic service
|
|
155
|
-
svc := setupTestService(t)
|
|
156
|
-
defer svc.cleanup()
|
|
157
|
-
|
|
158
|
-
tests := []struct {
|
|
159
|
-
name string
|
|
160
|
-
userName string
|
|
161
|
-
wantId string
|
|
162
|
-
wantName string
|
|
163
|
-
wantErr bool
|
|
164
|
-
}{
|
|
165
|
-
{
|
|
166
|
-
name: "valid hello",
|
|
167
|
-
userName: "Alice",
|
|
168
|
-
wantId: "1",
|
|
169
|
-
wantName: "Alice",
|
|
170
|
-
wantErr: false,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "empty name",
|
|
174
|
-
userName: "",
|
|
175
|
-
wantId: "2",
|
|
176
|
-
wantName: "", // Empty name should be preserved
|
|
177
|
-
wantErr: false,
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: "special characters",
|
|
181
|
-
userName: "John & Jane",
|
|
182
|
-
wantId: "3",
|
|
183
|
-
wantName: "John & Jane",
|
|
184
|
-
wantErr: false,
|
|
185
|
-
},
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
for _, tt := range tests {
|
|
189
|
-
t.Run(tt.name, func(t *testing.T) {
|
|
190
|
-
req := &service.QueryHelloRequest{
|
|
191
|
-
Name: tt.userName,
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
resp, err := svc.client.QueryHello(context.Background(), req)
|
|
195
|
-
if tt.wantErr {
|
|
196
|
-
assert.Error(t, err)
|
|
197
|
-
return
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
assert.NoError(t, err)
|
|
201
|
-
assert.NotNil(t, resp.Hello)
|
|
202
|
-
assert.Equal(t, tt.wantId, resp.Hello.Id)
|
|
203
|
-
assert.Equal(t, tt.wantName, resp.Hello.Name)
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
func TestSequentialIDs(t *testing.T) {
|
|
209
|
-
// Set up basic service
|
|
210
|
-
svc := setupTestService(t)
|
|
211
|
-
defer svc.cleanup()
|
|
212
|
-
|
|
213
|
-
// The first request should get ID "1"
|
|
214
|
-
firstReq := &service.QueryHelloRequest{Name: "First"}
|
|
215
|
-
firstResp, err := svc.client.QueryHello(context.Background(), firstReq)
|
|
216
|
-
require.NoError(t, err)
|
|
217
|
-
assert.Equal(t, "1", firstResp.Hello.Id)
|
|
218
|
-
|
|
219
|
-
// The second request should get ID "2"
|
|
220
|
-
secondReq := &service.QueryHelloRequest{Name: "Second"}
|
|
221
|
-
secondResp, err := svc.client.QueryHello(context.Background(), secondReq)
|
|
222
|
-
require.NoError(t, err)
|
|
223
|
-
assert.Equal(t, "2", secondResp.Hello.Id)
|
|
224
|
-
|
|
225
|
-
// The third request should get ID "3"
|
|
226
|
-
thirdReq := &service.QueryHelloRequest{Name: "Third"}
|
|
227
|
-
thirdResp, err := svc.client.QueryHello(context.Background(), thirdReq)
|
|
228
|
-
require.NoError(t, err)
|
|
229
|
-
assert.Equal(t, "3", thirdResp.Hello.Id)
|
|
230
|
-
}
|
|
231
|
-
`;
|
|
232
|
-
const readme = `# {name} Plugin - Cosmo gRPC Service Example
|
|
233
|
-
|
|
234
|
-
This repository contains a simple Cosmo gRPC service plugin that showcases how to design APIs with GraphQL Federation but implement them using gRPC methods instead of traditional resolvers.
|
|
235
|
-
|
|
236
|
-
## What is this demo about?
|
|
237
|
-
|
|
238
|
-
This demo illustrates a key pattern in Cosmo gRPC service development:
|
|
239
|
-
- **Design with GraphQL**: Define your API using GraphQL schema
|
|
240
|
-
- **Implement with gRPC**: Instead of writing GraphQL resolvers, implement gRPC service methods
|
|
241
|
-
- **Bridge the gap**: The Cosmo router connects GraphQL operations to your gRPC implementations
|
|
242
|
-
- **Test-Driven Development**: Test your gRPC service implementation with gRPC client and server without external dependencies
|
|
243
|
-
|
|
244
|
-
The plugin demonstrates:
|
|
245
|
-
- How GraphQL types and operations map to gRPC service methods
|
|
246
|
-
- Simple "Hello World" implementation
|
|
247
|
-
- Proper structure for a Cosmo gRPC service plugin
|
|
248
|
-
- How to test your gRPC service implementation with gRPC client and server without external dependencies
|
|
249
|
-
|
|
250
|
-
## Getting Started
|
|
251
|
-
|
|
252
|
-
Plugin structure:
|
|
253
|
-
|
|
254
|
-
\`\`\`
|
|
255
|
-
plugins/{originalPluginName}/
|
|
256
|
-
├── go.mod # Go module file with dependencies
|
|
257
|
-
├── go.sum # Go checksums file
|
|
258
|
-
├── src/
|
|
259
|
-
│ ├── main.go # Main plugin implementation
|
|
260
|
-
│ ├── main_test.go # Tests for the plugin
|
|
261
|
-
│ └── schema.graphql # GraphQL schema defining the API
|
|
262
|
-
├── generated/ # Generated code (created during build)
|
|
263
|
-
└── bin/ # Compiled binaries (created during build)
|
|
264
|
-
└── plugin # The compiled plugin binary
|
|
265
|
-
\`\`\`
|
|
266
|
-
|
|
267
|
-
## 🔧 Customizing Your Plugin
|
|
268
|
-
|
|
269
|
-
- Change the GraphQL schema in \`src/schema.graphql\` and regenerate the code with \`make generate\`.
|
|
270
|
-
- Implement the changes in \`src/main.go\` and test your implementation with \`make test\`.
|
|
271
|
-
- Build the plugin with \`make build\`.
|
|
272
|
-
|
|
273
|
-
## 📚 Learn More
|
|
274
|
-
|
|
275
|
-
For more information about Cosmo and building router plugins:
|
|
276
|
-
- [Cosmo Documentation](https://cosmo-docs.wundergraph.com/)
|
|
277
|
-
- [Cosmo Router Plugins Guide](https://cosmo-docs.wundergraph.com/connect/plugins)
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
<p align="center">Made with ❤️ by <a href="https://wundergraph.com">WunderGraph</a></p>`;
|
|
282
|
-
const schema = `type World {
|
|
283
|
-
"""
|
|
284
|
-
The ID of the world
|
|
285
|
-
"""
|
|
286
|
-
id: ID!
|
|
287
|
-
"""
|
|
288
|
-
The name of the world
|
|
289
|
-
"""
|
|
290
|
-
name: String!
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
type Query {
|
|
294
|
-
"""
|
|
295
|
-
The hello query
|
|
296
|
-
"""
|
|
297
|
-
hello(name: String!): World!
|
|
298
|
-
}
|
|
299
|
-
`;
|
|
300
|
-
const cursorRules = `---
|
|
301
|
-
description: {name} Plugin Guide
|
|
302
|
-
globs: src/**
|
|
303
|
-
alwaysApply: false
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
# {name} Plugin Development Guide
|
|
307
|
-
|
|
308
|
-
You are an expert in developing Cosmo Router plugins. You are given a GraphQL schema, and you need to implement the Go code for the plugin.
|
|
309
|
-
Your goal is to implement the plugin in a way that is easy to understand and maintain. You add tests to ensure the plugin works as expected.
|
|
310
|
-
|
|
311
|
-
All make commands need to be run from the plugin directory \`{pluginDir}\`.
|
|
312
|
-
|
|
313
|
-
## Plugin Structure
|
|
314
|
-
|
|
315
|
-
A plugin is structured as follows:
|
|
316
|
-
|
|
317
|
-
\`\`\`
|
|
318
|
-
plugins/{originalPluginName}/
|
|
319
|
-
├── Makefile # Build automation
|
|
320
|
-
├── go.mod # Go module definition
|
|
321
|
-
├── go.sum # Go module checksums
|
|
322
|
-
├── src/
|
|
323
|
-
│ ├── schema.graphql # GraphQL schema (API contract)
|
|
324
|
-
│ ├── main.go # Plugin implementation
|
|
325
|
-
│ └── main_test.go # Tests for the plugin
|
|
326
|
-
├── generated/ # Auto-generated files (DO NOT EDIT)
|
|
327
|
-
│ ├── service.proto # Generated Protocol Buffers
|
|
328
|
-
│ ├── service.pb.go # Generated Go structures
|
|
329
|
-
│ ├── service.proto.lock.json # Generated Protobuf lock file
|
|
330
|
-
│ └── service_grpc.pb.go # Generated gRPC service
|
|
331
|
-
└── bin/ # Compiled binaries
|
|
332
|
-
└── plugin # The compiled plugin binary
|
|
333
|
-
\`\`\`
|
|
334
|
-
|
|
335
|
-
## Development Workflow
|
|
336
|
-
|
|
337
|
-
1. When modifying the GraphQL schema in \`src/schema.graphql\`, you need to regenerate the code with \`make generate\`.
|
|
338
|
-
2. Look into the generated code in \`generated/service.proto\` and \`generated/service.pb.go\` to understand the updated API contract and service methods.
|
|
339
|
-
3. Implement the new RPC methods in \`src/main.go\`.
|
|
340
|
-
4. Add tests to \`src/main_test.go\` to ensure the plugin works as expected. You need to run \`make test\` to ensure the tests pass.
|
|
341
|
-
5. Finally, build the plugin with \`make build\` to ensure the plugin is working as expected.
|
|
342
|
-
6. Your job is done after successfully building the plugin. Don't verify if the binary was created. The build command will take care of that.
|
|
343
|
-
|
|
344
|
-
**Important**: Never manipulate the files inside \`generated\` directory yourself. Don't touch the \`service.proto\`, \`service.proto.lock.json\`, \`service.pb.go\` and \`service_grpc.pb.go\` files.
|
|
345
|
-
|
|
346
|
-
You can update the Go dependencies by running \`make test\` to ensure the dependencies are up to date. It runs \`go mod tidy\` under the hood.
|
|
347
|
-
|
|
348
|
-
## Implementation Pattern
|
|
349
|
-
|
|
350
|
-
### Service Integration
|
|
351
|
-
|
|
352
|
-
If you need to integrate with other HTTP services, you should prefer to use the \`github.com/wundergraph/cosmo/router-plugin/httpclient\` package.
|
|
353
|
-
Always prefer a real integration over mocking. In the tests, you can mock the external service by bootstrapping an http server that returns the expected response.
|
|
354
|
-
In tests, focus on a well-defined contract and the expected behavior of your service. Structure tests by endpoint, use-cases and use table-driven tests when possible.
|
|
355
|
-
|
|
356
|
-
Here is an example of how to use the \`httpclient\` package:
|
|
357
|
-
|
|
358
|
-
\`\`\`go
|
|
359
|
-
// Initialize HTTP client for external API calls
|
|
360
|
-
// The base URL is the URL of the external API
|
|
361
|
-
client := httpclient.New(
|
|
362
|
-
httpclient.WithBaseURL("<replace_with_base_url>"),
|
|
363
|
-
httpclient.WithTimeout(5*time.Second),
|
|
364
|
-
httpclient.WithHeaders(map[string]string{}),
|
|
365
|
-
)
|
|
366
|
-
// A HTTP GET request to the external API
|
|
367
|
-
resp, err := client.Get(ctx, "/<replace_with_path>")
|
|
368
|
-
// A HTTP POST/PUT/DELETE request to the external API with a struct that is marshalled to JSON
|
|
369
|
-
resp, err := client.Post(ctx, "/<replace_with_path>", payload)
|
|
370
|
-
// Passing payload with custom request options
|
|
371
|
-
resp, err := client.Put(ctx, "/<replace_with_path>", payload,
|
|
372
|
-
httpclient.WithHeaders(map[string]string{}),
|
|
373
|
-
)
|
|
374
|
-
// Unmarshal the JSON response into our data structure
|
|
375
|
-
data, err := httpclient.UnmarshalTo[[]ResponseType](resp)
|
|
376
|
-
// The response offers the following fields:
|
|
377
|
-
type Response struct {
|
|
378
|
-
StatusCode int
|
|
379
|
-
Headers http.Header
|
|
380
|
-
Body []byte
|
|
381
|
-
}
|
|
382
|
-
// You can check for success (StatusCode >= 200 && StatusCode < 300)
|
|
383
|
-
resp.IsSuccess()
|
|
384
|
-
\`\`\`
|
|
385
|
-
`;
|
|
386
|
-
const cursorIgnore = `# Ignore the mapping and lock files
|
|
387
|
-
generated/mapping.json
|
|
388
|
-
generated/service.proto.lock.json
|
|
389
|
-
# Ignore the proto to avoid interpretation issues
|
|
390
|
-
generated/service.proto
|
|
391
|
-
# Ignore the plugin binary
|
|
392
|
-
bin/
|
|
393
|
-
`;
|
|
394
|
-
const dockerfile = `FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
|
|
395
|
-
|
|
396
|
-
# Multi-platform build arguments
|
|
397
|
-
ARG TARGETOS
|
|
398
|
-
ARG TARGETARCH
|
|
399
|
-
|
|
400
|
-
WORKDIR /build
|
|
401
|
-
|
|
402
|
-
# Copy go mod files
|
|
403
|
-
COPY go.mod go.sum ./
|
|
404
|
-
RUN go mod download
|
|
405
|
-
|
|
406
|
-
# Copy source code
|
|
407
|
-
COPY . .
|
|
408
|
-
|
|
409
|
-
RUN --mount=type=cache,target="/root/.cache/go-build" CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o dist/plugin ./src
|
|
410
|
-
|
|
411
|
-
FROM --platform=$BUILDPLATFORM scratch
|
|
412
|
-
|
|
413
|
-
COPY --from=builder /build/dist/plugin ./{originalPluginName}-plugin
|
|
414
|
-
|
|
415
|
-
ENTRYPOINT ["./{originalPluginName}-plugin"]
|
|
416
|
-
`;
|
|
1
|
+
// Templates for plugin (templating is done by pupa)
|
|
2
|
+
// This file is auto-generated. Do not edit manually.
|
|
3
|
+
/* eslint-disable no-template-curly-in-string */
|
|
4
|
+
const gitignore = '# Ignore the binary files\nbin/\n';
|
|
5
|
+
const makefile = '\n.PHONY: build test generate install-wgc\n\ninstall-wgc:\n\t@which wgc > /dev/null 2>&1 || npm install -g wgc@latest\n\nmake: build\n\ntest: install-wgc\n\twgc router plugin test .\n\ngenerate: install-wgc\n\twgc router plugin generate .\n\npublish: generate\n\twgc router plugin publish .\n\nbuild: install-wgc\n\twgc router plugin build . --debug\n';
|
|
6
|
+
const readmePluginMd = '# {name} Plugin - Cosmo gRPC Service Example\n\nThis repository contains a simple Cosmo gRPC service plugin that showcases how to design APIs with GraphQL Federation but implement them using gRPC methods instead of traditional resolvers.\n\n## What is this demo about?\n\nThis demo illustrates a key pattern in Cosmo gRPC service development:\n- **Design with GraphQL**: Define your API using GraphQL schema\n- **Implement with gRPC**: Instead of writing GraphQL resolvers, implement gRPC service methods\n- **Bridge the gap**: The Cosmo router connects GraphQL operations to your gRPC implementations\n- **Test-Driven Development**: Test your gRPC service implementation with gRPC client and server without external dependencies\n\nThe plugin demonstrates:\n- How GraphQL types and operations map to gRPC service methods\n- Simple "Hello World" implementation\n- Proper structure for a Cosmo gRPC service plugin\n- How to test your gRPC service implementation with gRPC client and server without external dependencies\n\n{readmeText}\n\n## 🔧 Customizing Your Plugin\n\n- Change the GraphQL schema in `src/schema.graphql` and regenerate the code with `make generate`.\n- Implement the changes in `src/{mainFile}` and test your implementation with `make test`.\n- Build the plugin with `make build`.\n\n## 📚 Learn More\n\nFor more information about Cosmo and building router plugins:\n- [Cosmo Documentation](https://cosmo-docs.wundergraph.com/)\n- [Cosmo Router Plugins Guide](https://cosmo-docs.wundergraph.com/connect/plugins)\n\n---\n\n<p align="center">Made with ❤️ by <a href="https://wundergraph.com">WunderGraph</a></p>';
|
|
7
|
+
const cursorignore = '# Ignore the mapping and lock files\ngenerated/mapping.json\ngenerated/service.proto.lock.json\n# Ignore the proto to avoid interpretation issues\ngenerated/service.proto\n# Ignore the plugin binary\nbin/\n';
|
|
8
|
+
const schemaGraphql = 'type World {\n """\n The ID of the world\n """\n id: ID!\n """\n The name of the world\n """\n name: String!\n}\n\ntype Query {\n """\n The hello query\n """\n hello(name: String!): World!\n}\n';
|
|
417
9
|
export default {
|
|
418
|
-
goMod,
|
|
419
|
-
mainGo,
|
|
420
|
-
mainGoTest,
|
|
421
|
-
readme,
|
|
422
|
-
schema,
|
|
423
10
|
gitignore,
|
|
424
11
|
makefile,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
12
|
+
readmePluginMd,
|
|
13
|
+
cursorignore,
|
|
14
|
+
schemaGraphql,
|
|
428
15
|
};
|
|
429
16
|
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/templates/plugin.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../../../../../src/commands/router/commands/plugin/templates/plugin.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,qDAAqD;AACrD,gDAAgD;AAEhD,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAEtD,MAAM,QAAQ,GACZ,iWAAiW,CAAC;AAEpW,MAAM,cAAc,GAClB,8lDAA8lD,CAAC;AAEjmD,MAAM,YAAY,GAChB,gNAAgN,CAAC;AAEnN,MAAM,aAAa,GACjB,+MAA+M,CAAC;AAElN,eAAe;IACb,SAAS;IACT,QAAQ;IACR,cAAc;IACd,YAAY;IACZ,aAAa;CACd,CAAC"}
|