category: ""
configPages:
  - elements:
      - type: configVar
        value: Schedule
    name: Configuration
defaultInstanceProfile: Default Instance Profile
definitionVersion: 7
description: ""
documentation: ""
endpointType: flow_specific
flows:
  - endpointSecurityType: customer_optional
    isSynchronous: false
    name: Flow 1
    steps:
      - action:
          key: schedule
          component:
            isPublic: true
            key: schedule-triggers
            version: LATEST
        description: ""
        inputs: {}
        isTrigger: true
        name: Trigger
        schedule:
          meta:
            scheduleType: custom
            timeZone: ""
          type: configVar
          value: Schedule
      - action:
          key: writeLog
          component:
            isPublic: true
            key: log
            version: LATEST
        description: ""
        inputs:
          level:
            type: value
            value: info
          message:
            type: configVar
            value: Schedule
        name: Write Log Message
name: Random Schedule
requiredConfigVars:
  - key: Schedule
    description: ""
    dataType: string
    orgOnly: false
    dataSource:
      key: runCodeString
      component:
        isPublic: true
        key: code
        version: LATEST
    inputs:
      code:
        meta:
          orgOnly: true
          visibleToCustomerDeployer: false
          visibleToOrgDeployer: false
        type: value
        value: |
          module.exports = async () => {
            // Random number between 0 and 4
            const randomNumber = Math.floor(Math.random() * 5 + 1);

            // Create a cron string using the random number
            // 0-59/5 * * * * means "At every 5th minute from 0 through 59." (i.e. 0, 5, 10, 15, 20...)
            // 3-59/5 * * * * means "At every 5th minute from 3 through 59." (i.e. 3, 8, 13, 18, 23...)
            const cronString = `${randomNumber}-59/5 * * * *`;

            return { result: cronString };
          };
      connection:
        meta:
          orgOnly: true
          visibleToCustomerDeployer: false
          visibleToOrgDeployer: false
        type: configVar
        value: ""
      contextValue:
        meta:
          orgOnly: true
          visibleToCustomerDeployer: false
          visibleToOrgDeployer: false
        type: value
        value: ""
    meta:
      visibleToCustomerDeployer: false
      visibleToOrgDeployer: true
    defaultValue: ""
