lowdefy/packages/docs/concepts/operators.yaml

67 lines
3.2 KiB
YAML

# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/general.yaml.njk
vars:
pageId: operators
pageTitle: Operators
section: Concepts
filePath: concepts/operators.yaml
content:
- id: md1
type: Markdown
properties:
content: |
Operators are functions, that can be used to express logic. They are the reason why Lowdefy apps are not completely static, but can react to data and inputs. Operators can be used in `blocks`, `actions`, `requests`, and `connections`. See the specific documentation for more details.
Each operators expects arguments with a specific structure. They can be the result of other operators, since operators are evaluated beginning with the most nested operators.
If an operator errors while evaluating, it returns a `null` value, and logs the error to the console.
## Client or server operators
Some operators are only available on either the client or the server. For example, the [`_menu`](/_menu) operator is only useful on the client and is thus not included in server requests. Likewise, the [`_secret`](/_secret) operator is only available on the server for security reasons.
If a operator has special environment considerations, it is indicated on the individual operator documentation page. If no indication is made, the operator can be used under both environments.
##### Client only operators:
- [_actions](/_actions)
- [_format](/_format)
- [_js](/_js)
- [_list_contexts](/_list_contexts)
- [_media](/_media)
- [_menu](/_menu)
- [_request](/_request)
##### Server only operators:
- [_diff](/_diff)
- [_secret](/_secret)
- [_uuid](/_uuid)
Operators that are client side only cannot be used in `Requests` and `Connections`, and operators which are server side only cannot be used in `Blocks` and `Actions`.
## Build time operators
Besides the client and server environment, app build time is considered a third environment where special operator logic applies.
The `_ref` and `_var` operators do not work like other operators. They are evaluated while an app is being built, and can thus be used anywhere in the app configuration. They are used to split a app into multiple files, and to reuse configuration. See [`_ref`](/_ref) for more details.
- _ref:
path: templates/navigation_buttons.yaml
vars:
previous_page_title: Events and Actions
previous_page_id: events-and-actions
next_page_title: Secrets
next_page_id: secrets