@sentio/sdk 2.57.12-rc.j → 2.57.13-rc.1

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 (250) hide show
  1. package/lib/core/template.d.ts +1 -5
  2. package/lib/core/template.d.ts.map +1 -1
  3. package/lib/core/template.js +1 -4
  4. package/lib/core/template.js.map +1 -1
  5. package/lib/store/store.d.ts +2 -2
  6. package/lib/store/store.d.ts.map +1 -1
  7. package/lib/store/store.js.map +1 -1
  8. package/package.json +3 -3
  9. package/src/core/template.ts +1 -6
  10. package/src/store/store.ts +2 -3
  11. package/lib/chunk-2F2KNF4Z.js +0 -71905
  12. package/lib/chunk-2F2KNF4Z.js.map +0 -1
  13. package/lib/chunk-43HP4DQZ.js +0 -47
  14. package/lib/chunk-43HP4DQZ.js.map +0 -1
  15. package/lib/chunk-4HPFNKDX.js +0 -6763
  16. package/lib/chunk-4HPFNKDX.js.map +0 -1
  17. package/lib/chunk-4OCWUYSJ.js +0 -898
  18. package/lib/chunk-4OCWUYSJ.js.map +0 -1
  19. package/lib/chunk-6UVWNOIX.js +0 -4207
  20. package/lib/chunk-6UVWNOIX.js.map +0 -1
  21. package/lib/chunk-73SHERGU.js +0 -23970
  22. package/lib/chunk-73SHERGU.js.map +0 -1
  23. package/lib/chunk-742S42NO.js +0 -1323
  24. package/lib/chunk-742S42NO.js.map +0 -1
  25. package/lib/chunk-7ECRTQD7.js +0 -26757
  26. package/lib/chunk-7ECRTQD7.js.map +0 -1
  27. package/lib/chunk-7IDGS56O.js +0 -5058
  28. package/lib/chunk-7IDGS56O.js.map +0 -1
  29. package/lib/chunk-7S6WQ4RL.js +0 -1069
  30. package/lib/chunk-7S6WQ4RL.js.map +0 -1
  31. package/lib/chunk-AZFMPZRN.js +0 -3613
  32. package/lib/chunk-AZFMPZRN.js.map +0 -1
  33. package/lib/chunk-BZCXYTDE.js +0 -1333
  34. package/lib/chunk-BZCXYTDE.js.map +0 -1
  35. package/lib/chunk-E2DS6WZF.js +0 -1690
  36. package/lib/chunk-E2DS6WZF.js.map +0 -1
  37. package/lib/chunk-GE6BRIGS.js +0 -1721
  38. package/lib/chunk-GE6BRIGS.js.map +0 -1
  39. package/lib/chunk-J3I3VNTV.js +0 -767
  40. package/lib/chunk-J3I3VNTV.js.map +0 -1
  41. package/lib/chunk-J3QOJ2RV.js +0 -661
  42. package/lib/chunk-J3QOJ2RV.js.map +0 -1
  43. package/lib/chunk-J5UEW4B7.js +0 -1351
  44. package/lib/chunk-J5UEW4B7.js.map +0 -1
  45. package/lib/chunk-LPSNAS2G.js +0 -460
  46. package/lib/chunk-LPSNAS2G.js.map +0 -1
  47. package/lib/chunk-LR232ZJV.js +0 -2593
  48. package/lib/chunk-LR232ZJV.js.map +0 -1
  49. package/lib/chunk-N36N7RXJ.js +0 -653
  50. package/lib/chunk-N36N7RXJ.js.map +0 -1
  51. package/lib/chunk-OJG2VJ5T.js +0 -7063
  52. package/lib/chunk-OJG2VJ5T.js.map +0 -1
  53. package/lib/chunk-ONBEMKI5.js +0 -323
  54. package/lib/chunk-ONBEMKI5.js.map +0 -1
  55. package/lib/chunk-PVX2LIM5.js +0 -205
  56. package/lib/chunk-PVX2LIM5.js.map +0 -1
  57. package/lib/chunk-R7PMHHKJ.js +0 -52
  58. package/lib/chunk-R7PMHHKJ.js.map +0 -1
  59. package/lib/chunk-RMT2JEWA.js +0 -7740
  60. package/lib/chunk-RMT2JEWA.js.map +0 -1
  61. package/lib/chunk-S6MJ3KIL.js +0 -27798
  62. package/lib/chunk-S6MJ3KIL.js.map +0 -1
  63. package/lib/chunk-UEFVZL4I.js +0 -199
  64. package/lib/chunk-UEFVZL4I.js.map +0 -1
  65. package/lib/chunk-UIBPOKNT.js +0 -945
  66. package/lib/chunk-UIBPOKNT.js.map +0 -1
  67. package/lib/chunk-ZR7UHHH2.js +0 -5
  68. package/lib/chunk-ZR7UHHH2.js.map +0 -1
  69. package/lib/multipart-parser-SQIYSR67.js +0 -368
  70. package/lib/multipart-parser-SQIYSR67.js.map +0 -1
  71. package/src/aptos/builtin/0x1.d.ts +0 -6451
  72. package/src/aptos/builtin/0x1.d.ts.map +0 -1
  73. package/src/aptos/builtin/0x1.js +0 -7138
  74. package/src/aptos/builtin/0x1.js.map +0 -1
  75. package/src/aptos/builtin/0x3.d.ts +0 -1122
  76. package/src/aptos/builtin/0x3.d.ts.map +0 -1
  77. package/src/aptos/builtin/0x3.js +0 -937
  78. package/src/aptos/builtin/0x3.js.map +0 -1
  79. package/src/aptos/builtin/0x4.d.ts +0 -551
  80. package/src/aptos/builtin/0x4.d.ts.map +0 -1
  81. package/src/aptos/builtin/0x4.js +0 -529
  82. package/src/aptos/builtin/0x4.js.map +0 -1
  83. package/src/aptos/builtin/index.d.ts +0 -4
  84. package/src/aptos/builtin/index.d.ts.map +0 -1
  85. package/src/aptos/builtin/index.js +0 -7
  86. package/src/aptos/builtin/index.js.map +0 -1
  87. package/src/eth/builtin/eacaggregatorproxy.d.ts +0 -5
  88. package/src/eth/builtin/eacaggregatorproxy.d.ts.map +0 -1
  89. package/src/eth/builtin/eacaggregatorproxy.js +0 -8
  90. package/src/eth/builtin/eacaggregatorproxy.js.map +0 -1
  91. package/src/eth/builtin/erc1155.d.ts +0 -5
  92. package/src/eth/builtin/erc1155.d.ts.map +0 -1
  93. package/src/eth/builtin/erc1155.js +0 -8
  94. package/src/eth/builtin/erc1155.js.map +0 -1
  95. package/src/eth/builtin/erc20.d.ts +0 -5
  96. package/src/eth/builtin/erc20.d.ts.map +0 -1
  97. package/src/eth/builtin/erc20.js +0 -8
  98. package/src/eth/builtin/erc20.js.map +0 -1
  99. package/src/eth/builtin/erc20bytes.d.ts +0 -5
  100. package/src/eth/builtin/erc20bytes.d.ts.map +0 -1
  101. package/src/eth/builtin/erc20bytes.js +0 -8
  102. package/src/eth/builtin/erc20bytes.js.map +0 -1
  103. package/src/eth/builtin/erc721.d.ts +0 -5
  104. package/src/eth/builtin/erc721.d.ts.map +0 -1
  105. package/src/eth/builtin/erc721.js +0 -8
  106. package/src/eth/builtin/erc721.js.map +0 -1
  107. package/src/eth/builtin/index.d.ts +0 -13
  108. package/src/eth/builtin/index.d.ts.map +0 -1
  109. package/src/eth/builtin/index.js +0 -16
  110. package/src/eth/builtin/index.js.map +0 -1
  111. package/src/eth/builtin/internal/EACAggregatorProxy.d.ts +0 -50
  112. package/src/eth/builtin/internal/EACAggregatorProxy.d.ts.map +0 -1
  113. package/src/eth/builtin/internal/EACAggregatorProxy.js +0 -2
  114. package/src/eth/builtin/internal/EACAggregatorProxy.js.map +0 -1
  115. package/src/eth/builtin/internal/ERC1155.d.ts +0 -57
  116. package/src/eth/builtin/internal/ERC1155.d.ts.map +0 -1
  117. package/src/eth/builtin/internal/ERC1155.js +0 -2
  118. package/src/eth/builtin/internal/ERC1155.js.map +0 -1
  119. package/src/eth/builtin/internal/ERC20.d.ts +0 -41
  120. package/src/eth/builtin/internal/ERC20.d.ts.map +0 -1
  121. package/src/eth/builtin/internal/ERC20.js +0 -2
  122. package/src/eth/builtin/internal/ERC20.js.map +0 -1
  123. package/src/eth/builtin/internal/ERC20Bytes.d.ts +0 -32
  124. package/src/eth/builtin/internal/ERC20Bytes.d.ts.map +0 -1
  125. package/src/eth/builtin/internal/ERC20Bytes.js +0 -2
  126. package/src/eth/builtin/internal/ERC20Bytes.js.map +0 -1
  127. package/src/eth/builtin/internal/ERC721.d.ts +0 -43
  128. package/src/eth/builtin/internal/ERC721.d.ts.map +0 -1
  129. package/src/eth/builtin/internal/ERC721.js +0 -2
  130. package/src/eth/builtin/internal/ERC721.js.map +0 -1
  131. package/src/eth/builtin/internal/WETH9.d.ts +0 -47
  132. package/src/eth/builtin/internal/WETH9.d.ts.map +0 -1
  133. package/src/eth/builtin/internal/WETH9.js +0 -2
  134. package/src/eth/builtin/internal/WETH9.js.map +0 -1
  135. package/src/eth/builtin/internal/common.d.ts +0 -3
  136. package/src/eth/builtin/internal/common.d.ts.map +0 -1
  137. package/src/eth/builtin/internal/common.js +0 -8
  138. package/src/eth/builtin/internal/common.js.map +0 -1
  139. package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +0 -373
  140. package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +0 -1
  141. package/src/eth/builtin/internal/eacaggregatorproxy-processor.js +0 -1355
  142. package/src/eth/builtin/internal/eacaggregatorproxy-processor.js.map +0 -1
  143. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts +0 -7
  144. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts.map +0 -1
  145. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js +0 -55
  146. package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js.map +0 -1
  147. package/src/eth/builtin/internal/erc1155-processor.d.ts +0 -173
  148. package/src/eth/builtin/internal/erc1155-processor.d.ts.map +0 -1
  149. package/src/eth/builtin/internal/erc1155-processor.js +0 -596
  150. package/src/eth/builtin/internal/erc1155-processor.js.map +0 -1
  151. package/src/eth/builtin/internal/erc1155-test-utils.d.ts +0 -7
  152. package/src/eth/builtin/internal/erc1155-test-utils.d.ts.map +0 -1
  153. package/src/eth/builtin/internal/erc1155-test-utils.js +0 -55
  154. package/src/eth/builtin/internal/erc1155-test-utils.js.map +0 -1
  155. package/src/eth/builtin/internal/erc20-processor.d.ts +0 -244
  156. package/src/eth/builtin/internal/erc20-processor.d.ts.map +0 -1
  157. package/src/eth/builtin/internal/erc20-processor.js +0 -1109
  158. package/src/eth/builtin/internal/erc20-processor.js.map +0 -1
  159. package/src/eth/builtin/internal/erc20-test-utils.d.ts +0 -6
  160. package/src/eth/builtin/internal/erc20-test-utils.d.ts.map +0 -1
  161. package/src/eth/builtin/internal/erc20-test-utils.js +0 -44
  162. package/src/eth/builtin/internal/erc20-test-utils.js.map +0 -1
  163. package/src/eth/builtin/internal/erc20bytes-processor.d.ts +0 -144
  164. package/src/eth/builtin/internal/erc20bytes-processor.d.ts.map +0 -1
  165. package/src/eth/builtin/internal/erc20bytes-processor.js +0 -594
  166. package/src/eth/builtin/internal/erc20bytes-processor.js.map +0 -1
  167. package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts +0 -5
  168. package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts.map +0 -1
  169. package/src/eth/builtin/internal/erc20bytes-test-utils.js +0 -33
  170. package/src/eth/builtin/internal/erc20bytes-test-utils.js.map +0 -1
  171. package/src/eth/builtin/internal/erc721-processor.d.ts +0 -215
  172. package/src/eth/builtin/internal/erc721-processor.d.ts.map +0 -1
  173. package/src/eth/builtin/internal/erc721-processor.js +0 -895
  174. package/src/eth/builtin/internal/erc721-processor.js.map +0 -1
  175. package/src/eth/builtin/internal/erc721-test-utils.d.ts +0 -6
  176. package/src/eth/builtin/internal/erc721-test-utils.d.ts.map +0 -1
  177. package/src/eth/builtin/internal/erc721-test-utils.js +0 -44
  178. package/src/eth/builtin/internal/erc721-test-utils.js.map +0 -1
  179. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts +0 -400
  180. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts.map +0 -1
  181. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js +0 -524
  182. package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +0 -1
  183. package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts +0 -251
  184. package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts.map +0 -1
  185. package/src/eth/builtin/internal/factories/ERC1155__factory.js +0 -329
  186. package/src/eth/builtin/internal/factories/ERC1155__factory.js.map +0 -1
  187. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -185
  188. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts.map +0 -1
  189. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js +0 -251
  190. package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
  191. package/src/eth/builtin/internal/factories/ERC20__factory.d.ts +0 -303
  192. package/src/eth/builtin/internal/factories/ERC20__factory.d.ts.map +0 -1
  193. package/src/eth/builtin/internal/factories/ERC20__factory.js +0 -401
  194. package/src/eth/builtin/internal/factories/ERC20__factory.js.map +0 -1
  195. package/src/eth/builtin/internal/factories/ERC721__factory.d.ts +0 -273
  196. package/src/eth/builtin/internal/factories/ERC721__factory.d.ts.map +0 -1
  197. package/src/eth/builtin/internal/factories/ERC721__factory.js +0 -361
  198. package/src/eth/builtin/internal/factories/ERC721__factory.js.map +0 -1
  199. package/src/eth/builtin/internal/factories/WETH9__factory.d.ts +0 -220
  200. package/src/eth/builtin/internal/factories/WETH9__factory.d.ts.map +0 -1
  201. package/src/eth/builtin/internal/factories/WETH9__factory.js +0 -294
  202. package/src/eth/builtin/internal/factories/WETH9__factory.js.map +0 -1
  203. package/src/eth/builtin/internal/factories/index.d.ts +0 -7
  204. package/src/eth/builtin/internal/factories/index.d.ts.map +0 -1
  205. package/src/eth/builtin/internal/factories/index.js +0 -10
  206. package/src/eth/builtin/internal/factories/index.js.map +0 -1
  207. package/src/eth/builtin/internal/index.d.ts +0 -14
  208. package/src/eth/builtin/internal/index.d.ts.map +0 -1
  209. package/src/eth/builtin/internal/index.js +0 -8
  210. package/src/eth/builtin/internal/index.js.map +0 -1
  211. package/src/eth/builtin/internal/weth9-processor.d.ts +0 -172
  212. package/src/eth/builtin/internal/weth9-processor.d.ts.map +0 -1
  213. package/src/eth/builtin/internal/weth9-processor.js +0 -729
  214. package/src/eth/builtin/internal/weth9-processor.js.map +0 -1
  215. package/src/eth/builtin/internal/weth9-test-utils.d.ts +0 -7
  216. package/src/eth/builtin/internal/weth9-test-utils.d.ts.map +0 -1
  217. package/src/eth/builtin/internal/weth9-test-utils.js +0 -55
  218. package/src/eth/builtin/internal/weth9-test-utils.js.map +0 -1
  219. package/src/eth/builtin/weth9.d.ts +0 -5
  220. package/src/eth/builtin/weth9.d.ts.map +0 -1
  221. package/src/eth/builtin/weth9.js +0 -8
  222. package/src/eth/builtin/weth9.js.map +0 -1
  223. package/src/solana/builtin/index.d.ts +0 -2
  224. package/src/solana/builtin/index.d.ts.map +0 -1
  225. package/src/solana/builtin/index.js +0 -2
  226. package/src/solana/builtin/index.js.map +0 -1
  227. package/src/solana/builtin/spl-token-processor.d.ts +0 -40
  228. package/src/solana/builtin/spl-token-processor.d.ts.map +0 -1
  229. package/src/solana/builtin/spl-token-processor.js +0 -254
  230. package/src/solana/builtin/spl-token-processor.js.map +0 -1
  231. package/src/solana/builtin/types.d.ts +0 -428
  232. package/src/solana/builtin/types.d.ts.map +0 -1
  233. package/src/solana/builtin/types.js +0 -201
  234. package/src/solana/builtin/types.js.map +0 -1
  235. package/src/sui/builtin/0x1.d.ts +0 -114
  236. package/src/sui/builtin/0x1.d.ts.map +0 -1
  237. package/src/sui/builtin/0x1.js +0 -159
  238. package/src/sui/builtin/0x1.js.map +0 -1
  239. package/src/sui/builtin/0x2.d.ts +0 -1250
  240. package/src/sui/builtin/0x2.d.ts.map +0 -1
  241. package/src/sui/builtin/0x2.js +0 -1511
  242. package/src/sui/builtin/0x2.js.map +0 -1
  243. package/src/sui/builtin/0x3.d.ts +0 -774
  244. package/src/sui/builtin/0x3.d.ts.map +0 -1
  245. package/src/sui/builtin/0x3.js +0 -720
  246. package/src/sui/builtin/0x3.js.map +0 -1
  247. package/src/sui/builtin/index.d.ts +0 -4
  248. package/src/sui/builtin/index.d.ts.map +0 -1
  249. package/src/sui/builtin/index.js +0 -7
  250. package/src/sui/builtin/index.js.map +0 -1
