@digipair/skill-basic 0.95.4 → 0.95.6

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/index.cjs.js CHANGED
@@ -15,6 +15,65 @@ function _extends() {
15
15
  return _extends.apply(this, arguments);
16
16
  }
17
17
 
18
+ /**
19
+ * Convert array of 16 byte values to UUID string format of the form:
20
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
21
+ */ var byteToHex = [];
22
+ for(var i = 0; i < 256; ++i){
23
+ byteToHex.push((i + 0x100).toString(16).slice(1));
24
+ }
25
+ function unsafeStringify(arr) {
26
+ var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
27
+ // Note: Be careful editing this code! It's been tuned for performance
28
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
29
+ //
30
+ // Note to future-self: No, you can't remove the `toLowerCase()` call.
31
+ // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
32
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
33
+ }
34
+
35
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
36
+ // require the crypto API and do not support built-in fallback to lower quality random number
37
+ // generators (like Math.random()).
38
+ var getRandomValues;
39
+ var rnds8 = new Uint8Array(16);
40
+ function rng() {
41
+ // lazy load so that environments that need to polyfill have a chance to do so
42
+ if (!getRandomValues) {
43
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
44
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
45
+ if (!getRandomValues) {
46
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
47
+ }
48
+ }
49
+ return getRandomValues(rnds8);
50
+ }
51
+
52
+ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
53
+ var native = {
54
+ randomUUID: randomUUID
55
+ };
56
+
57
+ function v4(options, buf, offset) {
58
+ if (native.randomUUID && !buf && !options) {
59
+ return native.randomUUID();
60
+ }
61
+ options = options || {};
62
+ var rnds = options.random || (options.rng || rng)();
63
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
64
+ rnds[6] = rnds[6] & 0x0f | 0x40;
65
+ rnds[8] = rnds[8] & 0x3f | 0x80;
66
+ // Copy bytes to buffer, if provided
67
+ if (buf) {
68
+ offset = offset || 0;
69
+ for(var i = 0; i < 16; ++i){
70
+ buf[offset + i] = rnds[i];
71
+ }
72
+ return buf;
73
+ }
74
+ return unsafeStringify(rnds);
75
+ }
76
+
18
77
  let BasicService = class BasicService {
19
78
  async transform(params, _pinsSettingsList, context) {
20
79
  const { value, execute } = params;
@@ -78,6 +137,10 @@ let BasicService = class BasicService {
78
137
  }), `${context.__PATH__}.executeCatch`);
79
138
  }
80
139
  }
140
+ async uuid(_params, _pinsSettingsList, _context) {
141
+ const uuid = v4();
142
+ return uuid;
143
+ }
81
144
  };
82
145
  const transform = (params, pinsSettingsList, context)=>new BasicService().transform(params, pinsSettingsList, context);
83
146
  const setVariable = (params, pinsSettingsList, context)=>new BasicService().setVariable(params, pinsSettingsList, context);
