@atxp/client 0.10.4 → 0.10.5

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 (320) hide show
  1. package/dist/_virtual/index17.js +2 -2
  2. package/dist/_virtual/index18.js +2 -2
  3. package/dist/_virtual/index19.js +2 -2
  4. package/dist/_virtual/index20.js +2 -2
  5. package/dist/_virtual/index8.js +2 -2
  6. package/dist/_virtual/index9.js +2 -2
  7. package/dist/atxpFetcher.d.ts.map +1 -1
  8. package/dist/atxpFetcher.js +16 -1
  9. package/dist/atxpFetcher.js.map +1 -1
  10. package/dist/index.cjs +23 -2
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.js +23 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
  16. package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
  17. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js +1 -1
  18. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js +1 -1
  19. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js +1 -1
  20. package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js +1 -1
  21. package/dist/oAuth.d.ts +3 -1
  22. package/dist/oAuth.d.ts.map +1 -1
  23. package/dist/oAuth.js +7 -1
  24. package/dist/oAuth.js.map +1 -1
  25. package/package.json +2 -2
  26. package/dist/_virtual/cache.js +0 -4
  27. package/dist/_virtual/cache.js.map +0 -1
  28. package/dist/_virtual/uri.all.js +0 -4
  29. package/dist/_virtual/uri.all.js.map +0 -1
  30. package/dist/atxpAccount.d.ts +0 -20
  31. package/dist/atxpAccount.d.ts.map +0 -1
  32. package/dist/atxpAccount.js +0 -161
  33. package/dist/atxpAccount.js.map +0 -1
  34. package/dist/atxpClient.d.ts +0 -12
  35. package/dist/atxpLocalAccount.d.ts +0 -50
  36. package/dist/base.cjs +0 -34
  37. package/dist/base.cjs.map +0 -1
  38. package/dist/base.d.ts +0 -4
  39. package/dist/base.d.ts.map +0 -1
  40. package/dist/base.js +0 -5
  41. package/dist/base.js.map +0 -1
  42. package/dist/baseAccount.d.ts +0 -20
  43. package/dist/baseAccount.d.ts.map +0 -1
  44. package/dist/baseAccount.js +0 -47
  45. package/dist/baseAccount.js.map +0 -1
  46. package/dist/baseConstants.d.ts +0 -10
  47. package/dist/baseConstants.d.ts.map +0 -1
  48. package/dist/baseConstants.js +0 -21
  49. package/dist/baseConstants.js.map +0 -1
  50. package/dist/basePaymentMaker.d.ts +0 -23
  51. package/dist/basePaymentMaker.d.ts.map +0 -1
  52. package/dist/basePaymentMaker.js +0 -169
  53. package/dist/basePaymentMaker.js.map +0 -1
  54. package/dist/clientTestHelpers.d.ts +0 -6
  55. package/dist/destinationMakers/atxpDestinationMaker.d.ts +0 -15
  56. package/dist/destinationMakers/index.d.ts +0 -9
  57. package/dist/destinationMakers/passthroughDestinationMaker.d.ts +0 -8
  58. package/dist/errors.d.ts +0 -117
  59. package/dist/node_modules/ajv/dist/ajv.js +0 -71
  60. package/dist/node_modules/ajv/dist/ajv.js.map +0 -1
  61. package/dist/node_modules/ajv/dist/compile/codegen/code.js +0 -169
  62. package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +0 -1
  63. package/dist/node_modules/ajv/dist/compile/codegen/index.js +0 -712
  64. package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +0 -1
  65. package/dist/node_modules/ajv/dist/compile/codegen/scope.js +0 -157
  66. package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +0 -1
  67. package/dist/node_modules/ajv/dist/compile/errors.js +0 -139
  68. package/dist/node_modules/ajv/dist/compile/errors.js.map +0 -1
  69. package/dist/node_modules/ajv/dist/compile/index.js +0 -259
  70. package/dist/node_modules/ajv/dist/compile/index.js.map +0 -1
  71. package/dist/node_modules/ajv/dist/compile/names.js +0 -40
  72. package/dist/node_modules/ajv/dist/compile/names.js.map +0 -1
  73. package/dist/node_modules/ajv/dist/compile/ref_error.js +0 -24
  74. package/dist/node_modules/ajv/dist/compile/ref_error.js.map +0 -1
  75. package/dist/node_modules/ajv/dist/compile/resolve.js +0 -169
  76. package/dist/node_modules/ajv/dist/compile/resolve.js.map +0 -1
  77. package/dist/node_modules/ajv/dist/compile/rules.js +0 -37
  78. package/dist/node_modules/ajv/dist/compile/rules.js.map +0 -1
  79. package/dist/node_modules/ajv/dist/compile/util.js +0 -191
  80. package/dist/node_modules/ajv/dist/compile/util.js.map +0 -1
  81. package/dist/node_modules/ajv/dist/compile/validate/applicability.js +0 -30
  82. package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +0 -1
  83. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -64
  84. package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +0 -1
  85. package/dist/node_modules/ajv/dist/compile/validate/dataType.js +0 -219
  86. package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +0 -1
  87. package/dist/node_modules/ajv/dist/compile/validate/defaults.js +0 -48
  88. package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +0 -1
  89. package/dist/node_modules/ajv/dist/compile/validate/index.js +0 -541
  90. package/dist/node_modules/ajv/dist/compile/validate/index.js.map +0 -1
  91. package/dist/node_modules/ajv/dist/compile/validate/keyword.js +0 -139
  92. package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +0 -1
  93. package/dist/node_modules/ajv/dist/compile/validate/subschema.js +0 -94
  94. package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +0 -1
  95. package/dist/node_modules/ajv/dist/core.js +0 -642
  96. package/dist/node_modules/ajv/dist/core.js.map +0 -1
  97. package/dist/node_modules/ajv/dist/refs/data.json.js +0 -31
  98. package/dist/node_modules/ajv/dist/refs/data.json.js.map +0 -1
  99. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +0 -254
  100. package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +0 -1
  101. package/dist/node_modules/ajv/dist/runtime/equal.js +0 -19
  102. package/dist/node_modules/ajv/dist/runtime/equal.js.map +0 -1
  103. package/dist/node_modules/ajv/dist/runtime/ucs2length.js +0 -35
  104. package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +0 -1
  105. package/dist/node_modules/ajv/dist/runtime/uri.js +0 -18
  106. package/dist/node_modules/ajv/dist/runtime/uri.js.map +0 -1
  107. package/dist/node_modules/ajv/dist/runtime/validation_error.js +0 -22
  108. package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +0 -1
  109. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -62
  110. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +0 -1
  111. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -121
  112. package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +0 -1
  113. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -35
  114. package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +0 -1
  115. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -24
  116. package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +0 -1
  117. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -108
  118. package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +0 -1
  119. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -101
  120. package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +0 -1
  121. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -79
  122. package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +0 -1
  123. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -71
  124. package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +0 -1
  125. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -66
  126. package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +0 -1
  127. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -45
  128. package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +0 -1
  129. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -38
  130. package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +0 -1
  131. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -73
  132. package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +0 -1
  133. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -89
  134. package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +0 -1
  135. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -24
  136. package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +0 -1
  137. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -69
  138. package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +0 -1
  139. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -51
  140. package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +0 -1
  141. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -25
  142. package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +0 -1
  143. package/dist/node_modules/ajv/dist/vocabularies/code.js +0 -145
  144. package/dist/node_modules/ajv/dist/vocabularies/code.js.map +0 -1
  145. package/dist/node_modules/ajv/dist/vocabularies/core/id.js +0 -21
  146. package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +0 -1
  147. package/dist/node_modules/ajv/dist/vocabularies/core/index.js +0 -29
  148. package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +0 -1
  149. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +0 -139
  150. package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +0 -1
  151. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -120
  152. package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +0 -1
  153. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -20
  154. package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +0 -1
  155. package/dist/node_modules/ajv/dist/vocabularies/draft7.js +0 -33
  156. package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +0 -1
  157. package/dist/node_modules/ajv/dist/vocabularies/format/format.js +0 -104
  158. package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +0 -1
  159. package/dist/node_modules/ajv/dist/vocabularies/format/index.js +0 -18
  160. package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +0 -1
  161. package/dist/node_modules/ajv/dist/vocabularies/metadata.js +0 -29
  162. package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +0 -1
  163. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +0 -39
  164. package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +0 -1
  165. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -62
  166. package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +0 -1
  167. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +0 -54
  168. package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +0 -1
  169. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -36
  170. package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +0 -1
  171. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -41
  172. package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +0 -1
  173. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -39
  174. package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +0 -1
  175. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -36
  176. package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +0 -1
  177. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -38
  178. package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +0 -1
  179. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -37
  180. package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +0 -1
  181. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +0 -93
  182. package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +0 -1
  183. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -79
  184. package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +0 -1
  185. package/dist/node_modules/ajv/lib/ajv.js +0 -531
  186. package/dist/node_modules/ajv/lib/ajv.js.map +0 -1
  187. package/dist/node_modules/ajv/lib/cache.js +0 -37
  188. package/dist/node_modules/ajv/lib/cache.js.map +0 -1
  189. package/dist/node_modules/ajv/lib/compile/async.js +0 -102
  190. package/dist/node_modules/ajv/lib/compile/async.js.map +0 -1
  191. package/dist/node_modules/ajv/lib/compile/error_classes.js +0 -46
  192. package/dist/node_modules/ajv/lib/compile/error_classes.js.map +0 -1
  193. package/dist/node_modules/ajv/lib/compile/formats.js +0 -154
  194. package/dist/node_modules/ajv/lib/compile/formats.js.map +0 -1
  195. package/dist/node_modules/ajv/lib/compile/index.js +0 -404
  196. package/dist/node_modules/ajv/lib/compile/index.js.map +0 -1
  197. package/dist/node_modules/ajv/lib/compile/resolve.js +0 -286
  198. package/dist/node_modules/ajv/lib/compile/resolve.js.map +0 -1
  199. package/dist/node_modules/ajv/lib/compile/rules.js +0 -79
  200. package/dist/node_modules/ajv/lib/compile/rules.js.map +0 -1
  201. package/dist/node_modules/ajv/lib/compile/schema_obj.js +0 -21
  202. package/dist/node_modules/ajv/lib/compile/schema_obj.js.map +0 -1
  203. package/dist/node_modules/ajv/lib/compile/ucs2length.js +0 -30
  204. package/dist/node_modules/ajv/lib/compile/ucs2length.js.map +0 -1
  205. package/dist/node_modules/ajv/lib/compile/util.js +0 -252
  206. package/dist/node_modules/ajv/lib/compile/util.js.map +0 -1
  207. package/dist/node_modules/ajv/lib/data.js +0 -59
  208. package/dist/node_modules/ajv/lib/data.js.map +0 -1
  209. package/dist/node_modules/ajv/lib/definition_schema.js +0 -49
  210. package/dist/node_modules/ajv/lib/definition_schema.js.map +0 -1
  211. package/dist/node_modules/ajv/lib/dotjs/_limit.js +0 -173
  212. package/dist/node_modules/ajv/lib/dotjs/_limit.js.map +0 -1
  213. package/dist/node_modules/ajv/lib/dotjs/_limitItems.js +0 -90
  214. package/dist/node_modules/ajv/lib/dotjs/_limitItems.js.map +0 -1
  215. package/dist/node_modules/ajv/lib/dotjs/_limitLength.js +0 -95
  216. package/dist/node_modules/ajv/lib/dotjs/_limitLength.js.map +0 -1
  217. package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js +0 -90
  218. package/dist/node_modules/ajv/lib/dotjs/_limitProperties.js.map +0 -1
  219. package/dist/node_modules/ajv/lib/dotjs/allOf.js +0 -52
  220. package/dist/node_modules/ajv/lib/dotjs/allOf.js.map +0 -1
  221. package/dist/node_modules/ajv/lib/dotjs/anyOf.js +0 -83
  222. package/dist/node_modules/ajv/lib/dotjs/anyOf.js.map +0 -1
  223. package/dist/node_modules/ajv/lib/dotjs/comment.js +0 -24
  224. package/dist/node_modules/ajv/lib/dotjs/comment.js.map +0 -1
  225. package/dist/node_modules/ajv/lib/dotjs/const.js +0 -62
  226. package/dist/node_modules/ajv/lib/dotjs/const.js.map +0 -1
  227. package/dist/node_modules/ajv/lib/dotjs/contains.js +0 -91
  228. package/dist/node_modules/ajv/lib/dotjs/contains.js.map +0 -1
  229. package/dist/node_modules/ajv/lib/dotjs/custom.js +0 -238
  230. package/dist/node_modules/ajv/lib/dotjs/custom.js.map +0 -1
  231. package/dist/node_modules/ajv/lib/dotjs/dependencies.js +0 -178
  232. package/dist/node_modules/ajv/lib/dotjs/dependencies.js.map +0 -1
  233. package/dist/node_modules/ajv/lib/dotjs/enum.js +0 -72
  234. package/dist/node_modules/ajv/lib/dotjs/enum.js.map +0 -1
  235. package/dist/node_modules/ajv/lib/dotjs/format.js +0 -160
  236. package/dist/node_modules/ajv/lib/dotjs/format.js.map +0 -1
  237. package/dist/node_modules/ajv/lib/dotjs/if.js +0 -113
  238. package/dist/node_modules/ajv/lib/dotjs/if.js.map +0 -1
  239. package/dist/node_modules/ajv/lib/dotjs/index.js +0 -68
  240. package/dist/node_modules/ajv/lib/dotjs/index.js.map +0 -1
  241. package/dist/node_modules/ajv/lib/dotjs/items.js +0 -150
  242. package/dist/node_modules/ajv/lib/dotjs/items.js.map +0 -1
  243. package/dist/node_modules/ajv/lib/dotjs/multipleOf.js +0 -90
  244. package/dist/node_modules/ajv/lib/dotjs/multipleOf.js.map +0 -1
  245. package/dist/node_modules/ajv/lib/dotjs/not.js +0 -94
  246. package/dist/node_modules/ajv/lib/dotjs/not.js.map +0 -1
  247. package/dist/node_modules/ajv/lib/dotjs/oneOf.js +0 -83
  248. package/dist/node_modules/ajv/lib/dotjs/oneOf.js.map +0 -1
  249. package/dist/node_modules/ajv/lib/dotjs/pattern.js +0 -85
  250. package/dist/node_modules/ajv/lib/dotjs/pattern.js.map +0 -1
  251. package/dist/node_modules/ajv/lib/dotjs/properties.js +0 -345
  252. package/dist/node_modules/ajv/lib/dotjs/properties.js.map +0 -1
  253. package/dist/node_modules/ajv/lib/dotjs/propertyNames.js +0 -91
  254. package/dist/node_modules/ajv/lib/dotjs/propertyNames.js.map +0 -1
  255. package/dist/node_modules/ajv/lib/dotjs/ref.js +0 -134
  256. package/dist/node_modules/ajv/lib/dotjs/ref.js.map +0 -1
  257. package/dist/node_modules/ajv/lib/dotjs/required.js +0 -276
  258. package/dist/node_modules/ajv/lib/dotjs/required.js.map +0 -1
  259. package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js +0 -96
  260. package/dist/node_modules/ajv/lib/dotjs/uniqueItems.js.map +0 -1
  261. package/dist/node_modules/ajv/lib/dotjs/validate.js +0 -492
  262. package/dist/node_modules/ajv/lib/dotjs/validate.js.map +0 -1
  263. package/dist/node_modules/ajv/lib/keyword.js +0 -159
  264. package/dist/node_modules/ajv/lib/keyword.js.map +0 -1
  265. package/dist/node_modules/ajv/lib/refs/data.json.js +0 -33
  266. package/dist/node_modules/ajv/lib/refs/data.json.js.map +0 -1
  267. package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js +0 -254
  268. package/dist/node_modules/ajv/lib/refs/json-schema-draft-07.json.js.map +0 -1
  269. package/dist/node_modules/fast-json-stable-stringify/index.js +0 -69
  270. package/dist/node_modules/fast-json-stable-stringify/index.js.map +0 -1
  271. package/dist/node_modules/json-schema-traverse/index.js +0 -104
  272. package/dist/node_modules/json-schema-traverse/index.js.map +0 -1
  273. package/dist/node_modules/uri-js/dist/es5/uri.all.js +0 -1418
  274. package/dist/node_modules/uri-js/dist/es5/uri.all.js.map +0 -1
  275. package/dist/node_modules/zod/v3/ZodError.js +0 -133
  276. package/dist/node_modules/zod/v3/ZodError.js.map +0 -1
  277. package/dist/node_modules/zod/v3/errors.js +0 -9
  278. package/dist/node_modules/zod/v3/errors.js.map +0 -1
  279. package/dist/node_modules/zod/v3/helpers/errorUtil.js +0 -9
  280. package/dist/node_modules/zod/v3/helpers/errorUtil.js.map +0 -1
  281. package/dist/node_modules/zod/v3/helpers/parseUtil.js +0 -112
  282. package/dist/node_modules/zod/v3/helpers/parseUtil.js.map +0 -1
  283. package/dist/node_modules/zod/v3/helpers/util.js +0 -136
  284. package/dist/node_modules/zod/v3/helpers/util.js.map +0 -1
  285. package/dist/node_modules/zod/v3/locales/en.js +0 -112
  286. package/dist/node_modules/zod/v3/locales/en.js.map +0 -1
  287. package/dist/node_modules/zod/v3/types.js +0 -3491
  288. package/dist/node_modules/zod/v3/types.js.map +0 -1
  289. package/dist/polygon.cjs +0 -39
  290. package/dist/polygon.cjs.map +0 -1
  291. package/dist/polygon.d.ts +0 -1
  292. package/dist/polygon.d.ts.map +0 -1
  293. package/dist/polygon.js +0 -2
  294. package/dist/polygon.js.map +0 -1
  295. package/dist/polygonConstants.d.ts +0 -53
  296. package/dist/setup.expo.d.ts +0 -2
  297. package/dist/solana.cjs +0 -20
  298. package/dist/solana.cjs.map +0 -1
  299. package/dist/solana.d.ts +0 -2
  300. package/dist/solana.d.ts.map +0 -1
  301. package/dist/solana.js +0 -3
  302. package/dist/solana.js.map +0 -1
  303. package/dist/solanaAccount.d.ts +0 -13
  304. package/dist/solanaAccount.d.ts.map +0 -1
  305. package/dist/solanaAccount.js +0 -34
  306. package/dist/solanaAccount.js.map +0 -1
  307. package/dist/solanaPaymentMaker.d.ts +0 -25
  308. package/dist/solanaPaymentMaker.d.ts.map +0 -1
  309. package/dist/solanaPaymentMaker.js +0 -108
  310. package/dist/solanaPaymentMaker.js.map +0 -1
  311. package/dist/types.d.ts +0 -75
  312. package/dist/types.js +0 -152
  313. package/dist/types.js.map +0 -1
  314. package/dist/world.cjs +0 -39
  315. package/dist/world.cjs.map +0 -1
  316. package/dist/world.d.ts +0 -1
  317. package/dist/world.d.ts.map +0 -1
  318. package/dist/world.js +0 -2
  319. package/dist/world.js.map +0 -1
  320. package/dist/worldConstants.d.ts +0 -53
