telepact 1.0.0-alpha.120

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 (482) hide show
  1. package/README.md +71 -0
  2. package/dist/LICENSE +201 -0
  3. package/dist/NOTICE +15 -0
  4. package/dist/inc/auth.telepact.json +29 -0
  5. package/dist/inc/internal.telepact.json +258 -0
  6. package/dist/inc/json-schema.json +245 -0
  7. package/dist/inc/mock-internal.telepact.json +157 -0
  8. package/dist/index.cjs.js +5186 -0
  9. package/dist/index.esm.js +5167 -0
  10. package/dist/index.iife.js +5188 -0
  11. package/dist/src/Client.d.ts +20 -0
  12. package/dist/src/Client.js +59 -0
  13. package/dist/src/Client.js.map +1 -0
  14. package/dist/src/DefaultSerialization.d.ts +9 -0
  15. package/dist/src/DefaultSerialization.js +35 -0
  16. package/dist/src/DefaultSerialization.js.map +1 -0
  17. package/dist/src/Message.d.ts +7 -0
  18. package/dist/src/Message.js +32 -0
  19. package/dist/src/Message.js.map +1 -0
  20. package/dist/src/MockServer.d.ts +27 -0
  21. package/dist/src/MockServer.js +68 -0
  22. package/dist/src/MockServer.js.map +1 -0
  23. package/dist/src/MockTelepactSchema.d.ts +17 -0
  24. package/dist/src/MockTelepactSchema.js +45 -0
  25. package/dist/src/MockTelepactSchema.js.map +1 -0
  26. package/dist/src/RandomGenerator.d.ts +15 -0
  27. package/dist/src/RandomGenerator.js +107 -0
  28. package/dist/src/RandomGenerator.js.map +1 -0
  29. package/dist/src/Serialization.d.ts +13 -0
  30. package/dist/src/Serialization.js +17 -0
  31. package/dist/src/Serialization.js.map +1 -0
  32. package/dist/src/SerializationError.d.ts +3 -0
  33. package/dist/src/SerializationError.js +22 -0
  34. package/dist/src/SerializationError.js.map +1 -0
  35. package/dist/src/Serializer.d.ts +15 -0
  36. package/dist/src/Serializer.js +43 -0
  37. package/dist/src/Serializer.js.map +1 -0
  38. package/dist/src/Server.d.ts +22 -0
  39. package/dist/src/Server.js +61 -0
  40. package/dist/src/Server.js.map +1 -0
  41. package/dist/src/TelepactError.d.ts +4 -0
  42. package/dist/src/TelepactError.js +24 -0
  43. package/dist/src/TelepactError.js.map +1 -0
  44. package/dist/src/TelepactSchema.d.ts +21 -0
  45. package/dist/src/TelepactSchema.js +50 -0
  46. package/dist/src/TelepactSchema.js.map +1 -0
  47. package/dist/src/TelepactSchemaFiles.d.ts +5 -0
  48. package/dist/src/TelepactSchemaFiles.js +23 -0
  49. package/dist/src/TelepactSchemaFiles.js.map +1 -0
  50. package/dist/src/TelepactSchemaParseError.d.ts +9 -0
  51. package/dist/src/TelepactSchemaParseError.js +31 -0
  52. package/dist/src/TelepactSchemaParseError.js.map +1 -0
  53. package/dist/src/fileSystem.d.ts +18 -0
  54. package/dist/src/fileSystem.js +17 -0
  55. package/dist/src/fileSystem.js.map +1 -0
  56. package/dist/src/index.d.ts +19 -0
  57. package/dist/src/index.js +35 -0
  58. package/dist/src/index.js.map +1 -0
  59. package/dist/src/internal/ClientHandleMessage.d.ts +3 -0
  60. package/dist/src/internal/ClientHandleMessage.js +52 -0
  61. package/dist/src/internal/ClientHandleMessage.js.map +1 -0
  62. package/dist/src/internal/DeserializeInternal.d.ts +5 -0
  63. package/dist/src/internal/DeserializeInternal.js +65 -0
  64. package/dist/src/internal/DeserializeInternal.js.map +1 -0
  65. package/dist/src/internal/HandleMessage.d.ts +3 -0
  66. package/dist/src/internal/HandleMessage.js +168 -0
  67. package/dist/src/internal/HandleMessage.js.map +1 -0
  68. package/dist/src/internal/ObjectsAreEqual.d.ts +1 -0
  69. package/dist/src/internal/ObjectsAreEqual.js +40 -0
  70. package/dist/src/internal/ObjectsAreEqual.js.map +1 -0
  71. package/dist/src/internal/ParseRequestMessage.d.ts +4 -0
  72. package/dist/src/internal/ParseRequestMessage.js +46 -0
  73. package/dist/src/internal/ParseRequestMessage.js.map +1 -0
  74. package/dist/src/internal/ProcessBytes.d.ts +8 -0
  75. package/dist/src/internal/ProcessBytes.js +47 -0
  76. package/dist/src/internal/ProcessBytes.js.map +1 -0
  77. package/dist/src/internal/SelectStructFields.d.ts +4 -0
  78. package/dist/src/internal/SelectStructFields.js +87 -0
  79. package/dist/src/internal/SelectStructFields.js.map +1 -0
  80. package/dist/src/internal/SerializeInternal.d.ts +5 -0
  81. package/dist/src/internal/SerializeInternal.js +49 -0
  82. package/dist/src/internal/SerializeInternal.js.map +1 -0
  83. package/dist/src/internal/binary/Base64Encoder.d.ts +4 -0
  84. package/dist/src/internal/binary/Base64Encoder.js +18 -0
  85. package/dist/src/internal/binary/Base64Encoder.js.map +1 -0
  86. package/dist/src/internal/binary/Base64Util.d.ts +2 -0
  87. package/dist/src/internal/binary/Base64Util.js +36 -0
  88. package/dist/src/internal/binary/Base64Util.js.map +1 -0
  89. package/dist/src/internal/binary/BinaryEncoder.d.ts +4 -0
  90. package/dist/src/internal/binary/BinaryEncoder.js +18 -0
  91. package/dist/src/internal/binary/BinaryEncoder.js.map +1 -0
  92. package/dist/src/internal/binary/BinaryEncoderUnavailableError.d.ts +2 -0
  93. package/dist/src/internal/binary/BinaryEncoderUnavailableError.js +18 -0
  94. package/dist/src/internal/binary/BinaryEncoderUnavailableError.js.map +1 -0
  95. package/dist/src/internal/binary/BinaryEncoding.d.ts +6 -0
  96. package/dist/src/internal/binary/BinaryEncoding.js +30 -0
  97. package/dist/src/internal/binary/BinaryEncoding.js.map +1 -0
  98. package/dist/src/internal/binary/BinaryEncodingCache.d.ts +7 -0
  99. package/dist/src/internal/binary/BinaryEncodingCache.js +18 -0
  100. package/dist/src/internal/binary/BinaryEncodingCache.js.map +1 -0
  101. package/dist/src/internal/binary/BinaryEncodingMissing.d.ts +3 -0
  102. package/dist/src/internal/binary/BinaryEncodingMissing.js +21 -0
  103. package/dist/src/internal/binary/BinaryEncodingMissing.js.map +1 -0
  104. package/dist/src/internal/binary/BinaryPackNode.d.ts +5 -0
  105. package/dist/src/internal/binary/BinaryPackNode.js +24 -0
  106. package/dist/src/internal/binary/BinaryPackNode.js.map +1 -0
  107. package/dist/src/internal/binary/CannotPack.d.ts +3 -0
  108. package/dist/src/internal/binary/CannotPack.js +22 -0
  109. package/dist/src/internal/binary/CannotPack.js.map +1 -0
  110. package/dist/src/internal/binary/ClientBase64Decode.d.ts +1 -0
  111. package/dist/src/internal/binary/ClientBase64Decode.js +80 -0
  112. package/dist/src/internal/binary/ClientBase64Decode.js.map +1 -0
  113. package/dist/src/internal/binary/ClientBase64Encode.d.ts +1 -0
  114. package/dist/src/internal/binary/ClientBase64Encode.js +43 -0
  115. package/dist/src/internal/binary/ClientBase64Encode.js.map +1 -0
  116. package/dist/src/internal/binary/ClientBase64Encoder.d.ts +5 -0
  117. package/dist/src/internal/binary/ClientBase64Encoder.js +29 -0
  118. package/dist/src/internal/binary/ClientBase64Encoder.js.map +1 -0
  119. package/dist/src/internal/binary/ClientBinaryDecode.d.ts +3 -0
  120. package/dist/src/internal/binary/ClientBinaryDecode.js +42 -0
  121. package/dist/src/internal/binary/ClientBinaryDecode.js.map +1 -0
  122. package/dist/src/internal/binary/ClientBinaryEncode.d.ts +3 -0
  123. package/dist/src/internal/binary/ClientBinaryEncode.js +46 -0
  124. package/dist/src/internal/binary/ClientBinaryEncode.js.map +1 -0
  125. package/dist/src/internal/binary/ClientBinaryEncoder.d.ts +9 -0
  126. package/dist/src/internal/binary/ClientBinaryEncoder.js +33 -0
  127. package/dist/src/internal/binary/ClientBinaryEncoder.js.map +1 -0
  128. package/dist/src/internal/binary/ClientBinaryStrategy.d.ts +15 -0
  129. package/dist/src/internal/binary/ClientBinaryStrategy.js +84 -0
  130. package/dist/src/internal/binary/ClientBinaryStrategy.js.map +1 -0
  131. package/dist/src/internal/binary/ConstructBinaryEncoding.d.ts +3 -0
  132. package/dist/src/internal/binary/ConstructBinaryEncoding.js +85 -0
  133. package/dist/src/internal/binary/ConstructBinaryEncoding.js.map +1 -0
  134. package/dist/src/internal/binary/ConvertMapsToObjects.d.ts +1 -0
  135. package/dist/src/internal/binary/ConvertMapsToObjects.js +42 -0
  136. package/dist/src/internal/binary/ConvertMapsToObjects.js.map +1 -0
  137. package/dist/src/internal/binary/CreateChecksum.d.ts +1 -0
  138. package/dist/src/internal/binary/CreateChecksum.js +21 -0
  139. package/dist/src/internal/binary/CreateChecksum.js.map +1 -0
  140. package/dist/src/internal/binary/DecodeBody.d.ts +2 -0
  141. package/dist/src/internal/binary/DecodeBody.js +20 -0
  142. package/dist/src/internal/binary/DecodeBody.js.map +1 -0
  143. package/dist/src/internal/binary/DecodeKeys.d.ts +2 -0
  144. package/dist/src/internal/binary/DecodeKeys.js +37 -0
  145. package/dist/src/internal/binary/DecodeKeys.js.map +1 -0
  146. package/dist/src/internal/binary/DefaultBinaryEncodingCache.d.ts +10 -0
  147. package/dist/src/internal/binary/DefaultBinaryEncodingCache.js +38 -0
  148. package/dist/src/internal/binary/DefaultBinaryEncodingCache.js.map +1 -0
  149. package/dist/src/internal/binary/EncodeBody.d.ts +2 -0
  150. package/dist/src/internal/binary/EncodeBody.js +20 -0
  151. package/dist/src/internal/binary/EncodeBody.js.map +1 -0
  152. package/dist/src/internal/binary/EncodeKeys.d.ts +2 -0
  153. package/dist/src/internal/binary/EncodeKeys.js +36 -0
  154. package/dist/src/internal/binary/EncodeKeys.js.map +1 -0
  155. package/dist/src/internal/binary/LocalStorageBackedBinaryEncodingCache.d.ts +13 -0
  156. package/dist/src/internal/binary/LocalStorageBackedBinaryEncodingCache.js +65 -0
  157. package/dist/src/internal/binary/LocalStorageBackedBinaryEncodingCache.js.map +1 -0
  158. package/dist/src/internal/binary/Pack.d.ts +1 -0
  159. package/dist/src/internal/binary/Pack.js +32 -0
  160. package/dist/src/internal/binary/Pack.js.map +1 -0
  161. package/dist/src/internal/binary/PackBody.d.ts +1 -0
  162. package/dist/src/internal/binary/PackBody.js +25 -0
  163. package/dist/src/internal/binary/PackBody.js.map +1 -0
  164. package/dist/src/internal/binary/PackList.d.ts +4 -0
  165. package/dist/src/internal/binary/PackList.js +68 -0
  166. package/dist/src/internal/binary/PackList.js.map +1 -0
  167. package/dist/src/internal/binary/PackMap.d.ts +5 -0
  168. package/dist/src/internal/binary/PackMap.js +87 -0
  169. package/dist/src/internal/binary/PackMap.js.map +1 -0
  170. package/dist/src/internal/binary/ServerBase64Decode.d.ts +1 -0
  171. package/dist/src/internal/binary/ServerBase64Decode.js +76 -0
  172. package/dist/src/internal/binary/ServerBase64Decode.js.map +1 -0
  173. package/dist/src/internal/binary/ServerBase64Encode.d.ts +1 -0
  174. package/dist/src/internal/binary/ServerBase64Encode.js +76 -0
  175. package/dist/src/internal/binary/ServerBase64Encode.js.map +1 -0
  176. package/dist/src/internal/binary/ServerBase64Encoder.d.ts +5 -0
  177. package/dist/src/internal/binary/ServerBase64Encoder.js +28 -0
  178. package/dist/src/internal/binary/ServerBase64Encoder.js.map +1 -0
  179. package/dist/src/internal/binary/ServerBinaryDecode.d.ts +2 -0
  180. package/dist/src/internal/binary/ServerBinaryDecode.js +39 -0
  181. package/dist/src/internal/binary/ServerBinaryDecode.js.map +1 -0
  182. package/dist/src/internal/binary/ServerBinaryEncode.d.ts +2 -0
  183. package/dist/src/internal/binary/ServerBinaryEncode.js +42 -0
  184. package/dist/src/internal/binary/ServerBinaryEncode.js.map +1 -0
  185. package/dist/src/internal/binary/ServerBinaryEncoder.d.ts +8 -0
  186. package/dist/src/internal/binary/ServerBinaryEncoder.js +30 -0
  187. package/dist/src/internal/binary/ServerBinaryEncoder.js.map +1 -0
  188. package/dist/src/internal/binary/Unpack.d.ts +1 -0
  189. package/dist/src/internal/binary/Unpack.js +32 -0
  190. package/dist/src/internal/binary/Unpack.js.map +1 -0
  191. package/dist/src/internal/binary/UnpackBody.d.ts +1 -0
  192. package/dist/src/internal/binary/UnpackBody.js +25 -0
  193. package/dist/src/internal/binary/UnpackBody.js.map +1 -0
  194. package/dist/src/internal/binary/UnpackList.d.ts +1 -0
  195. package/dist/src/internal/binary/UnpackList.js +39 -0
  196. package/dist/src/internal/binary/UnpackList.js.map +1 -0
  197. package/dist/src/internal/binary/UnpackMap.d.ts +1 -0
  198. package/dist/src/internal/binary/UnpackMap.js +40 -0
  199. package/dist/src/internal/binary/UnpackMap.js.map +1 -0
  200. package/dist/src/internal/generation/GenerateContext.d.ts +16 -0
  201. package/dist/src/internal/generation/GenerateContext.js +33 -0
  202. package/dist/src/internal/generation/GenerateContext.js.map +1 -0
  203. package/dist/src/internal/generation/GenerateRandomAny.d.ts +2 -0
  204. package/dist/src/internal/generation/GenerateRandomAny.js +28 -0
  205. package/dist/src/internal/generation/GenerateRandomAny.js.map +1 -0
  206. package/dist/src/internal/generation/GenerateRandomArray.d.ts +3 -0
  207. package/dist/src/internal/generation/GenerateRandomArray.js +37 -0
  208. package/dist/src/internal/generation/GenerateRandomArray.js.map +1 -0
  209. package/dist/src/internal/generation/GenerateRandomBoolean.d.ts +2 -0
  210. package/dist/src/internal/generation/GenerateRandomBoolean.js +24 -0
  211. package/dist/src/internal/generation/GenerateRandomBoolean.js.map +1 -0
  212. package/dist/src/internal/generation/GenerateRandomBytes.d.ts +2 -0
  213. package/dist/src/internal/generation/GenerateRandomBytes.js +24 -0
  214. package/dist/src/internal/generation/GenerateRandomBytes.js.map +1 -0
  215. package/dist/src/internal/generation/GenerateRandomInteger.d.ts +2 -0
  216. package/dist/src/internal/generation/GenerateRandomInteger.js +24 -0
  217. package/dist/src/internal/generation/GenerateRandomInteger.js.map +1 -0
  218. package/dist/src/internal/generation/GenerateRandomMockCall.d.ts +5 -0
  219. package/dist/src/internal/generation/GenerateRandomMockCall.js +26 -0
  220. package/dist/src/internal/generation/GenerateRandomMockCall.js.map +1 -0
  221. package/dist/src/internal/generation/GenerateRandomMockStub.d.ts +5 -0
  222. package/dist/src/internal/generation/GenerateRandomMockStub.js +38 -0
  223. package/dist/src/internal/generation/GenerateRandomMockStub.js.map +1 -0
  224. package/dist/src/internal/generation/GenerateRandomNumber.d.ts +2 -0
  225. package/dist/src/internal/generation/GenerateRandomNumber.js +24 -0
  226. package/dist/src/internal/generation/GenerateRandomNumber.js.map +1 -0
  227. package/dist/src/internal/generation/GenerateRandomObject.d.ts +3 -0
  228. package/dist/src/internal/generation/GenerateRandomObject.js +38 -0
  229. package/dist/src/internal/generation/GenerateRandomObject.js.map +1 -0
  230. package/dist/src/internal/generation/GenerateRandomSelect.d.ts +2 -0
  231. package/dist/src/internal/generation/GenerateRandomSelect.js +49 -0
  232. package/dist/src/internal/generation/GenerateRandomSelect.js.map +1 -0
  233. package/dist/src/internal/generation/GenerateRandomString.d.ts +2 -0
  234. package/dist/src/internal/generation/GenerateRandomString.js +24 -0
  235. package/dist/src/internal/generation/GenerateRandomString.js.map +1 -0
  236. package/dist/src/internal/generation/GenerateRandomStruct.d.ts +5 -0
  237. package/dist/src/internal/generation/GenerateRandomStruct.js +60 -0
  238. package/dist/src/internal/generation/GenerateRandomStruct.js.map +1 -0
  239. package/dist/src/internal/generation/GenerateRandomUnion.d.ts +5 -0
  240. package/dist/src/internal/generation/GenerateRandomUnion.js +35 -0
  241. package/dist/src/internal/generation/GenerateRandomUnion.js.map +1 -0
  242. package/dist/src/internal/generation/GenerateRandomValueOfType.d.ts +4 -0
  243. package/dist/src/internal/generation/GenerateRandomValueOfType.js +24 -0
  244. package/dist/src/internal/generation/GenerateRandomValueOfType.js.map +1 -0
  245. package/dist/src/internal/mock/IsSubMap.d.ts +1 -0
  246. package/dist/src/internal/mock/IsSubMap.js +28 -0
  247. package/dist/src/internal/mock/IsSubMap.js.map +1 -0
  248. package/dist/src/internal/mock/IsSubMapEntryEqual.d.ts +1 -0
  249. package/dist/src/internal/mock/IsSubMapEntryEqual.js +37 -0
  250. package/dist/src/internal/mock/IsSubMapEntryEqual.js.map +1 -0
  251. package/dist/src/internal/mock/MockHandle.d.ts +6 -0
  252. package/dist/src/internal/mock/MockHandle.js +121 -0
  253. package/dist/src/internal/mock/MockHandle.js.map +1 -0
  254. package/dist/src/internal/mock/MockInvocation.d.ts +6 -0
  255. package/dist/src/internal/mock/MockInvocation.js +26 -0
  256. package/dist/src/internal/mock/MockInvocation.js.map +1 -0
  257. package/dist/src/internal/mock/MockStub.d.ts +8 -0
  258. package/dist/src/internal/mock/MockStub.js +30 -0
  259. package/dist/src/internal/mock/MockStub.js.map +1 -0
  260. package/dist/src/internal/mock/PartiallyMatches.d.ts +1 -0
  261. package/dist/src/internal/mock/PartiallyMatches.js +25 -0
  262. package/dist/src/internal/mock/PartiallyMatches.js.map +1 -0
  263. package/dist/src/internal/mock/Verify.d.ts +8 -0
  264. package/dist/src/internal/mock/Verify.js +94 -0
  265. package/dist/src/internal/mock/Verify.js.map +1 -0
  266. package/dist/src/internal/mock/VerifyNoMoreInteractions.d.ts +4 -0
  267. package/dist/src/internal/mock/VerifyNoMoreInteractions.js +30 -0
  268. package/dist/src/internal/mock/VerifyNoMoreInteractions.js.map +1 -0
  269. package/dist/src/internal/schema/ApplyErrorToParsedTypes.d.ts +13 -0
  270. package/dist/src/internal/schema/ApplyErrorToParsedTypes.js +61 -0
  271. package/dist/src/internal/schema/ApplyErrorToParsedTypes.js.map +1 -0
  272. package/dist/src/internal/schema/CatchErrorCollisions.d.ts +1 -0
  273. package/dist/src/internal/schema/CatchErrorCollisions.js +73 -0
  274. package/dist/src/internal/schema/CatchErrorCollisions.js.map +1 -0
  275. package/dist/src/internal/schema/CatchHeaderCollisions.d.ts +1 -0
  276. package/dist/src/internal/schema/CatchHeaderCollisions.js +74 -0
  277. package/dist/src/internal/schema/CatchHeaderCollisions.js.map +1 -0
  278. package/dist/src/internal/schema/CreateMockTelepactSchemaFromFileJsonMap.d.ts +2 -0
  279. package/dist/src/internal/schema/CreateMockTelepactSchemaFromFileJsonMap.js +25 -0
  280. package/dist/src/internal/schema/CreateMockTelepactSchemaFromFileJsonMap.js.map +1 -0
  281. package/dist/src/internal/schema/CreateTelepactSchemaFromFileJsonMap.d.ts +2 -0
  282. package/dist/src/internal/schema/CreateTelepactSchemaFromFileJsonMap.js +33 -0
  283. package/dist/src/internal/schema/CreateTelepactSchemaFromFileJsonMap.js.map +1 -0
  284. package/dist/src/internal/schema/DerivePossibleSelect.d.ts +2 -0
  285. package/dist/src/internal/schema/DerivePossibleSelect.js +87 -0
  286. package/dist/src/internal/schema/DerivePossibleSelect.js.map +1 -0
  287. package/dist/src/internal/schema/FindMatchingSchemaKey.d.ts +1 -0
  288. package/dist/src/internal/schema/FindMatchingSchemaKey.js +27 -0
  289. package/dist/src/internal/schema/FindMatchingSchemaKey.js.map +1 -0
  290. package/dist/src/internal/schema/FindSchemaKey.d.ts +1 -0
  291. package/dist/src/internal/schema/FindSchemaKey.js +40 -0
  292. package/dist/src/internal/schema/FindSchemaKey.js.map +1 -0
  293. package/dist/src/internal/schema/GetAuthTelepactJson.d.ts +1 -0
  294. package/dist/src/internal/schema/GetAuthTelepactJson.js +20 -0
  295. package/dist/src/internal/schema/GetAuthTelepactJson.js.map +1 -0
  296. package/dist/src/internal/schema/GetInternalTelepactJson.d.ts +1 -0
  297. package/dist/src/internal/schema/GetInternalTelepactJson.js +20 -0
  298. package/dist/src/internal/schema/GetInternalTelepactJson.js.map +1 -0
  299. package/dist/src/internal/schema/GetMockTelepactJson.d.ts +1 -0
  300. package/dist/src/internal/schema/GetMockTelepactJson.js +20 -0
  301. package/dist/src/internal/schema/GetMockTelepactJson.js.map +1 -0
  302. package/dist/src/internal/schema/GetOrParseType.d.ts +3 -0
  303. package/dist/src/internal/schema/GetOrParseType.js +108 -0
  304. package/dist/src/internal/schema/GetOrParseType.js.map +1 -0
  305. package/dist/src/internal/schema/GetPathDocumentCoordinatesPseudoJson.d.ts +7 -0
  306. package/dist/src/internal/schema/GetPathDocumentCoordinatesPseudoJson.js +218 -0
  307. package/dist/src/internal/schema/GetPathDocumentCoordinatesPseudoJson.js.map +1 -0
  308. package/dist/src/internal/schema/GetSchemaFileMap.d.ts +2 -0
  309. package/dist/src/internal/schema/GetSchemaFileMap.js +40 -0
  310. package/dist/src/internal/schema/GetSchemaFileMap.js.map +1 -0
  311. package/dist/src/internal/schema/GetTypeUnexpectedParseFailure.d.ts +2 -0
  312. package/dist/src/internal/schema/GetTypeUnexpectedParseFailure.js +26 -0
  313. package/dist/src/internal/schema/GetTypeUnexpectedParseFailure.js.map +1 -0
  314. package/dist/src/internal/schema/MapSchemaParseFailuresToPseudoJson.d.ts +2 -0
  315. package/dist/src/internal/schema/MapSchemaParseFailuresToPseudoJson.js +31 -0
  316. package/dist/src/internal/schema/MapSchemaParseFailuresToPseudoJson.js.map +1 -0
  317. package/dist/src/internal/schema/ParseContext.d.ts +41 -0
  318. package/dist/src/internal/schema/ParseContext.js +41 -0
  319. package/dist/src/internal/schema/ParseContext.js.map +1 -0
  320. package/dist/src/internal/schema/ParseErrorType.d.ts +5 -0
  321. package/dist/src/internal/schema/ParseErrorType.js +35 -0
  322. package/dist/src/internal/schema/ParseErrorType.js.map +1 -0
  323. package/dist/src/internal/schema/ParseField.d.ts +3 -0
  324. package/dist/src/internal/schema/ParseField.js +36 -0
  325. package/dist/src/internal/schema/ParseField.js.map +1 -0
  326. package/dist/src/internal/schema/ParseFunctionType.d.ts +8 -0
  327. package/dist/src/internal/schema/ParseFunctionType.js +75 -0
  328. package/dist/src/internal/schema/ParseFunctionType.js.map +1 -0
  329. package/dist/src/internal/schema/ParseHeadersType.d.ts +5 -0
  330. package/dist/src/internal/schema/ParseHeadersType.js +92 -0
  331. package/dist/src/internal/schema/ParseHeadersType.js.map +1 -0
  332. package/dist/src/internal/schema/ParseStructFields.d.ts +7 -0
  333. package/dist/src/internal/schema/ParseStructFields.js +58 -0
  334. package/dist/src/internal/schema/ParseStructFields.js.map +1 -0
  335. package/dist/src/internal/schema/ParseStructType.d.ts +5 -0
  336. package/dist/src/internal/schema/ParseStructType.js +53 -0
  337. package/dist/src/internal/schema/ParseStructType.js.map +1 -0
  338. package/dist/src/internal/schema/ParseTelepactSchema.d.ts +2 -0
  339. package/dist/src/internal/schema/ParseTelepactSchema.js +257 -0
  340. package/dist/src/internal/schema/ParseTelepactSchema.js.map +1 -0
  341. package/dist/src/internal/schema/ParseTypeDeclaration.d.ts +2 -0
  342. package/dist/src/internal/schema/ParseTypeDeclaration.js +84 -0
  343. package/dist/src/internal/schema/ParseTypeDeclaration.js.map +1 -0
  344. package/dist/src/internal/schema/ParseUnionType.d.ts +5 -0
  345. package/dist/src/internal/schema/ParseUnionType.js +138 -0
  346. package/dist/src/internal/schema/ParseUnionType.js.map +1 -0
  347. package/dist/src/internal/schema/SchemaParseFailure.d.ts +8 -0
  348. package/dist/src/internal/schema/SchemaParseFailure.js +29 -0
  349. package/dist/src/internal/schema/SchemaParseFailure.js.map +1 -0
  350. package/dist/src/internal/types/GetType.d.ts +1 -0
  351. package/dist/src/internal/types/GetType.js +39 -0
  352. package/dist/src/internal/types/GetType.js.map +1 -0
  353. package/dist/src/internal/types/TAny.d.ts +11 -0
  354. package/dist/src/internal/types/TAny.js +33 -0
  355. package/dist/src/internal/types/TAny.js.map +1 -0
  356. package/dist/src/internal/types/TArray.d.ts +12 -0
  357. package/dist/src/internal/types/TArray.js +34 -0
  358. package/dist/src/internal/types/TArray.js.map +1 -0
  359. package/dist/src/internal/types/TBoolean.d.ts +12 -0
  360. package/dist/src/internal/types/TBoolean.js +34 -0
  361. package/dist/src/internal/types/TBoolean.js.map +1 -0
  362. package/dist/src/internal/types/TBytes.d.ts +12 -0
  363. package/dist/src/internal/types/TBytes.js +34 -0
  364. package/dist/src/internal/types/TBytes.js.map +1 -0
  365. package/dist/src/internal/types/TError.d.ts +6 -0
  366. package/dist/src/internal/types/TError.js +24 -0
  367. package/dist/src/internal/types/TError.js.map +1 -0
  368. package/dist/src/internal/types/TFieldDeclaration.d.ts +7 -0
  369. package/dist/src/internal/types/TFieldDeclaration.js +26 -0
  370. package/dist/src/internal/types/TFieldDeclaration.js.map +1 -0
  371. package/dist/src/internal/types/THeaders.d.ts +15 -0
  372. package/dist/src/internal/types/THeaders.js +26 -0
  373. package/dist/src/internal/types/THeaders.js.map +1 -0
  374. package/dist/src/internal/types/TInteger.d.ts +12 -0
  375. package/dist/src/internal/types/TInteger.js +34 -0
  376. package/dist/src/internal/types/TInteger.js.map +1 -0
  377. package/dist/src/internal/types/TMockCall.d.ts +16 -0
  378. package/dist/src/internal/types/TMockCall.js +39 -0
  379. package/dist/src/internal/types/TMockCall.js.map +1 -0
  380. package/dist/src/internal/types/TMockStub.d.ts +18 -0
  381. package/dist/src/internal/types/TMockStub.js +39 -0
  382. package/dist/src/internal/types/TMockStub.js.map +1 -0
  383. package/dist/src/internal/types/TNumber.d.ts +12 -0
  384. package/dist/src/internal/types/TNumber.js +34 -0
  385. package/dist/src/internal/types/TNumber.js.map +1 -0
  386. package/dist/src/internal/types/TObject.d.ts +12 -0
  387. package/dist/src/internal/types/TObject.js +33 -0
  388. package/dist/src/internal/types/TObject.js.map +1 -0
  389. package/dist/src/internal/types/TSelect.d.ts +13 -0
  390. package/dist/src/internal/types/TSelect.js +34 -0
  391. package/dist/src/internal/types/TSelect.js.map +1 -0
  392. package/dist/src/internal/types/TString.d.ts +12 -0
  393. package/dist/src/internal/types/TString.js +34 -0
  394. package/dist/src/internal/types/TString.js.map +1 -0
  395. package/dist/src/internal/types/TStruct.d.ts +20 -0
  396. package/dist/src/internal/types/TStruct.js +39 -0
  397. package/dist/src/internal/types/TStruct.js.map +1 -0
  398. package/dist/src/internal/types/TType.d.ts +10 -0
  399. package/dist/src/internal/types/TType.js +18 -0
  400. package/dist/src/internal/types/TType.js.map +1 -0
  401. package/dist/src/internal/types/TTypeDeclaration.d.ts +12 -0
  402. package/dist/src/internal/types/TTypeDeclaration.js +34 -0
  403. package/dist/src/internal/types/TTypeDeclaration.js.map +1 -0
  404. package/dist/src/internal/types/TUnion.d.ts +25 -0
  405. package/dist/src/internal/types/TUnion.js +41 -0
  406. package/dist/src/internal/types/TUnion.js.map +1 -0
  407. package/dist/src/internal/validation/GetInvalidErrorMessage.d.ts +6 -0
  408. package/dist/src/internal/validation/GetInvalidErrorMessage.js +29 -0
  409. package/dist/src/internal/validation/GetInvalidErrorMessage.js.map +1 -0
  410. package/dist/src/internal/validation/GetTypeUnexpectedValidationFailure.d.ts +2 -0
  411. package/dist/src/internal/validation/GetTypeUnexpectedValidationFailure.js +26 -0
  412. package/dist/src/internal/validation/GetTypeUnexpectedValidationFailure.js.map +1 -0
  413. package/dist/src/internal/validation/InvalidMessage.d.ts +3 -0
  414. package/dist/src/internal/validation/InvalidMessage.js +21 -0
  415. package/dist/src/internal/validation/InvalidMessage.js.map +1 -0
  416. package/dist/src/internal/validation/InvalidMessageBody.d.ts +2 -0
  417. package/dist/src/internal/validation/InvalidMessageBody.js +18 -0
  418. package/dist/src/internal/validation/InvalidMessageBody.js.map +1 -0
  419. package/dist/src/internal/validation/MapValidationFailuresToInvalidFieldCases.d.ts +2 -0
  420. package/dist/src/internal/validation/MapValidationFailuresToInvalidFieldCases.js +27 -0
  421. package/dist/src/internal/validation/MapValidationFailuresToInvalidFieldCases.js.map +1 -0
  422. package/dist/src/internal/validation/ValidateArray.d.ts +4 -0
  423. package/dist/src/internal/validation/ValidateArray.js +42 -0
  424. package/dist/src/internal/validation/ValidateArray.js.map +1 -0
  425. package/dist/src/internal/validation/ValidateBoolean.d.ts +2 -0
  426. package/dist/src/internal/validation/ValidateBoolean.js +26 -0
  427. package/dist/src/internal/validation/ValidateBoolean.js.map +1 -0
  428. package/dist/src/internal/validation/ValidateBytes.d.ts +3 -0
  429. package/dist/src/internal/validation/ValidateBytes.js +56 -0
  430. package/dist/src/internal/validation/ValidateBytes.js.map +1 -0
  431. package/dist/src/internal/validation/ValidateContext.d.ts +13 -0
  432. package/dist/src/internal/validation/ValidateContext.js +32 -0
  433. package/dist/src/internal/validation/ValidateContext.js.map +1 -0
  434. package/dist/src/internal/validation/ValidateHeaders.d.ts +3 -0
  435. package/dist/src/internal/validation/ValidateHeaders.js +34 -0
  436. package/dist/src/internal/validation/ValidateHeaders.js.map +1 -0
  437. package/dist/src/internal/validation/ValidateInteger.d.ts +2 -0
  438. package/dist/src/internal/validation/ValidateInteger.js +33 -0
  439. package/dist/src/internal/validation/ValidateInteger.js.map +1 -0
  440. package/dist/src/internal/validation/ValidateMockCall.d.ts +4 -0
  441. package/dist/src/internal/validation/ValidateMockCall.js +50 -0
  442. package/dist/src/internal/validation/ValidateMockCall.js.map +1 -0
  443. package/dist/src/internal/validation/ValidateMockStub.d.ts +6 -0
  444. package/dist/src/internal/validation/ValidateMockStub.js +73 -0
  445. package/dist/src/internal/validation/ValidateMockStub.js.map +1 -0
  446. package/dist/src/internal/validation/ValidateNumber.d.ts +2 -0
  447. package/dist/src/internal/validation/ValidateNumber.js +33 -0
  448. package/dist/src/internal/validation/ValidateNumber.js.map +1 -0
  449. package/dist/src/internal/validation/ValidateObject.d.ts +4 -0
  450. package/dist/src/internal/validation/ValidateObject.js +40 -0
  451. package/dist/src/internal/validation/ValidateObject.js.map +1 -0
  452. package/dist/src/internal/validation/ValidateResult.d.ts +2 -0
  453. package/dist/src/internal/validation/ValidateResult.js +25 -0
  454. package/dist/src/internal/validation/ValidateResult.js.map +1 -0
  455. package/dist/src/internal/validation/ValidateSelect.d.ts +3 -0
  456. package/dist/src/internal/validation/ValidateSelect.js +56 -0
  457. package/dist/src/internal/validation/ValidateSelect.js.map +1 -0
  458. package/dist/src/internal/validation/ValidateString.d.ts +2 -0
  459. package/dist/src/internal/validation/ValidateString.js +26 -0
  460. package/dist/src/internal/validation/ValidateString.js.map +1 -0
  461. package/dist/src/internal/validation/ValidateStruct.d.ts +4 -0
  462. package/dist/src/internal/validation/ValidateStruct.js +28 -0
  463. package/dist/src/internal/validation/ValidateStruct.js.map +1 -0
  464. package/dist/src/internal/validation/ValidateStructFields.d.ts +4 -0
  465. package/dist/src/internal/validation/ValidateStructFields.js +53 -0
  466. package/dist/src/internal/validation/ValidateStructFields.js.map +1 -0
  467. package/dist/src/internal/validation/ValidateUnion.d.ts +4 -0
  468. package/dist/src/internal/validation/ValidateUnion.js +34 -0
  469. package/dist/src/internal/validation/ValidateUnion.js.map +1 -0
  470. package/dist/src/internal/validation/ValidateUnionStruct.d.ts +4 -0
  471. package/dist/src/internal/validation/ValidateUnionStruct.js +24 -0
  472. package/dist/src/internal/validation/ValidateUnionStruct.js.map +1 -0
  473. package/dist/src/internal/validation/ValidateUnionTags.d.ts +4 -0
  474. package/dist/src/internal/validation/ValidateUnionTags.js +46 -0
  475. package/dist/src/internal/validation/ValidateUnionTags.js.map +1 -0
  476. package/dist/src/internal/validation/ValidateValueOfType.d.ts +5 -0
  477. package/dist/src/internal/validation/ValidateValueOfType.js +28 -0
  478. package/dist/src/internal/validation/ValidateValueOfType.js.map +1 -0
  479. package/dist/src/internal/validation/ValidationFailure.d.ts +6 -0
  480. package/dist/src/internal/validation/ValidationFailure.js +26 -0
  481. package/dist/src/internal/validation/ValidationFailure.js.map +1 -0
  482. package/package.json +57 -0
