Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/FluenceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const checkConnection = async (client: FluenceClient, ttl?: number): Prom
const callbackService = '_callback';

const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(
`(seq
(call init_relay ("op" "identity") [msg] result)
Expand Down
7 changes: 6 additions & 1 deletion src/__test__/integration/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Typescript usage suite', () => {

// act
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(
`(seq
(call init_relay ("op" "identity") ["hello world!"] result)
Expand Down Expand Up @@ -76,7 +77,9 @@ describe('Typescript usage suite', () => {
data.set('c', 'some c');
data.set('d', 'some d');

await client1.initiateFlow(new RequestFlowBuilder().withRawScript(script).withVariables(data).build());
await client1.initiateFlow(
new RequestFlowBuilder().withDefaults().withRawScript(script).withVariables(data).build(),
);

let res = await resMakingPromise;
expect(res).toEqual(['some a', 'some b', 'some c', 'some d']);
Expand Down Expand Up @@ -186,6 +189,7 @@ describe('Typescript usage suite', () => {
it('xor handling should work with connected client', async function () {
// arrange
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(
`
(seq
Expand All @@ -210,6 +214,7 @@ describe('Typescript usage suite', () => {
it('xor handling should work with local client', async function () {
// arrange
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(
`
(call %init_peer_id% ("service" "fails") [])
Expand Down
8 changes: 6 additions & 2 deletions src/__test__/unit/air.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('== AIR suite', () => {

// prettier-ignore
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(script)
.buildAsFetch<string[]>(serviceId, fnName);

Expand Down Expand Up @@ -59,6 +60,7 @@ describe('== AIR suite', () => {
const script = `(incorrect)`;
// prettier-ignore
const [request, error] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(script)
.buildWithErrorHandling();

Expand All @@ -75,6 +77,7 @@ describe('== AIR suite', () => {
const script = `(null)`;
// prettier-ignore
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withTTL(1)
.withRawScript(script)
.buildAsFetch();
Expand All @@ -96,6 +99,7 @@ describe('== AIR suite', () => {

// prettier-ignore
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(script)
.withVariable('arg1', 'hello')
.buildAsFetch<string[]>(serviceId, fnName);
Expand Down Expand Up @@ -138,7 +142,7 @@ describe('== AIR suite', () => {
(call %init_peer_id% ("${makeDataServiceId}" "${makeDataFnName}") [] result)
(call %init_peer_id% ("${getDataServiceId}" "${getDataFnName}") [result.$.field])
)`;
await client.initiateFlow(new RequestFlowBuilder().withRawScript(script).build());
await client.initiateFlow(new RequestFlowBuilder().withDefaults().withRawScript(script).build());

// assert
const tetraplet = res.tetraplets[0][0];
Expand Down Expand Up @@ -187,7 +191,7 @@ describe('== AIR suite', () => {
(call %init_peer_id% ("${serviceId2}" "${fnName2}") ["${arg2}"] result2))
(call %init_peer_id% ("${serviceId3}" "${fnName3}") [result1 result2]))
`;
await client.initiateFlow(new RequestFlowBuilder().withRawScript(script).build());
await client.initiateFlow(new RequestFlowBuilder().withDefaults().withRawScript(script).build());

// assert
expect(res1).toEqual(arg1);
Expand Down
2 changes: 2 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const sendParticle = async (
onError?: (err) => void,
): Promise<string> => {
const [req, errorPromise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(particle.script)
.withVariables(particle.data)
.withTTL(particle.ttl)
Expand Down Expand Up @@ -147,6 +148,7 @@ export const sendParticleAsFetch = async <T>(
callbackServiceId: string = '_callback',
): Promise<T> => {
const [request, promise] = new RequestFlowBuilder()
.withDefaults()
.withRawScript(particle.script)
.withVariables(particle.data)
.withTTL(particle.ttl)
Expand Down
Loading