Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "durable-functions in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'durable-functions' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

extensions: ['.md', '.mkd', '.markdown'],
                pipeline: ['renderMarkdownActivity', 'renderTemplateActivity']
            },
            renderTextileActivity: {
                extensions: ['.text', '.textile'],
                pipeline: ['renderTextileActivity', 'renderTemplateActivity']
            },
           /* Render HTML snippets directly (disabled to allow custom content pass-through)
            renderTemplateActivity: {
                extensions: ['.htm', '.html'],
                pipeline: ['renderTemplateActivity']
            }
            */
        };

module.exports = df.orchestrator(function* (context) {
    const outputs = [],
          name = context.df.getInput(),
          extension = path.extname(name);

    var pipeline = ["copyActivity"],
        currentItem = name;

    // context.log("pipeline:", pipeline, name, extension);

    Object.keys(activityMap).forEach(key => { 
        if(activityMap[key].extensions.includes(extension)) {
            pipeline = activityMap[key].pipeline;
        }
    })

    // all activities we build should return a JS object
const df = require("durable-functions");
const moment = require('moment');

module.exports = df.orchestrator(function*(context) {
    const phoneNumber = context.df.getInput();
    if (!phoneNumber) {
        throw "A phone number input is required.";
    }

    const challengeCode = yield context.df.callActivity("E4_SendSmsChallenge", phoneNumber);

    // The user has 90 seconds to respond with the code they received in the SMS message.
    const expiration = moment.utc(context.df.currentUtcDateTime).add(90, 's');
    const timeoutTask = context.df.createTimer(expiration.toDate());

    let authorized = false;
    for (let i = 0; i <= 3; i++) {
        const challengeResponseTask = context.df.waitForExternalEvent("SmsChallengeResponse");

        const winner = yield context.df.Task.any([challengeResponseTask, timeoutTask]);
const df = require('durable-functions')

module.exports = df.orchestrator(function* (context) {
  // retrieves the organization name from the Orchestrator_HttpStart function
  var organizationName = context.df.getInput();
  
  // retrieves the list of repositories for an organization by invoking a separate Activity Function.
  var repositories = yield context.df.callActivity('GetAllRepositoriesForOrganization', organizationName);

  // Creates an array of task to store the result of each functions
  var output = []
  for (var i = 0; i < repositories.length; i++) {
    // Starting a `GetOpenedIssues` activity WITHOUT `yield`
    // This will starts Activity Functions in parallel instead of sequentially.
    output.push(
      context.df.callActivity('GetOpenedIssues', repositories[i])
    )
  }
const df = require("durable-functions");
const moment = require('moment');

module.exports = df.orchestrator(function*(context) {
    const input = context.df.getInput();
    context.log("Received monitor request. location: " + (input ? input.location : undefined)
        + ". phone: " + (input ? input.phone : undefined) + ".");

    verifyRequest(input);

    const endTime = moment.utc(context.df.currentUtcDateTime).add(6, 'h');
    context.log("Instantiating monitor for " + input.location.city + ", " + input.location.state
        + ". Expires: " + (endTime) + ".");

    while (moment.utc(context.df.currentUtcDateTime).isBefore(endTime)) {
        // Check the weather
        context.log("Checking current weather conditions for " + input.location.city + ", "
            + input.location.state + " at " + context.df.currentUtcDateTime + ".");
        const isClear = yield context.df.callActivity("E3_GetIsClear", input.location);
const df = require("durable-functions");

module.exports = df.orchestrator(function*(context){
    const rootDirectory = context.df.getInput();
    if (!rootDirectory) {
        throw new Error("A directory path is required as an input.");
    }

    const files = yield context.df.callActivity("E2_GetFileList", rootDirectory);

    // Backup Files and save Promises into array
    const tasks = [];
    for (const file of files) {
        tasks.push(context.df.callActivity("E2_CopyFileToBlob", file));
    }

    // wait for all the Backup Files Activities to complete, sum total bytes
    const results = yield context.df.Task.all(tasks);
    const totalBytes = results.reduce((prev, curr) => prev + curr, 0);
const df = require("durable-functions");
const moment = require('moment');

module.exports = df.orchestrator(function*(context) {
    let currentValue = context.df.getInput() || 0;
    context.log(`Value is ${currentValue}`);
    currentValue++;

    var wait = moment.utc(context.df.currentUtcDateTime).add(30, 's');
    context.log("Counting up at" + wait.toString());
    yield context.df.createTimer(wait.toDate());

    if (currentValue < 10) {
        yield context.df.continueAsNew(currentValue);
    }

    return currentValue;
});
/*
 * This function is not intended to be invoked directly. Instead it will be
 * triggered by an HTTP starter function.
 * 
 * Before running this sample, please:
 * - create a Durable activity function (default name is "Hello")
 * - create a Durable HTTP starter function
 * - run 'npm install durable-functions' from the wwwroot folder of your 
 *    function app in Kudu
 */

const df = require("durable-functions");

module.exports = df.orchestrator(function* (context) {

    const input = context.df.getInput()
    
    yield context.df.createTimer(new Date(input.startAt))
    
    
    return yield context.df.callActivity('sendEmail', input);
});
const df = require("durable-functions");

module.exports = df.orchestrator(function*(context){
    context.log("Starting chain sample");
    const output = [];
    output.push(yield context.df.callActivity("E1_SayHello", "Tokyo"));
    output.push(yield context.df.callActivity("E1_SayHello", "Seattle"));
    output.push(yield context.df.callActivity("E1_SayHello", "London"));

    return output;
});
const df = require("durable-functions");
const moment = require('moment');

module.exports = df.orchestrator(function*(context){
    const expiration = moment.utc(context.df.currentUtcDateTime).add(2, 'm');
    const timeoutTask = context.df.createTimer(expiration.toDate());

    const hello = yield context.df.callActivity("E1_SayHello", "from the other side");

    if (!timeoutTask.isCompleted) {
        timeoutTask.cancel();
    }

    return hello;
});
module.exports = async function (context, req) {
    const client = df.getClient(context);
    const instanceId = await client.startNew(req.params.functionName, undefined, req.body);

    context.log(`Started orchestration with ID = '${instanceId}'.`);

    return client.createCheckStatusResponse(context.bindingData.req, instanceId);
};

Is your System Free of Underlying Vulnerabilities?
Find Out Now