@@ -87,6 +150,7 @@ const defer = (params, pinsSettingsList, context)=>new BasicService().defer(para
87
150
  const stopInterval = (params, pinsSettingsList, context)=>new BasicService().stopInterval(params, pinsSettingsList, context);
88
151
  const stopDefer = (params, pinsSettingsList, context)=>new BasicService().stopDefer(params, pinsSettingsList, context);
89
152
  const trycatch = (params, pinsSettingsList, context)=>new BasicService().trycatch(params, pinsSettingsList, context);
153
+ const uuid = (params, pinsSettingsList, context)=>new BasicService().uuid(params, pinsSettingsList, context);
90
154
 
91
155
  exports.base64ToBuffer = base64ToBuffer;
92
156
  exports.defer = defer;
@@ -96,3 +160,4 @@ exports.stopDefer = stopDefer;
96
160
  exports.stopInterval = stopInterval;
97
161
  exports.transform = transform;
98
162
  exports.trycatch = trycatch;
163
+ exports.uuid = uuid;
package/index.esm.js CHANGED
@@ -23899,14 +23899,14 @@ function indent(str, spaces) {
23899
23899
  var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
23900
23900
  // match is required
23901
23901
  if (!match) {
23902
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23902
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23903
23903
  v: nextMatch1
23904
23904
  };
23905
23905
  }
23906
23906
  var token = match.token, offset = match.offset;
23907
23907
  i1 += offset;
23908
23908
  if (token === " ") {
23909
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23909
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23910
23910
  }
23911
23911
  tokens1 = _to_consumable_array$1(tokens1).concat([
23912
23912
  token
@@ -23925,7 +23925,7 @@ function indent(str, spaces) {
23925
23925
  if (contextKeys.some(function(el) {
23926
23926
  return el.startsWith(name);
23927
23927
  })) {
23928
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23928
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23929
23929
  }
23930
23930
  if (dateTimeIdentifiers.some(function(el) {
23931
23931
  return el === name;
@@ -23944,9 +23944,9 @@ function indent(str, spaces) {
23944
23944
  if (dateTimeIdentifiers.some(function(el) {
23945
23945
  return el.startsWith(name);
23946
23946
  })) {
23947
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, "continue";
23947
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, "continue";
23948
23948
  }
23949
- return i = i1, tokens = tokens1, nextMatch = nextMatch1, {
23949
+ return tokens = tokens1, i = i1, nextMatch = nextMatch1, {
23950
23950
  v: nextMatch1
23951
23951
  };
23952
23952
  };
@@ -27980,6 +27980,65 @@ const preparePinsSettings = (settings, context)=>{
27980
27980
  });
27981
27981
  };
27982
27982
 
27983
+ /**
27984
+ * Convert array of 16 byte values to UUID string format of the form:
27985
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
27986
+ */ var byteToHex = [];
27987
+ for(var i = 0; i < 256; ++i){
27988
+ byteToHex.push((i + 0x100).toString(16).slice(1));
27989
+ }
27990
+ function unsafeStringify(arr) {
27991
+ var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
27992
+ // Note: Be careful editing this code! It's been tuned for performance
27993
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
27994
+ //
27995
+ // Note to future-self: No, you can't remove the `toLowerCase()` call.
27996
+ // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
27997
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
27998
+ }
27999
+
28000
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
28001
+ // require the crypto API and do not support built-in fallback to lower quality random number
28002
+ // generators (like Math.random()).
28003
+ var getRandomValues;
28004
+ var rnds8 = new Uint8Array(16);
28005
+ function rng() {
28006
+ // lazy load so that environments that need to polyfill have a chance to do so
28007
+ if (!getRandomValues) {
28008
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
28009
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
28010
+ if (!getRandomValues) {
28011
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
28012
+ }
28013
+ }
28014
+ return getRandomValues(rnds8);
28015
+ }
28016
+
28017
+ var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
28018
+ var native = {
28019
+ randomUUID: randomUUID
28020
+ };
28021
+
28022
+ function v4(options, buf, offset) {
28023
+ if (native.randomUUID && !buf && !options) {
28024
+ return native.randomUUID();
28025
+ }
28026
+ options = options || {};
28027
+ var rnds = options.random || (options.rng || rng)();
28028
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
28029
+ rnds[6] = rnds[6] & 0x0f | 0x40;
28030
+ rnds[8] = rnds[8] & 0x3f | 0x80;
28031
+ // Copy bytes to buffer, if provided
28032
+ if (buf) {
28033
+ offset = offset || 0;
28034
+ for(var i = 0; i < 16; ++i){
28035
+ buf[offset + i] = rnds[i];
28036
+ }
28037
+ return buf;
28038
+ }
28039
+ return unsafeStringify(rnds);
28040
+ }
28041
+
27983
28042
  let BasicService = class BasicService {
27984
28043
  async transform(params, _pinsSettingsList, context) {
27985
28044
  const { value, execute } = params;
@@ -28043,6 +28102,10 @@ let BasicService = class BasicService {
28043
28102
  }), `${context.__PATH__}.executeCatch`);
28044
28103
  }
28045
28104
  }
28105
+ async uuid(_params, _pinsSettingsList, _context) {
28106
+ const uuid = v4();
28107
+ return uuid;
28108
+ }
28046
28109
  };
28047
28110
  const transform = (params, pinsSettingsList, context)=>new BasicService().transform(params, pinsSettingsList, context);
28048
28111
  const setVariable = (params, pinsSettingsList, context)=>new BasicService().setVariable(params, pinsSettingsList, context);
@@ -28052,5 +28115,6 @@ const defer = (params, pinsSettingsList, context)=>new BasicService().defer(para
28052
28115
  const stopInterval = (params, pinsSettingsList, context)=>new BasicService().stopInterval(params, pinsSettingsList, context);
28053
28116
  const stopDefer = (params, pinsSettingsList, context)=>new BasicService().stopDefer(params, pinsSettingsList, context);
28054
28117
  const trycatch = (params, pinsSettingsList, context)=>new BasicService().trycatch(params, pinsSettingsList, context);
28118
+ const uuid = (params, pinsSettingsList, context)=>new BasicService().uuid(params, pinsSettingsList, context);
28055
28119
 
28056
- export { base64ToBuffer, defer, interval, setVariable, stopDefer, stopInterval, transform, trycatch };
28120
+ export { base64ToBuffer, defer, interval, setVariable, stopDefer, stopInterval, transform, trycatch, uuid };
@@ -9,3 +9,4 @@ export declare const defer: (params: any, pinsSettingsList: PinsSettings[], cont
9
9
  export declare const stopInterval: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<void>;
10
10
  export declare const stopDefer: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<void>;
11
11
  export declare const trycatch: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<any>;
12
+ export declare const uuid: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-basic",
3
- "version": "0.95.4",
3
+ "version": "0.95.6",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "web",
package/schema.fr.json CHANGED
@@ -231,6 +231,15 @@
231
231
  ],
232
232
  "x-events": []
233
233
  }
234
+ },
235
+ "/uuid": {
236
+ "post": {
237
+ "tags": ["web", "service", "spatial"],
238
+ "summary": "Générer un UUID",
239
+ "description": "Génère un UUID",
240
+ "parameters": [],
241
+ "x-events": []
242
+ }
234
243
  }
235
244
  },
236
245
  "components": {
package/schema.json CHANGED
@@ -231,6 +231,15 @@
231
231
  ],
232
232
  "x-events": []
233
233
  }
234
+ },
235
+ "/uuid": {
236
+ "post": {
237
+ "tags": ["web", "service", "spatial"],
238
+ "summary": "Generate a UUID",
239
+ "description": "Generates a UUID.",
240
+ "parameters": [],
241
+ "x-events": []
242
+ }
234
243
  }
235
244
  },
236
245
  "components": {