fable 3.1.74 → 3.1.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/_version.json +3 -3
- package/docs/index.html +2 -2
- package/docs/retold-catalog.json +2 -13
- package/docs/retold-keyword-index.json +12433 -12033
- package/docs/services/expression-parser-functions/README.md +4 -0
- package/docs/services/expression-parser-functions/generateguid.md +56 -0
- package/package.json +1 -1
- package/source/services/Fable-Service-ExpressionParser/Fable-Service-ExpressionParser-FunctionMap.json +5 -0
- package/test/ExpressionParser_tests.js +2 -0
|
@@ -161,6 +161,10 @@ Basic math operations with arbitrary precision:
|
|
|
161
161
|
- [bezierpoint](./bezierpoint.md) - Evaluate point on cubic Bezier curve
|
|
162
162
|
- [beziercurvefit](./beziercurvefit.md) - Fit cubic Bezier curve to data points
|
|
163
163
|
|
|
164
|
+
### Identifier Generation
|
|
165
|
+
|
|
166
|
+
- [generateguid](./generateguid.md) - Generate a unique GUID string
|
|
167
|
+
|
|
164
168
|
### Other Utilities
|
|
165
169
|
|
|
166
170
|
- [generatearrayofobjectsfromsets](./generatearrayofobjectsfromsets.md) - Generate objects from sets
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# generateguid
|
|
2
|
+
|
|
3
|
+
Generates a GUID string.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
generateguid()
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
None
|
|
14
|
+
|
|
15
|
+
## Returns
|
|
16
|
+
|
|
17
|
+
String - A newly generated GUID, e.g. `'0x53c7c0bed0010000'`.
|
|
18
|
+
|
|
19
|
+
## Description
|
|
20
|
+
|
|
21
|
+
The `generateguid` function returns a unique identifier by delegating to `fable.getUUID()`. The underlying [UUID service](../uuid.md) uses the Snowflake ID pattern, encoding a timestamp together with the configured DataCenter and Worker IDs so that distributed processes can mint IDs without coordination.
|
|
22
|
+
|
|
23
|
+
Each call produces a new identifier.
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Basic Usage
|
|
28
|
+
|
|
29
|
+
```expression
|
|
30
|
+
Result = GENERATEGUID()
|
|
31
|
+
// Result: "0x53c7c0bed0010000" (different each call)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Tagging a Record
|
|
35
|
+
|
|
36
|
+
```expression
|
|
37
|
+
// Stamp a synthetic record with a fresh ID
|
|
38
|
+
RecordID = GENERATEGUID()
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Use Cases
|
|
42
|
+
|
|
43
|
+
- **Synthetic IDs**: Assign identifiers to records produced inside an expression
|
|
44
|
+
- **Test data**: Generate unique keys for fixtures and mocks
|
|
45
|
+
- **Correlation IDs**: Mint a trace/correlation token to thread through downstream calls
|
|
46
|
+
|
|
47
|
+
## Related Functions
|
|
48
|
+
|
|
49
|
+
- [randominteger](./randominteger.md) - Random integer (not guaranteed unique)
|
|
50
|
+
|
|
51
|
+
## Notes
|
|
52
|
+
|
|
53
|
+
- Returns the result as a string
|
|
54
|
+
- Backed by `fable.getUUID()` / the Fable UUID service ([details](../uuid.md))
|
|
55
|
+
- Configure DataCenter and Worker IDs via the `UUID` settings block on the Fable instance to keep IDs distinct across processes
|
|
56
|
+
- Each call produces a different value
|
package/package.json
CHANGED
|
@@ -331,6 +331,8 @@ suite
|
|
|
331
331
|
let tmpResultPrecise = _Parser.solve('Result = (160 * PR * Z) / (C / 100) * PR * Z + (160 * (1 - C / 100))', { C: "-13", PR: "1.5", Z: "20.03" })
|
|
332
332
|
Expect(tmpResultPrecise).to.equal("-1110837.0769230769230769230307");
|
|
333
333
|
|
|
334
|
+
Expect(_Parser.solve('Result = generateguid()').length).to.equal(36);
|
|
335
|
+
|
|
334
336
|
return fDone();
|
|
335
337
|
}
|
|
336
338
|
);
|