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,56 @@
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 { bytesName } from '../../internal/types/TBytes';
17
+ import { getTypeUnexpectedValidationFailure } from './GetTypeUnexpectedValidationFailure';
18
+ import { decodeBase64, encodeBase64 } from '../binary/Base64Util';
19
+ export function validateBytes(value, ctx) {
20
+ if (value instanceof Uint8Array) {
21
+ if (ctx.coerceBase64) {
22
+ setCoercedPath(ctx.path, ctx.base64Coercions);
23
+ }
24
+ return [];
25
+ }
26
+ if (typeof value === 'string') {
27
+ try {
28
+ const decoded = decodeBase64(value);
29
+ const reEncoded = encodeBase64(decoded);
30
+ if (reEncoded !== value) {
31
+ throw Error('Invalid base64');
32
+ }
33
+ if (!ctx.coerceBase64) {
34
+ setCoercedPath(ctx.path, ctx.bytesCoercions);
35
+ }
36
+ return [];
37
+ }
38
+ catch (e) {
39
+ return getTypeUnexpectedValidationFailure([], value, 'Base64String');
40
+ }
41
+ }
42
+ else {
43
+ return getTypeUnexpectedValidationFailure([], value, bytesName);
44
+ }
45
+ }
46
+ function setCoercedPath(path, coercedPath) {
47
+ const part = path[0];
48
+ if (path.length > 1) {
49
+ coercedPath[part] = coercedPath[part] || {};
50
+ setCoercedPath(path.slice(1), coercedPath[part]);
51
+ }
52
+ else {
53
+ coercedPath[part] = true;
54
+ }
55
+ }
56
+ //# sourceMappingURL=ValidateBytes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateBytes.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateBytes.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,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGxD,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAElE,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,GAAoB;IAC9D,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAC9B,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;YACnB,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC;YACD,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;YACxC,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;gBACtB,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAA;YACjC,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;gBACpB,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,EAAE,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,kCAAkC,CAAC,EAAE,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;QACzE,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,OAAO,kCAAkC,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACpE,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,IAAc,EAAE,WAAoC;IACxE,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAErB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClB,WAAW,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5C,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,CAA4B,CAAC,CAAC;IAChF,CAAC;SAAM,CAAC;QACJ,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7B,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare class ValidateContext {
2
+ path: string[];
3
+ select: {
4
+ [key: string]: any;
5
+ } | null;
6
+ fn: string | null;
7
+ coerceBase64: boolean;
8
+ base64Coercions: Record<string, object>;
9
+ bytesCoercions: Record<string, object>;
10
+ constructor(select: {
11
+ [key: string]: any;
12
+ } | null, fn: string | null, coerceBase64: boolean);
13
+ }
@@ -0,0 +1,32 @@
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 ValidateContext {
17
+ path;
18
+ select;
19
+ fn;
20
+ coerceBase64;
21
+ base64Coercions;
22
+ bytesCoercions;
23
+ constructor(select, fn, coerceBase64) {
24
+ this.path = [];
25
+ this.select = select;
26
+ this.fn = fn;
27
+ this.coerceBase64 = coerceBase64;
28
+ this.base64Coercions = {};
29
+ this.bytesCoercions = {};
30
+ }
31
+ }
32
+ //# sourceMappingURL=ValidateContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateContext.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateContext.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,MAAM,OAAO,eAAe;IACxB,IAAI,CAAW;IACf,MAAM,CAAgC;IACtC,EAAE,CAAgB;IAClB,YAAY,CAAU;IACtB,eAAe,CAAyB;IACxC,cAAc,CAAyB;IAEvC,YACI,MAAqC,EACrC,EAAiB,EACjB,YAAqB;QAErB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC7B,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ import { TFieldDeclaration } from '../types/TFieldDeclaration';
2
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
3
+ export declare function validateHeaders(headers: Record<string, any>, parsedRequestHeaders: Record<string, TFieldDeclaration>, functionName: string): ValidationFailure[];
@@ -0,0 +1,34 @@
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 { ValidationFailure } from '../../internal/validation/ValidationFailure';
17
+ import { ValidateContext } from './ValidateContext';
18
+ export function validateHeaders(headers, parsedRequestHeaders, functionName) {
19
+ const validationFailures = [];
20
+ for (const header in headers) {
21
+ const headerValue = headers[header];
22
+ const field = parsedRequestHeaders[header];
23
+ if (!header.startsWith("@")) {
24
+ validationFailures.push(new ValidationFailure([header], "RequiredObjectKeyPrefixMissing", { "prefix": "@" }));
25
+ }
26
+ if (field) {
27
+ const thisValidationFailures = field.typeDeclaration.validate(headerValue, new ValidateContext(null, functionName, false));
28
+ const thisValidationFailuresPath = thisValidationFailures.map((e) => new ValidationFailure([header, ...e.path], e.reason, e.data));
29
+ validationFailures.push(...thisValidationFailuresPath);
30
+ }
31
+ }
32
+ return validationFailures;
33
+ }
34
+ //# sourceMappingURL=ValidateHeaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateHeaders.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateHeaders.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,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,eAAe,CAC3B,OAA4B,EAC5B,oBAAuD,EACvD,YAAoB;IAEpB,MAAM,kBAAkB,GAAwB,EAAE,CAAC;IAEnD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAE3C,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,kBAAkB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,CAAC,MAAM,CAAC,EAAE,gCAAgC,EAAE,EAAC,QAAQ,EAAE,GAAG,EAAC,CAAC,CAAC,CAAC;QAChH,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACR,MAAM,sBAAsB,GAAG,KAAK,CAAC,eAAe,CAAC,QAAQ,CACzD,WAAW,EACX,IAAI,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CACjD,CAAC;YACF,MAAM,0BAA0B,GAAG,sBAAsB,CAAC,GAAG,CACzD,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CACtE,CAAC;YACF,kBAAkB,CAAC,IAAI,CAAC,GAAG,0BAA0B,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ export declare function validateInteger(value: any): ValidationFailure[];
@@ -0,0 +1,33 @@
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 { ValidationFailure } from '../../internal/validation/ValidationFailure';
17
+ import { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
18
+ import { integerName } from '../types/TInteger';
19
+ export function validateInteger(value) {
20
+ if (typeof value === 'number' && Number.isInteger(value)) {
21
+ if (value === 9223372036854776000 || value === -9223372036854776000) {
22
+ return [
23
+ new ValidationFailure([], 'NumberOutOfRange', {}),
24
+ new ValidationFailure([], 'NumberTruncated', {}),
25
+ ];
26
+ }
27
+ return [];
28
+ }
29
+ else {
30
+ return getTypeUnexpectedValidationFailure([], value, integerName);
31
+ }
32
+ }
33
+ //# sourceMappingURL=ValidateInteger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateInteger.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateInteger.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,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU,eAAe,CAAC,KAAU;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,IAAI,KAAK,KAAK,mBAAmB,IAAI,KAAK,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAClE,OAAO;gBACH,IAAI,iBAAiB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,CAAC;gBACjD,IAAI,iBAAiB,CAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC;aACnD,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;SAAM,CAAC;QACJ,OAAO,kCAAkC,CAAC,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACtE,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ import { TType } from '../types/TType';
3
+ import { ValidateContext } from './ValidateContext';
4
+ export declare function validateMockCall(givenObj: any, types: Record<string, TType>, ctx: ValidateContext): ValidationFailure[];
@@ -0,0 +1,50 @@
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 { ValidationFailure } from '../../internal/validation/ValidationFailure';
17
+ import { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
18
+ export function validateMockCall(givenObj, types, ctx) {
19
+ if (!(typeof givenObj === 'object' && !Array.isArray(givenObj))) {
20
+ return getTypeUnexpectedValidationFailure([], givenObj, 'Object');
21
+ }
22
+ const givenMap = givenObj;
23
+ const regexString = /^fn\..*$/;
24
+ const keys = Object.keys(givenMap).sort();
25
+ const matches = keys.filter((k) => regexString.test(k));
26
+ if (matches.length !== 1) {
27
+ return [
28
+ new ValidationFailure([], 'ObjectKeyRegexMatchCountUnexpected', {
29
+ regex: regexString.toString().slice(1, -1),
30
+ actual: matches.length,
31
+ expected: 1,
32
+ keys,
33
+ }),
34
+ ];
35
+ }
36
+ const functionName = matches[0];
37
+ const functionDef = types[functionName];
38
+ const input = givenMap[functionName];
39
+ const functionDefCall = functionDef;
40
+ const functionDefName = functionName;
41
+ const functionDefCallTags = functionDefCall.tags;
42
+ const inputFailures = functionDefCallTags[functionDefName].validate(input, [], ctx);
43
+ const inputFailuresWithPath = [];
44
+ for (const failure of inputFailures) {
45
+ const newPath = [functionName, ...failure.path];
46
+ inputFailuresWithPath.push(new ValidationFailure(newPath, failure.reason, failure.data));
47
+ }
48
+ return inputFailuresWithPath.filter((failure) => failure.reason !== 'RequiredObjectKeyMissing');
49
+ }
50
+ //# sourceMappingURL=ValidateMockCall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateMockCall.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateMockCall.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,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MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IAErC,MAAM,eAAe,GAAG,WAAW,CAAC;IACpC,MAAM,eAAe,GAAG,YAAY,CAAC;IACrC,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,CAAC;IAEjD,MAAM,aAAa,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IAEpF,MAAM,qBAAqB,GAAwB,EAAE,CAAC;IACtD,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAEhD,qBAAqB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,0BAA0B,CAAC,CAAC;AACpG,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ import { TType } from '../types/TType';
3
+ import { ValidateContext } from './ValidateContext';
4
+ export declare function validateMockStub(givenObj: any, types: {
5
+ [key: string]: TType;
6
+ }, ctx: ValidateContext): ValidationFailure[];
@@ -0,0 +1,73 @@
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 { ValidationFailure } from '../../internal/validation/ValidationFailure';
17
+ import { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
18
+ export function validateMockStub(givenObj, types, ctx) {
19
+ const validationFailures = [];
20
+ if (!(typeof givenObj === 'object' && !Array.isArray(givenObj))) {
21
+ return getTypeUnexpectedValidationFailure([], givenObj, 'Object');
22
+ }
23
+ const givenMap = givenObj;
24
+ const regexString = /^fn\..*$/;
25
+ const keys = Object.keys(givenMap).sort();
26
+ const matches = keys.filter((k) => regexString.test(k));
27
+ if (matches.length !== 1) {
28
+ return [
29
+ new ValidationFailure([], 'ObjectKeyRegexMatchCountUnexpected', {
30
+ regex: regexString.toString().slice(1, -1),
31
+ actual: matches.length,
32
+ expected: 1,
33
+ keys: keys,
34
+ }),
35
+ ];
36
+ }
37
+ const functionName = matches[0];
38
+ const input = givenMap[functionName];
39
+ const functionDefCall = types[functionName];
40
+ ;
41
+ const functionDefResult = types[`${functionName}.->`];
42
+ const functionDefName = functionName;
43
+ const functionDefCallTags = functionDefCall.tags;
44
+ const inputFailures = functionDefCallTags[functionDefName].validate(input, [], ctx);
45
+ const inputFailuresWithPath = [];
46
+ for (const f of inputFailures) {
47
+ const thisPath = [functionName, ...f.path];
48
+ inputFailuresWithPath.push(new ValidationFailure(thisPath, f.reason, f.data));
49
+ }
50
+ const inputFailuresWithoutMissingRequired = inputFailuresWithPath.filter((f) => f.reason !== 'RequiredObjectKeyMissing');
51
+ validationFailures.push(...inputFailuresWithoutMissingRequired);
52
+ const resultDefKey = '->';
53
+ if (!(resultDefKey in givenMap)) {
54
+ validationFailures.push(new ValidationFailure([], 'RequiredObjectKeyMissing', { key: resultDefKey }));
55
+ }
56
+ else {
57
+ const output = givenMap[resultDefKey];
58
+ const outputFailures = functionDefResult.validate(output, [], ctx);
59
+ const outputFailuresWithPath = [];
60
+ for (const f of outputFailures) {
61
+ const thisPath = [resultDefKey, ...f.path];
62
+ outputFailuresWithPath.push(new ValidationFailure(thisPath, f.reason, f.data));
63
+ }
64
+ const failuresWithoutMissingRequired = outputFailuresWithPath.filter((f) => f.reason !== 'RequiredObjectKeyMissing');
65
+ validationFailures.push(...failuresWithoutMissingRequired);
66
+ }
67
+ const disallowedFields = Object.keys(givenMap).filter((k) => !matches.includes(k) && k !== resultDefKey);
68
+ for (const disallowedField of disallowedFields) {
69
+ validationFailures.push(new ValidationFailure([disallowedField], 'ObjectKeyDisallowed', {}));
70
+ }
71
+ return validationFailures;
72
+ }
73
+ //# sourceMappingURL=ValidateMockStub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateMockStub.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateMockStub.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,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAMlH,MAAM,UAAU,gBAAgB,CAC5B,QAAa,EACb,KAA+B,EAC/B,GAAoB;IAEpB,MAAM,kBAAkB,GAAwB,EAAE,CAAC;IAEnD,IAAI,CAAC,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC9D,OAAO,kCAAkC,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,QAAQ,GAA2B,QAAQ,CAAC;IAElD,MAAM,WAAW,GAAG,UAAU,CAAC;IAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,C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,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,CAAC;IACzG,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE,CAAC;QAC7C,kBAAkB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,CAAC,eAAe,CAAC,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ export declare function validateNumber(value: any): Array<ValidationFailure>;
@@ -0,0 +1,33 @@
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 { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
17
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
18
+ import { numberName } from '../types/TNumber';
19
+ export function validateNumber(value) {
20
+ if (typeof value === 'number') {
21
+ if ((Number.isInteger(value) && value === 9223372036854776000) || value === -9223372036854776000) {
22
+ return [
23
+ new ValidationFailure([], 'NumberOutOfRange', {}),
24
+ new ValidationFailure([], 'NumberTruncated', {}),
25
+ ];
26
+ }
27
+ return [];
28
+ }
29
+ else {
30
+ return getTypeUnexpectedValidationFailure([], value, numberName);
31
+ }
32
+ }
33
+ //# sourceMappingURL=ValidateNumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateNumber.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateNumber.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,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAClH,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,UAAU,cAAc,CAAC,KAAU;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,mBAAmB,CAAC,IAAI,KAAK,KAAK,CAAC,mBAAmB,EAAE,CAAC;YAC/F,OAAO;gBACH,IAAI,iBAAiB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,CAAC;gBACjD,IAAI,iBAAiB,CAAC,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC;aACnD,CAAC;QACN,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;SAAM,CAAC;QACJ,OAAO,kCAAkC,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ import { TTypeDeclaration } from '../types/TTypeDeclaration';
3
+ import { ValidateContext } from './ValidateContext';
4
+ export declare function validateObject(value: any, typeParameters: TTypeDeclaration[], ctx: ValidateContext): ValidationFailure[];
@@ -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 { ValidationFailure } from '../../internal/validation/ValidationFailure';
17
+ import { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
18
+ import { objectName } from '../types/TObject';
19
+ export function validateObject(value, typeParameters, ctx) {
20
+ if (typeof value === 'object' && !Array.isArray(value)) {
21
+ const nestedTypeDeclaration = typeParameters[0];
22
+ const validationFailures = [];
23
+ for (const [k, v] of Object.entries(value)) {
24
+ ctx.path.push("*");
25
+ const nestedValidationFailures = nestedTypeDeclaration.validate(v, ctx);
26
+ ctx.path.pop();
27
+ const nestedValidationFailuresWithPath = [];
28
+ for (const f of nestedValidationFailures) {
29
+ const thisPath = [k, ...f.path];
30
+ nestedValidationFailuresWithPath.push(new ValidationFailure(thisPath, f.reason, f.data));
31
+ }
32
+ validationFailures.push(...nestedValidationFailuresWithPath);
33
+ }
34
+ return validationFailures;
35
+ }
36
+ else {
37
+ return getTypeUnexpectedValidationFailure([], value, objectName);
38
+ }
39
+ }
40
+ //# sourceMappingURL=ValidateObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateObject.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateObject.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,iBA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2 @@
1
+ import { TUnion } from '../types/TUnion';
2
+ export declare function validateResult(resultUnionType: TUnion, errorResult: any): void;
@@ -0,0 +1,25 @@
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 { TelepactError } from '../../TelepactError';
17
+ import { mapValidationFailuresToInvalidFieldCases } from '../../internal/validation/MapValidationFailuresToInvalidFieldCases';
18
+ import { ValidateContext } from './ValidateContext';
19
+ export function validateResult(resultUnionType, errorResult) {
20
+ const newErrorResultValidationFailures = resultUnionType.validate(errorResult, [], new ValidateContext(null, null, false));
21
+ if (newErrorResultValidationFailures.length !== 0) {
22
+ throw new TelepactError(`Failed internal telepact validation: ${JSON.stringify(mapValidationFailuresToInvalidFieldCases(newErrorResultValidationFailures))}`);
23
+ }
24
+ }
25
+ //# sourceMappingURL=ValidateResult.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateResult.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateResult.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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,wCAAwC,EAAE,MAAM,oEAAoE,CAAC;AAC9H,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,UAAU,cAAc,CAAC,eAAuB,EAAE,WAAgB;IACpE,MAAM,gCAAgC,GAAG,eAAe,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC3H,IAAI,gCAAgC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,aAAa,CACnB,wCAAwC,IAAI,CAAC,SAAS,CAAC,wCAAwC,CAAC,gCAAgC,CAAC,CAAC,EAAE,CACvI,CAAC;IACN,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ import { ValidateContext } from './ValidateContext';
3
+ export declare function validateSelect(givenObj: any, possibleFnSelects: Record<string, any>, ctx: ValidateContext): ValidationFailure[];
@@ -0,0 +1,56 @@
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 { ValidationFailure } from '../../internal/validation/ValidationFailure';
17
+ import { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
18
+ export function validateSelect(givenObj, possibleFnSelects, ctx) {
19
+ if (typeof givenObj !== 'object' || Array.isArray(givenObj) || givenObj === null || givenObj === undefined) {
20
+ return getTypeUnexpectedValidationFailure([], givenObj, 'Object');
21
+ }
22
+ const possibleSelect = possibleFnSelects[ctx.fn];
23
+ return isSubSelect([], givenObj, possibleSelect);
24
+ }
25
+ function isSubSelect(path, givenObj, possibleSelectSection) {
26
+ if (Array.isArray(possibleSelectSection)) {
27
+ if (!Array.isArray(givenObj)) {
28
+ return getTypeUnexpectedValidationFailure(path, givenObj, 'Array');
29
+ }
30
+ const validationFailures = [];
31
+ for (const [index, element] of givenObj.entries()) {
32
+ if (!possibleSelectSection.includes(element)) {
33
+ validationFailures.push(new ValidationFailure([...path, index], 'ArrayElementDisallowed', {}));
34
+ }
35
+ }
36
+ return validationFailures;
37
+ }
38
+ else if (typeof possibleSelectSection === 'object' && !Array.isArray(possibleSelectSection)) {
39
+ if (typeof givenObj !== 'object' || Array.isArray(givenObj) || givenObj === null) {
40
+ return getTypeUnexpectedValidationFailure(path, givenObj, 'Object');
41
+ }
42
+ const validationFailures = [];
43
+ for (const [key, value] of Object.entries(givenObj)) {
44
+ if (key in possibleSelectSection) {
45
+ const innerFailures = isSubSelect([...path, key], value, possibleSelectSection[key]);
46
+ validationFailures.push(...innerFailures);
47
+ }
48
+ else {
49
+ validationFailures.push(new ValidationFailure([...path, key], 'ObjectKeyDisallowed', {}));
50
+ }
51
+ }
52
+ return validationFailures;
53
+ }
54
+ return [];
55
+ }
56
+ //# sourceMappingURL=ValidateSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateSelect.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateSelect.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,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAGlH,MAA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QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC/E,OAAO,kCAAkC,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,kBAAkB,GAAwB,EAAE,CAAC;QAEnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClD,IAAI,GAAG,IAAI,qBAAqB,EAAE,CAAC;gBAC/B,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;gBACrF,kBAAkB,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACJ,kBAAkB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC;YAC9F,CAAC;QACL,CAAC;QAED,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAED,OAAO,EAAE,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
2
+ export declare function validateString(value: any): ValidationFailure[];
@@ -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 { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
17
+ import { stringName } from '../types/TString';
18
+ export function validateString(value) {
19
+ if (typeof value === 'string') {
20
+ return [];
21
+ }
22
+ else {
23
+ return getTypeUnexpectedValidationFailure([], value, stringName);
24
+ }
25
+ }
26
+ //# sourceMappingURL=ValidateString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidateString.js","sourceRoot":"","sources":["../../../../src/internal/validation/ValidateString.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,kCAAkC,EAAE,MAAM,8DAA8D,CAAC;AAElH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,UAAU,cAAc,CAAC,KAAU;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACd,CAAC;SAAM,CAAC;QACJ,OAAO,kCAAkC,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IACrE,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { TFieldDeclaration } from '../types/TFieldDeclaration';
2
+ import { ValidationFailure } from '../../internal/validation/ValidationFailure';
3
+ import { ValidateContext } from './ValidateContext';
4
+ export declare function validateStruct(value: any, name: string, fields: Record<string, TFieldDeclaration>, ctx: ValidateContext): ValidationFailure[];
@@ -0,0 +1,28 @@
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 { getTypeUnexpectedValidationFailure } from '../../internal/validation/GetTypeUnexpectedValidationFailure';
17
+ import { validateStructFields } from '../../internal/validation/ValidateStructFields';
18
+ import { structName } from '../types/TStruct';
19
+ export function validateStruct(value, name, fields, ctx) {
20
+ if (typeof value === 'object' && !Array.isArray(value)) {
21
+ const selectedFields = ctx.select?.[name] ?? null;
22
+ return validateStructFields(fields, selectedFields, value, ctx);
23
+ }
24
+ else {
25
+ return getTypeUnexpectedValidationFailure([], value, structName);
26
+ }
27
+ }
28
+ //# sourceMappingURL=ValidateStruct.js.map