@elastic/request-converter-dotnet 9.4.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 (188) hide show
  1. package/.stamp +0 -0
  2. package/README.md +98 -0
  3. package/RequestConverter.Wasm.runtimeconfig.json +32 -0
  4. package/_framework/Elastic.Esql.wasm +0 -0
  5. package/_framework/Elastic.Transport.wasm +0 -0
  6. package/_framework/Microsoft.CSharp.wasm +0 -0
  7. package/_framework/Microsoft.VisualBasic.Core.wasm +0 -0
  8. package/_framework/Microsoft.VisualBasic.wasm +0 -0
  9. package/_framework/Microsoft.Win32.Primitives.wasm +0 -0
  10. package/_framework/Microsoft.Win32.Registry.wasm +0 -0
  11. package/_framework/RequestConverter.Wasm.wasm +0 -0
  12. package/_framework/RequestConverter.wasm +0 -0
  13. package/_framework/System.AppContext.wasm +0 -0
  14. package/_framework/System.Buffers.wasm +0 -0
  15. package/_framework/System.Collections.Concurrent.wasm +0 -0
  16. package/_framework/System.Collections.Immutable.wasm +0 -0
  17. package/_framework/System.Collections.NonGeneric.wasm +0 -0
  18. package/_framework/System.Collections.Specialized.wasm +0 -0
  19. package/_framework/System.Collections.wasm +0 -0
  20. package/_framework/System.ComponentModel.Annotations.wasm +0 -0
  21. package/_framework/System.ComponentModel.DataAnnotations.wasm +0 -0
  22. package/_framework/System.ComponentModel.EventBasedAsync.wasm +0 -0
  23. package/_framework/System.ComponentModel.Primitives.wasm +0 -0
  24. package/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
  25. package/_framework/System.ComponentModel.wasm +0 -0
  26. package/_framework/System.Configuration.wasm +0 -0
  27. package/_framework/System.Console.wasm +0 -0
  28. package/_framework/System.Core.wasm +0 -0
  29. package/_framework/System.Data.Common.wasm +0 -0
  30. package/_framework/System.Data.DataSetExtensions.wasm +0 -0
  31. package/_framework/System.Data.wasm +0 -0
  32. package/_framework/System.Diagnostics.Contracts.wasm +0 -0
  33. package/_framework/System.Diagnostics.Debug.wasm +0 -0
  34. package/_framework/System.Diagnostics.DiagnosticSource.wasm +0 -0
  35. package/_framework/System.Diagnostics.FileVersionInfo.wasm +0 -0
  36. package/_framework/System.Diagnostics.Process.wasm +0 -0
  37. package/_framework/System.Diagnostics.StackTrace.wasm +0 -0
  38. package/_framework/System.Diagnostics.TextWriterTraceListener.wasm +0 -0
  39. package/_framework/System.Diagnostics.Tools.wasm +0 -0
  40. package/_framework/System.Diagnostics.TraceSource.wasm +0 -0
  41. package/_framework/System.Diagnostics.Tracing.wasm +0 -0
  42. package/_framework/System.Drawing.Primitives.wasm +0 -0
  43. package/_framework/System.Drawing.wasm +0 -0
  44. package/_framework/System.Dynamic.Runtime.wasm +0 -0
  45. package/_framework/System.Formats.Asn1.wasm +0 -0
  46. package/_framework/System.Formats.Tar.wasm +0 -0
  47. package/_framework/System.Globalization.Calendars.wasm +0 -0
  48. package/_framework/System.Globalization.Extensions.wasm +0 -0
  49. package/_framework/System.Globalization.wasm +0 -0
  50. package/_framework/System.IO.Compression.Brotli.wasm +0 -0
  51. package/_framework/System.IO.Compression.FileSystem.wasm +0 -0
  52. package/_framework/System.IO.Compression.ZipFile.wasm +0 -0
  53. package/_framework/System.IO.Compression.wasm +0 -0
  54. package/_framework/System.IO.FileSystem.AccessControl.wasm +0 -0
  55. package/_framework/System.IO.FileSystem.DriveInfo.wasm +0 -0
  56. package/_framework/System.IO.FileSystem.Primitives.wasm +0 -0
  57. package/_framework/System.IO.FileSystem.Watcher.wasm +0 -0
  58. package/_framework/System.IO.FileSystem.wasm +0 -0
  59. package/_framework/System.IO.IsolatedStorage.wasm +0 -0
  60. package/_framework/System.IO.MemoryMappedFiles.wasm +0 -0
  61. package/_framework/System.IO.Pipelines.wasm +0 -0
  62. package/_framework/System.IO.Pipes.AccessControl.wasm +0 -0
  63. package/_framework/System.IO.Pipes.wasm +0 -0
  64. package/_framework/System.IO.UnmanagedMemoryStream.wasm +0 -0
  65. package/_framework/System.IO.wasm +0 -0
  66. package/_framework/System.Linq.AsyncEnumerable.wasm +0 -0
  67. package/_framework/System.Linq.Expressions.wasm +0 -0
  68. package/_framework/System.Linq.Parallel.wasm +0 -0
  69. package/_framework/System.Linq.Queryable.wasm +0 -0
  70. package/_framework/System.Linq.wasm +0 -0
  71. package/_framework/System.Memory.wasm +0 -0
  72. package/_framework/System.Net.Http.Json.wasm +0 -0
  73. package/_framework/System.Net.Http.wasm +0 -0
  74. package/_framework/System.Net.HttpListener.wasm +0 -0
  75. package/_framework/System.Net.Mail.wasm +0 -0
  76. package/_framework/System.Net.NameResolution.wasm +0 -0
  77. package/_framework/System.Net.NetworkInformation.wasm +0 -0
  78. package/_framework/System.Net.Ping.wasm +0 -0
  79. package/_framework/System.Net.Primitives.wasm +0 -0
  80. package/_framework/System.Net.Quic.wasm +0 -0
  81. package/_framework/System.Net.Requests.wasm +0 -0
  82. package/_framework/System.Net.Security.wasm +0 -0
  83. package/_framework/System.Net.ServerSentEvents.wasm +0 -0
  84. package/_framework/System.Net.ServicePoint.wasm +0 -0
  85. package/_framework/System.Net.Sockets.wasm +0 -0
  86. package/_framework/System.Net.WebClient.wasm +0 -0
  87. package/_framework/System.Net.WebHeaderCollection.wasm +0 -0
  88. package/_framework/System.Net.WebProxy.wasm +0 -0
  89. package/_framework/System.Net.WebSockets.Client.wasm +0 -0
  90. package/_framework/System.Net.WebSockets.wasm +0 -0
  91. package/_framework/System.Net.wasm +0 -0
  92. package/_framework/System.Numerics.Vectors.wasm +0 -0
  93. package/_framework/System.Numerics.wasm +0 -0
  94. package/_framework/System.ObjectModel.wasm +0 -0
  95. package/_framework/System.Private.CoreLib.wasm +0 -0
  96. package/_framework/System.Private.DataContractSerialization.wasm +0 -0
  97. package/_framework/System.Private.Uri.wasm +0 -0
  98. package/_framework/System.Private.Xml.Linq.wasm +0 -0
  99. package/_framework/System.Private.Xml.wasm +0 -0
  100. package/_framework/System.Reflection.DispatchProxy.wasm +0 -0
  101. package/_framework/System.Reflection.Emit.ILGeneration.wasm +0 -0
  102. package/_framework/System.Reflection.Emit.Lightweight.wasm +0 -0
  103. package/_framework/System.Reflection.Emit.wasm +0 -0
  104. package/_framework/System.Reflection.Extensions.wasm +0 -0
  105. package/_framework/System.Reflection.Metadata.wasm +0 -0
  106. package/_framework/System.Reflection.Primitives.wasm +0 -0
  107. package/_framework/System.Reflection.TypeExtensions.wasm +0 -0
  108. package/_framework/System.Reflection.wasm +0 -0
  109. package/_framework/System.Resources.Reader.wasm +0 -0
  110. package/_framework/System.Resources.ResourceManager.wasm +0 -0
  111. package/_framework/System.Resources.Writer.wasm +0 -0
  112. package/_framework/System.Runtime.CompilerServices.Unsafe.wasm +0 -0
  113. package/_framework/System.Runtime.CompilerServices.VisualC.wasm +0 -0
  114. package/_framework/System.Runtime.Extensions.wasm +0 -0
  115. package/_framework/System.Runtime.Handles.wasm +0 -0
  116. package/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  117. package/_framework/System.Runtime.InteropServices.RuntimeInformation.wasm +0 -0
  118. package/_framework/System.Runtime.InteropServices.wasm +0 -0
  119. package/_framework/System.Runtime.Intrinsics.wasm +0 -0
  120. package/_framework/System.Runtime.Loader.wasm +0 -0
  121. package/_framework/System.Runtime.Numerics.wasm +0 -0
  122. package/_framework/System.Runtime.Serialization.Formatters.wasm +0 -0
  123. package/_framework/System.Runtime.Serialization.Json.wasm +0 -0
  124. package/_framework/System.Runtime.Serialization.Primitives.wasm +0 -0
  125. package/_framework/System.Runtime.Serialization.Xml.wasm +0 -0
  126. package/_framework/System.Runtime.Serialization.wasm +0 -0
  127. package/_framework/System.Runtime.wasm +0 -0
  128. package/_framework/System.Security.AccessControl.wasm +0 -0
  129. package/_framework/System.Security.Claims.wasm +0 -0
  130. package/_framework/System.Security.Cryptography.Algorithms.wasm +0 -0
  131. package/_framework/System.Security.Cryptography.Cng.wasm +0 -0
  132. package/_framework/System.Security.Cryptography.Csp.wasm +0 -0
  133. package/_framework/System.Security.Cryptography.Encoding.wasm +0 -0
  134. package/_framework/System.Security.Cryptography.OpenSsl.wasm +0 -0
  135. package/_framework/System.Security.Cryptography.Primitives.wasm +0 -0
  136. package/_framework/System.Security.Cryptography.X509Certificates.wasm +0 -0
  137. package/_framework/System.Security.Cryptography.wasm +0 -0
  138. package/_framework/System.Security.Principal.Windows.wasm +0 -0
  139. package/_framework/System.Security.Principal.wasm +0 -0
  140. package/_framework/System.Security.SecureString.wasm +0 -0
  141. package/_framework/System.Security.wasm +0 -0
  142. package/_framework/System.ServiceModel.Web.wasm +0 -0
  143. package/_framework/System.ServiceProcess.wasm +0 -0
  144. package/_framework/System.Text.Encoding.CodePages.wasm +0 -0
  145. package/_framework/System.Text.Encoding.Extensions.wasm +0 -0
  146. package/_framework/System.Text.Encoding.wasm +0 -0
  147. package/_framework/System.Text.Encodings.Web.wasm +0 -0
  148. package/_framework/System.Text.Json.wasm +0 -0
  149. package/_framework/System.Text.RegularExpressions.wasm +0 -0
  150. package/_framework/System.Threading.AccessControl.wasm +0 -0
  151. package/_framework/System.Threading.Channels.wasm +0 -0
  152. package/_framework/System.Threading.Overlapped.wasm +0 -0
  153. package/_framework/System.Threading.Tasks.Dataflow.wasm +0 -0
  154. package/_framework/System.Threading.Tasks.Extensions.wasm +0 -0
  155. package/_framework/System.Threading.Tasks.Parallel.wasm +0 -0
  156. package/_framework/System.Threading.Tasks.wasm +0 -0
  157. package/_framework/System.Threading.Thread.wasm +0 -0
  158. package/_framework/System.Threading.ThreadPool.wasm +0 -0
  159. package/_framework/System.Threading.Timer.wasm +0 -0
  160. package/_framework/System.Threading.wasm +0 -0
  161. package/_framework/System.Transactions.Local.wasm +0 -0
  162. package/_framework/System.Transactions.wasm +0 -0
  163. package/_framework/System.ValueTuple.wasm +0 -0
  164. package/_framework/System.Web.HttpUtility.wasm +0 -0
  165. package/_framework/System.Web.wasm +0 -0
  166. package/_framework/System.Windows.wasm +0 -0
  167. package/_framework/System.Xml.Linq.wasm +0 -0
  168. package/_framework/System.Xml.ReaderWriter.wasm +0 -0
  169. package/_framework/System.Xml.Serialization.wasm +0 -0
  170. package/_framework/System.Xml.XDocument.wasm +0 -0
  171. package/_framework/System.Xml.XPath.XDocument.wasm +0 -0
  172. package/_framework/System.Xml.XPath.wasm +0 -0
  173. package/_framework/System.Xml.XmlDocument.wasm +0 -0
  174. package/_framework/System.Xml.XmlSerializer.wasm +0 -0
  175. package/_framework/System.Xml.wasm +0 -0
  176. package/_framework/System.wasm +0 -0
  177. package/_framework/WindowsBase.wasm +0 -0
  178. package/_framework/dotnet.boot.js +928 -0
  179. package/_framework/dotnet.js +4 -0
  180. package/_framework/dotnet.js.map +1 -0
  181. package/_framework/dotnet.native.js +6687 -0
  182. package/_framework/dotnet.native.wasm +0 -0
  183. package/_framework/dotnet.runtime.js +4 -0
  184. package/_framework/dotnet.runtime.js.map +1 -0
  185. package/_framework/mscorlib.wasm +0 -0
  186. package/_framework/netstandard.wasm +0 -0
  187. package/main.mjs +47 -0
  188. package/package.json +17 -0
