Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • filter: the selector

    • a string
      considered as the extension of the file to match with (equals), or the mimetype to match with (equals or starts with)

    • a string array, as a list of file extensions or mimetypes to match with

    • a json object, as an conditional expression (logical and combination)

      • property as a variable

        • extension: extension of current file

        • mimetype: mimetype of current file

        • name: name of current file

        • basename: name (without extension) of current file

        • path: relative to san path of the current file

        • length: length of current file (bytes)

        • lastmodified: last modified timestamp (unix epoch time) of current file

        • width: pixel width of current file

        • height: pixel height of current file

        • xdpi: horizontal density in dots per inch of current file

        • ydpi: vertical density in dots per inch of current file

        • original.extension: extension of original file

        • original.mimetype: mimetype of original file

        • original.name: name of original file

        • original.basename: name (without extension) of original file

        • original.path: relative to san path of the original file

        • original.length: length of original file (bytes)

        • original.lastmodified: last modified timestamp (unix epoch time)

        • original.width: pixel width of original file

        • original.height: pixel height of original file

        • original.xdpi: horizontal density in dots per inch of original file

        • original.ydpi: vertical density in dots per inch of original file

        • some new properties has been added in 2023.5 (see below)

          Value is the test to be performed, as

          • a simple value, to check if the variable is equal to
            Example:

            Code Block
            languagejson
            "filter": {
                "extension":"jpg"
            }
          • an object, as logical and combination, where property name is an operator and value is the value to used with the operator, or an array of values (logical or combination)

          • an array, as logical or combination of all items
            Example 1:

            Code Block
            {
               "filter": {
                   "extension":["jpg","png"]
               }
            }

            Example 2:

            Code Block
            {
               "filter": {
                   "mimetype":["application/pdf",{"startswith":"image/"}]
               }
            }


      • property as a logical operator

        • or: the value must be an array of conditions

          example:

          Code Block
          languagejson
          {
             "filter": {
                "or": [
                        {"path": {"ct":"/asset/"}},
                        {"path": {"ct":"/legacy/"}}
                    ]
                ]
             }
          }
        • and: The value must be an array of conditions.

          example:

          Code Block
          languagejson
          {
             "filter": {
                "and": [
                        {"extension":"jpg"},
                        {"length":{"<":"2MiB"}}
                    ]
                ]
             }
          }
        • not: the value must be an object (conditional expression)

          example:

          Code Block
          languagejson
          {
             "filter": {
                "not": {
                    "extension": ["zip","mp4"]          ]
                }
             }
          }


    • an array, as a combination table of the above types
      Example:

      Code Block
      {
         "filter": [
             {
                 "extension":"jpg"
             },
             {
                 "extension":"png",
                 "length":{"<":"2MiB"}
             }
         ]
      }

    • some new operators has been added in 2023.5 (see below)

  • if: action to do if file matches selector

  • else: action to do if file doen’t match selector

...

[filter,actionIf,actionElse]: if matches the filter, do the actionIf, else do actionElse

string type parameter

Not supported.

testing variables

Status
title2023.5
It is possible to asset variables when present. Variables can also be compared with other variables.

Compare asset variables

To indicate an asset variable, use the prefix asset followed by :

  • a colon (:) followed by a property name (or a path), or a function property

  • a period (.) followed by a field name, or a path

  • a arobace (@) followed by a field name, or a path

A path is field names separated by period (.). It is only possible to access the value of a field by path on the child type.

The value of a non-existent variable is always null.

properties

  • present: (boolean) to test if asset is present
    Example:

    Code Block
    languagejson
    filter: {
       "asset:present": { "=": true }
    }
  • type: (string) the type of asset
    Example:

    Code Block
    languagejson
    filter: {
       "asset:type": { "=": "legacy" }
    }

function properties

  • type( name ): (boolean) test the type of asset, where argument name is a type to test
    Example:

    Code Block
    languagejson
    filter: {
       "asset:type(legacy)": { "=": "true" }
    }

    hasTag( name ), where argument name is a tag to test: (boolean) test if asset structurehas tag

  • hasField( name ), where argument name is a fieldname or a field path: (boolean) test if asset structure has field

  • fieldHasTag( name ) where argument name is a tag to test: (boolean) test if one of the fields of the asset structure has a tag,

field values

Field values are always strings. To compare type values (like dates by example), use field object values.

Examples:

Code Block
languagejson
filter: {
    "asset.status": { "=": "6" }
}
Code Block
languagejson
filter: {
    "asset.activated": { "=", "true"}
}

Boolean fields value (nature activated) are converted to boolean values. Date time values are converted to ISO date time string (yyyy-MM-dd'T'HH:mm:ss"), and date values to ISO date string.

field object values

To compare typed values, access the field's typed value, but not all field types are supported. Only simple types such as booleans, dates and numbers are supported.

Code Block
languagejson
filter: {
    "asset@created": { "=", "2023-0718T1000"}
}

comparing booleans

Use operator test (or tst) to compare booleans:

Code Block
languagejson
filter: {
    "asset@activated": { "tst", true}
}

compare dates to now

Use the function now() to compare date to now, with argument as negative day lag (no argument, or any argument that does not matche an integer, means 0 day):

By example, to match asset created before 5 days ago:

Code Block
languagejson
filter: {
    "asset@created": { "<", "now(5)" }
}

By example, to match asset expiring in less than 10 days:

Code Block
languagejson
filter: {
    "asset@dteendrights": { "<", "now(-10)" }
}

uuid

Use $uuid to specify uuid (also in path).

Comparing variables

To test a variable, specify its name and compare it with a constant, which is always static. For example:

Code Block
languagejson
filter {
    "height": { ">": 200}
}

To compare with another variable, specify the name of variable with the pattern ${ name of variable }.

Code Block
languagejson
filter {
    "height": { ">": "${width}" }
}

Password fields

Password values are always null.

additional operators

Status
title2023.5

  • blank (or bk): test if string value is blank

  • oneOf: combinatorial operator whose value is true if only one proposition is true
    Example:

    Code Block
    languagejson
    filter: {
       "oneOf": [
          { "width": { ">", "200"} },
          { "height": { ">", "200"} }
      ]
    }
  • allOf: combinatorial operator whose value is true if all propositions are true

  • anyOf: combinatorial operator whose value is true if one of the propositions is true

  • noneOf: combinatorial operator whose value is true if none of the propositions is true

  • tst: to compare (equality) boolean values