@fluid-experimental/property-common 0.49.0 → 0.50.0-41540
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/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/chronometer.d.ts +55 -0
- package/lib/chronometer.d.ts.map +1 -0
- package/lib/chronometer.js +185 -0
- package/lib/chronometer.js.map +1 -0
- package/lib/consoleUtils.d.ts +16 -0
- package/lib/consoleUtils.d.ts.map +1 -0
- package/lib/consoleUtils.js +20 -0
- package/lib/consoleUtils.js.map +1 -0
- package/lib/constants.d.ts +1219 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +1274 -0
- package/lib/constants.js.map +1 -0
- package/lib/datastructures/collection.d.ts +203 -0
- package/lib/datastructures/collection.d.ts.map +1 -0
- package/lib/datastructures/collection.js +377 -0
- package/lib/datastructures/collection.js.map +1 -0
- package/lib/datastructures/dataArray.d.ts +275 -0
- package/lib/datastructures/dataArray.d.ts.map +1 -0
- package/lib/datastructures/dataArray.js +497 -0
- package/lib/datastructures/dataArray.js.map +1 -0
- package/lib/datastructures/index.d.ts +9 -0
- package/lib/datastructures/index.d.ts.map +1 -0
- package/lib/datastructures/index.js +9 -0
- package/lib/datastructures/index.js.map +1 -0
- package/lib/datastructures/integer64.d.ts +47 -0
- package/lib/datastructures/integer64.d.ts.map +1 -0
- package/lib/datastructures/integer64.js +140 -0
- package/lib/datastructures/integer64.js.map +1 -0
- package/lib/datastructures/sortedCollection.d.ts +77 -0
- package/lib/datastructures/sortedCollection.d.ts.map +1 -0
- package/lib/datastructures/sortedCollection.js +140 -0
- package/lib/datastructures/sortedCollection.js.map +1 -0
- package/lib/deferredPromise.d.ts +28 -0
- package/lib/deferredPromise.d.ts.map +1 -0
- package/lib/deferredPromise.js +43 -0
- package/lib/deferredPromise.js.map +1 -0
- package/lib/deterministicRandomGenerator.d.ts +39 -0
- package/lib/deterministicRandomGenerator.d.ts.map +1 -0
- package/lib/deterministicRandomGenerator.js +83 -0
- package/lib/deterministicRandomGenerator.js.map +1 -0
- package/lib/error_objects/flaggedError.d.ts +29 -0
- package/lib/error_objects/flaggedError.d.ts.map +1 -0
- package/lib/error_objects/flaggedError.js +45 -0
- package/lib/error_objects/flaggedError.js.map +1 -0
- package/lib/error_objects/httpError.d.ts +31 -0
- package/lib/error_objects/httpError.d.ts.map +1 -0
- package/lib/error_objects/httpError.js +58 -0
- package/lib/error_objects/httpError.js.map +1 -0
- package/lib/error_objects/httpErrorNoStack.d.ts +25 -0
- package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -0
- package/lib/error_objects/httpErrorNoStack.js +29 -0
- package/lib/error_objects/httpErrorNoStack.js.map +1 -0
- package/lib/error_objects/index.d.ts +9 -0
- package/lib/error_objects/index.d.ts.map +1 -0
- package/lib/error_objects/index.js +9 -0
- package/lib/error_objects/index.js.map +1 -0
- package/lib/error_objects/operationError.d.ts +32 -0
- package/lib/error_objects/operationError.d.ts.map +1 -0
- package/lib/error_objects/operationError.js +73 -0
- package/lib/error_objects/operationError.js.map +1 -0
- package/lib/guidUtils.d.ts +16 -0
- package/lib/guidUtils.d.ts.map +1 -0
- package/lib/guidUtils.js +297 -0
- package/lib/guidUtils.js.map +1 -0
- package/lib/hashCalculator.d.ts +6 -0
- package/lib/hashCalculator.d.ts.map +1 -0
- package/lib/hashCalculator.js +14 -0
- package/lib/hashCalculator.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +16 -0
- package/lib/index.js.map +1 -0
- package/lib/joinPaths.d.ts +19 -0
- package/lib/joinPaths.d.ts.map +1 -0
- package/lib/joinPaths.js +28 -0
- package/lib/joinPaths.js.map +1 -0
- package/lib/packageVersion.d.ts +9 -0
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/packageVersion.js +9 -0
- package/lib/packageVersion.js.map +1 -0
- package/package.json +22 -2
- package/platform-dependent/package.json +1 -1
- package/src/constants.ts +5 -0
- package/src/packageVersion.ts +1 -1
- package/dist/test/chronometer.spec.js +0 -90
- package/dist/test/chronometer.spec.js.map +0 -1
- package/dist/test/datastructures/collection.spec.js +0 -401
- package/dist/test/datastructures/collection.spec.js.map +0 -1
- package/dist/test/datastructures/dataArray.spec.js +0 -79
- package/dist/test/datastructures/dataArray.spec.js.map +0 -1
- package/dist/test/datastructures/sortedCollection.spec.js +0 -106
- package/dist/test/datastructures/sortedCollection.spec.js.map +0 -1
- package/dist/test/deterministicRandomGenerator.spec.js +0 -18
- package/dist/test/deterministicRandomGenerator.spec.js.map +0 -1
- package/dist/test/error_objects/flaggedError.spec.js +0 -23
- package/dist/test/error_objects/flaggedError.spec.js.map +0 -1
- package/dist/test/error_objects/httpError.spec.js +0 -61
- package/dist/test/error_objects/httpError.spec.js.map +0 -1
- package/dist/test/error_objects/httpErrorNoStack.spec.js +0 -55
- package/dist/test/error_objects/httpErrorNoStack.spec.js.map +0 -1
- package/dist/test/error_objects/operationError.spec.js +0 -132
- package/dist/test/error_objects/operationError.spec.js.map +0 -1
- package/dist/test/guidUtils.spec.js +0 -184
- package/dist/test/guidUtils.spec.js.map +0 -1
- package/dist/test/strings/joinPaths.spec.js +0 -18
- package/dist/test/strings/joinPaths.spec.js.map +0 -1
- package/dist/test/tsconfig.tsbuildinfo +0 -2278
- package/nyc/mocha-junit-report.xml +0 -175
- package/src/test/chronometer.spec.ts +0 -99
- package/src/test/datastructures/collection.spec.ts +0 -567
- package/src/test/datastructures/dataArray.spec.ts +0 -81
- package/src/test/datastructures/sortedCollection.spec.ts +0 -128
- package/src/test/deterministicRandomGenerator.spec.ts +0 -18
- package/src/test/error_objects/flaggedError.spec.ts +0 -22
- package/src/test/error_objects/httpError.spec.ts +0 -68
- package/src/test/error_objects/httpErrorNoStack.spec.ts +0 -64
- package/src/test/error_objects/operationError.spec.ts +0 -152
- package/src/test/guidUtils.spec.ts +0 -213
- package/src/test/strings/joinPaths.spec.ts +0 -17
- package/src/test/tsconfig.json +0 -21
- package/tsconfig.esnext.tsbuildinfo +0 -824
- package/tsconfig.tsbuildinfo +0 -823
package/lib/guidUtils.js
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/* eslint-disable no-bitwise */
|
|
6
|
+
/**
|
|
7
|
+
* @fileoverview Utility functions related to handling GUIDs
|
|
8
|
+
*/
|
|
9
|
+
import base64js from "base64-js";
|
|
10
|
+
import { generateRandomUInt32Array } from "../platform-dependent";
|
|
11
|
+
const UINT_32HASH_PRIME = 16777619;
|
|
12
|
+
/**
|
|
13
|
+
* Fast high quality 32 bit RNG for consistent guid.
|
|
14
|
+
*
|
|
15
|
+
* Good "randomness" (distribution); Period is approximately equal to 3.11*10^37
|
|
16
|
+
* Implementation was take from "Numerical recipes. The Art of Scientific Computing.", 3rd edition.
|
|
17
|
+
* Page 357, algorithm name: Ranlim32
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
const guidRNG = {
|
|
21
|
+
u: 0,
|
|
22
|
+
v: 0,
|
|
23
|
+
w1: 0,
|
|
24
|
+
w2: 0,
|
|
25
|
+
isInitialized: false,
|
|
26
|
+
/**
|
|
27
|
+
* Initialize RNG.
|
|
28
|
+
* This function need to be called once, before the first guid gets created.
|
|
29
|
+
*
|
|
30
|
+
* @param in_seed - Optional 32-bit seed for guid RNG;
|
|
31
|
+
* If no seed is given, a combination of system's
|
|
32
|
+
* local time and Math.random() is used.
|
|
33
|
+
* @param in_enforceReInitialization - Optionally enforce re-initialization with another seed
|
|
34
|
+
*
|
|
35
|
+
* @returns The seed used to initialize the RNG;
|
|
36
|
+
* If re-initialization is not enforced,
|
|
37
|
+
* a zero indicates that the RNG was not re-seeded.
|
|
38
|
+
* @alias property-common.initializeGUIDGenerator
|
|
39
|
+
*/
|
|
40
|
+
initialize(in_seed, in_enforceReInitialization = false) {
|
|
41
|
+
// Quit if the RNG has already been initialized and we do not
|
|
42
|
+
// want to enforce a re-initialization with a new seed
|
|
43
|
+
if (this.isInitialized && !in_enforceReInitialization) {
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.isInitialized = true;
|
|
48
|
+
if (in_seed === undefined) {
|
|
49
|
+
const randomValues = generateRandomUInt32Array(4);
|
|
50
|
+
this.u = randomValues[0];
|
|
51
|
+
this.v = randomValues[1];
|
|
52
|
+
this.w1 = randomValues[2];
|
|
53
|
+
this.w2 = randomValues[3];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.v = 224461437;
|
|
57
|
+
this.w1 = 521288629;
|
|
58
|
+
this.w2 = 362436069;
|
|
59
|
+
this.u = in_seed ^ this.v;
|
|
60
|
+
this.genRandUInt32();
|
|
61
|
+
this.v = this.u;
|
|
62
|
+
this.genRandUInt32();
|
|
63
|
+
}
|
|
64
|
+
return -1;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* @returns 32-bit random number based on the RNGs internal state
|
|
69
|
+
*/
|
|
70
|
+
genRandUInt32() {
|
|
71
|
+
this.u = multiply_uint32(this.u, 2891336453) + 1640531513;
|
|
72
|
+
this.v ^= this.v >>> 13;
|
|
73
|
+
this.v ^= this.v << 17;
|
|
74
|
+
this.v = ((this.v >>> 5) ^ this.v) >>> 0;
|
|
75
|
+
this.w1 = multiply_uint32(33378, (this.w1 & 0xffff)) + (this.w1 >>> 16);
|
|
76
|
+
this.w2 = multiply_uint32(57225, (this.w2 & 0xffff)) + (this.w2 >>> 16);
|
|
77
|
+
let x = this.u ^ (this.u << 9);
|
|
78
|
+
x ^= x >>> 17;
|
|
79
|
+
x ^= x << 6;
|
|
80
|
+
let y = this.w1 ^ (this.w1 << 17);
|
|
81
|
+
y ^= y >>> 15;
|
|
82
|
+
y ^= y << 5;
|
|
83
|
+
return (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Check if guid is base64 based on the length
|
|
88
|
+
* The length of base16 guid is 36, base64 - 22
|
|
89
|
+
*
|
|
90
|
+
* @param guid - Input guid
|
|
91
|
+
* @returns True if guid is base64
|
|
92
|
+
*/
|
|
93
|
+
const isBase64 = (guid) => guid.length === 22;
|
|
94
|
+
/**
|
|
95
|
+
* Allows for 32-bit integer multiplication with C-like semantics
|
|
96
|
+
*
|
|
97
|
+
* @param a - unsigned int32 value
|
|
98
|
+
* @param b - unsigned int32 value
|
|
99
|
+
* @returns - result of unsigned integer multiplication
|
|
100
|
+
*/
|
|
101
|
+
function multiply_uint32(a, b) {
|
|
102
|
+
let n = a;
|
|
103
|
+
let m = b;
|
|
104
|
+
n >>>= 0;
|
|
105
|
+
m >>>= 0;
|
|
106
|
+
const nlo = n & 0xffff;
|
|
107
|
+
return (((n - nlo) * m >>> 0) + (nlo * m)) >>> 0;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Helper function to convert base64 encoding to url friendly format
|
|
111
|
+
*
|
|
112
|
+
* @param base64 - Base64 string
|
|
113
|
+
*
|
|
114
|
+
* @returns Url-friendly base64 encoding.
|
|
115
|
+
*/
|
|
116
|
+
const toUrlBase64 = (base64) => base64.replace(/\+/g, "-").replace(/\//g, "_").split("=")[0];
|
|
117
|
+
/**
|
|
118
|
+
* Helper function to recover padding of base64 encoding
|
|
119
|
+
*
|
|
120
|
+
* @param x - Base64 string
|
|
121
|
+
*
|
|
122
|
+
* @returns Padded base64 encoding.
|
|
123
|
+
*/
|
|
124
|
+
const toPaddedBase64 = function (x) {
|
|
125
|
+
let base64 = x;
|
|
126
|
+
const padLength = 4 - base64.length % 4;
|
|
127
|
+
base64 += "=".repeat(padLength);
|
|
128
|
+
return base64;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Helper function to create a guid string from an array with 32Bit values
|
|
132
|
+
*
|
|
133
|
+
* @param in_guidArray - Array with the 32 bit values
|
|
134
|
+
* @param base64 - Use base64 encoding instead of standart guids
|
|
135
|
+
*
|
|
136
|
+
* @returns The guid
|
|
137
|
+
*/
|
|
138
|
+
const uint32x4ToGUID = function (in_guidArray, base64 = false) {
|
|
139
|
+
if (base64) {
|
|
140
|
+
const intArray = new Uint32Array(in_guidArray);
|
|
141
|
+
const byteArray = new Uint8Array(intArray.buffer);
|
|
142
|
+
const base64guid = base64js.fromByteArray(byteArray);
|
|
143
|
+
// return url-friendly base64
|
|
144
|
+
return toUrlBase64(base64guid);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// Convert to hexadecimal string
|
|
148
|
+
let str = "";
|
|
149
|
+
for (let i = 0; i < 4; i++) {
|
|
150
|
+
const hex = in_guidArray[i].toString(16);
|
|
151
|
+
str += ("0".repeat(8 - hex.length) + hex);
|
|
152
|
+
}
|
|
153
|
+
// eslint-disable-next-line max-len
|
|
154
|
+
return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Convert guid to four 32Bit values.
|
|
159
|
+
*
|
|
160
|
+
* @param in_guid - The guid to convert
|
|
161
|
+
* @param io_result - An optional array to write the result to;
|
|
162
|
+
* If no array is given, a new one gets created
|
|
163
|
+
* @returns Four 32-bit values
|
|
164
|
+
*
|
|
165
|
+
*/
|
|
166
|
+
const guidToUint32x4 = function (in_guid, result = new Uint32Array(4)) {
|
|
167
|
+
if (isBase64(in_guid)) {
|
|
168
|
+
const guid = toPaddedBase64(in_guid);
|
|
169
|
+
const bytes = base64js.toByteArray(guid);
|
|
170
|
+
const intArray = new Uint32Array(bytes.buffer);
|
|
171
|
+
result.set(intArray);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
result[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);
|
|
175
|
+
result[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);
|
|
176
|
+
result[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);
|
|
177
|
+
result[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);
|
|
178
|
+
}
|
|
179
|
+
return result;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Convert base64 guid into base16.
|
|
183
|
+
*
|
|
184
|
+
* @param in_guid - Base64 guid to convert
|
|
185
|
+
* @returns Base16 guid
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
188
|
+
const base64Tobase16 = (in_guid) => uint32x4ToGUID(guidToUint32x4(in_guid));
|
|
189
|
+
/**
|
|
190
|
+
* Convert base16 into base64 guid.
|
|
191
|
+
*
|
|
192
|
+
* @param in_guid - Base16 guid to convert
|
|
193
|
+
* @returns Base64 guid
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
const base16ToBase64 = (in_guid) => uint32x4ToGUID(guidToUint32x4(in_guid), true);
|
|
197
|
+
/**
|
|
198
|
+
* Based on the boolean parameter generate either
|
|
199
|
+
* a 128 bit base16 guid with the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx
|
|
200
|
+
* or url-friendly base64 string guid of length 22
|
|
201
|
+
*
|
|
202
|
+
* This function is *not* thread safe!
|
|
203
|
+
*
|
|
204
|
+
* @param base64 - Use base64 encoding instead of standart guids
|
|
205
|
+
*
|
|
206
|
+
* @returns The guid
|
|
207
|
+
*/
|
|
208
|
+
const generateGUID = function (base64 = false) {
|
|
209
|
+
const rnds = new Uint32Array(4);
|
|
210
|
+
// Random numbers for guid (4x32 bit)
|
|
211
|
+
rnds[0] = guidRNG.genRandUInt32();
|
|
212
|
+
rnds[1] = guidRNG.genRandUInt32();
|
|
213
|
+
rnds[2] = guidRNG.genRandUInt32();
|
|
214
|
+
rnds[3] = guidRNG.genRandUInt32();
|
|
215
|
+
return uint32x4ToGUID(rnds, base64);
|
|
216
|
+
};
|
|
217
|
+
// The last character is checked this way because last 4 bits of 22nd character are ignored
|
|
218
|
+
// by decoder, e.g. "+Q" and "+Z" result in the same decoding.
|
|
219
|
+
// The only characters with last 4 bits set to 0 are A, Q, g, w.
|
|
220
|
+
const reBase64 = (/^[\w-]{21}[AQgw]$/);
|
|
221
|
+
// eslint-disable-next-line unicorn/no-unsafe-regex
|
|
222
|
+
const reBase16 = (/^[\dA-Fa-f]{8}(?:-[\dA-Fa-f]{4}){3}-[\dA-Fa-f]{12}$/);
|
|
223
|
+
/**
|
|
224
|
+
* Routine used to check whether the given string is a valid guid
|
|
225
|
+
*
|
|
226
|
+
* @param in_guid - The guid to test.
|
|
227
|
+
* @returns True if the parameter is a valid guid, false otherwise.
|
|
228
|
+
*/
|
|
229
|
+
const isGUID = (in_guid) => reBase16.test(in_guid) || reBase64.test(in_guid);
|
|
230
|
+
/**
|
|
231
|
+
* Performs a hash combination operation on the two supplied Uint32 arrays of length 4 (using
|
|
232
|
+
* a variant of the algorithm from boost::hash_combine
|
|
233
|
+
*
|
|
234
|
+
* @param in_array1 - First array
|
|
235
|
+
* @param in_array2 - Second array
|
|
236
|
+
* @returns New combined hash
|
|
237
|
+
*/
|
|
238
|
+
const hashCombine4xUint32 = function (in_array1, in_array2, io_result) {
|
|
239
|
+
let accumulated = io_result;
|
|
240
|
+
if (accumulated === undefined) {
|
|
241
|
+
accumulated = new Uint32Array(in_array2);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
accumulated[0] = in_array2[0];
|
|
245
|
+
accumulated[1] = in_array2[1];
|
|
246
|
+
accumulated[2] = in_array2[2];
|
|
247
|
+
accumulated[3] = in_array2[3];
|
|
248
|
+
}
|
|
249
|
+
accumulated[0] += 0x9e3779b9;
|
|
250
|
+
accumulated[1] += 0x638f227;
|
|
251
|
+
accumulated[2] += 0x1aff2bad;
|
|
252
|
+
accumulated[3] += 0x3a8f05c5;
|
|
253
|
+
accumulated[0] += in_array1[3] << 6;
|
|
254
|
+
accumulated[1] += in_array1[0] << 6;
|
|
255
|
+
accumulated[2] += in_array1[1] << 6;
|
|
256
|
+
accumulated[3] += in_array1[2] << 6;
|
|
257
|
+
accumulated[0] += in_array1[2] >> 2;
|
|
258
|
+
accumulated[1] += in_array1[3] >> 2;
|
|
259
|
+
accumulated[2] += in_array1[0] >> 2;
|
|
260
|
+
accumulated[3] += in_array1[1] >> 2;
|
|
261
|
+
accumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;
|
|
262
|
+
accumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;
|
|
263
|
+
accumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;
|
|
264
|
+
accumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;
|
|
265
|
+
return accumulated;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Takes two guids and generates a new derived guid.
|
|
269
|
+
* Note: You should only use this helper function when you need only one combination.
|
|
270
|
+
* Otherwise, it is more efficient to work on the uint8 arrays directly.
|
|
271
|
+
*
|
|
272
|
+
* @param in_guid1 - Input guid
|
|
273
|
+
* @param in_guid2 - Input guid
|
|
274
|
+
* @param base64 - Use base64 encoding instead of standart guids
|
|
275
|
+
* @returns Combined guid
|
|
276
|
+
*/
|
|
277
|
+
const combineGuids = function (in_guid1, in_guid2, base64 = false) {
|
|
278
|
+
const firstArray = guidToUint32x4(in_guid1);
|
|
279
|
+
const secondArray = guidToUint32x4(in_guid2);
|
|
280
|
+
const combined = hashCombine4xUint32(firstArray, secondArray);
|
|
281
|
+
return uint32x4ToGUID(combined, base64);
|
|
282
|
+
};
|
|
283
|
+
// Make sure the RNG is initialized
|
|
284
|
+
guidRNG.initialize();
|
|
285
|
+
const initializeGUIDGenerator = (...args) => { guidRNG.initialize(...args); };
|
|
286
|
+
export const GuidUtils = {
|
|
287
|
+
uint32x4ToGUID,
|
|
288
|
+
guidToUint32x4,
|
|
289
|
+
base64Tobase16,
|
|
290
|
+
base16ToBase64,
|
|
291
|
+
initializeGUIDGenerator,
|
|
292
|
+
generateGUID,
|
|
293
|
+
isGUID,
|
|
294
|
+
combineGuids,
|
|
295
|
+
hashCombine4xUint32,
|
|
296
|
+
};
|
|
297
|
+
//# sourceMappingURL=guidUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidUtils.js","sourceRoot":"","sources":["../src/guidUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+BAA+B;AAE/B;;GAEG;AAEH,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,OAAO,GAAG;IACZ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,aAAa,EAAE,KAAK;IAEpB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,OAAgB,EAAE,6BAAsC,KAAK;QACpE,6DAA6D;QAC7D,sDAAsD;QACtD,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,0BAA0B,EAAE;YACnD,OAAO,CAAC,CAAC;SACZ;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAE1B,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,MAAM,YAAY,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;gBAClD,IAAI,CAAC,CAAC,GAAG,Y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;IACZ,MAAM;IACN,YAAY;IACZ,mBAAmB;CACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\n/**\n * @fileoverview Utility functions related to handling GUIDs\n */\n\nimport base64js from \"base64-js\";\nimport { generateRandomUInt32Array } from \"../platform-dependent\";\nconst UINT_32HASH_PRIME = 16777619;\n\n/**\n * Fast high quality 32 bit RNG for consistent guid.\n *\n * Good \"randomness\" (distribution); Period is approximately equal to 3.11*10^37\n * Implementation was take from \"Numerical recipes. The Art of Scientific Computing.\", 3rd edition.\n * Page 357, algorithm name: Ranlim32\n *\n */\nconst guidRNG = {\n u: 0,\n v: 0,\n w1: 0,\n w2: 0,\n isInitialized: false,\n\n /**\n * Initialize RNG.\n * This function need to be called once, before the first guid gets created.\n *\n * @param in_seed - Optional 32-bit seed for guid RNG;\n * If no seed is given, a combination of system's\n * local time and Math.random() is used.\n * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed\n *\n * @returns The seed used to initialize the RNG;\n * If re-initialization is not enforced,\n * a zero indicates that the RNG was not re-seeded.\n * @alias property-common.initializeGUIDGenerator\n */\n initialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {\n // Quit if the RNG has already been initialized and we do not\n // want to enforce a re-initialization with a new seed\n if (this.isInitialized && !in_enforceReInitialization) {\n return 0;\n } else {\n this.isInitialized = true;\n\n if (in_seed === undefined) {\n const randomValues = generateRandomUInt32Array(4);\n this.u = randomValues[0];\n this.v = randomValues[1];\n this.w1 = randomValues[2];\n this.w2 = randomValues[3];\n } else {\n this.v = 224461437;\n this.w1 = 521288629;\n this.w2 = 362436069;\n\n this.u = in_seed ^ this.v;\n this.genRandUInt32();\n this.v = this.u;\n this.genRandUInt32();\n }\n return -1;\n }\n },\n\n /**\n * @returns 32-bit random number based on the RNGs internal state\n */\n genRandUInt32(): number {\n this.u = multiply_uint32(this.u, 2891336453) + 1640531513;\n this.v ^= this.v >>> 13;\n this.v ^= this.v << 17;\n this.v = ((this.v >>> 5) ^ this.v) >>> 0;\n\n this.w1 = multiply_uint32(33378, (this.w1 & 0xffff)) + (this.w1 >>> 16);\n this.w2 = multiply_uint32(57225, (this.w2 & 0xffff)) + (this.w2 >>> 16);\n\n let x = this.u ^ (this.u << 9);\n x ^= x >>> 17;\n x ^= x << 6;\n\n let y = this.w1 ^ (this.w1 << 17);\n y ^= y >>> 15;\n y ^= y << 5;\n return (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;\n },\n};\n\n/**\n * Check if guid is base64 based on the length\n * The length of base16 guid is 36, base64 - 22\n *\n * @param guid - Input guid\n * @returns True if guid is base64\n */\nconst isBase64 = (guid: string): boolean => guid.length === 22;\n\n/**\n * Allows for 32-bit integer multiplication with C-like semantics\n *\n * @param a - unsigned int32 value\n * @param b - unsigned int32 value\n * @returns - result of unsigned integer multiplication\n */\nfunction multiply_uint32(a: number, b: number): number {\n let n = a;\n let m = b;\n\n n >>>= 0;\n m >>>= 0;\n const nlo = n & 0xffff;\n return (((n - nlo) * m >>> 0) + (nlo * m)) >>> 0;\n}\n\n/**\n * Helper function to convert base64 encoding to url friendly format\n *\n * @param base64 - Base64 string\n *\n * @returns Url-friendly base64 encoding.\n */\nconst toUrlBase64 = (base64: string): string => base64.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").split(\"=\")[0];\n\n/**\n * Helper function to recover padding of base64 encoding\n *\n * @param x - Base64 string\n *\n * @returns Padded base64 encoding.\n */\nconst toPaddedBase64 = function(x: string): string {\n let base64 = x;\n const padLength = 4 - base64.length % 4;\n base64 += \"=\".repeat(padLength);\n return base64;\n};\n\n/**\n * Helper function to create a guid string from an array with 32Bit values\n *\n * @param in_guidArray - Array with the 32 bit values\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The guid\n */\nconst uint32x4ToGUID = function(in_guidArray: Uint32Array | Int32Array | number[], base64: boolean = false): string {\n if (base64) {\n const intArray = new Uint32Array(in_guidArray);\n const byteArray = new Uint8Array(intArray.buffer);\n const base64guid = base64js.fromByteArray(byteArray);\n // return url-friendly base64\n return toUrlBase64(base64guid);\n } else {\n // Convert to hexadecimal string\n let str = \"\";\n for (let i = 0; i < 4; i++) {\n const hex = in_guidArray[i].toString(16);\n str += (\"0\".repeat(8 - hex.length) + hex);\n }\n // eslint-disable-next-line max-len\n return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;\n }\n};\n\n/**\n * Convert guid to four 32Bit values.\n *\n * @param in_guid - The guid to convert\n * @param io_result - An optional array to write the result to;\n * If no array is given, a new one gets created\n * @returns Four 32-bit values\n *\n */\nconst guidToUint32x4 = function(in_guid: string, result: Uint32Array = new Uint32Array(4)): Uint32Array {\n if (isBase64(in_guid)) {\n const guid = toPaddedBase64(in_guid);\n const bytes = base64js.toByteArray(guid);\n const intArray = new Uint32Array(bytes.buffer);\n result.set(intArray);\n } else {\n result[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);\n result[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);\n result[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);\n result[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);\n }\n return result;\n};\n\n/**\n * Convert base64 guid into base16.\n *\n * @param in_guid - Base64 guid to convert\n * @returns Base16 guid\n *\n */\nconst base64Tobase16 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid));\n\n/**\n * Convert base16 into base64 guid.\n *\n * @param in_guid - Base16 guid to convert\n * @returns Base64 guid\n *\n */\nconst base16ToBase64 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_guid), true);\n\n/**\n * Based on the boolean parameter generate either\n * a 128 bit base16 guid with the following format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx\n * or url-friendly base64 string guid of length 22\n *\n * This function is *not* thread safe!\n *\n * @param base64 - Use base64 encoding instead of standart guids\n *\n * @returns The guid\n */\nconst generateGUID = function(base64 = false): string {\n const rnds = new Uint32Array(4);\n\n // Random numbers for guid (4x32 bit)\n rnds[0] = guidRNG.genRandUInt32();\n rnds[1] = guidRNG.genRandUInt32();\n rnds[2] = guidRNG.genRandUInt32();\n rnds[3] = guidRNG.genRandUInt32();\n return uint32x4ToGUID(rnds, base64);\n};\n\n// The last character is checked this way because last 4 bits of 22nd character are ignored\n// by decoder, e.g. \"+Q\" and \"+Z\" result in the same decoding.\n// The only characters with last 4 bits set to 0 are A, Q, g, w.\nconst reBase64 = (/^[\\w-]{21}[AQgw]$/);\n// eslint-disable-next-line unicorn/no-unsafe-regex\nconst reBase16 = (/^[\\dA-Fa-f]{8}(?:-[\\dA-Fa-f]{4}){3}-[\\dA-Fa-f]{12}$/);\n\n/**\n * Routine used to check whether the given string is a valid guid\n *\n * @param in_guid - The guid to test.\n * @returns True if the parameter is a valid guid, false otherwise.\n */\nconst isGUID = (in_guid: string) => reBase16.test(in_guid) || reBase64.test(in_guid);\n\n/**\n * Performs a hash combination operation on the two supplied Uint32 arrays of length 4 (using\n * a variant of the algorithm from boost::hash_combine\n *\n * @param in_array1 - First array\n * @param in_array2 - Second array\n * @returns New combined hash\n */\nconst hashCombine4xUint32 = function(\n in_array1: Uint32Array,\n in_array2: Uint32Array,\n io_result?: Uint32Array,\n): Uint32Array {\n let accumulated = io_result;\n if (accumulated === undefined) {\n accumulated = new Uint32Array(in_array2);\n } else {\n accumulated[0] = in_array2[0];\n accumulated[1] = in_array2[1];\n accumulated[2] = in_array2[2];\n accumulated[3] = in_array2[3];\n }\n\n accumulated[0] += 0x9e3779b9;\n accumulated[1] += 0x638f227;\n accumulated[2] += 0x1aff2bad;\n accumulated[3] += 0x3a8f05c5;\n\n accumulated[0] += in_array1[3] << 6;\n accumulated[1] += in_array1[0] << 6;\n accumulated[2] += in_array1[1] << 6;\n accumulated[3] += in_array1[2] << 6;\n\n accumulated[0] += in_array1[2] >> 2;\n accumulated[1] += in_array1[3] >> 2;\n accumulated[2] += in_array1[0] >> 2;\n accumulated[3] += in_array1[1] >> 2;\n\n accumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;\n accumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;\n\n return accumulated;\n};\n\n/**\n * Takes two guids and generates a new derived guid.\n * Note: You should only use this helper function when you need only one combination.\n * Otherwise, it is more efficient to work on the uint8 arrays directly.\n *\n * @param in_guid1 - Input guid\n * @param in_guid2 - Input guid\n * @param base64 - Use base64 encoding instead of standart guids\n * @returns Combined guid\n */\nconst combineGuids = function(in_guid1: string, in_guid2: string, base64 = false): string {\n const firstArray = guidToUint32x4(in_guid1);\n const secondArray = guidToUint32x4(in_guid2);\n const combined = hashCombine4xUint32(firstArray, secondArray);\n return uint32x4ToGUID(combined, base64);\n};\n\n// Make sure the RNG is initialized\nguidRNG.initialize();\n\nconst initializeGUIDGenerator = (...args) => { guidRNG.initialize(...args); };\n\nexport const GuidUtils = {\n uint32x4ToGUID,\n guidToUint32x4,\n base64Tobase16,\n base16ToBase64,\n initializeGUIDGenerator,\n generateGUID,\n isGUID,\n combineGuids,\n hashCombine4xUint32,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashCalculator.d.ts","sourceRoot":"","sources":["../src/hashCalculator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,wBAAgB,aAAa,CAAC,GAAG,KAAA,EAAE,IAAI,SAAI,UAG1C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Utility class to compute an hash for a given set of variables
|
|
7
|
+
* using the murmur3 hash (see https://code.google.com/p/smhasher/)
|
|
8
|
+
*/
|
|
9
|
+
import murmurHash3 from "murmurhash3js";
|
|
10
|
+
export function calculateHash(key, seed = 0) {
|
|
11
|
+
const str = murmurHash3.x86.hash128(key, seed);
|
|
12
|
+
return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=hashCalculator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashCalculator.js","sourceRoot":"","sources":["../src/hashCalculator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,MAAM,UAAU,aAAa,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC;IACvC,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/C,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AACrH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Utility class to compute an hash for a given set of variables\n * using the murmur3 hash (see https://code.google.com/p/smhasher/)\n */\n\nimport murmurHash3 from \"murmurhash3js\";\n\nexport function calculateHash(key, seed = 0) {\n const str = murmurHash3.x86.hash128(key, seed);\n return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./constants";
|
|
6
|
+
export * from "./consoleUtils";
|
|
7
|
+
export * from "./chronometer";
|
|
8
|
+
export * from "./joinPaths";
|
|
9
|
+
export * from "./guidUtils";
|
|
10
|
+
export * from "./error_objects";
|
|
11
|
+
export * from "./deferredPromise";
|
|
12
|
+
export * from "./deterministicRandomGenerator";
|
|
13
|
+
export * from "./hashCalculator";
|
|
14
|
+
export * from "./datastructures";
|
|
15
|
+
export { EventEmitter } from "events";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./constants";
|
|
6
|
+
export * from "./consoleUtils";
|
|
7
|
+
export * from "./chronometer";
|
|
8
|
+
export * from "./joinPaths";
|
|
9
|
+
export * from "./guidUtils";
|
|
10
|
+
export * from "./error_objects";
|
|
11
|
+
export * from "./deferredPromise";
|
|
12
|
+
export * from "./deterministicRandomGenerator";
|
|
13
|
+
export * from "./hashCalculator";
|
|
14
|
+
export * from "./datastructures";
|
|
15
|
+
export { EventEmitter } from "events";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./constants\";\nexport * from \"./consoleUtils\";\nexport * from \"./chronometer\";\nexport * from \"./joinPaths\";\nexport * from \"./guidUtils\";\nexport * from \"./error_objects\";\nexport * from \"./deferredPromise\";\nexport * from \"./deterministicRandomGenerator\";\nexport * from \"./hashCalculator\";\nexport * from \"./datastructures\";\nexport { EventEmitter } from \"events\";\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview implements a joinPaths routine to merge two paths.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Merges two strings with a separator. If one of the two is empty no separator will be added.
|
|
10
|
+
* No duplicated separators will be joined
|
|
11
|
+
*
|
|
12
|
+
* @param in_string1 - The first string to join
|
|
13
|
+
* @param in_string2 - The second string to join
|
|
14
|
+
* @param in_separator - The path separator
|
|
15
|
+
*
|
|
16
|
+
* @returns The joined path
|
|
17
|
+
*/
|
|
18
|
+
export declare function joinPaths(in_string1?: string, in_string2?: string, in_separator?: string): string;
|
|
19
|
+
//# sourceMappingURL=joinPaths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinPaths.d.ts","sourceRoot":"","sources":["../src/joinPaths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,UAAU,GAAE,MAAW,EAAE,UAAU,GAAE,MAAW,EAAE,YAAY,GAAE,MAAY,GAAG,MAAM,CAU9G"}
|
package/lib/joinPaths.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview implements a joinPaths routine to merge two paths.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Merges two strings with a separator. If one of the two is empty no separator will be added.
|
|
10
|
+
* No duplicated separators will be joined
|
|
11
|
+
*
|
|
12
|
+
* @param in_string1 - The first string to join
|
|
13
|
+
* @param in_string2 - The second string to join
|
|
14
|
+
* @param in_separator - The path separator
|
|
15
|
+
*
|
|
16
|
+
* @returns The joined path
|
|
17
|
+
*/
|
|
18
|
+
export function joinPaths(in_string1 = "", in_string2 = "", in_separator = "/") {
|
|
19
|
+
let separator = in_separator;
|
|
20
|
+
if (!in_string1 ||
|
|
21
|
+
!in_string2 ||
|
|
22
|
+
in_string1.substr(-in_separator.length) === in_separator ||
|
|
23
|
+
in_string2.substr(0, in_separator.length) === in_separator) {
|
|
24
|
+
separator = "";
|
|
25
|
+
}
|
|
26
|
+
return in_string1 + separator + in_string2;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=joinPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joinPaths.js","sourceRoot":"","sources":["../src/joinPaths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,aAAqB,EAAE,EAAE,aAAqB,EAAE,EAAE,eAAuB,GAAG;IAClG,IAAI,SAAS,GAAG,YAAY,CAAC;IAE7B,IAAI,CAAC,UAAU;QACX,CAAC,UAAU;QACX,UAAU,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,YAAY;QACxD,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,YAAY,EAAE;QAC5D,SAAS,GAAG,EAAE,CAAC;KAClB;IACD,OAAO,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAC/C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview implements a joinPaths routine to merge two paths.\n */\n\n/**\n * Merges two strings with a separator. If one of the two is empty no separator will be added.\n * No duplicated separators will be joined\n *\n * @param in_string1 - The first string to join\n * @param in_string2 - The second string to join\n * @param in_separator - The path separator\n *\n * @returns The joined path\n */\nexport function joinPaths(in_string1: string = \"\", in_string2: string = \"\", in_separator: string = \"/\"): string {\n let separator = in_separator;\n\n if (!in_string1 ||\n !in_string2 ||\n in_string1.substr(-in_separator.length) === in_separator ||\n in_string2.substr(0, in_separator.length) === in_separator) {\n separator = \"\";\n }\n return in_string1 + separator + in_string2;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
+
*/
|
|
7
|
+
export declare const pkgName = "@fluid-experimental/property-common";
|
|
8
|
+
export declare const pkgVersion = "0.50.0-41540";
|
|
9
|
+
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,wCAAwC,CAAC;AAC7D,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
|
+
*/
|
|
7
|
+
export const pkgName = "@fluid-experimental/property-common";
|
|
8
|
+
export const pkgVersion = "0.50.0-41540";
|
|
9
|
+
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-experimental/property-common\";\nexport const pkgVersion = \"0.50.0-41540\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-experimental/property-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0-41540",
|
|
4
4
|
"description": "common functions used in properties",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -32,6 +32,26 @@
|
|
|
32
32
|
"tsfmt": "tsfmt --verify",
|
|
33
33
|
"tsfmt:fix": "tsfmt --replace"
|
|
34
34
|
},
|
|
35
|
+
"nyc": {
|
|
36
|
+
"all": true,
|
|
37
|
+
"cache-dir": "nyc/.cache",
|
|
38
|
+
"exclude": [
|
|
39
|
+
"src/test/**/*.ts",
|
|
40
|
+
"dist/test/**/*.js"
|
|
41
|
+
],
|
|
42
|
+
"exclude-after-remap": false,
|
|
43
|
+
"include": [
|
|
44
|
+
"src/**/*.ts",
|
|
45
|
+
"dist/**/*.js"
|
|
46
|
+
],
|
|
47
|
+
"report-dir": "nyc/report",
|
|
48
|
+
"reporter": [
|
|
49
|
+
"cobertura",
|
|
50
|
+
"html",
|
|
51
|
+
"text"
|
|
52
|
+
],
|
|
53
|
+
"temp-directory": "nyc/.nyc_output"
|
|
54
|
+
},
|
|
35
55
|
"dependencies": {
|
|
36
56
|
"ajv": "7.1.1",
|
|
37
57
|
"async": "^3.2.0",
|
|
@@ -45,7 +65,7 @@
|
|
|
45
65
|
"devDependencies": {
|
|
46
66
|
"@fluidframework/build-common": "^0.23.0",
|
|
47
67
|
"@fluidframework/eslint-config-fluid": "^0.23.0",
|
|
48
|
-
"@fluidframework/mocha-test-setup": "
|
|
68
|
+
"@fluidframework/mocha-test-setup": "0.50.0-41540",
|
|
49
69
|
"@microsoft/api-extractor": "^7.16.1",
|
|
50
70
|
"@types/debug": "^4.1.5",
|
|
51
71
|
"@types/mocha": "^8.2.2",
|
package/src/constants.ts
CHANGED
|
@@ -713,6 +713,11 @@ const PropertyError = {
|
|
|
713
713
|
INSERT_NOT_A_PROP: "PR-141: In an array of properties, you can only insert instances of " +
|
|
714
714
|
"properties. This value is not valid: ",
|
|
715
715
|
|
|
716
|
+
/**
|
|
717
|
+
* If a property is a reference, it cannot be changed.
|
|
718
|
+
*/
|
|
719
|
+
MODIFICATION_OF_REFERENCED_PROPERTY: "PR-142: Modifications of referenced properties are not allowed.",
|
|
720
|
+
|
|
716
721
|
/**
|
|
717
722
|
* methods: Property.getValue
|
|
718
723
|
* Property.getValue(in_ids) is a shortcut for Property.get(in_ids).getValue().
|
package/src/packageVersion.ts
CHANGED