package/.stamp ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # @elastic/request-converter-dotnet
2
+
3
+ The .NET request converter for Elasticsearch, compiled to WebAssembly. It turns a parsed Dev
4
+ Console request into `Elastic.Clients.Elasticsearch` (.NET) client code, with the target
5
+ `Elastic.Clients.Elasticsearch` version embedded in the WASM bundle itself.
6
+
7
+ This package is consumed by `@elastic/request-converter`'s C# exporter, which loads it as an
8
+ `ExternalExporter` plugin. It is also usable standalone from Node by calling its `boot()` factory
9
+ directly, as shown below.
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import { boot } from "@elastic/request-converter-dotnet";
15
+
16
+ const { check, convert } = await boot();
17
+
18
+ const payload = {
19
+ requests: [
20
+ {
21
+ api: "search",
22
+ body: { query: { term: { "user.id": { value: "kimchy" } } } },
23
+ method: "GET",
24
+ params: { index: "my-index-000001" },
25
+ path: "/my-index-000001/_search",
26
+ query: { from: "40", size: "20" },
27
+ raw_path: "/my-index-000001/_search",
28
+ source: "GET /my-index-000001/_search?from=40&size=20",
29
+ url: "/my-index-000001/_search?from=40&size=20",
30
+ },
31
+ ],
32
+ options: {
33
+ document_type_name: "MyDocument",
34
+ syntax_mode: "descriptor",
35
+ use_strongly_typed_document: true,
36
+ },
37
+ };
38
+
39
+ const checked = JSON.parse(check(JSON.stringify(payload)));
40
+ // checked.return === true
41
+
42
+ const converted = JSON.parse(convert(JSON.stringify(payload)));
43
+ console.log(converted.return);
44
+ // var request = new SearchRequestDescriptor<MyDocument>() ...
45
+ ```
46
+
47
+ ## Contract
48
+
49
+ Both `check` and `convert` are synchronous, take a JSON string, and return a JSON string. Field
50
+ names are snake_case throughout.
51
+
52
+ - `check(input)` - input `{"requests": ParsedRequest[]}`; output `{"return": <bool>, "error"?: "..."}`.
53
+ It is a yes/no probe: a request the converter cannot handle (unsupported endpoint, invalid body,
54
+ ...) makes it return `false` rather than an error.
55
+ - `convert(input)` - input `{"requests": ParsedRequest[], "options": ConvertOptions}`; output
56
+ `{"return": <string>, "error"?: "..."}`. On failure, `error` is a concise, user-facing message (no
57
+ stack trace) naming the failing request and the reason.
58
+
59
+ `ParsedRequest` is produced by the host's parser (turning Dev Console text into an API name and URL
60
+ parameters needs the Elasticsearch schema, which this package does not carry), so this package only
61
+ converts requests already parsed into that shape.
62
+
63
+ ## Options
64
+
65
+ `options` on `convert` accepts:
66
+
67
+ - `document_type_name` (string, default `MyDocument`) - the placeholder document type name used when
68
+ `use_strongly_typed_document` is set.
69
+ - `syntax_mode` (`object_initializer` | `descriptor`, default `object_initializer`) - the emitted C#
70
+ syntax. `object_initializer` emits object initializers (`new SearchRequest { Query = ... }`);
71
+ `descriptor` emits the fluent descriptor chain (`new SearchRequestDescriptor().Query(q => ...)`).
72
+ - `type_name_style` (`Simplified` | `Fqn` | `GlobalFqn`, default `Simplified`) - how type names are
73
+ spelled in the generated code.
74
+ - `use_strongly_typed_document` (bool, default `false`) - switches field references to
75
+ `Infer.Field<DocumentTypeName>(x => x.Path)` lambdas and a generic request's document body to
76
+ `new DocumentTypeName { ... }`. Pairs with `syntax_mode: "descriptor"` to produce the generic
77
+ `XDescriptor<DocumentTypeName>` flavor.
78
+ - `debug` (bool, default `false`) - appends the full exception (type and stack trace) to a failed
79
+ `convert`'s `error`, after a `--- debug ---` marker.
80
+
81
+ The `document_type_name` given (`MyDocument` by default) is not a type the converter generates; the
82
+ caller supplies it, so any typed-document example in the generated output is illustrative and
83
+ generally does not compile or round-trip as-is.
84
+
85
+ ## Versioning
86
+
87
+ This package's major and minor version track the elasticsearch-net branch it was built from (for
88
+ example a build from the `9.1` branch ships as `9.1.x`); the patch number increments freely on each
89
+ publish and carries no meaning beyond ordering. The exact embedded client is recorded in
90
+ `package.json` under the `elasticsearch` key: `clientVersion` is the `Elastic.Clients.Elasticsearch`
91
+ version compiled into the bundle, and `commit` is the elasticsearch-net commit the bundle was built
92
+ from.
93
+
94
+ ## Building from source
95
+
96
+ This package is assembled from a published .NET WASM AppBundle; see
97
+ [`src/RequestConverter.Wasm`](https://github.com/elastic/elasticsearch-net/tree/main/src/RequestConverter.Wasm)
98
+ in the elasticsearch-net repository for build prerequisites and instructions.
@@ -0,0 +1,32 @@
1
+ {
2
+ "runtimeOptions": {
3
+ "tfm": "net10.0",
4
+ "includedFrameworks": [
5
+ {
6
+ "name": "Microsoft.NETCore.App",
7
+ "version": "10.0.10"
8
+ }
9
+ ],
10
+ "configProperties": {
11
+ "System.Diagnostics.Debugger.IsSupported": false,
12
+ "System.Diagnostics.Metrics.Meter.IsSupported": false,
13
+ "System.Diagnostics.Tracing.EventSource.IsSupported": false,
14
+ "System.Globalization.Invariant": true,
15
+ "System.TimeZoneInfo.Invariant": false,
16
+ "System.Globalization.PredefinedCulturesOnly": true,
17
+ "System.Linq.Enumerable.IsSizeOptimized": true,
18
+ "System.Net.Http.EnableActivityPropagation": false,
19
+ "System.Net.Http.WasmEnableStreamingResponse": true,
20
+ "System.Net.SocketsHttpHandler.Http3Support": false,
21
+ "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
22
+ "System.Resources.UseSystemResourceKeys": true,
23
+ "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
24
+ "System.Text.Encoding.EnableUnsafeUTF7Encoding": false
25
+ },
26
+ "wasmHostProperties": {
27
+ "runtimeArgs": [],
28
+ "perHostConfig": [],
29
+ "mainAssembly": "RequestConverter.Wasm.dll"
30
+ }
31
+ }
32
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file