@zachacious/protoc-gen-connect-vue 1.0.17 → 1.0.19
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 +22 -17
- package/package.json +1 -1
- package/templates/api.ts.mustache +6 -1
package/dist/generator.js
CHANGED
|
@@ -336817,19 +336817,20 @@ 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,6 +336838,7 @@ function processService(service) {
|
|
|
336837
336838
|
const importMap = new Map;
|
|
336838
336839
|
const wktImports = new Set;
|
|
336839
336840
|
const allMessages = new Set;
|
|
336841
|
+
const debugLog = [];
|
|
336840
336842
|
function track(msg) {
|
|
336841
336843
|
if (KNOWN_WKT.includes(msg.typeName)) {
|
|
336842
336844
|
wktImports.add(msg.name);
|
|
@@ -336870,12 +336872,13 @@ function processService(service) {
|
|
|
336870
336872
|
const isQuery = isUnary && !isMutation;
|
|
336871
336873
|
const reqPath = findPaginationPath(m.input, true);
|
|
336872
336874
|
const resPath = findPaginationPath(m.output, false);
|
|
336873
|
-
const
|
|
336874
|
-
|
|
336875
|
-
|
|
336876
|
-
|
|
336877
|
-
});
|
|
336878
|
-
|
|
336875
|
+
const isPaginated = isQuery && !!reqPath && !!resPath;
|
|
336876
|
+
debugLog.push(`Method: ${name}`);
|
|
336877
|
+
debugLog.push(` isQuery: ${isQuery}`);
|
|
336878
|
+
debugLog.push(` reqPath: ${reqPath?.join(".")}`);
|
|
336879
|
+
debugLog.push(` resPath: ${resPath?.join(".")}`);
|
|
336880
|
+
debugLog.push(` FINAL: isPaginated = ${isPaginated}`);
|
|
336881
|
+
debugLog.push("---");
|
|
336879
336882
|
return {
|
|
336880
336883
|
functionName: name.charAt(0).toLowerCase() + name.slice(1),
|
|
336881
336884
|
hookName: `use${name}`,
|
|
@@ -336898,12 +336901,14 @@ function processService(service) {
|
|
|
336898
336901
|
externalImports: Array.from(importMap.entries()).map(([path2, types2]) => ({
|
|
336899
336902
|
path: path2,
|
|
336900
336903
|
types: Array.from(types2)
|
|
336901
|
-
}))
|
|
336904
|
+
})),
|
|
336905
|
+
debugInfo: debugLog.join(`
|
|
336906
|
+
`)
|
|
336902
336907
|
};
|
|
336903
336908
|
}
|
|
336904
336909
|
var plugin = createEcmaScriptPlugin({
|
|
336905
336910
|
name: "protoc-gen-connect-vue",
|
|
336906
|
-
version: "v1.
|
|
336911
|
+
version: "v1.10.0",
|
|
336907
336912
|
generateTs: (schema) => {
|
|
336908
336913
|
const service = schema.files.flatMap((f) => f.services)[0];
|
|
336909
336914
|
if (!service)
|
package/package.json
CHANGED