com.fofx.observething 1.1.0 → 1.1.1-dev.161

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.
Files changed (99) hide show
  1. package/Runtime/{Operators/IInitializationOperationsProvider.cs → IInitializationOperationsProvider.cs} +1 -1
  2. package/Runtime/{IObservable.cs → Observables/IObservable.cs} +13 -9
  3. package/Runtime/{Implementations/ObservableBase.cs → Observables/Observable.cs} +6 -19
  4. package/Runtime/{Implementations → Observables}/ObservableCollection.cs +6 -15
  5. package/Runtime/{Implementations → Observables}/ObservableDictionary.cs +7 -18
  6. package/Runtime/{Implementations/Observable.cs → Observables/ObservableEventStream.cs} +11 -3
  7. package/Runtime/{Implementations → Observables}/ObservableList.cs +3 -13
  8. package/Runtime/{Implementations → Observables}/ObservableSet.cs +6 -15
  9. package/Runtime/{Implementations → Observables}/ObservableValue.cs +4 -11
  10. package/Runtime/Observables.meta +1 -1
  11. package/Runtime/ObservationDefaults.cs +10 -0
  12. package/Runtime/ObservationDefaults.cs.meta +2 -0
  13. package/Runtime/Observers.cs +51 -64
  14. package/Runtime/Operators/BatchOperator.cs +52 -51
  15. package/Runtime/Operators/BatchOperator.cs.meta +1 -1
  16. package/Runtime/{Observables/CastObservable.cs → Operators/CastOperator.cs} +10 -10
  17. package/Runtime/{Observables/CombineObservable.cs → Operators/CombineOperator.cs} +10 -10
  18. package/Runtime/{Observables/CombineValueObservable.cs → Operators/CombineValueOperator.cs} +12 -12
  19. package/Runtime/{Observables/ConcatObservable.cs → Operators/ConcatOperator.cs} +2 -2
  20. package/Runtime/{Observables/ContainsObservable.cs → Operators/ContainsOperator.cs} +2 -2
  21. package/Runtime/Operators/ContainsOperator.cs.meta +2 -0
  22. package/Runtime/{Observables/CountObservable.cs → Operators/CountOperator.cs} +2 -2
  23. package/Runtime/{Observables/DistinctObservable.cs → Operators/DistinctOperator.cs} +2 -2
  24. package/Runtime/Operators/{CollectionOperator.cs → Factories/CollectionOperatorFactory.cs} +2 -9
  25. package/Runtime/Operators/{DictionaryOperator.cs → Factories/DictionaryOperatorFactory.cs} +2 -9
  26. package/Runtime/Operators/{ObservableOperator.cs → Factories/EventStreamOperatorFactory.cs} +17 -10
  27. package/Runtime/Operators/{ListOperator.cs → Factories/ListOperatorFactory.cs} +2 -9
  28. package/Runtime/Operators/{Operator.cs → Factories/OperatorFactory.cs} +8 -8
  29. package/Runtime/Operators/{SetOperator.cs → Factories/SetOperatorFactory.cs} +2 -9
  30. package/Runtime/Operators/{ValueOperator.cs → Factories/ValueOperator.cs} +2 -9
  31. package/Runtime/{Implementations.meta → Operators/Factories.meta} +1 -1
  32. package/Runtime/{Observables/FirstObservable.cs → Operators/FirstOperator.cs} +2 -2
  33. package/Runtime/{Observables/IndexOfObservable.cs → Operators/IndexOfOperator.cs} +2 -2
  34. package/Runtime/Operators/OperationStreamOperator.cs +212 -0
  35. package/Runtime/{Observables.cs → Operators/Operators.cs} +105 -73
  36. package/Runtime/{Observables/OrderByObservable.cs → Operators/OrderByOperator.cs} +2 -2
  37. package/Runtime/{Observables/SelectCollectionObservable.cs → Operators/SelectCollectionOperator.cs} +2 -2
  38. package/Runtime/{Observables/SelectListObservable.cs → Operators/SelectListOperator.cs} +2 -2
  39. package/Runtime/{Observables/SelectManyObservable.cs → Operators/SelectManyOperator.cs} +2 -2
  40. package/Runtime/{Observables/SkipWhileObservable.cs → Operators/SkipWhileOperator.cs} +2 -2
  41. package/Runtime/{Observables/ThenObservable.cs → Operators/ThenOperator.cs} +2 -2
  42. package/Runtime/{Observables/ToDictionaryObservable.cs → Operators/ToDictionaryOperator.cs} +3 -3
  43. package/Runtime/{Observables/TrackObservable.cs → Operators/TrackOperator.cs} +2 -2
  44. package/Runtime/{Observables/UnwrapCollectionObservable.cs → Operators/UnwrapCollectionOperator.cs} +2 -2
  45. package/Runtime/{Observables/UnwrapListObservable.cs → Operators/UnwrapListOperator.cs} +2 -2
  46. package/Runtime/{Observables/UnwrapValueObservable.cs → Operators/UnwrapValueOperator.cs} +2 -2
  47. package/Runtime/{Observables/WhereObservable.cs → Operators/WhereOperator.cs} +2 -2
  48. package/Runtime/{Observables/WithPreviousObservable.cs → Operators/WithPreviousOperator.cs} +2 -2
  49. package/Tests/CollectionObservableTests.cs +1 -1
  50. package/Tests/DictionaryObservableTests.cs +1 -1
  51. package/Tests/ListObservableTests.cs +1 -1
  52. package/Tests/ObservationContextTests.cs +109 -83
  53. package/Tests/ValueObservableTests.cs +1 -1
  54. package/package.json +5 -4
  55. package/Runtime/Observables/BatchObservable.cs +0 -72
  56. package/Runtime/Observables/BatchObservable.cs.meta +0 -2
  57. package/Runtime/Observables/ContainsObservable.cs.meta +0 -2
  58. package/Runtime/Observables/OperationStreamObservable.cs +0 -194
  59. /package/Runtime/{Operators/IInitializationOperationsProvider.cs.meta → IInitializationOperationsProvider.cs.meta} +0 -0
  60. /package/Runtime/{IObservable.cs.meta → Observables/IObservable.cs.meta} +0 -0
  61. /package/Runtime/{Implementations/ObservableBase.cs.meta → Observables/Observable.cs.meta} +0 -0
  62. /package/Runtime/{Implementations → Observables}/ObservableCollection.cs.meta +0 -0
  63. /package/Runtime/{Implementations → Observables}/ObservableDictionary.cs.meta +0 -0
  64. /package/Runtime/{Implementations/Observable.cs.meta → Observables/ObservableEventStream.cs.meta} +0 -0
  65. /package/Runtime/{Implementations → Observables}/ObservableList.cs.meta +0 -0
  66. /package/Runtime/{Implementations → Observables}/ObservableSet.cs.meta +0 -0
  67. /package/Runtime/{Implementations → Observables}/ObservableValue.cs.meta +0 -0
  68. /package/Runtime/{Observables/CastObservable.cs.meta → Operators/CastOperator.cs.meta} +0 -0
  69. /package/Runtime/{Observables/CombineObservable.cs.meta → Operators/CombineOperator.cs.meta} +0 -0
  70. /package/Runtime/{Observables/CombineValueObservable.cs.meta → Operators/CombineValueOperator.cs.meta} +0 -0
  71. /package/Runtime/{Observables/ConcatObservable.cs.meta → Operators/ConcatOperator.cs.meta} +0 -0
  72. /package/Runtime/{Observables/CountObservable.cs.meta → Operators/CountOperator.cs.meta} +0 -0
  73. /package/Runtime/{Observables/DistinctObservable.cs.meta → Operators/DistinctOperator.cs.meta} +0 -0
  74. /package/Runtime/Operators/{CollectionOperator.cs.meta → Factories/CollectionOperatorFactory.cs.meta} +0 -0
  75. /package/Runtime/Operators/{DictionaryOperator.cs.meta → Factories/DictionaryOperatorFactory.cs.meta} +0 -0
  76. /package/Runtime/Operators/{ObservableOperator.cs.meta → Factories/EventStreamOperatorFactory.cs.meta} +0 -0
  77. /package/Runtime/Operators/{ListOperator.cs.meta → Factories/ListOperatorFactory.cs.meta} +0 -0
  78. /package/Runtime/Operators/{Operator.cs.meta → Factories/OperatorFactory.cs.meta} +0 -0
  79. /package/Runtime/Operators/{SetOperator.cs.meta → Factories/SetOperatorFactory.cs.meta} +0 -0
  80. /package/Runtime/Operators/{ValueOperator.cs.meta → Factories/ValueOperator.cs.meta} +0 -0
  81. /package/Runtime/{Observables/FirstObservable.cs.meta → Operators/FirstOperator.cs.meta} +0 -0
  82. /package/Runtime/{Observables/IndexOfObservable.cs.meta → Operators/IndexOfOperator.cs.meta} +0 -0
  83. /package/Runtime/{Observables/OperationStreamObservable.cs.meta → Operators/OperationStreamOperator.cs.meta} +0 -0
  84. /package/Runtime/{Observables.cs.meta → Operators/Operators.cs.meta} +0 -0
  85. /package/Runtime/{Observables/OrderByObservable.cs.meta → Operators/OrderByOperator.cs.meta} +0 -0
  86. /package/Runtime/{Observables/SelectCollectionObservable.cs.meta → Operators/SelectCollectionOperator.cs.meta} +0 -0
  87. /package/Runtime/{Observables/SelectListObservable.cs.meta → Operators/SelectListOperator.cs.meta} +0 -0
  88. /package/Runtime/{Observables/SelectManyObservable.cs.meta → Operators/SelectManyOperator.cs.meta} +0 -0
  89. /package/Runtime/{Observables/SelectValueObservable.cs → Operators/SelectValueOperator.cs} +0 -0
  90. /package/Runtime/{Observables/SelectValueObservable.cs.meta → Operators/SelectValueOperator.cs.meta} +0 -0
  91. /package/Runtime/{Observables/SkipWhileObservable.cs.meta → Operators/SkipWhileOperator.cs.meta} +0 -0
  92. /package/Runtime/{Observables/ThenObservable.cs.meta → Operators/ThenOperator.cs.meta} +0 -0
  93. /package/Runtime/{Observables/ToDictionaryObservable.cs.meta → Operators/ToDictionaryOperator.cs.meta} +0 -0
  94. /package/Runtime/{Observables/TrackObservable.cs.meta → Operators/TrackOperator.cs.meta} +0 -0
  95. /package/Runtime/{Observables/UnwrapCollectionObservable.cs.meta → Operators/UnwrapCollectionOperator.cs.meta} +0 -0
  96. /package/Runtime/{Observables/UnwrapListObservable.cs.meta → Operators/UnwrapListOperator.cs.meta} +0 -0
  97. /package/Runtime/{Observables/UnwrapValueObservable.cs.meta → Operators/UnwrapValueOperator.cs.meta} +0 -0
  98. /package/Runtime/{Observables/WhereObservable.cs.meta → Operators/WhereOperator.cs.meta} +0 -0
  99. /package/Runtime/{Observables/WithPreviousObservable.cs.meta → Operators/WithPreviousOperator.cs.meta} +0 -0
