Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .copier-answers.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changes here will be overwritten by Copier
project_slug=uuid
package_dir=cmem_plugin_uuid

5 changes: 3 additions & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Changes here will be overwritten by Copier
_commit: v6.3.1
_commit: v7.1.0
_src_path: gh:eccenca/cmem-plugin-template
author_mail: cmempy-developer@eccenca.com
author_name: eccenca GmbH
github_page: https://github.com/eccenca/cmem-plugin-uuid
project_description: Create universally unique identifiers (UUIDs) versions 1, 3,
4, 5, 6, 7 and 8 in transformations.
project_slug: uuid
pypi: false
project_type: plugin
pypi: true

4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1
uses: arduino/setup-task@v2

- name: Set up python
id: setup-python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
default:
image: docker-registry.eccenca.com/eccenca-python:v3.11.4
image: docker-registry.eccenca.com/eccenca-python:v3.11.9-2
# all jobs can be interrupted in case a new commit is pushed
interruptible: true
before_script:
Expand Down
2 changes: 1 addition & 1 deletion .idea/cmem-plugin-uuid.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .tasks-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://taskfile.dev
---
version: '3'

tasks:

install:
desc: Install plugin package in Corporate Memory
cmds:
- task build
- poetry run cmemc admin workspace python install dist/cmem_plugin_uuid*.tar.gz
- poetry run cmemc admin workspace python list-plugins

uninstall:
desc: Unnstall plugin package in Corporate Memory
cmds:
- task build
- poetry run cmemc admin workspace python uninstall cmem-plugin-uuid
- poetry run cmemc admin workspace python list-plugins
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/)


## [1.1.0] 2025-02-13

### Changed

- Update template to 7.1.0
- Output empty value instead of throwing an error if no input is given for plugins that need an input value


## [1.0.0] 2024-02-12

### Added
Expand Down
23 changes: 20 additions & 3 deletions README-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,28 @@

Create universally unique identifiers (UUIDs) versions 1, 3, 4, 5, 6, 7 and 8 in transformations.

## Installation

`cmemc -c my-cmem admin workspace python install cmem-plugin-uuid`
[![eccenca Corporate Memory][cmem-shield]][cmem-link]

