@vorplex/core 0.0.4 → 0.0.9

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 (187) hide show
  1. package/dist/consts/mime-type.const.d.ts +456 -0
  2. package/dist/consts/mime-type.const.js +456 -0
  3. package/dist/consts/unit.const.d.ts +22 -0
  4. package/dist/consts/unit.const.js +22 -0
  5. package/dist/functions/debounce.function.d.ts +1 -0
  6. package/dist/functions/debounce.function.js +12 -0
  7. package/dist/functions/is-node-environment.function.d.ts +1 -0
  8. package/dist/functions/is-node-environment.function.js +3 -0
  9. package/dist/functions/parse-path-selector.function.d.ts +2 -0
  10. package/dist/functions/parse-path-selector.function.js +17 -0
  11. package/dist/functions/parse-url.function.d.ts +12 -0
  12. package/dist/functions/parse-url.function.js +25 -0
  13. package/dist/index.d.ts +92 -0
  14. package/dist/index.js +93 -0
  15. package/dist/interfaces/group.interface.d.ts +4 -0
  16. package/dist/interfaces/group.interface.js +0 -0
  17. package/dist/interfaces/key-value.interface.d.ts +4 -0
  18. package/dist/interfaces/key-value.interface.js +0 -0
  19. package/dist/modules/api/socket.model.d.ts +26 -0
  20. package/dist/modules/api/socket.model.js +66 -0
  21. package/dist/modules/api/web-client.model.d.ts +16 -0
  22. package/dist/modules/api/web-client.model.js +34 -0
  23. package/dist/modules/array/array.util.d.ts +17 -0
  24. package/dist/modules/array/array.util.js +105 -0
  25. package/dist/modules/changes/changes.util.d.ts +45 -0
  26. package/dist/modules/changes/changes.util.js +330 -0
  27. package/dist/modules/color/color-data.interface.d.ts +10 -0
  28. package/dist/modules/color/color-data.interface.js +0 -0
  29. package/dist/modules/color/color-formats.const.d.ts +9 -0
  30. package/dist/modules/color/color-formats.const.js +8 -0
  31. package/dist/modules/color/color.type.d.ts +4 -0
  32. package/dist/modules/color/color.type.js +0 -0
  33. package/dist/modules/color/color.util.d.ts +41 -0
  34. package/dist/modules/color/color.util.js +327 -0
  35. package/dist/modules/color/colors.const.d.ts +151 -0
  36. package/dist/modules/color/colors.const.js +150 -0
  37. package/dist/modules/color/hsl.interface.d.ts +6 -0
  38. package/dist/modules/color/hsl.interface.js +0 -0
  39. package/dist/modules/color/hsv.interface.d.ts +6 -0
  40. package/dist/modules/color/hsv.interface.js +0 -0
  41. package/dist/modules/color/rgb.interface.d.ts +6 -0
  42. package/dist/modules/color/rgb.interface.js +0 -0
  43. package/dist/modules/compression/compression.util.d.ts +4 -0
  44. package/dist/modules/compression/compression.util.js +52 -0
  45. package/dist/modules/date/date.util.d.ts +37 -0
  46. package/dist/modules/date/date.util.js +84 -0
  47. package/dist/modules/enum/enum.util.d.ts +17 -0
  48. package/dist/modules/enum/enum.util.js +69 -0
  49. package/dist/modules/hash/hash.util.d.ts +3 -0
  50. package/dist/modules/hash/hash.util.js +9 -0
  51. package/dist/modules/id/id.util.d.ts +7 -0
  52. package/dist/modules/id/id.util.js +33 -0
  53. package/dist/modules/injector/decorators/inject-token.decorator.d.ts +14 -0
  54. package/dist/modules/injector/decorators/inject-token.decorator.js +12 -0
  55. package/dist/modules/injector/decorators/injectable.decorator.d.ts +9 -0
  56. package/dist/modules/injector/decorators/injectable.decorator.js +7 -0
  57. package/dist/modules/injector/injector.model.d.ts +25 -0
  58. package/dist/modules/injector/injector.model.js +152 -0
  59. package/dist/modules/injector/provider-scopes.enum.d.ts +5 -0
  60. package/dist/modules/injector/provider-scopes.enum.js +6 -0
  61. package/dist/modules/injector/provider.interface.d.ts +10 -0
  62. package/dist/modules/injector/provider.interface.js +0 -0
  63. package/dist/modules/json-filter/json-filter.function.d.ts +41 -0
  64. package/dist/modules/json-filter/json-filter.function.js +75 -0
  65. package/dist/modules/logging/console-logger.model.d.ts +36 -0
  66. package/dist/modules/logging/console-logger.model.js +44 -0
  67. package/dist/modules/logging/logger.model.d.ts +6 -0
  68. package/dist/modules/logging/logger.model.js +7 -0
  69. package/dist/modules/logging/task.d.ts +38 -0
  70. package/dist/modules/logging/task.js +133 -0
  71. package/dist/modules/math/line.d.ts +12 -0
  72. package/dist/modules/math/line.js +50 -0
  73. package/dist/modules/math/point.d.ts +34 -0
  74. package/dist/modules/math/point.js +71 -0
  75. package/dist/modules/math/polygon.d.ts +45 -0
  76. package/dist/modules/math/polygon.js +273 -0
  77. package/dist/modules/math/rect.d.ts +6 -0
  78. package/dist/modules/math/rect.js +0 -0
  79. package/dist/modules/math/size.d.ts +4 -0
  80. package/dist/modules/math/size.js +0 -0
  81. package/dist/modules/number/number.util.d.ts +9 -0
  82. package/dist/modules/number/number.util.js +27 -0
  83. package/dist/modules/object/object.util.d.ts +7 -0
  84. package/dist/modules/object/object.util.js +63 -0
  85. package/dist/modules/path/path.util.d.ts +11 -0
  86. package/dist/modules/path/path.util.js +59 -0
  87. package/dist/modules/random/random.util.d.ts +17 -0
  88. package/dist/modules/random/random.util.js +57 -0
  89. package/dist/modules/readable-stream/readable-stream.util.d.ts +3 -0
  90. package/dist/modules/readable-stream/readable-stream.util.js +26 -0
  91. package/dist/modules/reflection/interfaces/parameter.interface.d.ts +4 -0
  92. package/dist/modules/reflection/interfaces/parameter.interface.js +0 -0
  93. package/dist/modules/reflection/models/attribute.model.d.ts +12 -0
  94. package/dist/modules/reflection/models/attribute.model.js +17 -0
  95. package/dist/modules/reflection/models/class-attribute.model.d.ts +4 -0
  96. package/dist/modules/reflection/models/class-attribute.model.js +6 -0
  97. package/dist/modules/reflection/models/method-attribute.model.d.ts +5 -0
  98. package/dist/modules/reflection/models/method-attribute.model.js +8 -0
  99. package/dist/modules/reflection/models/parameter-attribute.model.d.ts +7 -0
  100. package/dist/modules/reflection/models/parameter-attribute.model.js +21 -0
  101. package/dist/modules/reflection/models/property-attribute.model.d.ts +5 -0
  102. package/dist/modules/reflection/models/property-attribute.model.js +8 -0
  103. package/dist/modules/reflection/models/property-proxy-attribute.model.d.ts +15 -0
  104. package/dist/modules/reflection/models/property-proxy-attribute.model.js +19 -0
  105. package/dist/modules/reflection/types/constructor.type.d.ts +2 -0
  106. package/dist/modules/reflection/types/constructor.type.js +0 -0
  107. package/dist/modules/reflection/types/instance.type.d.ts +7 -0
  108. package/dist/modules/reflection/types/instance.type.js +0 -0
  109. package/dist/modules/reflection/types/type.type.d.ts +2 -0
  110. package/dist/modules/reflection/types/type.type.js +0 -0
  111. package/dist/modules/reflection/utils/decorator.util.d.ts +70 -0
  112. package/dist/modules/reflection/utils/decorator.util.js +135 -0
  113. package/dist/modules/reflection/utils/reflection.util.d.ts +140 -0
  114. package/dist/modules/reflection/utils/reflection.util.js +311 -0
  115. package/dist/modules/router/router.util.d.ts +33 -0
  116. package/dist/modules/router/router.util.js +59 -0
  117. package/dist/modules/state/adaptors/array/array-adaptor.util.d.ts +25 -0
  118. package/dist/modules/state/adaptors/array/array-adaptor.util.js +97 -0
  119. package/dist/modules/state/adaptors/entity/entity-adaptor.util.d.ts +35 -0
  120. package/dist/modules/state/adaptors/entity/entity-adaptor.util.js +158 -0
  121. package/dist/modules/state/adaptors/entity/entity-map.type.d.ts +4 -0
  122. package/dist/modules/state/adaptors/entity/entity-map.type.js +0 -0
  123. package/dist/modules/state/adaptors/entity/entity.interface.d.ts +3 -0
  124. package/dist/modules/state/adaptors/entity/entity.interface.js +0 -0
  125. package/dist/modules/state/state.model.d.ts +46 -0
  126. package/dist/modules/state/state.model.js +129 -0
  127. package/dist/modules/state/update.type.d.ts +2 -0
  128. package/dist/modules/state/update.type.js +0 -0
  129. package/dist/modules/string/string.util.d.ts +11 -0
  130. package/dist/modules/string/string.util.js +42 -0
  131. package/dist/modules/subscribable/subscribable.model.d.ts +10 -0
  132. package/dist/modules/subscribable/subscribable.model.js +34 -0
  133. package/dist/modules/subscribable/subscription.interface.d.ts +3 -0
  134. package/dist/modules/subscribable/subscription.interface.js +0 -0
  135. package/dist/modules/tson/error.d.ts +8 -0
  136. package/dist/modules/tson/error.js +13 -0
  137. package/dist/modules/tson/schema.d.ts +10 -0
  138. package/dist/modules/tson/schema.js +0 -0
  139. package/dist/modules/tson/schemas/any.d.ts +14 -0
  140. package/dist/modules/tson/schemas/any.js +27 -0
  141. package/dist/modules/tson/schemas/array.d.ts +21 -0
  142. package/dist/modules/tson/schemas/array.js +80 -0
  143. package/dist/modules/tson/schemas/boolean.d.ts +14 -0
  144. package/dist/modules/tson/schemas/boolean.js +38 -0
  145. package/dist/modules/tson/schemas/enum.d.ts +15 -0
  146. package/dist/modules/tson/schemas/enum.js +43 -0
  147. package/dist/modules/tson/schemas/number.d.ts +20 -0
  148. package/dist/modules/tson/schemas/number.js +66 -0
  149. package/dist/modules/tson/schemas/object.d.ts +33 -0
  150. package/dist/modules/tson/schemas/object.js +88 -0
  151. package/dist/modules/tson/schemas/schema-base.d.ts +12 -0
  152. package/dist/modules/tson/schemas/schema-base.js +14 -0
  153. package/dist/modules/tson/schemas/string.d.ts +19 -0
  154. package/dist/modules/tson/schemas/string.js +60 -0
  155. package/dist/modules/tson/schemas/union.d.ts +16 -0
  156. package/dist/modules/tson/schemas/union.js +56 -0
  157. package/dist/modules/tson/tson.d.ts +41 -0
  158. package/dist/modules/tson/tson.js +138 -0
  159. package/dist/modules/tson/type.d.ts +53 -0
  160. package/dist/modules/tson/type.js +0 -0
  161. package/dist/modules/value/value.util.d.ts +18 -0
  162. package/dist/modules/value/value.util.js +180 -0
  163. package/dist/types/awaitable.type.d.ts +1 -0
  164. package/dist/types/awaitable.type.js +0 -0
  165. package/dist/types/camel-to-kebab.type.d.ts +1 -0
  166. package/dist/types/camel-to-kebab.type.js +0 -0
  167. package/dist/types/has-key.type.d.ts +3 -0
  168. package/dist/types/has-key.type.js +0 -0
  169. package/dist/types/is-union.type.d.ts +1 -0
  170. package/dist/types/is-union.type.js +0 -0
  171. package/dist/types/keys-of-type.type.d.ts +5 -0
  172. package/dist/types/keys-of-type.type.js +0 -0
  173. package/dist/types/keys-with-fix.type.d.ts +3 -0
  174. package/dist/types/keys-with-fix.type.js +0 -0
  175. package/dist/types/optional-keys.type.d.ts +6 -0
  176. package/dist/types/optional-keys.type.js +0 -0
  177. package/dist/types/partial.type.d.ts +6 -0
  178. package/dist/types/partial.type.js +0 -0
  179. package/dist/types/predicate.type.d.ts +1 -0
  180. package/dist/types/predicate.type.js +0 -0
  181. package/dist/types/recursive-readonly.type.d.ts +3 -0
  182. package/dist/types/recursive-readonly.type.js +0 -0
  183. package/dist/types/recursive-value.type.d.ts +3 -0
  184. package/dist/types/recursive-value.type.js +0 -0
  185. package/dist/types/selector.type.d.ts +1 -0
  186. package/dist/types/selector.type.js +0 -0
  187. package/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ export * from './consts/mime-type.const';
