@arkiv-network/sdk 0.7.0-dev.1 → 0.8.0-advanced.2

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 (237) hide show
  1. package/README.md +71 -16
  2. package/dist/actions/advanced/index.cjs +13 -0
  3. package/dist/actions/advanced/index.d.cts +8 -0
  4. package/dist/actions/advanced/index.d.ts +9 -0
  5. package/dist/actions/advanced/index.js +9 -0
  6. package/dist/advanced-8ZPTmmaN.js +598 -0
  7. package/dist/advanced-8ZPTmmaN.js.map +1 -0
  8. package/dist/advanced-fPImL6lW.cjs +656 -0
  9. package/dist/arkivTransactions-D74gERHG.d.cts +571 -0
  10. package/dist/arkivTransactions-D74gERHG.d.cts.map +1 -0
  11. package/dist/arkivTransactions-NtGD6uk5.d.ts +571 -0
  12. package/dist/arkivTransactions-NtGD6uk5.d.ts.map +1 -0
  13. package/dist/attr/index.cjs +35 -0
  14. package/dist/attr/index.d.cts +2 -0
  15. package/dist/attr/index.d.ts +3 -0
  16. package/dist/attr/index.js +4 -0
  17. package/dist/attributes-BhY5DwJp.js +809 -0
  18. package/dist/attributes-BhY5DwJp.js.map +1 -0
  19. package/dist/attributes-Df9IsCVs.cjs +1029 -0
  20. package/dist/chains/index.cjs +2 -3
  21. package/dist/chains/index.d.cts +22 -60
  22. package/dist/chains/index.d.cts.map +1 -1
  23. package/dist/chains/index.d.ts +22 -60
  24. package/dist/chains/index.d.ts.map +1 -1
  25. package/dist/chains/index.js +2 -2
  26. package/dist/chains-BJrZs6sG.js +57 -0
  27. package/dist/chains-BJrZs6sG.js.map +1 -0
  28. package/dist/chains-BYRTTipa.cjs +73 -0
  29. package/dist/codec-Car3KkFF.d.ts +102 -0
  30. package/dist/codec-Car3KkFF.d.ts.map +1 -0
  31. package/dist/entity/index.cjs +20 -0
  32. package/dist/entity/index.d.cts +4 -0
  33. package/dist/entity/index.d.ts +5 -0
  34. package/dist/entity/index.js +7 -0
  35. package/dist/entity-B00Li04j.cjs +71 -0
  36. package/dist/entity-B7G8q_Eo.cjs +0 -0
  37. package/dist/entity-BYQR1uoe.js +67 -0
  38. package/dist/entity-BYQR1uoe.js.map +1 -0
  39. package/dist/entity-CD_qFF2M.js +0 -0
  40. package/dist/errors-BVbjKVMN.cjs +56 -0
  41. package/dist/errors-LTe7bOYS.js +33 -0
  42. package/dist/errors-LTe7bOYS.js.map +1 -0
  43. package/dist/expiry-BELY2Kpw.cjs +135 -0
  44. package/dist/expiry-BjpxZZQU.js +95 -0
  45. package/dist/expiry-BjpxZZQU.js.map +1 -0
  46. package/dist/expiry-DRV29F1r.d.cts +79 -0
  47. package/dist/expiry-DRV29F1r.d.cts.map +1 -0
  48. package/dist/expiry-nDbCgZX4.d.ts +79 -0
  49. package/dist/expiry-nDbCgZX4.d.ts.map +1 -0
  50. package/dist/flags-5dTNRnow.d.ts +41 -0
  51. package/dist/flags-5dTNRnow.d.ts.map +1 -0
  52. package/dist/flags-CRjPpoh3.d.cts +41 -0
  53. package/dist/flags-CRjPpoh3.d.cts.map +1 -0
  54. package/dist/flags-DFBs2J94.js +33 -0
  55. package/dist/flags-DFBs2J94.js.map +1 -0
  56. package/dist/flags-kr276q6i.cjs +43 -0
  57. package/dist/index-B5j76711.d.ts +184 -0
  58. package/dist/index-B5j76711.d.ts.map +1 -0
  59. package/dist/index-BF7Mq9Is.d.cts +280 -0
  60. package/dist/index-BF7Mq9Is.d.cts.map +1 -0
  61. package/dist/index-CA4V7Pdh.d.cts +167 -0
  62. package/dist/index-CA4V7Pdh.d.cts.map +1 -0
  63. package/dist/index-CV5zCdpa.d.cts +417 -0
  64. package/dist/index-CV5zCdpa.d.cts.map +1 -0
  65. package/dist/index-DHDud2hC.d.ts +280 -0
  66. package/dist/index-DHDud2hC.d.ts.map +1 -0
  67. package/dist/index-DvYvrkdk.d.ts +320 -0
  68. package/dist/index-DvYvrkdk.d.ts.map +1 -0
  69. package/dist/index-EeUO0nnJ.d.cts +184 -0
  70. package/dist/index-EeUO0nnJ.d.cts.map +1 -0
  71. package/dist/index-fX_XyqLp.d.ts +167 -0
  72. package/dist/index-fX_XyqLp.d.ts.map +1 -0
  73. package/dist/index.cjs +411 -405
  74. package/dist/index.d.cts +360 -209
  75. package/dist/index.d.cts.map +1 -1
  76. package/dist/index.d.ts +361 -209
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +342 -387
  79. package/dist/index.js.map +1 -1
  80. package/dist/key-D1Bh7MF0.js +70 -0
  81. package/dist/key-D1Bh7MF0.js.map +1 -0
  82. package/dist/key-WKhXnXuU.cjs +98 -0
  83. package/dist/logger-CVpvU8ik.js +153 -0
  84. package/dist/logger-CVpvU8ik.js.map +1 -0
  85. package/dist/logger-Cr15lPAQ.cjs +188 -0
  86. package/dist/payload-BNoud2KZ.d.cts +94 -0
  87. package/dist/payload-BNoud2KZ.d.cts.map +1 -0
  88. package/dist/payload-Bz6651ax.js +67 -0
  89. package/dist/payload-Bz6651ax.js.map +1 -0
  90. package/dist/payload-CcUj85ys.d.ts +94 -0
  91. package/dist/payload-CcUj85ys.d.ts.map +1 -0
  92. package/dist/payload-KC14SDlN.cjs +83 -0
  93. package/dist/query/index.cjs +26 -150
  94. package/dist/query/index.d.cts +5 -3
  95. package/dist/query/index.d.ts +6 -3
  96. package/dist/query/index.js +8 -138
  97. package/dist/queryBuilder-DM6AWCBa.js +820 -0
  98. package/dist/queryBuilder-DM6AWCBa.js.map +1 -0
  99. package/dist/queryBuilder-DbUMEZln.cjs +944 -0
  100. package/dist/selection-C4UhsMOO.d.ts +434 -0
  101. package/dist/selection-C4UhsMOO.d.ts.map +1 -0
  102. package/dist/selection-DPg0uyJf.d.cts +433 -0
  103. package/dist/selection-DPg0uyJf.d.cts.map +1 -0
  104. package/dist/types/index.cjs +3 -3
  105. package/dist/types/index.d.cts +7 -2
  106. package/dist/types/index.d.ts +8 -2
  107. package/dist/types/index.js +3 -3
  108. package/dist/types-Bu_ZwMbZ.js +0 -0
  109. package/dist/types-NRqymi6S.cjs +0 -0
  110. package/dist/utils/index.cjs +4 -17
  111. package/dist/utils/index.d.cts +3 -17
  112. package/dist/utils/index.d.ts +3 -17
  113. package/dist/utils/index.js +4 -18
  114. package/package.json +26 -5
  115. package/src/actions/advanced/advanced.test.ts +258 -0
  116. package/src/actions/advanced/buildMutation.ts +104 -0
  117. package/src/actions/advanced/getMutationResult.ts +112 -0
  118. package/src/actions/advanced/index.ts +21 -0
  119. package/src/actions/advanced/pingTransaction.ts +43 -0
  120. package/src/actions/advanced/sendMutation.ts +59 -0
  121. package/src/actions/public/getEntity.ts +27 -43
  122. package/src/actions/public/getEntityNonce.ts +30 -0
  123. package/src/actions/public/predictEntityKeys.test.ts +143 -0
  124. package/src/actions/public/predictEntityKeys.ts +138 -0
  125. package/src/actions/public/query.ts +35 -67
  126. package/src/actions/public/watchEntityEvents.test.ts +414 -0
  127. package/src/actions/public/watchEntityEvents.ts +225 -0
  128. package/src/actions/wallet/changeOwnership.ts +2 -2
  129. package/src/actions/wallet/createEntity.ts +99 -24
  130. package/src/actions/wallet/extendEntity.ts +37 -13
  131. package/src/actions/wallet/mutateEntities.test.ts +76 -0
  132. package/src/actions/wallet/mutateEntities.ts +16 -33
  133. package/src/actions/wallet/patchEntity.ts +90 -0
  134. package/src/attr/attributes.test.ts +120 -0
  135. package/src/attr/attributes.ts +190 -0
  136. package/src/attr/codec.test.ts +162 -0
  137. package/src/attr/codec.ts +220 -0
  138. package/src/attr/decimal.ts +86 -0
  139. package/src/attr/errors.ts +145 -0
  140. package/src/attr/index.ts +50 -0
  141. package/src/attr/names.ts +106 -0
  142. package/src/attr/types.ts +150 -0
  143. package/src/attr/values.test.ts +271 -0
  144. package/src/attr/values.ts +502 -0
  145. package/src/chains/cheesecake.ts +22 -0
  146. package/src/chains/index.ts +1 -2
  147. package/src/clients/createPublicClient.test.ts +3 -5
  148. package/src/clients/createPublicClient.ts +5 -4
  149. package/src/clients/createWalletClient.test.ts +2 -2
  150. package/src/clients/createWalletClient.ts +13 -7
  151. package/src/clients/decorators/arkivAdvanced.ts +144 -0
  152. package/src/clients/decorators/arkivPublic.ts +172 -139
  153. package/src/clients/decorators/arkivWallet.ts +101 -94
  154. package/src/entity/create.test.ts +184 -0
  155. package/src/entity/errors.ts +38 -0
  156. package/src/entity/events.ts +16 -0
  157. package/src/entity/expiry.test.ts +195 -0
  158. package/src/entity/expiry.ts +181 -0
  159. package/src/entity/flags.ts +65 -0
  160. package/src/entity/index.ts +15 -0
  161. package/src/entity/key.ts +68 -0
  162. package/src/entity/operations.ts +134 -0
  163. package/src/entity/params.ts +15 -0
  164. package/src/errors.ts +26 -49
  165. package/src/index.ts +19 -0
  166. package/src/query/engine.ts +68 -137
  167. package/src/query/errors.ts +151 -0
  168. package/src/query/expression.test.ts +286 -0
  169. package/src/query/expression.ts +493 -0
  170. package/src/query/index.ts +40 -4
  171. package/src/query/injection.test.ts +151 -0
  172. package/src/query/queryBuilder.test.ts +342 -637
  173. package/src/query/queryBuilder.ts +133 -359
  174. package/src/query/queryResult.ts +54 -51
  175. package/src/query/selection.test.ts +48 -98
  176. package/src/query/selection.ts +77 -65
  177. package/src/types/entity.test.ts +44 -155
  178. package/src/types/entity.ts +60 -52
  179. package/src/types/events.ts +59 -16
  180. package/src/types/index.ts +20 -17
  181. package/src/types/rpcSchema.ts +69 -37
  182. package/src/utils/arkivTransactions.test.ts +600 -155
  183. package/src/utils/arkivTransactions.ts +350 -219
  184. package/src/utils/chains.test.ts +21 -24
  185. package/src/utils/compression.ts +1 -1
  186. package/src/utils/entities.test.ts +62 -0
  187. package/src/utils/entities.ts +109 -37
  188. package/src/utils/expirationTime.ts +114 -10
  189. package/src/utils/logger.ts +2 -2
  190. package/src/utils/revert.test.ts +99 -0
  191. package/src/utils/revert.ts +145 -0
  192. package/dist/chains-BifaY04V.cjs +0 -108
  193. package/dist/chains-CrtkVbBh.js +0 -86
  194. package/dist/chains-CrtkVbBh.js.map +0 -1
  195. package/dist/consts-Bz0LZQZY.js +0 -7
  196. package/dist/consts-Bz0LZQZY.js.map +0 -1
  197. package/dist/consts-CxT1-RXU.cjs +0 -18
  198. package/dist/entity-BhSXaB23.cjs +0 -81
  199. package/dist/entity-CN41IOrq.d.cts +0 -401
  200. package/dist/entity-CN41IOrq.d.cts.map +0 -1
  201. package/dist/entity-DGfVyB-a.js +0 -71
  202. package/dist/entity-DGfVyB-a.js.map +0 -1
  203. package/dist/entity-NnEVlePN.d.ts +0 -401
  204. package/dist/entity-NnEVlePN.d.ts.map +0 -1
  205. package/dist/index-ClkpS6s_.d.ts +0 -481
  206. package/dist/index-ClkpS6s_.d.ts.map +0 -1
  207. package/dist/index-w4qop0Pe.d.cts +0 -481
  208. package/dist/index-w4qop0Pe.d.cts.map +0 -1
  209. package/dist/payload-BpNUPOnY.js +0 -13
  210. package/dist/payload-BpNUPOnY.js.map +0 -1
  211. package/dist/payload-C2KHOUoj.d.ts +0 -6
  212. package/dist/payload-C2KHOUoj.d.ts.map +0 -1
  213. package/dist/payload-CJN8fTvX.d.cts +0 -6
  214. package/dist/payload-CJN8fTvX.d.cts.map +0 -1
  215. package/dist/payload-D8YLKcJj.cjs +0 -23
  216. package/dist/query/index.js.map +0 -1
  217. package/dist/queryBuilder-BE_XhLLa.js +0 -735
  218. package/dist/queryBuilder-BE_XhLLa.js.map +0 -1
  219. package/dist/queryBuilder-J37buGCi.cjs +0 -865
  220. package/dist/utils/index.d.cts.map +0 -1
  221. package/dist/utils/index.d.ts.map +0 -1
  222. package/dist/utils/index.js.map +0 -1
  223. package/src/actions/public/buildQuery.ts +0 -10
  224. package/src/actions/public/subscribeEntityEvents.ts +0 -93
  225. package/src/actions/wallet/updateEntity.ts +0 -59
  226. package/src/chains/braga.ts +0 -26
  227. package/src/chains/kaolin.ts +0 -29
  228. package/src/query/engine.test.ts +0 -571
  229. package/src/query/predicate.test.ts +0 -461
  230. package/src/query/predicate.ts +0 -144
  231. package/src/query/queryResult.test.ts +0 -270
  232. package/src/query/selectQueryBuilder.test.ts +0 -213
  233. package/src/types/attributes.ts +0 -28
  234. package/src/utils/validation.test.ts +0 -106
  235. package/src/utils/validation.ts +0 -80
  236. /package/dist/{types-Ci4BRClw.js → attr-DlmErkvR.cjs} +0 -0
  237. /package/dist/{types-a8gm_IaQ.cjs → attr-GcQKatub.js} +0 -0
