0.6.6 • Published 2 years ago

@anticrm/platform v0.6.6

Weekly downloads
1
License
EPL-2.0
Repository
-
Last release
2 years ago

The Platform

Antierp Platform built around a few simple concepts:

  • Platform Object -- a piece of information, typically persisted by the platform in a database. May refer another platform object and Resources
  • Resource -- something we can't persist in the database (e.g. JavaScript function, or "mailing service"), but want to refer from a Platform Object.
  • Plugin -- piece of code, which provide Resources to the platform, and code to deal with Platform Objects.

Any Platform application is nothing but a bunch of installed plugins. At the very core Platform is a simple piece of code, which connects plugins together and route resource requests.

Platform Objects

Platform Objects utilize classical object-oriented model, so every platform object belongs to a particualar class. A Class may extend another class, and implement a number of interfaces. Interface may extend another interface as well. There is also concept of Mixin, which we'll describe later.

Class Diagram

There are no instances of Obj, Doc, Class... and other classes in the hierarchy exists. Those are abstract classes describing models. Platform instantiate derived classes, which are either Layout<Obj> or Instance<Obj>.

LayoutObjInstance
RefRef (string)Ref
LayoutTypeProperty (T)T
ResourceResource (string)T

Resources

Resource can be anything meaningful: an object in extrnal database, Vue component, an asset URL, etc. For any resource there is a known plugin, which can resolve resource identifier into actual meaningful object.

Plugin is an isolated piece of software, and a plugin never directly import stuff from other plugins (in sense of JavaScript import statement). Every plugin provide Resources via Platform runtime. Resource accessible via PRI (Platform Resource Identifier).

Why Resources?

Platform persists Platform Objects in the database. Platform objects uniquely identified and belongs to a Class. Any platform object may have properties, which can be:

  • A reference to another platform object
  • Embedded object (structure)
  • Value of some type (including user-defined type)
  • Resource

Resources play significant role in platform object persistence. Consider we have a property which refer to something we can't persist in the database (something which live in runtime only, e.g. JavaScript function instance). So we can provide this function as Resource with method:myplugin.Method PRI. So myplugin will be responsible to provide the function at runtime. Plaform will wire things together: platform object's property of Resource type with actual function provided under method:myplugin.Method PRI.

Examples of Resource:

// database object with id === `class:contact.Person`
`class:contact.Person` as Resource<Class<Person>>
// translated string according to current i18n settings
`string:class.ClassLabel` as Resource<string> 
// URL to SVG sprites
`asset:ui.Icons` as Resource<URL> 
// Vue component for Person Form
`component:client.PersonForm` as Resource<Component<VueComp>> 
`easyscript:2+2` as Resource<() => number> // function
`object:5679fd5a459245ccb435` as Resource<Doc> // db object

Plugins loaded asynchonously, on-demand thus everything in the Platform wired together via asynchronous communications. A Plugin itself is also a Platform Resource, so you can request access to a plugin's API using same approach.

Plugins

Following is a plugin package structure. It is not a mandatory, but the stucture I tend to use now.

__tests__
__model__
  model.ts
  meta.ts
  strings/*.ts
index.ts // A Plugin's API
plugin.ts // plugin entry point
*.ts  // implementation-related stuff

Plugin API defined in index.ts. It should not export any code (including internal) and should not have any side effects. Only API and plugin's PRIs.

Basically, if a plugin depends on another, importing dependant's index.ts must be sufficient to start communicating with a plugin.

A plugin.ts available to Platform only. So you should never import anything from another plugin besides index.ts.

Runtime code not allowed to import anything from __model__ folder. This is solely for tooling/configuration purposes, and does not exists at runtime.

@infinitebrahmanuniverse/nolb-_anti@everything-registry/sub-chunk-70@anticrm/account@anticrm/activity@anticrm/activity-assets@anticrm/activity-resources@anticrm/app-mission-control@anticrm/tags@anticrm/task@anticrm/task-assets@anticrm/task-resources@anticrm/telegram@anticrm/ui@anticrm/upload@anticrm/view@anticrm/view-assets@anticrm/view-resources@anticrm/workbench@anticrm/workbench-impl@anticrm/workbench-resources@anticrm/chunter-resources@anticrm/client@anticrm/client-resources@anticrm/demo-3d@anticrm/dev-account@anticrm/dev-client-resources@anticrm/dev-server@anticrm/dev-server-chunter-resources@anticrm/dev-storage@anticrm/elastic@anticrm/front@anticrm/gmail@anticrm/login@anticrm/login-assets@anticrm/login-resources@anticrm/memdb@anticrm/model@anticrm/model-activity@anticrm/model-chunter@anticrm/model-contact@anticrm/model-core@anticrm/model-demo@anticrm/model-recruit@anticrm/app-storybook@anticrm/attachment@anticrm/chunter@anticrm/chunter-assets@anticrm/contact@anticrm/contact-assets@anticrm/contact-resources@anticrm/contrib@anticrm/core@anticrm/server-core@anticrm/server-recruit@anticrm/server-recruit-resources@anticrm/server-view@anticrm/server-view-resources@anticrm/server-ws@anticrm/setting@anticrm/server-chunter@anticrm/server-chunter-resources@anticrm/model-server-chunter@anticrm/model-server-core@anticrm/model-server-recruit@anticrm/model-server-view@anticrm/model-task@anticrm/model-view@anticrm/model-workbench@anticrm/mongo@anticrm/notification@anticrm/panel@anticrm/platform-core@anticrm/platform-rpc@anticrm/platform-ui@anticrm/platform-vue@anticrm/presentation@anticrm/query@anticrm/recruit@anticrm/recruit-assets@anticrm/recruit-resources@anticrm/server@zalastax/nolb-_anti
0.6.6

2 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.4.2

3 years ago

0.4.0

3 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.0-dev.29

4 years ago

0.1.0-dev.28

4 years ago

0.1.0-dev.27

4 years ago

0.1.0-dev.26

4 years ago

0.1.0-dev.24

4 years ago

0.1.0-dev.25

4 years ago

0.1.0-dev.20

4 years ago

0.1.0-dev.23

4 years ago

0.1.0-dev.22

4 years ago

0.1.0-dev.21

4 years ago

0.1.0-dev.17

4 years ago

0.1.0-dev.19

4 years ago

0.1.0-dev.18

4 years ago

0.1.0-dev.16

4 years ago

0.1.0-dev.7

4 years ago

0.1.0-dev.12

4 years ago

0.1.0-dev.11

4 years ago

0.1.0-dev.15

4 years ago

0.1.0-dev.14

4 years ago

0.1.0-dev.5

4 years ago

0.1.0-dev.3

4 years ago

0.1.0-dev.4

4 years ago

0.1.0-dev.2

4 years ago

0.1.0-dev.1

4 years ago

0.1.0

4 years ago