Skip to content

Commit

Permalink
Add executions modes to activateFlowTriggerById
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-liablin committed Jun 24, 2024
1 parent 2d22dff commit 717fc2b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion backendless.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,12 @@ declare module Backendless {
* @type: Function
*/

type Execution = 'activateAny' | 'activateAll' | string

function activateFlow(flowName: string, initialData?: object): Promise<void>
function activateFlowById(flowId: string, initialData?: object): Promise<void>
function activateFlowTrigger(flowName: string, triggerName: string, data?: object): Promise<void>
function activateFlowTriggerById(flowId: string, triggerId: string, data?: object, execution?: string): Promise<void>
function activateFlowTriggerById(flowId: string, triggerId: string, data?: object, execution?: Execution): Promise<void>
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/automations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class Automations {
if (execution !== undefined && (typeof execution !== 'string' || !execution)) {
throw new Error(
// eslint-disable-next-line
'The "execution" argument must be a non-empty string and must be one of this values: "activateAny", "activateAll" or executionId.'
'The "execution" argument must be a non-empty string and must be one of this values: "activateAny", "activateAll" or Execution ID.'
)
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/automations/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ describe('<Automations> Basic', function() {

it('fails when execution id is invalid', async () => {
// eslint-disable-next-line
const errorMsg = 'The "execution" argument must be a non-empty string and must be one of this values: "activateAny", "activateAll" or executionId.'
const errorMsg = 'The "execution" argument must be a non-empty string and must be one of this values: "activateAny", "activateAll" or Execution ID.'

await expect(Backendless.Automations.activateFlowTriggerById(FLOW_ID, TRIGGER_ID, {}, null)).to.eventually.be.rejectedWith(errorMsg)
await expect(Backendless.Automations.activateFlowTriggerById(FLOW_ID, TRIGGER_ID, {}, true)).to.eventually.be.rejectedWith(errorMsg)
Expand Down

0 comments on commit 717fc2b

Please sign in to comment.