19.5.4 • Published 2 months ago

@balena/pinejs v19.5.4

Weekly downloads
513
License
Apache-2.0
Repository
github
Last release
2 months ago

npm version

Pine.js is a sophisticated rules-driven API engine that enables you to define rules in a structured subset of English. Those rules are used in order for Pine.js to generate a database schema and the associated OData API. This makes it very easy to rapidly create, update and maintain a backend while keeping the logic in an easily understood form, as well as providing the ability to update and maintain this logic going forward.

Rules are described in SBVR format, which stands for "Semantics of Business Vocabulary and Business Rules". SBVR provides a way to capture specifications in natural language and represent them in formal logic, so they can be machine processed.

The basic components of SBVR are as follows:

  • Terms - these are the atomic elements of your data model, defined via Term: [Term Name]. Generally speaking, these map to tables in a relational database, or attributes of other tables.
  • Fact Types - these define relations between different terms and properties of those terms, e.g. Fact type: pilot can fly plane or Fact type: pilot is experienced - these somewhat map to fields and foreign keys in a relational database.
  • Rules - these define logical constraints on the data model and is the most powerful aspect of SBVR and Pine.js itself. Rules map loosely to constraints in a relational database, but extend them to constraints that can traverse tables and generally be far more powerful than a database constraint. E.g. Rule: It is obligatory that each pilot can fly at least 1 plane. The expressive capability of SBVR rules is much more than simple SQL DDL, and has the full power of First Order Logic.

In order to get an idea of how SBVR works, visit the sbvr lab, and for more details, check out the SBVR spec.

As part of the @balena/pinejs package the following tools are installed:

  • sbvr-compiler: Can be used to compile SBVR via the SBVR chain into SQL, eg npx sbvr-compiler test.sbvr
  • odata-compiler: Can be used to compile an OData URL via the OData chain from to SQL, eg npx odata-compiler test.sbvr /test

Both tools use some of the main dependencies of Pine.js:

  • abstract-sql-compiler
  • lf-to-abstract-sql
  • sbvr-parser
  • odata-parser
  • odata-to-abstract-sql

The above packages are written in OMeta and compiled into Javascript. The following resources consitute a good starting point in order for someone to get a better understanding of OMeta and the above dependencies:

The following papers are also helpful in understanding the main concept of Pine.js:

The documentation inside /docs folder also provide a great overview of the main concepts of Pine.js, in particular:

  • docs/Migrations.md: provides information regarding sql queries or Javascript functions that are executed prior to pinejs executing a given SBVR model.
  • docs/Hooks.md: functions that you can implement in order to execute custom code when API calls are requested.
  • docs/ProjectConfig.md: provides information regarding creating and configuring a project.
  • docs/Types.md: types definitions and declarations in various systems.
  • docs/sequence-diagrams/: provide a great overview of how the main processes are executed, including OData request parsing, response processing, etc. (The sequence diagrams can be depicted in websequencediagrams.com)

One can experiment with Pine.js, its main dependencies and the above tools inside the development environment of balena.

Where to go from here:

Start by creating your very first application with Pine.js. Jump to the Getting Started guide.

Storing files and other large objects

An application can choose between two types to save file content or another large object: File or WebResource. When using a File, PineJS saves the content in the database using a binary data type like BYTEA or BLOB. When using a WebResource, PineJS saves the binary content on an external storage service and then writes metadata, including the content public URL, to the database. Client apps use the WebResource href to get the content.

Please note that WebResource is still a work in progress and as such has a few limitations. Such as (but not exclusively):

  • Filtering for specific filenames or size
  • Deletion of a file may fail and will require to manually delete the file from its storage
19.5.2

2 months ago

19.5.1

2 months ago

19.5.4

2 months ago

19.5.3

2 months ago

19.4.3

2 months ago

19.4.4

2 months ago

19.5.0

2 months ago

19.4.1

2 months ago

19.4.2

2 months ago

19.3.0

2 months ago

19.1.0

2 months ago

19.4.0

2 months ago

19.2.0

2 months ago

19.0.3

3 months ago

19.0.5

3 months ago

19.0.4

3 months ago

19.0.7

2 months ago

19.0.6

3 months ago

18.1.5

4 months ago

18.1.4

4 months ago

18.1.3

4 months ago

18.1.2

4 months ago

18.2.9

3 months ago

18.2.8

3 months ago

18.2.7

3 months ago

19.0.1

3 months ago

18.2.6

3 months ago

19.0.0

3 months ago

18.2.5

3 months ago

18.2.4

3 months ago

19.0.2

3 months ago

18.2.3

4 months ago

18.2.2

4 months ago

18.2.1

4 months ago

18.2.0

4 months ago

18.2.10

3 months ago

17.3.2

5 months ago

17.3.4

5 months ago

17.3.3

5 months ago

17.3.5

