@inflector/aura 0.2.8 → 0.2.10

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,QA0CnC;AAyaD,wBAAsB,GAAG,kBAsExB"}
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAmLA,wBAAgB,KAAK,CAAC,MAAM,UAAQ,QAiDnC;AAwaD,wBAAsB,GAAG,kBAsExB"}
package/dist/bin.js CHANGED
@@ -125,7 +125,12 @@ function scanFolderWithTypes(folder) {
125
125
  function objectToTypeWithReturn(name, obj, auraType = "AuraFunctionHandler") {
126
126
  const lines = [];
127
127
  function toFnType(returnType) {
128
- return `(...args: any[]) => Promise<${returnType}>`;
128
+ if (returnType === "SSEHandler") {
129
+ return `(...args: any[]) => Promise<SSEEvent>`;
130
+ }
131
+ else {
132
+ return `(...args: any[]) => Promise<${returnType}>`;
133
+ }
129
134
  }
130
135
  function recurse(o, indent = " ") {
131
136
  const inner = [];
@@ -159,11 +164,18 @@ export function build(silent = false) {
159
164
  try {
160
165
  const folder = join(process.cwd(), "Aura", "Functions");
161
166
  const structure = scanFolderWithTypes(folder);
167
+ // IMPORTANT:
168
+ // - SSEHandler is NOT generic
169
+ // - Client exposes parsed data, not raw SSE events
162
170
  const header = `
163
- import type { SSEHandler } from "@inflector/aura";
171
+ export type SSEEvent = {
172
+ event: string; // default: "message"
173
+ data: any;
174
+ raw: string;
175
+ };
164
176
 
165
177
  export type SSEStream<T> = {
166
- onMessage(cb: SSEHandler<T>): Promise<void>;
178
+ onMessage(cb: (data: T) => void): Promise<void>;
167
179
  abort(): void;
168
180
  };
169
181
 
@@ -1,9 +1,9 @@
1
- export type SSEEvent<T = unknown> = {
1
+ export type SSEEvent = {
2
2
  event: string;
3
- data: T;
3
+ data: any;
4
4
  raw: string;
5
5
  };
6
- export type SSEHandler<T> = (evt: SSEEvent<T>) => void;
6
+ export type SSEHandler<T> = (evt: SSEEvent) => void;
7
7
  export type FunctionResult<TJson, TSse> = Promise<TJson> | {
8
8
  onMessage(cb: SSEHandler<TSse>): Promise<void>;
9
9
  abort(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../src/function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;IACR,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEvD,MAAM,MAAM,cAAc,CAAC,KAAK,EAAE,IAAI,IAClC,OAAO,CAAC,KAAK,CAAC,GACd;IACE,SAAS,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAqDN,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1E,SAAS,EAAE,MAAM,cAyDlB"}
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../src/function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAC;AAEpD,MAAM,MAAM,cAAc,CAAC,KAAK,EAAE,IAAI,IAClC,OAAO,CAAC,KAAK,CAAC,GACd;IACE,SAAS,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAqDN,wBAAgB,qBAAqB,CAAC,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1E,SAAS,EAAE,MAAM,cAyDlB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflector/aura",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",