@zachacious/protoc-gen-connect-vue 1.0.17 → 1.0.18

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/generator.js CHANGED
@@ -336817,26 +336817,33 @@ function findPaginationPath(msg, isRequest, depth = 0) {
336817
336817
  ];
336818
336818
  const resKeywords = ["nextpagetoken", "nextpage", "nextcursor"];
336819
336819
  const targets = isRequest ? reqKeywords : resKeywords;
336820
+ for (const f of msg.fields) {
336821
+ if (f.fieldKind === "message") {
336822
+ const name = f.name.toLowerCase();
336823
+ if (name.includes("page") || name.includes("meta") || name.includes("paging")) {
336824
+ const sub = findPaginationPath(f.message, isRequest, depth + 1);
336825
+ if (sub)
336826
+ return [f.name, ...sub];
336827
+ }
336828
+ }
336829
+ }
336820
336830
  for (const f of msg.fields) {
336821
336831
  const normalized = f.name.toLowerCase().replace(/_/g, "");
336822
336832
  if (targets.some((t) => normalized.includes(t)))
336823
336833
  return [f.name];
336824
- if (isRequest && normalized === "page" && f.fieldKind === "message")
336825
- return [f.name];
336826
- }
336827
- for (const f of msg.fields) {
336828
- if (f.fieldKind === "message") {
336829
- const sub = findPaginationPath(f.message, isRequest, depth + 1);
336830
- if (sub)
336831
- return [f.name, ...sub];
336832
- }
336833
336834
  }
336834
336835
  return null;
336835
336836
  }
336837
+ function isRepeatedSafe(f) {
336838
+ if (f.fieldKind === "map")
336839
+ return false;
336840
+ return "repeated" in f && f.repeated === true;
336841
+ }
336836
336842
  function processService(service) {
336837
336843
  const importMap = new Map;
336838
336844
  const wktImports = new Set;
336839
336845
  const allMessages = new Set;
336846
+ const debugLog = [];
336840
336847
  function track(msg) {
336841
336848
  if (KNOWN_WKT.includes(msg.typeName)) {
336842
336849
  wktImports.add(msg.name);
@@ -336870,12 +336877,15 @@ function processService(service) {
336870
336877
  const isQuery = isUnary && !isMutation;
336871
336878
  const reqPath = findPaginationPath(m.input, true);
336872
336879
  const resPath = findPaginationPath(m.output, false);
336873
- const hasRepeatedList = m.output.fields.some((f) => {
336874
- if (f.fieldKind === "map")
336875
- return false;
336876
- return f.repeated === true;
336877
- });
336880
+ const hasRepeatedList = m.output.fields.some((f) => isRepeatedSafe(f));
336878
336881
  const isPaginated = isQuery && hasRepeatedList && !!reqPath && !!resPath;
336882
+ debugLog.push(`Method: ${name}`);
336883
+ debugLog.push(` isUnary: ${isUnary}, isMutation: ${isMutation} -> isQuery: ${isQuery}`);
336884
+ debugLog.push(` reqPath: ${reqPath?.join(".")}`);
336885
+ debugLog.push(` resPath: ${resPath?.join(".")}`);
336886
+ debugLog.push(` hasRepeatedList: ${hasRepeatedList}`);
336887
+ debugLog.push(` FINAL: isPaginated = ${isPaginated}`);
336888
+ debugLog.push("---");
336879
336889
  return {
336880
336890
  functionName: name.charAt(0).toLowerCase() + name.slice(1),
336881
336891
  hookName: `use${name}`,
@@ -336898,12 +336908,14 @@ function processService(service) {
336898
336908
  externalImports: Array.from(importMap.entries()).map(([path2, types2]) => ({
336899
336909
  path: path2,
336900
336910
  types: Array.from(types2)
336901
- }))
336911
+ })),
336912
+ debugInfo: debugLog.join(`
336913
+ `)
336902
336914
  };
336903
336915
  }
336904
336916
  var plugin = createEcmaScriptPlugin({
336905
336917
  name: "protoc-gen-connect-vue",
336906
- version: "v1.8.0",
336918
+ version: "v1.9.0",
336907
336919
  generateTs: (schema) => {
336908
336920
  const service = schema.files.flatMap((f) => f.services)[0];
336909
336921
  if (!service)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zachacious/protoc-gen-connect-vue",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "Smart TanStack Query & ConnectRPC SDK generator for Vue.js",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -66,4 +66,9 @@ export const useApi = () => {
66
66
  queryKeys,
67
67
  createEmpty
68
68
  };
69
- };
69
+ };
70
+
71
+ /*
72
+ --- GENERATOR DEBUG INFO ---
73
+ {{{debugInfo}}}
74
+ */