The functions object is a collection of utility functions designed to assist your application in performing various tasks. These functions enhance the functionality of your application and simplify common operations.

Available Functions:

  1. epcsToGtinQuantity(epcs: string[]):

    • This function converts a list of EPCs into a list sorted by GTINs along with their corresponding quantities.
    const gtinQuantities = functions.epcsToGtinQuantity(epcsArray)
    
    
  2. epcToPassword(epc: string, key: string):

    • The epcToPassword function generates a tag password based on the provided EPC and key.
    const tagPassword = functions.epcToPassword(epcValue, key)
    
    
  3. getRandomSerial(minValue: number, maxValue: number):

    • getRandomSerial generates a new random tag serial number within the specified range.
    const randomSerial = functions.getRandomSerial(minValue, maxValue)
    
    
  4. runHook(hookReference: string, body: object):

    • The runHook function allows your application to trigger an API hook, and it returns a result object as a response. Note that this only works with API-based hooks.
    const runMyHook = async () => {
      try {
        const result = await functions.runHook('hook-slug', { property: '123' })
        console.log(result)
      } catch (error) {
        console.error(error)
      }
    }