lowdefy/packages/docs/operators/_uuid.yaml

115 lines
3.6 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/operators.yaml.njk
transformer: templates/operatorsMethodTransformer.js
vars:
pageId: _uuid
pageTitle: _uuid
filePath: operators/_uuid.yaml
description: |
The `_uuid` operator creates [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier). A UUID is a random identifier that is, for all practical purposes, unique. It looks like:
```
123e4567-e89b-12d3-a456-426614174000
```
types: |
```
(void): string
```
arguments: |
###### default:
`_uuid: true`, `_uuid: null` or `_uuid: undefined` returns a version 4 UUID.
examples: |
###### Generate a v4 uuid:
```yaml
_uuid: null
```
Returns: A version 4 UUID.
methods:
- name: v1
types: |
```
(void): string
```
description: |
Create a version 1 (timestamp) UUID.
arguments: |
The `_uuid.v1` method does not take any arguments.
examples: |
###### Generate a version 1 UUID:
```yaml
_uuid.v1: null
```
Returns: A version 1 UUID.
- name: v3
types: |
```
({name: string | string[], namespace: string | string[]}): string
([name: string | string[], namespace: string | string[]]): string
```
description: |
Create a version 3 (namespace w/ MD5) UUID.
arguments: |
###### object:
If the `_uuid` operator is called with arguments, it can be one of the following:
- `name: string | string[]`: A string or an array.
- `namespace: string | string[]`: A string or an Array[16] - Namespace UUID.
examples: |
###### Generate a version 3 UUID:
```yaml
_uuid.v3:
name: hello
namespace: world
```
Returns: A version 3 UUID.
- name: v4
types: |
```
(void): string
```
description: |
Create a version 4 (random) UUID.
arguments: |
The `_uuid.v4` method does not take any arguments.
examples: |
###### Generate a version 4 UUID:
```yaml
_uuid.v4: null
```
Returns: A version 4 UUID.
- name: v5
types: |
```
({name: string | string[], namespace: string | string[]}): string
([name: string | string[], namespace: string | string[]]): string
```
description: |
Create a version 5 (namespace w/ SHA-1) UUID.
arguments: |
###### object:
If the `_uuid` operator is called with arguments, it can be one of the following:
- `name: string | string[]`: A string or an array.
- `namespace: string | string[]`: A string or an Array[16] - Namespace UUID.
examples: |
###### Generate a version 5 UUID:
```yaml
_uuid.v5:
name: hello
namespace: world
```
Returns: A version 5 UUID.