2
+ export * from './consts/unit.const';
3
+ export * from './functions/debounce.function';
4
+ export * from './functions/is-node-environment.function';
5
+ export * from './functions/parse-path-selector.function';
6
+ export * from './functions/parse-url.function';
7
+ export * from './interfaces/group.interface';
8
+ export * from './interfaces/key-value.interface';
9
+ export * from './modules/api/socket.model';
10
+ export * from './modules/api/web-client.model';
11
+ export * from './modules/array/array.util';
12
+ export * from './modules/changes/changes.util';
13
+ export * from './modules/color/color-data.interface';
14
+ export * from './modules/color/color-formats.const';
15
+ export * from './modules/color/color.type';
16
+ export * from './modules/color/color.util';
17
+ export * from './modules/color/colors.const';
18
+ export * from './modules/color/hsl.interface';
19
+ export * from './modules/color/hsv.interface';
20
+ export * from './modules/color/rgb.interface';
21
+ export * from './modules/compression/compression.util';
22
+ export * from './modules/date/date.util';
23
+ export * from './modules/enum/enum.util';
24
+ export * from './modules/hash/hash.util';
25
+ export * from './modules/id/id.util';
26
+ export * from './modules/injector/injector.model';
27
+ export * from './modules/injector/provider-scopes.enum';
28
+ export * from './modules/injector/provider.interface';
29
+ export * from './modules/injector/decorators/inject-token.decorator';
30
+ export * from './modules/injector/decorators/injectable.decorator';
31
+ export * from './modules/json-filter/json-filter.function';
32
+ export * from './modules/logging/console-logger.model';
33
+ export * from './modules/logging/logger.model';
34
+ export * from './modules/logging/task';
35
+ export * from './modules/math/line';
36
+ export * from './modules/math/point';
37
+ export * from './modules/math/polygon';
38
+ export * from './modules/math/rect';
39
+ export * from './modules/math/size';
40
+ export * from './modules/number/number.util';
41
+ export * from './modules/object/object.util';
42
+ export * from './modules/path/path.util';
43
+ export * from './modules/random/random.util';
44
+ export * from './modules/readable-stream/readable-stream.util';
45
+ export * from './modules/reflection/interfaces/parameter.interface';
46
+ export * from './modules/reflection/models/attribute.model';
47
+ export * from './modules/reflection/models/class-attribute.model';
48
+ export * from './modules/reflection/models/method-attribute.model';
49
+ export * from './modules/reflection/models/parameter-attribute.model';
50
+ export * from './modules/reflection/models/property-attribute.model';
51
+ export * from './modules/reflection/models/property-proxy-attribute.model';
52
+ export * from './modules/reflection/types/constructor.type';
53
+ export * from './modules/reflection/types/instance.type';
54
+ export * from './modules/reflection/types/type.type';
55
+ export * from './modules/reflection/utils/decorator.util';
56
+ export * from './modules/reflection/utils/reflection.util';
57
+ export * from './modules/router/router.util';
58
+ export * from './modules/state/state.model';
59
+ export * from './modules/state/update.type';
60
+ export * from './modules/state/adaptors/array/array-adaptor.util';
61
+ export * from './modules/state/adaptors/entity/entity-adaptor.util';
62
+ export * from './modules/state/adaptors/entity/entity-map.type';
63
+ export * from './modules/state/adaptors/entity/entity.interface';
64
+ export * from './modules/string/string.util';
65
+ export * from './modules/subscribable/subscribable.model';
66
+ export * from './modules/subscribable/subscription.interface';
67
+ export * from './modules/tson/error';
68
+ export * from './modules/tson/schema';
69
+ export * from './modules/tson/tson';
70
+ export * from './modules/tson/type';
71
+ export * from './modules/tson/schemas/any';
72
+ export * from './modules/tson/schemas/array';
73
+ export * from './modules/tson/schemas/boolean';
74
+ export * from './modules/tson/schemas/enum';
75
+ export * from './modules/tson/schemas/number';
76
+ export * from './modules/tson/schemas/object';
77
+ export * from './modules/tson/schemas/schema-base';
78
+ export * from './modules/tson/schemas/string';
79
+ export * from './modules/tson/schemas/union';
80
+ export * from './modules/value/value.util';
81
+ export * from './types/awaitable.type';
82
+ export * from './types/camel-to-kebab.type';
83
+ export * from './types/has-key.type';
84
+ export * from './types/is-union.type';
85
+ export * from './types/keys-of-type.type';
86
+ export * from './types/keys-with-fix.type';
87
+ export * from './types/optional-keys.type';
88
+ export * from './types/partial.type';
89
+ export * from './types/predicate.type';
90
+ export * from './types/recursive-readonly.type';
91
+ export * from './types/recursive-value.type';
92
+ export * from './types/selector.type';
package/dist/index.js ADDED
@@ -0,0 +1,93 @@
1
+ // **/*.ts
2
+ export * from './consts/mime-type.const';
3
+ export * from './consts/unit.const';
4
+ export * from './functions/debounce.function';
5
+ export * from './functions/is-node-environment.function';
6
+ export * from './functions/parse-path-selector.function';
7
+ export * from './functions/parse-url.function';
8
+ export * from './interfaces/group.interface';
9
+ export * from './interfaces/key-value.interface';
10
+ export * from './modules/api/socket.model';
11
+ export * from './modules/api/web-client.model';
12
+ export * from './modules/array/array.util';
13
+ export * from './modules/changes/changes.util';
14
+ export * from './modules/color/color-data.interface';
15
+ export * from './modules/color/color-formats.const';
16
+ export * from './modules/color/color.type';
17
+ export * from './modules/color/color.util';
18
+ export * from './modules/color/colors.const';
19
+ export * from './modules/color/hsl.interface';
20
+ export * from './modules/color/hsv.interface';
21
+ export * from './modules/color/rgb.interface';
22
+ export * from './modules/compression/compression.util';
23
+ export * from './modules/date/date.util';
24
+ export * from './modules/enum/enum.util';
25
+ export * from './modules/hash/hash.util';
26
+ export * from './modules/id/id.util';
27
+ export * from './modules/injector/injector.model';
28
+ export * from './modules/injector/provider-scopes.enum';
29
+ export * from './modules/injector/provider.interface';
30
+ export * from './modules/injector/decorators/inject-token.decorator';
31
+ export * from './modules/injector/decorators/injectable.decorator';
32
+ export * from './modules/json-filter/json-filter.function';
33
+ export * from './modules/logging/console-logger.model';
34
+ export * from './modules/logging/logger.model';
35
+ export * from './modules/logging/task';
36
+ export * from './modules/math/line';
37
+ export * from './modules/math/point';
38
+ export * from './modules/math/polygon';
39
+ export * from './modules/math/rect';
40
+ export * from './modules/math/size';
41
+ export * from './modules/number/number.util';
42
+ export * from './modules/object/object.util';
43
+ export * from './modules/path/path.util';
44
+ export * from './modules/random/random.util';
45
+ export * from './modules/readable-stream/readable-stream.util';
46
+ export * from './modules/reflection/interfaces/parameter.interface';
47
+ export * from './modules/reflection/models/attribute.model';
48
+ export * from './modules/reflection/models/class-attribute.model';
49
+ export * from './modules/reflection/models/method-attribute.model';
50
+ export * from './modules/reflection/models/parameter-attribute.model';
51
+ export * from './modules/reflection/models/property-attribute.model';
52
+ export * from './modules/reflection/models/property-proxy-attribute.model';
53
+ export * from './modules/reflection/types/constructor.type';
54
+ export * from './modules/reflection/types/instance.type';
55
+ export * from './modules/reflection/types/type.type';
56
+ export * from './modules/reflection/utils/decorator.util';
57
+ export * from './modules/reflection/utils/reflection.util';
58
+ export * from './modules/router/router.util';
59
+ export * from './modules/state/state.model';
60
+ export * from './modules/state/update.type';
61
+ export * from './modules/state/adaptors/array/array-adaptor.util';
62
+ export * from './modules/state/adaptors/entity/entity-adaptor.util';
63
+ export * from './modules/state/adaptors/entity/entity-map.type';
64
+ export * from './modules/state/adaptors/entity/entity.interface';
65
+ export * from './modules/string/string.util';
66
+ export * from './modules/subscribable/subscribable.model';
67
+ export * from './modules/subscribable/subscription.interface';
68
+ export * from './modules/tson/error';
69
+ export * from './modules/tson/schema';
70
+ export * from './modules/tson/tson';
71
+ export * from './modules/tson/type';
72
+ export * from './modules/tson/schemas/any';
73
+ export * from './modules/tson/schemas/array';
74
+ export * from './modules/tson/schemas/boolean';
75
+ export * from './modules/tson/schemas/enum';
76
+ export * from './modules/tson/schemas/number';
77
+ export * from './modules/tson/schemas/object';
78
+ export * from './modules/tson/schemas/schema-base';
79
+ export * from './modules/tson/schemas/string';
80
+ export * from './modules/tson/schemas/union';
81
+ export * from './modules/value/value.util';
82
+ export * from './types/awaitable.type';
83
+ export * from './types/camel-to-kebab.type';
84
+ export * from './types/has-key.type';
85
+ export * from './types/is-union.type';
86
+ export * from './types/keys-of-type.type';
87
+ export * from './types/keys-with-fix.type';
88
+ export * from './types/optional-keys.type';
89
+ export * from './types/partial.type';
90
+ export * from './types/predicate.type';
91
+ export * from './types/recursive-readonly.type';
92
+ export * from './types/recursive-value.type';
93
+ export * from './types/selector.type';
@@ -0,0 +1,4 @@
1
+ export interface Group<TKey, TValue> {
2
+ key: TKey;
3
+ items: TValue[];
4
+ }
File without changes
@@ -0,0 +1,4 @@
1
+ export interface KeyValue<T> {
2
+ key: string;
3
+ value: T;
4
+ }
File without changes
@@ -0,0 +1,26 @@
1
+ import { Emitter } from '../subscribable/subscribable.model';
2
+ export declare class ISocket {
3
+ readyState: number;
4
+ OPEN: number;
5
+ onmessage: (message: any) => void;
6
+ onerror: (error: any) => void;
7
+ onclose: (event?: any) => void;
8
+ send: (data: any) => void;
9
+ onopen: (event: any) => void;
10
+ close: () => void;
11
+ }
12
+ export type SocketOptions = {
13
+ url: string;
14
+ autoReconnect?: boolean;
15
+ retryInterval?: number;
16
+ };
17
+ export declare class Socket {
18
+ private socket;
19
+ private state;
20
+ readonly stream: Emitter<any>;
21
+ get connected(): boolean;
22
+ private constructor();
23
+ static connect(options: SocketOptions): Promise<Socket>;
24
+ send(request: any): void;
25
+ disconnect(): void;
26
+ }
@@ -0,0 +1,66 @@
1
+ import { $Object } from '../object/object.util';
2
+ import { State } from '../state/state.model';
3
+ import { Emitter } from '../subscribable/subscribable.model';
4
+ const SOCKET = null;
5
+ export class ISocket {
6
+ readyState;
7
+ OPEN;
8
+ onmessage;
9
+ onerror;
10
+ onclose;
11
+ send;
12
+ onopen;
13
+ close;
14
+ }
15
+ export class Socket {
16
+ socket;
17
+ state = new State(null);
18
+ stream = new Emitter();
19
+ get connected() {
20
+ return this.socket && this.socket.readyState === this.socket.OPEN;
21
+ }
22
+ constructor() { }
23
+ static async connect(options) {
24
+ options = $Object.getDefaults(options, { retryInterval: 1000 });
25
+ const connect = (socket) => {
26
+ return new Promise((resolve, reject) => {
27
+ const stream = (socket.socket = new SOCKET(options.url));
28
+ stream.onopen = () => {
29
+ resolve(socket);
30
+ socket.state.update('open');
31
+ };
32
+ stream.onmessage = (message) => socket.stream.emit(JSON.parse(message.data));
33
+ stream.onclose = () => {
34
+ if (socket.state.value !== 'closed') {
35
+ socket.state.update('closed');
36
+ if (options.autoReconnect) {
37
+ const retry = async () => {
38
+ try {
39
+ await connect(socket);
40
+ }
41
+ catch {
42
+ await new Promise((resolve) => setTimeout(resolve, options.retryInterval));
43
+ await retry();
44
+ }
45
+ };
46
+ retry();
47
+ }
48
+ }
49
+ };
50
+ stream.onerror = (error) => {
51
+ reject(error);
52
+ socket.stream.emit(error);
53
+ };
54
+ });
55
+ };
56
+ const socket = new Socket();
57
+ return connect(socket);
58
+ }
59
+ send(request) {
60
+ this.socket.send(JSON.stringify(request));
61
+ }
62
+ disconnect() {
63
+ this.state.update('closed');
64
+ this.socket.close();
65
+ }
66
+ }
@@ -0,0 +1,16 @@
1
+ import { Emitter } from '../subscribable/subscribable.model';
2
+ import { ISocket } from './socket.model';
3
+ export declare class WebClient {
4
+ socket: ISocket;
5
+ address?: string;
6
+ private readonly state;
7
+ readonly id: string;
8
+ readonly stream: Emitter<any>;
9
+ get connected(): boolean;
10
+ readonly status: import("../..").Subscribable<import("../..").StateChange<"open" | "closed" | "none">> & {
11
+ readonly value: "open" | "closed" | "none";
12
+ };
13
+ constructor(socket: ISocket, address?: string);
14
+ send(packet: any): void;
15
+ disconnect(): void;
16
+ }
@@ -0,0 +1,34 @@
1
+ import { $Id } from '../id/id.util';
2
+ import { State } from '../state/state.model';
3
+ import { Emitter } from '../subscribable/subscribable.model';
4
+ export class WebClient {
5
+ socket;
6
+ address;
7
+ state = new State('none');
8
+ id = $Id.uuid();
9
+ stream = new Emitter();
10
+ get connected() {
11
+ return this.socket && this.socket.readyState === this.socket.OPEN;
12
+ }
13
+ status = this.state.asReadOnly();
14
+ constructor(socket, address) {
15
+ this.socket = socket;
16
+ this.address = address;
17
+ socket.onopen = () => this.state.update('open');
18
+ socket.onclose = () => this.state.update('closed');
19
+ socket.onmessage = (message) => {
20
+ let data = message.data;
21
+ try {
22
+ data = JSON.parse(data);
23
+ }
24
+ catch { }
25
+ this.stream.emit(data);
26
+ };
27
+ }
28
+ send(packet) {
29
+ this.socket.send(JSON.stringify(packet));
30
+ }
31
+ disconnect() {
32
+ this.socket.close();
33
+ }
34
+ }
@@ -0,0 +1,17 @@
1
+ import type { Predicate } from '../../types/predicate.type';
2
+ import type { Selector } from '../../types/selector.type';
3
+ export declare class $Array {
4
+ static isUnique(array: any[]): boolean;
5
+ static removeWhere<T>(array: T[], predicate: Predicate<T>, first?: boolean): T[];
6
+ static remove<T>(array: T[], ...items: T[]): T[];
7
+ static toggle<T>(array: T[], ...items: T[]): T[];
8
+ static upsert<T>(array: T[], ...items: T[]): T[];
9
+ static removeAt<T>(array: T[], ...indexes: number[]): T[];
10
+ static swap<T>(array: T[], indexA: number, indexB: number): T[];
11
+ static insert<T>(array: T[], index: number, ...items: T[]): T[];
12
+ static move<T>(array: T[], item: T, index: number): T[];
13
+ static moveAt<T>(array: T[], sourceIndex: number, destinationIndex: number): T[];
14
+ static order<T>(array: T[], order?: 'asc' | 'desc'): T[];
15
+ static orderBy<T>(array: T[], selector: Selector<T>, order?: 'asc' | 'desc'): T[];
16
+ static last<T>(array: T[]): T;
17
+ }
@@ -0,0 +1,105 @@
1
+ export class $Array {
2
+ static isUnique(array) {
3
+ return new Set(array).size === array.length;
4
+ }
5
+ static removeWhere(array, predicate, first) {
6
+ const result = [...array];
7
+ for (const [index, item] of result.entries()) {
8
+ if (predicate(item)) {
9
+ result.splice(index, 1);
10
+ if (first)
11
+ return result;
12
+ }
13
+ }
14
+ return result;
15
+ }
16
+ static remove(array, ...items) {
17
+ const result = [...array];
18
+ for (const item of items) {
19
+ const index = result.indexOf(item);
20
+ if (index !== -1)
21
+ result.splice(index, 1);
22
+ }
23
+ return result;
24
+ }
25
+ static toggle(array, ...items) {
26
+ const result = [...array];
27
+ for (const item of items) {
28
+ const index = result.indexOf(item);
29
+ if (index !== -1)
30
+ result.splice(index, 1);
31
+ else
32
+ result.push(item);
33
+ }
34
+ return result;
35
+ }
36
+ static upsert(array, ...items) {
37
+ const result = [...array];
38
+ for (const item of items) {
39
+ if (!result.includes(item))
40
+ result.push(item);
41
+ }
42
+ return result;
43
+ }
44
+ static removeAt(array, ...indexes) {
45
+ const result = [...array];
46
+ for (const index of indexes) {
47
+ result.splice(index, 1);
48
+ }
49
+ return result;
50
+ }
51
+ static swap(array, indexA, indexB) {
52
+ const result = [...array];
53
+ if (indexA === indexB)
54
+ return result;
55
+ const temp = result[indexA];
56
+ result[indexA] = result[indexB];
57
+ result[indexB] = temp;
58
+ return result;
59
+ }
60
+ static insert(array, index, ...items) {
61
+ const result = [...array];
62
+ result.splice(index, 0, ...items);
63
+ return result;
64
+ }
65
+ static move(array, item, index) {
66
+ return $Array.moveAt(array, array.indexOf(item), index);
67
+ }
68
+ static moveAt(array, sourceIndex, destinationIndex) {
69
+ const result = [...array];
70
+ const item = result[sourceIndex];
71
+ result.splice(sourceIndex, 1);
72
+ result.splice(destinationIndex, 0, item);
73
+ return result;
74
+ }
75
+ static order(array, order) {
76
+ return $Array.orderBy(array, (a) => a, order);
77
+ }
78
+ static orderBy(array, selector, order) {
79
+ const result = [...array];
80
+ const compare = (a, b) => {
81
+ if (a == null && b == null)
82
+ return 0;
83
+ if (a == null)
84
+ return 1;
85
+ if (b == null)
86
+ return -1;
87
+ if (typeof a === 'string' && typeof b === 'string')
88
+ return a.localeCompare(b);
89
+ if (a instanceof Date && b instanceof Date) {
90
+ a = a.getTime();
91
+ b = b.getTime();
92
+ }
93
+ if (a < b)
94
+ return -1;
95
+ if (a > b)
96
+ return 1;
97
+ return 0;
98
+ };
99
+ result.sort((a, b) => compare(selector(a), selector(b)) * (order === 'desc' ? -1 : 1));
100
+ return result;
101
+ }
102
+ static last(array) {
103
+ return array[array.length - 1];
104
+ }
105
+ }
@@ -0,0 +1,45 @@
1
+ export type ArrayChange = Record<`$${number}` | `$${number}+`, any | typeof $Changes.deleted>;
2
+ export interface ChangeConflicts {
3
+ conflicts: any;
4
+ differences: any;
5
+ }
6
+ export interface ChangeRebase<T = any> {
7
+ result: T;
8
+ conflicts?: {
9
+ local: ChangeConflicts;
10
+ remote: ChangeConflicts;
11
+ };
12
+ merge?: {
13
+ source: T;
14
+ remote: T;
15
+ local: T;
16
+ result: T;
17
+ };
18
+ }
19
+ export declare class $Changes {
20
+ static readonly deleted: "[deleted]";
21
+ private static isArrayIndexChange;
22
+ static getArrayChanges(a: any[], b: any[]): ArrayChange | undefined;
23
+ static getObjectChanges(a: Record<string, any>, b: Record<string, any>): Record<string, any | typeof $Changes.deleted>;
24
+ static get(a: any, b: any): undefined | any | Record<string, any | typeof $Changes.deleted> | ArrayChange;
25
+ static classifyPathsByOverlap(changesA: any, changesB: any): {
26
+ conflicts: string[];
27
+ differences: string[];
28
+ };
29
+ static resolveConflicts(changesA: any, changesB: any): ChangeConflicts;
30
+ private static pathsOverlap;
31
+ static hasConflict(changesA: any, changesB: any): boolean;
32
+ static asValue(changes: any): any;
33
+ static apply(value: any, changes: any): any;
34
+ static rebase(source: any, local: any, remote: any): ChangeRebase;
35
+ /**
36
+ * Excludes specific paths from a changes object and cleans up empty containers.
37
+ * Empty objects {} left behind after exclusion are recursively cleaned up,
38
+ * unless they existed in the original changes (intentional {} changes are preserved).
39
+ *
40
+ * @param changes - The changes object to filter
41
+ * @param paths - Array of dot-notation paths to exclude (e.g., ['user.name', 'config.theme'])
42
+ * @returns The filtered changes object with empty containers cleaned up
43
+ */
44
+ static excludeChanges(changes: any, paths: string[]): any;
45
+ }