gingersnap 0.22.0

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 (251) hide show
  1. package/_virtual/_tslib.cjs +102 -0
  2. package/_virtual/_tslib.mjs +93 -0
  3. package/data/AtomicValue.d.ts +15 -0
  4. package/data/bus.cjs +179 -0
  5. package/data/bus.d.ts +72 -0
  6. package/data/bus.mjs +177 -0
  7. package/data/decoders/index.d.ts +4 -0
  8. package/data/decoders/json.cjs +12 -0
  9. package/data/decoders/json.d.ts +7 -0
  10. package/data/decoders/json.mjs +10 -0
  11. package/data/decoders/msgpack.cjs +14 -0
  12. package/data/decoders/msgpack.d.ts +7 -0
  13. package/data/decoders/msgpack.mjs +12 -0
  14. package/data/decoders/protobuf.d.ts +13 -0
  15. package/data/decoders/string.cjs +12 -0
  16. package/data/decoders/string.d.ts +7 -0
  17. package/data/decoders/string.mjs +10 -0
  18. package/data/decoders/type.d.ts +7 -0
  19. package/data/decoders.cjs +11 -0
  20. package/data/decoders.mjs +3 -0
  21. package/data/model/credentials.cjs +114 -0
  22. package/data/model/credentials.d.ts +61 -0
  23. package/data/model/credentials.mjs +109 -0
  24. package/data/model/extra.cjs +88 -0
  25. package/data/model/extra.d.ts +5 -0
  26. package/data/model/extra.mjs +66 -0
  27. package/data/model/index.d.ts +6 -0
  28. package/data/model/model.cjs +541 -0
  29. package/data/model/model.d.ts +207 -0
  30. package/data/model/model.mjs +518 -0
  31. package/data/model/plugin.cjs +96 -0
  32. package/data/model/plugin.d.ts +38 -0
  33. package/data/model/plugin.mjs +72 -0
  34. package/data/model/property.cjs +310 -0
  35. package/data/model/property.d.ts +83 -0
  36. package/data/model/property.mjs +278 -0
  37. package/data/model/types.cjs +32 -0
  38. package/data/model/types.d.ts +28 -0
  39. package/data/model/types.mjs +32 -0
  40. package/data/model.cjs +43 -0
  41. package/data/model.mjs +6 -0
  42. package/data/signal.cjs +47 -0
  43. package/data/signal.d.ts +17 -0
  44. package/data/signal.mjs +45 -0
  45. package/data/store/index.d.ts +4 -0
  46. package/data/store/json.cjs +58 -0
  47. package/data/store/json.d.ts +18 -0
  48. package/data/store/json.mjs +56 -0
  49. package/data/store/manager.cjs +206 -0
  50. package/data/store/manager.d.ts +44 -0
  51. package/data/store/manager.mjs +203 -0
  52. package/data/store/web.cjs +92 -0
  53. package/data/store/web.d.ts +25 -0
  54. package/data/store/web.mjs +89 -0
  55. package/data/value.cjs +66 -0
  56. package/data/value.mjs +64 -0
  57. package/data-structures/array/CyclicalList.cjs +57 -0
  58. package/data-structures/array/CyclicalList.d.ts +12 -0
  59. package/data-structures/array/CyclicalList.mjs +55 -0
  60. package/data-structures/array/Pair.cjs +30 -0
  61. package/data-structures/array/Pair.d.ts +17 -0
  62. package/data-structures/array/Pair.mjs +27 -0
  63. package/data-structures/array/Stack.cjs +96 -0
  64. package/data-structures/array/Stack.d.ts +41 -0
  65. package/data-structures/array/Stack.mjs +94 -0
  66. package/data-structures/array/Triple.cjs +34 -0
  67. package/data-structures/array/Triple.d.ts +19 -0
  68. package/data-structures/array/Triple.mjs +31 -0
  69. package/data-structures/array/Tuple.d.ts +8 -0
  70. package/data-structures/array/index.d.ts +5 -0
  71. package/data-structures/array.cjs +15 -0
  72. package/data-structures/array.mjs +4 -0
  73. package/data-structures/object/BufferQueue.cjs +98 -0
  74. package/data-structures/object/BufferQueue.d.ts +21 -0
  75. package/data-structures/object/BufferQueue.mjs +77 -0
  76. package/data-structures/object/CyclicalObject.cjs +155 -0
  77. package/data-structures/object/CyclicalObject.d.ts +74 -0
  78. package/data-structures/object/CyclicalObject.mjs +134 -0
  79. package/data-structures/object/Queue.cjs +178 -0
  80. package/data-structures/object/Queue.d.ts +31 -0
  81. package/data-structures/object/Queue.mjs +176 -0
  82. package/data-structures/object/SimpleQueue.cjs +53 -0
  83. package/data-structures/object/SimpleQueue.d.ts +13 -0
  84. package/data-structures/object/SimpleQueue.mjs +51 -0
  85. package/data-structures/object/TimeableObject.cjs +73 -0
  86. package/data-structures/object/TimeableObject.d.ts +30 -0
  87. package/data-structures/object/TimeableObject.mjs +71 -0
  88. package/data-structures/object/WaitableObject.cjs +61 -0
  89. package/data-structures/object/WaitableObject.d.ts +29 -0
  90. package/data-structures/object/WaitableObject.mjs +59 -0
  91. package/data-structures/object/WatchableObject.cjs +251 -0
  92. package/data-structures/object/WatchableObject.d.ts +88 -0
  93. package/data-structures/object/WatchableObject.mjs +230 -0
  94. package/data-structures/object/index.d.ts +7 -0
  95. package/data-structures/object.cjs +23 -0
  96. package/data-structures/object.mjs +7 -0
  97. package/errors/AbortError.cjs +9 -0
  98. package/errors/AbortError.d.ts +5 -0
  99. package/errors/AbortError.mjs +7 -0
  100. package/errors/CallExecutionError.cjs +13 -0
  101. package/errors/CallExecutionError.d.ts +7 -0
  102. package/errors/CallExecutionError.mjs +11 -0
  103. package/errors/FutureCancelled.cjs +11 -0
  104. package/errors/FutureCancelled.d.ts +6 -0
  105. package/errors/FutureCancelled.mjs +9 -0
  106. package/errors/FutureError.cjs +11 -0
  107. package/errors/FutureError.d.ts +6 -0
  108. package/errors/FutureError.mjs +9 -0
  109. package/errors/IllegalArgumentsError.cjs +13 -0
  110. package/errors/IllegalArgumentsError.d.ts +7 -0
  111. package/errors/IllegalArgumentsError.mjs +11 -0
  112. package/errors/IllegalOperationError.cjs +6 -0
  113. package/errors/IllegalOperationError.d.ts +2 -0
  114. package/errors/IllegalOperationError.mjs +4 -0
  115. package/errors/InvalidType.cjs +6 -0
  116. package/errors/InvalidType.d.ts +2 -0
  117. package/errors/InvalidType.mjs +4 -0
  118. package/errors/InvalidValue.cjs +11 -0
  119. package/errors/InvalidValue.d.ts +4 -0
  120. package/errors/InvalidValue.mjs +9 -0
  121. package/errors/MissingArgumentsError.cjs +13 -0
  122. package/errors/MissingArgumentsError.d.ts +7 -0
  123. package/errors/MissingArgumentsError.mjs +11 -0
  124. package/errors/NetworkError.cjs +13 -0
  125. package/errors/NetworkError.d.ts +8 -0
  126. package/errors/NetworkError.mjs +11 -0
  127. package/errors/NoSuchElement.cjs +6 -0
  128. package/errors/NoSuchElement.d.ts +2 -0
  129. package/errors/NoSuchElement.mjs +4 -0
  130. package/errors/NotImplemented.cjs +9 -0
  131. package/errors/NotImplemented.d.ts +5 -0
  132. package/errors/NotImplemented.mjs +7 -0
  133. package/errors/ParsingError.cjs +10 -0
  134. package/errors/ParsingError.d.ts +5 -0
  135. package/errors/ParsingError.mjs +8 -0
  136. package/errors/QueueEmptyError.cjs +6 -0
  137. package/errors/QueueEmptyError.d.ts +2 -0
  138. package/errors/QueueEmptyError.mjs +4 -0
  139. package/errors/QueueFullError.cjs +6 -0
  140. package/errors/QueueFullError.d.ts +2 -0
  141. package/errors/QueueFullError.mjs +4 -0
  142. package/errors/StackEmptyError.cjs +6 -0
  143. package/errors/StackEmptyError.d.ts +2 -0
  144. package/errors/StackEmptyError.mjs +4 -0
  145. package/errors/StackFullError.cjs +6 -0
  146. package/errors/StackFullError.d.ts +2 -0
  147. package/errors/StackFullError.mjs +4 -0
  148. package/errors/StreamEnded.cjs +6 -0
  149. package/errors/StreamEnded.d.ts +2 -0
  150. package/errors/StreamEnded.mjs +4 -0
  151. package/errors/TimeoutError.cjs +11 -0
  152. package/errors/TimeoutError.d.ts +6 -0
  153. package/errors/TimeoutError.mjs +9 -0
  154. package/errors/ValueDestroyedError.cjs +6 -0
  155. package/errors/ValueDestroyedError.d.ts +2 -0
  156. package/errors/ValueDestroyedError.mjs +4 -0
  157. package/errors/VerificationError.cjs +9 -0
  158. package/errors/VerificationError.d.ts +5 -0
  159. package/errors/VerificationError.mjs +7 -0
  160. package/errors/index.d.ts +18 -0
  161. package/errors.cjs +41 -0
  162. package/errors.mjs +18 -0
  163. package/files.cjs +201 -0
  164. package/files.d.ts +31 -0
  165. package/files.mjs +180 -0
  166. package/functools/index.d.ts +31 -0
  167. package/functools.cjs +371 -0
  168. package/functools.mjs +334 -0
  169. package/future/future.cjs +570 -0
  170. package/future/future.d.ts +208 -0
  171. package/future/future.mjs +548 -0
  172. package/future/group.cjs +180 -0
  173. package/future/group.d.ts +82 -0
  174. package/future/group.mjs +159 -0
  175. package/future/index.d.ts +3 -0
  176. package/future/result.cjs +19 -0
  177. package/future/result.d.ts +18 -0
  178. package/future/result.mjs +17 -0
  179. package/future.cjs +11 -0
  180. package/future.mjs +3 -0
  181. package/managers/context.d.ts +8 -0
  182. package/managers/index.d.ts +1 -0
  183. package/managers.cjs +2 -0
  184. package/managers.mjs +1 -0
  185. package/mocks.cjs +301 -0
  186. package/mocks.d.ts +125 -0
  187. package/mocks.mjs +293 -0
  188. package/networking/EventSourceService.cjs +104 -0
  189. package/networking/EventSourceService.d.ts +11 -0
  190. package/networking/EventSourceService.mjs +83 -0
  191. package/networking/NetworkService.cjs +394 -0
  192. package/networking/NetworkService.d.ts +97 -0
  193. package/networking/NetworkService.mjs +373 -0
  194. package/networking/SocketService.cjs +218 -0
  195. package/networking/SocketService.d.ts +23 -0
  196. package/networking/SocketService.mjs +197 -0
  197. package/networking/decorators/index.d.ts +4 -0
  198. package/networking/decorators/options.cjs +289 -0
  199. package/networking/decorators/options.d.ts +148 -0
  200. package/networking/decorators/options.mjs +242 -0
  201. package/networking/decorators/requests.cjs +80 -0
  202. package/networking/decorators/requests.d.ts +34 -0
  203. package/networking/decorators/requests.mjs +52 -0
  204. package/networking/decorators/socket.cjs +81 -0
  205. package/networking/decorators/socket.d.ts +13 -0
  206. package/networking/decorators/socket.mjs +51 -0
  207. package/networking/http.cjs +69 -0
  208. package/networking/http.d.ts +66 -0
  209. package/networking/http.mjs +69 -0
  210. package/networking/index.d.ts +39 -0
  211. package/networking/request.cjs +18 -0
  212. package/networking/request.d.ts +9 -0
  213. package/networking/request.mjs +16 -0
  214. package/networking/types.cjs +37 -0
  215. package/networking/types.d.ts +132 -0
  216. package/networking/types.mjs +35 -0
  217. package/networking.cjs +91 -0
  218. package/networking.mjs +33 -0
  219. package/package.json +1 -0
  220. package/reflection/injector.cjs +43 -0
  221. package/reflection/injector.d.ts +3 -0
  222. package/reflection/injector.mjs +40 -0
  223. package/socket.cjs +239 -0
  224. package/socket.d.ts +65 -0
  225. package/socket.mjs +237 -0
  226. package/store.cjs +12 -0
  227. package/store.mjs +3 -0
  228. package/stream/call.cjs +157 -0
  229. package/stream/call.d.ts +66 -0
  230. package/stream/call.mjs +154 -0
  231. package/stream/collector.cjs +217 -0
  232. package/stream/collector.d.ts +14 -0
  233. package/stream/collector.mjs +215 -0
  234. package/stream/index.d.ts +257 -0
  235. package/stream/observable.cjs +110 -0
  236. package/stream/observable.d.ts +65 -0
  237. package/stream/observable.mjs +106 -0
  238. package/stream/state.cjs +10 -0
  239. package/stream/state.d.ts +5 -0
  240. package/stream/state.mjs +8 -0
  241. package/stream.cjs +1153 -0
  242. package/stream.mjs +1132 -0
  243. package/synchronize.cjs +106 -0
  244. package/synchronize.d.ts +54 -0
  245. package/synchronize.mjs +103 -0
  246. package/typing/types.d.ts +24 -0
  247. package/typing.cjs +2 -0
  248. package/typing.mjs +1 -0
  249. package/utils/parser.cjs +37 -0
  250. package/utils/parser.d.ts +7 -0
  251. package/utils/parser.mjs +16 -0
