atmx-cli 0.65.0 → 0.67.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.
|
@@ -25,11 +25,21 @@ function generateSdk(multiIr, isReact = false) {
|
|
|
25
25
|
lines.push(` clearAuthToken(methodName: string) {`);
|
|
26
26
|
lines.push(` clearAuthToken("${ns}", methodName);`);
|
|
27
27
|
lines.push(` },`);
|
|
28
|
+
// ✨ FIX: Properly generate React WebSocket imperative methods!
|
|
28
29
|
lines.push(` connect(methodName: string, args?: Record<string, any>) {`);
|
|
29
|
-
lines.push(`
|
|
30
|
+
lines.push(` const { axiomQueryManager } = require('atmx-react');`);
|
|
31
|
+
lines.push(` const def = (this as any)[\`get\${methodName.charAt(0).toUpperCase() + methodName.slice(1)}Def\`](args);`);
|
|
32
|
+
lines.push(` axiomQueryManager.connect(def);`);
|
|
30
33
|
lines.push(` },`);
|
|
31
34
|
lines.push(` disconnect(methodName: string, args?: Record<string, any>) {`);
|
|
32
|
-
lines.push(`
|
|
35
|
+
lines.push(` const { axiomQueryManager } = require('atmx-react');`);
|
|
36
|
+
lines.push(` const def = (this as any)[\`get\${methodName.charAt(0).toUpperCase() + methodName.slice(1)}Def\`](args);`);
|
|
37
|
+
lines.push(` axiomQueryManager.disconnect(def);`);
|
|
38
|
+
lines.push(` },`);
|
|
39
|
+
lines.push(` send(methodName: string, payload: any, args?: Record<string, any>) {`);
|
|
40
|
+
lines.push(` const { axiomQueryManager } = require('atmx-react');`);
|
|
41
|
+
lines.push(` const def = (this as any)[\`get\${methodName.charAt(0).toUpperCase() + methodName.slice(1)}Def\`](args);`);
|
|
42
|
+
lines.push(` axiomQueryManager.send(def, payload);`);
|
|
33
43
|
lines.push(` }`);
|
|
34
44
|
}
|
|
35
45
|
else {
|
|
@@ -46,6 +56,10 @@ function generateSdk(multiIr, isReact = false) {
|
|
|
46
56
|
lines.push(` disconnect(methodName: string, args?: Record<string, any>) {`);
|
|
47
57
|
lines.push(` const argsStr = args && Object.keys(args).length > 0 ? JSON.stringify(args) : '';`);
|
|
48
58
|
lines.push(` (window as any).atmx?.disconnect(\`${ns}.\${methodName}(\${argsStr})\`);`);
|
|
59
|
+
lines.push(` },`);
|
|
60
|
+
lines.push(` send(methodName: string, payload: any, args?: Record<string, any>) {`);
|
|
61
|
+
lines.push(` const argsStr = args && Object.keys(args).length > 0 ? JSON.stringify(args) : '';`);
|
|
62
|
+
lines.push(` (window as any).atmx?.send(\`${ns}.\${methodName}(\${argsStr})\`, payload);`);
|
|
49
63
|
lines.push(` }`);
|
|
50
64
|
}
|
|
51
65
|
lines.push(` },`);
|
package/package.json
CHANGED
|
@@ -34,19 +34,33 @@ export function generateSdk(
|
|
|
34
34
|
lines.push(` clearAuthToken(methodName: string) {`);
|
|
35
35
|
lines.push(` clearAuthToken("${ns}", methodName);`);
|
|
36
36
|
lines.push(` },`);
|
|
37
|
+
// ✨ FIX: Properly generate React WebSocket imperative methods!
|
|
37
38
|
lines.push(
|
|
38
39
|
` connect(methodName: string, args?: Record<string, any>) {`,
|
|
39
40
|
);
|
|
41
|
+
lines.push(` const { axiomQueryManager } = require('atmx-react');`);
|
|
40
42
|
lines.push(
|
|
41
|
-
`
|
|
43
|
+
` const def = (this as any)[\`get\${methodName.charAt(0).toUpperCase() + methodName.slice(1)}Def\`](args);`,
|
|
42
44
|
);
|
|
45
|
+
lines.push(` axiomQueryManager.connect(def);`);
|
|
43
46
|
lines.push(` },`);
|
|
44
47
|
lines.push(
|
|
45
48
|
` disconnect(methodName: string, args?: Record<string, any>) {`,
|
|
46
49
|
);
|
|
50
|
+
lines.push(` const { axiomQueryManager } = require('atmx-react');`);
|
|
47
51
|
lines.push(
|
|
48
|
-
`
|
|
52
|
+
` const def = (this as any)[\`get\${methodName.charAt(0).toUpperCase() + methodName.slice(1)}Def\`](args);`,
|
|
49
53
|
);
|
|
54
|
+
lines.push(` axiomQueryManager.disconnect(def);`);
|
|
55
|
+
lines.push(` },`);
|
|
56
|
+
lines.push(
|
|
57
|
+
` send(methodName: string, payload: any, args?: Record<string, any>) {`,
|
|
58
|
+
);
|
|
59
|
+
lines.push(` const { axiomQueryManager } = require('atmx-react');`);
|
|
60
|
+
lines.push(
|
|
61
|
+
` const def = (this as any)[\`get\${methodName.charAt(0).toUpperCase() + methodName.slice(1)}Def\`](args);`,
|
|
62
|
+
);
|
|
63
|
+
lines.push(` axiomQueryManager.send(def, payload);`);
|
|
50
64
|
lines.push(` }`);
|
|
51
65
|
} else {
|
|
52
66
|
lines.push(` setAuthToken(methodName: string, token: string) {`);
|
|
@@ -78,6 +92,16 @@ export function generateSdk(
|
|
|
78
92
|
lines.push(
|
|
79
93
|
` (window as any).atmx?.disconnect(\`${ns}.\${methodName}(\${argsStr})\`);`,
|
|
80
94
|
);
|
|
95
|
+
lines.push(` },`);
|
|
96
|
+
lines.push(
|
|
97
|
+
` send(methodName: string, payload: any, args?: Record<string, any>) {`,
|
|
98
|
+
);
|
|
99
|
+
lines.push(
|
|
100
|
+
` const argsStr = args && Object.keys(args).length > 0 ? JSON.stringify(args) : '';`,
|
|
101
|
+
);
|
|
102
|
+
lines.push(
|
|
103
|
+
` (window as any).atmx?.send(\`${ns}.\${methodName}(\${argsStr})\`, payload);`,
|
|
104
|
+
);
|
|
81
105
|
lines.push(` }`);
|
|
82
106
|
}
|
|
83
107
|
lines.push(` },`);
|