@inflector/aura 0.2.7 → 0.2.9

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/bin.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AA+KA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAyBnC;AAwaD,wBAAsB,GAAG,kBAsExB"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AA+KA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QA2CnC;AA0aD,wBAAsB,GAAG,kBAsExB"}
package/dist/bin.js CHANGED
@@ -159,8 +159,22 @@ export function build(silent = false) {
159
159
  try {
160
160
  const folder = join(process.cwd(), "Aura", "Functions");
161
161
  const structure = scanFolderWithTypes(folder);
162
- const tsType = 'import type { SSEHandler } from "@inflector/aura";\n' +
163
- objectToTypeWithReturn("AuraFunctions", structure);
162
+ // IMPORTANT:
163
+ // - SSEHandler is NOT generic
164
+ // - Client exposes parsed data, not raw SSE events
165
+ const header = `
166
+ export type SSEStream<T> = {
167
+ onMessage(cb: (data: T) => void): Promise<void>;
168
+ abort(): void;
169
+ };
170
+
171
+ export type FnResult<TJson, TSse = never> =
172
+ TSse extends never
173
+ ? Promise<TJson>
174
+ : Promise<TJson> | SSEStream<TSse>;
175
+ `.trimStart();
176
+ const body = objectToTypeWithReturn("AuraFunctions", structure);
177
+ const tsType = header + "\n\n" + body;
164
178
  const generatedDir = join(process.cwd(), "Aura", ".generated");
165
179
  if (!fs.existsSync(generatedDir)) {
166
180
  fs.mkdirSync(generatedDir, { recursive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflector/aura",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",