Inputinterfaceno test imports itinterface InputAn input: its type, and whether it may be left out.
| Member | Type | What it is |
|---|---|---|
type | InputType | |
optional? | boolean |
Operations (commons data 0031-operations): the business operations of a model as contracts. A contract says what an operation is for, what it takes, what it reads and writes (concepts of the domain), what permission it needs, what it records in the audit trail and whether it runs as its caller or as the service; it holds no SQL and names no database. A lint holds contracts to the domain they are for. How an operation is done, and run, is an extension's (sql/extensions/operations).
Inputinterfaceno test imports itinterface InputAn input: its type, and whether it may be left out.
| Member | Type | What it is |
|---|---|---|
type | InputType | |
optional? | boolean |
InputTypetypeno test imports ittype InputType = "text" | "integer" | "number" | "boolean" | "instant" | "textList";The type of an input of an operation.
lintOperationsfunctionfunction lintOperations(d: Domain, operations: readonly Operation[]): readonly Finding[]The findings of operations against the domain they are for.
| Parameter | What it is |
|---|---|
d | the domain |
operations | the operations |
Returns: the findings: a concept that is not there, a query that writes, a permission or an audit action that is not of its form, a command that writes a restricted concept and runs as its caller, a scope that is not an input, a duplicate name, and a command that writes and records nothing
operationfunctionfunction operation(name: string, spec: OperationSpec): OperationAn operation.
| Parameter | What it is |
|---|---|
name | its name, in lower camel case |
spec | its contract |
Returns: the operation, frozen
Operationinterfaceno test imports itinterface OperationAn operation.
| Member | Type | What it is |
|---|---|---|
kind | "operation" | |
name | string | |
spec | Required<Omit<OperationSpec, "checkedBy" | "public" | "requires" | "scope" | "serves">> & Pick<OperationSpec, "checkedBy" | "public" | "requires" | "scope" | "serves"> | |
input | Readonly<Record<string, Required<Input>>> | Its inputs, each with its type and whether it is optional. |
OperationRuletypeno test imports ittype OperationRule = "operation/unknown-concept" | "operation/query-writes" | "operation/permission-form" | "operation/emit-form" | "operation/restricted-as-caller" | "operation/duplicate" | "operation/scope-unknown" | "operation/command-silent" | "operation/no-permission" | "operation/access-ambiguous";What the lint holds an operation to.
OperationSpecinterfaceno test imports itinterface OperationSpecWhat a project says of an operation.
| Member | Type | What it is |
|---|---|---|
definition | string | |
kind | "command" | "query" | A command changes the database; a query only reads it. |
input | Readonly<Record<string, Input | InputType>> | |
reads | readonly string[] | The concepts it reads, by name. |
writes? | readonly string[] | The concepts it writes, by name; a query writes none. |
requires? | string | The permission the caller must hold, as resource:action. |
public? | boolean | Says that anyone may call it, with no permission. |
checkedBy? | string | Says what its implementation checks to decide who may call it, where that is more than a permission (for example, that the caller is the one the input names): in words. A contract has exactly one of requires, public and checkedBy (0031-operations FR-009). |
scope? | string | The input that holds the tenant the permission is held in. |
emits? | readonly string[] | What it records in the audit trail, each as subject.verb; a command that records none says so by leaving this empty. |
runsAs | "caller" | "service" | Whether it runs as the caller, with the caller's rights, or as the service, with its own. |
idempotent | boolean | Whether doing it twice with the same input leaves the same state. |
serves? | string | The requirement it serves, as text. |