@digicatapult/dtdl-parser 0.0.4 → 0.0.7

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 (215) hide show
  1. package/README.md +29 -1
  2. package/build/interop/.stamp +0 -0
  3. package/build/interop/DTDLParserJSInterop.runtimeconfig.json +42 -0
  4. package/build/interop/_framework/DTDLParser.wasm +0 -0
  5. package/build/interop/_framework/DTDLParserJSInterop.pdb +0 -0
  6. package/build/interop/_framework/DTDLParserJSInterop.wasm +0 -0
  7. package/build/interop/_framework/Microsoft.CSharp.wasm +0 -0
  8. package/build/interop/_framework/Microsoft.VisualBasic.Core.wasm +0 -0
  9. package/build/interop/_framework/Microsoft.VisualBasic.wasm +0 -0
  10. package/build/interop/_framework/Microsoft.Win32.Primitives.wasm +0 -0
  11. package/build/interop/_framework/Microsoft.Win32.Registry.wasm +0 -0
  12. package/build/interop/_framework/System.AppContext.wasm +0 -0
  13. package/build/interop/_framework/System.Buffers.wasm +0 -0
  14. package/build/interop/_framework/System.Collections.Concurrent.wasm +0 -0
  15. package/build/interop/_framework/System.Collections.Immutable.wasm +0 -0
  16. package/build/interop/_framework/System.Collections.NonGeneric.wasm +0 -0
  17. package/build/interop/_framework/System.Collections.Specialized.wasm +0 -0
  18. package/build/interop/_framework/System.Collections.wasm +0 -0
  19. package/build/interop/_framework/System.ComponentModel.Annotations.wasm +0 -0
  20. package/build/interop/_framework/System.ComponentModel.DataAnnotations.wasm +0 -0
  21. package/build/interop/_framework/System.ComponentModel.EventBasedAsync.wasm +0 -0
  22. package/build/interop/_framework/System.ComponentModel.Primitives.wasm +0 -0
  23. package/build/interop/_framework/System.ComponentModel.TypeConverter.wasm +0 -0
  24. package/build/interop/_framework/System.ComponentModel.wasm +0 -0
  25. package/build/interop/_framework/System.Configuration.wasm +0 -0
  26. package/build/interop/_framework/System.Console.wasm +0 -0
  27. package/build/interop/_framework/System.Core.wasm +0 -0
  28. package/build/interop/_framework/System.Data.Common.wasm +0 -0
  29. package/build/interop/_framework/System.Data.DataSetExtensions.wasm +0 -0
  30. package/build/interop/_framework/System.Data.wasm +0 -0
  31. package/build/interop/_framework/System.Diagnostics.Contracts.wasm +0 -0
  32. package/build/interop/_framework/System.Diagnostics.Debug.wasm +0 -0
  33. package/build/interop/_framework/System.Diagnostics.DiagnosticSource.wasm +0 -0
  34. package/build/interop/_framework/System.Diagnostics.FileVersionInfo.wasm +0 -0
  35. package/build/interop/_framework/System.Diagnostics.Process.wasm +0 -0
  36. package/build/interop/_framework/System.Diagnostics.StackTrace.wasm +0 -0
  37. package/build/interop/_framework/System.Diagnostics.TextWriterTraceListener.wasm +0 -0
  38. package/build/interop/_framework/System.Diagnostics.Tools.wasm +0 -0
  39. package/build/interop/_framework/System.Diagnostics.TraceSource.wasm +0 -0
  40. package/build/interop/_framework/System.Diagnostics.Tracing.wasm +0 -0
  41. package/build/interop/_framework/System.Drawing.Primitives.wasm +0 -0
  42. package/build/interop/_framework/System.Drawing.wasm +0 -0
  43. package/build/interop/_framework/System.Dynamic.Runtime.wasm +0 -0
  44. package/build/interop/_framework/System.Formats.Asn1.wasm +0 -0
  45. package/build/interop/_framework/System.Formats.Tar.wasm +0 -0
  46. package/build/interop/_framework/System.Globalization.Calendars.wasm +0 -0
  47. package/build/interop/_framework/System.Globalization.Extensions.wasm +0 -0
  48. package/build/interop/_framework/System.Globalization.wasm +0 -0
  49. package/build/interop/_framework/System.IO.Compression.Brotli.wasm +0 -0
  50. package/build/interop/_framework/System.IO.Compression.FileSystem.wasm +0 -0
  51. package/build/interop/_framework/System.IO.Compression.ZipFile.wasm +0 -0
  52. package/build/interop/_framework/System.IO.Compression.wasm +0 -0
  53. package/build/interop/_framework/System.IO.FileSystem.AccessControl.wasm +0 -0
  54. package/build/interop/_framework/System.IO.FileSystem.DriveInfo.wasm +0 -0
  55. package/build/interop/_framework/System.IO.FileSystem.Primitives.wasm +0 -0
  56. package/build/interop/_framework/System.IO.FileSystem.Watcher.wasm +0 -0
  57. package/build/interop/_framework/System.IO.FileSystem.wasm +0 -0
  58. package/build/interop/_framework/System.IO.IsolatedStorage.wasm +0 -0
  59. package/build/interop/_framework/System.IO.MemoryMappedFiles.wasm +0 -0
  60. package/build/interop/_framework/System.IO.Pipes.AccessControl.wasm +0 -0
  61. package/build/interop/_framework/System.IO.Pipes.wasm +0 -0
  62. package/build/interop/_framework/System.IO.UnmanagedMemoryStream.wasm +0 -0
  63. package/build/interop/_framework/System.IO.wasm +0 -0
  64. package/build/interop/_framework/System.Linq.Expressions.wasm +0 -0
  65. package/build/interop/_framework/System.Linq.Parallel.wasm +0 -0
  66. package/build/interop/_framework/System.Linq.Queryable.wasm +0 -0
  67. package/build/interop/_framework/System.Linq.wasm +0 -0
  68. package/build/interop/_framework/System.Memory.wasm +0 -0
  69. package/build/interop/_framework/System.Net.Http.Json.wasm +0 -0
  70. package/build/interop/_framework/System.Net.Http.wasm +0 -0
  71. package/build/interop/_framework/System.Net.HttpListener.wasm +0 -0
  72. package/build/interop/_framework/System.Net.Mail.wasm +0 -0
  73. package/build/interop/_framework/System.Net.NameResolution.wasm +0 -0
  74. package/build/interop/_framework/System.Net.NetworkInformation.wasm +0 -0
  75. package/build/interop/_framework/System.Net.Ping.wasm +0 -0
  76. package/build/interop/_framework/System.Net.Primitives.wasm +0 -0
  77. package/build/interop/_framework/System.Net.Quic.wasm +0 -0
  78. package/build/interop/_framework/System.Net.Requests.wasm +0 -0
  79. package/build/interop/_framework/System.Net.Security.wasm +0 -0
  80. package/build/interop/_framework/System.Net.ServicePoint.wasm +0 -0
  81. package/build/interop/_framework/System.Net.Sockets.wasm +0 -0
  82. package/build/interop/_framework/System.Net.WebClient.wasm +0 -0
  83. package/build/interop/_framework/System.Net.WebHeaderCollection.wasm +0 -0
  84. package/build/interop/_framework/System.Net.WebProxy.wasm +0 -0
  85. package/build/interop/_framework/System.Net.WebSockets.Client.wasm +0 -0
  86. package/build/interop/_framework/System.Net.WebSockets.wasm +0 -0
  87. package/build/interop/_framework/System.Net.wasm +0 -0
  88. package/build/interop/_framework/System.Numerics.Vectors.wasm +0 -0
  89. package/build/interop/_framework/System.Numerics.wasm +0 -0
  90. package/build/interop/_framework/System.ObjectModel.wasm +0 -0
  91. package/build/interop/_framework/System.Private.CoreLib.wasm +0 -0
  92. package/build/interop/_framework/System.Private.DataContractSerialization.wasm +0 -0
  93. package/build/interop/_framework/System.Private.Uri.wasm +0 -0
  94. package/build/interop/_framework/System.Private.Xml.Linq.wasm +0 -0
  95. package/build/interop/_framework/System.Private.Xml.wasm +0 -0
  96. package/build/interop/_framework/System.Reflection.DispatchProxy.wasm +0 -0
  97. package/build/interop/_framework/System.Reflection.Emit.ILGeneration.wasm +0 -0
  98. package/build/interop/_framework/System.Reflection.Emit.Lightweight.wasm +0 -0
  99. package/build/interop/_framework/System.Reflection.Emit.wasm +0 -0
  100. package/build/interop/_framework/System.Reflection.Extensions.wasm +0 -0
  101. package/build/interop/_framework/System.Reflection.Metadata.wasm +0 -0
  102. package/build/interop/_framework/System.Reflection.Primitives.wasm +0 -0
  103. package/build/interop/_framework/System.Reflection.TypeExtensions.wasm +0 -0
  104. package/build/interop/_framework/System.Reflection.wasm +0 -0
  105. package/build/interop/_framework/System.Resources.Reader.wasm +0 -0
  106. package/build/interop/_framework/System.Resources.ResourceManager.wasm +0 -0
  107. package/build/interop/_framework/System.Resources.Writer.wasm +0 -0
  108. package/build/interop/_framework/System.Runtime.CompilerServices.Unsafe.wasm +0 -0
  109. package/build/interop/_framework/System.Runtime.CompilerServices.VisualC.wasm +0 -0
  110. package/build/interop/_framework/System.Runtime.Extensions.wasm +0 -0
  111. package/build/interop/_framework/System.Runtime.Handles.wasm +0 -0
  112. package/build/interop/_framework/System.Runtime.InteropServices.JavaScript.wasm +0 -0
  113. package/build/interop/_framework/System.Runtime.InteropServices.RuntimeInformation.wasm +0 -0
  114. package/build/interop/_framework/System.Runtime.InteropServices.wasm +0 -0
  115. package/build/interop/_framework/System.Runtime.Intrinsics.wasm +0 -0
  116. package/build/interop/_framework/System.Runtime.Loader.wasm +0 -0
  117. package/build/interop/_framework/System.Runtime.Numerics.wasm +0 -0
  118. package/build/interop/_framework/System.Runtime.Serialization.Formatters.wasm +0 -0
  119. package/build/interop/_framework/System.Runtime.Serialization.Json.wasm +0 -0
  120. package/build/interop/_framework/System.Runtime.Serialization.Primitives.wasm +0 -0
  121. package/build/interop/_framework/System.Runtime.Serialization.Xml.wasm +0 -0
  122. package/build/interop/_framework/System.Runtime.Serialization.wasm +0 -0
  123. package/build/interop/_framework/System.Runtime.wasm +0 -0
  124. package/build/interop/_framework/System.Security.AccessControl.wasm +0 -0
  125. package/build/interop/_framework/System.Security.Claims.wasm +0 -0
  126. package/build/interop/_framework/System.Security.Cryptography.Algorithms.wasm +0 -0
  127. package/build/interop/_framework/System.Security.Cryptography.Cng.wasm +0 -0
  128. package/build/interop/_framework/System.Security.Cryptography.Csp.wasm +0 -0
  129. package/build/interop/_framework/System.Security.Cryptography.Encoding.wasm +0 -0
  130. package/build/interop/_framework/System.Security.Cryptography.OpenSsl.wasm +0 -0
  131. package/build/interop/_framework/System.Security.Cryptography.Primitives.wasm +0 -0
  132. package/build/interop/_framework/System.Security.Cryptography.X509Certificates.wasm +0 -0
  133. package/build/interop/_framework/System.Security.Cryptography.wasm +0 -0
  134. package/build/interop/_framework/System.Security.Principal.Windows.wasm +0 -0
  135. package/build/interop/_framework/System.Security.Principal.wasm +0 -0
  136. package/build/interop/_framework/System.Security.SecureString.wasm +0 -0
  137. package/build/interop/_framework/System.Security.wasm +0 -0
  138. package/build/interop/_framework/System.ServiceModel.Web.wasm +0 -0
  139. package/build/interop/_framework/System.ServiceProcess.wasm +0 -0
  140. package/build/interop/_framework/System.Text.Encoding.CodePages.wasm +0 -0
  141. package/build/interop/_framework/System.Text.Encoding.Extensions.wasm +0 -0
  142. package/build/interop/_framework/System.Text.Encoding.wasm +0 -0
  143. package/build/interop/_framework/System.Text.Encodings.Web.wasm +0 -0
  144. package/build/interop/_framework/System.Text.Json.wasm +0 -0
  145. package/build/interop/_framework/System.Text.RegularExpressions.wasm +0 -0
  146. package/build/interop/_framework/System.Threading.Channels.wasm +0 -0
  147. package/build/interop/_framework/System.Threading.Overlapped.wasm +0 -0
  148. package/build/interop/_framework/System.Threading.Tasks.Dataflow.wasm +0 -0
  149. package/build/interop/_framework/System.Threading.Tasks.Extensions.wasm +0 -0
  150. package/build/interop/_framework/System.Threading.Tasks.Parallel.wasm +0 -0
  151. package/build/interop/_framework/System.Threading.Tasks.wasm +0 -0
  152. package/build/interop/_framework/System.Threading.Thread.wasm +0 -0
  153. package/build/interop/_framework/System.Threading.ThreadPool.wasm +0 -0
  154. package/build/interop/_framework/System.Threading.Timer.wasm +0 -0
  155. package/build/interop/_framework/System.Threading.wasm +0 -0
  156. package/build/interop/_framework/System.Transactions.Local.wasm +0 -0
  157. package/build/interop/_framework/System.Transactions.wasm +0 -0
  158. package/build/interop/_framework/System.ValueTuple.wasm +0 -0
  159. package/build/interop/_framework/System.Web.HttpUtility.wasm +0 -0
  160. package/build/interop/_framework/System.Web.wasm +0 -0
  161. package/build/interop/_framework/System.Windows.wasm +0 -0
  162. package/build/interop/_framework/System.Xml.Linq.wasm +0 -0
  163. package/build/interop/_framework/System.Xml.ReaderWriter.wasm +0 -0
  164. package/build/interop/_framework/System.Xml.Serialization.wasm +0 -0
  165. package/build/interop/_framework/System.Xml.XDocument.wasm +0 -0
  166. package/build/interop/_framework/System.Xml.XPath.XDocument.wasm +0 -0
  167. package/build/interop/_framework/System.Xml.XPath.wasm +0 -0
  168. package/build/interop/_framework/System.Xml.XmlDocument.wasm +0 -0
  169. package/build/interop/_framework/System.Xml.XmlSerializer.wasm +0 -0
  170. package/build/interop/_framework/System.Xml.wasm +0 -0
  171. package/build/interop/_framework/System.wasm +0 -0
  172. package/build/interop/_framework/WindowsBase.wasm +0 -0
  173. package/build/interop/_framework/blazor.boot.json +197 -0
  174. package/build/interop/_framework/dotnet.js +4 -0
  175. package/build/interop/_framework/dotnet.js.map +1 -0
  176. package/build/interop/_framework/dotnet.native.js +17 -0
  177. package/build/interop/_framework/dotnet.native.wasm +0 -0
  178. package/build/interop/_framework/dotnet.runtime.js +4 -0
  179. package/build/interop/_framework/dotnet.runtime.js.map +1 -0
  180. package/build/interop/_framework/mscorlib.wasm +0 -0
  181. package/build/interop/_framework/netstandard.wasm +0 -0
  182. package/build/interop/_framework/supportFiles/0_runtimeconfig.bin +1 -0
  183. package/build/interop/package.json +1 -0
  184. package/build/package.json +62 -0
  185. package/build/src/error.js +2 -0
  186. package/build/src/error.js.map +1 -0
  187. package/build/src/index.js +6 -0
  188. package/build/src/index.js.map +1 -0
  189. package/build/src/interop.js +2 -0
  190. package/build/src/interop.js.map +1 -0
  191. package/package.json +7 -2
  192. package/.depcheckrc +0 -6
  193. package/.github/CODEOWNERS +0 -4
  194. package/.github/workflows/release.yml +0 -211
  195. package/.github/workflows/test.yml +0 -87
  196. package/.prettierrc +0 -9
  197. package/.swcrc +0 -32
  198. package/dtdl/error/error.json +0 -11
  199. package/dtdl/simple/simple.json +0 -9
  200. package/eslint.config.mjs +0 -52
  201. package/interop/DTDLParserJSInterop.csproj +0 -26
  202. package/interop/DtdlErr.d.ts +0 -26
  203. package/interop/DtdlOm.d.ts +0 -372
  204. package/interop/LICENSE +0 -21
  205. package/interop/ModelParserInterop.cs +0 -19
  206. package/interop/README.md +0 -1
  207. package/interop/runtimeconfig.template.json +0 -11
  208. package/src/__tests__/index.test.ts +0 -119
  209. package/src/error.ts +0 -25
  210. package/src/interop.ts +0 -9
  211. package/test/mocharc.json +0 -6
  212. package/tsconfig.json +0 -21
  213. /package/{interop → build/interop}/modelParser.js +0 -0
  214. /package/{src → build/src}/__tests__/fixtures/empty.json +0 -0
  215. /package/{src → build/src}/__tests__/fixtures/nested/nested.json +0 -0
