@rs-x/core 0.4.4
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/LICENSE +21 -0
- package/dist/index.d.ts +616 -0
- package/dist/index.js +2222 -0
- package/package.json +65 -0
- package/readme.md +1184 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2222 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// lib/deep-clone/deep-clone-value-getter.ts
|
|
5
|
+
import { Observable } from "rxjs";
|
|
6
|
+
|
|
7
|
+
// lib/dependency-injection.ts
|
|
8
|
+
import "reflect-metadata";
|
|
9
|
+
import { Container, ContainerModule, inject, injectable, multiInject, preDestroy, unmanaged } from "inversify";
|
|
10
|
+
var InjectionContainer = new Container();
|
|
11
|
+
function registerMultiInjectService(container, target, options) {
|
|
12
|
+
container.bind(target).to(target).inSingletonScope();
|
|
13
|
+
if (options.serviceToken) {
|
|
14
|
+
container.bind(options.serviceToken).toService(target);
|
|
15
|
+
}
|
|
16
|
+
container.bind(options.multiInjectToken).toService(target);
|
|
17
|
+
}
|
|
18
|
+
__name(registerMultiInjectService, "registerMultiInjectService");
|
|
19
|
+
function registerMultiInjectServices(container, multiInjectToken, services) {
|
|
20
|
+
services.forEach((service) => registerMultiInjectService(container, service.target, {
|
|
21
|
+
multiInjectToken,
|
|
22
|
+
serviceToken: service.token
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
__name(registerMultiInjectServices, "registerMultiInjectServices");
|
|
26
|
+
function overrideMultiInjectServices(container, multiInjectToken, services) {
|
|
27
|
+
if (container.isBound(multiInjectToken)) {
|
|
28
|
+
container.unbind(multiInjectToken);
|
|
29
|
+
}
|
|
30
|
+
const seen = /* @__PURE__ */ new Set();
|
|
31
|
+
services.forEach((service) => {
|
|
32
|
+
if (seen.has(service.target)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
seen.add(service.target);
|
|
36
|
+
if (!container.isBound(service.target)) {
|
|
37
|
+
container.bind(service.target).to(service.target).inSingletonScope();
|
|
38
|
+
}
|
|
39
|
+
if (service.token && !container.isBound(service.token)) {
|
|
40
|
+
container.bind(service.token).toService(service.target);
|
|
41
|
+
}
|
|
42
|
+
container.bind(multiInjectToken).toService(service.target);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
__name(overrideMultiInjectServices, "overrideMultiInjectServices");
|
|
46
|
+
|
|
47
|
+
// lib/rs-x-core.injection-tokens.ts
|
|
48
|
+
var RsXCoreInjectionTokens = {
|
|
49
|
+
IInjectionContainer: Symbol("IInjectionContainer"),
|
|
50
|
+
IErrorLog: Symbol("IErrorLog"),
|
|
51
|
+
IIndexValueAccessor: Symbol("IIndexValueAccessor"),
|
|
52
|
+
IMapKeyAccessor: Symbol("IMapKeyAccessor"),
|
|
53
|
+
ISetKeyAccessor: Symbol("ISetKeyAccessor"),
|
|
54
|
+
IArrayIndexAccessor: Symbol("IArrayIndexAccessor"),
|
|
55
|
+
IPropertyValueAccessor: Symbol("IPropertyValueAccessor"),
|
|
56
|
+
IMethodAccessor: Symbol("IPropertyValueAccessor"),
|
|
57
|
+
IDatePropertyAccessor: Symbol("IDatePropertyAccessor"),
|
|
58
|
+
IDeepClone: Symbol("IDeepClone"),
|
|
59
|
+
IEqualityService: Symbol("IEqualityService"),
|
|
60
|
+
IObservableAccessor: Symbol("IObservableAccessor"),
|
|
61
|
+
IPromiseAccessor: Symbol("IPromiseAccessor"),
|
|
62
|
+
IIndexValueAccessorList: Symbol("IIndexValueAccessorList"),
|
|
63
|
+
ISequenceIdFactory: Symbol("ISequenceIdFactory"),
|
|
64
|
+
IFunctionCallIndexFactory: Symbol("IFunctionCallIndexFactory"),
|
|
65
|
+
IFunctionCallResultCacheFactory: Symbol("IFunctionCallResultCacheFactory"),
|
|
66
|
+
IGuidFactory: Symbol("IGuidFactory"),
|
|
67
|
+
IStructuredDeepClone: Symbol("IStructuredDeepClone"),
|
|
68
|
+
ILodashDeepClone: Symbol("ILodashDeepClone"),
|
|
69
|
+
IDeepCloneList: Symbol("IDeepCloneList"),
|
|
70
|
+
IResolvedValueCache: Symbol("IResolvedValueCache"),
|
|
71
|
+
IDeepCloneValueGetter: Symbol("IDeepCloneValueGetter"),
|
|
72
|
+
DefaultDeepCloneValueGetter: Symbol("DefaultDeepCloneValueGetter")
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// lib/deep-clone/deep-clone-value-getter.ts
|
|
76
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
77
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
78
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
79
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
80
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
81
|
+
}
|
|
82
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
83
|
+
function _ts_metadata(k, v) {
|
|
84
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
85
|
+
}
|
|
86
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
87
|
+
function _ts_param(paramIndex, decorator) {
|
|
88
|
+
return function(target, key) {
|
|
89
|
+
decorator(target, key, paramIndex);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
__name(_ts_param, "_ts_param");
|
|
93
|
+
var DeepCloneValueGetter = class {
|
|
94
|
+
static {
|
|
95
|
+
__name(this, "DeepCloneValueGetter");
|
|
96
|
+
}
|
|
97
|
+
_resolvedValueCache;
|
|
98
|
+
constructor(_resolvedValueCache) {
|
|
99
|
+
this._resolvedValueCache = _resolvedValueCache;
|
|
100
|
+
}
|
|
101
|
+
get(source) {
|
|
102
|
+
if (source instanceof Promise || source instanceof Observable) {
|
|
103
|
+
return this._resolvedValueCache.get(source);
|
|
104
|
+
}
|
|
105
|
+
return source;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
DeepCloneValueGetter = _ts_decorate([
|
|
109
|
+
injectable(),
|
|
110
|
+
_ts_param(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
|
|
111
|
+
_ts_metadata("design:type", Function),
|
|
112
|
+
_ts_metadata("design:paramtypes", [
|
|
113
|
+
typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
|
|
114
|
+
])
|
|
115
|
+
], DeepCloneValueGetter);
|
|
116
|
+
|
|
117
|
+
// lib/deep-clone/deep-clone.decorator.ts
|
|
118
|
+
function DeepClone(serviceToken) {
|
|
119
|
+
return function(target) {
|
|
120
|
+
registerMultiInjectService(InjectionContainer, target, {
|
|
121
|
+
serviceToken,
|
|
122
|
+
multiInjectToken: RsXCoreInjectionTokens.IDeepCloneList
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
__name(DeepClone, "DeepClone");
|
|
127
|
+
|
|
128
|
+
// lib/deep-clone/default-deep-clone.ts
|
|
129
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
130
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
131
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
132
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
133
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
134
|
+
}
|
|
135
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
136
|
+
function _ts_metadata2(k, v) {
|
|
137
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
138
|
+
}
|
|
139
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
140
|
+
function _ts_param2(paramIndex, decorator) {
|
|
141
|
+
return function(target, key) {
|
|
142
|
+
decorator(target, key, paramIndex);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
__name(_ts_param2, "_ts_param");
|
|
146
|
+
var DefaultDeepClone = class {
|
|
147
|
+
static {
|
|
148
|
+
__name(this, "DefaultDeepClone");
|
|
149
|
+
}
|
|
150
|
+
_deepCloneList;
|
|
151
|
+
_deepCloneValueGetter;
|
|
152
|
+
priority = 0;
|
|
153
|
+
constructor(_deepCloneList, _deepCloneValueGetter) {
|
|
154
|
+
this._deepCloneList = _deepCloneList;
|
|
155
|
+
this._deepCloneValueGetter = _deepCloneValueGetter;
|
|
156
|
+
}
|
|
157
|
+
clone(source) {
|
|
158
|
+
let error = null;
|
|
159
|
+
const value = this._deepCloneValueGetter.get(source);
|
|
160
|
+
for (let i = 0; i < this._deepCloneList.length; i++) {
|
|
161
|
+
try {
|
|
162
|
+
return this._deepCloneList[i].clone(value);
|
|
163
|
+
} catch (e) {
|
|
164
|
+
error = e;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
DefaultDeepClone = _ts_decorate2([
|
|
171
|
+
injectable(),
|
|
172
|
+
_ts_param2(0, multiInject(RsXCoreInjectionTokens.IDeepCloneList)),
|
|
173
|
+
_ts_param2(1, inject(RsXCoreInjectionTokens.IDeepCloneValueGetter)),
|
|
174
|
+
_ts_metadata2("design:type", Function),
|
|
175
|
+
_ts_metadata2("design:paramtypes", [
|
|
176
|
+
Object,
|
|
177
|
+
typeof IDeepCloneValueGetter === "undefined" ? Object : IDeepCloneValueGetter
|
|
178
|
+
])
|
|
179
|
+
], DefaultDeepClone);
|
|
180
|
+
|
|
181
|
+
// lib/deep-clone/lodash-deep-clone.ts
|
|
182
|
+
import cloneDeepWith from "lodash.clonedeepwith";
|
|
183
|
+
import { isObservable } from "rxjs";
|
|
184
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
185
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
186
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
187
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
188
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
189
|
+
}
|
|
190
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
191
|
+
var LodashDeepClone = class {
|
|
192
|
+
static {
|
|
193
|
+
__name(this, "LodashDeepClone");
|
|
194
|
+
}
|
|
195
|
+
priority = 1;
|
|
196
|
+
clone(source) {
|
|
197
|
+
return cloneDeepWith(source, this.cloneExceptPredicate);
|
|
198
|
+
}
|
|
199
|
+
cloneExceptPredicate = /* @__PURE__ */ __name((value) => {
|
|
200
|
+
if (value instanceof Promise || isObservable(value)) {
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
return void 0;
|
|
204
|
+
}, "cloneExceptPredicate");
|
|
205
|
+
};
|
|
206
|
+
LodashDeepClone = _ts_decorate3([
|
|
207
|
+
injectable()
|
|
208
|
+
], LodashDeepClone);
|
|
209
|
+
|
|
210
|
+
// lib/deep-clone/structured-deep-clone.ts
|
|
211
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
212
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
213
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
214
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
215
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
216
|
+
}
|
|
217
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
218
|
+
var StructuredDeepClone = class {
|
|
219
|
+
static {
|
|
220
|
+
__name(this, "StructuredDeepClone");
|
|
221
|
+
}
|
|
222
|
+
priority = 2;
|
|
223
|
+
clone(source) {
|
|
224
|
+
return structuredClone(source);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
StructuredDeepClone = _ts_decorate4([
|
|
228
|
+
injectable()
|
|
229
|
+
], StructuredDeepClone);
|
|
230
|
+
|
|
231
|
+
// lib/equality-service/equality-service.ts
|
|
232
|
+
import { createCustomEqual } from "fast-equals";
|
|
233
|
+
import { isObservable as isObservable2 } from "rxjs";
|
|
234
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
235
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
236
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
237
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
238
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
239
|
+
}
|
|
240
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
241
|
+
var EqualityService = class {
|
|
242
|
+
static {
|
|
243
|
+
__name(this, "EqualityService");
|
|
244
|
+
}
|
|
245
|
+
isEqual = createCustomEqual({
|
|
246
|
+
createCustomConfig: /* @__PURE__ */ __name((baseConfig) => ({
|
|
247
|
+
...baseConfig,
|
|
248
|
+
areObjectsEqual: /* @__PURE__ */ __name((a, b, equalityCheck) => {
|
|
249
|
+
if (isObservable2(a) && isObservable2(b)) {
|
|
250
|
+
return a === b;
|
|
251
|
+
}
|
|
252
|
+
return baseConfig.areObjectsEqual(a, b, equalityCheck);
|
|
253
|
+
}, "areObjectsEqual")
|
|
254
|
+
}), "createCustomConfig")
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
EqualityService = _ts_decorate5([
|
|
258
|
+
injectable()
|
|
259
|
+
], EqualityService);
|
|
260
|
+
|
|
261
|
+
// lib/error-log/error-log.ts
|
|
262
|
+
import { Subject } from "rxjs";
|
|
263
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
264
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
265
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
266
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
267
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
268
|
+
}
|
|
269
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
270
|
+
function _ts_metadata3(k, v) {
|
|
271
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
272
|
+
}
|
|
273
|
+
__name(_ts_metadata3, "_ts_metadata");
|
|
274
|
+
var ErrorLog = class {
|
|
275
|
+
static {
|
|
276
|
+
__name(this, "ErrorLog");
|
|
277
|
+
}
|
|
278
|
+
_error;
|
|
279
|
+
constructor() {
|
|
280
|
+
this._error = new Subject();
|
|
281
|
+
}
|
|
282
|
+
get error() {
|
|
283
|
+
return this._error;
|
|
284
|
+
}
|
|
285
|
+
add(error) {
|
|
286
|
+
console.error(error);
|
|
287
|
+
this._error.next(error);
|
|
288
|
+
}
|
|
289
|
+
clear() {
|
|
290
|
+
console.clear();
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
ErrorLog = _ts_decorate6([
|
|
294
|
+
injectable(),
|
|
295
|
+
_ts_metadata3("design:type", Function),
|
|
296
|
+
_ts_metadata3("design:paramtypes", [])
|
|
297
|
+
], ErrorLog);
|
|
298
|
+
|
|
299
|
+
// lib/error-log/pretty-printer.ts
|
|
300
|
+
function registerHandler(handler) {
|
|
301
|
+
return {
|
|
302
|
+
predicate: handler.predicate,
|
|
303
|
+
action: /* @__PURE__ */ __name((value, level, quoteStrings) => handler.action(value, level, quoteStrings), "action")
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
__name(registerHandler, "registerHandler");
|
|
307
|
+
var PrettyPrinter = class {
|
|
308
|
+
static {
|
|
309
|
+
__name(this, "PrettyPrinter");
|
|
310
|
+
}
|
|
311
|
+
indent;
|
|
312
|
+
handlers;
|
|
313
|
+
constructor(indent = 4) {
|
|
314
|
+
this.indent = indent;
|
|
315
|
+
this.handlers = [
|
|
316
|
+
registerHandler({
|
|
317
|
+
predicate: /* @__PURE__ */ __name((v) => v === null || [
|
|
318
|
+
"string",
|
|
319
|
+
"number",
|
|
320
|
+
"boolean",
|
|
321
|
+
"bigint",
|
|
322
|
+
"symbol",
|
|
323
|
+
"undefined"
|
|
324
|
+
].includes(typeof v), "predicate"),
|
|
325
|
+
action: /* @__PURE__ */ __name((v, level, quoteStrings) => [
|
|
326
|
+
this.spaces(level) + this.formatPrimitive(v, quoteStrings ?? false)
|
|
327
|
+
], "action")
|
|
328
|
+
}),
|
|
329
|
+
registerHandler({
|
|
330
|
+
predicate: /* @__PURE__ */ __name((v) => typeof v === "function", "predicate"),
|
|
331
|
+
action: /* @__PURE__ */ __name((_, level) => [
|
|
332
|
+
this.spaces(level) + "[[function]]"
|
|
333
|
+
], "action")
|
|
334
|
+
}),
|
|
335
|
+
registerHandler({
|
|
336
|
+
predicate: Array.isArray,
|
|
337
|
+
action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
|
|
338
|
+
if (v.length === 0) {
|
|
339
|
+
return [
|
|
340
|
+
this.spaces(level) + "[]"
|
|
341
|
+
];
|
|
342
|
+
}
|
|
343
|
+
const lines = [
|
|
344
|
+
this.spaces(level) + "["
|
|
345
|
+
];
|
|
346
|
+
for (let i = 0; i < v.length; i++) {
|
|
347
|
+
const nested = this.toLines(v[i], level + 1, quoteStrings);
|
|
348
|
+
lines.push(...nested);
|
|
349
|
+
if (i < v.length - 1) {
|
|
350
|
+
lines[lines.length - 1] += ",";
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
lines.push(this.spaces(level) + "]");
|
|
354
|
+
return lines;
|
|
355
|
+
}, "action")
|
|
356
|
+
}),
|
|
357
|
+
registerHandler({
|
|
358
|
+
predicate: /* @__PURE__ */ __name((v) => v instanceof Map, "predicate"),
|
|
359
|
+
action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
|
|
360
|
+
if (v.size === 0) {
|
|
361
|
+
return [
|
|
362
|
+
this.spaces(level) + "{}"
|
|
363
|
+
];
|
|
364
|
+
}
|
|
365
|
+
const lines = [
|
|
366
|
+
this.spaces(level) + "{"
|
|
367
|
+
];
|
|
368
|
+
const next = this.spaces(level + 1);
|
|
369
|
+
for (const [k, val] of v.entries()) {
|
|
370
|
+
const nested = this.toLines(val, level + 1, quoteStrings);
|
|
371
|
+
lines.push(`${next}${this.formatKey(k)}: ${nested[0].trimStart()}`);
|
|
372
|
+
if (nested.length > 1) {
|
|
373
|
+
lines.push(...nested.slice(1));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
lines.push(this.spaces(level) + "}");
|
|
377
|
+
return lines;
|
|
378
|
+
}, "action")
|
|
379
|
+
}),
|
|
380
|
+
registerHandler({
|
|
381
|
+
predicate: /* @__PURE__ */ __name((v) => v instanceof Set, "predicate"),
|
|
382
|
+
action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
|
|
383
|
+
if (v.size === 0) {
|
|
384
|
+
return [
|
|
385
|
+
this.spaces(level) + "{}"
|
|
386
|
+
];
|
|
387
|
+
}
|
|
388
|
+
const lines = [
|
|
389
|
+
this.spaces(level) + "{"
|
|
390
|
+
];
|
|
391
|
+
for (const item of v) {
|
|
392
|
+
lines.push(...this.toLines(item, level + 1, quoteStrings));
|
|
393
|
+
}
|
|
394
|
+
lines.push(this.spaces(level) + "}");
|
|
395
|
+
return lines;
|
|
396
|
+
}, "action")
|
|
397
|
+
}),
|
|
398
|
+
registerHandler({
|
|
399
|
+
predicate: /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && "toLines" in v, "predicate"),
|
|
400
|
+
action: /* @__PURE__ */ __name((v, _level) => v.toLines(this.indent, _level), "action")
|
|
401
|
+
}),
|
|
402
|
+
registerHandler({
|
|
403
|
+
predicate: /* @__PURE__ */ __name((v) => this.isCustomToString(v), "predicate"),
|
|
404
|
+
action: /* @__PURE__ */ __name((v, level) => {
|
|
405
|
+
const raw = v.toString(this.indent, level);
|
|
406
|
+
const lines = Array.isArray(raw) ? raw : String(raw).split("\n");
|
|
407
|
+
return lines.map((l) => this.spaces(level) + l);
|
|
408
|
+
}, "action")
|
|
409
|
+
}),
|
|
410
|
+
registerHandler({
|
|
411
|
+
predicate: /* @__PURE__ */ __name((v) => typeof v === "object" && v !== null && !Array.isArray(v), "predicate"),
|
|
412
|
+
action: /* @__PURE__ */ __name((v, level, quoteStrings) => {
|
|
413
|
+
const keys = Object.keys(v);
|
|
414
|
+
if (keys.length === 0) {
|
|
415
|
+
return [
|
|
416
|
+
this.spaces(level) + "{}"
|
|
417
|
+
];
|
|
418
|
+
}
|
|
419
|
+
const lines = [
|
|
420
|
+
this.spaces(level) + "{"
|
|
421
|
+
];
|
|
422
|
+
const next = this.spaces(level + 1);
|
|
423
|
+
for (const key of keys) {
|
|
424
|
+
const nested = this.toLines(v[key], level + 1, quoteStrings);
|
|
425
|
+
lines.push(`${next}${key}: ${nested[0].trimStart()}`);
|
|
426
|
+
if (nested.length > 1) {
|
|
427
|
+
lines.push(...nested.slice(1));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
lines.push(this.spaces(level) + "}");
|
|
431
|
+
return lines;
|
|
432
|
+
}, "action")
|
|
433
|
+
})
|
|
434
|
+
];
|
|
435
|
+
}
|
|
436
|
+
toString(value, quoteStrings = true) {
|
|
437
|
+
return this.toLines(value, 0, quoteStrings).join("\n");
|
|
438
|
+
}
|
|
439
|
+
toLines(value, level = 0, quoteStrings = true) {
|
|
440
|
+
for (const handler of this.handlers) {
|
|
441
|
+
if (handler.predicate(value)) {
|
|
442
|
+
return handler.action(value, level, quoteStrings);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
return [
|
|
446
|
+
this.spaces(level) + String(value)
|
|
447
|
+
];
|
|
448
|
+
}
|
|
449
|
+
formatPrimitive(value, quoteStrings) {
|
|
450
|
+
if (typeof value === "string" && quoteStrings) {
|
|
451
|
+
return `'${value}'`;
|
|
452
|
+
}
|
|
453
|
+
return String(value);
|
|
454
|
+
}
|
|
455
|
+
formatKey(key) {
|
|
456
|
+
return typeof key === "string" ? key : String(key);
|
|
457
|
+
}
|
|
458
|
+
spaces(level) {
|
|
459
|
+
return " ".repeat(this.indent * level);
|
|
460
|
+
}
|
|
461
|
+
isCustomToString(value) {
|
|
462
|
+
if (typeof value !== "object" || value === null) return false;
|
|
463
|
+
const proto = Object.getPrototypeOf(value);
|
|
464
|
+
if (!proto) return false;
|
|
465
|
+
const desc = Object.getOwnPropertyDescriptor(proto, "toString");
|
|
466
|
+
return !!desc && typeof desc.value === "function" && desc.value !== Object.prototype.toString;
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
// lib/error-log/print-value.ts
|
|
471
|
+
function printValue(value) {
|
|
472
|
+
console.log(new PrettyPrinter().toString(value, false));
|
|
473
|
+
}
|
|
474
|
+
__name(printValue, "printValue");
|
|
475
|
+
|
|
476
|
+
// lib/exceptions/argument-exception.ts
|
|
477
|
+
var ArgumentException = class extends Error {
|
|
478
|
+
static {
|
|
479
|
+
__name(this, "ArgumentException");
|
|
480
|
+
}
|
|
481
|
+
constructor(message) {
|
|
482
|
+
super(message);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
// lib/types/property-descriptor-type.enum.ts
|
|
487
|
+
var PropertyDescriptorType = /* @__PURE__ */ (function(PropertyDescriptorType2) {
|
|
488
|
+
PropertyDescriptorType2["Function"] = "Function";
|
|
489
|
+
PropertyDescriptorType2["ReadonlyProperty"] = "ReadonlyProperty";
|
|
490
|
+
PropertyDescriptorType2["Property"] = "Property";
|
|
491
|
+
PropertyDescriptorType2["Field"] = "Field";
|
|
492
|
+
return PropertyDescriptorType2;
|
|
493
|
+
})({});
|
|
494
|
+
|
|
495
|
+
// lib/types/type.ts
|
|
496
|
+
var emptyValue = Symbol("empty");
|
|
497
|
+
var emptyFunction = /* @__PURE__ */ __name(() => {
|
|
498
|
+
}, "emptyFunction");
|
|
499
|
+
var truePredicate = /* @__PURE__ */ __name(() => true, "truePredicate");
|
|
500
|
+
var echo = /* @__PURE__ */ __name((value) => value, "echo");
|
|
501
|
+
var Type = class _Type {
|
|
502
|
+
static {
|
|
503
|
+
__name(this, "Type");
|
|
504
|
+
}
|
|
505
|
+
static isPositiveIntegerString(value) {
|
|
506
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
if (value === "0") {
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
if (value[0] === "0") {
|
|
513
|
+
return false;
|
|
514
|
+
}
|
|
515
|
+
for (let i = 0; i < value.length; i++) {
|
|
516
|
+
const code = value.charCodeAt(i);
|
|
517
|
+
if (code < 48 || code > 57) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
static isPositiveInteger(value) {
|
|
524
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 || _Type.isPositiveIntegerString(value);
|
|
525
|
+
}
|
|
526
|
+
static walkObjectTopToBottom(object, visit, recursive) {
|
|
527
|
+
if (typeof object !== "object" || object === null) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
for (const [key, value] of Object.entries(object)) {
|
|
531
|
+
visit(object, key, value);
|
|
532
|
+
if (recursive && typeof value === "object" && value !== null) {
|
|
533
|
+
_Type.walkObjectTopToBottom(value, visit, recursive);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
static walkObjectBottomToTop(object, visit, recursive) {
|
|
538
|
+
if (typeof object !== "object" || object === null) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
for (const [key, value] of Object.entries(object)) {
|
|
542
|
+
if (recursive && typeof value === "object" && value !== null) {
|
|
543
|
+
_Type.walkObjectBottomToTop(value, visit, recursive);
|
|
544
|
+
}
|
|
545
|
+
visit(object, key, value);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
static cast(instance) {
|
|
549
|
+
return instance;
|
|
550
|
+
}
|
|
551
|
+
static isFunction(value) {
|
|
552
|
+
return typeof value === "function";
|
|
553
|
+
}
|
|
554
|
+
static isMethod(value) {
|
|
555
|
+
return typeof value === "function" && !("prototype" in value);
|
|
556
|
+
}
|
|
557
|
+
static isArrowFunction(object) {
|
|
558
|
+
return _Type.isFunction(object) && !Object.prototype.hasOwnProperty.call(object, "prototype");
|
|
559
|
+
}
|
|
560
|
+
static isString(value) {
|
|
561
|
+
return typeof value === "string" || value instanceof String;
|
|
562
|
+
}
|
|
563
|
+
static isNullOrUndefined(value) {
|
|
564
|
+
return value === null || value === void 0;
|
|
565
|
+
}
|
|
566
|
+
static isEmpty(value) {
|
|
567
|
+
return _Type.isNullOrUndefined(value) || _Type.isString(value) && value.length === 0 || Array.isArray(value) && value.length === 0;
|
|
568
|
+
}
|
|
569
|
+
static isPlainObject(object) {
|
|
570
|
+
if (object !== null && typeof object === "object") {
|
|
571
|
+
const prototype = Object.getPrototypeOf(object);
|
|
572
|
+
return prototype === Object.prototype || prototype === null;
|
|
573
|
+
}
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
static hasProperty(root, name) {
|
|
577
|
+
for (let current = root; current && current !== Object.prototype; current = Object.getPrototypeOf(current)) {
|
|
578
|
+
if (Object.prototype.hasOwnProperty.call(current, name)) {
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return false;
|
|
583
|
+
}
|
|
584
|
+
static hasOwnPropertyInPrototypeChain(target, key) {
|
|
585
|
+
if (target == null) {
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
let proto = typeof target === "function" ? target.prototype : Object.getPrototypeOf(target);
|
|
589
|
+
while (proto) {
|
|
590
|
+
if (Object.prototype.hasOwnProperty.call(proto, key)) {
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
proto = Object.getPrototypeOf(proto);
|
|
594
|
+
}
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
static getPropertyDescriptorType(propertyDescriptor) {
|
|
598
|
+
if (propertyDescriptor.set) {
|
|
599
|
+
return PropertyDescriptorType.Property;
|
|
600
|
+
}
|
|
601
|
+
if (propertyDescriptor.get) {
|
|
602
|
+
return PropertyDescriptorType.ReadonlyProperty;
|
|
603
|
+
}
|
|
604
|
+
if (_Type.isMethod(propertyDescriptor.value)) {
|
|
605
|
+
return PropertyDescriptorType.Function;
|
|
606
|
+
}
|
|
607
|
+
return PropertyDescriptorType.Field;
|
|
608
|
+
}
|
|
609
|
+
static getPropertyDescriptor(root, name) {
|
|
610
|
+
if (!root || typeof root !== "object") {
|
|
611
|
+
throw new ArgumentException(`Cannot get property '${String(name)}' from non-object root: ${String(root)}`);
|
|
612
|
+
}
|
|
613
|
+
let current = root;
|
|
614
|
+
while (current && current !== Object.prototype) {
|
|
615
|
+
const propertyDescriptor = Object.getOwnPropertyDescriptor(current, name);
|
|
616
|
+
if (propertyDescriptor) {
|
|
617
|
+
return {
|
|
618
|
+
type: _Type.getPropertyDescriptorType(propertyDescriptor),
|
|
619
|
+
descriptor: propertyDescriptor
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
current = Object.getPrototypeOf(current);
|
|
623
|
+
}
|
|
624
|
+
const constructorName = root.constructor?.name || "UnknownObject";
|
|
625
|
+
throw new ArgumentException(`${constructorName} does not have a property, method or field with name '${String(name)}'`);
|
|
626
|
+
}
|
|
627
|
+
static toObject(context) {
|
|
628
|
+
if (context && (typeof context === "object" || typeof context === "function")) {
|
|
629
|
+
return context;
|
|
630
|
+
}
|
|
631
|
+
return void 0;
|
|
632
|
+
}
|
|
633
|
+
static getConstructorName(value) {
|
|
634
|
+
if (typeof value === "object" && value !== null) {
|
|
635
|
+
return value.constructor.name;
|
|
636
|
+
}
|
|
637
|
+
return "unknown";
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
// lib/exceptions/invalid-cast-exception.ts
|
|
642
|
+
var InvalidCastException = class extends Error {
|
|
643
|
+
static {
|
|
644
|
+
__name(this, "InvalidCastException");
|
|
645
|
+
}
|
|
646
|
+
constructor(message) {
|
|
647
|
+
super(message);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
// lib/exceptions/null-or-empty-exception.ts
|
|
652
|
+
var NullOrEmptyException = class extends Error {
|
|
653
|
+
static {
|
|
654
|
+
__name(this, "NullOrEmptyException");
|
|
655
|
+
}
|
|
656
|
+
constructor(argumentName) {
|
|
657
|
+
super(`'${argumentName}' cannot be null or empty`);
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
// lib/exceptions/null-or-undefined-exception.ts
|
|
662
|
+
var NullOrUndefinedException = class extends Error {
|
|
663
|
+
static {
|
|
664
|
+
__name(this, "NullOrUndefinedException");
|
|
665
|
+
}
|
|
666
|
+
constructor(argumentName) {
|
|
667
|
+
super(`'${argumentName}' cannot be null or undefined`);
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
// lib/exceptions/assertion.ts
|
|
672
|
+
var Assertion = class {
|
|
673
|
+
static {
|
|
674
|
+
__name(this, "Assertion");
|
|
675
|
+
}
|
|
676
|
+
constructor() {
|
|
677
|
+
}
|
|
678
|
+
static assertIsFunction(value, name) {
|
|
679
|
+
if (!Type.isFunction(value)) {
|
|
680
|
+
const typeName = value && typeof value === "object" ? value.constructor?.name : typeof value;
|
|
681
|
+
throw new InvalidCastException(`${typeName}[${name}] is not a function`);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
static assertNotNullOrUndefined(value, argumentName) {
|
|
685
|
+
if (Type.isNullOrUndefined(value)) {
|
|
686
|
+
throw new NullOrUndefinedException(argumentName);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
static assertNotNullOrEmpty(value, argumentName) {
|
|
690
|
+
if (Type.isEmpty(value)) {
|
|
691
|
+
throw new NullOrEmptyException(argumentName);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
// lib/exceptions/invalid-operation-exception.ts
|
|
697
|
+
var InvalidOperationException = class extends Error {
|
|
698
|
+
static {
|
|
699
|
+
__name(this, "InvalidOperationException");
|
|
700
|
+
}
|
|
701
|
+
constructor(message) {
|
|
702
|
+
super(message);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
// lib/exceptions/parser-exception.ts
|
|
707
|
+
var ParserException = class extends Error {
|
|
708
|
+
static {
|
|
709
|
+
__name(this, "ParserException");
|
|
710
|
+
}
|
|
711
|
+
expression;
|
|
712
|
+
position;
|
|
713
|
+
constructor(expression, message, position) {
|
|
714
|
+
super(createMessage(expression, message, position ?? 0)), this.expression = expression, this.position = position;
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
function createMessage(expression, message, position) {
|
|
718
|
+
if (position >= 0) {
|
|
719
|
+
return `Invalid expression ${expression}. ${message}. Position ${position}`;
|
|
720
|
+
}
|
|
721
|
+
return `Invalid expression ${expression}. ${message}.`;
|
|
722
|
+
}
|
|
723
|
+
__name(createMessage, "createMessage");
|
|
724
|
+
|
|
725
|
+
// lib/exceptions/unexpected-exception.ts
|
|
726
|
+
var UnexpectedException = class extends Error {
|
|
727
|
+
static {
|
|
728
|
+
__name(this, "UnexpectedException");
|
|
729
|
+
}
|
|
730
|
+
constructor(message) {
|
|
731
|
+
super(message);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
// lib/exceptions/unsupported-exception.ts
|
|
736
|
+
var UnsupportedException = class extends Error {
|
|
737
|
+
static {
|
|
738
|
+
__name(this, "UnsupportedException");
|
|
739
|
+
}
|
|
740
|
+
constructor(message) {
|
|
741
|
+
super(message);
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
// lib/singleton-factory/singleton.factory.ts
|
|
746
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
747
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
748
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
749
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
750
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
751
|
+
}
|
|
752
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
753
|
+
function _ts_metadata4(k, v) {
|
|
754
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
755
|
+
}
|
|
756
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
757
|
+
var SingletonFactory = class {
|
|
758
|
+
static {
|
|
759
|
+
__name(this, "SingletonFactory");
|
|
760
|
+
}
|
|
761
|
+
_instances = /* @__PURE__ */ new Map();
|
|
762
|
+
_referenceCounts = /* @__PURE__ */ new Map();
|
|
763
|
+
constructor() {
|
|
764
|
+
}
|
|
765
|
+
exists(target) {
|
|
766
|
+
for (const instance of this._instances.values()) {
|
|
767
|
+
if (target === instance) {
|
|
768
|
+
return true;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return false;
|
|
772
|
+
}
|
|
773
|
+
toLines(indent = 4, level = 0) {
|
|
774
|
+
const lines = [];
|
|
775
|
+
const spaces = " ".repeat(indent * level);
|
|
776
|
+
const spacesNext = " ".repeat(indent * (level + 1));
|
|
777
|
+
const prettyPrinter = new PrettyPrinter();
|
|
778
|
+
lines.push(spaces + "___________________________________________________________");
|
|
779
|
+
lines.push(spaces + `${this.constructor.name}`);
|
|
780
|
+
for (const [key, instance] of this._instances.entries()) {
|
|
781
|
+
lines.push(spacesNext + "___________________________________________________________");
|
|
782
|
+
lines.push(spacesNext + `key (ref. count = ${this._referenceCounts.get(key)}):`);
|
|
783
|
+
const keyLines = prettyPrinter.toLines(key, level + 2, false);
|
|
784
|
+
lines.push(...keyLines);
|
|
785
|
+
lines.push(spacesNext + "instance:");
|
|
786
|
+
const instanceLines = prettyPrinter.toLines(instance, level + 2, false);
|
|
787
|
+
lines.push(...instanceLines);
|
|
788
|
+
}
|
|
789
|
+
return lines;
|
|
790
|
+
}
|
|
791
|
+
toString(indent = 4, level = 0) {
|
|
792
|
+
return this.toLines(indent, level).map((l) => " ".repeat(indent * level) + l).join("\n");
|
|
793
|
+
}
|
|
794
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
795
|
+
return `${this.constructor.name}`;
|
|
796
|
+
}
|
|
797
|
+
get isEmpty() {
|
|
798
|
+
return this._instances.size === 0;
|
|
799
|
+
}
|
|
800
|
+
ids() {
|
|
801
|
+
return this._instances.keys();
|
|
802
|
+
}
|
|
803
|
+
getFromId(id) {
|
|
804
|
+
return this._instances.get(id);
|
|
805
|
+
}
|
|
806
|
+
has(id) {
|
|
807
|
+
return this._instances.has(id);
|
|
808
|
+
}
|
|
809
|
+
getFromData(data) {
|
|
810
|
+
const id = this.getId(data);
|
|
811
|
+
return id !== void 0 ? this.getFromId(id) : void 0;
|
|
812
|
+
}
|
|
813
|
+
dispose() {
|
|
814
|
+
for (const id of this._instances.keys()) {
|
|
815
|
+
this.release(id, true);
|
|
816
|
+
}
|
|
817
|
+
this._instances.clear();
|
|
818
|
+
this._referenceCounts.clear();
|
|
819
|
+
this.onDipose();
|
|
820
|
+
}
|
|
821
|
+
getOrCreate(data) {
|
|
822
|
+
let instance = this.getFromId(this.getOrCreateId(data));
|
|
823
|
+
if (instance === void 0) {
|
|
824
|
+
instance = this.create(data).instance;
|
|
825
|
+
}
|
|
826
|
+
return instance;
|
|
827
|
+
}
|
|
828
|
+
create(data) {
|
|
829
|
+
const id = this.getOrCreateId(data);
|
|
830
|
+
const instance = this.getOrCreateInstance(id, data);
|
|
831
|
+
const result = {
|
|
832
|
+
id,
|
|
833
|
+
instance,
|
|
834
|
+
referenceCount: this.updateReferenceCount(id, 1, instance)
|
|
835
|
+
};
|
|
836
|
+
if (result.referenceCount === 1) {
|
|
837
|
+
this.onInstanceCreated(result.instance, data);
|
|
838
|
+
}
|
|
839
|
+
return result;
|
|
840
|
+
}
|
|
841
|
+
release(id, force) {
|
|
842
|
+
const instance = this._instances.get(id);
|
|
843
|
+
if (!instance) {
|
|
844
|
+
return {
|
|
845
|
+
instance: null,
|
|
846
|
+
referenceCount: 0
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
referenceCount: this.updateReferenceCount(id, -1, instance, force),
|
|
851
|
+
instance
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
get keys() {
|
|
855
|
+
return Array.from(this._instances.keys());
|
|
856
|
+
}
|
|
857
|
+
onDisposeInstance = /* @__PURE__ */ __name((id, dispose) => {
|
|
858
|
+
const { referenceCount } = this.release(id);
|
|
859
|
+
if (referenceCount === 0) {
|
|
860
|
+
dispose();
|
|
861
|
+
}
|
|
862
|
+
return referenceCount === 0;
|
|
863
|
+
}, "onDisposeInstance");
|
|
864
|
+
onDipose() {
|
|
865
|
+
}
|
|
866
|
+
onReleased() {
|
|
867
|
+
}
|
|
868
|
+
releaseInstance(_instance, _id) {
|
|
869
|
+
}
|
|
870
|
+
onInstanceCreated(_instance, _data) {
|
|
871
|
+
}
|
|
872
|
+
getOrCreateId(data) {
|
|
873
|
+
return this.getId(data) ?? this.createId(data);
|
|
874
|
+
}
|
|
875
|
+
getReferenceCount(id) {
|
|
876
|
+
return this._referenceCounts.get(id) ?? 0;
|
|
877
|
+
}
|
|
878
|
+
updateReferenceCount(id, change, instance, forceRelease) {
|
|
879
|
+
const referenceCount = this.getReferenceCount(id) + change;
|
|
880
|
+
if (change === -1 && (forceRelease || referenceCount === 0)) {
|
|
881
|
+
this._instances.delete(id);
|
|
882
|
+
this._referenceCounts.delete(id);
|
|
883
|
+
this.releaseInstance(instance, id);
|
|
884
|
+
this.onReleased();
|
|
885
|
+
} else if (referenceCount > 0) {
|
|
886
|
+
this._referenceCounts.set(id, referenceCount);
|
|
887
|
+
}
|
|
888
|
+
return referenceCount;
|
|
889
|
+
}
|
|
890
|
+
getOrCreateInstance(id, data) {
|
|
891
|
+
let instance = this._instances.get(id);
|
|
892
|
+
if (instance !== void 0) {
|
|
893
|
+
return instance;
|
|
894
|
+
}
|
|
895
|
+
instance = this.createInstance(data, id);
|
|
896
|
+
this._instances.set(id, instance);
|
|
897
|
+
return instance;
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
_ts_decorate7([
|
|
901
|
+
preDestroy(),
|
|
902
|
+
_ts_metadata4("design:type", Function),
|
|
903
|
+
_ts_metadata4("design:paramtypes", []),
|
|
904
|
+
_ts_metadata4("design:returntype", void 0)
|
|
905
|
+
], SingletonFactory.prototype, "dispose", null);
|
|
906
|
+
|
|
907
|
+
// lib/function-call-index/function-call-index.ts
|
|
908
|
+
var FunctionCallIndex = class {
|
|
909
|
+
static {
|
|
910
|
+
__name(this, "FunctionCallIndex");
|
|
911
|
+
}
|
|
912
|
+
context;
|
|
913
|
+
functionName;
|
|
914
|
+
_sequenceWithId;
|
|
915
|
+
_owner;
|
|
916
|
+
_isDisposed = false;
|
|
917
|
+
_id;
|
|
918
|
+
constructor(context, functionName, _sequenceWithId, _owner) {
|
|
919
|
+
this.context = context;
|
|
920
|
+
this.functionName = functionName;
|
|
921
|
+
this._sequenceWithId = _sequenceWithId;
|
|
922
|
+
this._owner = _owner;
|
|
923
|
+
}
|
|
924
|
+
get id() {
|
|
925
|
+
if (!this._id) {
|
|
926
|
+
this._id = `${this.functionName}${this._sequenceWithId.id}`;
|
|
927
|
+
}
|
|
928
|
+
return this._id;
|
|
929
|
+
}
|
|
930
|
+
get argumentsId() {
|
|
931
|
+
return this._sequenceWithId;
|
|
932
|
+
}
|
|
933
|
+
dispose() {
|
|
934
|
+
if (this._isDisposed) {
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
if (this._owner.canDispose?.()) {
|
|
938
|
+
this._isDisposed = true;
|
|
939
|
+
this._sequenceWithId.dispose();
|
|
940
|
+
}
|
|
941
|
+
this._owner.release();
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
|
|
945
|
+
// lib/function-call-index/function-call-index.factory.ts
|
|
946
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
947
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
948
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
949
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
950
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
951
|
+
}
|
|
952
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
953
|
+
function _ts_metadata5(k, v) {
|
|
954
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
955
|
+
}
|
|
956
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
957
|
+
function _ts_param3(paramIndex, decorator) {
|
|
958
|
+
return function(target, key) {
|
|
959
|
+
decorator(target, key, paramIndex);
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
__name(_ts_param3, "_ts_param");
|
|
963
|
+
var FunctionCallIndexFactory = class extends SingletonFactory {
|
|
964
|
+
static {
|
|
965
|
+
__name(this, "FunctionCallIndexFactory");
|
|
966
|
+
}
|
|
967
|
+
_sequenceIdFactory;
|
|
968
|
+
constructor(_sequenceIdFactory) {
|
|
969
|
+
super(), this._sequenceIdFactory = _sequenceIdFactory;
|
|
970
|
+
}
|
|
971
|
+
getId(data) {
|
|
972
|
+
return this._sequenceIdFactory.get(data.context, data.arguments);
|
|
973
|
+
}
|
|
974
|
+
createInstance(data, id) {
|
|
975
|
+
return new FunctionCallIndex(data.context, data.functionName, id, {
|
|
976
|
+
canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
|
|
977
|
+
release: /* @__PURE__ */ __name(() => this.release(id), "release")
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
createId(data) {
|
|
981
|
+
const context = data.context;
|
|
982
|
+
if (!context || typeof context !== "object") {
|
|
983
|
+
throw new ArgumentException(`Expected context to be an object, got ${String(context)}`);
|
|
984
|
+
}
|
|
985
|
+
const fn = context[data.functionName];
|
|
986
|
+
return this._sequenceIdFactory.create(fn, data.arguments);
|
|
987
|
+
}
|
|
988
|
+
releaseInstance(_, id) {
|
|
989
|
+
id.dispose();
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
FunctionCallIndexFactory = _ts_decorate8([
|
|
993
|
+
injectable(),
|
|
994
|
+
_ts_param3(0, inject(RsXCoreInjectionTokens.ISequenceIdFactory)),
|
|
995
|
+
_ts_metadata5("design:type", Function),
|
|
996
|
+
_ts_metadata5("design:paramtypes", [
|
|
997
|
+
typeof ISequenceIdFactory === "undefined" ? Object : ISequenceIdFactory
|
|
998
|
+
])
|
|
999
|
+
], FunctionCallIndexFactory);
|
|
1000
|
+
|
|
1001
|
+
// lib/function-call-result-cache/function-call-result-cache.factory.ts
|
|
1002
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
1003
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1004
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1005
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1006
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1007
|
+
}
|
|
1008
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
1009
|
+
function _ts_metadata6(k, v) {
|
|
1010
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1011
|
+
}
|
|
1012
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
1013
|
+
function _ts_param4(paramIndex, decorator) {
|
|
1014
|
+
return function(target, key) {
|
|
1015
|
+
decorator(target, key, paramIndex);
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
__name(_ts_param4, "_ts_param");
|
|
1019
|
+
var FunctionCallResultCache = class FunctionCallResultCache2 {
|
|
1020
|
+
static {
|
|
1021
|
+
__name(this, "FunctionCallResultCache");
|
|
1022
|
+
}
|
|
1023
|
+
_disposeableIndex;
|
|
1024
|
+
result;
|
|
1025
|
+
_owner;
|
|
1026
|
+
_isDisposed = false;
|
|
1027
|
+
constructor(_disposeableIndex, result, _owner) {
|
|
1028
|
+
this._disposeableIndex = _disposeableIndex;
|
|
1029
|
+
this.result = result;
|
|
1030
|
+
this._owner = _owner;
|
|
1031
|
+
}
|
|
1032
|
+
get index() {
|
|
1033
|
+
return this._disposeableIndex;
|
|
1034
|
+
}
|
|
1035
|
+
dispose() {
|
|
1036
|
+
if (this._isDisposed) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
if (this._owner.canDispose?.()) {
|
|
1040
|
+
this._disposeableIndex.dispose();
|
|
1041
|
+
this._isDisposed = true;
|
|
1042
|
+
}
|
|
1043
|
+
this._owner.release();
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
var FunctionCallResultCacheForContextManager = class FunctionCallResultCacheForContextManager2 extends SingletonFactory {
|
|
1047
|
+
static {
|
|
1048
|
+
__name(this, "FunctionCallResultCacheForContextManager");
|
|
1049
|
+
}
|
|
1050
|
+
_context;
|
|
1051
|
+
_functionCallIndexFactory;
|
|
1052
|
+
releaseContext;
|
|
1053
|
+
constructor(_context, _functionCallIndexFactory, releaseContext) {
|
|
1054
|
+
super(), this._context = _context, this._functionCallIndexFactory = _functionCallIndexFactory, this.releaseContext = releaseContext;
|
|
1055
|
+
}
|
|
1056
|
+
getId(data) {
|
|
1057
|
+
return this._functionCallIndexFactory.getFromData({
|
|
1058
|
+
functionName: data.functionName,
|
|
1059
|
+
context: this._context,
|
|
1060
|
+
arguments: data.arguments
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
createInstance(data, id) {
|
|
1064
|
+
return new FunctionCallResultCache(id, data.result, {
|
|
1065
|
+
canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
|
|
1066
|
+
release: /* @__PURE__ */ __name(() => this.release(id), "release")
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
createId(data) {
|
|
1070
|
+
return this._functionCallIndexFactory.create({
|
|
1071
|
+
functionName: data.functionName,
|
|
1072
|
+
context: this._context,
|
|
1073
|
+
arguments: data.arguments
|
|
1074
|
+
}).instance;
|
|
1075
|
+
}
|
|
1076
|
+
releaseInstance(_, id) {
|
|
1077
|
+
this._functionCallIndexFactory.release(id.argumentsId);
|
|
1078
|
+
}
|
|
1079
|
+
onReleased() {
|
|
1080
|
+
this.releaseContext();
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
var FunctionCallResultCacheManager = class FunctionCallResultCacheManager2 extends SingletonFactory {
|
|
1084
|
+
static {
|
|
1085
|
+
__name(this, "FunctionCallResultCacheManager");
|
|
1086
|
+
}
|
|
1087
|
+
_functionCallIndexFactory;
|
|
1088
|
+
constructor(_functionCallIndexFactory) {
|
|
1089
|
+
super(), this._functionCallIndexFactory = _functionCallIndexFactory;
|
|
1090
|
+
}
|
|
1091
|
+
getId(contex) {
|
|
1092
|
+
return this.createId(contex);
|
|
1093
|
+
}
|
|
1094
|
+
createInstance(context, id) {
|
|
1095
|
+
return new FunctionCallResultCacheForContextManager(context, this._functionCallIndexFactory, () => this.release(id));
|
|
1096
|
+
}
|
|
1097
|
+
createId(contex) {
|
|
1098
|
+
return contex;
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
var FunctionCallResultCacheFactory = class {
|
|
1102
|
+
static {
|
|
1103
|
+
__name(this, "FunctionCallResultCacheFactory");
|
|
1104
|
+
}
|
|
1105
|
+
_functionCallResultCacheManager;
|
|
1106
|
+
constructor(functionCallIndexFactory) {
|
|
1107
|
+
this._functionCallResultCacheManager = new FunctionCallResultCacheManager(functionCallIndexFactory);
|
|
1108
|
+
}
|
|
1109
|
+
create(context, result) {
|
|
1110
|
+
return this._functionCallResultCacheManager.create(context).instance.create(result).instance;
|
|
1111
|
+
}
|
|
1112
|
+
has(context, index) {
|
|
1113
|
+
return this._functionCallResultCacheManager.getFromId(context)?.has(index) ?? false;
|
|
1114
|
+
}
|
|
1115
|
+
get(context, index) {
|
|
1116
|
+
return this._functionCallResultCacheManager.getFromId(context)?.getFromId(index);
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
FunctionCallResultCacheFactory = _ts_decorate9([
|
|
1120
|
+
injectable(),
|
|
1121
|
+
_ts_param4(0, inject(RsXCoreInjectionTokens.IFunctionCallIndexFactory)),
|
|
1122
|
+
_ts_metadata6("design:type", Function),
|
|
1123
|
+
_ts_metadata6("design:paramtypes", [
|
|
1124
|
+
typeof IFunctionCallIndexFactory === "undefined" ? Object : IFunctionCallIndexFactory
|
|
1125
|
+
])
|
|
1126
|
+
], FunctionCallResultCacheFactory);
|
|
1127
|
+
|
|
1128
|
+
// lib/guid/guid.factory.ts
|
|
1129
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
1130
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1131
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1132
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1133
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1134
|
+
}
|
|
1135
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
1136
|
+
var GuidFactory = class {
|
|
1137
|
+
static {
|
|
1138
|
+
__name(this, "GuidFactory");
|
|
1139
|
+
}
|
|
1140
|
+
create() {
|
|
1141
|
+
return crypto.randomUUID();
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
GuidFactory = _ts_decorate10([
|
|
1145
|
+
injectable()
|
|
1146
|
+
], GuidFactory);
|
|
1147
|
+
|
|
1148
|
+
// lib/index-value-accessor/array-index-accessor.ts
|
|
1149
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1150
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1151
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1152
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1153
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1154
|
+
}
|
|
1155
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1156
|
+
var ArrayIndexAccessor = class {
|
|
1157
|
+
static {
|
|
1158
|
+
__name(this, "ArrayIndexAccessor");
|
|
1159
|
+
}
|
|
1160
|
+
priority = 5;
|
|
1161
|
+
isAsync() {
|
|
1162
|
+
return false;
|
|
1163
|
+
}
|
|
1164
|
+
getIndexes(array) {
|
|
1165
|
+
return array.keys();
|
|
1166
|
+
}
|
|
1167
|
+
hasValue(array, index) {
|
|
1168
|
+
return this.getValue(array, index) !== void 0;
|
|
1169
|
+
}
|
|
1170
|
+
getResolvedValue(array, index) {
|
|
1171
|
+
return array[index];
|
|
1172
|
+
}
|
|
1173
|
+
getValue(array, index) {
|
|
1174
|
+
return this.getResolvedValue(array, index);
|
|
1175
|
+
}
|
|
1176
|
+
setValue(array, index, value) {
|
|
1177
|
+
array[index] = value;
|
|
1178
|
+
}
|
|
1179
|
+
applies(array) {
|
|
1180
|
+
return Array.isArray(array);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
ArrayIndexAccessor = _ts_decorate11([
|
|
1184
|
+
injectable()
|
|
1185
|
+
], ArrayIndexAccessor);
|
|
1186
|
+
|
|
1187
|
+
// lib/index-value-accessor/date-property-accessor.interface.ts
|
|
1188
|
+
var dataProperties = [
|
|
1189
|
+
"year",
|
|
1190
|
+
"utcYear",
|
|
1191
|
+
"month",
|
|
1192
|
+
"utcMonth",
|
|
1193
|
+
"date",
|
|
1194
|
+
"utcDate",
|
|
1195
|
+
"hours",
|
|
1196
|
+
"utcHours",
|
|
1197
|
+
"minutes",
|
|
1198
|
+
"utcMinutes",
|
|
1199
|
+
"seconds",
|
|
1200
|
+
"utcSeconds",
|
|
1201
|
+
"milliseconds",
|
|
1202
|
+
"utcMilliseconds",
|
|
1203
|
+
"time"
|
|
1204
|
+
];
|
|
1205
|
+
|
|
1206
|
+
// lib/index-value-accessor/date-property-accessor.ts
|
|
1207
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1208
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1209
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1210
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1211
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1212
|
+
}
|
|
1213
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1214
|
+
var DatePropertyAccessor = class {
|
|
1215
|
+
static {
|
|
1216
|
+
__name(this, "DatePropertyAccessor");
|
|
1217
|
+
}
|
|
1218
|
+
priority = 0;
|
|
1219
|
+
_setter = {
|
|
1220
|
+
year: /* @__PURE__ */ __name((date, value) => date.setFullYear(value), "year"),
|
|
1221
|
+
utcYear: /* @__PURE__ */ __name((date, value) => date.setUTCFullYear(value), "utcYear"),
|
|
1222
|
+
month: /* @__PURE__ */ __name((date, value) => date.setMonth(value), "month"),
|
|
1223
|
+
utcMonth: /* @__PURE__ */ __name((date, value) => date.setUTCMonth(value), "utcMonth"),
|
|
1224
|
+
date: /* @__PURE__ */ __name((date, value) => date.setDate(value), "date"),
|
|
1225
|
+
utcDate: /* @__PURE__ */ __name((date, value) => date.setUTCDate(value), "utcDate"),
|
|
1226
|
+
hours: /* @__PURE__ */ __name((date, value) => date.setHours(value), "hours"),
|
|
1227
|
+
utcHours: /* @__PURE__ */ __name((date, value) => date.setUTCHours(value), "utcHours"),
|
|
1228
|
+
minutes: /* @__PURE__ */ __name((date, value) => date.setMinutes(value), "minutes"),
|
|
1229
|
+
utcMinutes: /* @__PURE__ */ __name((date, value) => date.setUTCMinutes(value), "utcMinutes"),
|
|
1230
|
+
seconds: /* @__PURE__ */ __name((date, value) => date.setSeconds(value), "seconds"),
|
|
1231
|
+
utcSeconds: /* @__PURE__ */ __name((date, value) => date.setUTCSeconds(value), "utcSeconds"),
|
|
1232
|
+
milliseconds: /* @__PURE__ */ __name((date, value) => date.setMilliseconds(value), "milliseconds"),
|
|
1233
|
+
utcMilliseconds: /* @__PURE__ */ __name((date, value) => date.setUTCMilliseconds(value), "utcMilliseconds"),
|
|
1234
|
+
time: /* @__PURE__ */ __name((date, value) => date.setTime(value), "time")
|
|
1235
|
+
};
|
|
1236
|
+
_getters = {
|
|
1237
|
+
year: /* @__PURE__ */ __name((date) => date.getFullYear(), "year"),
|
|
1238
|
+
utcYear: /* @__PURE__ */ __name((date) => date.getUTCFullYear(), "utcYear"),
|
|
1239
|
+
month: /* @__PURE__ */ __name((date) => date.getMonth(), "month"),
|
|
1240
|
+
utcMonth: /* @__PURE__ */ __name((date) => date.getUTCMonth(), "utcMonth"),
|
|
1241
|
+
date: /* @__PURE__ */ __name((date) => date.getDate(), "date"),
|
|
1242
|
+
utcDate: /* @__PURE__ */ __name((date) => date.getUTCDate(), "utcDate"),
|
|
1243
|
+
hours: /* @__PURE__ */ __name((date) => date.getHours(), "hours"),
|
|
1244
|
+
utcHours: /* @__PURE__ */ __name((date) => date.getUTCHours(), "utcHours"),
|
|
1245
|
+
minutes: /* @__PURE__ */ __name((date) => date.getMinutes(), "minutes"),
|
|
1246
|
+
utcMinutes: /* @__PURE__ */ __name((date) => date.getUTCMinutes(), "utcMinutes"),
|
|
1247
|
+
seconds: /* @__PURE__ */ __name((date) => date.getSeconds(), "seconds"),
|
|
1248
|
+
utcSeconds: /* @__PURE__ */ __name((date) => date.getUTCSeconds(), "utcSeconds"),
|
|
1249
|
+
milliseconds: /* @__PURE__ */ __name((date) => date.getMilliseconds(), "milliseconds"),
|
|
1250
|
+
utcMilliseconds: /* @__PURE__ */ __name((date) => date.getUTCMilliseconds(), "utcMilliseconds"),
|
|
1251
|
+
time: /* @__PURE__ */ __name((date) => date.getTime(), "time")
|
|
1252
|
+
};
|
|
1253
|
+
isAsync() {
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
1256
|
+
getIndexes() {
|
|
1257
|
+
return dataProperties.values();
|
|
1258
|
+
}
|
|
1259
|
+
hasValue(context, index) {
|
|
1260
|
+
return this.getValue(context, index) !== void 0;
|
|
1261
|
+
}
|
|
1262
|
+
getResolvedValue(context, index) {
|
|
1263
|
+
return this.getValue(context, index);
|
|
1264
|
+
}
|
|
1265
|
+
getValue(date, index) {
|
|
1266
|
+
return this._getters[index]?.(date);
|
|
1267
|
+
}
|
|
1268
|
+
setValue(date, index, value) {
|
|
1269
|
+
this._setter[index]?.(date, value);
|
|
1270
|
+
}
|
|
1271
|
+
applies(context, index) {
|
|
1272
|
+
return context instanceof Date && !!this._getters[index];
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
DatePropertyAccessor = _ts_decorate12([
|
|
1276
|
+
injectable()
|
|
1277
|
+
], DatePropertyAccessor);
|
|
1278
|
+
|
|
1279
|
+
// lib/index-value-accessor/index-value-accessor.ts
|
|
1280
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1281
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1282
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1283
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1284
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1285
|
+
}
|
|
1286
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1287
|
+
function _ts_metadata7(k, v) {
|
|
1288
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1289
|
+
}
|
|
1290
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
1291
|
+
function _ts_param5(paramIndex, decorator) {
|
|
1292
|
+
return function(target, key) {
|
|
1293
|
+
decorator(target, key, paramIndex);
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
__name(_ts_param5, "_ts_param");
|
|
1297
|
+
var IndexValueAccessor = class {
|
|
1298
|
+
static {
|
|
1299
|
+
__name(this, "IndexValueAccessor");
|
|
1300
|
+
}
|
|
1301
|
+
priority = 0;
|
|
1302
|
+
_accessors;
|
|
1303
|
+
constructor(accessors) {
|
|
1304
|
+
this._accessors = [
|
|
1305
|
+
...accessors
|
|
1306
|
+
].sort((a, b) => b.priority - a.priority);
|
|
1307
|
+
}
|
|
1308
|
+
getIndexes(context, index) {
|
|
1309
|
+
return this.getIndexAccessor(context, index).getIndexes(context, index);
|
|
1310
|
+
}
|
|
1311
|
+
isAsync(context, index) {
|
|
1312
|
+
return this.getIndexAccessor(context, index).isAsync(context, index);
|
|
1313
|
+
}
|
|
1314
|
+
hasValue(context, index) {
|
|
1315
|
+
return this.getIndexAccessor(context, index).hasValue(context, index);
|
|
1316
|
+
}
|
|
1317
|
+
getResolvedValue(context, index) {
|
|
1318
|
+
return this.getIndexAccessor(context, index).getResolvedValue(context, index);
|
|
1319
|
+
}
|
|
1320
|
+
getValue(context, index) {
|
|
1321
|
+
return this.getIndexAccessor(context, index).getValue(context, index);
|
|
1322
|
+
}
|
|
1323
|
+
setValue(context, index, value) {
|
|
1324
|
+
this.getIndexAccessor(context, index).setValue(context, index, value);
|
|
1325
|
+
}
|
|
1326
|
+
applies(context, index) {
|
|
1327
|
+
return this.getIndexAccessor(context, index).applies(context, index);
|
|
1328
|
+
}
|
|
1329
|
+
getIndexAccessor(context, index) {
|
|
1330
|
+
const accessor = this._accessors.find((accessor2) => accessor2.applies(context, index));
|
|
1331
|
+
if (!accessor) {
|
|
1332
|
+
if (typeof context === "object" && context !== null) {
|
|
1333
|
+
throw new UnsupportedException(`No accessor found for ${context.constructor.name}.${String(index)}`);
|
|
1334
|
+
} else {
|
|
1335
|
+
throw new UnsupportedException(`No accessor found for non-object context: ${String(context)}.${String(index)}`);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return accessor;
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
IndexValueAccessor = _ts_decorate13([
|
|
1342
|
+
injectable(),
|
|
1343
|
+
_ts_param5(0, multiInject(RsXCoreInjectionTokens.IIndexValueAccessorList)),
|
|
1344
|
+
_ts_metadata7("design:type", Function),
|
|
1345
|
+
_ts_metadata7("design:paramtypes", [
|
|
1346
|
+
Object
|
|
1347
|
+
])
|
|
1348
|
+
], IndexValueAccessor);
|
|
1349
|
+
|
|
1350
|
+
// lib/index-value-accessor/map-key-accessor.ts
|
|
1351
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1352
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1353
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1354
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1355
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1356
|
+
}
|
|
1357
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1358
|
+
var MapKeyAccessor = class {
|
|
1359
|
+
static {
|
|
1360
|
+
__name(this, "MapKeyAccessor");
|
|
1361
|
+
}
|
|
1362
|
+
priority = 4;
|
|
1363
|
+
getIndexes(map) {
|
|
1364
|
+
return map.keys();
|
|
1365
|
+
}
|
|
1366
|
+
isAsync() {
|
|
1367
|
+
return false;
|
|
1368
|
+
}
|
|
1369
|
+
hasValue(map, key) {
|
|
1370
|
+
return map.has(key);
|
|
1371
|
+
}
|
|
1372
|
+
getResolvedValue(map, key) {
|
|
1373
|
+
return map.get(key);
|
|
1374
|
+
}
|
|
1375
|
+
getValue(map, key) {
|
|
1376
|
+
return this.getResolvedValue(map, key);
|
|
1377
|
+
}
|
|
1378
|
+
setValue(map, key, value) {
|
|
1379
|
+
map.set(key, value);
|
|
1380
|
+
}
|
|
1381
|
+
applies(map) {
|
|
1382
|
+
return map instanceof Map;
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
MapKeyAccessor = _ts_decorate14([
|
|
1386
|
+
injectable()
|
|
1387
|
+
], MapKeyAccessor);
|
|
1388
|
+
|
|
1389
|
+
// lib/index-value-accessor/method-accessor.ts
|
|
1390
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
1391
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1392
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1393
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1394
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1395
|
+
}
|
|
1396
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1397
|
+
function _ts_metadata8(k, v) {
|
|
1398
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1399
|
+
}
|
|
1400
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
1401
|
+
function _ts_param6(paramIndex, decorator) {
|
|
1402
|
+
return function(target, key) {
|
|
1403
|
+
decorator(target, key, paramIndex);
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
__name(_ts_param6, "_ts_param");
|
|
1407
|
+
var MethodAccessor = class {
|
|
1408
|
+
static {
|
|
1409
|
+
__name(this, "MethodAccessor");
|
|
1410
|
+
}
|
|
1411
|
+
_functionCallResultCacheFactory;
|
|
1412
|
+
priority = 6;
|
|
1413
|
+
constructor(_functionCallResultCacheFactory) {
|
|
1414
|
+
this._functionCallResultCacheFactory = _functionCallResultCacheFactory;
|
|
1415
|
+
}
|
|
1416
|
+
getIndexes() {
|
|
1417
|
+
return [].values();
|
|
1418
|
+
}
|
|
1419
|
+
isAsync() {
|
|
1420
|
+
return false;
|
|
1421
|
+
}
|
|
1422
|
+
hasValue(context, index) {
|
|
1423
|
+
return this._functionCallResultCacheFactory.has(context, index);
|
|
1424
|
+
}
|
|
1425
|
+
getResolvedValue(context, index) {
|
|
1426
|
+
return this.getValue(context, index);
|
|
1427
|
+
}
|
|
1428
|
+
getValue(context, index) {
|
|
1429
|
+
return this._functionCallResultCacheFactory.get(context, index)?.result;
|
|
1430
|
+
}
|
|
1431
|
+
setValue(_, index) {
|
|
1432
|
+
throw new UnsupportedException(`Cannot set method '${index}'`);
|
|
1433
|
+
}
|
|
1434
|
+
applies(context, index) {
|
|
1435
|
+
if (typeof context !== "object" || context === null) {
|
|
1436
|
+
return false;
|
|
1437
|
+
}
|
|
1438
|
+
const prop = context[index.functionName];
|
|
1439
|
+
return Type.isFunction(prop) || Type.isArrowFunction(prop);
|
|
1440
|
+
}
|
|
1441
|
+
};
|
|
1442
|
+
MethodAccessor = _ts_decorate15([
|
|
1443
|
+
injectable(),
|
|
1444
|
+
_ts_param6(0, inject(RsXCoreInjectionTokens.IFunctionCallResultCacheFactory)),
|
|
1445
|
+
_ts_metadata8("design:type", Function),
|
|
1446
|
+
_ts_metadata8("design:paramtypes", [
|
|
1447
|
+
typeof IFunctionCallResultCacheFactory === "undefined" ? Object : IFunctionCallResultCacheFactory
|
|
1448
|
+
])
|
|
1449
|
+
], MethodAccessor);
|
|
1450
|
+
|
|
1451
|
+
// lib/index-value-accessor/observable-accessor.ts
|
|
1452
|
+
import { BehaviorSubject, isObservable as isObservable3, Subject as Subject2 } from "rxjs";
|
|
1453
|
+
|
|
1454
|
+
// lib/types/set.ts
|
|
1455
|
+
function replaceSetItemAt(set, oldValue, newValue) {
|
|
1456
|
+
const values = Array.from(set);
|
|
1457
|
+
const index = values.indexOf(oldValue);
|
|
1458
|
+
if (index === -1) {
|
|
1459
|
+
throw new RangeError("Index out of range");
|
|
1460
|
+
}
|
|
1461
|
+
values[index] = newValue;
|
|
1462
|
+
set.clear();
|
|
1463
|
+
values.forEach((value) => set.add(value));
|
|
1464
|
+
return set;
|
|
1465
|
+
}
|
|
1466
|
+
__name(replaceSetItemAt, "replaceSetItemAt");
|
|
1467
|
+
|
|
1468
|
+
// lib/types/utc-date.ts
|
|
1469
|
+
function utCDate(year, month = 0, date = 1, hours = 0, minutes = 0, seconds = 0, millisecond = 0) {
|
|
1470
|
+
return new Date(Date.UTC(year, month, date, hours, minutes, seconds, millisecond));
|
|
1471
|
+
}
|
|
1472
|
+
__name(utCDate, "utCDate");
|
|
1473
|
+
|
|
1474
|
+
// lib/index-value-accessor/pending.ts
|
|
1475
|
+
var PENDING = Symbol("pending");
|
|
1476
|
+
|
|
1477
|
+
// lib/index-value-accessor/observable-accessor.ts
|
|
1478
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
1479
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1480
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1481
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1482
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1483
|
+
}
|
|
1484
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
1485
|
+
function _ts_metadata9(k, v) {
|
|
1486
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1487
|
+
}
|
|
1488
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1489
|
+
function _ts_param7(paramIndex, decorator) {
|
|
1490
|
+
return function(target, key) {
|
|
1491
|
+
decorator(target, key, paramIndex);
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
__name(_ts_param7, "_ts_param");
|
|
1495
|
+
var ObservableAccessor = class {
|
|
1496
|
+
static {
|
|
1497
|
+
__name(this, "ObservableAccessor");
|
|
1498
|
+
}
|
|
1499
|
+
_resolvedValueCache;
|
|
1500
|
+
priority = 2;
|
|
1501
|
+
constructor(_resolvedValueCache) {
|
|
1502
|
+
this._resolvedValueCache = _resolvedValueCache;
|
|
1503
|
+
}
|
|
1504
|
+
getIndexes() {
|
|
1505
|
+
return [].values();
|
|
1506
|
+
}
|
|
1507
|
+
isAsync() {
|
|
1508
|
+
return true;
|
|
1509
|
+
}
|
|
1510
|
+
getResolvedValue(context, index) {
|
|
1511
|
+
if (context instanceof BehaviorSubject) return context.value;
|
|
1512
|
+
const val = this.getIndexedValue(context, index);
|
|
1513
|
+
if (val && typeof val === "object" || typeof val === "function") {
|
|
1514
|
+
return this._resolvedValueCache.get(val) ?? PENDING;
|
|
1515
|
+
}
|
|
1516
|
+
return PENDING;
|
|
1517
|
+
}
|
|
1518
|
+
hasValue(context, index) {
|
|
1519
|
+
return this.getResolvedValue(context, index) !== PENDING;
|
|
1520
|
+
}
|
|
1521
|
+
getValue(context, index) {
|
|
1522
|
+
return this.getIndexedValue(context, index);
|
|
1523
|
+
}
|
|
1524
|
+
setValue(context, index, value) {
|
|
1525
|
+
const val = this.getIndexedValue(context, index);
|
|
1526
|
+
if (val instanceof Subject2) {
|
|
1527
|
+
val.next(value);
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
throw new UnsupportedException("Cannot set value for an observable");
|
|
1531
|
+
}
|
|
1532
|
+
applies(context, index) {
|
|
1533
|
+
const val = this.getIndexedValue(context, index);
|
|
1534
|
+
return isObservable3(val);
|
|
1535
|
+
}
|
|
1536
|
+
setLastValue(observable, value) {
|
|
1537
|
+
this._resolvedValueCache.set(observable, value);
|
|
1538
|
+
}
|
|
1539
|
+
clearLastValue(observable) {
|
|
1540
|
+
this._resolvedValueCache.delete(observable);
|
|
1541
|
+
}
|
|
1542
|
+
getIndexedValue(context, index) {
|
|
1543
|
+
return (Type.toObject(context) ?? {})[index];
|
|
1544
|
+
}
|
|
1545
|
+
};
|
|
1546
|
+
ObservableAccessor = _ts_decorate16([
|
|
1547
|
+
injectable(),
|
|
1548
|
+
_ts_param7(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
|
|
1549
|
+
_ts_metadata9("design:type", Function),
|
|
1550
|
+
_ts_metadata9("design:paramtypes", [
|
|
1551
|
+
typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
|
|
1552
|
+
])
|
|
1553
|
+
], ObservableAccessor);
|
|
1554
|
+
|
|
1555
|
+
// lib/index-value-accessor/promise-accessor.ts
|
|
1556
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
1557
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1558
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1559
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1560
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1561
|
+
}
|
|
1562
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
1563
|
+
function _ts_metadata10(k, v) {
|
|
1564
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1565
|
+
}
|
|
1566
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1567
|
+
function _ts_param8(paramIndex, decorator) {
|
|
1568
|
+
return function(target, key) {
|
|
1569
|
+
decorator(target, key, paramIndex);
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
__name(_ts_param8, "_ts_param");
|
|
1573
|
+
var PromiseAccessor = class {
|
|
1574
|
+
static {
|
|
1575
|
+
__name(this, "PromiseAccessor");
|
|
1576
|
+
}
|
|
1577
|
+
_resolvedValueCache;
|
|
1578
|
+
priority = 1;
|
|
1579
|
+
constructor(_resolvedValueCache) {
|
|
1580
|
+
this._resolvedValueCache = _resolvedValueCache;
|
|
1581
|
+
}
|
|
1582
|
+
getIndexes() {
|
|
1583
|
+
return [].values();
|
|
1584
|
+
}
|
|
1585
|
+
isAsync() {
|
|
1586
|
+
return true;
|
|
1587
|
+
}
|
|
1588
|
+
hasValue(context, index) {
|
|
1589
|
+
const val = this.getIndexedValue(context, index);
|
|
1590
|
+
return this.isCacheable(val) && this._resolvedValueCache.get(val) !== PENDING;
|
|
1591
|
+
}
|
|
1592
|
+
getResolvedValue(context, index) {
|
|
1593
|
+
const val = this.getIndexedValue(context, index);
|
|
1594
|
+
return this.isCacheable(val) ? this._resolvedValueCache.get(val) ?? PENDING : PENDING;
|
|
1595
|
+
}
|
|
1596
|
+
getValue(context, index) {
|
|
1597
|
+
return this.getIndexedValue(context, index);
|
|
1598
|
+
}
|
|
1599
|
+
setValue() {
|
|
1600
|
+
throw new UnsupportedException("Cannot set value for a Promise");
|
|
1601
|
+
}
|
|
1602
|
+
applies(context, index) {
|
|
1603
|
+
const val = this.getIndexedValue(context, index);
|
|
1604
|
+
return val instanceof Promise;
|
|
1605
|
+
}
|
|
1606
|
+
setLastValue(promise, value) {
|
|
1607
|
+
this._resolvedValueCache.set(promise, value);
|
|
1608
|
+
}
|
|
1609
|
+
clearLastValue(promise) {
|
|
1610
|
+
this._resolvedValueCache.delete(promise);
|
|
1611
|
+
}
|
|
1612
|
+
getIndexedValue(context, index) {
|
|
1613
|
+
return (Type.toObject(context) ?? {})[index];
|
|
1614
|
+
}
|
|
1615
|
+
isCacheable(value) {
|
|
1616
|
+
return value !== null && (typeof value === "object" || typeof value === "function");
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
PromiseAccessor = _ts_decorate17([
|
|
1620
|
+
injectable(),
|
|
1621
|
+
_ts_param8(0, inject(RsXCoreInjectionTokens.IResolvedValueCache)),
|
|
1622
|
+
_ts_metadata10("design:type", Function),
|
|
1623
|
+
_ts_metadata10("design:paramtypes", [
|
|
1624
|
+
typeof IResolvedValueCache === "undefined" ? Object : IResolvedValueCache
|
|
1625
|
+
])
|
|
1626
|
+
], PromiseAccessor);
|
|
1627
|
+
|
|
1628
|
+
// lib/index-value-accessor/property-value-accessor.ts
|
|
1629
|
+
import { isObservable as isObservable4 } from "rxjs";
|
|
1630
|
+
var PropertyValueAccessor = class {
|
|
1631
|
+
static {
|
|
1632
|
+
__name(this, "PropertyValueAccessor");
|
|
1633
|
+
}
|
|
1634
|
+
priority = 7;
|
|
1635
|
+
isAsync() {
|
|
1636
|
+
return false;
|
|
1637
|
+
}
|
|
1638
|
+
getIndexes(context) {
|
|
1639
|
+
const obj = Type.toObject(context);
|
|
1640
|
+
if (!obj) {
|
|
1641
|
+
return [].values();
|
|
1642
|
+
}
|
|
1643
|
+
return Object.keys(obj).filter((key) => !Type.isMethod(obj[key])).values();
|
|
1644
|
+
}
|
|
1645
|
+
hasValue(context, index) {
|
|
1646
|
+
const val = this.getValue(context, index);
|
|
1647
|
+
return val !== void 0;
|
|
1648
|
+
}
|
|
1649
|
+
getResolvedValue(context, index) {
|
|
1650
|
+
return this.getValue(context, index);
|
|
1651
|
+
}
|
|
1652
|
+
getValue(context, index) {
|
|
1653
|
+
const obj = Type.toObject(context);
|
|
1654
|
+
return obj ? obj[index] : void 0;
|
|
1655
|
+
}
|
|
1656
|
+
setValue(context, index, value) {
|
|
1657
|
+
const obj = Type.toObject(context);
|
|
1658
|
+
if (obj) {
|
|
1659
|
+
obj[index] = value;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
applies(context, index) {
|
|
1663
|
+
const obj = Type.toObject(context);
|
|
1664
|
+
if (!obj) {
|
|
1665
|
+
return false;
|
|
1666
|
+
}
|
|
1667
|
+
return Type.hasProperty(obj, index) && !(obj instanceof Date) && !isObservable4(obj[index]) && !(obj[index] instanceof Promise);
|
|
1668
|
+
}
|
|
1669
|
+
};
|
|
1670
|
+
|
|
1671
|
+
// lib/index-value-accessor/resolved-value-cache.ts
|
|
1672
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
1673
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1674
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1675
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1676
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1677
|
+
}
|
|
1678
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
1679
|
+
var ResolvedValueCache = class {
|
|
1680
|
+
static {
|
|
1681
|
+
__name(this, "ResolvedValueCache");
|
|
1682
|
+
}
|
|
1683
|
+
_resolvedValues = /* @__PURE__ */ new WeakMap();
|
|
1684
|
+
set(source, value) {
|
|
1685
|
+
this._resolvedValues.set(source, value);
|
|
1686
|
+
}
|
|
1687
|
+
get(source) {
|
|
1688
|
+
return this._resolvedValues.get(source);
|
|
1689
|
+
}
|
|
1690
|
+
delete(source) {
|
|
1691
|
+
this._resolvedValues.delete(source);
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
ResolvedValueCache = _ts_decorate18([
|
|
1695
|
+
injectable()
|
|
1696
|
+
], ResolvedValueCache);
|
|
1697
|
+
|
|
1698
|
+
// lib/index-value-accessor/set-key-accessor.ts
|
|
1699
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
1700
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1701
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1702
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1703
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1704
|
+
}
|
|
1705
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
1706
|
+
var SetKeyAccessor = class {
|
|
1707
|
+
static {
|
|
1708
|
+
__name(this, "SetKeyAccessor");
|
|
1709
|
+
}
|
|
1710
|
+
priority = 3;
|
|
1711
|
+
getIndexes(set) {
|
|
1712
|
+
return new Set(set).values();
|
|
1713
|
+
}
|
|
1714
|
+
isAsync() {
|
|
1715
|
+
return false;
|
|
1716
|
+
}
|
|
1717
|
+
hasValue(set, key) {
|
|
1718
|
+
return set.has(key);
|
|
1719
|
+
}
|
|
1720
|
+
getResolvedValue(set, key) {
|
|
1721
|
+
return set.has(key) ? key : void 0;
|
|
1722
|
+
}
|
|
1723
|
+
getValue(set, key) {
|
|
1724
|
+
return this.getResolvedValue(set, key);
|
|
1725
|
+
}
|
|
1726
|
+
setValue(set, key, value) {
|
|
1727
|
+
replaceSetItemAt(set, key, value);
|
|
1728
|
+
}
|
|
1729
|
+
applies(map) {
|
|
1730
|
+
return map instanceof Set;
|
|
1731
|
+
}
|
|
1732
|
+
};
|
|
1733
|
+
SetKeyAccessor = _ts_decorate19([
|
|
1734
|
+
injectable()
|
|
1735
|
+
], SetKeyAccessor);
|
|
1736
|
+
|
|
1737
|
+
// lib/singleton-factory/singleton-factory-with-id-generation.ts
|
|
1738
|
+
var SingletonFactoryWithIdGeneration = class extends SingletonFactory {
|
|
1739
|
+
static {
|
|
1740
|
+
__name(this, "SingletonFactoryWithIdGeneration");
|
|
1741
|
+
}
|
|
1742
|
+
_groupedData = /* @__PURE__ */ new Map();
|
|
1743
|
+
getId(data) {
|
|
1744
|
+
const groupId = this.getGroupId(data);
|
|
1745
|
+
const groupMemberId = this.getGroupMemberId(data);
|
|
1746
|
+
return this._groupedData.get(groupId)?.get(groupMemberId);
|
|
1747
|
+
}
|
|
1748
|
+
isGroupRegistered(groupId) {
|
|
1749
|
+
return this._groupedData.has(groupId);
|
|
1750
|
+
}
|
|
1751
|
+
createId(data) {
|
|
1752
|
+
const groupId = this.getGroupId(data);
|
|
1753
|
+
let dataGroup = this._groupedData.get(groupId);
|
|
1754
|
+
if (!dataGroup) {
|
|
1755
|
+
dataGroup = /* @__PURE__ */ new Map();
|
|
1756
|
+
this._groupedData.set(groupId, dataGroup);
|
|
1757
|
+
}
|
|
1758
|
+
let groupMemberId = this.getGroupMemberId(data);
|
|
1759
|
+
let groupMember = dataGroup.get(groupMemberId);
|
|
1760
|
+
if (groupMember) {
|
|
1761
|
+
throw new InvalidOperationException("id allready exists");
|
|
1762
|
+
}
|
|
1763
|
+
const id = this.createUniqueId(data);
|
|
1764
|
+
dataGroup.set(groupMemberId, id);
|
|
1765
|
+
return id;
|
|
1766
|
+
}
|
|
1767
|
+
releaseInstance(_instance, id) {
|
|
1768
|
+
const { groupId, groupMemberId } = this.findGroupMemberId(id);
|
|
1769
|
+
let dataGroup = this._groupedData.get(groupId);
|
|
1770
|
+
if (!dataGroup) {
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
1773
|
+
dataGroup.delete(groupMemberId);
|
|
1774
|
+
if (dataGroup.size === 0) {
|
|
1775
|
+
this._groupedData.delete(groupId);
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
findGroupMemberId(idToFind) {
|
|
1779
|
+
for (const [groupId, groupData] of this._groupedData) {
|
|
1780
|
+
for (const [groupMemberId, id] of groupData.entries()) {
|
|
1781
|
+
if (idToFind === id) {
|
|
1782
|
+
return {
|
|
1783
|
+
groupId,
|
|
1784
|
+
groupMemberId
|
|
1785
|
+
};
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
return {
|
|
1790
|
+
groupId: null,
|
|
1791
|
+
groupMemberId: null
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
var SingletonFactoryWithGuid = class extends SingletonFactoryWithIdGeneration {
|
|
1796
|
+
static {
|
|
1797
|
+
__name(this, "SingletonFactoryWithGuid");
|
|
1798
|
+
}
|
|
1799
|
+
_guidFactory;
|
|
1800
|
+
constructor(_guidFactory) {
|
|
1801
|
+
super(), this._guidFactory = _guidFactory;
|
|
1802
|
+
}
|
|
1803
|
+
createUniqueId(_data) {
|
|
1804
|
+
return this._guidFactory.create();
|
|
1805
|
+
}
|
|
1806
|
+
};
|
|
1807
|
+
|
|
1808
|
+
// lib/sequence-id/sequence-id.factory.ts
|
|
1809
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
1810
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1811
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1812
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1813
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1814
|
+
}
|
|
1815
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
1816
|
+
function _ts_metadata11(k, v) {
|
|
1817
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1818
|
+
}
|
|
1819
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1820
|
+
function _ts_param9(paramIndex, decorator) {
|
|
1821
|
+
return function(target, key) {
|
|
1822
|
+
decorator(target, key, paramIndex);
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
__name(_ts_param9, "_ts_param");
|
|
1826
|
+
var RegistryNode = class RegistryNode2 {
|
|
1827
|
+
static {
|
|
1828
|
+
__name(this, "RegistryNode");
|
|
1829
|
+
}
|
|
1830
|
+
children = /* @__PURE__ */ new Map();
|
|
1831
|
+
id;
|
|
1832
|
+
};
|
|
1833
|
+
var SequenceWithId = class {
|
|
1834
|
+
static {
|
|
1835
|
+
__name(this, "SequenceWithId");
|
|
1836
|
+
}
|
|
1837
|
+
id;
|
|
1838
|
+
sequence;
|
|
1839
|
+
_owner;
|
|
1840
|
+
_isDisposed = false;
|
|
1841
|
+
constructor(id, sequence, _owner) {
|
|
1842
|
+
this.id = id;
|
|
1843
|
+
this.sequence = sequence;
|
|
1844
|
+
this._owner = _owner;
|
|
1845
|
+
}
|
|
1846
|
+
dispose() {
|
|
1847
|
+
if (this._isDisposed) {
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
if (this._owner.canDispose?.()) {
|
|
1851
|
+
this._isDisposed = true;
|
|
1852
|
+
}
|
|
1853
|
+
this._owner.release();
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
var ValueSequenceIdRegistry = class ValueSequenceIdRegistry2 {
|
|
1857
|
+
static {
|
|
1858
|
+
__name(this, "ValueSequenceIdRegistry");
|
|
1859
|
+
}
|
|
1860
|
+
_guidFactory;
|
|
1861
|
+
_root = new RegistryNode();
|
|
1862
|
+
_idToSequence = /* @__PURE__ */ new Map();
|
|
1863
|
+
constructor(_guidFactory) {
|
|
1864
|
+
this._guidFactory = _guidFactory;
|
|
1865
|
+
}
|
|
1866
|
+
getId(sequence) {
|
|
1867
|
+
let node = this._root;
|
|
1868
|
+
for (const value of sequence) {
|
|
1869
|
+
let next = node.children.get(value);
|
|
1870
|
+
if (!next) {
|
|
1871
|
+
next = new RegistryNode();
|
|
1872
|
+
node.children.set(value, next);
|
|
1873
|
+
}
|
|
1874
|
+
node = next;
|
|
1875
|
+
}
|
|
1876
|
+
let isNew = !node.id;
|
|
1877
|
+
if (isNew) {
|
|
1878
|
+
node.id = this._guidFactory.create();
|
|
1879
|
+
this._idToSequence.set(node.id, [
|
|
1880
|
+
...sequence
|
|
1881
|
+
]);
|
|
1882
|
+
}
|
|
1883
|
+
return {
|
|
1884
|
+
isNew,
|
|
1885
|
+
id: node.id
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
deleteId(id) {
|
|
1889
|
+
const sequence = this.getSequence(id);
|
|
1890
|
+
if (!sequence) {
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
const stack = [];
|
|
1894
|
+
let node = this._root;
|
|
1895
|
+
for (const value of sequence) {
|
|
1896
|
+
const next = node.children.get(value);
|
|
1897
|
+
if (!next) {
|
|
1898
|
+
this._idToSequence.delete(id);
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
stack.push({
|
|
1902
|
+
node,
|
|
1903
|
+
value
|
|
1904
|
+
});
|
|
1905
|
+
node = next;
|
|
1906
|
+
}
|
|
1907
|
+
delete node.id;
|
|
1908
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
1909
|
+
const { node: parent, value } = stack[i];
|
|
1910
|
+
const child = parent.children.get(value);
|
|
1911
|
+
if (child.children.size === 0 && !child.id) {
|
|
1912
|
+
parent.children.delete(value);
|
|
1913
|
+
} else {
|
|
1914
|
+
break;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
this._idToSequence.delete(id);
|
|
1918
|
+
}
|
|
1919
|
+
getSequence(id) {
|
|
1920
|
+
return this._idToSequence.get(id);
|
|
1921
|
+
}
|
|
1922
|
+
hasSequence(id) {
|
|
1923
|
+
return this._idToSequence.has(id);
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
var ValueSequenceIdsForContext = class ValueSequenceIdsForContext2 extends SingletonFactory {
|
|
1927
|
+
static {
|
|
1928
|
+
__name(this, "ValueSequenceIdsForContext");
|
|
1929
|
+
}
|
|
1930
|
+
context;
|
|
1931
|
+
_guidFactory;
|
|
1932
|
+
releaseContext;
|
|
1933
|
+
_valueSequenceIdRegistry;
|
|
1934
|
+
constructor(context, _guidFactory, releaseContext) {
|
|
1935
|
+
super(), this.context = context, this._guidFactory = _guidFactory, this.releaseContext = releaseContext;
|
|
1936
|
+
this._valueSequenceIdRegistry = new ValueSequenceIdRegistry(this._guidFactory);
|
|
1937
|
+
}
|
|
1938
|
+
getId(sequence) {
|
|
1939
|
+
return this.createId(sequence);
|
|
1940
|
+
}
|
|
1941
|
+
createInstance(sequence, id) {
|
|
1942
|
+
return new SequenceWithId(id, sequence, {
|
|
1943
|
+
canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(id) === 1, "canDispose"),
|
|
1944
|
+
release: /* @__PURE__ */ __name(() => this.release(id), "release")
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
createId(sequence) {
|
|
1948
|
+
return this._valueSequenceIdRegistry.getId(sequence).id;
|
|
1949
|
+
}
|
|
1950
|
+
releaseInstance(_, id) {
|
|
1951
|
+
this._valueSequenceIdRegistry.deleteId(id);
|
|
1952
|
+
}
|
|
1953
|
+
onReleased() {
|
|
1954
|
+
this.releaseContext();
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
var ValueSequenceIdRegistryManager = class ValueSequenceIdRegistryManager2 extends SingletonFactory {
|
|
1958
|
+
static {
|
|
1959
|
+
__name(this, "ValueSequenceIdRegistryManager");
|
|
1960
|
+
}
|
|
1961
|
+
_guidFactory;
|
|
1962
|
+
constructor(_guidFactory) {
|
|
1963
|
+
super(), this._guidFactory = _guidFactory;
|
|
1964
|
+
}
|
|
1965
|
+
getId(context) {
|
|
1966
|
+
return context;
|
|
1967
|
+
}
|
|
1968
|
+
createInstance(context, id) {
|
|
1969
|
+
return new ValueSequenceIdsForContext(context, this._guidFactory, () => this.release(id));
|
|
1970
|
+
}
|
|
1971
|
+
releaseInstance(instance, _id) {
|
|
1972
|
+
instance.dispose();
|
|
1973
|
+
}
|
|
1974
|
+
createId(context) {
|
|
1975
|
+
return context;
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
var SequenceIdFactory = class {
|
|
1979
|
+
static {
|
|
1980
|
+
__name(this, "SequenceIdFactory");
|
|
1981
|
+
}
|
|
1982
|
+
_valueSequenceIdRegistryManager;
|
|
1983
|
+
constructor(guidFactory) {
|
|
1984
|
+
this._valueSequenceIdRegistryManager = new ValueSequenceIdRegistryManager(guidFactory);
|
|
1985
|
+
}
|
|
1986
|
+
dispose() {
|
|
1987
|
+
this._valueSequenceIdRegistryManager.dispose();
|
|
1988
|
+
}
|
|
1989
|
+
create(context, sequence) {
|
|
1990
|
+
return this._valueSequenceIdRegistryManager.create(context).instance.create(sequence).instance;
|
|
1991
|
+
}
|
|
1992
|
+
release(context, id) {
|
|
1993
|
+
this._valueSequenceIdRegistryManager.getFromId(context)?.release(id);
|
|
1994
|
+
}
|
|
1995
|
+
get(context, sequence) {
|
|
1996
|
+
return this._valueSequenceIdRegistryManager.getFromId(context)?.getFromData(sequence);
|
|
1997
|
+
}
|
|
1998
|
+
has(context, id) {
|
|
1999
|
+
return !!this._valueSequenceIdRegistryManager.getFromId(context)?.has(id);
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
_ts_decorate20([
|
|
2003
|
+
preDestroy(),
|
|
2004
|
+
_ts_metadata11("design:type", Function),
|
|
2005
|
+
_ts_metadata11("design:paramtypes", []),
|
|
2006
|
+
_ts_metadata11("design:returntype", void 0)
|
|
2007
|
+
], SequenceIdFactory.prototype, "dispose", null);
|
|
2008
|
+
SequenceIdFactory = _ts_decorate20([
|
|
2009
|
+
injectable(),
|
|
2010
|
+
_ts_param9(0, inject(RsXCoreInjectionTokens.IGuidFactory)),
|
|
2011
|
+
_ts_metadata11("design:type", Function),
|
|
2012
|
+
_ts_metadata11("design:paramtypes", [
|
|
2013
|
+
typeof IGuidFactory === "undefined" ? Object : IGuidFactory
|
|
2014
|
+
])
|
|
2015
|
+
], SequenceIdFactory);
|
|
2016
|
+
|
|
2017
|
+
// lib/rs-x-core.module.ts
|
|
2018
|
+
var defaultIndexValueAccessorList = [
|
|
2019
|
+
{
|
|
2020
|
+
target: PropertyValueAccessor,
|
|
2021
|
+
token: RsXCoreInjectionTokens.IPropertyValueAccessor
|
|
2022
|
+
},
|
|
2023
|
+
{
|
|
2024
|
+
target: MethodAccessor,
|
|
2025
|
+
token: RsXCoreInjectionTokens.IMethodAccessor
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
target: ArrayIndexAccessor,
|
|
2029
|
+
token: RsXCoreInjectionTokens.IArrayIndexAccessor
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
target: MapKeyAccessor,
|
|
2033
|
+
token: RsXCoreInjectionTokens.IMapKeyAccessor
|
|
2034
|
+
},
|
|
2035
|
+
{
|
|
2036
|
+
target: SetKeyAccessor,
|
|
2037
|
+
token: RsXCoreInjectionTokens.ISetKeyAccessor
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
target: ObservableAccessor,
|
|
2041
|
+
token: RsXCoreInjectionTokens.IObservableAccessor
|
|
2042
|
+
},
|
|
2043
|
+
{
|
|
2044
|
+
target: PromiseAccessor,
|
|
2045
|
+
token: RsXCoreInjectionTokens.IPromiseAccessor
|
|
2046
|
+
},
|
|
2047
|
+
{
|
|
2048
|
+
target: DatePropertyAccessor,
|
|
2049
|
+
token: RsXCoreInjectionTokens.IDatePropertyAccessor
|
|
2050
|
+
}
|
|
2051
|
+
];
|
|
2052
|
+
var defaultDeeoCloneList = [
|
|
2053
|
+
{
|
|
2054
|
+
target: StructuredDeepClone,
|
|
2055
|
+
token: RsXCoreInjectionTokens.IStructuredDeepClone
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
target: LodashDeepClone,
|
|
2059
|
+
token: RsXCoreInjectionTokens.ILodashDeepClone
|
|
2060
|
+
}
|
|
2061
|
+
];
|
|
2062
|
+
var RsXCoreModule = new ContainerModule((options) => {
|
|
2063
|
+
options.bind(RsXCoreInjectionTokens.IInjectionContainer).toConstantValue(InjectionContainer);
|
|
2064
|
+
options.bind(RsXCoreInjectionTokens.IErrorLog).to(ErrorLog).inSingletonScope();
|
|
2065
|
+
options.bind(RsXCoreInjectionTokens.IIndexValueAccessor).to(IndexValueAccessor).inSingletonScope();
|
|
2066
|
+
options.bind(RsXCoreInjectionTokens.IDeepClone).to(DefaultDeepClone).inSingletonScope();
|
|
2067
|
+
options.bind(RsXCoreInjectionTokens.IEqualityService).to(EqualityService).inSingletonScope();
|
|
2068
|
+
options.bind(RsXCoreInjectionTokens.ISequenceIdFactory).to(SequenceIdFactory).inSingletonScope();
|
|
2069
|
+
options.bind(RsXCoreInjectionTokens.IFunctionCallIndexFactory).to(FunctionCallIndexFactory).inSingletonScope();
|
|
2070
|
+
options.bind(RsXCoreInjectionTokens.IFunctionCallResultCacheFactory).to(FunctionCallResultCacheFactory).inSingletonScope();
|
|
2071
|
+
options.bind(RsXCoreInjectionTokens.IGuidFactory).to(GuidFactory).inSingletonScope();
|
|
2072
|
+
options.bind(RsXCoreInjectionTokens.IResolvedValueCache).to(ResolvedValueCache).inSingletonScope();
|
|
2073
|
+
options.bind(RsXCoreInjectionTokens.IDeepCloneValueGetter).to(DeepCloneValueGetter).inSingletonScope();
|
|
2074
|
+
options.bind(RsXCoreInjectionTokens.DefaultDeepCloneValueGetter).to(DeepCloneValueGetter).inSingletonScope();
|
|
2075
|
+
registerMultiInjectServices(options, RsXCoreInjectionTokens.IIndexValueAccessorList, defaultIndexValueAccessorList);
|
|
2076
|
+
registerMultiInjectServices(options, RsXCoreInjectionTokens.IDeepCloneList, defaultDeeoCloneList);
|
|
2077
|
+
});
|
|
2078
|
+
|
|
2079
|
+
// lib/wait-for-event.ts
|
|
2080
|
+
import { firstValueFrom, Observable as Observable2 } from "rxjs";
|
|
2081
|
+
var WaitForEvent = class {
|
|
2082
|
+
static {
|
|
2083
|
+
__name(this, "WaitForEvent");
|
|
2084
|
+
}
|
|
2085
|
+
_target;
|
|
2086
|
+
_eventName;
|
|
2087
|
+
_options;
|
|
2088
|
+
constructor(_target, _eventName, options) {
|
|
2089
|
+
this._target = _target;
|
|
2090
|
+
this._eventName = _eventName;
|
|
2091
|
+
this._options = {
|
|
2092
|
+
count: options?.count ?? 1,
|
|
2093
|
+
timeout: options?.timeout ?? 100,
|
|
2094
|
+
ignoreInitialValue: options?.ignoreInitialValue ?? false
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
wait(trigger) {
|
|
2098
|
+
const state = {
|
|
2099
|
+
results: [],
|
|
2100
|
+
pending: this._options.ignoreInitialValue,
|
|
2101
|
+
subscription: null,
|
|
2102
|
+
timerId: 0
|
|
2103
|
+
};
|
|
2104
|
+
return new Promise((resolve, reject) => {
|
|
2105
|
+
state.timerId = window.setTimeout(() => {
|
|
2106
|
+
this.unsubscribeEvent(state);
|
|
2107
|
+
resolve(null);
|
|
2108
|
+
}, this._options.timeout);
|
|
2109
|
+
state.subscription = this.subscribeToEvent(state, resolve, reject);
|
|
2110
|
+
this.runTrigger(trigger, state, reject);
|
|
2111
|
+
});
|
|
2112
|
+
}
|
|
2113
|
+
subscribeToEvent(state, resolve, reject) {
|
|
2114
|
+
return this._target[this._eventName].subscribe({
|
|
2115
|
+
next: /* @__PURE__ */ __name((value) => {
|
|
2116
|
+
if (state.pending || state.results.length >= (this._options.count ?? 1)) {
|
|
2117
|
+
state.pending = false;
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2120
|
+
state.results.push(value);
|
|
2121
|
+
if (state.results.length === this._options.count) {
|
|
2122
|
+
this.finish(state, resolve);
|
|
2123
|
+
}
|
|
2124
|
+
}, "next"),
|
|
2125
|
+
error: /* @__PURE__ */ __name((error) => {
|
|
2126
|
+
this.cleanup(state);
|
|
2127
|
+
reject(error);
|
|
2128
|
+
}, "error")
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
async runTrigger(trigger, state, reject) {
|
|
2132
|
+
try {
|
|
2133
|
+
const result = trigger();
|
|
2134
|
+
if (result instanceof Promise) {
|
|
2135
|
+
await result;
|
|
2136
|
+
} else if (result instanceof Observable2) {
|
|
2137
|
+
await firstValueFrom(result);
|
|
2138
|
+
}
|
|
2139
|
+
} catch (error) {
|
|
2140
|
+
this.cleanup(state);
|
|
2141
|
+
reject(error);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
finish(state, resolve) {
|
|
2145
|
+
this.cleanup(state);
|
|
2146
|
+
resolve(state.results.length > 1 ? state.results : state.results[0]);
|
|
2147
|
+
}
|
|
2148
|
+
cleanup(state) {
|
|
2149
|
+
window.clearTimeout(state.timerId);
|
|
2150
|
+
this.unsubscribeEvent(state);
|
|
2151
|
+
}
|
|
2152
|
+
unsubscribeEvent(state) {
|
|
2153
|
+
if (state.subscription) {
|
|
2154
|
+
state.subscription.unsubscribe();
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
};
|
|
2158
|
+
export {
|
|
2159
|
+
ArgumentException,
|
|
2160
|
+
ArrayIndexAccessor,
|
|
2161
|
+
Assertion,
|
|
2162
|
+
Container,
|
|
2163
|
+
ContainerModule,
|
|
2164
|
+
DatePropertyAccessor,
|
|
2165
|
+
DeepClone,
|
|
2166
|
+
DeepCloneValueGetter,
|
|
2167
|
+
DefaultDeepClone,
|
|
2168
|
+
EqualityService,
|
|
2169
|
+
ErrorLog,
|
|
2170
|
+
FunctionCallIndex,
|
|
2171
|
+
FunctionCallIndexFactory,
|
|
2172
|
+
FunctionCallResultCacheFactory,
|
|
2173
|
+
GuidFactory,
|
|
2174
|
+
IndexValueAccessor,
|
|
2175
|
+
inject as Inject,
|
|
2176
|
+
injectable as Injectable,
|
|
2177
|
+
InjectionContainer,
|
|
2178
|
+
InvalidCastException,
|
|
2179
|
+
InvalidOperationException,
|
|
2180
|
+
LodashDeepClone,
|
|
2181
|
+
MapKeyAccessor,
|
|
2182
|
+
MethodAccessor,
|
|
2183
|
+
multiInject as MultiInject,
|
|
2184
|
+
NullOrEmptyException,
|
|
2185
|
+
NullOrUndefinedException,
|
|
2186
|
+
ObservableAccessor,
|
|
2187
|
+
PENDING,
|
|
2188
|
+
ParserException,
|
|
2189
|
+
preDestroy as PreDestroy,
|
|
2190
|
+
PrettyPrinter,
|
|
2191
|
+
PromiseAccessor,
|
|
2192
|
+
PropertyDescriptorType,
|
|
2193
|
+
PropertyValueAccessor,
|
|
2194
|
+
ResolvedValueCache,
|
|
2195
|
+
RsXCoreInjectionTokens,
|
|
2196
|
+
RsXCoreModule,
|
|
2197
|
+
SequenceIdFactory,
|
|
2198
|
+
SequenceWithId,
|
|
2199
|
+
SetKeyAccessor,
|
|
2200
|
+
SingletonFactory,
|
|
2201
|
+
SingletonFactoryWithGuid,
|
|
2202
|
+
SingletonFactoryWithIdGeneration,
|
|
2203
|
+
StructuredDeepClone,
|
|
2204
|
+
Type,
|
|
2205
|
+
UnexpectedException,
|
|
2206
|
+
unmanaged as Unmanaged,
|
|
2207
|
+
UnsupportedException,
|
|
2208
|
+
WaitForEvent,
|
|
2209
|
+
dataProperties,
|
|
2210
|
+
defaultDeeoCloneList,
|
|
2211
|
+
defaultIndexValueAccessorList,
|
|
2212
|
+
echo,
|
|
2213
|
+
emptyFunction,
|
|
2214
|
+
emptyValue,
|
|
2215
|
+
overrideMultiInjectServices,
|
|
2216
|
+
printValue,
|
|
2217
|
+
registerMultiInjectService,
|
|
2218
|
+
registerMultiInjectServices,
|
|
2219
|
+
replaceSetItemAt,
|
|
2220
|
+
truePredicate,
|
|
2221
|
+
utCDate
|
|
2222
|
+
};
|