@@ -1,194 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
-
4
- namespace ObserveThing
5
- {
6
- public class ValueOperationStreamObservable<T> : IInitializationOperationsProvider<ValueOp<T>>, IDisposable
7
- {
8
- private IValueObservable<T> _source;
9
- private Observable<ValueOp<T>> _operand;
10
- private IDisposable _subscriptions;
11
-
12
- public ValueOperationStreamObservable(IValueObservable<T> source, Observable<ValueOp<T>> operand)
13
- {
14
- _source = source;
15
- _operand = operand;
16
-
17
- _subscriptions = _source.Subscribe(
18
- onNext: x => operand.EnqueueOperation(new() { source = _source, value = x }),
19
- onDispose: Dispose,
20
- onError: operand.OnError,
21
- immediate: true
22
- );
23
- }
24
-
25
- public IEnumerable<ValueOp<T>> GetInitializationOperations()
26
- {
27
- var initOperations = new List<ValueOp<T>>();
28
- var subscription = _source.Subscribe(x => initOperations.Add(new ValueOp<T>() { source = _source, value = x }));
29
- subscription.Dispose();
30
-
31
- foreach (var op in initOperations)
32
- yield return op;
33
- }
34
-
35
- public void Dispose()
36
- {
37
- _subscriptions?.Dispose();
38
- _subscriptions = null;
39
- _operand.Dispose();
40
- }
41
- }
42
-
43
- public class CollectionOperationStreamObservable<T> : IInitializationOperationsProvider<CollectionOp<T>>, IDisposable
44
- {
45
- private ICollectionObservable<T> _source;
46
- private Observable<CollectionOp<T>> _operand;
47
- private IDisposable _subscriptions;
48
-
49
- public CollectionOperationStreamObservable(ICollectionObservable<T> source, Observable<CollectionOp<T>> operand)
50
- {
51
- _source = source;
52
- _operand = operand;
53
-
54
- _subscriptions = _source.SubscribeWithId(
55
- onAdd: (id, element) => operand.EnqueueOperation(new() { source = _source, elementId = id, element = element, isRemove = false }),
56
- onRemove: (id, element) => operand.EnqueueOperation(new() { source = _source, elementId = id, element = element, isRemove = true }),
57
- onDispose: Dispose,
58
- onError: operand.OnError,
59
- immediate: true
60
- );
61
- }
62
-
63
- public IEnumerable<CollectionOp<T>> GetInitializationOperations()
64
- {
65
- var initOperations = new List<CollectionOp<T>>();
66
- var subscription = _source.SubscribeWithId((id, element) => initOperations.Add(new CollectionOp<T>() { source = _source, elementId = id, element = element }));
67
- subscription.Dispose();
68
-
69
- foreach (var op in initOperations)
70
- yield return op;
71
- }
72
-
73
- public void Dispose()
74
- {
75
- _subscriptions?.Dispose();
76
- _subscriptions = null;
77
- _operand.Dispose();
78
- }
79
- }
80
-
81
- public class ListOperationStreamObservable<T> : IInitializationOperationsProvider<ListOp<T>>, IDisposable
82
- {
83
- private IListObservable<T> _source;
84
- private Observable<ListOp<T>> _operand;
85
- private IDisposable _subscriptions;
86
-
87
- public ListOperationStreamObservable(IListObservable<T> source, Observable<ListOp<T>> operand)
88
- {
89
- _source = source;
90
- _operand = operand;
91
-
92
- _subscriptions = _source.SubscribeWithId(
93
- onAdd: (id, index, element) => operand.EnqueueOperation(new() { source = _source, elementId = id, index = index, element = element, isRemove = false }),
94
- onRemove: (id, index, element) => operand.EnqueueOperation(new() { source = _source, elementId = id, index = index, element = element, isRemove = true }),
95
- onDispose: Dispose,
96
- onError: operand.OnError,
97
- immediate: true
98
- );
99
- }
100
-
101
- public IEnumerable<ListOp<T>> GetInitializationOperations()
102
- {
103
- var initOperations = new List<ListOp<T>>();
104
- var subscription = _source.SubscribeWithId((id, index, element) => initOperations.Add(new ListOp<T>() { source = _source, elementId = id, index = index, element = element }));
105
- subscription.Dispose();
106
-
107
- foreach (var op in initOperations)
108
- yield return op;
109
- }
110
-
111
- public void Dispose()
112
- {
113
- _subscriptions?.Dispose();
114
- _subscriptions = null;
115
- _operand.Dispose();
116
- }
117
- }
118
-
119
- public class DictionaryOperationStreamObservable<TKey, TValue> : IInitializationOperationsProvider<DictionaryOp<TKey, TValue>>, IDisposable
120
- {
121
- private IDictionaryObservable<TKey, TValue> _source;
122
- private Observable<DictionaryOp<TKey, TValue>> _operand;
123
- private IDisposable _subscriptions;
124
-
125
- public DictionaryOperationStreamObservable(IDictionaryObservable<TKey, TValue> source, Observable<DictionaryOp<TKey, TValue>> operand)
126
- {
127
- _source = source;
128
- _operand = operand;
129
-
130
- _subscriptions = _source.SubscribeWithId(
131
- onAdd: (id, kvp) => operand.EnqueueOperation(new() { source = _source, elementId = id, key = kvp.Key, value = kvp.Value, isRemove = false }),
132
- onRemove: (id, kvp) => operand.EnqueueOperation(new() { source = _source, elementId = id, key = kvp.Key, value = kvp.Value, isRemove = true }),
133
- onDispose: Dispose,
134
- onError: operand.OnError,
135
- immediate: true
136
- );
137
- }
138
-
139
- public IEnumerable<DictionaryOp<TKey, TValue>> GetInitializationOperations()
140
- {
141
- var initOperations = new List<DictionaryOp<TKey, TValue>>();
142
- var subscription = _source.SubscribeWithId((id, kvp) => initOperations.Add(new DictionaryOp<TKey, TValue>() { source = _source, elementId = id, key = kvp.Key, value = kvp.Value }));
143
- subscription.Dispose();
144
-
145
- foreach (var op in initOperations)
146
- yield return op;
147
- }
148
-
149
- public void Dispose()
150
- {
151
- _subscriptions?.Dispose();
152
- _subscriptions = null;
153
- _operand.Dispose();
154
- }
155
- }
156
-
157
- public class SetOperationStreamObservable<T> : IInitializationOperationsProvider<SetOp<T>>, IDisposable
158
- {
159
- private ISetObservable<T> _source;
160
- private Observable<SetOp<T>> _operand;
161
- private IDisposable _subscriptions;
162
-
163
- public SetOperationStreamObservable(ISetObservable<T> source, Observable<SetOp<T>> operand)
164
- {
165
- _source = source;
166
- _operand = operand;
167
-
168
- _subscriptions = _source.SubscribeWithId(
169
- onAdd: (id, element) => operand.EnqueueOperation(new() { source = _source, elementId = id, element = element, isRemove = false }),
170
- onRemove: (id, element) => operand.EnqueueOperation(new() { source = _source, elementId = id, element = element, isRemove = true }),
171
- onDispose: Dispose,
172
- onError: operand.OnError,
173
- immediate: true
174
- );
175
- }
176
-
177
- public IEnumerable<SetOp<T>> GetInitializationOperations()
178
- {
179
- var initOperations = new List<SetOp<T>>();
180
- var subscription = _source.SubscribeWithId((id, element) => initOperations.Add(new SetOp<T>() { source = _source, elementId = id, element = element }));
181
- subscription.Dispose();
182
-
183
- foreach (var op in initOperations)
184
- yield return op;
185
- }
186
-
187
- public void Dispose()
188
- {
189
- _subscriptions?.Dispose();
190
- _subscriptions = null;
191
- _operand.Dispose();
192
- }
193
- }
194
- }