Improved sjs-3 API


This is a developers post.

The API of the sjs-3 interpreter was improved with the following.


The os.TYPESAFE placement flag was added for moving, copying, creating files. This allows you to programmatically access the same typesafe file placement functionality present on the drag-and-drop frontend.

The os.TYPESAFE flag enforces that a file can only be placed in a typesafe fashion, where typesafe means conforming the file’s .Accept rules.

If the bucket is provided, and placement would not be typesafe, the operation will fail.

If the bucket is not provided, Boomla will find the first typesafe bucket and use it. If no bucket is safe, the operation will fail.

Docs: os.TYPESAFE.


Similarly, the os.TYPESAFE_IF_POSSIBLE placement flag was also added.

It’s like os.TYPESAFE, but it will proceed anyway instead of failing, when a typesafe bucket is not available.


File.inline(), Collection.inline()

Now you can call f.inline() directly, instead of calling os.inline(f).

Same goes for collection.inline(), instead of os.inline(collection).

Docs: File.inline().
Docs: Collection.inline().

The last argument, the bucket, is now optional.

Now you can call, "name")

instead of, "name", 0)



The last 2 arguments are now optional. You can use the following 3 forms:

f.move(os.APPEND, target)
f.move(os.APPEND, target, "name")
f.move(os.APPEND, target, "name", 0)

Docs: File.move().


Similarly, the last 2 arguments are now optional. You can use the following 3 forms:

f.copy(os.APPEND, target)
f.copy(os.APPEND, target, "name")
f.copy(os.APPEND, target, "name", 0)


you can follow me on Twitter