@@ -0,0 +1,20 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ import mockInternalTelepact from '../../../inc/mock-internal.telepact.json';
17
+ export function getMockTelepactJson() {
18
+ return JSON.stringify(mockInternalTelepact);
19
+ }
20
+ //# sourceMappingURL=GetMockTelepactJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetMockTelepactJson.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetMockTelepactJson.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAEH,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,MAAM,UAAU,mBAAmB;IAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TType } from '../types/TType';
2
+ import { ParseContext } from '../../internal/schema/ParseContext';
3
+ export declare function getOrParseType(path: any[], typeName: string, ctx: ParseContext): TType;
@@ -0,0 +1,108 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ import { TelepactSchemaParseError } from '../../TelepactSchemaParseError';
17
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
18
+ import { TBoolean } from '../types/TBoolean';
19
+ import { TInteger } from '../types/TInteger';
20
+ import { TNumber } from '../types/TNumber';
21
+ import { TString } from '../types/TString';
22
+ import { TAny } from '../types/TAny';
23
+ import { TBytes } from '../types/TBytes';
24
+ import { parseFunctionErrorsRegex, parseFunctionResultType } from '../../internal/schema/ParseFunctionType';
25
+ import { parseStructType } from '../../internal/schema/ParseStructType';
26
+ import { parseUnionType } from '../../internal/schema/ParseUnionType';
27
+ import { TSelect } from '../types/TSelect';
28
+ import { TMockCall } from '../types/TMockCall';
29
+ import { TMockStub } from '../types/TMockStub';
30
+ import { TUnion } from '../types/TUnion';
31
+ export function getOrParseType(path, typeName, ctx) {
32
+ if (ctx.failedTypes.has(typeName)) {
33
+ throw new TelepactSchemaParseError([], ctx.telepactSchemaDocumentNamesToJson);
34
+ }
35
+ const existingType = ctx.parsedTypes[typeName];
36
+ if (existingType !== undefined) {
37
+ return existingType;
38
+ }
39
+ const regexString = `^(boolean|integer|number|string|any|bytes)|((fn|(union|struct|_ext))\\.([a-zA-Z_]\\w*))$`;
40
+ const regex = new RegExp(regexString);
41
+ const matcher = typeName.match(regex);
42
+ if (!matcher) {
43
+ throw new TelepactSchemaParseError([new SchemaParseFailure(ctx.documentName, path, 'StringRegexMatchFailed', { regex: regexString })], ctx.telepactSchemaDocumentNamesToJson);
44
+ }
45
+ const standardTypeName = matcher[1];
46
+ if (standardTypeName) {
47
+ return ({
48
+ boolean: new TBoolean(),
49
+ integer: new TInteger(),
50
+ number: new TNumber(),
51
+ string: new TString(),
52
+ bytes: new TBytes(),
53
+ }[standardTypeName] || new TAny());
54
+ }
55
+ const customTypeName = matcher[2];
56
+ const thisIndex = ctx.schemaKeysToIndex[customTypeName];
57
+ const thisDocumentName = ctx.schemaKeysToDocumentName[customTypeName];
58
+ if (thisIndex === undefined) {
59
+ throw new TelepactSchemaParseError([new SchemaParseFailure(ctx.documentName, path, 'TypeUnknown', { name: customTypeName })], ctx.telepactSchemaDocumentNamesToJson);
60
+ }
61
+ const definition = ctx.telepactSchemaDocumentNamesToPseudoJson[thisDocumentName][thisIndex];
62
+ let type;
63
+ try {
64
+ if (customTypeName.startsWith('struct')) {
65
+ type = parseStructType([thisIndex], definition, customTypeName, [], ctx.copy({ documentName: thisDocumentName }));
66
+ ctx.parsedTypes[customTypeName] = type;
67
+ }
68
+ else if (customTypeName.startsWith('union')) {
69
+ type = parseUnionType([thisIndex], definition, customTypeName, [], [], ctx.copy({ documentName: thisDocumentName }));
70
+ ctx.parsedTypes[customTypeName] = type;
71
+ }
72
+ else if (customTypeName.startsWith('fn')) {
73
+ const argType = parseStructType([thisIndex], definition, customTypeName, ['->', '_errors'], ctx.copy({ documentName: thisDocumentName }));
74
+ type = new TUnion(customTypeName, { [customTypeName]: argType }, { [customTypeName]: 0 });
75
+ ctx.parsedTypes[customTypeName] = type;
76
+ const resultType = parseFunctionResultType([thisIndex], definition, customTypeName, ctx.copy({ documentName: thisDocumentName }));
77
+ ctx.parsedTypes[customTypeName + '.->'] = resultType;
78
+ const errorsRegex = parseFunctionErrorsRegex([thisIndex], definition, customTypeName, ctx.copy({ documentName: thisDocumentName }));
79
+ ctx.fnErrorRegexes[customTypeName] = errorsRegex;
80
+ }
81
+ else {
82
+ const possibleTypeExtension = {
83
+ '_ext.Select_': new TSelect(),
84
+ '_ext.Call_': new TMockCall(ctx.parsedTypes),
85
+ '_ext.Stub_': new TMockStub(ctx.parsedTypes),
86
+ }[customTypeName];
87
+ if (!possibleTypeExtension) {
88
+ throw new TelepactSchemaParseError([
89
+ new SchemaParseFailure(ctx.documentName, [thisIndex], 'TypeExtensionImplementationMissing', {
90
+ name: customTypeName,
91
+ }),
92
+ ], ctx.telepactSchemaDocumentNamesToJson);
93
+ }
94
+ type = possibleTypeExtension;
95
+ ctx.parsedTypes[customTypeName] = type;
96
+ }
97
+ return type;
98
+ }
99
+ catch (e) {
100
+ if (e instanceof TelepactSchemaParseError) {
101
+ ctx.allParseFailures.push(...e.schemaParseFailures);
102
+ ctx.failedTypes.add(customTypeName);
103
+ throw new TelepactSchemaParseError([], ctx.telepactSchemaDocumentNamesToJson);
104
+ }
105
+ throw e;
106
+ }
107
+ }
108
+ //# sourceMappingURL=GetOrParseType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetOrParseType.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetOrParseType.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;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M,IAAI,wBAAwB,CAAC,EAAE,EAAE,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,CAAC,CAAC;IACZ,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ type Path = (string | number)[];
2
+ type Coordinates = {
3
+ row: number;
4
+ col: number;
5
+ };
6
+ export declare function getPathDocumentCoordinatesPseudoJson(path: Path, document: string): Coordinates;
7
+ export {};
@@ -0,0 +1,218 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ class StringReader {
17
+ s;
18
+ index;
19
+ row;
20
+ col;
21
+ constructor(s) {
22
+ this.s = s;
23
+ this.index = 0;
24
+ this.row = 1;
25
+ this.col = 0;
26
+ }
27
+ next() {
28
+ if (this.index >= this.s.length) {
29
+ return null;
30
+ }
31
+ const c = this.s[this.index++];
32
+ if (c === '\n') {
33
+ this.row += 1;
34
+ this.col = 0;
35
+ }
36
+ else {
37
+ this.col += 1;
38
+ }
39
+ //console.log(`reader: char=${c}, row=${this.row}, col=${this.col}`);
40
+ return [c, this.row, this.col];
41
+ }
42
+ }
43
+ export function getPathDocumentCoordinatesPseudoJson(path, document) {
44
+ //console.log(`getPathDocumentCoordinatesPseudoJson: path=${path}, document=${document}`);
45
+ try {
46
+ const reader = new StringReader(document);
47
+ return findCoordinates(path, reader);
48
+ }
49
+ catch (e) {
50
+ console.log('Could not determine document coordinates');
51
+ console.log(`path: ${path}`);
52
+ console.log(`document: ${document}`);
53
+ console.log(`e: ${e}`);
54
+ console.log(`e.trace: ${e.trace}`);
55
+ throw e;
56
+ }
57
+ }
58
+ function findCoordinates(path, reader, ovRow, ovCol) {
59
+ //console.log(`findCoordinates: path=${path}`);
60
+ let result;
61
+ while ((result = reader.next()) !== null) {
62
+ const [c, row, col] = result;
63
+ if (path.length === 0) {
64
+ return {
65
+ row: ovRow ?? row,
66
+ col: ovCol ?? col,
67
+ };
68
+ }
69
+ //console.log(`findCoordinates: char=${c}, row=${row}, col=${col}`);
70
+ if (c === '{') {
71
+ const result = findCoordinatesObject(path, reader);
72
+ if (result) {
73
+ return result;
74
+ }
75
+ }
76
+ if (c === '[') {
77
+ const result = findCoordinatesArray(path, reader);
78
+ if (result) {
79
+ return result;
80
+ }
81
+ }
82
+ }
83
+ throw new Error('findCoordinates: Path not found in document');
84
+ }
85
+ function findCoordinatesObject(path, reader) {
86
+ //console.log(`findCoordinatesObject: path=${path}`);
87
+ let workingKeyRowStart = null;
88
+ let workingKeyColStart = null;
89
+ let workingKey;
90
+ let result;
91
+ while ((result = reader.next()) !== null) {
92
+ const [c, row, col] = result;
93
+ //console.log(`findCoordinatesObject: char=${c}, row=${row}, col=${col}`);
94
+ if (c === '}') {
95
+ return null;
96
+ }
97
+ else if (c === '"') {
98
+ workingKeyRowStart = row;
99
+ workingKeyColStart = col;
100
+ workingKey = findString(reader);
101
+ }
102
+ else if (c === ':') {
103
+ if (workingKey === path[0]) {
104
+ return findCoordinates(path.slice(1), reader, workingKeyRowStart, workingKeyColStart);
105
+ }
106
+ else {
107
+ findValue(reader);
108
+ }
109
+ }
110
+ }
111
+ throw new Error('findCoordinatesObject: Path not found in document');
112
+ }
113
+ function findCoordinatesArray(path, reader) {
114
+ //console.log(`findCoordinatesArray: path=${path}`);
115
+ let workingIndex = 0;
116
+ if (workingIndex === path[0]) {
117
+ return findCoordinates(path.slice(1), reader);
118
+ }
119
+ else {
120
+ findValue(reader);
121
+ }
122
+ let result;
123
+ while ((result = reader.next()) !== null) {
124
+ const [c, row, col] = result;
125
+ //console.log(`findCoordinatesArray: char=${c}, row=${row}, col=${col}`);
126
+ workingIndex += 1;
127
+ //console.log(`findCoordinatesArray: workingIndex=${workingIndex}`);
128
+ if (workingIndex === path[0]) {
129
+ return findCoordinates(path.slice(1), reader);
130
+ }
131
+ else {
132
+ findValue(reader);
133
+ }
134
+ }
135
+ throw new Error('findCoordinatesArray: Path not found in document');
136
+ }
137
+ function findValue(reader) {
138
+ let result;
139
+ while ((result = reader.next()) !== null) {
140
+ const [c, row, col] = result;
141
+ //console.log(`findValue: char=${c}, row=${row}, col=${col}`);
142
+ if (c === '{') {
143
+ findObject(reader);
144
+ return false;
145
+ }
146
+ else if (c === '[') {
147
+ findArray(reader);
148
+ return false;
149
+ }
150
+ else if (c === '"') {
151
+ findString(reader);
152
+ return false;
153
+ }
154
+ else if (c === '}') {
155
+ return true;
156
+ }
157
+ else if (c === ']') {
158
+ return true;
159
+ }
160
+ else if (c === ',') {
161
+ return false;
162
+ }
163
+ }
164
+ throw new Error('Value not found in document');
165
+ }
166
+ function findObject(reader) {
167
+ let result;
168
+ while ((result = reader.next()) !== null) {
169
+ const [c, row, col] = result;
170
+ //console.log(`findObject: char=${c}, row=${row}, col=${col}`);
171
+ if (c === '}') {
172
+ return;
173
+ }
174
+ else if (c === '"') {
175
+ findString(reader);
176
+ }
177
+ else if (c === ':') {
178
+ if (findValue(reader)) {
179
+ return;
180
+ }
181
+ }
182
+ }
183
+ }
184
+ function findArray(reader) {
185
+ //console.log('findArray');
186
+ if (findValue(reader)) {
187
+ return;
188
+ }
189
+ let workingIndex = 0;
190
+ let result;
191
+ while ((result = reader.next()) !== null) {
192
+ const [c, row, col] = result;
193
+ //console.log(`findArray: char=${c}, row=${row}, col=${col}`);
194
+ if (c === ']') {
195
+ return;
196
+ }
197
+ workingIndex += 1;
198
+ if (findValue(reader)) {
199
+ return;
200
+ }
201
+ }
202
+ }
203
+ function findString(reader) {
204
+ let workingString = '';
205
+ let result;
206
+ while ((result = reader.next()) !== null) {
207
+ const [c, row, col] = result;
208
+ //console.log(`findString: char=${c}`);
209
+ if (c === '"') {
210
+ return workingString;
211
+ }
212
+ else {
213
+ workingString += c;
214
+ }
215
+ }
216
+ throw new Error('String not closed');
217
+ }
218
+ //# sourceMappingURL=GetPathDocumentCoordinatesPseudoJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetPathDocumentCoordinatesPseudoJson.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetPathDocumentCoordinatesPseudoJson.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAKH,MAAM,YAAY;IACN,CAAC,CAAS;IACV,KAAK,CAAS;IACd,GAAG,CAAS;IACZ,GAAG,CAAS;IAEpB,YAAY,CAAS;QACjB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,IAAI;QACA,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACd,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;Q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AC;QACpB,OAAO;IACX,CAAC;IAED,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;QAC7B,8DAA8D;QAC9D,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,OAAO;QACX,CAAC;QACD,YAAY,IAAI,CAAC,CAAC;QAClB,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACpB,OAAO;QACX,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,MAAoB;IACpC,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;QAC7B,uCAAuC;QACvC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,OAAO,aAAa,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,aAAa,IAAI,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { FsModule, PathModule } from '../../fileSystem';
2
+ export declare function getSchemaFileMap(directory: string, fs: FsModule, path: PathModule): Record<string, string>;
@@ -0,0 +1,40 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
17
+ import { TelepactSchemaParseError } from '../../TelepactSchemaParseError';
18
+ export function getSchemaFileMap(directory, fs, path) {
19
+ const finalJsonDocuments = {};
20
+ const schemaParseFailures = [];
21
+ const paths = fs.readdirSync(directory).map((file) => path.join(directory, file));
22
+ for (const filePath of paths) {
23
+ const relativePath = path.relative(directory, filePath);
24
+ if (fs.statSync(filePath).isDirectory()) {
25
+ schemaParseFailures.push(new SchemaParseFailure(relativePath, [], 'DirectoryDisallowed', {}));
26
+ finalJsonDocuments[relativePath] = '[]';
27
+ continue;
28
+ }
29
+ const content = fs.readFileSync(filePath, 'utf-8');
30
+ finalJsonDocuments[relativePath] = content;
31
+ if (!filePath.endsWith('.telepact.json')) {
32
+ schemaParseFailures.push(new SchemaParseFailure(relativePath, [], 'FileNamePatternInvalid', { expected: '*.telepact.json' }));
33
+ }
34
+ }
35
+ if (schemaParseFailures.length > 0) {
36
+ throw new TelepactSchemaParseError(schemaParseFailures, finalJsonDocuments);
37
+ }
38
+ return finalJsonDocuments;
39
+ }
40
+ //# sourceMappingURL=GetSchemaFileMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetSchemaFileMap.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetSchemaFileMap.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAA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AAmB,EAAE,kBAAkB,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
2
+ export declare function getTypeUnexpectedParseFailure(documentName: string, path: any[], value: any, expectedType: string): SchemaParseFailure[];
@@ -0,0 +1,26 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
17
+ import { getType } from '../../internal/types/GetType';
18
+ export function getTypeUnexpectedParseFailure(documentName, path, value, expectedType) {
19
+ const actualType = getType(value);
20
+ const data = {
21
+ actual: { [actualType]: {} },
22
+ expected: { [expectedType]: {} },
23
+ };
24
+ return [new SchemaParseFailure(documentName, path, 'TypeUnexpected', data)];
25
+ }
26
+ //# sourceMappingURL=GetTypeUnexpectedParseFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetTypeUnexpectedParseFailure.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetTypeUnexpectedParseFailure.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,MAAM,UAAU,6BAA6B,CACzC,YAAoB,EACpB,IAAW,EACX,KAAU,EACV,YAAoB;IAEpB,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAyE;QAC/E,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE;QAC5B,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE;KACnC,CAAC;IACF,OAAO,CAAC,IAAI,kBAAkB,CAAC,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
2
+ export declare function mapSchemaParseFailuresToPseudoJson(schemaParseFailures: SchemaParseFailure[], documentNamesToJson: Record<string, string>): any[];
@@ -0,0 +1,31 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ import { getPathDocumentCoordinatesPseudoJson } from './GetPathDocumentCoordinatesPseudoJson';
17
+ export function mapSchemaParseFailuresToPseudoJson(schemaParseFailures, documentNamesToJson) {
18
+ const pseudoJsonList = [];
19
+ for (const f of schemaParseFailures) {
20
+ const documentJson = documentNamesToJson[f.documentName];
21
+ const location = getPathDocumentCoordinatesPseudoJson(f.path, documentJson);
22
+ const pseudoJson = {};
23
+ pseudoJson.document = f.documentName;
24
+ pseudoJson.location = location;
25
+ pseudoJson.path = f.path;
26
+ pseudoJson.reason = { [f.reason]: f.data };
27
+ pseudoJsonList.push(Object.assign({}, pseudoJson));
28
+ }
29
+ return pseudoJsonList;
30
+ }
31
+ //# sourceMappingURL=MapSchemaParseFailuresToPseudoJson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapSchemaParseFailuresToPseudoJson.js","sourceRoot":"","sources":["../../../../src/internal/schema/MapSchemaParseFailuresToPseudoJson.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAGH,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAE9F,MAAM,UAAU,kCAAkC,CAC9C,mBAAyC,EACzC,mBAA2C;IAE3C,MAAM,cAAc,GAAU,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,mBAAmB,EAAE,CAAC;QAClC,MAAM,YAAY,GAAG,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,oCAAoC,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAQ,EAAE,CAAC;QAC3B,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC,YAAY,CAAC;QACrC,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACzB,UAAU,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC3C,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
2
+ import { TType } from '../types/TType';
3
+ export declare class ParseContext {
4
+ readonly documentName: string;
5
+ readonly telepactSchemaDocumentNamesToPseudoJson: {
6
+ [key: string]: any[];
7
+ };
8
+ readonly telepactSchemaDocumentNamesToJson: {
9
+ [key: string]: string;
10
+ };
11
+ readonly schemaKeysToDocumentName: {
12
+ [key: string]: string;
13
+ };
14
+ readonly schemaKeysToIndex: {
15
+ [key: string]: number;
16
+ };
17
+ readonly parsedTypes: {
18
+ [key: string]: TType;
19
+ };
20
+ readonly fnErrorRegexes: {
21
+ [key: string]: string;
22
+ };
23
+ readonly allParseFailures: SchemaParseFailure[];
24
+ readonly failedTypes: Set<string>;
25
+ constructor(documentName: string, telepactSchemaDocumentNamesToPseudoJson: {
26
+ [key: string]: any[];
27
+ }, telepactSchemaDocumentNamesToJson: {
28
+ [key: string]: string;
29
+ }, schemaKeysToDocumentName: {
30
+ [key: string]: string;
31
+ }, schemaKeysToIndex: {
32
+ [key: string]: number;
33
+ }, parsedTypes: {
34
+ [key: string]: TType;
35
+ }, fnErrorRegexes: {
36
+ [key: string]: string;
37
+ }, allParseFailures: SchemaParseFailure[], failedTypes: Set<string>);
38
+ copy({ documentName }: {
39
+ documentName?: string;
40
+ }): ParseContext;
41
+ }
@@ -0,0 +1,41 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ export class ParseContext {
17
+ documentName;
18
+ telepactSchemaDocumentNamesToPseudoJson;
19
+ telepactSchemaDocumentNamesToJson;
20
+ schemaKeysToDocumentName;
21
+ schemaKeysToIndex;
22
+ parsedTypes;
23
+ fnErrorRegexes;
24
+ allParseFailures;
25
+ failedTypes;
26
+ constructor(documentName, telepactSchemaDocumentNamesToPseudoJson, telepactSchemaDocumentNamesToJson, schemaKeysToDocumentName, schemaKeysToIndex, parsedTypes, fnErrorRegexes, allParseFailures, failedTypes) {
27
+ this.documentName = documentName;
28
+ this.telepactSchemaDocumentNamesToPseudoJson = telepactSchemaDocumentNamesToPseudoJson;
29
+ this.telepactSchemaDocumentNamesToJson = telepactSchemaDocumentNamesToJson;
30
+ this.schemaKeysToDocumentName = schemaKeysToDocumentName;
31
+ this.schemaKeysToIndex = schemaKeysToIndex;
32
+ this.parsedTypes = parsedTypes;
33
+ this.fnErrorRegexes = fnErrorRegexes;
34
+ this.allParseFailures = allParseFailures;
35
+ this.failedTypes = failedTypes;
36
+ }
37
+ copy({ documentName }) {
38
+ return new ParseContext(documentName ?? this.documentName, this.telepactSchemaDocumentNamesToPseudoJson, this.telepactSchemaDocumentNamesToJson, this.schemaKeysToDocumentName, this.schemaKeysToIndex, this.parsedTypes, this.fnErrorRegexes, this.allParseFailures, this.failedTypes);
39
+ }
40
+ }
41
+ //# sourceMappingURL=ParseContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParseContext.js","sourceRoot":"","sources":["../../../../src/internal/schema/ParseContext.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAKH,MAAM,OAAO,YAAY;IACL,YAAY,CAAS;IACrB,uCAAuC,CAA2B;IAClE,iCAAiC,CAA4B;IAC7D,wBAAwB,CAA4B;IACpD,iBAAiB,CAA4B;IAC7C,WAAW,CAA2B;IACtC,cAAc,CAA4B;IAC1C,gBAAgB,CAAuB;IACvC,WAAW,CAAc;IAEzC,YACI,YAAoB,EACpB,uCAAiE,EACjE,iCAA4D,EAC5D,wBAAmD,EACnD,iBAA4C,EAC5C,WAAqC,EACrC,cAAyC,EACzC,gBAAsC,EACtC,WAAwB;QAExB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,uCAAuC,GAAG,uCAAuC,CAAC;QACvF,IAAI,CAAC,iCAAiC,GAAG,iCAAiC,CAAC;QAC3E,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;QACzD,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAEM,IAAI,CAAC,EAAE,YAAY,EAA6B;QACnD,OAAO,IAAI,YAAY,CACnB,YAAY,IAAI,IAAI,CAAC,YAAY,EACjC,IAAI,CAAC,uCAAuC,EAC5C,IAAI,CAAC,iCAAiC,EACtC,IAAI,CAAC,wBAAwB,EAC7B,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,WAAW,CACnB,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,5 @@
1
+ import { TError } from '../types/TError';
2
+ import { ParseContext } from '../../internal/schema/ParseContext';
3
+ export declare function parseErrorType(path: any[], errorDefinitionAsParsedJson: {
4
+ [key: string]: any;
5
+ }, schemaKey: string, ctx: ParseContext): TError;
@@ -0,0 +1,35 @@
1
+ //|
2
+ //| Copyright The Telepact Authors
3
+ //|
4
+ //| Licensed under the Apache License, Version 2.0 (the "License");
5
+ //| you may not use this file except in compliance with the License.
6
+ //| You may obtain a copy of the License at
7
+ //|
8
+ //| https://www.apache.org/licenses/LICENSE-2.0
9
+ //|
10
+ //| Unless required by applicable law or agreed to in writing, software
11
+ //| distributed under the License is distributed on an "AS IS" BASIS,
12
+ //| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //| See the License for the specific language governing permissions and
14
+ //| limitations under the License.
15
+ //|
16
+ import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
17
+ import { TError } from '../types/TError';
18
+ import { TelepactSchemaParseError } from '../../TelepactSchemaParseError';
19
+ import { parseUnionType } from '../../internal/schema/ParseUnionType';
20
+ export function parseErrorType(path, errorDefinitionAsParsedJson, schemaKey, ctx) {
21
+ const parseFailures = [];
22
+ const otherKeys = Object.keys(errorDefinitionAsParsedJson).filter((key) => key !== schemaKey && key !== '///');
23
+ if (otherKeys.length > 0) {
24
+ for (const k of otherKeys) {
25
+ const loopPath = path.concat(k);
26
+ parseFailures.push(new SchemaParseFailure(ctx.documentName, loopPath, 'ObjectKeyDisallowed', {}));
27
+ }
28
+ }
29
+ if (parseFailures.length > 0) {
30
+ throw new TelepactSchemaParseError(parseFailures, ctx.telepactSchemaDocumentNamesToJson);
31
+ }
32
+ const error = parseUnionType(path, errorDefinitionAsParsedJson, schemaKey, [], [], ctx);
33
+ return new TError(schemaKey, error);
34
+ }
35
+ //# sourceMappingURL=ParseErrorType.js.map