Toolbox plugin - collection of utility elements

v1.1.3 New Version

  • Server script - to run a Node script on the server, as a workflow step.

This will be handy if you don’t want to create a plugin of your own for server side code.

Uses

  • Calculations and string expressions, regular expressions.

  • Conversions between types, which has been difficult to do on the server side.

  • Set a value to be used by a subsequent workflow step.

I’ll be putting up some examples soon.

Note that you can run the script from a page workflow, the script will be run on the server, so you’ll notice a delay on the app as the client waits for the result.

Limitations
The script will be stopped with an error after a timeout of 10 seconds.

Global variables aren’t reliably available – you can set them up, but there’s no guarantee that the script will run in the same process when you want to retrieve them.

There are a limited number of Node packages/modules available, Bubble has mentioned they will come up with a process for more to be added.

Caution - if you allow untrusted scripts to run, for example submitted by a user, it could break your app’s server scripting environment, and require intervention by the Bubble team.

Node objects and functions you may find useful.

Node modules/objects:
Object
Function
Array
Number
Boolean
String
Symbol
Date
RegExp
Error
EvalError
RangeError
ReferenceError
SyntaxError
TypeError
URIError
JSON
Math
ArrayBuffer
Uint8Array
Int8Array
Uint16Array
Int16Array
Uint32Array
Int32Array
Float32Array
Float64Array
Uint8ClampedArray
DataView
Map
Set
WeakMap
WeakSet
Proxy
Reflect
Infinity
Promise
Intl
Buffer

Potentially useful functions:
parseInt
parseFloat
escape
unescape
decodeURI
decodeURIComponent
encodeURI
encodeURIComponent
clearInterval
clearTimeout
setInterval
setTimeout
get_object_from_id
get_objects_from_ids

Plus the documented functions assigned for a plugin:
context.request
context.currentUser

Remember to refresh the app editor after upgrading a plugin.

9 Likes