@@ -0,0 +1 @@
1
+ MMicrosoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmabilitytruefSystem.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerializationfalse'System.Diagnostics.Debugger.IsSupportedfalse2System.Diagnostics.Tracing.EventSource.IsSupportedfalseSystem.Globalization.Invarianttrue+System.Globalization.PredefinedCulturesOnlytrue6System.Reflection.Metadata.MetadataUpdater.IsSupportedfalse9System.Resources.ResourceManager.AllowCustomResourceTypesfalse&System.Resources.UseSystemResourceKeystrue<System.Runtime.InteropServices.BuiltInComInterop.IsSupportedfalseJSystem.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHostingfalse9System.Runtime.InteropServices.EnableCppCLIHostActivationfalseVSystem.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInteropfalseESystem.Runtime.Serialization.EnableUnsafeBinaryFormatterSerializationfalse&System.StartupHookProvider.IsSupportedfalse-System.Text.Encoding.EnableUnsafeUTF7Encodingfalse<System.Text.Json.JsonSerializer.IsReflectionEnabledByDefaultfalse-System.Threading.Thread.EnableAutoreleasePoolfalse
@@ -0,0 +1 @@
1
+ { "type":"module" }
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@digicatapult/dtdl-parser",
3
+ "version": "0.0.7",
4
+ "description": "JS tool to parse DTDL defined Ontologies",
5
+ "main": "src/index.ts",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts",
9
+ "build": "swc ./src ./package.json -d ./build --copy-files && npm run interop:build",
10
+ "interop:debug": "dotnet build interop",
11
+ "interop:build": "dotnet build interop --configuration Release",
12
+ "clean": "rimraf -rf ./build",
13
+ "lint": "eslint .",
14
+ "depcheck": "depcheck"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/digicatapult/dtdl-parser.git"
19
+ },
20
+ "files": [
21
+ "/build"
22
+ ],
23
+ "keywords": [
24
+ "dtdl",
25
+ "digital",
26
+ "twins",
27
+ "parsing",
28
+ "tool"
29
+ ],
30
+ "author": "Digital Catapult",
31
+ "license": "Apache-2.0",
32
+ "bugs": {
33
+ "url": "https://github.com/digicatapult/dtdl-parser/issues"
34
+ },
35
+ "homepage": "https://github.com/digicatapult/dtdl-parser#readme",
36
+ "devDependencies": {
37
+ "@eslint/eslintrc": "^3.1.0",
38
+ "@eslint/js": "^9.12.0",
39
+ "@swc-node/register": "^1.10.9",
40
+ "@swc/cli": "^0.4.1-nightly.20240914",
41
+ "@swc/core": "^1.7.35",
42
+ "@types/chai": "^5.0.0",
43
+ "@types/mocha": "^10.0.9",
44
+ "@types/node": "^22.7.5",
45
+ "@typescript-eslint/eslint-plugin": "^8.8.1",
46
+ "@typescript-eslint/parser": "^8.8.1",
47
+ "chai": "^5.1.1",
48
+ "depcheck": "^1.4.7",
49
+ "eslint": "^9.12.0",
50
+ "eslint-config-prettier": "^9.1.0",
51
+ "eslint-plugin-prettier": "^5.2.1",
52
+ "globals": "^15.11.0",
53
+ "mocha": "^10.7.3",
54
+ "prettier": "^3.3.3",
55
+ "prettier-plugin-organize-imports": "^4.1.0",
56
+ "rimraf": "^6.0.1",
57
+ "typescript": "^5.6.3"
58
+ },
59
+ "engines": {
60
+ "node": ">= 20"
61
+ }
62
+ }
@@ -0,0 +1,2 @@
1
+ let{error:e}=console,n=e=>"Parsing"===e.ExceptionKind,o=e=>"Resolution"===e.ExceptionKind;export const isResolutionException=e=>e instanceof Error&&o(JSON.parse(e.message));export const errorHandler=r=>{if(!(r instanceof Error))return e(`Unexpected error: ${r}`);let t=JSON.parse(r.message);n(t)||o(t)||e("Unknown exception type"),e(t)};
2
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/error.ts"],"sourcesContent":["import { ModelingException, ParsingException, ResolutionException } from '../interop/DtdlErr.js'\n\nconst { error } = console\n\nconst isParsingEx = (exception: ModelingException): exception is ParsingException => {\n return exception.ExceptionKind === 'Parsing'\n}\n\nconst isResolutionEx = (exception: ModelingException): exception is ResolutionException => {\n return exception.ExceptionKind === 'Resolution'\n}\n\nexport const isResolutionException = (err: unknown) => {\n if (!(err instanceof Error)) return false\n return isResolutionEx(JSON.parse(err.message))\n}\n\nexport const errorHandler = (err: unknown) => {\n if (!(err instanceof Error)) return error(`Unexpected error: ${err}`)\n\n const exception = JSON.parse(err.message) as ModelingException\n\n if (!(isParsingEx(exception) || isResolutionEx(exception))) error('Unknown exception type')\n error(exception)\n}\n"],"names":["error","console","isParsingEx","exception","ExceptionKind","isResolutionEx","isResolutionException","err","Error","JSON","parse","message","errorHandler"],"mappings":"AAEA,GAAM,CAAEA,MAAAA,CAAK,CAAE,CAAGC,QAEZC,EAAc,AAACC,GACZA,AAA4B,YAA5BA,EAAUC,aAAa,CAG1BC,EAAiB,AAACF,GACfA,AAA4B,eAA5BA,EAAUC,aAAa,AAGhC,QAAO,MAAME,sBAAwB,AAACC,GACpC,AAAMA,aAAeC,OACdH,EAAeI,KAAKC,KAAK,CAACH,EAAII,OAAO,EAC7C,AAED,QAAO,MAAMC,aAAe,AAACL,IAC3B,GAAI,CAAEA,CAAAA,aAAeC,KAAI,EAAI,OAAOR,EAAM,CAAC,kBAAkB,EAAEO,EAAI,CAAC,EAEpE,IAAMJ,EAAYM,KAAKC,KAAK,CAACH,EAAII,OAAO,EAElCT,EAAYC,IAAcE,EAAeF,IAAaH,EAAM,0BAClEA,EAAMG,EACR,CAAC"}
@@ -0,0 +1,6 @@
1
+ import e from"fs";import r from"path";import{errorHandler as t,isResolutionException as l}from"./error.js";let{log:n,error:s}=console;export const searchForJsonFiles=t=>e.existsSync(t)?e.readdirSync(t).map(e=>r.join(t,e)).reduce((t,l)=>e.statSync(l).isDirectory()?t.concat(searchForJsonFiles(l)):".json"===r.extname(l)?t.concat(l):t,[]):(s(`'${t}' not a valid filepath`),[]);let i=r=>{try{let t=e.readFileSync(r,"utf-8");return JSON.parse(t)}catch(e){return s(`Invalid JSON at '${r}'`),s(e),null}},a=e=>{let r=[];for(let t of e){let e=i(t);if(null===e)return null;r.push(e)}return r},o=(r,i,a)=>{try{let t=e.readFileSync(r,"utf-8");return i.parse(t),n(`Successfully validated '${r}'`),!0}catch(e){if(!a&&l(e))return n(`Successfully validated '${r}'`),!0;return s(`Error parsing '${r}'`),t(e),!1}},u=(e,r)=>{try{let t=JSON.parse(r.parse(JSON.stringify(e)));return n("Successfully parsed"),t}catch(e){return s("Error parsing"),t(e),null}};export const validateDirectories=(e,r,t)=>{n(`${r.parserVersion()}
2
+ `),n(`Validating DTDL at: '${e}'`);let l=searchForJsonFiles(e);if(l.length<1)return!1;for(let e of(n(`Found ${l.length} files:`),n(l),l))if(!o(e,r,t))return!1;return n(`All files validated!
3
+ `),!0};export const parseDirectories=(e,r)=>{n(`${r.parserVersion()}
4
+ `),n(`Parsing DTDL at: '${e}'`);let t=searchForJsonFiles(e);if(t.length<1)return null;n(`Found ${t.length} files:`),n(t);let l=a(t);if(null===l)return null;let s=u(l,r);if(null===s)return null;n(`All files parsed!
5
+ `),n("Entities:"),n(Object.keys(s));let i=Object.values(s).filter(e=>"Interface"===e.EntityKind);return n(`Number of interfaces: ${i.length}`),s};
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { DtdlObjectModel, InterfaceInfo } from '../interop/DtdlOm.js'\nimport { errorHandler, isResolutionException } from './error.js'\nimport { Parser } from './interop.js'\n\nconst { log, error } = console\n\nexport const searchForJsonFiles = (directory: string): string[] => {\n if (!fs.existsSync(directory)) {\n error(`'${directory}' not a valid filepath`)\n return []\n }\n\n return fs\n .readdirSync(directory)\n .map((file) => path.join(directory, file))\n .reduce((jsonFiles, fullPath) => {\n if (fs.statSync(fullPath).isDirectory()) {\n return jsonFiles.concat(searchForJsonFiles(fullPath)) //recursive\n } else if (path.extname(fullPath) === '.json') {\n return jsonFiles.concat(fullPath)\n }\n return jsonFiles\n }, [] as string[])\n}\n\nconst readJsonFile = (filepath: string): unknown | null => {\n try {\n const file = fs.readFileSync(filepath, 'utf-8')\n const json = JSON.parse(file)\n return json\n } catch (err) {\n error(`Invalid JSON at '${filepath}'`)\n error(err)\n return null\n }\n}\n\nconst combineJson = (filepaths: string[]) => {\n const combinedJson: unknown[] = []\n\n for (const filepath of filepaths) {\n const json = readJsonFile(filepath)\n if (json === null) {\n return null // exit on any error\n }\n combinedJson.push(json)\n }\n\n return combinedJson\n}\n\nconst validateFile = (filepath: string, parserModule: Parser, incResolutionException: boolean): boolean => {\n try {\n const file = fs.readFileSync(filepath, 'utf-8')\n parserModule.parse(file)\n log(`Successfully validated '${filepath}'`)\n return true\n } catch (err) {\n if (!incResolutionException && isResolutionException(err)) {\n // ignore resolution exception\n log(`Successfully validated '${filepath}'`)\n return true\n }\n error(`Error parsing '${filepath}'`)\n errorHandler(err)\n return false\n }\n}\n\nconst parseDtdl = (json: unknown[], parserModule: Parser): DtdlObjectModel | null => {\n try {\n const model = JSON.parse(parserModule.parse(JSON.stringify(json))) as DtdlObjectModel\n log(`Successfully parsed`)\n return model\n } catch (err) {\n error(`Error parsing`)\n errorHandler(err)\n return null\n }\n}\n\nexport const validateDirectories = (directory: string, parser: Parser, incResolutionException: boolean): boolean => {\n log(`${parser.parserVersion()}\\n`)\n log(`Validating DTDL at: '${directory}'`)\n\n const filepaths = searchForJsonFiles(directory)\n if (filepaths.length < 1) return false\n\n log(`Found ${filepaths.length} files:`)\n log(filepaths)\n\n for (const filepath of filepaths) {\n const isValid = validateFile(filepath, parser, incResolutionException)\n if (!isValid) return false // stop validating if error\n }\n\n log(`All files validated!\\n`)\n return true\n}\n\nexport const parseDirectories = (directory: string, parser: Parser): DtdlObjectModel | null => {\n log(`${parser.parserVersion()}\\n`)\n log(`Parsing DTDL at: '${directory}'`)\n\n const filepaths = searchForJsonFiles(directory)\n if (filepaths.length < 1) return null\n\n log(`Found ${filepaths.length} files:`)\n log(filepaths)\n\n const fullJson = combineJson(filepaths)\n if (fullJson === null) return null\n\n const fullModel = parseDtdl(fullJson, parser)\n if (fullModel === null) return null\n\n log(`All files parsed!\\n`)\n log(`Entities:`)\n log(Object.keys(fullModel))\n\n // Example type guard\n const interfaces: InterfaceInfo[] = Object.values(fullModel).filter(\n (value): value is InterfaceInfo => value.EntityKind === 'Interface'\n )\n log(`Number of interfaces: ${interfaces.length}`)\n\n return fullModel\n}\n"],"names":["fs","path","errorHandler","isResolutionException","log","error","console","searchForJsonFiles","directory","existsSync","readdirSync","map","file","join","reduce","jsonFiles","fullPath","statSync","isDirectory","concat","extname","readJsonFile","filepath","readFileSync","JSON","parse","err","combineJson","filepaths","combinedJson","json","push","validateFile","parserModule","incResolutionException","parseDtdl","model","stringify","validateDirectories","parser","parserVersion","length","parseDirectories","fullJson","fullModel","Object","keys","interfaces","values","filter","value","EntityKind"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export const getInterop=async()=>await import("../interop/modelParser.js");
2
+ //# sourceMappingURL=interop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/interop.ts"],"sourcesContent":["export const getInterop = async (): Promise<Parser> => {\n const module = await import('../interop/modelParser.js')\n return module as Parser\n}\n\nexport interface Parser {\n parse: (file: string) => string\n parserVersion: () => string\n}\n"],"names":["getInterop"],"mappings":"AAAA,OAAO,MAAMA,WAAa,SACT,MAAM,MAAM,CAAC,4BAE7B"}
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@digicatapult/dtdl-parser",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "JS tool to parse DTDL defined Ontologies",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "test": "NODE_ENV=test ./node_modules/.bin/mocha --config ./test/mocharc.json ./src/**/*.test.ts",
9
- "build": "npx swc ./src ./package.json -d ./build --copy-files",
9
+ "build": "swc ./src ./package.json -d ./build --copy-files && npm run interop:build",
10
+ "interop:debug": "dotnet build interop",
11
+ "interop:build": "dotnet build interop --configuration Release",
10
12
  "clean": "rimraf -rf ./build",
11
13
  "lint": "eslint .",
12
14
  "depcheck": "depcheck"
@@ -15,6 +17,9 @@
15
17
  "type": "git",
16
18
  "url": "git+https://github.com/digicatapult/dtdl-parser.git"
17
19
  },
20
+ "files": [
21
+ "/build"
22
+ ],
18
23
  "keywords": [
19
24
  "dtdl",
20
25
  "digital",
package/.depcheckrc DELETED
@@ -1,6 +0,0 @@
1
- ignores: [
2
- '@swc-node/register',
3
- 'prettier-plugin-organize-imports',
4
- 'rimraf',
5
- 'typescript'
6
- ]
@@ -1,4 +0,0 @@
1
- # Github CODEOWNERS file
2
-
3
- # Global code-owners for this repository
4
- * @digicatapult/software-engineering
@@ -1,211 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- branches: ['main', "init-commit"]
6
- jobs:
7
- preconditions:
8
- runs-on: ubuntu-latest
9
- outputs:
10
- repo_name: ${{ steps.repo_ids.outputs.REPO_NAME }}
11
- org_name: ${{ steps.repo_ids.outputs.ORG_NAME }}
12
- steps:
13
- - name: Checkout
14
- uses: actions/checkout@v4
15
- with:
16
- fetch-depth: 0
17
- - name: Check Github token
18
- run: |
19
- if [ -z "${{ secrets.GITHUB_TOKEN }}"]; then
20
- echo "Must provide a GITHUB_TOKEN secret in order to run release workflow"
21
- exit 1
22
- fi
23
- - name: Check npmjs token
24
- run: |
25
- if [ -z "${{ secrets.NPMJS_TOKEN }}"]; then
26
- echo "Must provide a NPMJS_TOKEN secret in order to run release workflow"
27
- exit 1
28
- fi
29
- - name: Get repository identifiers
30
- id: repo_ids
31
- run: |
32
- REPO_NAME=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
33
- ORG_NAME=$(echo "${{ github.event.repository.owner.name }}" | tr '[:upper:]' '[:lower:]')
34
- echo "REPO_NAME=$REPO_NAME" >> $GITHUB_OUTPUT
35
- echo "ORG_NAME=$ORG_NAME" >> $GITHUB_OUTPUT
36
- lint:
37
- name: Run lint
38
- runs-on: ubuntu-latest
39
- steps:
40
- - uses: actions/checkout@v4
41
- - uses: actions/setup-node@master
42
- with:
43
- node-version: 20.x
44
- - name: Use npm latest
45
- run: npm install -g npm@latest
46
- - name: Cache Node.js modules
47
- uses: actions/cache@v4
48
- with:
49
- path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
50
- key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
51
- restore-keys: |
52
- ${{ runner.OS }}-node-
53
- ${{ runner.OS }}-
54
- - name: Install Packages
55
- run: npm ci
56
- - name: Lint
57
- run: npm run lint
58
-
59
- dependency-check:
60
- name: Run dependency check
61
- runs-on: ubuntu-latest
62
- steps:
63
- - uses: actions/checkout@v4
64
- - uses: actions/setup-node@master
65
- with:
66
- node-version: 20.x
67
- - name: Use npm latest
68
- run: npm install -g npm@latest
69
- - name: Cache Node.js modules
70
- uses: actions/cache@v4
71
- with:
72
- path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
73
- key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
74
- restore-keys: |
75
- ${{ runner.OS }}-node-
76
- ${{ runner.OS }}-
77
- - name: Install Packages
78
- run: npm ci
79
- - name: Dependency Check
80
- run: npm run depcheck
81
- tests:
82
- name: Run tests
83
- strategy:
84
- fail-fast: false
85
- matrix:
86
- command: ['test']
87
- runs-on: ubuntu-latest
88
- steps:
89
- - uses: actions/checkout@v4
90
- - uses: actions/setup-node@v4
91
- with:
92
- node-version: 20.x
93
- - name: Cache Node.js modules
94
- uses: actions/cache@v4
95
- with:
96
- path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
97
- key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
98
- restore-keys: |
99
- ${{ runner.OS }}-node-
100
- ${{ runner.OS }}-
101
- - name: Install Packages
102
- run: npm ci
103
- - name: Build
104
- run: npm run build
105
- - name: Run tests
106
- run: npm run ${{ matrix.command }}
107
- check-version:
108
- name: 'Check version'
109
- runs-on: ubuntu-latest
110
- outputs:
111
- is_new_version: ${{ steps.get_version.outputs.IS_NEW_VERSION }}
112
- version: ${{ steps.get_version.outputs.VERSION }}
113
- build_date: ${{ steps.get_version.outputs.BUILD_DATE }}
114
- is_prerelease: ${{ steps.get_version.outputs.IS_PRERELEASE }}
115
-
116
- steps:
117
- - uses: actions/checkout@v4
118
- - name: Check version
119
- id: get_version
120
- uses: digicatapult/check-version@v1
121
- with:
122
- token: ${{ secrets.GITHUB_TOKEN }}
123
- publish-gh:
124
- name: 'Publish Github package'
125
- needs:
126
- - preconditions
127
- - lint
128
- - dependency-check
129
- - tests
130
- - check-version
131
- runs-on: ubuntu-latest
132
- if: ${{ needs.check-version.outputs.is_new_version == 'true' }}
133
-
134
- steps:
135
- - uses: actions/checkout@v4
136
- - uses: actions/setup-node@v4
137
- with:
138
- node-version: '16.x'
139
- registry-url: 'https://npm.pkg.github.com'
140
- scope: '@digicatapult'
141
- - name: Install packages
142
- run: npm ci
143
- - name: Publish to github packages
144
- run: npm publish --access public
145
- env:
146
- NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147
-
148
- publish-npm:
149
- name: 'Publish package to NPMJS'
150
- needs:
151
- - preconditions
152
- - lint
153
- - dependency-check
154
- - tests
155
- - check-version
156
- runs-on: ubuntu-latest
157
- if: ${{ needs.check-version.outputs.is_new_version == 'true' }}
158
-
159
- steps:
160
- - uses: actions/checkout@v4
161
- - uses: actions/setup-node@v4
162
- with:
163
- node-version: '18.x'
164
- registry-url: 'https://registry.npmjs.org'
165
- scope: '@digicatapult'
166
- - name: Install packages
167
- run: npm ci
168
- - name: Build
169
- run: npm run build
170
- - name: Publish to npmjs packages
171
- run: npm publish --access public
172
- env:
173
- NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
174
-
175
- publish:
176
- name: 'Publish release'
177
- needs: [preconditions, lint, dependency-check, tests, check-version]
178
- runs-on: ubuntu-latest
179
- if: ${{ needs.check-version.outputs.is_new_version == 'true' }}
180
-
181
- steps:
182
- - uses: actions/checkout@v4
183
-
184
- - name: Build release version
185
- uses: softprops/action-gh-release@v2
186
- with:
187
- token: '${{ secrets.GITHUB_TOKEN }}'
188
- tag_name: ${{ needs.check-version.outputs.version }}
189
- prerelease: false
190
- name: ${{ needs.check-version.outputs.version }}
191
- generate_release_notes: true
192
- - name: Delete release latest
193
- uses: actions/github-script@v7
194
- with:
195
- github-token: ${{secrets.GITHUB_TOKEN}}
196
- script: |
197
- const { owner, repo } = context.repo
198
- try {
199
- await github.rest.git.deleteRef({ owner, repo, ref: 'tags/latest' })
200
- }
201
- catch (err) {
202
- if (err.status !== 422) throw err
203
- }
204
- - name: Build release latest
205
- uses: softprops/action-gh-release@v2
206
- with:
207
- token: '${{ secrets.GITHUB_TOKEN }}'
208
- tag_name: latest
209
- prerelease: false
210
- name: Latest ${{ needs.check-version.outputs.version }}
211
- generate_release_notes: true
@@ -1,87 +0,0 @@
1
- name: Lint and Test
2
-
3
- on:
4
- push:
5
- branches-ignore: ['main']
6
-
7
- jobs:
8
- repo_ids:
9
- runs-on: ubuntu-latest
10
- outputs:
11
- repo_name: ${{ steps.repo_ids.outputs.REPO_NAME }}
12
- org_name: ${{ steps.repo_ids.outputs.ORG_NAME }}
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v4
16
- with:
17
- fetch-depth: 0
18
- - name: Get repository identifiers
19
- id: repo_ids
20
- run: |
21
- REPO_NAME=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
22
- ORG_NAME=$(echo "${{ github.event.repository.owner.name }}" | tr '[:upper:]' '[:lower:]')
23
- echo "REPO_NAME=$REPO_NAME" >> $GITHUB_OUTPUT
24
- echo "ORG_NAME=$ORG_NAME" >> $GITHUB_OUTPUT
25
-
26
- static-checks:
27
- name: Run Static Analysis Checks
28
- strategy:
29
- fail-fast: false
30
- matrix:
31
- command: [lint, depcheck]
32
- runs-on: ubuntu-latest
33
- steps:
34
- - uses: actions/checkout@v4
35
- - uses: actions/setup-node@v4
36
- with:
37
- node-version: 20.x
38
- - name: Cache Node.js modules
39
- uses: actions/cache@v4
40
- with:
41
- path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
42
- key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
43
- restore-keys: |
44
- ${{ runner.OS }}-node-
45
- ${{ runner.OS }}-
46
- - name: Install Packages
47
- run: npm ci
48
- - name: Lint
49
- run: npm run ${{ matrix.command }}
50
-
51
- tests:
52
- name: Run tests
53
- strategy:
54
- fail-fast: false
55
- matrix:
56
- command: ['test']
57
- runs-on: ubuntu-latest
58
- steps:
59
- - uses: actions/checkout@v4
60
- - uses: actions/setup-node@v4
61
- with:
62
- node-version: 20.x
63
- - name: Cache Node.js modules
64
- uses: actions/cache@v4
65
- with:
66
- path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
67
- key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
68
- restore-keys: |
69
- ${{ runner.OS }}-node-
70
- ${{ runner.OS }}-
71
- - name: Install Packages
72
- run: npm ci
73
- - name: Build
74
- run: npm run build
75
- - name: Run tests
76
- run: npm run ${{ matrix.command }}
77
-
78
- check-version:
79
- name: 'Check version'
80
- runs-on: ubuntu-latest
81
- steps:
82
- - uses: actions/checkout@v4
83
- - name: Check version
84
- id: get_version
85
- uses: digicatapult/check-version@v1
86
- with:
87
- token: ${{ secrets.GITHUB_TOKEN }}
package/.prettierrc DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "singleQuote": true,
3
- "semi": false,
4
- "trailingComma": "es5",
5
- "printWidth": 120,
6
- "plugins": [
7
- "prettier-plugin-organize-imports"
8
- ]
9
- }
package/.swcrc DELETED
@@ -1,32 +0,0 @@
1
- {
2
- "$schema": "https://swc.rs/schema.json",
3
- "jsc": {
4
- "parser": {
5
- "syntax": "typescript",
6
- "decorators": true,
7
- "topLevelAwait": true,
8
- "importMeta": true
9
- },
10
- "transform": {
11
- "legacyDecorator": true,
12
- "decoratorMetadata": true,
13
- "useDefineForClassFields": true
14
- },
15
- "minify": {
16
- "compress": {
17
- "unused": true
18
- },
19
- "mangle": true
20
- },
21
- "target": "esnext",
22
- "experimental": {
23
- "keepImportAttributes": true
24
- }
25
- },
26
- "exclude": [
27
- "/__tests__/"
28
- ],
29
- "sourceMaps": true,
30
- "isModule": true,
31
- "minify": true
32
- }
@@ -1,11 +0,0 @@
1
- {
2
- "@type": "Interface",
3
- "@id": "dtmi:com:example:Thermostat",
4
- "contents": [
5
- {
6
- "@type": "Telemetry",
7
- "name": "temperature",
8
- "schema": "double"
9
- }
10
- ]
11
- }
@@ -1,9 +0,0 @@
1
- {
2
- "@context": ["dtmi:dtdl:context;3"],
3
- "@id": "dtmi:com:example;1",
4
- "@type": "Interface",
5
- "extends": {
6
- "@type": "Interface",
7
- "@id": "dtmi:com:example:base;1"
8
- }
9
- }
package/eslint.config.mjs DELETED
@@ -1,52 +0,0 @@
1
- import { FlatCompat } from '@eslint/eslintrc'
2
- import js from '@eslint/js'
3
- import typescriptEslint from '@typescript-eslint/eslint-plugin'
4
- import tsParser from '@typescript-eslint/parser'
5
- import prettier from 'eslint-plugin-prettier'
6
- import globals from 'globals'
7
- import path from 'node:path'
8
- import { fileURLToPath } from 'node:url'
9
-
10
- const __filename = fileURLToPath(import.meta.url)
11
- const __dirname = path.dirname(__filename)
12
- const compat = new FlatCompat({
13
- baseDirectory: __dirname,
14
- recommendedConfig: js.configs.recommended,
15
- allConfig: js.configs.all,
16
- })
17
-
18
- export default [
19
- ...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'),
20
- {
21
- plugins: {
22
- prettier,
23
- '@typescript-eslint': typescriptEslint,
24
- },
25
-
26
- languageOptions: {
27
- globals: {
28
- ...globals.node,
29
- },
30
-
31
- parser: tsParser,
32
- ecmaVersion: 12,
33
- sourceType: 'module',
34
- },
35
-
36
- rules: {
37
- 'prettier/prettier': 'error',
38
- '@typescript-eslint/no-unused-vars': [
39
- 'warn',
40
- {
41
- ignoreRestSiblings: true,
42
- },
43
- ],
44
-
45
- 'no-console': 2,
46
- 'no-duplicate-imports': 'warn',
47
- },
48
- },
49
- {
50
- ignores: ['build/', 'node_modules/', 'interop/'],
51
- },
52
- ]
@@ -1,26 +0,0 @@
1
- <Project Sdk="Microsoft.NET.Sdk">
2
- <PropertyGroup>
3
- <TargetFramework>net8.0</TargetFramework>
4
- <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
5
- <OutputType>Exe</OutputType>
6
- <WasmMainJSPath>modelParser.js</WasmMainJSPath>
7
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8
- <RunAOTCompilation>false</RunAOTCompilation>
9
- <PublishTrimmed>true</PublishTrimmed>
10
- <InvariantGlobalization>true</InvariantGlobalization>
11
- <EmccInitialHeapSize>16mb</EmccInitialHeapSize>
12
- <DebuggerSupport>false</DebuggerSupport>
13
- <UseSystemResourceKeys>true</UseSystemResourceKeys>
14
- <EventSourceSupport>false</EventSourceSupport>
15
- <WasmEmitSymbolMap>false</WasmEmitSymbolMap>
16
- <WasmAppDir>../build/interop</WasmAppDir>
17
- </PropertyGroup>
18
-
19
- <ItemGroup>
20
- <WasmExtraFilesToDeploy Include="modelParser.js" />
21
- </ItemGroup>
22
-
23
- <ItemGroup>
24
- <PackageReference Include="DTDLParser" Version="1.0.52" />
25
- </ItemGroup>
26
- </Project>
@@ -1,26 +0,0 @@
1
- export type ModelingException = ParsingException | ResolutionException
2
-
3
- export interface ParsingException {
4
- ExceptionKind: 'Parsing'
5
- Errors: ParsingError[]
6
- }
7
-
8
- export interface ParsingError {
9
- PrimaryID?: string
10
- SecondaryID?: string
11
- Property?: string
12
- AuxProperty?: string
13
- Type?: string
14
- Value?: string
15
- Restriction?: string
16
- Transformation?: string
17
- Violations?: string[]
18
- Cause: string
19
- Action: string
20
- ValidationID: string
21
- }
22
-
23
- export interface ResolutionException {
24
- ExceptionKind: 'Resolution'
25
- UndefinedIdentifiers: string[]
26
- }