@rentman/rm-core 1.0.0 → 1.0.2
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/definitions/classes/ApiFormatter.d.ts +36 -0
- package/dist/definitions/classes/BatchStatus.d.ts +16 -0
- package/dist/definitions/classes/ChangesCompiler.d.ts +34 -0
- package/dist/definitions/classes/ChangesProcessor.d.ts +46 -0
- package/dist/definitions/classes/CollectionCache.d.ts +39 -0
- package/dist/definitions/classes/CollectionEntryService.d.ts +15 -0
- package/dist/definitions/classes/CollectionHandler.d.ts +79 -0
- package/dist/definitions/classes/CollectionResourceService.d.ts +5 -0
- package/dist/definitions/classes/ColumnCache.d.ts +18 -0
- package/dist/definitions/classes/ColumnExpansion.d.ts +16 -0
- package/dist/definitions/classes/ColumnHandler.d.ts +19 -0
- package/dist/definitions/classes/ColumnSet.d.ts +54 -0
- package/dist/definitions/classes/ColumnUtil.d.ts +80 -0
- package/dist/definitions/classes/CreateRequest.d.ts +28 -0
- package/dist/definitions/classes/ItemAdministrator.d.ts +114 -0
- package/dist/definitions/classes/ItemCache.d.ts +22 -0
- package/dist/definitions/classes/ItemEntryService.d.ts +50 -0
- package/dist/definitions/classes/ItemHandler.d.ts +70 -0
- package/dist/definitions/classes/ItemRequestService.d.ts +31 -0
- package/dist/definitions/classes/ItemResourceService.d.ts +8 -0
- package/dist/definitions/classes/KeyService.d.ts +28 -0
- package/dist/definitions/classes/LockService.d.ts +25 -0
- package/dist/definitions/classes/ModuleChangesCompiler.d.ts +18 -0
- package/dist/definitions/classes/PromiseService.d.ts +10 -0
- package/dist/definitions/classes/QueryMatcher.d.ts +14 -0
- package/dist/definitions/classes/QueryParser.d.ts +16 -0
- package/dist/definitions/classes/QueryService.d.ts +19 -0
- package/dist/definitions/classes/RequestColumnExpansion.d.ts +9 -0
- package/dist/definitions/classes/ResourceCache.d.ts +78 -0
- package/dist/definitions/classes/Util.d.ts +25 -0
- package/dist/definitions/constants.d.ts +10 -0
- package/dist/definitions/factories/BatchStatusFactory.d.ts +8 -0
- package/dist/definitions/factories/ChangesCompilerFactory.d.ts +9 -0
- package/dist/definitions/factories/ChangesProcessorFactory.d.ts +31 -0
- package/{src/factories/CollectionCacheFactory.ts → dist/definitions/factories/CollectionCacheFactory.d.ts} +3 -11
- package/dist/definitions/factories/CollectionEntryFactory.d.ts +19 -0
- package/dist/definitions/factories/CollectionResourceFactory.d.ts +18 -0
- package/dist/definitions/factories/ColumnExpansionFactory.d.ts +11 -0
- package/dist/definitions/factories/ColumnSetFactory.d.ts +9 -0
- package/dist/definitions/factories/CreateRequestFactory.d.ts +13 -0
- package/dist/definitions/factories/ItemCacheFactory.d.ts +9 -0
- package/dist/definitions/factories/ItemEntryFactory.d.ts +6 -0
- package/dist/definitions/factories/ItemResourceFactory.d.ts +12 -0
- package/{src/factories/ModuleChangesCompilerFactory.ts → dist/definitions/factories/ModuleChangesCompilerFactory.d.ts} +3 -14
- package/dist/definitions/factories/QueryMatcherFactory.d.ts +7 -0
- package/dist/definitions/factories/QueryParserFactory.d.ts +5 -0
- package/{src/factories/RequestColumnExpansionFactory.ts → dist/definitions/factories/RequestColumnExpansionFactory.d.ts} +3 -11
- package/dist/definitions/factories/ResourceCacheFactory.d.ts +33 -0
- package/dist/definitions/index.d.ts +121 -0
- package/dist/definitions/interfaces/ApiRequestServiceInterface.d.ts +10 -0
- package/dist/definitions/interfaces/AuthInterface.d.ts +4 -0
- package/{src/interfaces/ErrorHandlerInterface.ts → dist/definitions/interfaces/ErrorHandlerInterface.d.ts} +2 -2
- package/dist/definitions/interfaces/ResourceCacheInterface.d.ts +6 -0
- package/dist/definitions/models/CollectionEditResource.d.ts +23 -0
- package/dist/definitions/models/CollectionEntry.d.ts +61 -0
- package/dist/definitions/models/CollectionResource.d.ts +29 -0
- package/{src/models/CollectionViewResource.ts → dist/definitions/models/CollectionViewResource.d.ts} +6 -13
- package/dist/definitions/models/EditResource.d.ts +7 -0
- package/dist/definitions/models/ItemEntry.d.ts +18 -0
- package/dist/definitions/models/ItemResource.d.ts +14 -0
- package/dist/definitions/models/ViewResource.d.ts +7 -0
- package/dist/rm-core.js +29 -0
- package/dist/rm-core.js.map +1 -0
- package/package.json +5 -1
- package/.editorconfig +0 -23
- package/src/classes/ApiFormatter.ts +0 -338
- package/src/classes/BatchStatus.ts +0 -86
- package/src/classes/ChangesCompiler.ts +0 -161
- package/src/classes/ChangesProcessor.ts +0 -475
- package/src/classes/CollectionCache.ts +0 -234
- package/src/classes/CollectionEntryService.ts +0 -83
- package/src/classes/CollectionHandler.ts +0 -619
- package/src/classes/CollectionResourceService.ts +0 -38
- package/src/classes/ColumnCache.ts +0 -114
- package/src/classes/ColumnExpansion.ts +0 -74
- package/src/classes/ColumnHandler.ts +0 -90
- package/src/classes/ColumnSet.ts +0 -181
- package/src/classes/ColumnUtil.ts +0 -589
- package/src/classes/CreateRequest.ts +0 -158
- package/src/classes/ItemAdministrator.ts +0 -571
- package/src/classes/ItemCache.ts +0 -158
- package/src/classes/ItemEntryService.ts +0 -488
- package/src/classes/ItemHandler.ts +0 -592
- package/src/classes/ItemRequestService.ts +0 -229
- package/src/classes/ItemResourceService.ts +0 -36
- package/src/classes/KeyService.ts +0 -76
- package/src/classes/LockService.ts +0 -184
- package/src/classes/ModuleChangesCompiler.ts +0 -123
- package/src/classes/PromiseService.ts +0 -19
- package/src/classes/QueryMatcher.ts +0 -135
- package/src/classes/QueryParser.ts +0 -209
- package/src/classes/QueryService.ts +0 -35
- package/src/classes/RequestColumnExpansion.ts +0 -31
- package/src/classes/ResourceCache.ts +0 -289
- package/src/classes/Util.ts +0 -422
- package/src/constants.ts +0 -11
- package/src/factories/BatchStatusFactory.ts +0 -18
- package/src/factories/ChangesCompilerFactory.ts +0 -20
- package/src/factories/ChangesProcessorFactory.ts +0 -53
- package/src/factories/CollectionEntryFactory.ts +0 -35
- package/src/factories/CollectionResourceFactory.ts +0 -36
- package/src/factories/ColumnExpansionFactory.ts +0 -25
- package/src/factories/ColumnSetFactory.ts +0 -24
- package/src/factories/CreateRequestFactory.ts +0 -28
- package/src/factories/ItemCacheFactory.ts +0 -18
- package/src/factories/ItemEntryFactory.ts +0 -18
- package/src/factories/ItemResourceFactory.ts +0 -28
- package/src/factories/QueryMatcherFactory.ts +0 -20
- package/src/factories/QueryParserFactory.ts +0 -10
- package/src/factories/ResourceCacheFactory.ts +0 -55
- package/src/index.ts +0 -188
- package/src/interfaces/ApiRequestServiceInterface.ts +0 -17
- package/src/interfaces/AuthInterface.ts +0 -5
- package/src/interfaces/ResourceCacheInterface.ts +0 -9
- package/src/models/CollectionEditResource.ts +0 -139
- package/src/models/CollectionEntry.ts +0 -448
- package/src/models/CollectionResource.ts +0 -223
- package/src/models/EditResource.ts +0 -15
- package/src/models/ItemEntry.ts +0 -24
- package/src/models/ItemResource.ts +0 -35
- package/src/models/ViewResource.ts +0 -14
- package/tsconfig.json +0 -12
- package/tslint.json +0 -63
- package/webpack.common.js +0 -35
- package/webpack.dev.js +0 -10
- package/webpack.prod.js +0 -17
package/src/classes/Util.ts
DELETED
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
export function shallowMerge (object, defaults) {
|
|
2
|
-
if (object === undefined)
|
|
3
|
-
return defaults;
|
|
4
|
-
|
|
5
|
-
const result = {};
|
|
6
|
-
|
|
7
|
-
for (const key in defaults) {
|
|
8
|
-
result[key] = object[key] === undefined ?
|
|
9
|
-
defaults[key] : object[key];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function hasProperties (object) {
|
|
16
|
-
for (const key in object)
|
|
17
|
-
return true;
|
|
18
|
-
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getFirstProperty (object) {
|
|
23
|
-
if (typeof object !== 'object')
|
|
24
|
-
return null;
|
|
25
|
-
|
|
26
|
-
for (const key in object)
|
|
27
|
-
return key;
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function inArray (needle, haystack) {
|
|
33
|
-
for (const hay of haystack) {
|
|
34
|
-
// tslint:disable:triple-equals
|
|
35
|
-
if (needle == hay)
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function filterArray (source, callback) {
|
|
43
|
-
const filtered = [];
|
|
44
|
-
|
|
45
|
-
for (const src of source) {
|
|
46
|
-
if (callback(src))
|
|
47
|
-
filtered.push(src);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (filtered.length === source.length)
|
|
51
|
-
return false;
|
|
52
|
-
|
|
53
|
-
emptyArray(source);
|
|
54
|
-
|
|
55
|
-
for (const filter of filtered)
|
|
56
|
-
source.push(filter);
|
|
57
|
-
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function emptyArray (array) {
|
|
62
|
-
array.splice(0);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function pathExists (source, path) {
|
|
66
|
-
if (typeof source === 'undefined')
|
|
67
|
-
return false;
|
|
68
|
-
|
|
69
|
-
for (const p of path) {
|
|
70
|
-
if (typeof source[p] === 'undefined')
|
|
71
|
-
return false;
|
|
72
|
-
|
|
73
|
-
source = source[p];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function createPath (object, path, defaults) {
|
|
80
|
-
for (let i = 0; i < path.length; i++) {
|
|
81
|
-
const value = path[i];
|
|
82
|
-
|
|
83
|
-
if (object[value] === undefined)
|
|
84
|
-
object[value] = defaults[i];
|
|
85
|
-
|
|
86
|
-
object = object[value];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return object;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function getPath (object, path, create = false) {
|
|
93
|
-
if (object === undefined)
|
|
94
|
-
return undefined;
|
|
95
|
-
|
|
96
|
-
for (const p of path) {
|
|
97
|
-
object = object[p]; // won't alter the caller's var
|
|
98
|
-
|
|
99
|
-
if (object === undefined && !create)
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return object;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Taken from AngularJS
|
|
107
|
-
function baseExtend (dst, objs, deep) {
|
|
108
|
-
for (let i = 0, ii = objs.length; i < ii; ++i) {
|
|
109
|
-
const obj = objs[i];
|
|
110
|
-
|
|
111
|
-
if (!isObject(obj) && !isFunction(obj))
|
|
112
|
-
continue;
|
|
113
|
-
|
|
114
|
-
const keys = Object.keys(obj);
|
|
115
|
-
|
|
116
|
-
for (let j = 0, jj = keys.length; j < jj; j++) {
|
|
117
|
-
const key = keys[j];
|
|
118
|
-
const src = obj[key];
|
|
119
|
-
|
|
120
|
-
if (deep && isObject(src)) {
|
|
121
|
-
if (isDate(src)) {
|
|
122
|
-
dst[key] = new Date(src.valueOf());
|
|
123
|
-
} else if (isRegExp(src)) {
|
|
124
|
-
dst[key] = new RegExp(src);
|
|
125
|
-
} else if (src.nodeName) {
|
|
126
|
-
dst[key] = src.cloneNode(true);
|
|
127
|
-
} else if (isElement(src)) {
|
|
128
|
-
dst[key] = src.clone();
|
|
129
|
-
} else {
|
|
130
|
-
if (!isObject(dst[key]))
|
|
131
|
-
dst[key] = isArray(src) ? [] : {};
|
|
132
|
-
|
|
133
|
-
baseExtend(dst[key], [src], true);
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
dst[key] = src;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return dst;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function extend (dst, ...args) {
|
|
145
|
-
return baseExtend(dst, args, false);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function merge (dst, ...args) {
|
|
149
|
-
return baseExtend(dst, args, true);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function isObject (value) {
|
|
153
|
-
// http://jsperf.com/isobject4
|
|
154
|
-
return value !== null && typeof value === 'object';
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function isBlankObject (value) {
|
|
158
|
-
return value !== null && typeof value === 'object' && !Object.getPrototypeOf(value);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export function isString (value) {
|
|
162
|
-
return typeof value === 'string';
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export function isNumber (value) {
|
|
166
|
-
return typeof value === 'number';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export function isDate (value) {
|
|
170
|
-
return toString.call(value) === '[object Date]';
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export const isArray = Array.isArray;
|
|
174
|
-
|
|
175
|
-
export function isFunction (value) {
|
|
176
|
-
return typeof value === 'function';
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function isRegExp (value) {
|
|
180
|
-
return toString.call(value) === '[object RegExp]';
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export function isBoolean (value) {
|
|
184
|
-
return typeof value === 'boolean';
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function isElement (node) {
|
|
188
|
-
return !!(node &&
|
|
189
|
-
(
|
|
190
|
-
node.nodeName // We are a direct element.
|
|
191
|
-
|| (node.prop && node.attr && node.find)
|
|
192
|
-
)
|
|
193
|
-
); // We have an on and find method part of jQuery API.
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function isWindow (obj) {
|
|
197
|
-
return obj && obj.window === obj;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export function isDefined (value) {
|
|
201
|
-
return typeof value !== 'undefined';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function equals (o1, o2) {
|
|
205
|
-
if (o1 === o2)
|
|
206
|
-
return true;
|
|
207
|
-
|
|
208
|
-
if (o1 === null || o2 === null)
|
|
209
|
-
return false;
|
|
210
|
-
|
|
211
|
-
// eslint-disable-next-line no-self-compare
|
|
212
|
-
if (o1 !== o1 && o2 !== o2)
|
|
213
|
-
return true; // NaN === NaN
|
|
214
|
-
|
|
215
|
-
const t1 = typeof o1;
|
|
216
|
-
const t2 = typeof o2;
|
|
217
|
-
|
|
218
|
-
let length;
|
|
219
|
-
let key;
|
|
220
|
-
let keySet;
|
|
221
|
-
|
|
222
|
-
if (t1 === t2 && t1 === 'object') {
|
|
223
|
-
if (isArray(o1)) {
|
|
224
|
-
if (!isArray(o2))
|
|
225
|
-
return false;
|
|
226
|
-
|
|
227
|
-
length = o1.length;
|
|
228
|
-
|
|
229
|
-
if (o1.length === o2.length) {
|
|
230
|
-
for (key = 0; key < length; key++) {
|
|
231
|
-
if (!equals(o1[key], o2[key]))
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
} else if (isDate(o1)) {
|
|
238
|
-
if (!isDate(o2))
|
|
239
|
-
return false;
|
|
240
|
-
|
|
241
|
-
return simpleCompare(o1.getTime(), o2.getTime());
|
|
242
|
-
} else if (isRegExp(o1)) {
|
|
243
|
-
if (!isRegExp(o2))
|
|
244
|
-
return false;
|
|
245
|
-
|
|
246
|
-
return o1.toString() === o2.toString();
|
|
247
|
-
} else {
|
|
248
|
-
if (isWindow(o1) || isWindow(o2) || isArray(o2) || isDate(o2) || isRegExp(o2))
|
|
249
|
-
return false;
|
|
250
|
-
|
|
251
|
-
keySet = createMap();
|
|
252
|
-
for (key in o1) {
|
|
253
|
-
if (isFunction(o1[key]))
|
|
254
|
-
continue;
|
|
255
|
-
|
|
256
|
-
if (!equals(o1[key], o2[key]))
|
|
257
|
-
return false;
|
|
258
|
-
|
|
259
|
-
keySet[key] = true;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
for (key in o2) {
|
|
263
|
-
if (!(key in keySet) && isDefined(o2[key]) && !isFunction(o2[key]))
|
|
264
|
-
return false;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return false;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function createMap () {
|
|
275
|
-
return Object.create(null);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// eslint-disable-next-line no-self-compare
|
|
279
|
-
function simpleCompare (a, b) {
|
|
280
|
-
return a === b || (a !== a && b !== b);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export function copy (source, destination?, maxDepth = 5) {
|
|
284
|
-
const stackSource = [];
|
|
285
|
-
const stackDest = [];
|
|
286
|
-
|
|
287
|
-
if (!isNumber(maxDepth))
|
|
288
|
-
maxDepth = 5;
|
|
289
|
-
|
|
290
|
-
if (destination) {
|
|
291
|
-
if (source === destination) {
|
|
292
|
-
throw new Error('Can\'t copy! Source and destination are identical.');
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Empty the destination object
|
|
296
|
-
if (isArray(destination)) {
|
|
297
|
-
destination.length = 0;
|
|
298
|
-
} else {
|
|
299
|
-
for (const key in destination)
|
|
300
|
-
delete destination[key];
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
stackSource.push(source);
|
|
304
|
-
stackDest.push(destination);
|
|
305
|
-
|
|
306
|
-
return copyRecurse(source, destination, maxDepth);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return copyElement(source, maxDepth);
|
|
310
|
-
|
|
311
|
-
function copyRecurse (_source, _destination, _maxDepth) {
|
|
312
|
-
_maxDepth--;
|
|
313
|
-
|
|
314
|
-
if (_maxDepth < 0)
|
|
315
|
-
return '...';
|
|
316
|
-
|
|
317
|
-
if (isArray(_source)) {
|
|
318
|
-
for (let i = 0, ii = _source.length; i < ii; i++) {
|
|
319
|
-
_destination.push(copyElement(_source[i], _maxDepth));
|
|
320
|
-
}
|
|
321
|
-
} else if (isBlankObject(_source)) {
|
|
322
|
-
// createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
|
|
323
|
-
for (const key in _source) {
|
|
324
|
-
_destination[key] = copyElement(_source[key], _maxDepth);
|
|
325
|
-
}
|
|
326
|
-
} else if (_source && typeof _source.hasOwnProperty === 'function') {
|
|
327
|
-
// Slow path, which must rely on hasOwnProperty
|
|
328
|
-
for (const key in _source) {
|
|
329
|
-
if (_source.hasOwnProperty(key)) {
|
|
330
|
-
_destination[key] = copyElement(_source[key], _maxDepth);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
} else {
|
|
334
|
-
// Slowest path --- hasOwnProperty can't be called as a method
|
|
335
|
-
for (const key in _source) {
|
|
336
|
-
if (Object.prototype.hasOwnProperty.call(_source, key)) {
|
|
337
|
-
_destination[key] = copyElement(_source[key], _maxDepth);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return _destination;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function copyElement (_source, _maxDepth = 5) {
|
|
346
|
-
// Simple values
|
|
347
|
-
if (!isObject(_source))
|
|
348
|
-
return _source;
|
|
349
|
-
|
|
350
|
-
// Already copied values
|
|
351
|
-
const index = stackSource.indexOf(_source);
|
|
352
|
-
|
|
353
|
-
if (index !== -1)
|
|
354
|
-
return stackDest[index];
|
|
355
|
-
|
|
356
|
-
if (isWindow(_source)) {
|
|
357
|
-
throw new Error('Can\'t copy! Making copies of Window instances is not supported.');
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
let needsRecurse = false;
|
|
361
|
-
let _destination = copyType(_source);
|
|
362
|
-
|
|
363
|
-
if (_destination === undefined) {
|
|
364
|
-
_destination = isArray(_source) ? [] : Object.create(Object.getPrototypeOf(_source));
|
|
365
|
-
needsRecurse = true;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
stackSource.push(_source);
|
|
369
|
-
stackDest.push(_destination);
|
|
370
|
-
|
|
371
|
-
return needsRecurse
|
|
372
|
-
? copyRecurse(_source, _destination, _maxDepth)
|
|
373
|
-
: _destination;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
function copyType (_source) {
|
|
377
|
-
switch (toString.call(_source)) {
|
|
378
|
-
case '[object Int8Array]':
|
|
379
|
-
case '[object Int16Array]':
|
|
380
|
-
case '[object Int32Array]':
|
|
381
|
-
case '[object Float32Array]':
|
|
382
|
-
case '[object Float64Array]':
|
|
383
|
-
case '[object Uint8Array]':
|
|
384
|
-
case '[object Uint8ClampedArray]':
|
|
385
|
-
case '[object Uint16Array]':
|
|
386
|
-
case '[object Uint32Array]':
|
|
387
|
-
return new _source.constructor(copyElement(_source.buffer), _source.byteOffset, _source.length);
|
|
388
|
-
|
|
389
|
-
case '[object ArrayBuffer]':
|
|
390
|
-
// Support: IE10
|
|
391
|
-
if (!_source.slice) {
|
|
392
|
-
// If we're in this case we know the environment supports ArrayBuffer
|
|
393
|
-
/* eslint-disable no-undef */
|
|
394
|
-
const copied = new ArrayBuffer(_source.byteLength);
|
|
395
|
-
new Uint8Array(copied).set(new Uint8Array(_source));
|
|
396
|
-
/* eslint-enable */
|
|
397
|
-
return copied;
|
|
398
|
-
}
|
|
399
|
-
return _source.slice(0);
|
|
400
|
-
|
|
401
|
-
case '[object Boolean]':
|
|
402
|
-
case '[object Number]':
|
|
403
|
-
case '[object String]':
|
|
404
|
-
case '[object Date]':
|
|
405
|
-
return new _source.constructor(_source.valueOf());
|
|
406
|
-
|
|
407
|
-
case '[object RegExp]':
|
|
408
|
-
const re = new RegExp(_source._source, _source.toString().match(/[^/]*$/)[0]);
|
|
409
|
-
|
|
410
|
-
re.lastIndex = _source.lastIndex;
|
|
411
|
-
|
|
412
|
-
return re;
|
|
413
|
-
|
|
414
|
-
case '[object Blob]':
|
|
415
|
-
return new _source.constructor([_source], {type: _source.type});
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (isFunction(_source.cloneNode)) {
|
|
419
|
-
return _source.cloneNode(true);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
}
|
package/src/constants.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const ENTRY_STATUS = {
|
|
2
|
-
CACHED: 'cached',
|
|
3
|
-
PROMISED: 'promised',
|
|
4
|
-
EXPAND: 'expand',
|
|
5
|
-
PROMISED_EXPAND: 'promised-expand',
|
|
6
|
-
RESOLVE: 'resolve',
|
|
7
|
-
LOCAL: 'local'
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const COLUMN_SEPERATOR = '>';
|
|
11
|
-
export const RENDER_AS_SEPERATOR = ':';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import BatchStatus from "../classes/BatchStatus";
|
|
2
|
-
import PromiseService from '../classes/PromiseService';
|
|
3
|
-
import ItemEntry from "../models/ItemEntry";
|
|
4
|
-
|
|
5
|
-
export default class BatchStatusFactory {
|
|
6
|
-
constructor (
|
|
7
|
-
private promiseService: PromiseService,
|
|
8
|
-
) {
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
construct (getItemId: (itemEntry: ItemEntry) => number, getPromise: (itemEntry: ItemEntry) => Promise<any>): BatchStatus {
|
|
12
|
-
return new BatchStatus(
|
|
13
|
-
this.promiseService,
|
|
14
|
-
getItemId,
|
|
15
|
-
getPromise
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import ChangesCompiler from "../classes/ChangesCompiler";
|
|
2
|
-
import ItemEntryService from '../classes/ItemEntryService';
|
|
3
|
-
import CollectionEntry from "../models/CollectionEntry";
|
|
4
|
-
import ItemEntry from "../models/ItemEntry";
|
|
5
|
-
|
|
6
|
-
export default class ChangesCompilerFactory {
|
|
7
|
-
constructor (
|
|
8
|
-
private itemEntryService: ItemEntryService
|
|
9
|
-
) {
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
construct (singleItems: ItemEntry[], collections: CollectionEntry[], collectionOptions): ChangesCompiler {
|
|
13
|
-
return new ChangesCompiler(
|
|
14
|
-
this.itemEntryService,
|
|
15
|
-
singleItems,
|
|
16
|
-
collections,
|
|
17
|
-
collectionOptions
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import ApiFormatter from '../classes/ApiFormatter';
|
|
2
|
-
import ChangesProcessor from "../classes/ChangesProcessor";
|
|
3
|
-
import CollectionEntryService from "../classes/CollectionEntryService";
|
|
4
|
-
import CollectionHandler from "../classes/CollectionHandler";
|
|
5
|
-
import ColumnHandler from "../classes/ColumnHandler";
|
|
6
|
-
import ItemEntryService from '../classes/ItemEntryService';
|
|
7
|
-
import ItemHandler from "../classes/ItemHandler";
|
|
8
|
-
import PromiseService from '../classes/PromiseService';
|
|
9
|
-
import ApiRequestServiceInterface from '../interfaces/ApiRequestServiceInterface';
|
|
10
|
-
import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
|
|
11
|
-
import ChangesCompilerFactory from "./ChangesCompilerFactory";
|
|
12
|
-
import ColumnExpansionFactory from "./ColumnExpansionFactory";
|
|
13
|
-
import CreateRequestFactory from "./CreateRequestFactory";
|
|
14
|
-
import RequestColumnExpansionFactory from "./RequestColumnExpansionFactory";
|
|
15
|
-
|
|
16
|
-
export default class ChangesProcessorFactory {
|
|
17
|
-
constructor (
|
|
18
|
-
private apiRequestService: ApiRequestServiceInterface,
|
|
19
|
-
private errorHandler: ErrorHandlerInterface,
|
|
20
|
-
private itemHandler: ItemHandler,
|
|
21
|
-
private collectionHandler: CollectionHandler,
|
|
22
|
-
private columnHandler: ColumnHandler,
|
|
23
|
-
private changesCompilerFactory: ChangesCompilerFactory,
|
|
24
|
-
private createRequestFactory: CreateRequestFactory,
|
|
25
|
-
private columnExpansionFactory: ColumnExpansionFactory,
|
|
26
|
-
private requestColumnExpansionFactory: RequestColumnExpansionFactory,
|
|
27
|
-
private collectionEntryService: CollectionEntryService,
|
|
28
|
-
private itemEntryService: ItemEntryService,
|
|
29
|
-
private apiFormatter: ApiFormatter,
|
|
30
|
-
private promiseService: PromiseService
|
|
31
|
-
) {
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
construct (): ChangesProcessor {
|
|
36
|
-
return new ChangesProcessor(
|
|
37
|
-
this.apiRequestService,
|
|
38
|
-
this.itemHandler,
|
|
39
|
-
this.errorHandler,
|
|
40
|
-
this.collectionHandler,
|
|
41
|
-
this.columnHandler,
|
|
42
|
-
this.changesCompilerFactory,
|
|
43
|
-
this.createRequestFactory,
|
|
44
|
-
this.columnExpansionFactory,
|
|
45
|
-
this.requestColumnExpansionFactory,
|
|
46
|
-
this.collectionEntryService,
|
|
47
|
-
this.itemEntryService,
|
|
48
|
-
this.apiFormatter,
|
|
49
|
-
this.promiseService
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import CollectionEntryService from "../classes/CollectionEntryService";
|
|
2
|
-
import ItemEntryService from '../classes/ItemEntryService';
|
|
3
|
-
import ItemRequestService from "../classes/ItemRequestService";
|
|
4
|
-
import KeyService from '../classes/KeyService';
|
|
5
|
-
import PromiseService from '../classes/PromiseService';
|
|
6
|
-
import QueryService from '../classes/QueryService';
|
|
7
|
-
import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
|
|
8
|
-
import CollectionEntry from "../models/CollectionEntry";
|
|
9
|
-
|
|
10
|
-
export default class CollectionEntryFactory {
|
|
11
|
-
constructor (
|
|
12
|
-
private errorHandler: ErrorHandlerInterface,
|
|
13
|
-
private collectionEntryService: CollectionEntryService,
|
|
14
|
-
private itemRequestService: ItemRequestService,
|
|
15
|
-
private itemEntryService: ItemEntryService,
|
|
16
|
-
private keyService: KeyService,
|
|
17
|
-
private queryService: QueryService,
|
|
18
|
-
private promiseService: PromiseService
|
|
19
|
-
) {
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
construct (itemType: string, options): CollectionEntry {
|
|
23
|
-
return new CollectionEntry(
|
|
24
|
-
this.errorHandler,
|
|
25
|
-
this.collectionEntryService,
|
|
26
|
-
this.itemRequestService,
|
|
27
|
-
this.itemEntryService,
|
|
28
|
-
this.keyService,
|
|
29
|
-
this.queryService,
|
|
30
|
-
this.promiseService,
|
|
31
|
-
itemType,
|
|
32
|
-
options
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import ItemHandler from "../classes/ItemHandler";
|
|
2
|
-
import KeyService from '../classes/KeyService';
|
|
3
|
-
import PromiseService from '../classes/PromiseService';
|
|
4
|
-
import ErrorHandlerInterface from '../interfaces/ErrorHandlerInterface';
|
|
5
|
-
import CollectionEditResource from "../models/CollectionEditResource";
|
|
6
|
-
import CollectionEntry from "../models/CollectionEntry";
|
|
7
|
-
import CollectionResource from "../models/CollectionResource";
|
|
8
|
-
import CollectionViewResource from "../models/CollectionViewResource";
|
|
9
|
-
import ChangesProcessorFactory from './ChangesProcessorFactory';
|
|
10
|
-
import ItemResourceFactory from "./ItemResourceFactory";
|
|
11
|
-
|
|
12
|
-
export default class CollectionResourceFactory {
|
|
13
|
-
constructor (
|
|
14
|
-
private errorHandler: ErrorHandlerInterface,
|
|
15
|
-
private itemHandler: ItemHandler,
|
|
16
|
-
private itemResourceFactory: ItemResourceFactory,
|
|
17
|
-
private changesProcessorFactory: ChangesProcessorFactory,
|
|
18
|
-
private keyService: KeyService,
|
|
19
|
-
private promiseService: PromiseService
|
|
20
|
-
) {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
construct (collectionEntry: CollectionEntry, options): CollectionResource {
|
|
25
|
-
return new (options.editCollection ? CollectionEditResource : CollectionViewResource)(
|
|
26
|
-
this.errorHandler,
|
|
27
|
-
this.itemHandler,
|
|
28
|
-
this.itemResourceFactory,
|
|
29
|
-
this.changesProcessorFactory,
|
|
30
|
-
this.keyService,
|
|
31
|
-
this.promiseService,
|
|
32
|
-
collectionEntry,
|
|
33
|
-
options
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import ColumnExpansion from "../classes/ColumnExpansion";
|
|
2
|
-
import ColumnHandler from "../classes/ColumnHandler";
|
|
3
|
-
import ColumnUtil from '../classes/ColumnUtil';
|
|
4
|
-
import ColumnSetFactory from "./ColumnSetFactory";
|
|
5
|
-
|
|
6
|
-
export default class ColumnExpansionFactory {
|
|
7
|
-
constructor (
|
|
8
|
-
private columnHandler: ColumnHandler,
|
|
9
|
-
private columnSetFactory: ColumnSetFactory,
|
|
10
|
-
private columnUtil: ColumnUtil
|
|
11
|
-
) {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
construct (itemType: string, requestColumns: any | boolean, responseColumns: any) {
|
|
16
|
-
return new ColumnExpansion(
|
|
17
|
-
this.columnHandler,
|
|
18
|
-
this.columnSetFactory,
|
|
19
|
-
this.columnUtil,
|
|
20
|
-
itemType,
|
|
21
|
-
requestColumns,
|
|
22
|
-
responseColumns
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import ColumnHandler from "../classes/ColumnHandler";
|
|
2
|
-
import ColumnSet from "../classes/ColumnSet";
|
|
3
|
-
import ColumnUtil from '../classes/ColumnUtil';
|
|
4
|
-
|
|
5
|
-
export default class ColumnSetFactory {
|
|
6
|
-
constructor (
|
|
7
|
-
private columnHandler: ColumnHandler,
|
|
8
|
-
private columnUtil: ColumnUtil
|
|
9
|
-
) {
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
construct (itemType: string, requestColumns, responseColumns, enableCaching = true, includeIdColumn = true) {
|
|
14
|
-
return new ColumnSet(
|
|
15
|
-
this.columnHandler,
|
|
16
|
-
this.columnUtil,
|
|
17
|
-
itemType,
|
|
18
|
-
requestColumns,
|
|
19
|
-
responseColumns,
|
|
20
|
-
enableCaching,
|
|
21
|
-
includeIdColumn
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import CollectionHandler from "../classes/CollectionHandler";
|
|
2
|
-
import CreateRequest from "../classes/CreateRequest";
|
|
3
|
-
import ItemEntryService from '../classes/ItemEntryService';
|
|
4
|
-
import KeyService from '../classes/KeyService';
|
|
5
|
-
import RequestColumnExpansionFactory from "./RequestColumnExpansionFactory";
|
|
6
|
-
|
|
7
|
-
export default class CreateRequestFactory {
|
|
8
|
-
constructor (
|
|
9
|
-
private collectionHandler: CollectionHandler,
|
|
10
|
-
private requestColumnExpansionFactory: RequestColumnExpansionFactory,
|
|
11
|
-
private itemEntryService: ItemEntryService,
|
|
12
|
-
private keyService: KeyService
|
|
13
|
-
) {
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
construct (compilation, parameterMap, breakupByParent = false) {
|
|
18
|
-
return new CreateRequest(
|
|
19
|
-
this.collectionHandler,
|
|
20
|
-
this.requestColumnExpansionFactory,
|
|
21
|
-
this.itemEntryService,
|
|
22
|
-
this.keyService,
|
|
23
|
-
compilation,
|
|
24
|
-
parameterMap,
|
|
25
|
-
breakupByParent
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ItemCache from "../classes/ItemCache";
|
|
2
|
-
import ItemEntryService from '../classes/ItemEntryService';
|
|
3
|
-
import QueryMatcherFactory from "./QueryMatcherFactory";
|
|
4
|
-
|
|
5
|
-
export default class ItemCacheFactory {
|
|
6
|
-
constructor (
|
|
7
|
-
private queryMatcherFactory: QueryMatcherFactory,
|
|
8
|
-
private itemEntryService: ItemEntryService
|
|
9
|
-
) {
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
construct (): ItemCache {
|
|
13
|
-
return new ItemCache(
|
|
14
|
-
this.queryMatcherFactory,
|
|
15
|
-
this.itemEntryService
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|