new Versionned(id, version, label)
Supertype of every class that has UUID identity, version numbers and labels.
Methods are designed to be mixed in piecemeal as required.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | Globally unique UUID identifier for the resource. |
version |
string | String formatted PTP timestamp (<seconds>:<nanoseconds>) indicating precisely when an attribute of the resource last changed. |
label |
string | Freeform string label for the resource. |
- Source:
Members
(readonly) id :string
Globally unique UUID identifier for the resource.
Type:
- string
- Source:
(readonly) label :string
Freeform string label for the resource.
Type:
- string
- Source:
(readonly) version :string
String formatted PTP timestamp (<seconds>:<nanoseconds>)
indicating precisely when an attribute of the resource last changed.
Type:
- string
- Source:
Methods
generateID(idopt) → {string}
Generate an identifier when one is not provided,
otherwise pass this one through. No validation takes place.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
id |
string |
<optional> |
Identifier to pass through. |
- Source:
Returns:
Value passed to the method or a generated pseudo-random
UUID for no arguments, null or undefined.
- Type
- string
generateLabel(labelopt) → {string}
Generate a label when one is not provided, otherwise
pass the given one through. No validation takes place.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
label |
string |
<optional> |
Label to pass through. |
- Source:
Returns:
Value passed to the method or an empty string for
no arguments, null or undefined.
- Type
- string
generateVersion(versionopt) → {string}
Generate a version number when one is not provided,
otherwise pass the given one through. No validation takes place.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
version |
string |
<optional> |
Version number to pass through. |
- Source:
Returns:
Value passed to the method or a generated version
number from the current clock with no arguments,
null or undefined.
- Type
- string
valid() → {boolean}
Checks that all the properties of this resource are valid. The is a syntactic
check and does not check semantics such as references to other objects can be
checked. Valid includes:
- Required properties are defined and not null.
- Identifiers a valid UUIDs.
- Enumerations are known values and/or match expected patterns.
- Values are of the expected type.
- Source:
Returns:
Is the resource valid?
- Type
- boolean