5 months ago

18.1.1

4 months ago

18.1.0

4 months ago

15.5.0

11 months ago

17.1.2

6 months ago

17.1.1

6 months ago

17.1.4

6 months ago

17.1.3

6 months ago

17.1.0

6 months ago

17.1.6

6 months ago

17.1.5

6 months ago

15.3.33

1 year ago

15.3.32

1 year ago

15.3.31

1 year ago

15.3.30

1 year ago

15.3.19

1 year ago

15.3.18

1 year ago

15.3.17

1 year ago

15.3.29

1 year ago

15.3.26

1 year ago

15.3.25

1 year ago

15.3.28

1 year ago

15.3.27

1 year ago

15.3.22

1 year ago

15.3.21

1 year ago

15.3.24

1 year ago

15.3.23

1 year ago

15.3.20

1 year ago

16.1.7

7 months ago

16.1.6

8 months ago

16.1.1

9 months ago

16.1.0

9 months ago

16.1.5

8 months ago

16.1.4

8 months ago

16.1.3

8 months ago

16.1.2

8 months ago

18.0.2

4 months ago

18.0.1

4 months ago

18.0.0

5 months ago

15.6.1

11 months ago

15.6.0

11 months ago

15.6.3

10 months ago

15.6.2

11 months ago

17.2.1

6 months ago

17.2.0

6 months ago

15.4.1

12 months ago

15.4.0

12 months ago

15.4.3

11 months ago

15.4.2

12 months ago

15.4.5

11 months ago

15.4.4

11 months ago

17.0.3

6 months ago

17.0.2

6 months ago

17.0.1

6 months ago

17.0.0

7 months ago

16.0.2

9 months ago

16.0.1

9 months ago

16.0.0

10 months ago

15.3.15

1 year ago

15.3.14

1 year ago

15.3.16

1 year ago

15.3.11

1 year ago

15.3.10

1 year ago

15.3.13

1 year ago

15.3.12

1 year ago

15.3.0

1 year ago

15.3.2

1 year ago

15.3.1

1 year ago

15.3.4

1 year ago

15.3.3

1 year ago

15.3.6

1 year ago

15.3.5

1 year ago

15.3.8

1 year ago

15.3.7

1 year ago

15.3.9

1 year ago

15.1.1

1 year ago

15.1.0

1 year ago

15.0.5

1 year ago

15.2.0

1 year ago

15.2.1

1 year ago

15.0.4

1 year ago

15.0.3

2 years ago

15.0.2

2 years ago

15.0.0

2 years ago

15.0.1

2 years ago

14.64.0

2 years ago

14.64.1

2 years ago

14.62.8

2 years ago

14.62.7

2 years ago

14.62.9

2 years ago

14.62.6

2 years ago

14.63.0

2 years ago

14.62.0

2 years ago

14.62.2

2 years ago

14.62.1

2 years ago

14.62.4

2 years ago

14.62.3

2 years ago

14.62.5

2 years ago

14.61.1

2 years ago

14.61.3

2 years ago

14.61.2

2 years ago

14.61.5

2 years ago

14.61.4

2 years ago

14.57.2

2 years ago

14.57.1

2 years ago

14.57.0

2 years ago

14.59.0

2 years ago

14.59.1

2 years ago

14.55.0

2 years ago

14.60.0

2 years ago

14.60.1

2 years ago

14.58.0

2 years ago

14.54.5

2 years ago

14.54.7

2 years ago

14.54.6

2 years ago

14.54.8

2 years ago

14.56.0

2 years ago

14.61.0

2 years ago

14.54.4

2 years ago

14.54.1

2 years ago

14.54.0

2 years ago

14.54.3

2 years ago

14.54.2

2 years ago

14.53.6

2 years ago

14.53.5

2 years ago

14.53.0

2 years ago

14.53.2

2 years ago

14.53.1

2 years ago

14.53.4

2 years ago

14.53.3

2 years ago

14.52.1

2 years ago

14.52.0

2 years ago

14.52.2

2 years ago

14.51.8

2 years ago

14.51.7

2 years ago

14.51.2

2 years ago

14.51.1

2 years ago

14.51.4

2 years ago

14.51.3

2 years ago

14.51.6

2 years ago

14.51.5

2 years ago

14.50.0

2 years ago

14.51.0

2 years ago

14.49.2

2 years ago

14.49.5

2 years ago

14.49.6

2 years ago

14.46.1

2 years ago

14.46.0

3 years ago

14.45.1

3 years ago

14.45.0

3 years ago

14.48.0

2 years ago

14.47.1

2 years ago

14.47.0

2 years ago

14.47.3

2 years ago

14.47.2

2 years ago

14.47.5

2 years ago

14.47.4

2 years ago

14.47.6

2 years ago

14.44.0

3 years ago

14.43.6

3 years ago

