
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
directus-extension-formula-interface
Advanced tools
Perform computed value based on other fields
A Directus extension for automatically calculating the value of a field based on other fields of the same item, on the client side.
npm i directus-extension-formula-interface
this extension is based on mathjs, see ther Expression Syntax documentation
you can also see mathjs defined Constants
Sum 2 numbers:
a + b
Multiply 2 numbers:
a * b
Convert string to slug:
toSlug(title)
Text interpolation:
concat('/', toSlug(title), '-', id )
Complex calculation:
2 * x + b
Operator | Description |
---|---|
toSlug(a) | transform string to slug (e.g. "This is a title" → "this-is-a-title") |
Operator | Description |
---|---|
aSum(a, b) | Aggregated sum of O2M field. For example: calculate shopping cart total price with ASUM(products, price * quantity) where products is the O2M field in the shopping cart and price & quantity are 2 fields of products . |
There are dynamic variables available that you can use in the expressions:
$CURRENT_USER
: return the current user's id. Example: $CURRENT_USER.id == user
checks if the user
field is the current user.$PARENTS
: return an object containing potential parents (for using it in a repeated field) but with a limitation for extending fields, we have no reference to parent. For using it you should use the system name of the parent collection Ex for referencing the price of the "parent" collection named "machines" in a formula on a repeated field you can use $PARENTS.machines.price
but take in care when change this value on parent collection is not updated in repeated fields, also this field is not auto evaluated.{{ 's' }}
).FAQs
Perform computed value based on other fields
The npm package directus-extension-formula-interface receives a total of 26 weekly downloads. As such, directus-extension-formula-interface popularity was classified as not popular.
We found that directus-extension-formula-interface demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.