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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fable",
3
- "version": "3.1.74",
3
+ "version": "3.1.75",
4
4
  "description": "A service dependency injection, configuration and logging library.",
5
5
  "main": "source/Fable.js",
6
6
  "scripts": {
@@ -520,5 +520,10 @@
520
520
  "beziercurvefit": {
521
521
  "Name": "Fit a Cubic Bezier Curve to a Set of Data Points",
522
522
  "Address": "fable.Math.bezierCurveFit"
523
+ },
524
+
525
+ "generateguid": {
526
+ "Name": "Generate a GUID string",
527
+ "Address": "fable.getUUID"
523
528
  }
524
529
  }
@@ -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
  );