14.49.1

2 years ago

14.49.0

2 years ago

14.43.4

3 years ago

14.43.5

3 years ago

14.43.2

3 years ago

14.43.3

3 years ago

14.43.0

3 years ago

14.43.1

3 years ago

14.42.0

3 years ago

14.42.1

3 years ago

14.42.2

3 years ago

14.41.0

3 years ago

14.41.1

3 years ago

14.41.2

3 years ago

14.40.1

3 years ago

14.40.2

3 years ago

14.40.0

3 years ago

14.39.2

3 years ago

14.35.1

3 years ago

14.37.1

3 years ago

14.37.2

3 years ago

14.37.0

3 years ago

14.36.0

3 years ago

14.36.1

3 years ago

14.39.0

3 years ago

14.39.1

3 years ago

14.38.0

3 years ago

14.38.1

3 years ago

14.38.2

3 years ago

14.38.3

3 years ago

14.35.0

3 years ago

14.34.2

3 years ago

14.34.0

3 years ago

14.34.1

3 years ago

14.33.3

3 years ago

14.33.2

3 years ago

14.31.2

3 years ago

14.33.1

3 years ago

14.33.0

3 years ago

14.32.0

3 years ago

14.31.0

3 years ago

14.31.1

3 years ago

14.30.4

3 years ago

14.30.1

3 years ago

14.30.2

3 years ago

14.30.3

3 years ago

14.30.0

3 years ago

14.29.1

3 years ago

14.29.0

3 years ago

14.27.2

3 years ago

14.28.0

3 years ago

14.27.0

3 years ago

14.27.1

3 years ago

14.26.2

3 years ago

14.26.3

3 years ago

14.25.2

3 years ago

14.26.1

3 years ago

14.26.0

3 years ago

14.25.0

3 years ago

14.25.1

3 years ago

14.24.6

3 years ago

14.24.4

3 years ago

14.24.5

3 years ago

14.24.3

3 years ago

14.24.2

3 years ago

14.24.1

4 years ago

14.23.0

4 years ago

14.22.3

4 years ago

14.24.0

4 years ago

14.22.2

4 years ago

14.22.1

4 years ago

14.22.0

4 years ago

14.21.1

4 years ago

14.21.0

4 years ago

14.20.1

4 years ago

14.20.0

4 years ago

14.19.0

4 years ago

14.18.3

4 years ago

14.18.4

4 years ago

14.18.2

4 years ago

14.18.1

4 years ago

14.18.0

4 years ago

14.17.1

4 years ago

14.17.0

4 years ago

14.16.1

4 years ago

14.16.0

4 years ago

14.15.0

4 years ago

14.14.3

4 years ago

14.14.2

4 years ago

14.14.1

4 years ago

14.14.0

4 years ago

14.13.0

4 years ago

14.12.2

4 years ago

14.12.1

4 years ago

14.12.0

4 years ago

14.11.0

4 years ago

14.10.2

4 years ago

14.10.1

4 years ago

14.10.0

4 years ago

14.9.5

4 years ago

14.9.4

4 years ago

14.9.3

4 years ago

14.9.2

4 years ago

14.9.1

4 years ago

14.9.0

4 years ago

14.7.2

4 years ago

14.7.1

4 years ago

14.8.0

4 years ago

14.7.0

4 years ago

14.5.0

4 years ago

14.6.0

4 years ago

14.4.0

4 years ago

14.3.0

4 years ago

14.2.5

4 years ago

14.2.6

4 years ago

14.2.4

4 years ago

14.2.3

4 years ago

14.2.2

4 years ago

14.2.1

4 years ago

14.2.0

4 years ago

14.1.1

4 years ago

14.1.0

4 years ago

14.0.0

4 years ago

13.13.9

4 years ago

13.13.8

4 years ago

13.13.6

4 years ago

13.13.7

4 years ago

13.13.5

4 years ago

13.13.4

4 years ago

13.13.1

4 years ago

13.13.2

4 years ago

13.13.3

4 years ago

13.13.0

4 years ago

13.12.2

4 years ago

13.12.1

4 years ago

13.12.0

4 years ago

13.11.3

4 years ago

13.11.2

4 years ago

13.11.1

4 years ago

13.11.0

4 years ago

13.10.1

4 years ago

13.10.0

4 years ago

13.9.1

4 years ago

13.9.0

4 years ago

13.8.1

4 years ago

13.8.0

4 years ago

13.7.0

4 years ago

13.6.1

4 years ago

13.6.0

4 years ago

13.5.0

4 years ago

13.4.2

4 years ago

13.4.1

4 years ago

13.4.0

4 years ago

13.3.0

4 years ago

13.2.1

4 years ago

13.2.0

4 years ago

13.0.2

4 years ago

13.1.0

4 years ago

13.0.1

5 years ago

13.0.0

5 years ago