infinispan 0.13.0 → 0.15.0
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/.githooks/commit-msg +9 -0
- package/.githooks/configure-hooks +7 -0
- package/.githooks/configure-hooks.bat +15 -0
- package/.gitmessage +7 -0
- package/AI-CODE.md +86 -0
- package/README.md +52 -80
- package/lib/codec.js +396 -28
- package/lib/functional.js +65 -7
- package/lib/infinispan.js +591 -69
- package/lib/io.js +402 -44
- package/lib/listeners.js +166 -5
- package/lib/near-cache.js +99 -0
- package/lib/protocols.js +580 -82
- package/lib/sasl/digest.js +22 -17
- package/lib/sasl/external.js +7 -4
- package/lib/sasl/factory.js +6 -5
- package/lib/sasl/oauthbearer.js +7 -5
- package/lib/sasl/plain.js +6 -4
- package/lib/sasl/scram.js +19 -11
- package/lib/uri.js +206 -0
- package/lib/utils.js +89 -24
- package/package.json +10 -4
- package/server/.keep +0 -0
- package/types/index.d.ts +236 -1
package/lib/functional.js
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
var _ = require('underscore');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Checks whether a value exists (is not null or undefined).
|
|
7
|
+
* @param {*} x Value to check.
|
|
8
|
+
* @returns {boolean} True if the value is not null or undefined.
|
|
9
|
+
*/
|
|
10
|
+
function existy(x) { return x != null; }
|
|
6
11
|
exports.existy = existy;
|
|
7
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Concatenates multiple arrays into a single array.
|
|
15
|
+
* @param {...Array} arguments Arrays to concatenate.
|
|
16
|
+
* @returns {Array} Concatenated array.
|
|
17
|
+
*/
|
|
8
18
|
function cat() {
|
|
9
19
|
var head = _.first(arguments);
|
|
10
20
|
if (existy(head))
|
|
@@ -14,6 +24,12 @@
|
|
|
14
24
|
}
|
|
15
25
|
exports.cat = cat;
|
|
16
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Prepends a head element to a tail collection, returning a new array.
|
|
29
|
+
* @param {*} head Element to prepend.
|
|
30
|
+
* @param {Array|Arguments} tail Collection to append after head.
|
|
31
|
+
* @returns {Array} New array with head followed by tail elements.
|
|
32
|
+
*/
|
|
17
33
|
function construct(head, tail) {
|
|
18
34
|
return cat([head], _.toArray(tail));
|
|
19
35
|
}
|
|
@@ -64,8 +80,8 @@
|
|
|
64
80
|
};
|
|
65
81
|
};
|
|
66
82
|
|
|
67
|
-
exports.greaterThan = exports.curry2(function (lhs, rhs) { return lhs > rhs });
|
|
68
|
-
exports.lessThan = exports.curry2(function (lhs, rhs) { return lhs < rhs });
|
|
83
|
+
exports.greaterThan = exports.curry2(function (lhs, rhs) { return lhs > rhs; });
|
|
84
|
+
exports.lessThan = exports.curry2(function (lhs, rhs) { return lhs < rhs; });
|
|
69
85
|
|
|
70
86
|
exports.lift = function lift(answerFun, stateFun) {
|
|
71
87
|
return function(/* args */) {
|
|
@@ -101,6 +117,12 @@
|
|
|
101
117
|
};
|
|
102
118
|
};
|
|
103
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Maps a function over a collection and concatenates the results.
|
|
122
|
+
* @param {Function} fun Mapping function returning arrays.
|
|
123
|
+
* @param {Array} coll Collection to map over.
|
|
124
|
+
* @returns {Array} Concatenated results.
|
|
125
|
+
*/
|
|
104
126
|
function mapcat(fun, coll) {
|
|
105
127
|
return cat.apply(null, _.map(coll, fun));
|
|
106
128
|
}
|
|
@@ -131,8 +153,19 @@
|
|
|
131
153
|
};
|
|
132
154
|
|
|
133
155
|
exports.truthy = truthy;
|
|
134
|
-
|
|
135
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Checks whether a value is truthy (not false, null, or undefined).
|
|
158
|
+
* @param {*} x Value to check.
|
|
159
|
+
* @returns {boolean} True if the value is truthy.
|
|
160
|
+
*/
|
|
161
|
+
function truthy(x) { return (x !== false) && existy(x); }
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Executes an action if the condition is truthy, otherwise returns undefined.
|
|
165
|
+
* @param {*} cond Condition to evaluate.
|
|
166
|
+
* @param {Function} action Function to invoke if condition is truthy.
|
|
167
|
+
* @returns {*} Result of action if condition is truthy, undefined otherwise.
|
|
168
|
+
*/
|
|
136
169
|
function doWhen(cond, action) {
|
|
137
170
|
if(truthy(cond))
|
|
138
171
|
return action();
|
|
@@ -160,6 +193,31 @@
|
|
|
160
193
|
return _.extend.apply(null, construct({}, arguments));
|
|
161
194
|
};
|
|
162
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Deep merges multiple objects, with later arguments taking precedence.
|
|
198
|
+
* @returns {Object} A new merged object.
|
|
199
|
+
*/
|
|
200
|
+
exports.deepMerge = function(/*args*/) {
|
|
201
|
+
var sources = _.toArray(arguments);
|
|
202
|
+
var result = {};
|
|
203
|
+
for (var i = 0; i < sources.length; i++) {
|
|
204
|
+
var src = sources[i];
|
|
205
|
+
if (!existy(src)) continue;
|
|
206
|
+
var keys = _.keys(src);
|
|
207
|
+
for (var k = 0; k < keys.length; k++) {
|
|
208
|
+
var key = keys[k];
|
|
209
|
+
var val = src[key];
|
|
210
|
+
if (!existy(val)) continue;
|
|
211
|
+
if (_.isObject(val) && !_.isArray(val) && _.isObject(result[key]) && !_.isArray(result[key])) {
|
|
212
|
+
result[key] = exports.deepMerge(result[key], val);
|
|
213
|
+
} else {
|
|
214
|
+
result[key] = val;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
};
|
|
220
|
+
|
|
163
221
|
exports.dispatch = function(/* funs */) {
|
|
164
222
|
var funs = _.toArray(arguments);
|
|
165
223
|
var size = funs.length;
|
|
@@ -183,7 +241,7 @@
|
|
|
183
241
|
return function(obj) {
|
|
184
242
|
if (type === obj)
|
|
185
243
|
return action(obj);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
244
|
+
};
|
|
245
|
+
};
|
|
188
246
|
|
|
189
247
|
}.call(this));
|