@@ -1,712 +0,0 @@
1
- import { __exports as codegen } from '../../../../../_virtual/index5.js';
2
- import { __require as requireCode } from './code.js';
3
- import { __require as requireScope } from './scope.js';
4
-
5
- var hasRequiredCodegen;
6
-
7
- function requireCodegen () {
8
- if (hasRequiredCodegen) return codegen;
9
- hasRequiredCodegen = 1;
10
- (function (exports$1) {
11
- Object.defineProperty(exports$1, "__esModule", { value: true });
12
- exports$1.or = exports$1.and = exports$1.not = exports$1.CodeGen = exports$1.operators = exports$1.varKinds = exports$1.ValueScopeName = exports$1.ValueScope = exports$1.Scope = exports$1.Name = exports$1.regexpCode = exports$1.stringify = exports$1.getProperty = exports$1.nil = exports$1.strConcat = exports$1.str = exports$1._ = void 0;
13
- const code_1 = requireCode();
14
- const scope_1 = requireScope();
15
- var code_2 = requireCode();
16
- Object.defineProperty(exports$1, "_", { enumerable: true, get: function () { return code_2._; } });
17
- Object.defineProperty(exports$1, "str", { enumerable: true, get: function () { return code_2.str; } });
18
- Object.defineProperty(exports$1, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } });
19
- Object.defineProperty(exports$1, "nil", { enumerable: true, get: function () { return code_2.nil; } });
20
- Object.defineProperty(exports$1, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } });
21
- Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function () { return code_2.stringify; } });
22
- Object.defineProperty(exports$1, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } });
23
- Object.defineProperty(exports$1, "Name", { enumerable: true, get: function () { return code_2.Name; } });
24
- var scope_2 = requireScope();
25
- Object.defineProperty(exports$1, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } });
26
- Object.defineProperty(exports$1, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } });
27
- Object.defineProperty(exports$1, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } });
28
- Object.defineProperty(exports$1, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } });
29
- exports$1.operators = {
30
- GT: new code_1._Code(">"),
31
- GTE: new code_1._Code(">="),
32
- LT: new code_1._Code("<"),
33
- LTE: new code_1._Code("<="),
34
- EQ: new code_1._Code("==="),
35
- NEQ: new code_1._Code("!=="),
36
- NOT: new code_1._Code("!"),
37
- OR: new code_1._Code("||"),
38
- AND: new code_1._Code("&&"),
39
- ADD: new code_1._Code("+"),
40
- };
41
- class Node {
42
- optimizeNodes() {
43
- return this;
44
- }
45
- optimizeNames(_names, _constants) {
46
- return this;
47
- }
48
- }
49
- class Def extends Node {
50
- constructor(varKind, name, rhs) {
51
- super();
52
- this.varKind = varKind;
53
- this.name = name;
54
- this.rhs = rhs;
55
- }
56
- render({ es5, _n }) {
57
- const varKind = es5 ? scope_1.varKinds.var : this.varKind;
58
- const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`;
59
- return `${varKind} ${this.name}${rhs};` + _n;
60
- }
61
- optimizeNames(names, constants) {
62
- if (!names[this.name.str])
63
- return;
64
- if (this.rhs)
65
- this.rhs = optimizeExpr(this.rhs, names, constants);
66
- return this;
67
- }
68
- get names() {
69
- return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
70
- }
71
- }
72
- class Assign extends Node {
73
- constructor(lhs, rhs, sideEffects) {
74
- super();
75
- this.lhs = lhs;
76
- this.rhs = rhs;
77
- this.sideEffects = sideEffects;
78
- }
79
- render({ _n }) {
80
- return `${this.lhs} = ${this.rhs};` + _n;
81
- }
82
- optimizeNames(names, constants) {
83
- if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
84
- return;
85
- this.rhs = optimizeExpr(this.rhs, names, constants);
86
- return this;
87
- }
88
- get names() {
89
- const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
90
- return addExprNames(names, this.rhs);
91
- }
92
- }
93
- class AssignOp extends Assign {
94
- constructor(lhs, op, rhs, sideEffects) {
95
- super(lhs, rhs, sideEffects);
96
- this.op = op;
97
- }
98
- render({ _n }) {
99
- return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
100
- }
101
- }
102
- class Label extends Node {
103
- constructor(label) {
104
- super();
105
- this.label = label;
106
- this.names = {};
107
- }
108
- render({ _n }) {
109
- return `${this.label}:` + _n;
110
- }
111
- }
112
- class Break extends Node {
113
- constructor(label) {
114
- super();
115
- this.label = label;
116
- this.names = {};
117
- }
118
- render({ _n }) {
119
- const label = this.label ? ` ${this.label}` : "";
120
- return `break${label};` + _n;
121
- }
122
- }
123
- class Throw extends Node {
124
- constructor(error) {
125
- super();
126
- this.error = error;
127
- }
128
- render({ _n }) {
129
- return `throw ${this.error};` + _n;
130
- }
131
- get names() {
132
- return this.error.names;
133
- }
134
- }
135
- class AnyCode extends Node {
136
- constructor(code) {
137
- super();
138
- this.code = code;
139
- }
140
- render({ _n }) {
141
- return `${this.code};` + _n;
142
- }
143
- optimizeNodes() {
144
- return `${this.code}` ? this : undefined;
145
- }
146
- optimizeNames(names, constants) {
147
- this.code = optimizeExpr(this.code, names, constants);
148
- return this;
149
- }
150
- get names() {
151
- return this.code instanceof code_1._CodeOrName ? this.code.names : {};
152
- }
153
- }
154
- class ParentNode extends Node {
155
- constructor(nodes = []) {
156
- super();
157
- this.nodes = nodes;
158
- }
159
- render(opts) {
160
- return this.nodes.reduce((code, n) => code + n.render(opts), "");
161
- }
162
- optimizeNodes() {
163
- const { nodes } = this;
164
- let i = nodes.length;
165
- while (i--) {
166
- const n = nodes[i].optimizeNodes();
167
- if (Array.isArray(n))
168
- nodes.splice(i, 1, ...n);
169
- else if (n)
170
- nodes[i] = n;
171
- else
172
- nodes.splice(i, 1);
173
- }
174
- return nodes.length > 0 ? this : undefined;
175
- }
176
- optimizeNames(names, constants) {
177
- const { nodes } = this;
178
- let i = nodes.length;
179
- while (i--) {
180
- // iterating backwards improves 1-pass optimization
181
- const n = nodes[i];
182
- if (n.optimizeNames(names, constants))
183
- continue;
184
- subtractNames(names, n.names);
185
- nodes.splice(i, 1);
186
- }
187
- return nodes.length > 0 ? this : undefined;
188
- }
189
- get names() {
190
- return this.nodes.reduce((names, n) => addNames(names, n.names), {});
191
- }
192
- }
193
- class BlockNode extends ParentNode {
194
- render(opts) {
195
- return "{" + opts._n + super.render(opts) + "}" + opts._n;
196
- }
197
- }
198
- class Root extends ParentNode {
199
- }
200
- class Else extends BlockNode {
201
- }
202
- Else.kind = "else";
203
- class If extends BlockNode {
204
- constructor(condition, nodes) {
205
- super(nodes);
206
- this.condition = condition;
207
- }
208
- render(opts) {
209
- let code = `if(${this.condition})` + super.render(opts);
210
- if (this.else)
211
- code += "else " + this.else.render(opts);
212
- return code;
213
- }
214
- optimizeNodes() {
215
- super.optimizeNodes();
216
- const cond = this.condition;
217
- if (cond === true)
218
- return this.nodes; // else is ignored here
219
- let e = this.else;
220
- if (e) {
221
- const ns = e.optimizeNodes();
222
- e = this.else = Array.isArray(ns) ? new Else(ns) : ns;
223
- }
224
- if (e) {
225
- if (cond === false)
226
- return e instanceof If ? e : e.nodes;
227
- if (this.nodes.length)
228
- return this;
229
- return new If(not(cond), e instanceof If ? [e] : e.nodes);
230
- }
231
- if (cond === false || !this.nodes.length)
232
- return undefined;
233
- return this;
234
- }
235
- optimizeNames(names, constants) {
236
- var _a;
237
- this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
238
- if (!(super.optimizeNames(names, constants) || this.else))
239
- return;
240
- this.condition = optimizeExpr(this.condition, names, constants);
241
- return this;
242
- }
243
- get names() {
244
- const names = super.names;
245
- addExprNames(names, this.condition);
246
- if (this.else)
247
- addNames(names, this.else.names);
248
- return names;
249
- }
250
- }
251
- If.kind = "if";
252
- class For extends BlockNode {
253
- }
254
- For.kind = "for";
255
- class ForLoop extends For {
256
- constructor(iteration) {
257
- super();
258
- this.iteration = iteration;
259
- }
260
- render(opts) {
261
- return `for(${this.iteration})` + super.render(opts);
262
- }
263
- optimizeNames(names, constants) {
264
- if (!super.optimizeNames(names, constants))
265
- return;
266
- this.iteration = optimizeExpr(this.iteration, names, constants);
267
- return this;
268
- }
269
- get names() {
270
- return addNames(super.names, this.iteration.names);
271
- }
272
- }
273
- class ForRange extends For {
274
- constructor(varKind, name, from, to) {
275
- super();
276
- this.varKind = varKind;
277
- this.name = name;
278
- this.from = from;
279
- this.to = to;
280
- }
281
- render(opts) {
282
- const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
283
- const { name, from, to } = this;
284
- return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
285
- }
286
- get names() {
287
- const names = addExprNames(super.names, this.from);
288
- return addExprNames(names, this.to);
289
- }
290
- }
291
- class ForIter extends For {
292
- constructor(loop, varKind, name, iterable) {
293
- super();
294
- this.loop = loop;
295
- this.varKind = varKind;
296
- this.name = name;
297
- this.iterable = iterable;
298
- }
299
- render(opts) {
300
- return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
301
- }
302
- optimizeNames(names, constants) {
303
- if (!super.optimizeNames(names, constants))
304
- return;
305
- this.iterable = optimizeExpr(this.iterable, names, constants);
306
- return this;
307
- }
308
- get names() {
309
- return addNames(super.names, this.iterable.names);
310
- }
311
- }
312
- class Func extends BlockNode {
313
- constructor(name, args, async) {
314
- super();
315
- this.name = name;
316
- this.args = args;
317
- this.async = async;
318
- }
319
- render(opts) {
320
- const _async = this.async ? "async " : "";
321
- return `${_async}function ${this.name}(${this.args})` + super.render(opts);
322
- }
323
- }
324
- Func.kind = "func";
325
- class Return extends ParentNode {
326
- render(opts) {
327
- return "return " + super.render(opts);
328
- }
329
- }
330
- Return.kind = "return";
331
- class Try extends BlockNode {
332
- render(opts) {
333
- let code = "try" + super.render(opts);
334
- if (this.catch)
335
- code += this.catch.render(opts);
336
- if (this.finally)
337
- code += this.finally.render(opts);
338
- return code;
339
- }
340
- optimizeNodes() {
341
- var _a, _b;
342
- super.optimizeNodes();
343
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
344
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
345
- return this;
346
- }
347
- optimizeNames(names, constants) {
348
- var _a, _b;
349
- super.optimizeNames(names, constants);
350
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
351
- (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
352
- return this;
353
- }
354
- get names() {
355
- const names = super.names;
356
- if (this.catch)
357
- addNames(names, this.catch.names);
358
- if (this.finally)
359
- addNames(names, this.finally.names);
360
- return names;
361
- }
362
- }
363
- class Catch extends BlockNode {
364
- constructor(error) {
365
- super();
366
- this.error = error;
367
- }
368
- render(opts) {
369
- return `catch(${this.error})` + super.render(opts);
370
- }
371
- }
372
- Catch.kind = "catch";
373
- class Finally extends BlockNode {
374
- render(opts) {
375
- return "finally" + super.render(opts);
376
- }
377
- }
378
- Finally.kind = "finally";
379
- class CodeGen {
380
- constructor(extScope, opts = {}) {
381
- this._values = {};
382
- this._blockStarts = [];
383
- this._constants = {};
384
- this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
385
- this._extScope = extScope;
386
- this._scope = new scope_1.Scope({ parent: extScope });
387
- this._nodes = [new Root()];
388
- }
389
- toString() {
390
- return this._root.render(this.opts);
391
- }
392
- // returns unique name in the internal scope
393
- name(prefix) {
394
- return this._scope.name(prefix);
395
- }
396
- // reserves unique name in the external scope
397
- scopeName(prefix) {
398
- return this._extScope.name(prefix);
399
- }
400
- // reserves unique name in the external scope and assigns value to it
401
- scopeValue(prefixOrName, value) {
402
- const name = this._extScope.value(prefixOrName, value);
403
- const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set());
404
- vs.add(name);
405
- return name;
406
- }
407
- getScopeValue(prefix, keyOrRef) {
408
- return this._extScope.getValue(prefix, keyOrRef);
409
- }
410
- // return code that assigns values in the external scope to the names that are used internally
411
- // (same names that were returned by gen.scopeName or gen.scopeValue)
412
- scopeRefs(scopeName) {
413
- return this._extScope.scopeRefs(scopeName, this._values);
414
- }
415
- scopeCode() {
416
- return this._extScope.scopeCode(this._values);
417
- }
418
- _def(varKind, nameOrPrefix, rhs, constant) {
419
- const name = this._scope.toName(nameOrPrefix);
420
- if (rhs !== undefined && constant)
421
- this._constants[name.str] = rhs;
422
- this._leafNode(new Def(varKind, name, rhs));
423
- return name;
424
- }
425
- // `const` declaration (`var` in es5 mode)
426
- const(nameOrPrefix, rhs, _constant) {
427
- return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
428
- }
429
- // `let` declaration with optional assignment (`var` in es5 mode)
430
- let(nameOrPrefix, rhs, _constant) {
431
- return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);
432
- }
433
- // `var` declaration with optional assignment
434
- var(nameOrPrefix, rhs, _constant) {
435
- return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);
436
- }
437
- // assignment code
438
- assign(lhs, rhs, sideEffects) {
439
- return this._leafNode(new Assign(lhs, rhs, sideEffects));
440
- }
441
- // `+=` code
442
- add(lhs, rhs) {
443
- return this._leafNode(new AssignOp(lhs, exports$1.operators.ADD, rhs));
444
- }
445
- // appends passed SafeExpr to code or executes Block
446
- code(c) {
447
- if (typeof c == "function")
448
- c();
449
- else if (c !== code_1.nil)
450
- this._leafNode(new AnyCode(c));
451
- return this;
452
- }
453
- // returns code for object literal for the passed argument list of key-value pairs
454
- object(...keyValues) {
455
- const code = ["{"];
456
- for (const [key, value] of keyValues) {
457
- if (code.length > 1)
458
- code.push(",");
459
- code.push(key);
460
- if (key !== value || this.opts.es5) {
461
- code.push(":");
462
- (0, code_1.addCodeArg)(code, value);
463
- }
464
- }
465
- code.push("}");
466
- return new code_1._Code(code);
467
- }
468
- // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
469
- if(condition, thenBody, elseBody) {
470
- this._blockNode(new If(condition));
471
- if (thenBody && elseBody) {
472
- this.code(thenBody).else().code(elseBody).endIf();
473
- }
474
- else if (thenBody) {
475
- this.code(thenBody).endIf();
476
- }
477
- else if (elseBody) {
478
- throw new Error('CodeGen: "else" body without "then" body');
479
- }
480
- return this;
481
- }
482
- // `else if` clause - invalid without `if` or after `else` clauses
483
- elseIf(condition) {
484
- return this._elseNode(new If(condition));
485
- }
486
- // `else` clause - only valid after `if` or `else if` clauses
487
- else() {
488
- return this._elseNode(new Else());
489
- }
490
- // end `if` statement (needed if gen.if was used only with condition)
491
- endIf() {
492
- return this._endBlockNode(If, Else);
493
- }
494
- _for(node, forBody) {
495
- this._blockNode(node);
496
- if (forBody)
497
- this.code(forBody).endFor();
498
- return this;
499
- }
500
- // a generic `for` clause (or statement if `forBody` is passed)
501
- for(iteration, forBody) {
502
- return this._for(new ForLoop(iteration), forBody);
503
- }
504
- // `for` statement for a range of values
505
- forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
506
- const name = this._scope.toName(nameOrPrefix);
507
- return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
508
- }
509
- // `for-of` statement (in es5 mode replace with a normal for loop)
510
- forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
511
- const name = this._scope.toName(nameOrPrefix);
512
- if (this.opts.es5) {
513
- const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
514
- return this.forRange("_i", 0, (0, code_1._) `${arr}.length`, (i) => {
515
- this.var(name, (0, code_1._) `${arr}[${i}]`);
516
- forBody(name);
517
- });
518
- }
519
- return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
520
- }
521
- // `for-in` statement.
522
- // With option `ownProperties` replaced with a `for-of` loop for object keys
523
- forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
524
- if (this.opts.ownProperties) {
525
- return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody);
526
- }
527
- const name = this._scope.toName(nameOrPrefix);
528
- return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
529
- }
530
- // end `for` loop
531
- endFor() {
532
- return this._endBlockNode(For);
533
- }
534
- // `label` statement
535
- label(label) {
536
- return this._leafNode(new Label(label));
537
- }
538
- // `break` statement
539
- break(label) {
540
- return this._leafNode(new Break(label));
541
- }
542
- // `return` statement
543
- return(value) {
544
- const node = new Return();
545
- this._blockNode(node);
546
- this.code(value);
547
- if (node.nodes.length !== 1)
548
- throw new Error('CodeGen: "return" should have one node');
549
- return this._endBlockNode(Return);
550
- }
551
- // `try` statement
552
- try(tryBody, catchCode, finallyCode) {
553
- if (!catchCode && !finallyCode)
554
- throw new Error('CodeGen: "try" without "catch" and "finally"');
555
- const node = new Try();
556
- this._blockNode(node);
557
- this.code(tryBody);
558
- if (catchCode) {
559
- const error = this.name("e");
560
- this._currNode = node.catch = new Catch(error);
561
- catchCode(error);
562
- }
563
- if (finallyCode) {
564
- this._currNode = node.finally = new Finally();
565
- this.code(finallyCode);
566
- }
567
- return this._endBlockNode(Catch, Finally);
568
- }
569
- // `throw` statement
570
- throw(error) {
571
- return this._leafNode(new Throw(error));
572
- }
573
- // start self-balancing block
574
- block(body, nodeCount) {
575
- this._blockStarts.push(this._nodes.length);
576
- if (body)
577
- this.code(body).endBlock(nodeCount);
578
- return this;
579
- }
580
- // end the current self-balancing block
581
- endBlock(nodeCount) {
582
- const len = this._blockStarts.pop();
583
- if (len === undefined)
584
- throw new Error("CodeGen: not in self-balancing block");
585
- const toClose = this._nodes.length - len;
586
- if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) {
587
- throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);
588
- }
589
- this._nodes.length = len;
590
- return this;
591
- }
592
- // `function` heading (or definition if funcBody is passed)
593
- func(name, args = code_1.nil, async, funcBody) {
594
- this._blockNode(new Func(name, args, async));
595
- if (funcBody)
596
- this.code(funcBody).endFunc();
597
- return this;
598
- }
599
- // end function definition
600
- endFunc() {
601
- return this._endBlockNode(Func);
602
- }
603
- optimize(n = 1) {
604
- while (n-- > 0) {
605
- this._root.optimizeNodes();
606
- this._root.optimizeNames(this._root.names, this._constants);
607
- }
608
- }
609
- _leafNode(node) {
610
- this._currNode.nodes.push(node);
611
- return this;
612
- }
613
- _blockNode(node) {
614
- this._currNode.nodes.push(node);
615
- this._nodes.push(node);
616
- }
617
- _endBlockNode(N1, N2) {
618
- const n = this._currNode;
619
- if (n instanceof N1 || (N2 && n instanceof N2)) {
620
- this._nodes.pop();
621
- return this;
622
- }
623
- throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
624
- }
625
- _elseNode(node) {
626
- const n = this._currNode;
627
- if (!(n instanceof If)) {
628
- throw new Error('CodeGen: "else" without "if"');
629
- }
630
- this._currNode = n.else = node;
631
- return this;
632
- }
633
- get _root() {
634
- return this._nodes[0];
635
- }
636
- get _currNode() {
637
- const ns = this._nodes;
638
- return ns[ns.length - 1];
639
- }
640
- set _currNode(node) {
641
- const ns = this._nodes;
642
- ns[ns.length - 1] = node;
643
- }
644
- }
645
- exports$1.CodeGen = CodeGen;
646
- function addNames(names, from) {
647
- for (const n in from)
648
- names[n] = (names[n] || 0) + (from[n] || 0);
649
- return names;
650
- }
651
- function addExprNames(names, from) {
652
- return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
653
- }
654
- function optimizeExpr(expr, names, constants) {
655
- if (expr instanceof code_1.Name)
656
- return replaceName(expr);
657
- if (!canOptimize(expr))
658
- return expr;
659
- return new code_1._Code(expr._items.reduce((items, c) => {
660
- if (c instanceof code_1.Name)
661
- c = replaceName(c);
662
- if (c instanceof code_1._Code)
663
- items.push(...c._items);
664
- else
665
- items.push(c);
666
- return items;
667
- }, []));
668
- function replaceName(n) {
669
- const c = constants[n.str];
670
- if (c === undefined || names[n.str] !== 1)
671
- return n;
672
- delete names[n.str];
673
- return c;
674
- }
675
- function canOptimize(e) {
676
- return (e instanceof code_1._Code &&
677
- e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined));
678
- }
679
- }
680
- function subtractNames(names, from) {
681
- for (const n in from)
682
- names[n] = (names[n] || 0) - (from[n] || 0);
683
- }
684
- function not(x) {
685
- return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`;
686
- }
687
- exports$1.not = not;
688
- const andCode = mappend(exports$1.operators.AND);
689
- // boolean AND (&&) expression with the passed arguments
690
- function and(...args) {
691
- return args.reduce(andCode);
692
- }
693
- exports$1.and = and;
694
- const orCode = mappend(exports$1.operators.OR);
695
- // boolean OR (||) expression with the passed arguments
696
- function or(...args) {
697
- return args.reduce(orCode);
698
- }
699
- exports$1.or = or;
700
- function mappend(op) {
701
- return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`);
702
- }
703
- function par(x) {
704
- return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`;
705
- }
706
-
707
- } (codegen));
708
- return codegen;
709
- }
710
-
711
- export { requireCodegen as __require };
712
- //# sourceMappingURL=index.js.map