Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions 0-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Sealious is a declarative, resource-oriented framework for creating application
When creating a Sealious application, the developer has to focus on the "what" of the application, not the "how". Consider the following Sealious resource-type declaration:

```javascript
var Person = new Sealious.ResourceType({
var Person = new Sealious.Collection({
name: "people",
fields: [
{name: "full-name", type: "text", required: true},
Expand Down Expand Up @@ -73,7 +73,7 @@ Sealious uses `npm` as a way to distribute it's modules. To distinguish them fro
Sealious plugins contain one or more "chips". Chips are small entities that contain a singular purpose. Every chip is one of these types:

* Channel
* ResourceType
* Collection
* FieldType
* AccessStrategyType
* Datastore
Expand Down Expand Up @@ -200,7 +200,7 @@ digraph lifespan{

subgraph clusterResourceTypeCreate {
style="dashed";
label="ResourceTypePerson:create";
label="PersonCollection:create";
validate_values [label="Validate all values\n(iterate through FieldTypes)", style=filled];
check_access [label="check access\n(via AccessStrategy)", style=filled];
check_missing [label="check if any required\nfields are missing"];
Expand Down
24 changes: 13 additions & 11 deletions 1-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type Params: Object<String, Any>;
params: <a href="#generic-types">Params</a>,
value_in_db: Any
) =&gt; Promise&lt;decoded_value: Any&gt; & Any,
extends?: <a href="#fieldtype">FieldType</a>
extends?: <a href="#fieldtype">FieldType</a>,
has_index?: (params: Any) => false | index_type: String | Promise&lt;false | index_type: String&gt;
} | FieldTypeName
</code>
</pre>
Expand All @@ -53,6 +54,7 @@ type Params: Object<String, Any>;
* `encode`: **optional**. Takes the value for a field from client's input and transforms it into something else. The result of calling that function for the client's input is what will be stored in the database.
* `decode`: **optional**. A function reverse to `encode`. If declared, the value in the database will be run through that function before being returned to the client.
* `extends`: **optional**. Must be a proper `FieldType` declaration. When specified, the field-type being declared will inherit behavior from the type it is extending. All specified methods will obscure the parent's methods. The unspecified will be inherited.
* `has_index`: **optional**. Whether or not to instruct the Datastore to create an index on that field. In order to include the contents of the fields of this type in full-text-search, return "text" here.

* Usage

Expand Down Expand Up @@ -98,7 +100,7 @@ type Params: Object<String, Any>;

### Field

Fields are the most important part of a ResourceType. They describe it's behavior and structure.
Fields are the most important part of a Collection. They describe it's behavior and structure.

* Syntax

Expand All @@ -114,13 +116,13 @@ Fields are the most important part of a ResourceType. They describe it's behavio
* Explanation

* `type`: required. A FieldType declaration. It's more comfortable to use the "short" FieldType notation here (that is: just entering the name of the registered FieldType).
* `name`: the name of the field. Has to be unique within the ResourceType.
* `name`: the name of the field. Has to be unique within the Collection.
* `required`: **optional**. Defaults to `false`. If set to `true`, Sealious won't allow modifications of the resource that would result in removing a value from that field.
* `params`: **optional**. A set of parameters that configure the behavior of the FieldType for that particular field.

* Usage

Use it when describing a [ResourceType](#resourcetype).
Use it when describing a [Collection](#collection).

* Example

Expand All @@ -130,7 +132,7 @@ Fields are the most important part of a ResourceType. They describe it's behavio

### AccessStrategyType

AccessStrategyType describes a type of an access strategy that can be parametrized, instantiated, and, for example, assigned to a ResourceType.
AccessStrategyType describes a type of an access strategy that can be parametrized, instantiated, and, for example, assigned to a Collection.

* Syntax

Expand Down Expand Up @@ -205,7 +207,7 @@ AccessStrategyType describes a type of an access strategy that can be parametriz

* Usage

Currently this declaration is only being used when describing access strategies to resource actions in [ResourceType](#resourcetype) declaration.
Currently this declaration is only being used when describing access strategies to resource actions in [Collection](#collection) declaration.

* Examples

Expand All @@ -225,15 +227,15 @@ AccessStrategyType describes a type of an access strategy that can be parametriz

* Usage

It does not have it's own constructor, as it doesn't do anything by itself. It can be used when describing access strategies in [ResourceType](#resourcetype) declaration.
It does not have it's own constructor, as it doesn't do anything by itself. It can be used when describing access strategies in [Collection](#collection) declaration.

### ResourceType
### Collection

* Syntax

<div class="wide">
<pre>
<code>type ResourceType: {
<code>type Collection: {
name: String,
fields: Array&lt;<a href="#field">Field</a>&gt;,
access_strategy: <a href="#accessstrategy">AccessStrategy</a> | Object&lt;<a href="#resourceactionname">ResourceActionName</a>, <a href="#accessstrategy">AccessStrategy</a>&gt;
Expand All @@ -250,10 +252,10 @@ AccessStrategyType describes a type of an access strategy that can be parametriz

* Usage

To create a new ResourceType, call the `ResourceType` constructor:
To create a new Collection, call the `Collection` constructor:

```javascript
var Person = new Sealious.ResourceType({
var Person = new Sealious.Collection({
name: "person",
fields: //...
});
Expand Down
6 changes: 3 additions & 3 deletions 2-base-chips.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Resolves only if the provided Context is an instance of SuperContext.

Resolves only if the `user_id` in the `context` argument matches the `id` attribute of the `item` argument.

Useful for creating access strategies for the `User` ResourceType.
Useful for creating access strategies for the `User` Collection.

* Sensitivity

Expand Down Expand Up @@ -423,11 +423,11 @@ Can reference any other resource.

```javascript
type single_reference_params: {
resource_type: ResourceTypeName
collection: CollectionDeclaration
}
```

* `resource_type`: **required**. Only references to resources of that particular type will be accepted.
* `collection`: **required**. Only references to resources of that particular type will be accepted.

* **sensitivity**

Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Table of Contents
- [AccessStrategyType](#accessstrategytype-1)
- [AccessStrategy](#accessstrategy)
- [ResourceActionName](#resourceactionname)
- [ResourceType](#resourcetype)
- [Collection](#collection)
- [Base Chips](#base-chips)
- [Access Strategy Types](#access-strategy-types)
- [and](#and)
Expand Down Expand Up @@ -73,7 +73,7 @@ Sealious is a declarative, resource-oriented framework for creating application
When creating a Sealious application, the developer has to focus on the "what" of the application, not the "how". Consider the following Sealious resource-type declaration:

``` javascript
var Person = new Sealious.ResourceType({
var Person = new Sealious.Collection({
name: "people",
fields: [
{name: "full-name", type: "text", required: true},
Expand Down Expand Up @@ -106,7 +106,7 @@ Sealious uses `npm` as a way to distribute it's modules. To distinguish them fro
Sealious plugins contain one or more "chips". Chips are small entities that contain a singular purpose. Every chip is one of these types:

- Channel
- ResourceType
- Collection
- FieldType
- AccessStrategyType
- Datastore
Expand Down Expand Up @@ -195,7 +195,7 @@ Assume the following client input:

The exact syntax of a call can be different for each Channel, but essentially it always has to contain the information presented above. The differences between call syntax for Sealious Channels does not fit inside the scope of this reference.

![](graphviz-images/4ed5f199fd1cfab80ae0df0518fb2296.png)
![](graphviz-images/76b1670cffb07b9196b91cc9ca8cbc9b.png)

The darker nodes represent functions that are context-sensitive.

Expand Down Expand Up @@ -292,7 +292,7 @@ Creating a Sealious application consists mainly of composing various declaration

### Field

Fields are the most important part of a ResourceType. They describe it's behavior and structure.
Fields are the most important part of a Collection. They describe it's behavior and structure.

- Syntax

Expand All @@ -308,12 +308,12 @@ Fields are the most important part of a ResourceType. They describe it's behavio
- Explanation

- `type`: required. A FieldType declaration. It's more comfortable to use the "short" FieldType notation here (that is: just entering the name of the registered FieldType).
- `name`: the name of the field. Has to be unique within the ResourceType.
- `name`: the name of the field. Has to be unique within the Collection.
- `required`: **optional**. Defaults to `false`. If set to `true`, Sealious won't allow modifications of the resource that would result in removing a value from that field.
- `params`: **optional**. A set of parameters that configure the behavior of the FieldType for that particular field.
- Usage

Use it when describing a [ResourceType](#resourcetype).
Use it when describing a [Collection](#collection).

- Example

Expand All @@ -323,7 +323,7 @@ Fields are the most important part of a ResourceType. They describe it's behavio

### AccessStrategyType

AccessStrategyType describes a type of an access strategy that can be parametrized, instantiated, and, for example, assigned to a ResourceType.
AccessStrategyType describes a type of an access strategy that can be parametrized, instantiated, and, for example, assigned to a Collection.

- Syntax

Expand Down Expand Up @@ -397,7 +397,7 @@ AccessStrategyType describes a type of an access strategy that can be parametriz

- Usage

Currently this declaration is only being used when describing access strategies to resource actions in [ResourceType](#resourcetype) declaration.
Currently this declaration is only being used when describing access strategies to resource actions in [Collection](#collection) declaration.

- Examples

Expand All @@ -413,14 +413,14 @@ AccessStrategyType describes a type of an access strategy that can be parametriz

- Usage

It does not have it's own constructor, as it doesn't do anything by itself. It can be used when describing access strategies in [ResourceType](#resourcetype) declaration.
It does not have it's own constructor, as it doesn't do anything by itself. It can be used when describing access strategies in [Collection](#collection) declaration.

### ResourceType
### Collection

- Syntax

<pre>
<code>type ResourceType: {
<code>type Collection: {
name: String,
fields: Array&lt;<a href="#field">Field</a>&gt;,
access_strategy: <a href="#accessstrategy">AccessStrategy</a> | Object&lt;<a href="#resourceactionname">ResourceActionName</a>, <a href="#accessstrategy">AccessStrategy</a>&gt;
Expand All @@ -436,10 +436,10 @@ AccessStrategyType describes a type of an access strategy that can be parametriz
- `access_strategy`: **required**. Describes what access strategies will be used for granting access to calling various resource actions. When a single [AccessStrategy](#accessstrategy) is specified, it will be used for all of the actions. If the `Object<ResourceActionName, AccessStrategy>` notation is being used, then each action can have a different access\_strategy assigned. If an action does not have an AccessStrategy assigned, it will use the `default` one.
- Usage

To create a new ResourceType, call the `ResourceType` constructor:
To create a new Collection, call the `Collection` constructor:

``` javascript
var Person = new Sealious.ResourceType({
var Person = new Sealious.Collection({
name: "person",
fields: //...
});
Expand Down Expand Up @@ -627,7 +627,7 @@ Resolves only if the provided Context is an instance of SuperContext.

Resolves only if the `user_id` in the `context` argument matches the `id` attribute of the `item` argument.

Useful for creating access strategies for the `User` ResourceType.
Useful for creating access strategies for the `User` Collection.

- Sensitivity

Expand Down Expand Up @@ -879,11 +879,11 @@ Can reference any other resource.

``` javascript
type single_reference_params: {
resource_type: ResourceTypeName
collection: CollectionDeclaration
}
```

- `resource_type`: **required**. Only references to resources of that particular type will be accepted.
- `collection`: **required**. Only references to resources of that particular type will be accepted.
- **sensitivity**

The behavior of this resource type depends on `context`, `params` and `value`.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.