@@ -0,0 +1,41 @@
1
+ //#region src/entity/flags.d.ts
2
+ /**
3
+ * The immutable properties an entity is created with. Both default to `false`.
4
+ *
5
+ * Creation flags are fixed at creation: there is no operation that changes them, so an entity is
6
+ * whatever it was created as for its whole life.
7
+ */
8
+ type CreationFlags = {
9
+ /**
10
+ * The entity's attributes and payload can never be changed — only its expiry extended, its
11
+ * ownership transferred, and the entity deleted.
12
+ */
13
+ readonly?: boolean;
14
+ /**
15
+ * Anyone, not just the owner, may extend the entity's expiry. Lets a third party keep something
16
+ * alive without being able to change it.
17
+ */
18
+ permissionlessExtension?: boolean;
19
+ };
20
+ /** {@link CreationFlags} as read back, with every flag resolved and the raw byte alongside. */
21
+ type ResolvedCreationFlags = {
22
+ readonly: boolean;
23
+ permissionlessExtension: boolean;
24
+ raw: number;
25
+ };
26
+ /**
27
+ * Packs creation flags into the `creationFlags` byte.
28
+ *
29
+ * @throws {InvalidCreationFlagsError} If a value is not a boolean.
30
+ */
31
+ declare function encodeCreationFlags(flags?: CreationFlags): number;
32
+ /**
33
+ * Reads the `creationFlags` byte back.
34
+ *
35
+ * @param raw - The `creationFlags` byte.
36
+ * @throws {InvalidCreationFlagsError} Malformed input
37
+ */
38
+ declare function decodeCreationFlags(raw: number): ResolvedCreationFlags;
39
+ //#endregion
40
+ export { encodeCreationFlags as i, ResolvedCreationFlags as n, decodeCreationFlags as r, CreationFlags as t };
41
+ //# sourceMappingURL=flags-CRjPpoh3.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags-CRjPpoh3.d.cts","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":[],"mappings":";;AAYA;AAcA;AAWA;AAkBA;;KA3CY,aAAA;;;;;;;;;;;;;KAcA,qBAAA;;;;;;;;;;iBAWI,mBAAA,SAA2B;;;;;;;iBAkB3B,mBAAA,eAAkC"}
@@ -0,0 +1,33 @@
1
+ import { t as InvalidCreationFlagsError } from "./errors-LTe7bOYS.js";
2
+
3
+ //#region src/entity/flags.ts
4
+ /** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */
5
+ const READONLY_BIT = 1;
6
+ const PERMISSIONLESS_EXTENSION_BIT = 2;
7
+ /**
8
+ * Packs creation flags into the `creationFlags` byte.
9
+ *
10
+ * @throws {InvalidCreationFlagsError} If a value is not a boolean.
11
+ */
12
+ function encodeCreationFlags(flags = {}) {
13
+ for (const [name, value] of Object.entries(flags)) if (value !== void 0 && typeof value !== "boolean") throw new InvalidCreationFlagsError(`"${name}" must be a boolean, got ${typeof value}`);
14
+ return (flags.readonly ? READONLY_BIT : 0) | (flags.permissionlessExtension ? PERMISSIONLESS_EXTENSION_BIT : 0);
15
+ }
16
+ /**
17
+ * Reads the `creationFlags` byte back.
18
+ *
19
+ * @param raw - The `creationFlags` byte.
20
+ * @throws {InvalidCreationFlagsError} Malformed input
21
+ */
22
+ function decodeCreationFlags(raw) {
23
+ if (!Number.isInteger(raw) || raw < 0 || raw > 255) throw new InvalidCreationFlagsError(`${raw} is not a byte`);
24
+ return {
25
+ readonly: (raw & READONLY_BIT) !== 0,
26
+ permissionlessExtension: (raw & PERMISSIONLESS_EXTENSION_BIT) !== 0,
27
+ raw
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ export { encodeCreationFlags as n, decodeCreationFlags as t };
33
+ //# sourceMappingURL=flags-DFBs2J94.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags-DFBs2J94.js","names":[],"sources":["../src/entity/flags.ts"],"sourcesContent":["import { InvalidCreationFlagsError } from \"./errors\"\n\n/** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */\nconst READONLY_BIT = 0b0000_0001\nconst PERMISSIONLESS_EXTENSION_BIT = 0b0000_0010\n\n/**\n * The immutable properties an entity is created with. Both default to `false`.\n *\n * Creation flags are fixed at creation: there is no operation that changes them, so an entity is\n * whatever it was created as for its whole life.\n */\nexport type CreationFlags = {\n /**\n * The entity's attributes and payload can never be changed — only its expiry extended, its\n * ownership transferred, and the entity deleted.\n */\n readonly?: boolean\n /**\n * Anyone, not just the owner, may extend the entity's expiry. Lets a third party keep something\n * alive without being able to change it.\n */\n permissionlessExtension?: boolean\n}\n\n/** {@link CreationFlags} as read back, with every flag resolved and the raw byte alongside. */\nexport type ResolvedCreationFlags = {\n readonly: boolean\n permissionlessExtension: boolean\n raw: number\n}\n\n/**\n * Packs creation flags into the `creationFlags` byte.\n *\n * @throws {InvalidCreationFlagsError} If a value is not a boolean.\n */\nexport function encodeCreationFlags(flags: CreationFlags = {}): number {\n for (const [name, value] of Object.entries(flags)) {\n if (value !== undefined && typeof value !== \"boolean\") {\n throw new InvalidCreationFlagsError(`\"${name}\" must be a boolean, got ${typeof value}`)\n }\n }\n return (\n (flags.readonly ? READONLY_BIT : 0) |\n (flags.permissionlessExtension ? PERMISSIONLESS_EXTENSION_BIT : 0)\n )\n}\n\n/**\n * Reads the `creationFlags` byte back.\n *\n * @param raw - The `creationFlags` byte.\n * @throws {InvalidCreationFlagsError} Malformed input\n */\nexport function decodeCreationFlags(raw: number): ResolvedCreationFlags {\n if (!Number.isInteger(raw) || raw < 0 || raw > 0xff) {\n throw new InvalidCreationFlagsError(`${raw} is not a byte`)\n }\n return {\n readonly: (raw & READONLY_BIT) !== 0,\n permissionlessExtension: (raw & PERMISSIONLESS_EXTENSION_BIT) !== 0,\n raw,\n }\n}\n"],"mappings":";;;;AAGA,MAAM,eAAe;AACrB,MAAM,+BAA+B;;;;;;AAiCrC,SAAgB,oBAAoB,QAAuB,EAAE,EAAU;AACrE,MAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,CAC/C,KAAI,UAAU,UAAa,OAAO,UAAU,UAC1C,OAAM,IAAI,0BAA0B,IAAI,KAAK,2BAA2B,OAAO,QAAQ;AAG3F,SACG,MAAM,WAAW,eAAe,MAChC,MAAM,0BAA0B,+BAA+B;;;;;;;;AAUpE,SAAgB,oBAAoB,KAAoC;AACtE,KAAI,CAAC,OAAO,UAAU,IAAI,IAAI,MAAM,KAAK,MAAM,IAC7C,OAAM,IAAI,0BAA0B,GAAG,IAAI,gBAAgB;AAE7D,QAAO;EACL,WAAW,MAAM,kBAAkB;EACnC,0BAA0B,MAAM,kCAAkC;EAClE;EACD"}
@@ -0,0 +1,43 @@
1
+ const require_errors = require('./errors-BVbjKVMN.cjs');
2
+
3
+ //#region src/entity/flags.ts
4
+ /** Bit positions in the `creationFlags` byte. Bits 2-7 are reserved and must be zero. */
5
+ const READONLY_BIT = 1;
6
+ const PERMISSIONLESS_EXTENSION_BIT = 2;
7
+ /**
8
+ * Packs creation flags into the `creationFlags` byte.
9
+ *
10
+ * @throws {InvalidCreationFlagsError} If a value is not a boolean.
11
+ */
12
+ function encodeCreationFlags(flags = {}) {
13
+ for (const [name, value] of Object.entries(flags)) if (value !== void 0 && typeof value !== "boolean") throw new require_errors.InvalidCreationFlagsError(`"${name}" must be a boolean, got ${typeof value}`);
14
+ return (flags.readonly ? READONLY_BIT : 0) | (flags.permissionlessExtension ? PERMISSIONLESS_EXTENSION_BIT : 0);
15
+ }
16
+ /**
17
+ * Reads the `creationFlags` byte back.
18
+ *
19
+ * @param raw - The `creationFlags` byte.
20
+ * @throws {InvalidCreationFlagsError} Malformed input
21
+ */
22
+ function decodeCreationFlags(raw) {
23
+ if (!Number.isInteger(raw) || raw < 0 || raw > 255) throw new require_errors.InvalidCreationFlagsError(`${raw} is not a byte`);
24
+ return {
25
+ readonly: (raw & READONLY_BIT) !== 0,
26
+ permissionlessExtension: (raw & PERMISSIONLESS_EXTENSION_BIT) !== 0,
27
+ raw
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ Object.defineProperty(exports, 'decodeCreationFlags', {
33
+ enumerable: true,
34
+ get: function () {
35
+ return decodeCreationFlags;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, 'encodeCreationFlags', {
39
+ enumerable: true,
40
+ get: function () {
41
+ return encodeCreationFlags;
42
+ }
43
+ });
@@ -0,0 +1,184 @@
1
+ import { j as ArkivClient } from "./selection-C4UhsMOO.js";
2
+ import { f as Operation } from "./index-fX_XyqLp.js";
3
+ import { c as TxParams, t as EntityMutationOps } from "./arkivTransactions-NtGD6uk5.js";
4
+ import { Address, Hash, Hex, TransactionReceipt } from "viem";
5
+
6
+ //#region src/actions/advanced/buildMutation.d.ts
7
+ /** Options for the advanced-path builders ({@link buildMutation}, {@link sendMutation}). */
8
+ type BuildMutationOptions = {
9
+ /**
10
+ * The chain head to resolve relative expiries against.
11
+ *
12
+ * Pass a block number you already hold — from a previous call, `getBlockTiming()`, or your own
13
+ * tracking — and the build spends no RPC call at all. Without it, one `eth_blockNumber` is made,
14
+ * and only when the batch actually needs the head (a relative lifetime or a `Date` deadline);
15
+ * purely absolute `atBlock(n)` expiries never trigger it.
16
+ *
17
+ * Supplying it also buys back a check: absolute expiries are validated against it, so an
18
+ * `atBlock(n)` already in the past throws {@link InvalidExpiryError} locally instead of
19
+ * reverting on-chain. When the head is neither supplied nor fetched, that dead-on-arrival
20
+ * check is skipped — the one local validation of the everyday path this path trades away.
21
+ */
22
+ currentBlock?: bigint;
23
+ };
24
+ /** What {@link buildMutation} hands back: the batch in every form a sender might want. */
25
+ type BuildMutationReturnType = {
26
+ /** The encoded batch, in engine order, for `writeContract`-style sends. */
27
+ operations: Operation[];
28
+ /** The Arkiv engine address the transaction must be sent to. */
29
+ to: Address;
30
+ /**
31
+ * The full `execute(operations)` calldata. Sign a transaction carrying it offline (with your own
32
+ * nonce, gas and fees) and the whole mutation costs exactly one `eth_sendRawTransaction`.
33
+ */
34
+ data: Hex;
35
+ /**
36
+ * How many operations of each kind went into the batch — which is how many events of each kind a
37
+ * successful transaction emits, in batch order, for cross-checking a decoded result.
38
+ */
39
+ expected: {
40
+ creates: number;
41
+ patches: number;
42
+ deletes: number;
43
+ extensions: number;
44
+ ownershipChanges: number;
45
+ };
46
+ };
47
+ /**
48
+ * Encodes a mutation batch without sending anything.
49
+ *
50
+ * This is the first step of the advanced path: it performs only local validation and encoding, so
51
+ * it costs **zero RPC calls** when `options.currentBlock` is provided (or no expiry is relative),
52
+ * and at most one `eth_blockNumber` otherwise. Send the result however you like: pass `operations`
53
+ * to `writeContract`, or sign `{ to, data }` offline and push it with `eth_sendRawTransaction`.
54
+ *
55
+ * One check rides on knowing the head: an absolute `atBlock(n)` already in the past is rejected
56
+ * locally only when the head is supplied or was fetched anyway. With neither, a dead-on-arrival
57
+ * expiry encodes cleanly and the engine reverts it on-chain — see
58
+ * {@link BuildMutationOptions.currentBlock}.
59
+ *
60
+ * @throws {InvalidExpiryError} If an expiry exceeds a protocol bound.
61
+ * @throws {InvalidValueError} If an attribute value does not fit the type it names.
62
+ * @throws {EmptyPatchError} If a patch has nothing to apply.
63
+ */
64
+ declare function buildMutation(client: ArkivClient, data: EntityMutationOps, options?: BuildMutationOptions): Promise<BuildMutationReturnType>;
65
+ //#endregion
66
+ //#region src/actions/advanced/getMutationResult.d.ts
67
+ /**
68
+ * A mined mutation, decoded from its receipt alone.
69
+ *
70
+ * Everything here comes out of the events the batch emitted, so no request context is needed to
71
+ * read it — a process that holds nothing but the transaction hash gets the full picture. Arrays
72
+ * are in batch order, which is the order the operations were applied in.
73
+ */
74
+ type MutationResult = {
75
+ /** `success` means the whole batch applied; `reverted` means none of it did (arrays are empty). */
76
+ status: "success" | "reverted";
77
+ /** The transaction hash. */
78
+ txHash: Hash;
79
+ /** The block the transaction landed in. */
80
+ blockNumber: bigint;
81
+ /** The keys the engine minted for the created entities, in batch order. */
82
+ createdEntities: Hex[];
83
+ /** The block each created entity expires at, as the engine recorded it, in the same order. */
84
+ createdExpiries: bigint[];
85
+ /** The keys of the patched entities. */
86
+ patchedEntities: Hex[];
87
+ /** The keys of the deleted entities. */
88
+ deletedEntities: Hex[];
89
+ /** The keys of the extended entities. */
90
+ extendedEntities: Hex[];
91
+ /** The block each extended entity now expires at, in the same order. */
92
+ extendedExpiries: bigint[];
93
+ /** The keys of the entities handed to a new owner. */
94
+ ownershipChanges: Hex[];
95
+ /** The raw receipt, so nothing the chain said is lost. */
96
+ receipt: TransactionReceipt;
97
+ };
98
+ /** Return type for {@link getMutationResult}: the decoded result, or still pending. */
99
+ type GetMutationResultReturnType = MutationResult | {
100
+ status: "pending";
101
+ };
102
+ /**
103
+ * Decodes a receipt you already hold into a {@link MutationResult}. **Zero RPC calls.**
104
+ *
105
+ * The pure tail of the advanced path: if a receipt reached you some other way — your own
106
+ * `waitForTransactionReceipt`, a webhook, a block watcher — this turns it into entity keys and
107
+ * expiries without touching the network. Lenient by design: it reports what the events say,
108
+ * without counting them against a request it never saw.
109
+ */
110
+ declare function decodeMutationResult(receipt: TransactionReceipt): MutationResult;
111
+ /**
112
+ * Fetches a transaction's receipt — once — and decodes what the mutation did.
113
+ *
114
+ * Exactly one `eth_getTransactionReceipt`, like `pingTransaction`, but the answer carries the
115
+ * decoded entity events as well: created keys, recorded expiries, and the keys of everything
116
+ * patched, deleted, extended or handed over. A transaction that is not mined yet comes back as
117
+ * `{ status: "pending" }` — check `status` before reading the rest.
118
+ *
119
+ * No revert diagnosis is run: a `reverted` result reports the fact and the raw receipt, and
120
+ * spending a `simulateContract` on the why is your call, not the SDK's.
121
+ */
122
+ declare function getMutationResult(client: ArkivClient, txHash: Hash): Promise<GetMutationResultReturnType>;
123
+ //#endregion
124
+ //#region src/actions/advanced/pingTransaction.d.ts
125
+ /** Return type for {@link pingTransaction}. */
126
+ type PingTransactionReturnType = {
127
+ /** Not mined yet (or unknown to this node). Ping again later. */
128
+ status: "pending";
129
+ blockNumber?: undefined;
130
+ } | {
131
+ /** Mined. `success` means the whole batch applied; `reverted` means none of it did. */
132
+ status: "success" | "reverted";
133
+ /** The block the transaction landed in. */
134
+ blockNumber: bigint;
135
+ };
136
+ /**
137
+ * Asks the chain — once — whether a transaction has landed.
138
+ *
139
+ * Exactly one `eth_getTransactionReceipt`, never a poll: a transaction that is not mined yet comes
140
+ * back as `{ status: "pending" }` rather than being waited on. This is the "ping" of the advanced
141
+ * path — you own the schedule, the SDK owns nothing.
142
+ *
143
+ * When it reports `success` and you need the created keys or recorded expiries, spend the next
144
+ * call on `getMutationResult` — or none at all, if you predicted the keys up front with
145
+ * `predictEntityKeys`.
146
+ */
147
+ declare function pingTransaction(client: ArkivClient, txHash: Hash): Promise<PingTransactionReturnType>;
148
+ //#endregion
149
+ //#region src/actions/advanced/sendMutation.d.ts
150
+ /** Options for {@link sendMutation}. */
151
+ type SendMutationOptions = BuildMutationOptions & {
152
+ /**
153
+ * Transaction parameters. Supply `nonce`, `gas` and the fee fields and viem has nothing left to
154
+ * look up — the send collapses to a single `eth_sendRawTransaction`.
155
+ */
156
+ txParams?: TxParams;
157
+ };
158
+ /** Return type for {@link sendMutation}. */
159
+ type SendMutationReturnType = {
160
+ /** The transaction hash. Poll it with `pingTransaction` / fetch it with `getMutationResult`. */
161
+ txHash: Hash;
162
+ /** The per-kind operation counts of the batch that was sent, for cross-checking the result. */
163
+ expected: BuildMutationReturnType["expected"];
164
+ };
165
+ /**
166
+ * Signs and sends a mutation batch, returning as soon as the transaction is submitted.
167
+ *
168
+ * The fire-and-forget half of the advanced path. Unlike `mutateEntities`, this does **not** wait
169
+ * for a receipt, does not poll, and runs no revert diagnosis — it spends only what submitting
170
+ * costs. With `options.currentBlock` and full `txParams` (nonce, gas, fees) that is exactly one
171
+ * RPC call; each omitted piece adds only the lookup viem needs to fill it.
172
+ *
173
+ * Follow up separately, on your own schedule:
174
+ * - `pingTransaction(txHash)` — one `eth_getTransactionReceipt`, tells you pending/success/reverted.
175
+ * - `getMutationResult(txHash)` — the same single call, plus the decoded entity keys and expiries.
176
+ *
177
+ * @throws {EntityMutationError} If the node rejects the submission (the batch never made it into
178
+ * the mempool) — in engine terms when the rejection decodes, with the node's message otherwise.
179
+ * Anything after that — inclusion, success — is yours to check.
180
+ */
181
+ declare function sendMutation(client: ArkivClient, data: EntityMutationOps, options?: SendMutationOptions): Promise<SendMutationReturnType>;
182
+ //#endregion
183
+ export { pingTransaction as a, decodeMutationResult as c, BuildMutationReturnType as d, buildMutation as f, PingTransactionReturnType as i, getMutationResult as l, SendMutationReturnType as n, GetMutationResultReturnType as o, sendMutation as r, MutationResult as s, SendMutationOptions as t, BuildMutationOptions as u };
184
+ //# sourceMappingURL=index-B5j76711.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B5j76711.d.ts","names":[],"sources":["../src/actions/advanced/buildMutation.ts","../src/actions/advanced/getMutationResult.ts","../src/actions/advanced/pingTransaction.ts","../src/actions/advanced/sendMutation.ts"],"sourcesContent":[],"mappings":";;;;;;;KAeY,oBAAA;EAAA;AAkBZ;;;;;AAwCA;;;;;;;;;;AC1DY,KDkBA,uBAAA,GClBc;EAIhB;EAIS,UAAA,EDYL,SCZK,EAAA;EAIA;EAEA,EAAA,EDQb,OCRa;EAEC;;;;EAUR,IAAA,EDCJ,GCDI;EAUI;AA4BhB;;;EAGW,QAAA,EAAA;IAAR,OAAA,EAAA,MAAA;IAAO,OAAA,EAAA,MAAA;;;;EC1EE,CAAA;AAwBZ,CAAA;;;;;;;;;AClBA;AASA;AAuBA;;;;;;;iBH2BsB,aAAA,SACZ,mBACF,6BACG,uBACR,QAAQ;;;;;;;AA9DX;AAkBA;;AAIM,KCtBM,cAAA,GDsBN;EAKE;EAAG,MAAA,EAAA,SAAA,GAAA,UAAA;EA+BW;EACZ,MAAA,ECvDA,IDuDA;EACF;EACG,WAAA,EAAA,MAAA;EACA;EAAR,eAAA,ECtDgB,GDsDhB,EAAA;EAAO;;;mBClDS;EAZP;EAIF,eAAA,EAUS,GAVT,EAAA;EAIS;EAIA,gBAAA,EAIC,GAJD,EAAA;EAEA;EAEC,gBAAA,EAAA,MAAA,EAAA;EAIA;EAET,gBAAA,EAFS,GAET,EAAA;EAAkB;EAIjB,OAAA,EAJD,kBAIC;AAUZ,CAAA;AA4BA;AACU,KAvCE,2BAAA,GAA8B,cAuChC,GAAA;EACA,MAAA,EAAA,SAAA;CACC;;;;;;AC1EX;AAwBA;;AAEU,iBDiBM,oBAAA,CCjBN,OAAA,EDiBoC,kBCjBpC,CAAA,EDiByD,cCjBzD;;;;;;;ACpBV;AASA;AAuBA;;;AAGW,iBF8BW,iBAAA,CE9BX,MAAA,EF+BD,WE/BC,EAAA,MAAA,EFgCD,IEhCC,CAAA,EFiCR,OEjCQ,CFiCA,2BEjCA,CAAA;;;;KDzCC,yBAAA;;;EFOA,WAAA,CAAA,EAAA,SAAoB;AAkBhC,CAAA,GAAY;EAEE;EAER,MAAA,EAAA,SAAA,GAAA,UAAA;EAKE;EAAG,WAAA,EAAA,MAAA;AA+BX,CAAA;;;;;;;;;;AC1DA;;AAQmB,iBCSG,eAAA,CDTH,MAAA,ECUT,WDVS,EAAA,MAAA,ECWT,IDXS,CAAA,ECYhB,ODZgB,CCYR,yBDZQ,CAAA;;;;ADRP,KGDA,mBAAA,GAAsB,oBHCF,GAAA;EAkBpB;;;;EASD,QAAA,CAAA,EGvBE,QHuBF;AA+BX,CAAA;;AAEQ,KGpDI,sBAAA,GHoDJ;EACG;EACA,MAAA,EGpDD,IHoDC;EAAR;EAAO,QAAA,EGlDE,uBHkDF,CAAA,UAAA,CAAA;;;;AC9DV;;;;;;;;;AA0BA;AAUA;AA4BA;;;AAGW,iBEpCW,YAAA,CFoCX,MAAA,EEnCD,WFmCC,EAAA,IAAA,EElCH,iBFkCG,EAAA,OAAA,CAAA,EEjCA,mBFiCA,CAAA,EEhCR,OFgCQ,CEhCA,sBFgCA,CAAA"}
@@ -0,0 +1,280 @@
1
+ import { R as RpcSelect, i as SelectArg, j as ArkivClient, p as Expression, s as Entity } from "./selection-DPg0uyJf.cjs";
2
+ import { K as TypeTag } from "./index-CV5zCdpa.cjs";
3
+ import { Hex } from "viem";
4
+
5
+ //#region src/query/engine.d.ts
6
+ declare const MAX_LIMIT = 200;
7
+ /** One `arkiv_query` call. */
8
+ type QueryRequest = {
9
+ /** The query expression, already rendered. */
10
+ query: string;
11
+ /** What to return. */
12
+ select: RpcSelect;
13
+ /** Page size, up to {@link MAX_LIMIT}. Defaults to the node's own page size. */
14
+ limit?: number | undefined;
15
+ /** Cursor from a previous page. */
16
+ cursor?: string | undefined;
17
+ /** Block height to read at. Defaults to the head. */
18
+ atBlock?: bigint | undefined;
19
+ };
20
+ /** One page of results. */
21
+ type QueryResponse = {
22
+ entities: Entity[];
23
+ /** The block the page was read at — the same for every page of a paginated query. */
24
+ blockNumber: bigint;
25
+ /** The cursor for the next page, or `undefined` when this was the last one. */
26
+ cursor: string | undefined;
27
+ };
28
+ /**
29
+ * Runs one query and decodes the page it returns.
30
+ *
31
+ * @throws {QueryError} If the node rejects the query.
32
+ */
33
+ declare function runQuery(client: ArkivClient, request: QueryRequest): Promise<QueryResponse>;
34
+ //#endregion
35
+ //#region src/query/errors.d.ts
36
+ /**
37
+ * A predicate asked for an operator the query language does not define for that type.
38
+ *
39
+ * The operator × type matrix is part of the language, not a policy: a range comparison on an
40
+ * equality-only type is a **parse error** at the node, not an empty result. Catching it here turns
41
+ * a round trip and an RPC error code into a stack trace pointing at the call site.
42
+ *
43
+ * | | `=` `!=` | `<` `<=` `>` `>=` | `STARTSWITH` |
44
+ * | --- | --- | --- | --- |
45
+ * | `bool` | yes | no | no |
46
+ * | `i32` `u256` `dec` | yes | yes | no |
47
+ * | `str` | yes | no | yes |
48
+ * | `addr` `key` `bytes32` | yes | no | no |
49
+ */
50
+ declare class UnsupportedOperatorError extends Error {
51
+ /** The attribute the predicate names. */
52
+ readonly attributeName: string;
53
+ /** The operator, as it would have been written in the query. */
54
+ readonly operator: string;
55
+ /** The type of the value it was applied to. */
56
+ readonly tag: TypeTag;
57
+ constructor(attributeName: string, operator: string, tag: TypeTag, hint?: string);
58
+ }
59
+ /**
60
+ * A predicate could not be expressed in the query language for a reason other than its operator —
61
+ * a system attribute that is returned in results but cannot be filtered on, a system attribute
62
+ * compared against the wrong type, or a combinator with nothing to combine.
63
+ */
64
+ declare class InvalidPredicateError extends Error {
65
+ /** The attribute the predicate names, where there is one. */
66
+ readonly attributeName: string | undefined;
67
+ constructor(message: string, attributeName?: string);
68
+ }
69
+ /**
70
+ * What a node rejected a query for. Part of the frozen RPC surface, so it is safe to branch on —
71
+ * a `"cursor"` failure means start the query again, a `"block"` failure means the node no longer
72
+ * retains that height, and the rest mean the query itself needs fixing.
73
+ */
74
+ type QueryErrorKind = /** The query string does not parse. `data` locates it: `{ position, expected, got }`. */
75
+ "parse"
76
+ /** A predicate is well-formed but ill-typed — a range operator on an equality-only type, an unknown tag. */ | "type"
77
+ /** A literal failed validation — an `i32` out of range, a bad EIP-55 checksum, more than 18 decimal places. */ | "literal"
78
+ /** A node budget was exceeded — query length, predicate count, nesting depth, bitmap operations. */ | "limits"
79
+ /** The cursor expired, is malformed, or belongs to a different query, block or selection. */ | "cursor"
80
+ /** `atBlock` is outside the range the node retains. */ | "block";
81
+ /**
82
+ * The node rejected a query.
83
+ *
84
+ * These codes are part of the frozen `arkiv_query` surface, so {@link kind} and {@link data} are
85
+ * stable enough to branch on — which the underlying JSON-RPC error is not, because the codes
86
+ * overlap Ethereum's own EIP-1474 numbering and get wrapped accordingly on the way up.
87
+ *
88
+ * @example
89
+ * try {
90
+ * await result.next()
91
+ * } catch (error) {
92
+ * if (error instanceof QueryError && error.kind === "cursor") {
93
+ * // The page is gone — start the query over.
94
+ * }
95
+ * }
96
+ */
97
+ declare class QueryError extends Error {
98
+ /** Which failure this is. */
99
+ readonly kind: QueryErrorKind;
100
+ /** The JSON-RPC error code. */
101
+ readonly code: number;
102
+ /** The machine-readable detail the node sent, if any — e.g. `{ position, expected, got }`. */
103
+ readonly data: unknown;
104
+ /** The query string that was rejected. */
105
+ readonly query: string;
106
+ constructor(kind: QueryErrorKind, code: number, query: string, data: unknown, detail?: string);
107
+ }
108
+ //#endregion
109
+ //#region src/query/queryResult.d.ts
110
+ /** Fetches the page a cursor points at. */
111
+ type FetchPage<TEntity> = (cursor: string) => Promise<QueryResult<TEntity>>;
112
+ /**
113
+ * One page of query results.
114
+ *
115
+ * A page is immutable: {@link next} returns the following page rather than mutating this one, so a
116
+ * page that has been read stays readable.
117
+ *
118
+ * @typeParam TEntity - The shape of each entity, inferred from the selection by `client.select()`.
119
+ *
120
+ * @example
121
+ * let page = await client.select({ key: true }).where(eq("category", "docs")).limit(100).fetch()
122
+ * while (page.hasNextPage()) {
123
+ * page = await page.next()
124
+ * }
125
+ */
126
+ declare class QueryResult<TEntity = Entity> {
127
+ /** The entities on this page. */
128
+ readonly entities: readonly TEntity[];
129
+ /**
130
+ * The block this page was read at.
131
+ *
132
+ * Every page of one walk reads the same block — the cursor is bound to it — so results cannot
133
+ * shift under a paginating reader.
134
+ */
135
+ readonly blockNumber: bigint;
136
+ /** The cursor for the next page, or `undefined` when this was the last one. */
137
+ readonly cursor: string | undefined;
138
+ private readonly fetchPage;
139
+ constructor(entities: readonly TEntity[], blockNumber: bigint, cursor: string | undefined, fetchPage: FetchPage<TEntity>);
140
+ /**
141
+ * Whether another page follows.
142
+ *
143
+ * The node omits the cursor once nothing remains, so this is an answer rather than the guess a
144
+ * short final page would be — a full last page is reported correctly.
145
+ */
146
+ hasNextPage(): boolean;
147
+ /**
148
+ * Fetches the next page.
149
+ *
150
+ * @throws {NoMoreResultsError} If this was the last page — check {@link hasNextPage} first.
151
+ * @throws {QueryError} If the node rejects the request; `kind === "cursor"` means the cursor
152
+ * expired and the walk has to start again.
153
+ */
154
+ next(): Promise<QueryResult<TEntity>>;
155
+ }
156
+ //#endregion
157
+ //#region src/query/queryBuilder.d.ts
158
+ /**
159
+ * Builds and runs a query.
160
+ *
161
+ * The selection is fixed when the builder is created and the filter is added by chaining, so the
162
+ * result type is known before a single predicate is written. Create one with `client.select(...)`
163
+ * rather than constructing it directly — that is what infers the entity shape from the selection.
164
+ *
165
+ * Every filter added with {@link where}, {@link ownedBy} and {@link createdBy} must hold; use
166
+ * {@link or} for alternatives inside one call.
167
+ *
168
+ * @typeParam TEntity - The projected entity shape, inferred from the selection by `client.select()`.
169
+ *
170
+ * @example
171
+ * import { createPublicClient } from "@arkiv-network/sdk"
172
+ * import { i32 } from "@arkiv-network/sdk/attr"
173
+ * import { cheesecake } from "@arkiv-network/sdk/chains"
174
+ * import { eq, gte, or } from "@arkiv-network/sdk/query"
175
+ * import { http } from "viem"
176
+ *
177
+ * const client = createPublicClient({ chain: cheesecake, transport: http() })
178
+ *
179
+ * const page = await client
180
+ * .select({ key: true, attributes: true })
181
+ * .where(gte("level", i32(10)), or(eq("status", "open"), eq("status", "review")))
182
+ * .ownedBy(owner)
183
+ * .limit(100)
184
+ * .fetch()
185
+ *
186
+ * for (const entity of page.entities) console.log(entity.key, entity.attributes)
187
+ */
188
+ declare class SelectQueryBuilder<TEntity = Entity> {
189
+ private readonly _client;
190
+ private readonly _select;
191
+ private readonly _filters;
192
+ private _ownedBy;
193
+ private _createdBy;
194
+ private _limit;
195
+ private _cursor;
196
+ private _atBlock;
197
+ constructor(client: ArkivClient, selection?: SelectArg);
198
+ /**
199
+ * Adds filters. Everything passed here, and across repeated calls, must hold.
200
+ *
201
+ * @param expressions - The expressions, as separate arguments or one array.
202
+ *
203
+ * @example
204
+ * builder.where(eq("category", "docs"))
205
+ * builder.where(gte("level", i32(10)), lt("level", i32(20)))
206
+ * builder.where(or(eq("status", "open"), not(exists("closedAt"))))
207
+ */
208
+ where(expressions: readonly Expression[]): this;
209
+ where(...expressions: Expression[]): this;
210
+ /**
211
+ * Restricts the results to entities this account owns — shorthand for
212
+ * `where(eq("$owner", addr(owner)))`. Calling it again replaces the filter.
213
+ *
214
+ * @example
215
+ * builder.ownedBy("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")
216
+ */
217
+ ownedBy(owner: Hex): this;
218
+ /**
219
+ * Restricts the results to entities this account created — shorthand for
220
+ * `where(eq("$creator", addr(creator)))`. Calling it again replaces the filter.
221
+ *
222
+ * The creator never changes; the owner does, so these differ after a transfer.
223
+ */
224
+ createdBy(creator: Hex): this;
225
+ /**
226
+ * Sets the page size, up to the node maximum of 200. Without it the node picks the page size.
227
+ *
228
+ * @example
229
+ * builder.limit(100)
230
+ */
231
+ limit(limit: number): this;
232
+ /**
233
+ * Starts from a cursor returned by an earlier page.
234
+ *
235
+ * Pagination normally goes through {@link QueryResult.next}, which carries the cursor for you;
236
+ * this is for resuming a walk in a later process. A cursor is bound to the query, block and
237
+ * selection it came from, so it must be used with an identically-built query — {@link atBlock}
238
+ * set to the `blockNumber` of the page the cursor came from is required (persist the two
239
+ * together), and a fetch with a cursor but no block rejects locally.
240
+ */
241
+ cursor(cursor: string): this;
242
+ /**
243
+ * Reads the state as of a given block rather than the head. The block must be within the range
244
+ * the node retains.
245
+ *
246
+ * @example
247
+ * builder.atBlock(1_297_000n)
248
+ */
249
+ atBlock(block: bigint): this;
250
+ /**
251
+ * The query string this builder will send — the same text the node parses.
252
+ *
253
+ * @throws {InvalidPredicateError} If no filter has been added.
254
+ */
255
+ toString(): string;
256
+ /**
257
+ * Runs the query and returns the first page.
258
+ *
259
+ * @throws {InvalidPredicateError} If no filter has been added.
260
+ * @throws {QueryError} If the node rejects the query.
261
+ *
262
+ * @example
263
+ * const page = await client.select({ key: true }).where(eq("category", "docs")).fetch()
264
+ * page.entities // this page
265
+ * await page.next() // the next one
266
+ */
267
+ fetch(): Promise<QueryResult<TEntity>>;
268
+ /**
269
+ * Walks every page, yielding one entity at a time.
270
+ *
271
+ * @example
272
+ * for await (const entity of client.select({ key: true }).where(eq("category", "docs"))) {
273
+ * console.log(entity.key)
274
+ * }
275
+ */
276
+ [Symbol.asyncIterator](): AsyncGenerator<TEntity>;
277
+ }
278
+ //#endregion
279
+ export { QueryErrorKind as a, QueryRequest as c, QueryError as i, QueryResponse as l, QueryResult as n, UnsupportedOperatorError as o, InvalidPredicateError as r, MAX_LIMIT as s, SelectQueryBuilder as t, runQuery as u };
280
+ //# sourceMappingURL=index-BF7Mq9Is.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BF7Mq9Is.d.cts","names":[],"sources":["../src/query/engine.ts","../src/query/errors.ts","../src/query/queryResult.ts","../src/query/queryBuilder.ts"],"sourcesContent":[],"mappings":";;;;;cAUa,SAAA;;AAAA,KAGD,YAAA,GAHU;EAGV;EAcA,KAAA,EAAA,MAAA;EAaU;EAAiB,MAAA,EAvB7B,SAuB6B;EAAsB;EAAuB,KAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAR;EAAO,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;;;ACxBnF;AAMgB,KDKJ,aAAA,GCLI;EAE4C,QAAA,EDIhD,MCJgD,EAAA;EARd;EAAK,WAAA,EAAA,MAAA;EAyBtC;EAgBD,MAAA,EAAA,MAAA,GAAc,SAAA;AAwC1B,CAAA;;;;;;iBDzDsB,QAAA,SAAiB,sBAAsB,eAAe,QAAQ;;;;;;;AA9BpF;AAGA;AAcA;AAaA;;;;;;;cCxBa,wBAAA,SAAiC,KAAA;;EAAjC,SAAA,aAAA,EAAA,MAAyB;EAMtB;EAE4C,SAAA,QAAA,EAAA,MAAA;EARd;EAAK,SAAA,GAAA,EAMnC,OANmC;EAyBtC,WAAA,CAAA,aAAsB,EAAA,MAAA,EAAA,QAAa,EAAA,MAAA,EAAA,GAAA,EAjBY,OAiBZ,EAAA,IAAA,CAAA,EAAA,MAAA;AAgBhD;AAwCA;;;;;cAxDa,qBAAA,SAA8B,KAAA;;;ECrCtC,WAAA,CAAS,OAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAAA,MAAA;;;;;AAgBd;;AAE8B,KDmClB,cAAA;;+GCSwB;kHAApB;;;ACzBhB,0DAA0C,OAAA;;;;;;;;;;;;;;;;;cFwD7B,UAAA,SAAmB,KAAA;;iBAEf;;;;;;;oBAQG;;;;;KCvGf,yCAAyC,QAAQ,YAAY;;;AFMlE;AAGA;AAcA;AAaA;;;;;;;;;ACxBa,cCIA,WDJyB,CAAA,UCIH,MDJG,CAAA,CAAA;EAMtB;EAE4C,SAAA,QAAA,EAAA,SCF9B,ODE8B,EAAA;EARd;;AAyB9C;AAgBA;AAwCA;;EAUoB,SAAA,WAAA,EAAA,MAAA;EAVY;EAAK,SAAA,MAAA,EAAA,MAAA,GAAA,SAAA;;iCC7Dd,uEAGR,UAAU;;AAtCoB;;;;;EAmBhC,WAAA,CAAA,CAAA,EAAW,OAAA;EAAW;;;;;;;EA8CnB,IAAA,CAAA,CAAA,EAAA,OAAA,CAAQ,WAAR,CAAoB,OAApB,CAAA,CAAA;;;;AFrDhB;AAcA;AAaA;;;;;;;;;ACxBA;;;;;AAyBA;AAgBA;AAwCA;;;;;;;;AChG6C;;;;AAGQ,cCqCxC,kBDrCwC,CAAA,UCqCX,MDrCW,CAAA,CAAA;EAgBxC,iBAAW,OAAA;EAAW,iBAAA,OAAA;EAEL,iBAAA,QAAA;EAcP,QAAA,QAAA;EAGE,QAAA,UAAA;EAAV,QAAA,MAAA;EA2BqB,QAAA,OAAA;EAAZ,QAAA,QAAA;EAAR,WAAA,CAAA,MAAA,ECfM,WDeN,EAAA,SAAA,CAAA,ECf+B,SDe/B;EAAO;;;;ACzBvB;;;;;;EAuCiB,KAAA,CAAA,WAAA,EAAA,SAda,UAcb,EAAA,CAAA,EAAA,IAAA;EAWI,KAAA,CAAA,GAAA,WAAA,EAxBG,UAwBH,EAAA,CAAA,EAAA,IAAA;EAyEgB;;;;;;;iBApFpB;;;;;;;qBAWI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAyEJ,QAAQ,YAAY;;;;;;;;;GAqB3B,MAAA,CAAO,aAAA,KAAkB,eAAe"}