@nsshunt/stsobservability 1.0.34 → 1.0.35
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/dist/stsobservability.mjs +60 -54
- package/dist/stsobservability.mjs.map +1 -1
- package/dist/stsobservability.umd.js +182 -176
- package/dist/stsobservability.umd.js.map +1 -1
- package/package.json +15 -12
- package/types/instrumentation/instruments/instrumentTimerGauge.d.ts.map +1 -1
- package/types/instrumentation/instruments/instrumentVelocity.d.ts.map +1 -1
- package/types/publish/publishInstrumentController.d.ts.map +1 -1
- package/types/publish/publishers/publishTransportRESTServer.d.ts.map +1 -1
|
@@ -17,7 +17,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
17
17
|
return __privateGet(obj, member, getter);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
var _a, _label, _options, _data, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData,
|
|
20
|
+
var _a, _label, _options, _data, _val, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _instruments, _inPublish, _observer2, _publishState, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, GetPayloadData_fn, PublishTimeoutLoop_fn, UpdateState_fn, _httpsAgent, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn;
|
|
21
21
|
import _cloneDeep from "lodash.clonedeep";
|
|
22
22
|
import isNode from "detect-node";
|
|
23
23
|
import { STSOptionsBase } from "@nsshunt/stsutils";
|
|
@@ -196,9 +196,11 @@ class InstrumentVelocity extends InstrumentBase {
|
|
|
196
196
|
constructor(options = {}) {
|
|
197
197
|
super(options);
|
|
198
198
|
__privateAdd(this, _InstrumentVelocity_instances);
|
|
199
|
-
|
|
199
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
200
|
+
__privateAdd(this, _val, 0);
|
|
200
201
|
__privateAdd(this, _interval, null);
|
|
201
202
|
__privateAdd(this, _timeoutComputeVelocity, null);
|
|
203
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
202
204
|
__privateAdd(this, _lastVelocity, 0);
|
|
203
205
|
__privateAdd(this, _delta, 0);
|
|
204
206
|
__privateAdd(this, _maxVelocity, 0);
|
|
@@ -210,6 +212,7 @@ class InstrumentVelocity extends InstrumentBase {
|
|
|
210
212
|
__privateAdd(this, _averageValStack, []);
|
|
211
213
|
__privateAdd(this, _maxAverageValStack, 0);
|
|
212
214
|
__privateAdd(this, _maxAverageIterations, 0);
|
|
215
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
213
216
|
__privateAdd(this, _valStackMaxLength, 0);
|
|
214
217
|
__privateAdd(this, _valStackAverage, 0);
|
|
215
218
|
__privateAdd(this, _timeStamp, 0);
|
|
@@ -424,6 +427,7 @@ class InstrumentVelocity extends InstrumentBase {
|
|
|
424
427
|
}
|
|
425
428
|
}
|
|
426
429
|
}
|
|
430
|
+
_val = new WeakMap();
|
|
427
431
|
_interval = new WeakMap();
|
|
428
432
|
_timeoutComputeVelocity = new WeakMap();
|
|
429
433
|
_lastVelocity = new WeakMap();
|
|
@@ -615,7 +619,7 @@ class InstrumentHistogram extends InstrumentBase {
|
|
|
615
619
|
super(options);
|
|
616
620
|
__privateAdd(this, _InstrumentHistogram_instances);
|
|
617
621
|
__privateAdd(this, _histogramData, []);
|
|
618
|
-
__privateAdd(this,
|
|
622
|
+
__privateAdd(this, _val2, 0);
|
|
619
623
|
__privateAdd(this, _copy2, false);
|
|
620
624
|
__publicField(this, "hist", []);
|
|
621
625
|
__publicField(this, "val", 0);
|
|
@@ -680,16 +684,16 @@ class InstrumentHistogram extends InstrumentBase {
|
|
|
680
684
|
});
|
|
681
685
|
}
|
|
682
686
|
if (typeof options.initValue !== "undefined") {
|
|
683
|
-
__privateSet(this,
|
|
687
|
+
__privateSet(this, _val2, options.initValue);
|
|
684
688
|
}
|
|
685
689
|
if (typeof options.fromJSON !== "undefined") {
|
|
686
690
|
const result = _cloneDeep(options.fromJSON);
|
|
687
|
-
__privateSet(this,
|
|
691
|
+
__privateSet(this, _val2, result.val);
|
|
688
692
|
this.hist = result.hist;
|
|
689
693
|
}
|
|
690
694
|
}
|
|
691
695
|
WithInitVal(initVal) {
|
|
692
|
-
__privateSet(this,
|
|
696
|
+
__privateSet(this, _val2, initVal);
|
|
693
697
|
return this;
|
|
694
698
|
}
|
|
695
699
|
ResetHistogramData() {
|
|
@@ -819,14 +823,14 @@ class InstrumentHistogram extends InstrumentBase {
|
|
|
819
823
|
}
|
|
820
824
|
}
|
|
821
825
|
_histogramData = new WeakMap();
|
|
822
|
-
|
|
826
|
+
_val2 = new WeakMap();
|
|
823
827
|
_copy2 = new WeakMap();
|
|
824
828
|
_InstrumentHistogram_instances = new WeakSet();
|
|
825
829
|
GetVal_fn2 = function() {
|
|
826
|
-
return this.GetNumber(__privateGet(this,
|
|
830
|
+
return this.GetNumber(__privateGet(this, _val2));
|
|
827
831
|
};
|
|
828
832
|
SetVal_fn2 = function(value) {
|
|
829
|
-
__privateSet(this,
|
|
833
|
+
__privateSet(this, _val2, value);
|
|
830
834
|
this.AddObservation(value);
|
|
831
835
|
};
|
|
832
836
|
GetHistogramData_fn = function() {
|
|
@@ -1143,6 +1147,22 @@ class InstrumentTimerGauge extends InstrumentBase {
|
|
|
1143
1147
|
get start() {
|
|
1144
1148
|
return __privateGet(this, _start);
|
|
1145
1149
|
}
|
|
1150
|
+
/*
|
|
1151
|
+
#convertMS(ms: number): string {
|
|
1152
|
+
//let d, h, m, s;
|
|
1153
|
+
let s = Math.floor(ms / 1000);
|
|
1154
|
+
let m = Math.floor(s / 60);
|
|
1155
|
+
s = s % 60;
|
|
1156
|
+
let h = Math.floor(m / 60);
|
|
1157
|
+
m = m % 60;
|
|
1158
|
+
const d = Math.floor(h / 24);
|
|
1159
|
+
h = h % 24;
|
|
1160
|
+
|
|
1161
|
+
const pad: (n: number) => string = function(n: number) { return n < 10 ? '0' + n : n.toString(); };
|
|
1162
|
+
|
|
1163
|
+
return (d + '.' + pad(h) + ':' + pad(m) + ':' + pad(s)).padStart(12);
|
|
1164
|
+
}
|
|
1165
|
+
*/
|
|
1146
1166
|
ProcessTelemetry(telemetry) {
|
|
1147
1167
|
if (telemetry.val) {
|
|
1148
1168
|
this.val = telemetry.val;
|
|
@@ -1179,19 +1199,6 @@ SetVal_fn4 = function(updatedValue) {
|
|
|
1179
1199
|
__privateSet(this, _start, performance.now() - updatedValue);
|
|
1180
1200
|
}
|
|
1181
1201
|
};
|
|
1182
|
-
convertMS_fn = function(ms) {
|
|
1183
|
-
let s = Math.floor(ms / 1e3);
|
|
1184
|
-
let m = Math.floor(s / 60);
|
|
1185
|
-
s = s % 60;
|
|
1186
|
-
let h = Math.floor(m / 60);
|
|
1187
|
-
m = m % 60;
|
|
1188
|
-
const d = Math.floor(h / 24);
|
|
1189
|
-
h = h % 24;
|
|
1190
|
-
const pad = function(n) {
|
|
1191
|
-
return n < 10 ? "0" + n : n.toString();
|
|
1192
|
-
};
|
|
1193
|
-
return (d + "." + pad(h) + ":" + pad(m) + ":" + pad(s)).padStart(12);
|
|
1194
|
-
};
|
|
1195
1202
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1196
1203
|
function getDefaultExportFromCjs(x) {
|
|
1197
1204
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
@@ -1882,7 +1889,7 @@ class InstrumentGauge extends InstrumentBase {
|
|
|
1882
1889
|
constructor(options = {}) {
|
|
1883
1890
|
super(options);
|
|
1884
1891
|
__privateAdd(this, _InstrumentGauge_instances);
|
|
1885
|
-
__privateAdd(this,
|
|
1892
|
+
__privateAdd(this, _val3, 0);
|
|
1886
1893
|
__privateAdd(this, _maxval, null);
|
|
1887
1894
|
__privateAdd(this, _lastObservedValue, 0);
|
|
1888
1895
|
__privateAdd(this, _timeSeriesList, []);
|
|
@@ -2021,7 +2028,7 @@ class InstrumentGauge extends InstrumentBase {
|
|
|
2021
2028
|
this.StopTimer();
|
|
2022
2029
|
__privateSet(this, _maxval, 0);
|
|
2023
2030
|
__privateSet(this, _lastObservedValue, 0);
|
|
2024
|
-
__privateSet(this,
|
|
2031
|
+
__privateSet(this, _val3, 0);
|
|
2025
2032
|
__privateSet(this, _min, null);
|
|
2026
2033
|
__privateSet(this, _max, 0);
|
|
2027
2034
|
__privateSet(this, _observations, 0);
|
|
@@ -2031,10 +2038,10 @@ class InstrumentGauge extends InstrumentBase {
|
|
|
2031
2038
|
}
|
|
2032
2039
|
}
|
|
2033
2040
|
Inc(incVal = 1) {
|
|
2034
|
-
__privateMethod(this, _InstrumentGauge_instances, SetVal_fn5).call(this, __privateGet(this,
|
|
2041
|
+
__privateMethod(this, _InstrumentGauge_instances, SetVal_fn5).call(this, __privateGet(this, _val3) + incVal);
|
|
2035
2042
|
}
|
|
2036
2043
|
Dec(decVal = 1) {
|
|
2037
|
-
__privateMethod(this, _InstrumentGauge_instances, SetVal_fn5).call(this, __privateGet(this,
|
|
2044
|
+
__privateMethod(this, _InstrumentGauge_instances, SetVal_fn5).call(this, __privateGet(this, _val3) - decVal);
|
|
2038
2045
|
}
|
|
2039
2046
|
ProcessTelemetry(telemetry) {
|
|
2040
2047
|
if (telemetry.Inc) {
|
|
@@ -2048,7 +2055,7 @@ class InstrumentGauge extends InstrumentBase {
|
|
|
2048
2055
|
}
|
|
2049
2056
|
}
|
|
2050
2057
|
}
|
|
2051
|
-
|
|
2058
|
+
_val3 = new WeakMap();
|
|
2052
2059
|
_maxval = new WeakMap();
|
|
2053
2060
|
_lastObservedValue = new WeakMap();
|
|
2054
2061
|
_timeSeriesList = new WeakMap();
|
|
@@ -2073,28 +2080,28 @@ GetVal_fn5 = function() {
|
|
|
2073
2080
|
return this.GetNumber(__privateGet(this, _maxval));
|
|
2074
2081
|
}
|
|
2075
2082
|
}
|
|
2076
|
-
return this.GetNumber(__privateGet(this,
|
|
2083
|
+
return this.GetNumber(__privateGet(this, _val3));
|
|
2077
2084
|
};
|
|
2078
2085
|
SetVal_fn5 = function(updatedValue) {
|
|
2079
|
-
__privateSet(this,
|
|
2086
|
+
__privateSet(this, _val3, updatedValue);
|
|
2080
2087
|
__privateWrapper(this, _observations)._++;
|
|
2081
2088
|
__privateSet(this, _total, __privateGet(this, _total) + updatedValue);
|
|
2082
|
-
if (__privateGet(this,
|
|
2083
|
-
__privateSet(this, _max, __privateGet(this,
|
|
2089
|
+
if (__privateGet(this, _val3) > __privateGet(this, _max)) {
|
|
2090
|
+
__privateSet(this, _max, __privateGet(this, _val3));
|
|
2084
2091
|
}
|
|
2085
2092
|
if (__privateGet(this, _min) !== null) {
|
|
2086
|
-
if (__privateGet(this,
|
|
2087
|
-
__privateSet(this, _min, __privateGet(this,
|
|
2093
|
+
if (__privateGet(this, _val3) < __privateGet(this, _min)) {
|
|
2094
|
+
__privateSet(this, _min, __privateGet(this, _val3));
|
|
2088
2095
|
}
|
|
2089
2096
|
} else {
|
|
2090
|
-
__privateSet(this, _min, __privateGet(this,
|
|
2097
|
+
__privateSet(this, _min, __privateGet(this, _val3));
|
|
2091
2098
|
}
|
|
2092
2099
|
if (__privateGet(this, _timerInterval2) > 0) {
|
|
2093
2100
|
__privateSet(this, _lastObservedValue, updatedValue);
|
|
2094
2101
|
if (__privateGet(this, _maxval) === null) {
|
|
2095
|
-
__privateSet(this, _maxval, __privateGet(this,
|
|
2096
|
-
} else if (__privateGet(this,
|
|
2097
|
-
__privateSet(this, _maxval, __privateGet(this,
|
|
2102
|
+
__privateSet(this, _maxval, __privateGet(this, _val3));
|
|
2103
|
+
} else if (__privateGet(this, _val3) > __privateGet(this, _maxval)) {
|
|
2104
|
+
__privateSet(this, _maxval, __privateGet(this, _val3));
|
|
2098
2105
|
}
|
|
2099
2106
|
}
|
|
2100
2107
|
};
|
|
@@ -2146,7 +2153,7 @@ class InstrumentObject extends InstrumentBase {
|
|
|
2146
2153
|
constructor(options = {}) {
|
|
2147
2154
|
super(options);
|
|
2148
2155
|
__privateAdd(this, _InstrumentObject_instances);
|
|
2149
|
-
__privateAdd(this,
|
|
2156
|
+
__privateAdd(this, _val4, {});
|
|
2150
2157
|
__privateAdd(this, _copy6, false);
|
|
2151
2158
|
__publicField(this, "val");
|
|
2152
2159
|
if (typeof options.label === "undefined") {
|
|
@@ -2196,14 +2203,14 @@ class InstrumentObject extends InstrumentBase {
|
|
|
2196
2203
|
}
|
|
2197
2204
|
}
|
|
2198
2205
|
}
|
|
2199
|
-
|
|
2206
|
+
_val4 = new WeakMap();
|
|
2200
2207
|
_copy6 = new WeakMap();
|
|
2201
2208
|
_InstrumentObject_instances = new WeakSet();
|
|
2202
2209
|
GetVal_fn6 = function() {
|
|
2203
|
-
return __privateGet(this,
|
|
2210
|
+
return __privateGet(this, _val4);
|
|
2204
2211
|
};
|
|
2205
2212
|
SetVal_fn6 = function(updatedValue) {
|
|
2206
|
-
__privateSet(this,
|
|
2213
|
+
__privateSet(this, _val4, updatedValue);
|
|
2207
2214
|
};
|
|
2208
2215
|
function CreateInstrument(sourceInstrument) {
|
|
2209
2216
|
switch (sourceInstrument[GaugeTypes.GAUGE_TYPE]) {
|
|
@@ -2429,7 +2436,6 @@ class RequestLoggerMiddleware extends STSOptionsBase {
|
|
|
2429
2436
|
* @param {*} next
|
|
2430
2437
|
* @returns
|
|
2431
2438
|
*/
|
|
2432
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2433
2439
|
__publicField(this, "Middleware", async (req, res, next) => {
|
|
2434
2440
|
if (this.options.ignoresocketio && req.originalUrl.includes("socket.io")) {
|
|
2435
2441
|
return;
|
|
@@ -5746,8 +5752,15 @@ RemoveKeepAlive_fn = function(subscription) {
|
|
|
5746
5752
|
delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id];
|
|
5747
5753
|
}
|
|
5748
5754
|
};
|
|
5749
|
-
|
|
5750
|
-
|
|
5755
|
+
var byteToHex = [];
|
|
5756
|
+
for (var i = 0; i < 256; ++i) {
|
|
5757
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
5758
|
+
}
|
|
5759
|
+
function unsafeStringify(arr, offset = 0) {
|
|
5760
|
+
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();
|
|
5761
|
+
}
|
|
5762
|
+
var getRandomValues;
|
|
5763
|
+
var rnds8 = new Uint8Array(16);
|
|
5751
5764
|
function rng() {
|
|
5752
5765
|
if (!getRandomValues) {
|
|
5753
5766
|
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
@@ -5757,14 +5770,7 @@ function rng() {
|
|
|
5757
5770
|
}
|
|
5758
5771
|
return getRandomValues(rnds8);
|
|
5759
5772
|
}
|
|
5760
|
-
|
|
5761
|
-
for (let i = 0; i < 256; ++i) {
|
|
5762
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
5763
|
-
}
|
|
5764
|
-
function unsafeStringify(arr, offset = 0) {
|
|
5765
|
-
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]];
|
|
5766
|
-
}
|
|
5767
|
-
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
5773
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
5768
5774
|
const native = {
|
|
5769
5775
|
randomUUID
|
|
5770
5776
|
};
|
|
@@ -5773,12 +5779,12 @@ function v4(options, buf, offset) {
|
|
|
5773
5779
|
return native.randomUUID();
|
|
5774
5780
|
}
|
|
5775
5781
|
options = options || {};
|
|
5776
|
-
|
|
5782
|
+
var rnds = options.random || (options.rng || rng)();
|
|
5777
5783
|
rnds[6] = rnds[6] & 15 | 64;
|
|
5778
5784
|
rnds[8] = rnds[8] & 63 | 128;
|
|
5779
5785
|
if (buf) {
|
|
5780
5786
|
offset = offset || 0;
|
|
5781
|
-
for (
|
|
5787
|
+
for (var i = 0; i < 16; ++i) {
|
|
5782
5788
|
buf[offset + i] = rnds[i];
|
|
5783
5789
|
}
|
|
5784
5790
|
return buf;
|