@@ -1,323 +0,0 @@
1
- import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import {
3
- RichValue_NullValue,
4
- toBigDecimal,
5
- toBigInteger
6
- } from "./chunk-2F2KNF4Z.js";
7
- import {
8
- BigDecimal
9
- } from "./chunk-J5UEW4B7.js";
10
- import {
11
- __name
12
- } from "./chunk-R7PMHHKJ.js";
13
-
14
- // src/store/convert.ts
15
- var ValueRequiredError = new Error("Value is required but received null or undefined");
16
- function required_(converter) {
17
- const { from, to, ...rest } = converter;
18
- return {
19
- from: /* @__PURE__ */ __name((value) => {
20
- if (value == null) {
21
- throw ValueRequiredError;
22
- }
23
- return from(value);
24
- }, "from"),
25
- to: /* @__PURE__ */ __name((value) => {
26
- if (value == null || value.nullValue) {
27
- throw ValueRequiredError;
28
- }
29
- return to(value);
30
- }, "to"),
31
- ...rest,
32
- required: true
33
- };
34
- }
35
- __name(required_, "required_");
36
- function array_(converter) {
37
- return {
38
- from: /* @__PURE__ */ __name((value) => {
39
- return {
40
- listValue: {
41
- values: value.map(converter.from)
42
- }
43
- };
44
- }, "from"),
45
- to: /* @__PURE__ */ __name((value) => {
46
- return value.listValue?.values.map(converter.to) || [];
47
- }, "to"),
48
- isArray: true,
49
- isRelation: converter.isRelation,
50
- relationName: converter.relationName
51
- };
52
- }
53
- __name(array_, "array_");
54
- function enumerate_(values) {
55
- return {
56
- from: /* @__PURE__ */ __name((value) => {
57
- if (value == null) {
58
- return {
59
- nullValue: RichValue_NullValue.NULL_VALUE
60
- };
61
- }
62
- return {
63
- stringValue: values[value]
64
- };
65
- }, "from"),
66
- to(v) {
67
- return v.stringValue;
68
- }
69
- };
70
- }
71
- __name(enumerate_, "enumerate_");
72
- function objectId_(entityName) {
73
- return {
74
- from: /* @__PURE__ */ __name((value) => {
75
- if (typeof value == "string") {
76
- return {
77
- stringValue: value
78
- };
79
- }
80
- if (value instanceof Uint8Array) {
81
- return {
82
- stringValue: `0x${Buffer.from(value).toString("hex")}`
83
- };
84
- }
85
- if (typeof value == "object") {
86
- const entity = value;
87
- return {
88
- stringValue: entity.id.toString()
89
- };
90
- }
91
- return {
92
- nullValue: RichValue_NullValue.NULL_VALUE
93
- };
94
- }, "from"),
95
- to(v) {
96
- return v.stringValue;
97
- },
98
- isRelation: true,
99
- relationName: entityName
100
- };
101
- }
102
- __name(objectId_, "objectId_");
103
- var StringConverter = {
104
- from: /* @__PURE__ */ __name((value) => {
105
- if (value == null) {
106
- return {
107
- nullValue: RichValue_NullValue.NULL_VALUE
108
- };
109
- }
110
- return {
111
- stringValue: value
112
- };
113
- }, "from"),
114
- to(v) {
115
- return v.stringValue;
116
- }
117
- };
118
- var IntConverter = {
119
- from: /* @__PURE__ */ __name((value) => {
120
- if (value == null) {
121
- return {
122
- nullValue: RichValue_NullValue.NULL_VALUE
123
- };
124
- }
125
- return {
126
- intValue: Math.floor(value)
127
- };
128
- }, "from"),
129
- to(v) {
130
- return v.intValue;
131
- }
132
- };
133
- var Int8Converter = {
134
- from: /* @__PURE__ */ __name((value) => {
135
- if (value == null) {
136
- return {
137
- nullValue: RichValue_NullValue.NULL_VALUE
138
- };
139
- }
140
- return {
141
- int64Value: BigInt(value)
142
- };
143
- }, "from"),
144
- to(v) {
145
- return v.int64Value;
146
- }
147
- };
148
- var FloatConverter = {
149
- from: /* @__PURE__ */ __name((value) => {
150
- if (value == null) {
151
- return {
152
- nullValue: RichValue_NullValue.NULL_VALUE
153
- };
154
- }
155
- return {
156
- floatValue: value
157
- };
158
- }, "from"),
159
- to(v) {
160
- return v.floatValue;
161
- }
162
- };
163
- var BooleanConverter = {
164
- from: /* @__PURE__ */ __name((value) => {
165
- if (value == null) {
166
- return {
167
- nullValue: RichValue_NullValue.NULL_VALUE
168
- };
169
- }
170
- return {
171
- boolValue: value
172
- };
173
- }, "from"),
174
- to(v) {
175
- return v.boolValue;
176
- }
177
- };
178
- var TimestampConverter = {
179
- from: /* @__PURE__ */ __name((value) => {
180
- if (value == null) {
181
- return {
182
- nullValue: RichValue_NullValue.NULL_VALUE
183
- };
184
- }
185
- return {
186
- timestampValue: value
187
- };
188
- }, "from"),
189
- to(v) {
190
- return v.timestampValue;
191
- }
192
- };
193
- var BytesConverter = {
194
- from: /* @__PURE__ */ __name((value) => {
195
- if (value == null) {
196
- return {
197
- nullValue: RichValue_NullValue.NULL_VALUE
198
- };
199
- }
200
- return {
201
- bytesValue: value
202
- };
203
- }, "from"),
204
- to(v) {
205
- return v.bytesValue;
206
- }
207
- };
208
- var IDConverter = {
209
- from(value) {
210
- if (typeof value == "string") {
211
- return {
212
- stringValue: value
213
- };
214
- }
215
- if (value instanceof Uint8Array) {
216
- return {
217
- stringValue: `0x${Buffer.from(value).toString("hex")}`
218
- };
219
- }
220
- return {
221
- nullValue: RichValue_NullValue.NULL_VALUE
222
- };
223
- },
224
- to(value) {
225
- if (value.stringValue) {
226
- return value.stringValue;
227
- }
228
- if (value.bytesValue) {
229
- const v = `0x${Buffer.from(value.bytesValue).toString("hex")}`;
230
- return v;
231
- }
232
- return void 0;
233
- }
234
- };
235
- var BigDecimalConverter = {
236
- from: /* @__PURE__ */ __name((value) => {
237
- if (value == null) {
238
- return {
239
- nullValue: RichValue_NullValue.NULL_VALUE
240
- };
241
- }
242
- return { bigdecimalValue: toBigDecimal(value) };
243
- }, "from"),
244
- to(v) {
245
- const d = v.bigdecimalValue;
246
- if (d) {
247
- const i = bytesToBigInt(d.value.data);
248
- let ret = new BigDecimal(i.toString());
249
- if (d.exp < 0) {
250
- ret = ret.dividedBy(new BigDecimal(10).pow(-d.exp));
251
- } else {
252
- ret = ret.multipliedBy(new BigDecimal(10).pow(d.exp));
253
- }
254
- return ret.multipliedBy(d.value?.negative ? -1 : 1);
255
- }
256
- return void 0;
257
- }
258
- };
259
- var BigIntConverter = {
260
- from: /* @__PURE__ */ __name((value) => {
261
- if (value == null) {
262
- return {
263
- nullValue: RichValue_NullValue.NULL_VALUE
264
- };
265
- }
266
- return {
267
- bigintValue: toBigInteger(value)
268
- };
269
- }, "from"),
270
- to(v) {
271
- if (v.bigintValue) {
272
- let res = bytesToBigInt(v.bigintValue?.data);
273
- if (v.bigintValue.negative) {
274
- res = -res;
275
- }
276
- return res;
277
- }
278
- return void 0;
279
- }
280
- };
281
- function bytesToBigInt(bytes) {
282
- let intValue = BigInt(0);
283
- for (let i = 0; i < bytes.length; i++) {
284
- intValue = intValue * BigInt(256) + BigInt(bytes[i]);
285
- }
286
- return intValue;
287
- }
288
- __name(bytesToBigInt, "bytesToBigInt");
289
- var TypeConverters = {
290
- BigDecimal: BigDecimalConverter,
291
- BigInt: BigIntConverter,
292
- String: StringConverter,
293
- Boolean: BooleanConverter,
294
- Uint8Array: BytesConverter,
295
- ID: IDConverter,
296
- Bytes: BytesConverter,
297
- Int: IntConverter,
298
- Int8: Int8Converter,
299
- Float: FloatConverter,
300
- Timestamp: TimestampConverter
301
- };
302
- import("node:process").then((p) => p.stdout.write(""));
303
-
304
- export {
305
- ValueRequiredError,
306
- required_,
307
- array_,
308
- enumerate_,
309
- objectId_,
310
- StringConverter,
311
- IntConverter,
312
- Int8Converter,
313
- FloatConverter,
314
- BooleanConverter,
315
- TimestampConverter,
316
- BytesConverter,
317
- IDConverter,
318
- BigDecimalConverter,
319
- BigIntConverter,
320
- bytesToBigInt,
321
- TypeConverters
322
- };
323
- //# sourceMappingURL=chunk-ONBEMKI5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/store/convert.ts"],"sourcesContent":["import { RichValue, RichValue_NullValue } from '@sentio/protos'\nimport type { String, Int, Float, ID, Bytes, Timestamp, Boolean } from './types.js'\nimport { BigDecimal } from '@sentio/bigdecimal'\nimport { toBigInteger, toBigDecimal } from '../core/numberish.js'\n\nexport interface ValueConverter<T> {\n from: (value: T) => RichValue\n to: (value: RichValue) => T\n required?: boolean\n isArray?: boolean\n isRelation?: boolean\n relationName?: string\n}\n\nexport const ValueRequiredError = new Error('Value is required but received null or undefined')\n\nexport function required_<T>(converter: ValueConverter<T | undefined>): ValueConverter<T> {\n const { from, to, ...rest } = converter\n return {\n from: (value: T | undefined) => {\n if (value == null) {\n throw ValueRequiredError\n }\n return from(value)\n },\n to: (value: RichValue) => {\n if (value == null || value.nullValue) {\n throw ValueRequiredError\n }\n return to(value)!\n },\n ...rest,\n required: true\n }\n}\n\nexport function array_<T>(converter: ValueConverter<T>): ValueConverter<T[]> {\n return {\n from: (value: T[]) => {\n return {\n listValue: {\n values: value.map(converter.from)\n }\n }\n },\n to: (value: RichValue) => {\n return value.listValue?.values.map(converter.to) || []\n },\n isArray: true,\n isRelation: converter.isRelation,\n relationName: converter.relationName\n }\n}\n\nexport function enumerate_<T extends string | number>(values: Record<T, string>): ValueConverter<T> {\n return {\n from: (value?: T) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n stringValue: values[value]\n }\n },\n to(v: RichValue): T {\n return v.stringValue as T\n }\n }\n}\n\nexport function objectId_<T>(entityName: string): ValueConverter<T | ID> {\n return {\n from: (value: T | ID) => {\n if (typeof value == 'string') {\n return {\n stringValue: value\n }\n }\n if (value instanceof Uint8Array) {\n return {\n stringValue: `0x${Buffer.from(value).toString('hex')}`\n }\n }\n\n if (typeof value == 'object') {\n const entity = value as any\n return {\n stringValue: entity.id.toString()\n }\n }\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n },\n to(v) {\n return v.stringValue as T | ID\n },\n isRelation: true,\n relationName: entityName\n }\n}\n\nexport const StringConverter: ValueConverter<String | undefined> = {\n from: (value?: String) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n stringValue: value\n }\n },\n to(v) {\n return v.stringValue\n }\n}\n\nexport const IntConverter: ValueConverter<Int | undefined> = {\n from: (value?: Int) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n intValue: Math.floor(value)\n }\n },\n to(v) {\n return v.intValue as Int\n }\n}\n\nexport const Int8Converter: ValueConverter<bigint | undefined> = {\n from: (value?: bigint) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n int64Value: BigInt(value)\n }\n },\n to(v) {\n return v.int64Value\n }\n}\n\nexport const FloatConverter: ValueConverter<Float | undefined> = {\n from: (value?: Float) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n floatValue: value\n }\n },\n to(v) {\n return v.floatValue\n }\n}\n\nexport const BooleanConverter: ValueConverter<Boolean | undefined> = {\n from: (value?: Boolean) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n boolValue: value\n }\n },\n to(v) {\n return v.boolValue\n }\n}\n\nexport const TimestampConverter: ValueConverter<Timestamp | undefined> = {\n from: (value: Timestamp | undefined) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n timestampValue: value\n }\n },\n to(v) {\n return v.timestampValue\n }\n}\n\nexport const BytesConverter: ValueConverter<Bytes | undefined> = {\n from: (value?: Bytes) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n bytesValue: value\n }\n },\n to(v) {\n return v.bytesValue\n }\n}\n\nexport const IDConverter: ValueConverter<ID | undefined> = {\n from(value: ID | undefined): RichValue {\n if (typeof value == 'string') {\n return {\n stringValue: value\n }\n }\n if (value instanceof Uint8Array) {\n return {\n stringValue: `0x${Buffer.from(value).toString('hex')}`\n }\n }\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n },\n to(value: RichValue): ID | undefined {\n if (value.stringValue) {\n return value.stringValue as ID\n }\n if (value.bytesValue) {\n const v = `0x${Buffer.from(value.bytesValue).toString('hex')}`\n return v as ID\n }\n return undefined\n }\n}\n\nexport const BigDecimalConverter: ValueConverter<BigDecimal | undefined> = {\n from: (value?: BigDecimal): RichValue => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return { bigdecimalValue: toBigDecimal(value) }\n },\n to(v) {\n const d = v.bigdecimalValue\n if (d) {\n const i = bytesToBigInt(d.value!.data)\n let ret = new BigDecimal(i.toString())\n if (d.exp < 0) {\n ret = ret.dividedBy(new BigDecimal(10).pow(-d.exp))\n } else {\n ret = ret.multipliedBy(new BigDecimal(10).pow(d.exp))\n }\n return ret.multipliedBy(d.value?.negative ? -1 : 1)\n }\n return undefined\n }\n}\n\nexport const BigIntConverter: ValueConverter<bigint | undefined> = {\n from: (value?: bigint) => {\n if (value == null) {\n return {\n nullValue: RichValue_NullValue.NULL_VALUE\n }\n }\n return {\n bigintValue: toBigInteger(value)\n }\n },\n to(v) {\n if (v.bigintValue) {\n let res = bytesToBigInt(v.bigintValue?.data)\n if (v.bigintValue.negative) {\n res = -res\n }\n return res\n }\n return undefined\n }\n}\n\nexport function bytesToBigInt(bytes: Uint8Array) {\n let intValue = BigInt(0)\n for (let i = 0; i < bytes.length; i++) {\n intValue = intValue * BigInt(256) + BigInt(bytes[i])\n }\n return intValue\n}\n\nexport const TypeConverters: Record<string, ValueConverter<any>> = {\n BigDecimal: BigDecimalConverter,\n BigInt: BigIntConverter,\n String: StringConverter,\n Boolean: BooleanConverter,\n Uint8Array: BytesConverter,\n ID: IDConverter,\n Bytes: BytesConverter,\n Int: IntConverter,\n Int8: Int8Converter,\n Float: FloatConverter,\n Timestamp: TimestampConverter\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;;;;;;;AAcO,IAAM,qBAAqB,IAAI,MAAM,kDAAkD;AAEvF,SAAS,UAAa,WAA6D;AACxF,QAAM,EAAE,MAAM,IAAI,GAAG,KAAK,IAAI;AAC9B,SAAO;AAAA,IACL,MAAM,wBAAC,UAAyB;AAC9B,UAAI,SAAS,MAAM;AACjB,cAAM;AAAA,MACR;AACA,aAAO,KAAK,KAAK;AAAA,IACnB,GALM;AAAA,IAMN,IAAI,wBAAC,UAAqB;AACxB,UAAI,SAAS,QAAQ,MAAM,WAAW;AACpC,cAAM;AAAA,MACR;AACA,aAAO,GAAG,KAAK;AAAA,IACjB,GALI;AAAA,IAMJ,GAAG;AAAA,IACH,UAAU;AAAA,EACZ;AACF;AAlBgB;AAoBT,SAAS,OAAU,WAAmD;AAC3E,SAAO;AAAA,IACL,MAAM,wBAAC,UAAe;AACpB,aAAO;AAAA,QACL,WAAW;AAAA,UACT,QAAQ,MAAM,IAAI,UAAU,IAAI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