@rs-x/core 0.4.11 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
5
5
  import { Observable } from "rxjs";
6
6
 
7
7
  // lib/dependency-injection.ts
8
- import "reflect-metadata";
9
8
  import { Container, ContainerModule, inject, injectable, multiInject, preDestroy, unmanaged } from "inversify";
9
+ import "reflect-metadata";
10
10
  var InjectionContainer = new Container();
11
11
  function registerMultiInjectService(container, target, options) {
12
12
  container.bind(target).to(target).inSingletonScope();
@@ -57,9 +57,6 @@ var ArrayIndexAccessor = class {
57
57
  __name(this, "ArrayIndexAccessor");
58
58
  }
59
59
  priority = 5;
60
- isAsync() {
61
- return false;
62
- }
63
60
  getIndexes(array) {
64
61
  return array.keys();
65
62
  }
@@ -149,9 +146,6 @@ var DatePropertyAccessor = class {
149
146
  utcMilliseconds: /* @__PURE__ */ __name((date) => date.getUTCMilliseconds(), "utcMilliseconds"),
150
147
  time: /* @__PURE__ */ __name((date) => date.getTime(), "time")
151
148
  };
152
- isAsync() {
153
- return false;
154
- }
155
149
  getIndexes() {
156
150
  return dataProperties.values();
157
151
  }
@@ -175,13 +169,24 @@ DatePropertyAccessor = _ts_decorate2([
175
169
  injectable()
176
170
  ], DatePropertyAccessor);
177
171
 
172
+ // lib/exceptions/custome-error.ts
173
+ var CustomError = class extends Error {
174
+ static {
175
+ __name(this, "CustomError");
176
+ }
177
+ constructor(message, name) {
178
+ super(message);
179
+ this.name = name ?? this.constructor.name;
180
+ }
181
+ };
182
+
178
183
  // lib/exceptions/unsupported-exception.ts
179
- var UnsupportedException = class extends Error {
184
+ var UnsupportedException = class extends CustomError {
180
185
  static {
181
186
  __name(this, "UnsupportedException");
182
187
  }
183
188
  constructor(message) {
184
- super(message);
189
+ super(message, "UnsupportedException");
185
190
  }
186
191
  };
187
192
 
@@ -210,7 +215,16 @@ var RsXCoreInjectionTokens = {
210
215
  IDeepCloneList: Symbol("IDeepCloneList"),
211
216
  IResolvedValueCache: Symbol("IResolvedValueCache"),
212
217
  IDeepCloneExcept: Symbol("IDeepCloneExcept"),
213
- DefaultDeepCloneExcept: Symbol("DefaultDeepCloneExcept")
218
+ DefaultDeepCloneExcept: Symbol("DefaultDeepCloneExcept"),
219
+ IValueMetadataList: Symbol("IValueMetadataList"),
220
+ ArrayMetadata: Symbol("ArrayMetadata"),
221
+ DateMetadata: Symbol("DateMetadata"),
222
+ DummyMetadata: Symbol("DummyMetadata"),
223
+ MapMetadata: Symbol("MapMetadata"),
224
+ ObservableMetadata: Symbol("ObservableMetadata"),
225
+ PromiseMetadata: Symbol("PromiseMetadata"),
226
+ SetMetadata: Symbol("SetMetadata"),
227
+ IValueMetadata: Symbol("IValueMetadata")
214
228
  };
215
229
 
216
230
  // lib/index-value-accessor/index-value-accessor.ts
@@ -245,9 +259,6 @@ var IndexValueAccessor = class {
245
259
  getIndexes(context, index) {
246
260
  return this.getIndexAccessor(context, index).getIndexes(context, index);
247
261
  }
248
- isAsync(context, index) {
249
- return this.getIndexAccessor(context, index).isAsync(context, index);
250
- }
251
262
  hasValue(context, index) {
252
263
  return this.getIndexAccessor(context, index).hasValue(context, index);
253
264
  }
@@ -300,9 +311,6 @@ var MapKeyAccessor = class {
300
311
  getIndexes(map) {
301
312
  return map.keys();
302
313
  }
303
- isAsync() {
304
- return false;
305
- }
306
314
  hasValue(map, key) {
307
315
  return map.has(key);
308
316
  }
@@ -324,12 +332,22 @@ MapKeyAccessor = _ts_decorate4([
324
332
  ], MapKeyAccessor);
325
333
 
326
334
  // lib/exceptions/argument-exception.ts
327
- var ArgumentException = class extends Error {
335
+ var ArgumentException = class extends CustomError {
328
336
  static {
329
337
  __name(this, "ArgumentException");
330
338
  }
331
339
  constructor(message) {
332
- super(message);
340
+ super(message, "ArgumentException");
341
+ }
342
+ };
343
+
344
+ // lib/exceptions/assert-exception.ts
345
+ var AssertionError = class extends CustomError {
346
+ static {
347
+ __name(this, "AssertionError");
348
+ }
349
+ constructor(message) {
350
+ super(message, "AssertionError");
333
351
  }
334
352
  };
335
353
 
@@ -489,32 +507,32 @@ var Type = class _Type {
489
507
  };
490
508
 
491
509
  // lib/exceptions/invalid-cast-exception.ts
492
- var InvalidCastException = class extends Error {
510
+ var InvalidCastException = class extends CustomError {
493
511
  static {
494
512
  __name(this, "InvalidCastException");
495
513
  }
496
514
  constructor(message) {
497
- super(message);
515
+ super(message, "InvalidCastException");
498
516
  }
499
517
  };
500
518
 
501
519
  // lib/exceptions/null-or-empty-exception.ts
502
- var NullOrEmptyException = class extends Error {
520
+ var NullOrEmptyException = class extends CustomError {
503
521
  static {
504
522
  __name(this, "NullOrEmptyException");
505
523
  }
506
524
  constructor(argumentName) {
507
- super(`'${argumentName}' cannot be null or empty`);
525
+ super(`'${argumentName}' cannot be null or empty`, "NullOrEmptyException");
508
526
  }
509
527
  };
510
528
 
511
529
  // lib/exceptions/null-or-undefined-exception.ts
512
- var NullOrUndefinedException = class extends Error {
530
+ var NullOrUndefinedException = class extends CustomError {
513
531
  static {
514
532
  __name(this, "NullOrUndefinedException");
515
533
  }
516
534
  constructor(argumentName) {
517
- super(`'${argumentName}' cannot be null or undefined`);
535
+ super(`'${argumentName}' cannot be null or undefined`, "NullOrEmptyException");
518
536
  }
519
537
  };
520
538
 
@@ -531,6 +549,11 @@ var Assertion = class {
531
549
  throw new InvalidCastException(`${typeName}[${name}] is not a function`);
532
550
  }
533
551
  }
552
+ static assert(predicate, messsage) {
553
+ if (!predicate()) {
554
+ throw new AssertionError(messsage);
555
+ }
556
+ }
534
557
  static assertNotNullOrUndefined(value, argumentName) {
535
558
  if (Type.isNullOrUndefined(value)) {
536
559
  throw new NullOrUndefinedException(argumentName);
@@ -544,24 +567,24 @@ var Assertion = class {
544
567
  };
545
568
 
546
569
  // lib/exceptions/invalid-operation-exception.ts
547
- var InvalidOperationException = class extends Error {
570
+ var InvalidOperationException = class extends CustomError {
548
571
  static {
549
572
  __name(this, "InvalidOperationException");
550
573
  }
551
574
  constructor(message) {
552
- super(message);
575
+ super(message, "InvalidOperationException");
553
576
  }
554
577
  };
555
578
 
556
579
  // lib/exceptions/parser-exception.ts
557
- var ParserException = class extends Error {
580
+ var ParserException = class extends CustomError {
558
581
  static {
559
582
  __name(this, "ParserException");
560
583
  }
561
584
  expression;
562
585
  position;
563
586
  constructor(expression, message, position) {
564
- super(createMessage(expression, message, position ?? 0)), this.expression = expression, this.position = position;
587
+ super(createMessage(expression, message, position ?? 0), "ParserException"), this.expression = expression, this.position = position;
565
588
  }
566
589
  };
567
590
  function createMessage(expression, message, position) {
@@ -573,12 +596,12 @@ function createMessage(expression, message, position) {
573
596
  __name(createMessage, "createMessage");
574
597
 
575
598
  // lib/exceptions/unexpected-exception.ts
576
- var UnexpectedException = class extends Error {
599
+ var UnexpectedException = class extends CustomError {
577
600
  static {
578
601
  __name(this, "UnexpectedException");
579
602
  }
580
603
  constructor(message) {
581
- super(message);
604
+ super(message, "UnexpectedException");
582
605
  }
583
606
  };
584
607
 
@@ -612,9 +635,6 @@ var MethodAccessor = class {
612
635
  getIndexes() {
613
636
  return [].values();
614
637
  }
615
- isAsync() {
616
- return false;
617
- }
618
638
  hasValue(context, index) {
619
639
  return this._functionCallResultCacheFactory.has(context, index);
620
640
  }
@@ -628,7 +648,7 @@ var MethodAccessor = class {
628
648
  throw new UnsupportedException(`Cannot set method '${index}'`);
629
649
  }
630
650
  applies(context, index) {
631
- if (typeof context !== "object" || context === null) {
651
+ if (!index || typeof context !== "object" || context === null) {
632
652
  return false;
633
653
  }
634
654
  const prop = context[index.functionName];
@@ -700,9 +720,6 @@ var ObservableAccessor = class {
700
720
  getIndexes() {
701
721
  return [].values();
702
722
  }
703
- isAsync() {
704
- return true;
705
- }
706
723
  getResolvedValue(context, index) {
707
724
  if (context instanceof BehaviorSubject) return context.value;
708
725
  const val = this.getIndexedValue(context, index);
@@ -778,9 +795,6 @@ var PromiseAccessor = class {
778
795
  getIndexes() {
779
796
  return [].values();
780
797
  }
781
- isAsync() {
782
- return true;
783
- }
784
798
  hasValue(context, index) {
785
799
  const val = this.getIndexedValue(context, index);
786
800
  return this.isCacheable(val) && this._resolvedValueCache.get(val) !== PENDING;
@@ -828,9 +842,6 @@ var PropertyValueAccessor = class {
828
842
  __name(this, "PropertyValueAccessor");
829
843
  }
830
844
  priority = 7;
831
- isAsync() {
832
- return false;
833
- }
834
845
  getIndexes(context) {
835
846
  const obj = Type.toObject(context);
836
847
  if (!obj) {
@@ -907,9 +918,6 @@ var SetKeyAccessor = class {
907
918
  getIndexes(set) {
908
919
  return new Set(set).values();
909
920
  }
910
- isAsync() {
911
- return false;
912
- }
913
921
  hasValue(set, key) {
914
922
  return set.has(key);
915
923
  }
@@ -1331,6 +1339,44 @@ function printValue(value) {
1331
1339
  }
1332
1340
  __name(printValue, "printValue");
1333
1341
 
1342
+ // lib/function-call-index/function-call-index.ts
1343
+ var FunctionCallIndex = class {
1344
+ static {
1345
+ __name(this, "FunctionCallIndex");
1346
+ }
1347
+ context;
1348
+ functionName;
1349
+ _sequenceWithId;
1350
+ _owner;
1351
+ _isDisposed = false;
1352
+ _id;
1353
+ constructor(context, functionName, _sequenceWithId, _owner) {
1354
+ this.context = context;
1355
+ this.functionName = functionName;
1356
+ this._sequenceWithId = _sequenceWithId;
1357
+ this._owner = _owner;
1358
+ }
1359
+ get id() {
1360
+ if (!this._id) {
1361
+ this._id = `${this.functionName}${this._sequenceWithId.id}`;
1362
+ }
1363
+ return this._id;
1364
+ }
1365
+ get argumentsId() {
1366
+ return this._sequenceWithId;
1367
+ }
1368
+ dispose() {
1369
+ if (this._isDisposed) {
1370
+ return;
1371
+ }
1372
+ if (this._owner.canDispose?.()) {
1373
+ this._isDisposed = true;
1374
+ this._sequenceWithId.dispose();
1375
+ }
1376
+ this._owner.release();
1377
+ }
1378
+ };
1379
+
1334
1380
  // lib/singleton-factory/singleton.factory.ts
1335
1381
  function _ts_decorate16(decorators, target, key, desc) {
1336
1382
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1440,8 +1486,22 @@ var SingletonFactory = class {
1440
1486
  instance
1441
1487
  };
1442
1488
  }
1489
+ getReferenceCount(id) {
1490
+ return this._referenceCounts.get(id) ?? 0;
1491
+ }
1443
1492
  get keys() {
1444
- return Array.from(this._instances.keys());
1493
+ return this._instances.keys();
1494
+ }
1495
+ get instances() {
1496
+ return this._instances.values();
1497
+ }
1498
+ replaceKey(oldKey, newKey) {
1499
+ const instance = this.getFromId(oldKey);
1500
+ if (instance == void 0) {
1501
+ return;
1502
+ }
1503
+ this._instances.delete(oldKey);
1504
+ this._instances.set(newKey, instance);
1445
1505
  }
1446
1506
  onDisposeInstance = /* @__PURE__ */ __name((id, dispose) => {
1447
1507
  const { referenceCount } = this.release(id);
@@ -1461,9 +1521,6 @@ var SingletonFactory = class {
1461
1521
  getOrCreateId(data) {
1462
1522
  return this.getId(data) ?? this.createId(data);
1463
1523
  }
1464
- getReferenceCount(id) {
1465
- return this._referenceCounts.get(id) ?? 0;
1466
- }
1467
1524
  updateReferenceCount(id, change, instance, forceRelease) {
1468
1525
  const referenceCount = this.getReferenceCount(id) + change;
1469
1526
  if (change === -1 && (forceRelease || referenceCount === 0)) {
@@ -1493,44 +1550,6 @@ _ts_decorate16([
1493
1550
  _ts_metadata9("design:returntype", void 0)
1494
1551
  ], SingletonFactory.prototype, "dispose", null);
1495
1552
 
1496
- // lib/function-call-index/function-call-index.ts
1497
- var FunctionCallIndex = class {
1498
- static {
1499
- __name(this, "FunctionCallIndex");
1500
- }
1501
- context;
1502
- functionName;
1503
- _sequenceWithId;
1504
- _owner;
1505
- _isDisposed = false;
1506
- _id;
1507
- constructor(context, functionName, _sequenceWithId, _owner) {
1508
- this.context = context;
1509
- this.functionName = functionName;
1510
- this._sequenceWithId = _sequenceWithId;
1511
- this._owner = _owner;
1512
- }
1513
- get id() {
1514
- if (!this._id) {
1515
- this._id = `${this.functionName}${this._sequenceWithId.id}`;
1516
- }
1517
- return this._id;
1518
- }
1519
- get argumentsId() {
1520
- return this._sequenceWithId;
1521
- }
1522
- dispose() {
1523
- if (this._isDisposed) {
1524
- return;
1525
- }
1526
- if (this._owner.canDispose?.()) {
1527
- this._isDisposed = true;
1528
- this._sequenceWithId.dispose();
1529
- }
1530
- this._owner.release();
1531
- }
1532
- };
1533
-
1534
1553
  // lib/function-call-index/function-call-index.factory.ts
1535
1554
  function _ts_decorate17(decorators, target, key, desc) {
1536
1555
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1740,6 +1759,26 @@ var SingletonFactoryWithIdGeneration = class extends SingletonFactory {
1740
1759
  __name(this, "SingletonFactoryWithIdGeneration");
1741
1760
  }
1742
1761
  _groupedData = /* @__PURE__ */ new Map();
1762
+ *instanceGroupInfoEntries() {
1763
+ for (const groupId of this.groupIds) {
1764
+ const group = this.getGroup(groupId);
1765
+ if (!group) {
1766
+ continue;
1767
+ }
1768
+ for (const [groupMemberId, id] of group) {
1769
+ const instance = this.getFromId(id);
1770
+ if (!instance) {
1771
+ continue;
1772
+ }
1773
+ yield {
1774
+ groupId,
1775
+ groupMemberId,
1776
+ id,
1777
+ instance
1778
+ };
1779
+ }
1780
+ }
1781
+ }
1743
1782
  getId(data) {
1744
1783
  const groupId = this.getGroupId(data);
1745
1784
  const groupMemberId = this.getGroupMemberId(data);
@@ -1748,6 +1787,12 @@ var SingletonFactoryWithIdGeneration = class extends SingletonFactory {
1748
1787
  isGroupRegistered(groupId) {
1749
1788
  return this._groupedData.has(groupId);
1750
1789
  }
1790
+ get groupIds() {
1791
+ return this._groupedData.keys();
1792
+ }
1793
+ getGroup(groupId) {
1794
+ return this._groupedData.get(groupId);
1795
+ }
1751
1796
  createId(data) {
1752
1797
  const groupId = this.getGroupId(data);
1753
1798
  let dataGroup = this._groupedData.get(groupId);
@@ -2014,6 +2059,251 @@ SequenceIdFactory = _ts_decorate20([
2014
2059
  ])
2015
2060
  ], SequenceIdFactory);
2016
2061
 
2062
+ // lib/value-metadata/array-metadata.ts
2063
+ function _ts_decorate21(decorators, target, key, desc) {
2064
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2065
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2066
+ 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;
2067
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2068
+ }
2069
+ __name(_ts_decorate21, "_ts_decorate");
2070
+ var ArrayMetadata = class {
2071
+ static {
2072
+ __name(this, "ArrayMetadata");
2073
+ }
2074
+ priority = 8;
2075
+ isAsync() {
2076
+ return false;
2077
+ }
2078
+ needsProxy() {
2079
+ return true;
2080
+ }
2081
+ applies(value) {
2082
+ return Array.isArray(value);
2083
+ }
2084
+ };
2085
+ ArrayMetadata = _ts_decorate21([
2086
+ injectable()
2087
+ ], ArrayMetadata);
2088
+
2089
+ // lib/value-metadata/date-metadata.ts
2090
+ function _ts_decorate22(decorators, target, key, desc) {
2091
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2092
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2093
+ 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;
2094
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2095
+ }
2096
+ __name(_ts_decorate22, "_ts_decorate");
2097
+ var DateMetadata = class {
2098
+ static {
2099
+ __name(this, "DateMetadata");
2100
+ }
2101
+ priority = 7;
2102
+ isAsync() {
2103
+ return false;
2104
+ }
2105
+ needsProxy() {
2106
+ return true;
2107
+ }
2108
+ applies(value) {
2109
+ return value instanceof Date;
2110
+ }
2111
+ };
2112
+ DateMetadata = _ts_decorate22([
2113
+ injectable()
2114
+ ], DateMetadata);
2115
+
2116
+ // lib/value-metadata/dummy-metadata.ts
2117
+ function _ts_decorate23(decorators, target, key, desc) {
2118
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2119
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2120
+ 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;
2121
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2122
+ }
2123
+ __name(_ts_decorate23, "_ts_decorate");
2124
+ var DummyMetadata = class {
2125
+ static {
2126
+ __name(this, "DummyMetadata");
2127
+ }
2128
+ priority = -1e3;
2129
+ isAsync() {
2130
+ return false;
2131
+ }
2132
+ needsProxy() {
2133
+ return false;
2134
+ }
2135
+ applies() {
2136
+ return true;
2137
+ }
2138
+ };
2139
+ DummyMetadata = _ts_decorate23([
2140
+ injectable()
2141
+ ], DummyMetadata);
2142
+
2143
+ // lib/value-metadata/map-metadata.ts
2144
+ function _ts_decorate24(decorators, target, key, desc) {
2145
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2146
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2147
+ 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;
2148
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2149
+ }
2150
+ __name(_ts_decorate24, "_ts_decorate");
2151
+ var MapMetadata = class {
2152
+ static {
2153
+ __name(this, "MapMetadata");
2154
+ }
2155
+ priority = 6;
2156
+ isAsync() {
2157
+ return false;
2158
+ }
2159
+ needsProxy() {
2160
+ return true;
2161
+ }
2162
+ applies(value) {
2163
+ return value instanceof Map;
2164
+ }
2165
+ };
2166
+ MapMetadata = _ts_decorate24([
2167
+ injectable()
2168
+ ], MapMetadata);
2169
+
2170
+ // lib/value-metadata/observable-metadata.ts
2171
+ import { Observable as Observable2 } from "rxjs";
2172
+ function _ts_decorate25(decorators, target, key, desc) {
2173
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2174
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2175
+ 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;
2176
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2177
+ }
2178
+ __name(_ts_decorate25, "_ts_decorate");
2179
+ var ObservableMetadata = class {
2180
+ static {
2181
+ __name(this, "ObservableMetadata");
2182
+ }
2183
+ priority = 5;
2184
+ isAsync() {
2185
+ return true;
2186
+ }
2187
+ needsProxy() {
2188
+ return true;
2189
+ }
2190
+ applies(value) {
2191
+ return value instanceof Observable2;
2192
+ }
2193
+ };
2194
+ ObservableMetadata = _ts_decorate25([
2195
+ injectable()
2196
+ ], ObservableMetadata);
2197
+
2198
+ // lib/value-metadata/promise-metadata.ts
2199
+ function _ts_decorate26(decorators, target, key, desc) {
2200
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2201
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2202
+ 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;
2203
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2204
+ }
2205
+ __name(_ts_decorate26, "_ts_decorate");
2206
+ var PromiseMetadata = class {
2207
+ static {
2208
+ __name(this, "PromiseMetadata");
2209
+ }
2210
+ priority = 4;
2211
+ isAsync() {
2212
+ return true;
2213
+ }
2214
+ needsProxy() {
2215
+ return true;
2216
+ }
2217
+ applies(value) {
2218
+ return value instanceof Promise;
2219
+ }
2220
+ };
2221
+ PromiseMetadata = _ts_decorate26([
2222
+ injectable()
2223
+ ], PromiseMetadata);
2224
+
2225
+ // lib/value-metadata/set-metadata.ts
2226
+ function _ts_decorate27(decorators, target, key, desc) {
2227
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2228
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2229
+ 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;
2230
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2231
+ }
2232
+ __name(_ts_decorate27, "_ts_decorate");
2233
+ var SetMetadata = class {
2234
+ static {
2235
+ __name(this, "SetMetadata");
2236
+ }
2237
+ priority = 3;
2238
+ isAsync() {
2239
+ return false;
2240
+ }
2241
+ needsProxy() {
2242
+ return true;
2243
+ }
2244
+ applies(value) {
2245
+ return value instanceof Set;
2246
+ }
2247
+ };
2248
+ SetMetadata = _ts_decorate27([
2249
+ injectable()
2250
+ ], SetMetadata);
2251
+
2252
+ // lib/value-metadata/value-metadata.ts
2253
+ function _ts_decorate28(decorators, target, key, desc) {
2254
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2255
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2256
+ 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;
2257
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2258
+ }
2259
+ __name(_ts_decorate28, "_ts_decorate");
2260
+ function _ts_metadata13(k, v) {
2261
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2262
+ }
2263
+ __name(_ts_metadata13, "_ts_metadata");
2264
+ function _ts_param11(paramIndex, decorator) {
2265
+ return function(target, key) {
2266
+ decorator(target, key, paramIndex);
2267
+ };
2268
+ }
2269
+ __name(_ts_param11, "_ts_param");
2270
+ var ValueMetadata = class {
2271
+ static {
2272
+ __name(this, "ValueMetadata");
2273
+ }
2274
+ priority = 11;
2275
+ _valueMetadataList;
2276
+ constructor(valueMetadataList) {
2277
+ this._valueMetadataList = [
2278
+ ...valueMetadataList
2279
+ ].sort((a, b) => b.priority - a.priority);
2280
+ }
2281
+ isAsync(value) {
2282
+ return this.getValueMetadata(value).isAsync(value);
2283
+ }
2284
+ needsProxy(value) {
2285
+ return this.getValueMetadata(value).needsProxy(value);
2286
+ }
2287
+ applies(value) {
2288
+ return !!this.getValueMetadata(value);
2289
+ }
2290
+ getValueMetadata(value) {
2291
+ const valueMetadata = this._valueMetadataList.find((valueMetadata2) => valueMetadata2.applies(value));
2292
+ if (!valueMetadata) {
2293
+ throw new UnsupportedException(`No accessor found for ${Type.toObject(value)?.constructor.name}}`);
2294
+ }
2295
+ return valueMetadata;
2296
+ }
2297
+ };
2298
+ ValueMetadata = _ts_decorate28([
2299
+ injectable(),
2300
+ _ts_param11(0, multiInject(RsXCoreInjectionTokens.IValueMetadataList)),
2301
+ _ts_metadata13("design:type", Function),
2302
+ _ts_metadata13("design:paramtypes", [
2303
+ Object
2304
+ ])
2305
+ ], ValueMetadata);
2306
+
2017
2307
  // lib/rs-x-core.module.ts
2018
2308
  var defaultIndexValueAccessorList = [
2019
2309
  {
@@ -2059,6 +2349,36 @@ var defaultDeeoCloneList = [
2059
2349
  token: RsXCoreInjectionTokens.ILodashDeepClone
2060
2350
  }
2061
2351
  ];
2352
+ var defaultValueMetadataList = [
2353
+ {
2354
+ target: ArrayMetadata,
2355
+ token: RsXCoreInjectionTokens.ArrayMetadata
2356
+ },
2357
+ {
2358
+ target: DateMetadata,
2359
+ token: RsXCoreInjectionTokens.DateMetadata
2360
+ },
2361
+ {
2362
+ target: DummyMetadata,
2363
+ token: RsXCoreInjectionTokens.DummyMetadata
2364
+ },
2365
+ {
2366
+ target: MapMetadata,
2367
+ token: RsXCoreInjectionTokens.MapMetadata
2368
+ },
2369
+ {
2370
+ target: ObservableMetadata,
2371
+ token: RsXCoreInjectionTokens.ObservableMetadata
2372
+ },
2373
+ {
2374
+ target: PromiseMetadata,
2375
+ token: RsXCoreInjectionTokens.PromiseMetadata
2376
+ },
2377
+ {
2378
+ target: SetMetadata,
2379
+ token: RsXCoreInjectionTokens.SetMetadata
2380
+ }
2381
+ ];
2062
2382
  var RsXCoreModule = new ContainerModule((options) => {
2063
2383
  options.bind(RsXCoreInjectionTokens.IInjectionContainer).toConstantValue(InjectionContainer);
2064
2384
  options.bind(RsXCoreInjectionTokens.IErrorLog).to(ErrorLog).inSingletonScope();
@@ -2072,12 +2392,14 @@ var RsXCoreModule = new ContainerModule((options) => {
2072
2392
  options.bind(RsXCoreInjectionTokens.IResolvedValueCache).to(ResolvedValueCache).inSingletonScope();
2073
2393
  options.bind(RsXCoreInjectionTokens.IDeepCloneExcept).to(DeepCloneValueExcept).inSingletonScope();
2074
2394
  options.bind(RsXCoreInjectionTokens.DefaultDeepCloneExcept).to(DeepCloneValueExcept).inSingletonScope();
2395
+ options.bind(RsXCoreInjectionTokens.IValueMetadata).to(ValueMetadata).inSingletonScope();
2075
2396
  registerMultiInjectServices(options, RsXCoreInjectionTokens.IIndexValueAccessorList, defaultIndexValueAccessorList);
2076
2397
  registerMultiInjectServices(options, RsXCoreInjectionTokens.IDeepCloneList, defaultDeeoCloneList);
2398
+ registerMultiInjectServices(options, RsXCoreInjectionTokens.IValueMetadataList, defaultValueMetadataList);
2077
2399
  });
2078
2400
 
2079
2401
  // lib/wait-for-event.ts
2080
- import { firstValueFrom, Observable as Observable2 } from "rxjs";
2402
+ import { firstValueFrom, Observable as Observable3 } from "rxjs";
2081
2403
  var WaitForEvent = class {
2082
2404
  static {
2083
2405
  __name(this, "WaitForEvent");
@@ -2133,7 +2455,7 @@ var WaitForEvent = class {
2133
2455
  const result = trigger();
2134
2456
  if (result instanceof Promise) {
2135
2457
  await result;
2136
- } else if (result instanceof Observable2) {
2458
+ } else if (result instanceof Observable3) {
2137
2459
  await firstValueFrom(result);
2138
2460
  }
2139
2461
  } catch (error) {
@@ -2158,12 +2480,17 @@ var WaitForEvent = class {
2158
2480
  export {
2159
2481
  ArgumentException,
2160
2482
  ArrayIndexAccessor,
2483
+ ArrayMetadata,
2161
2484
  Assertion,
2485
+ AssertionError,
2162
2486
  Container,
2163
2487
  ContainerModule,
2488
+ CustomError,
2489
+ DateMetadata,
2164
2490
  DatePropertyAccessor,
2165
2491
  DeepCloneValueExcept,
2166
2492
  DefaultDeepClone,
2493
+ DummyMetadata,
2167
2494
  EqualityService,
2168
2495
  ErrorLog,
2169
2496
  FunctionCallIndex,
@@ -2178,16 +2505,19 @@ export {
2178
2505
  InvalidOperationException,
2179
2506
  LodashDeepClone,
2180
2507
  MapKeyAccessor,
2508
+ MapMetadata,
2181
2509
  MethodAccessor,
2182
2510
  multiInject as MultiInject,
2183
2511
  NullOrEmptyException,
2184
2512
  NullOrUndefinedException,
2185
2513
  ObservableAccessor,
2514
+ ObservableMetadata,
2186
2515
  PENDING,
2187
2516
  ParserException,
2188
2517
  preDestroy as PreDestroy,
2189
2518
  PrettyPrinter,
2190
2519
  PromiseAccessor,
2520
+ PromiseMetadata,
2191
2521
  PropertyDescriptorType,
2192
2522
  PropertyValueAccessor,
2193
2523
  ResolvedValueCache,
@@ -2196,6 +2526,7 @@ export {
2196
2526
  SequenceIdFactory,
2197
2527
  SequenceWithId,
2198
2528
  SetKeyAccessor,
2529
+ SetMetadata,
2199
2530
  SingletonFactory,
2200
2531
  SingletonFactoryWithGuid,
2201
2532
  SingletonFactoryWithIdGeneration,
@@ -2204,10 +2535,12 @@ export {
2204
2535
  UnexpectedException,
2205
2536
  unmanaged as Unmanaged,
2206
2537
  UnsupportedException,
2538
+ ValueMetadata,
2207
2539
  WaitForEvent,
2208
2540
  dataProperties,
2209
2541
  defaultDeeoCloneList,
2210
2542
  defaultIndexValueAccessorList,
2543
+ defaultValueMetadataList,
2211
2544
  echo,
2212
2545
  emptyFunction,
2213
2546
  emptyValue,