@@ -0,0 +1,207 @@
1
+ /// <reference types="node" />
2
+ import "reflect-metadata";
3
+ import { DataFormat, DataType } from "./types";
4
+ import Papa from "papaparse";
5
+ export type ModelConstructor<T extends Model> = (new () => T) & typeof Model;
6
+ /**
7
+ * Properties for handling de/serialization process for each property on a model
8
+ */
9
+ export interface IgnoreProps {
10
+ /**
11
+ * Should serialization be enabled
12
+ */
13
+ serialize?: boolean;
14
+ /**
15
+ * Should deserialization be enabled
16
+ */
17
+ deserialize?: boolean;
18
+ }
19
+ /** @ignore */
20
+ export interface FieldProps {
21
+ ignore?: IgnoreProps;
22
+ name: string;
23
+ Type: any;
24
+ KeyType?: any;
25
+ ValueType?: any;
26
+ isArray?: boolean;
27
+ isMap?: boolean;
28
+ readonly?: boolean;
29
+ aliases?: string[];
30
+ schema?: {
31
+ dataType: DataType;
32
+ options?: {
33
+ values?: string[];
34
+ length?: number;
35
+ itemType?: string;
36
+ recordClass?: any;
37
+ optional?: boolean;
38
+ useOptionalObj?: boolean;
39
+ };
40
+ aliases?: string[];
41
+ };
42
+ customTags?: {
43
+ [string: string]: {
44
+ properties: Object;
45
+ __callback__?: (name: string, properties: Object, target: Model, fieldName: string) => void;
46
+ };
47
+ };
48
+ }
49
+ /** @ignore */
50
+ export interface ModelInternalProps {
51
+ fields: Map<string, FieldProps>;
52
+ parent?: string;
53
+ }
54
+ /** @ignore */
55
+ export declare const namespacedModelInternalProps: Map<string, ModelInternalProps>;
56
+ /**
57
+ * A container object which may or may not contain a non-null/non-undefined value
58
+ */
59
+ export declare class Optional<T> {
60
+ private readonly value;
61
+ constructor(value: T | undefined);
62
+ /**
63
+ * Returns an Optional with the specified present non-null value.
64
+ * @param value
65
+ */
66
+ static of<T>(value: T | undefined): Optional<T>;
67
+ /**
68
+ * Returns an empty Optional instance.
69
+ */
70
+ static empty<T>(): Optional<T>;
71
+ /**
72
+ * Return true if there is a value present, otherwise false.
73
+ */
74
+ isPresent(): boolean;
75
+ /**
76
+ * If a value is present in this Optional, returns the value, otherwise throws NoSuchElement.
77
+ */
78
+ get(): T;
79
+ }
80
+ /**
81
+ * A Data de/serializer class that manages and validates data as JavaScript Objects
82
+ */
83
+ export declare class Model {
84
+ /** @ignore */
85
+ private static readonly __xmlParser__;
86
+ /**
87
+ * Converts arraybuffer to a model
88
+ * @param data arraybuffer
89
+ * @param format data format
90
+ * @param options configurations for deserializing the data
91
+ * @returns new model or an array of models
92
+ */
93
+ static fromBuffer<T extends Model>(this: ModelConstructor<T>, data: Uint8Array | Buffer, format?: DataFormat, options?: {
94
+ headers?: string[];
95
+ ignoreErrors?: boolean;
96
+ array?: boolean;
97
+ delimiter?: string;
98
+ newline?: string;
99
+ }): T | T[];
100
+ /**
101
+ * Downloads data from the given source and deserializes the data to one or more models
102
+ * @param source URL source to fetch the data
103
+ * @param format data format
104
+ * @param options configurations for deserializing and/or retrieving the data
105
+ * @returns one or more models
106
+ */
107
+ static fromURL<T extends Model>(this: ModelConstructor<T>, source: string, format?: DataFormat, options?: {
108
+ headers?: string[];
109
+ ignoreErrors?: boolean;
110
+ array?: boolean;
111
+ delimiter?: string;
112
+ newline?: string;
113
+ requestHeaders?: any;
114
+ mode?: any;
115
+ }): Promise<T | T[]>;
116
+ /**
117
+ * Deserializes one or more models from a Blob
118
+ * @param data blob data
119
+ * @param format data format
120
+ * @param options configurations for deserializing the data
121
+ * @returns one or more models
122
+ */
123
+ static fromBlob<T extends Model>(this: ModelConstructor<T>, data: Blob, format?: DataFormat, options?: {
124
+ headers?: string[];
125
+ ignoreErrors?: boolean;
126
+ array?: boolean;
127
+ delimiter?: string;
128
+ newline?: string;
129
+ }): Promise<T | T[]>;
130
+ /**
131
+ * Deserializes one or more models from given string
132
+ *
133
+ * @remarks
134
+ * If the data format is a binary one, the provided string should be a hexadecimal string.
135
+ * @param data string data source
136
+ * @param format data format
137
+ * @param options
138
+ */
139
+ static fromString<T extends Model>(this: ModelConstructor<T>, data: string, format?: DataFormat, options?: {
140
+ headers?: string[];
141
+ ignoreErrors?: boolean;
142
+ array?: boolean;
143
+ delimiter?: string;
144
+ newline?: string;
145
+ }): T | T[];
146
+ /**
147
+ * Converts a JSON object to a model
148
+ * @param data JSON Object
149
+ * @returns new model
150
+ */
151
+ static fromJSON<T extends Model>(this: ModelConstructor<T>, data: object): T;
152
+ /**
153
+ * Converts the current model to a JSON object
154
+ */
155
+ object(removeMissingFields?: boolean): {
156
+ [string: string]: any;
157
+ };
158
+ /**
159
+ * Converts the current model to a JSON string
160
+ */
161
+ json(removeMissingFields?: boolean): string;
162
+ /**
163
+ * Converts the current model to an arraybuffer
164
+ */
165
+ buffer(removeMissingFields?: boolean): ArrayBuffer;
166
+ /**
167
+ * Converts the current model to a blob
168
+ */
169
+ blob(removeMissingFields?: boolean): Blob;
170
+ /**
171
+ * Converts the current model to an XML string
172
+ */
173
+ xml(removeMissingFields?: boolean): string;
174
+ /**
175
+ * Converts the current model to message pack binary format
176
+ * @returns message pack binary
177
+ */
178
+ messagePack(removeMissingFields?: boolean): Buffer;
179
+ /**
180
+ * Converts the current model to csv format
181
+ * @param removeMissingFields
182
+ * @param config CSV unparsing configuration
183
+ * @returns csv string
184
+ */
185
+ csv(removeMissingFields?: boolean, config?: Papa.UnparseConfig): string;
186
+ clone(): any;
187
+ /**
188
+ * Retrieves the schema of the current model based on the selected format
189
+ * @param format data format
190
+ * @returns the schema for the current model
191
+ */
192
+ schema(format?: DataFormat): any;
193
+ toString(): string;
194
+ /**
195
+ * Constructs the model properties by traversing the inheritance tree of the current Model being instantiated
196
+ * @param modelPrototype prototype of the model
197
+ * @ignore
198
+ */
199
+ private static buildPropTree;
200
+ /**
201
+ * Constructs a model from a JSON object
202
+ * @param data JSON object
203
+ * @param format
204
+ * @private
205
+ */
206
+ private static fromObject;
207
+ }