Skip to content

Commit ca78e81

Browse files
committed
wip
1 parent 5af9139 commit ca78e81

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Future.ts

+15
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,18 @@ export class FutureInput extends Future<any> {
352352
this.schema = schema ?? {};
353353
}
354354
}
355+
356+
/**
357+
* Specify an `input` future that can be assigned a name when create a new module.
358+
* Input types and validation paramters may optionally be described using a JSON Schema object.
359+
*
360+
* Default values may also be specified here and will be used if user input is not provided for this input.
361+
*/
362+
export function input(schema?: FutureInput["schema"]) {
363+
// NOTE: using `any` as the return type here for now to ease using
364+
// this in general node input args or helper functions.
365+
//
366+
// Once we ship our Future type reorganization work, we can just
367+
// use this as-is (Future<any>)
368+
return new FutureInput(schema) as any;
369+
}

src/sb.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { FutureAnyObject, FutureInput, FutureString } from "substrate/Future";
1+
import { FutureAnyObject, FutureString, input } from "substrate/Future";
22
import { StreamingResponse } from "substrate/SubstrateStreamingResponse";
33

44
export const sb = {
55
concat: FutureString.concat,
66
jq: FutureAnyObject.jq,
77
interpolate: FutureString.interpolate,
8-
input: (schema?: FutureInput["schema"]) => new FutureInput(schema) as any,
8+
input,
99
streaming: {
1010
fromSSEResponse: StreamingResponse.fromReponse,
1111
},

0 commit comments

Comments
 (0)