@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 +1 -1
- package/dist/bin.js +15 -3
- package/dist/function.d.ts +3 -3
- package/dist/function.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
178
|
+
onMessage(cb: (data: T) => void): Promise<void>;
|
|
167
179
|
abort(): void;
|
|
168
180
|
};
|
|
169
181
|
|
package/dist/function.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export type SSEEvent
|
|
1
|
+
export type SSEEvent = {
|
|
2
2
|
event: string;
|
|
3
|
-
data:
|
|
3
|
+
data: any;
|
|
4
4
|
raw: string;
|
|
5
5
|
};
|
|
6
|
-
export type SSEHandler<T> = (evt: SSEEvent
|
|
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;
|
package/dist/function.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../src/function.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,
|
|
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"}
|