This is a plugin for [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com). You can install it with the [cmemc](https://eccenca.com/go/cmemc) command line clients like this:

```
cmemc admin workspace python install cmem-plugin-uuid
```
[![workflow](https://github.com/eccenca/cmem-plugin-uuid/actions/workflows/check.yml/badge.svg)](https://github.com/eccenca/cmem-plugin-uuid/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-uuid)](https://pypi.org/project/cmem-plugin-uuid) [![license](https://img.shields.io/pypi/l/cmem-plugin-uuid)](https://pypi.org/project/cmem-plugin-uuid)
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]

[cmem-link]: https://documentation.eccenca.com
[cmem-shield]: https://img.shields.io/endpoint?url=https://dev.documentation.eccenca.com/badge.json
[poetry-link]: https://python-poetry.org/
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
[ruff-link]: https://docs.astral.sh/ruff/
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
[mypy-link]: https://mypy-lang.org/
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
[copier]: https://copier.readthedocs.io/
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json

## UUID1

UUID1 version is generated from a host ID, sequence number, and the current time.

Expand Down
226 changes: 12 additions & 214 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,228 +2,26 @@

Create universally unique identifiers (UUIDs) versions 1, 3, 4, 5, 6, 7 and 8 in transformations.

[![eccenca Corporate Memory](https://img.shields.io/badge/eccenca-Corporate%20Memory-orange)](https://documentation.eccenca.com) [![workflow](https://github.com/eccenca/cmem-plugin-uuid/actions/workflows/check.yml/badge.svg)](https://github.com/eccenca/cmem-plugin-uuid/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-uuid)](https://pypi.org/project/uuid) [![license](https://img.shields.io/pypi/l/cmem-plugin-uuid)](https://pypi.org/project/cmem-plugin-uuid)

## Installation
[![eccenca Corporate Memory][cmem-shield]][cmem-link][![workflow](https://github.com/eccenca/cmem-plugin-uuid/actions/workflows/check.yml/badge.svg)](https://github.com/eccenca/cmem-plugin-uuid/actions) [![pypi version](https://img.shields.io/pypi/v/cmem-plugin-uuid)](https://pypi.org/project/cmem-plugin-uuid) [![license](https://img.shields.io/pypi/l/cmem-plugin-uuid)](https://pypi.org/project/cmem-plugin-uuid)
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]

`cmemc -c my-cmem admin workspace python install cmem-plugin-uuid`

## Development

- Run [task](https://taskfile.dev/) to see all major development tasks.
- Use [pre-commit](https://pre-commit.com/) to avoid errors before commit.
- This repository was created with [this copier template](https://github.com/eccenca/cmem-plugin-template).

## UUID1

UUID1 version is generated from a host ID, sequence number, and the current time.
[cmem-link]: https://documentation.eccenca.com
[cmem-shield]: https://img.shields.io/endpoint?url=https://dev.documentation.eccenca.com/badge.json
[poetry-link]: https://python-poetry.org/
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
[ruff-link]: https://docs.astral.sh/ruff/
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
[mypy-link]: https://mypy-lang.org/
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
[copier]: https://copier.readthedocs.io/
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json

### Parameters

#### Node

Node value in the form "01:23:45:67:89:AB", "01-23-45-67-89-AB", or "0123456789AB".
If not given, [`uuid.getnode()`](https://docs.python.org/3/library/uuid.html#uuid.getnode) is used to
attempt to obtain the hardware address. If this is unsuccessful a random 48-bit number is chosen.

Default value: _None_
ID: `node`

#### Clock sequence

If clock sequence is given, it is used as the sequence number, otherwise a random 14-bit sequence number is chosen.

Default value: _None_
ID: `clock_seq`

<br>

## UUID3

UUID version 3 is a reproducible UUID based on the MD5 hash of a namespace identifier (which is a UUID) and a name
(which is a string).


### Parameters

#### Namespace

The namespace can be entered manually or selected from the namespace UUIDs defined in
[RFC 4122](https://www.rfc-editor.org/rfc/rfc4122):

- Namespace DNS: 6ba7b810-9dad-11d1-80b4-00c04fd430c8 (*namespace_dns*)
- Namespace URL: 6ba7b811-9dad-11d1-80b4-00c04fd430c8 (*namespace_url*)
- Namespace OID: 6ba7b812-9dad-11d1-80b4-00c04fd430c8 (*namespace_oid*)
- Namespace X500: 6ba7b814-9dad-11d1-80b4-00c04fd430c8 (*namespace_x500*)

If none of the predefined namespace UUIDs is selected, the input namespace is either directly
interpreted as a UUID, or used to derive a UUID (see parameter _Namespace as UUID_). If no namespace is given,
the output is the same as that of the standard CMEM UUID operator with input value.

Default value: _none_
ID: `namespace`

#### Use input as namespace

If enabled, the input value is used for the namespace.

Default value: _False_
ID: `input_as_namespace`

#### Namespace as UUID

Applies only if none of the pre-defined namespaces is selected. If enabled, the namespace string
needs to be a valid UUID. Otherwise, the namespace UUID is a UUIDv1 derived from the MD5
hash of the namespace string.

Default value: _False_
ID: `namespace_as_uuid`

<br>


## UUID4

UUID version 4 specifies a random UUID. This plugin is equivalent to the standard CMEM UUID operator without input value.

<br>


## UUID5

UUID version 5 is a reproducible UUID based on the SHA1 hash of a namespace identifier (which is a UUID) and a
name (which is a string).

### Parameters

#### Namespace

The namespace can be entered manually or selected from the namespace UUIDs defined in
[RFC 4122](https://www.rfc-editor.org/rfc/rfc4122):

- Namespace DNS: 6ba7b810-9dad-11d1-80b4-00c04fd430c8 (*namespace_dns*)
- Namespace URL: 6ba7b811-9dad-11d1-80b4-00c04fd430c8 (*namespace_url*)
- Namespace OID: 6ba7b812-9dad-11d1-80b4-00c04fd430c8 (*namespace_oid*)
- Namespace X500: 6ba7b814-9dad-11d1-80b4-00c04fd430c8 (*namespace_x500*)

If none of the predefined namespace UUIDs is selected, the input namespace is either directly
interpreted as a UUID, or used to derive a UUID (see parameter _Namespace as UUID_).

Default value: _none_
ID: `namespace`

#### Namespace as UUID

Applies only if none of the pre-defined namespaces is selected. If enabled, the namespace string
needs to be a valid UUID. Otherwise, the namespace UUID is a UUIDv1 derived from the SHA1
hash of the namespace string.

Default value: _False_
ID: `namespace_as_uuid`

<br>

## UUID6

UUID6 version is generated from a host ID, sequence number, and the current time.
UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality.

### Parameters

#### Node

Node value in the form "01:23:45:67:89:AB", "01-23-45-67-89-AB", or "0123456789AB".
If not given, a random 48-bit sequence number is chosen.

Default value: _None_
ID: `node`

#### Clock sequence

If clock sequence is given, it is used as the sequence number, otherwise a random 14-bit number is chosen.

Default value: _None_
ID: `clock_seq`

<br>

## UUID7

UUID version 7 features a time-ordered value field derived from the
widely implemented and well known Unix Epoch timestamp source, the
number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds
excluded, as well as improved entropy characteristics over versions
1 or 6.

<br>

## UUID8

UUID version 8 features a time-ordered value field derived from the
widely implemented and well known Unix Epoch timestamp source, the
number of nanoseconds since midnight 1 Jan 1970 UTC, leap seconds
excluded.

<br>

## UUID1 to UUID6

Generate a UUID version 6 from a UUID version 1. The input needs to be a valid UUIDv1
hexdecimal string.

<br>

## UUID Version

Outputs the UUID version from a UUID input string.

<br>

## UUID Convert

Convert a UUID from one format to another. The plugin accepts strings in the correct format, however, the log will show
a warning if the input does not comply with the standard specified in [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122) and the
[proposed updates](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html).

### Parameters

#### From

The input format

Options:

- **UUID/32-character hexadecimal string** (*uuid_hex*):

A standard UUID or a UUID as a 32-character lowercase hexadecimal string.
- **128-bit integer** (_int_):

The UUID as a 128-bit integer.
- **URN** (_urn_):

The UUID as a URN.

Default value: _UUID/32-character lowercase hexadecimal string_
ID: `from_format`

#### To

The output format

Options:

- **UUID** (_uuid_):

A standard UUID.
- **32-character lowercase hexadecimal string** (_hex_):

The UUID as a 32-character lowercase hexadecimal string.
- **128-bit integer** (_int_):

The UUID as a 128-bit integer.
- **URN** (_urn_):

The UUID as a URN as specified in [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122).

Default value: _32-character lowercase hexadecimal string_
ID: `to_format`
Loading