Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@connectrpc/protoc-gen-connect-query

Package Overview
Dependencies
Maintainers
7
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@connectrpc/protoc-gen-connect-query - npm Package Compare versions

Comparing version 0.6.0 to 1.0.0-rc.1

6

dist/cjs/package.json
{
"name": "@connectrpc/protoc-gen-connect-query",
"version": "0.6.0",
"version": "1.0.0-rc.1",
"description": "Code generator for connect-query",

@@ -30,6 +30,6 @@ "license": "Apache-2.0",

"devDependencies": {
"@bufbuild/buf": "1.27.0",
"@bufbuild/buf": "1.27.1",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-query": "workspace:*",
"@connectrpc/connect-react-query": "workspace:*",
"@connectrpc/protoc-gen-connect-es": "^1.1.2",

@@ -36,0 +36,0 @@ "@tanstack/react-query": "^4.36.1",

@@ -28,23 +28,2 @@ "use strict";

f.preamble(protoFile);
f.print((0, ecmascript_1.makeJsDoc)(service));
f.print("export declare const ", (0, ecmascript_1.localName)(service), ": {");
f.print(` readonly typeName: `, (0, ecmascript_1.literalString)(service.typeName), `,`);
f.print(" readonly methods: {");
for (const method of service.methods) {
f.print((0, ecmascript_1.makeJsDoc)(method, " "));
f.print(" readonly ", (0, ecmascript_1.localName)(method), ": {");
f.print(` readonly name: `, (0, ecmascript_1.literalString)(method.name), `,`);
f.print(" readonly I: typeof ", method.input, ",");
f.print(" readonly O: typeof ", method.output, ",");
f.print(" readonly kind: ", rtMethodKind, ".", protobuf_1.MethodKind[method.methodKind], ",");
if (method.idempotency !== undefined) {
f.print(" readonly idempotency: ", rtMethodIdempotency, ".", protobuf_1.MethodIdempotency[method.idempotency], ",");
}
// In case we start supporting options, we have to surface them here
f.print(" },");
}
f.print(" }");
f.print("};");
f.print();
const unaryFunctionsWithHooks = f.import('UnaryFunctionsWithHooks', '@connectrpc/connect-query');
service.methods.forEach((method) => {

@@ -54,3 +33,15 @@ switch (method.methodKind) {

{
f.print(`export const `, safeIdentifier((0, ecmascript_1.localName)(method)), `: `, unaryFunctionsWithHooks, `<`, method.input, `, `, method.output, `>`, ';');
f.print((0, ecmascript_1.makeJsDoc)(method));
f.print(`export const `, safeIdentifier((0, ecmascript_1.localName)(method)), `: {`);
f.print(` readonly name: `, (0, ecmascript_1.literalString)(method.name), `,`);
f.print(" readonly I: typeof ", method.input, ",");
f.print(" readonly O: typeof ", method.output, ",");
f.print(" readonly kind: ", rtMethodKind, ".", protobuf_1.MethodKind[method.methodKind], ",");
if (method.idempotency !== undefined) {
f.print(" readonly idempotency: ", rtMethodIdempotency, ".", protobuf_1.MethodIdempotency[method.idempotency], ",");
}
f.print(` readonly service: {`);
f.print(` readonly typeName: ${(0, ecmascript_1.literalString)(service.typeName)}`);
f.print(` }`);
f.print("};");
}

@@ -57,0 +48,0 @@ break;

@@ -30,27 +30,3 @@ "use strict";

f.preamble(protoFile);
f.print(`export const typeName = ${(0, ecmascript_1.literalString)(service.typeName)};`);
f.print();
const { MethodKind: rtMethodKind, MethodIdempotency: rtMethodIdempotency } = schema.runtime;
f.print((0, ecmascript_1.makeJsDoc)(service));
f.print("export const ", (0, ecmascript_1.localName)(service), " = {");
f.print(` typeName: `, (0, ecmascript_1.literalString)(service.typeName), `,`);
f.print(" methods: {");
for (const method of service.methods) {
f.print((0, ecmascript_1.makeJsDoc)(method, " "));
f.print(" ", (0, ecmascript_1.localName)(method), ": {");
f.print(` name: `, (0, ecmascript_1.literalString)(method.name), `,`);
f.print(" I: ", method.input, ",");
f.print(" O: ", method.output, ",");
f.print(" kind: ", rtMethodKind, ".", protobuf_1.MethodKind[method.methodKind], ",");
if (method.idempotency !== undefined) {
f.print(" idempotency: ", rtMethodIdempotency, ".", protobuf_1.MethodIdempotency[method.idempotency], ",");
}
// In case we start supporting options, we have to surface them here
f.print(" },");
}
f.print(" }");
f.print("}", isTs ? " as const" : "", ";");
f.print();
f.print(`const $queryService = `, f.import('createQueryService', '@connectrpc/connect-query'), `({`, ` service: `, (0, ecmascript_1.localName)(service), `,`, `});`);
f.print();
service.methods

@@ -60,8 +36,15 @@ .filter((method) => method.methodKind === protobuf_1.MethodKind.Unary)

f.print((0, ecmascript_1.makeJsDoc)(method));
const methodTsType = [
": ",
f.import('UnaryFunctionsWithHooks', '@connectrpc/connect-query'),
`<${method.input.name}, ${method.output.name}>`
];
f.print(`export const ${safeIdentifier((0, ecmascript_1.localName)(method))}`, ...(isTs ? methodTsType : []), ` = { `, ` ...$queryService.${(0, ecmascript_1.localName)(method)},`, ` ...`, f.import('createUnaryHooks', '@connectrpc/connect-query'), `($queryService.${(0, ecmascript_1.localName)(method)})`, `};`);
f.print(`export const ${safeIdentifier((0, ecmascript_1.localName)(method))} = { `);
f.print(` localName: ${(0, ecmascript_1.literalString)((0, ecmascript_1.localName)(method))},`);
f.print(` name: ${(0, ecmascript_1.literalString)(method.name)},`);
f.print(` kind: `, rtMethodKind, ".", protobuf_1.MethodKind[method.methodKind], ",");
f.print(` I: `, method.input, `,`);
f.print(` O: `, method.output, `,`);
if (method.idempotency !== undefined) {
f.print(" idempotency: ", rtMethodIdempotency, ".", protobuf_1.MethodIdempotency[method.idempotency], ",");
}
f.print(` service: {`);
f.print(` typeName: ${(0, ecmascript_1.literalString)(service.typeName)}`);
f.print(` }`);
f.print(`}`, isTs ? ` as const` : ``, `;`);
const lastIndex = index === filteredMethods.length - 1;

@@ -68,0 +51,0 @@ if (!lastIndex) {

{
"name": "@connectrpc/protoc-gen-connect-query",
"version": "0.6.0",
"version": "1.0.0-rc.1",
"description": "Code generator for connect-query",

@@ -23,3 +23,3 @@ "license": "Apache-2.0",

"devDependencies": {
"@bufbuild/buf": "1.27.0",
"@bufbuild/buf": "1.27.1",
"@bufbuild/protoc-gen-es": "^1.3.3",

@@ -30,3 +30,3 @@ "@connectrpc/connect": "^1.1.2",

"typescript": "^5.2.2",
"@connectrpc/connect-query": "0.6.0"
"@connectrpc/connect-react-query": "1.0.0-rc.1"
},

@@ -33,0 +33,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc