mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-25 13:51:34 +00:00
Extract defaults (#34)
* Extracted default request flow builder behavior out of the constructor * Remove init_peer_id variable, which stands in the way when building apps with aquamarine
This commit is contained in:
@ -55,6 +55,7 @@ const requestResponse = async <T>(
|
||||
`;
|
||||
|
||||
const [request, promise] = new RequestFlowBuilder()
|
||||
.withDefaults()
|
||||
.withRawScript(script)
|
||||
.withVariables(data)
|
||||
.withTTL(ttl)
|
||||
@ -72,6 +73,7 @@ const requestResponse = async <T>(
|
||||
export const getModules = async (client: FluenceClient, ttl?: number): Promise<string[]> => {
|
||||
let callbackFn = 'getModules';
|
||||
const [req, promise] = new RequestFlowBuilder()
|
||||
.withDefaults()
|
||||
.withRawScript(
|
||||
`
|
||||
(seq
|
||||
@ -100,6 +102,7 @@ export const getModules = async (client: FluenceClient, ttl?: number): Promise<s
|
||||
export const getInterfaces = async (client: FluenceClient, ttl?: number): Promise<string[]> => {
|
||||
let callbackFn = 'getInterfaces';
|
||||
const [req, promise] = new RequestFlowBuilder()
|
||||
.withDefaults()
|
||||
.withRawScript(
|
||||
`
|
||||
(seq
|
||||
@ -166,6 +169,7 @@ export const uploadModule = async (
|
||||
data.set('myPeerId', client.selfPeerId);
|
||||
|
||||
const [req, promise] = new RequestFlowBuilder()
|
||||
.withDefaults()
|
||||
.withRawScript(
|
||||
`
|
||||
(seq
|
||||
@ -259,7 +263,11 @@ export const createService = async (
|
||||
* @param {[number]} ttl - Optional ttl for the particle which does the job
|
||||
* @returns { Array<object> } - List of available blueprints
|
||||
*/
|
||||
export const getBlueprints = async (client: FluenceClient, nodeId?: string, ttl?: number): Promise<[{dependencies, id: string, name: string}]> => {
|
||||
export const getBlueprints = async (
|
||||
client: FluenceClient,
|
||||
nodeId?: string,
|
||||
ttl?: number,
|
||||
): Promise<[{ dependencies; id: string; name: string }]> => {
|
||||
let returnValue = 'blueprints';
|
||||
let call = (nodeId: string) => `(call "${nodeId}" ("dist" "list_blueprints") [] ${returnValue})`;
|
||||
|
||||
|
Reference in New Issue
Block a user