@arkiv-network/sdk 0.7.0 → 0.8.0-advanced.3

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 (240) 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-Ds2XRflQ.cjs +656 -0
  7. package/dist/advanced-FZy7WoYR.js +598 -0
  8. package/dist/advanced-FZy7WoYR.js.map +1 -0
  9. package/dist/arkivTransactions-BpARZOsH.d.cts +584 -0
  10. package/dist/arkivTransactions-BpARZOsH.d.cts.map +1 -0
  11. package/dist/arkivTransactions-DfZ_yVDD.d.ts +584 -0
  12. package/dist/arkivTransactions-DfZ_yVDD.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-BJGuhsqp.js +819 -0
  18. package/dist/attributes-BJGuhsqp.js.map +1 -0
  19. package/dist/attributes-CMJlp1wn.cjs +1039 -0
  20. package/dist/chains/index.cjs +2 -3
  21. package/dist/chains/index.d.cts +41 -76
  22. package/dist/chains/index.d.cts.map +1 -1
  23. package/dist/chains/index.d.ts +24 -59
  24. package/dist/chains/index.d.ts.map +1 -1
  25. package/dist/chains/index.js +2 -2
  26. package/dist/chains-BfNQliHU.cjs +76 -0
  27. package/dist/chains-Du8tql7I.js +60 -0
  28. package/dist/chains-Du8tql7I.js.map +1 -0
  29. package/dist/codec-M74UR1_0.d.ts +101 -0
  30. package/dist/codec-M74UR1_0.d.ts.map +1 -0
  31. package/dist/entity/index.cjs +21 -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-51znTSB1.cjs +56 -0
  41. package/dist/errors-CwPJ16bn.js +33 -0
  42. package/dist/errors-CwPJ16bn.js.map +1 -0
  43. package/dist/expiry-CZErShX6.js +95 -0
  44. package/dist/expiry-CZErShX6.js.map +1 -0
  45. package/dist/expiry-DRV29F1r.d.cts +79 -0
  46. package/dist/expiry-DRV29F1r.d.cts.map +1 -0
  47. package/dist/expiry-nDbCgZX4.d.ts +79 -0
  48. package/dist/expiry-nDbCgZX4.d.ts.map +1 -0
  49. package/dist/expiry-xr6mx4f7.cjs +135 -0
  50. package/dist/flags-5dTNRnow.d.ts +41 -0
  51. package/dist/flags-5dTNRnow.d.ts.map +1 -0
  52. package/dist/flags-Bh0HJldY.cjs +43 -0
  53. package/dist/flags-CRjPpoh3.d.cts +41 -0
  54. package/dist/flags-CRjPpoh3.d.cts.map +1 -0
  55. package/dist/flags-Cr76ldwF.js +33 -0
  56. package/dist/flags-Cr76ldwF.js.map +1 -0
  57. package/dist/index-CMeD8uEq.d.cts +280 -0
  58. package/dist/index-CMeD8uEq.d.cts.map +1 -0
  59. package/dist/index-CTDI5pXZ.d.ts +184 -0
  60. package/dist/index-CTDI5pXZ.d.ts.map +1 -0
  61. package/dist/index-CekGjkRx.d.cts +184 -0
  62. package/dist/index-CekGjkRx.d.cts.map +1 -0
  63. package/dist/index-D0IzFwMX.d.ts +328 -0
  64. package/dist/index-D0IzFwMX.d.ts.map +1 -0
  65. package/dist/index-DZxwz2Ky.d.cts +177 -0
  66. package/dist/index-DZxwz2Ky.d.cts.map +1 -0
  67. package/dist/index-Dz4SkQWg.d.ts +280 -0
  68. package/dist/index-Dz4SkQWg.d.ts.map +1 -0
  69. package/dist/index-JP31fjyM.d.ts +177 -0
  70. package/dist/index-JP31fjyM.d.ts.map +1 -0
  71. package/dist/index-NbfnXxgr.d.cts +424 -0
  72. package/dist/index-NbfnXxgr.d.cts.map +1 -0
  73. package/dist/index.cjs +434 -412
  74. package/dist/index.d.cts +401 -235
  75. package/dist/index.d.cts.map +1 -1
  76. package/dist/index.d.ts +402 -235
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +370 -404
  79. package/dist/index.js.map +1 -1
  80. package/dist/key-E7mv0BYf.cjs +116 -0
  81. package/dist/key-XQkpw2xh.js +82 -0
  82. package/dist/key-XQkpw2xh.js.map +1 -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-Cvrir3Q-.cjs +108 -0
  87. package/dist/payload-D53ms-Mg.d.ts +153 -0
  88. package/dist/payload-D53ms-Mg.d.ts.map +1 -0
  89. package/dist/payload-DaPzUvEh.js +92 -0
  90. package/dist/payload-DaPzUvEh.js.map +1 -0
  91. package/dist/payload-hluX1rc0.d.cts +153 -0
  92. package/dist/payload-hluX1rc0.d.cts.map +1 -0
  93. package/dist/query/index.cjs +26 -149
  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 -137
  97. package/dist/queryBuilder-BXR-HxD9.cjs +947 -0
  98. package/dist/queryBuilder-BwauPaGO.js +823 -0
  99. package/dist/queryBuilder-BwauPaGO.js.map +1 -0
  100. package/dist/selection-C6KeWJ7g.d.cts +441 -0
  101. package/dist/selection-C6KeWJ7g.d.cts.map +1 -0
  102. package/dist/selection-mjiiAGDO.d.ts +442 -0
  103. package/dist/selection-mjiiAGDO.d.ts.map +1 -0
  104. package/dist/types/index.cjs +4 -1
  105. package/dist/types/index.d.cts +7 -2
  106. package/dist/types/index.d.ts +8 -2
  107. package/dist/types/index.js +4 -1
  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 -9
  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 +28 -43
  122. package/src/actions/public/getEntityNonce.ts +30 -0
  123. package/src/actions/public/predictEntityKeys.test.ts +159 -0
  124. package/src/actions/public/predictEntityKeys.ts +152 -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 +8 -8
  129. package/src/actions/wallet/createEntity.ts +105 -26
  130. package/src/actions/wallet/deleteEntity.ts +2 -3
  131. package/src/actions/wallet/executeBatch.test.ts +76 -0
  132. package/src/actions/wallet/executeBatch.ts +51 -0
  133. package/src/actions/wallet/extendEntity.ts +40 -16
  134. package/src/actions/wallet/patchEntity.ts +90 -0
  135. package/src/attr/attributes.test.ts +120 -0
  136. package/src/attr/attributes.ts +196 -0
  137. package/src/attr/codec.test.ts +162 -0
  138. package/src/attr/codec.ts +220 -0
  139. package/src/attr/decimal.ts +86 -0
  140. package/src/attr/errors.ts +145 -0
  141. package/src/attr/index.ts +50 -0
  142. package/src/attr/names.ts +106 -0
  143. package/src/attr/types.ts +150 -0
  144. package/src/attr/values.test.ts +271 -0
  145. package/src/attr/values.ts +506 -0
  146. package/src/chains/cheesecake.ts +22 -0
  147. package/src/chains/index.ts +1 -2
  148. package/src/chains/localhost.ts +3 -0
  149. package/src/clients/createPublicClient.test.ts +4 -6
  150. package/src/clients/createPublicClient.ts +9 -8
  151. package/src/clients/createWalletClient.test.ts +4 -4
  152. package/src/clients/createWalletClient.ts +13 -9
  153. package/src/clients/decorators/arkivAdvanced.ts +144 -0
  154. package/src/clients/decorators/arkivPublic.ts +181 -147
  155. package/src/clients/decorators/arkivWallet.ts +141 -122
  156. package/src/consts.ts +2 -1
  157. package/src/entity/create.test.ts +203 -0
  158. package/src/entity/errors.ts +39 -0
  159. package/src/entity/events.ts +16 -0
  160. package/src/entity/expiry.test.ts +195 -0
  161. package/src/entity/expiry.ts +182 -0
  162. package/src/entity/flags.ts +65 -0
  163. package/src/entity/index.ts +16 -0
  164. package/src/entity/key.ts +88 -0
  165. package/src/entity/operations.ts +135 -0
  166. package/src/entity/params.ts +15 -0
  167. package/src/errors.ts +33 -28
  168. package/src/index.ts +19 -0
  169. package/src/query/engine.ts +68 -132
  170. package/src/query/errors.ts +151 -0
  171. package/src/query/expression.test.ts +286 -0
  172. package/src/query/expression.ts +500 -0
  173. package/src/query/index.ts +40 -4
  174. package/src/query/injection.test.ts +151 -0
  175. package/src/query/queryBuilder.test.ts +342 -637
  176. package/src/query/queryBuilder.ts +133 -359
  177. package/src/query/queryResult.ts +54 -51
  178. package/src/query/selection.test.ts +48 -98
  179. package/src/query/selection.ts +77 -65
  180. package/src/types/entity.test.ts +44 -155
  181. package/src/types/entity.ts +62 -44
  182. package/src/types/events.ts +64 -23
  183. package/src/types/index.ts +24 -20
  184. package/src/types/rpcSchema.ts +71 -33
  185. package/src/types/txParams.ts +8 -0
  186. package/src/utils/arkivTransactions.test.ts +687 -38
  187. package/src/utils/arkivTransactions.ts +400 -115
  188. package/src/utils/chains.test.ts +21 -24
  189. package/src/utils/compression.ts +1 -1
  190. package/src/utils/entities.test.ts +62 -0
  191. package/src/utils/entities.ts +111 -29
  192. package/src/utils/expirationTime.ts +153 -10
  193. package/src/utils/logger.ts +2 -2
  194. package/src/utils/payload.ts +29 -2
  195. package/src/utils/revert.test.ts +99 -0
  196. package/src/utils/revert.ts +145 -0
  197. package/dist/chains-BifaY04V.cjs +0 -108
  198. package/dist/chains-CrtkVbBh.js +0 -86
  199. package/dist/chains-CrtkVbBh.js.map +0 -1
  200. package/dist/consts-AUoL-v42.cjs +0 -18
  201. package/dist/consts-BV4PR-de.js +0 -7
  202. package/dist/consts-BV4PR-de.js.map +0 -1
  203. package/dist/entity-B6g_EPm1.d.cts +0 -382
  204. package/dist/entity-B6g_EPm1.d.cts.map +0 -1
  205. package/dist/entity-qoLMAuuk.d.ts +0 -382
  206. package/dist/entity-qoLMAuuk.d.ts.map +0 -1
  207. package/dist/index-DdspxNAA.d.ts +0 -481
  208. package/dist/index-DdspxNAA.d.ts.map +0 -1
  209. package/dist/index-Ds9dwqb5.d.cts +0 -481
  210. package/dist/index-Ds9dwqb5.d.cts.map +0 -1
  211. package/dist/payload-B2kFJyah.d.ts +0 -6
  212. package/dist/payload-B2kFJyah.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-Claf2jUO.js +0 -13
  216. package/dist/payload-Claf2jUO.js.map +0 -1
  217. package/dist/payload-DpA5PA-w.cjs +0 -23
  218. package/dist/query/index.js.map +0 -1
  219. package/dist/queryBuilder-D2uwP9jI.js +0 -704
  220. package/dist/queryBuilder-D2uwP9jI.js.map +0 -1
  221. package/dist/queryBuilder-UW2MCaX4.cjs +0 -792
  222. package/dist/utils/index.d.cts.map +0 -1
  223. package/dist/utils/index.d.ts.map +0 -1
  224. package/dist/utils/index.js.map +0 -1
  225. package/src/actions/public/buildQuery.ts +0 -10
  226. package/src/actions/public/subscribeEntityEvents.ts +0 -119
  227. package/src/actions/wallet/mutateEntities.ts +0 -111
  228. package/src/actions/wallet/updateEntity.ts +0 -60
  229. package/src/chains/braga.ts +0 -26
  230. package/src/chains/kaolin.ts +0 -29
  231. package/src/query/engine.test.ts +0 -526
  232. package/src/query/predicate.test.ts +0 -461
  233. package/src/query/predicate.ts +0 -144
  234. package/src/query/queryResult.test.ts +0 -270
  235. package/src/query/selectQueryBuilder.test.ts +0 -210
  236. package/src/types/attributes.ts +0 -16
  237. package/src/utils/validation.test.ts +0 -60
  238. package/src/utils/validation.ts +0 -32
  239. /package/dist/{types-H-TSmRpm.js → attr-DlmErkvR.cjs} +0 -0
  240. /package/dist/{types-o3zWarRp.cjs → attr-GcQKatub.js} +0 -0
@@ -0,0 +1,92 @@
1
+ import { i as MAX_EXPIRES_AT, r as toBlocks, t as makeExpiry } from "./expiry-CZErShX6.js";
2
+ import { n as InvalidExpiryError } from "./errors-CwPJ16bn.js";
3
+ import { stringToBytes, toBytes } from "viem";
4
+
5
+ //#region src/utils/expirationTime.ts
6
+ function lifetimeOf(seconds) {
7
+ return makeExpiry(toBlocks(seconds), 0n);
8
+ }
9
+ function deadlineOf(expiresAt, options) {
10
+ return makeExpiry(options?.atLeast?.minLifetime ?? 0n, expiresAt);
11
+ }
12
+ /**
13
+ * Builds the `expires` of a create or an extension.
14
+ *
15
+ * Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is
16
+ * what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;
17
+ * {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes
18
+ * whichever comes later, which is why a deadline can also carry a floor.
19
+ *
20
+ * Values are plain data — no methods, no prototype — so they log, clone and compare like any other
21
+ * object.
22
+ *
23
+ * @example The 90% case: a duration, and nothing else to think about.
24
+ * await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })
25
+ *
26
+ * @example An exact block, or a wall-clock date.
27
+ * expires: ExpirationTime.atBlock(1_200_000n)
28
+ * expires: ExpirationTime.atDate(new Date("2027-01-01"))
29
+ *
30
+ * @example A deadline that still guarantees a minimum life.
31
+ * expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })
32
+ */
33
+ const ExpirationTime = {
34
+ fromSeconds: (seconds) => lifetimeOf(seconds),
35
+ fromMinutes: (minutes) => lifetimeOf(minutes * 60),
36
+ fromHours: (hours) => lifetimeOf(hours * 60 * 60),
37
+ fromDays: (days) => lifetimeOf(days * 24 * 60 * 60),
38
+ fromWeeks: (weeks) => lifetimeOf(weeks * 7 * 24 * 60 * 60),
39
+ fromMonths: (months) => lifetimeOf(months * 30 * 24 * 60 * 60),
40
+ fromYears: (years) => lifetimeOf(years * 365 * 24 * 60 * 60),
41
+ fromBlocks: (blocks) => {
42
+ if (!Number.isInteger(blocks) || blocks <= 0) throw new InvalidExpiryError(`a lifetime must be a positive whole number of blocks, got ${blocks}`);
43
+ return makeExpiry(BigInt(blocks), 0n);
44
+ },
45
+ atBlock: (block, options) => {
46
+ if (typeof block !== "bigint" || block < 0n) throw new InvalidExpiryError(`a deadline must be a non-negative block height, got ${block}`);
47
+ return deadlineOf(block, options);
48
+ },
49
+ atDate: (date, options) => {
50
+ if (!(date instanceof Date) || Number.isNaN(date.getTime())) throw new InvalidExpiryError(`a deadline must be a valid Date, got ${String(date)}`);
51
+ return deadlineOf(date, options);
52
+ },
53
+ permanent: () => deadlineOf(MAX_EXPIRES_AT)
54
+ };
55
+
56
+ //#endregion
57
+ //#region src/utils/payload.ts
58
+ /**
59
+ * A JSON-serialisable value as an entity payload — `JSON.stringify` then UTF-8.
60
+ *
61
+ * Pair it with `contentType: "application/json"`, which is what lets `entity.toJson()` read it back.
62
+ *
63
+ * @example
64
+ * await client.createEntity({
65
+ * payload: jsonToPayload({ hello: "world" }),
66
+ * contentType: "application/json",
67
+ * expires: ExpirationTime.fromDays(30),
68
+ * })
69
+ */
70
+ function jsonToPayload(json) {
71
+ return toBytes(JSON.stringify(json));
72
+ }
73
+ /**
74
+ * A string as an entity payload, encoded as UTF-8.
75
+ *
76
+ * Hex-looking text is encoded as text: `stringToPayload("0xab")` gives the four bytes of that
77
+ * string, not the single byte `0xab`. Read it back with `entity.toText()`.
78
+ *
79
+ * @example
80
+ * await client.createEntity({
81
+ * payload: stringToPayload("hello"),
82
+ * contentType: "text/plain",
83
+ * expires: ExpirationTime.fromDays(30),
84
+ * })
85
+ */
86
+ function stringToPayload(data) {
87
+ return stringToBytes(data);
88
+ }
89
+
90
+ //#endregion
91
+ export { stringToPayload as n, ExpirationTime as r, jsonToPayload as t };
92
+ //# sourceMappingURL=payload-DaPzUvEh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload-DaPzUvEh.js","names":[],"sources":["../src/utils/expirationTime.ts","../src/utils/payload.ts"],"sourcesContent":["import { InvalidExpiryError } from \"../entity/errors\"\nimport { type Expiry, type Lifetime, makeExpiry, toBlocks } from \"../entity/expiry\"\nimport { MAX_EXPIRES_AT } from \"../entity/params\"\n\n/**\n * The optional floor a deadline can carry.\n *\n * `atLeast` takes a duration — one of the `from*` helpers — and never another deadline, so\n * `atBlock(x, { atLeast: atBlock(y) })` does not compile. Two deadlines are not a thing the engine\n * can resolve.\n */\nexport type DeadlineOptions = {\n /** Live at least this long from now, even if the deadline is sooner. */\n atLeast?: Lifetime | undefined\n}\n\nfunction lifetimeOf(seconds: number): Lifetime {\n return makeExpiry(toBlocks(seconds), 0n) as Lifetime\n}\n\nfunction deadlineOf(expiresAt: bigint | Date, options?: DeadlineOptions): Expiry {\n return makeExpiry(options?.atLeast?.minLifetime ?? 0n, expiresAt)\n}\n\n/**\n * Builds the `expires` of a create or an extension.\n *\n * Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is\n * what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;\n * {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes\n * whichever comes later, which is why a deadline can also carry a floor.\n *\n * Values are plain data — no methods, no prototype — so they log, clone and compare like any other\n * object.\n *\n * @example The 90% case: a duration, and nothing else to think about.\n * await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })\n *\n * @example An exact block, or a wall-clock date.\n * expires: ExpirationTime.atBlock(1_200_000n)\n * expires: ExpirationTime.atDate(new Date(\"2027-01-01\"))\n *\n * @example A deadline that still guarantees a minimum life.\n * expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })\n */\nexport const ExpirationTime = {\n /**\n * A raw number of seconds. Must be a whole number of blocks' worth — see the other helpers, which\n * all produce one by construction.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromSeconds: (seconds: number): Lifetime => lifetimeOf(seconds),\n /**\n * A number of minutes.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromMinutes: (minutes: number): Lifetime => lifetimeOf(minutes * 60),\n\n /**\n * A number of hours.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromHours: (hours: number): Lifetime => lifetimeOf(hours * 60 * 60),\n\n /**\n * A number of days. The everyday form — `fromDays(30)` is what most creates want.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromDays: (days: number): Lifetime => lifetimeOf(days * 24 * 60 * 60),\n\n /**\n * A number of weeks, each of 7 days.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromWeeks: (weeks: number): Lifetime => lifetimeOf(weeks * 7 * 24 * 60 * 60),\n\n /**\n * A number of months, each of exactly **30 days** — calendar months are not all the same length,\n * and a lifetime is a duration rather than a date. Use {@link ExpirationTime.atDate} when the\n * expiry has to land on a particular calendar day.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromMonths: (months: number): Lifetime => lifetimeOf(months * 30 * 24 * 60 * 60),\n\n /**\n * A number of years, each of exactly **365 days** — leap days are not counted, so `fromYears(4)`\n * is a day short of four calendar years. Use {@link ExpirationTime.atDate} for a calendar\n * deadline.\n *\n * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.\n */\n fromYears: (years: number): Lifetime => lifetimeOf(years * 365 * 24 * 60 * 60),\n\n /**\n * A number of blocks, for callers who think in the chain's own unit. Always exact — there is no\n * conversion to be approximate about.\n *\n * @throws {InvalidExpiryError} If the count is not a positive whole number.\n */\n fromBlocks: (blocks: number): Lifetime => {\n if (!Number.isInteger(blocks) || blocks <= 0) {\n throw new InvalidExpiryError(\n `a lifetime must be a positive whole number of blocks, got ${blocks}`,\n )\n }\n return makeExpiry(BigInt(blocks), 0n) as Lifetime\n },\n\n /**\n * An absolute block height.\n *\n * @param block - The block the entity expires at.\n * @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.\n * @throws {InvalidExpiryError} If the height is negative.\n */\n atBlock: (block: bigint, options?: DeadlineOptions): Expiry => {\n if (typeof block !== \"bigint\" || block < 0n) {\n throw new InvalidExpiryError(`a deadline must be a non-negative block height, got ${block}`)\n }\n return deadlineOf(block, options)\n },\n\n /**\n * A wall-clock instant, placed against the block the transaction is built on.\n *\n * A date cannot land on a block boundary in general, so it rounds **up** to the next block: the\n * entity lives until at least the instant asked for. This is why a date is never rejected for\n * \"not being a whole number of blocks\" the way a duration is — it becomes a block height, not a\n * duration.\n *\n * @param date - When the entity should expire.\n * @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.\n * @throws {InvalidExpiryError} If the value is not a valid `Date`.\n */\n atDate: (date: Date, options?: DeadlineOptions): Expiry => {\n if (!(date instanceof Date) || Number.isNaN(date.getTime())) {\n throw new InvalidExpiryError(`a deadline must be a valid Date, got ${String(date)}`)\n }\n return deadlineOf(date, options)\n },\n\n /**\n * An entity that should never expire.\n *\n * This is `atBlock(MAX_EXPIRES_AT)` — the largest expiry the `uint64` field holds — and the\n * engine treats it as an ordinary deadline rather than a special case. There is no permanence\n * flag; a block height no chain will reach is what permanence is.\n */\n permanent: (): Expiry => deadlineOf(MAX_EXPIRES_AT),\n}\n","import { stringToBytes, toBytes } from \"viem\"\n\n/**\n * A JSON-serialisable value as an entity payload — `JSON.stringify` then UTF-8.\n *\n * Pair it with `contentType: \"application/json\"`, which is what lets `entity.toJson()` read it back.\n *\n * @example\n * await client.createEntity({\n * payload: jsonToPayload({ hello: \"world\" }),\n * contentType: \"application/json\",\n * expires: ExpirationTime.fromDays(30),\n * })\n */\nexport function jsonToPayload(json: object): Uint8Array {\n return toBytes(JSON.stringify(json))\n}\n\n/**\n * A string as an entity payload, encoded as UTF-8.\n *\n * Hex-looking text is encoded as text: `stringToPayload(\"0xab\")` gives the four bytes of that\n * string, not the single byte `0xab`. Read it back with `entity.toText()`.\n *\n * @example\n * await client.createEntity({\n * payload: stringToPayload(\"hello\"),\n * contentType: \"text/plain\",\n * expires: ExpirationTime.fromDays(30),\n * })\n */\nexport function stringToPayload(data: string): Uint8Array {\n // stringToBytes, not toBytes: toBytes hex-decodes hex-looking strings, which\n // would corrupt payloads like \"0xab\" instead of UTF-8 encoding them\n return stringToBytes(data)\n}\n"],"mappings":";;;;;AAgBA,SAAS,WAAW,SAA2B;AAC7C,QAAO,WAAW,SAAS,QAAQ,EAAE,GAAG;;AAG1C,SAAS,WAAW,WAA0B,SAAmC;AAC/E,QAAO,WAAW,SAAS,SAAS,eAAe,IAAI,UAAU;;;;;;;;;;;;;;;;;;;;;;;AAwBnE,MAAa,iBAAiB;CAO5B,cAAc,YAA8B,WAAW,QAAQ;CAM/D,cAAc,YAA8B,WAAW,UAAU,GAAG;CAOpE,YAAY,UAA4B,WAAW,QAAQ,KAAK,GAAG;CAOnE,WAAW,SAA2B,WAAW,OAAO,KAAK,KAAK,GAAG;CAOrE,YAAY,UAA4B,WAAW,QAAQ,IAAI,KAAK,KAAK,GAAG;CAS5E,aAAa,WAA6B,WAAW,SAAS,KAAK,KAAK,KAAK,GAAG;CAShF,YAAY,UAA4B,WAAW,QAAQ,MAAM,KAAK,KAAK,GAAG;CAQ9E,aAAa,WAA6B;AACxC,MAAI,CAAC,OAAO,UAAU,OAAO,IAAI,UAAU,EACzC,OAAM,IAAI,mBACR,6DAA6D,SAC9D;AAEH,SAAO,WAAW,OAAO,OAAO,EAAE,GAAG;;CAUvC,UAAU,OAAe,YAAsC;AAC7D,MAAI,OAAO,UAAU,YAAY,QAAQ,GACvC,OAAM,IAAI,mBAAmB,uDAAuD,QAAQ;AAE9F,SAAO,WAAW,OAAO,QAAQ;;CAenC,SAAS,MAAY,YAAsC;AACzD,MAAI,EAAE,gBAAgB,SAAS,OAAO,MAAM,KAAK,SAAS,CAAC,CACzD,OAAM,IAAI,mBAAmB,wCAAwC,OAAO,KAAK,GAAG;AAEtF,SAAO,WAAW,MAAM,QAAQ;;CAUlC,iBAAyB,WAAW,eAAe;CACpD;;;;;;;;;;;;;;;;AC7ID,SAAgB,cAAc,MAA0B;AACtD,QAAO,QAAQ,KAAK,UAAU,KAAK,CAAC;;;;;;;;;;;;;;;AAgBtC,SAAgB,gBAAgB,MAA0B;AAGxD,QAAO,cAAc,KAAK"}
@@ -0,0 +1,153 @@
1
+ import { i as Lifetime, n as Expiry } from "./expiry-DRV29F1r.cjs";
2
+
3
+ //#region src/utils/expirationTime.d.ts
4
+
5
+ /**
6
+ * The optional floor a deadline can carry.
7
+ *
8
+ * `atLeast` takes a duration — one of the `from*` helpers — and never another deadline, so
9
+ * `atBlock(x, { atLeast: atBlock(y) })` does not compile. Two deadlines are not a thing the engine
10
+ * can resolve.
11
+ */
12
+ type DeadlineOptions = {
13
+ /** Live at least this long from now, even if the deadline is sooner. */
14
+ atLeast?: Lifetime | undefined;
15
+ };
16
+ /**
17
+ * Builds the `expires` of a create or an extension.
18
+ *
19
+ * Every helper returns the `{ minLifetime, expiresAt }` pair the ABI carries, so what you write is
20
+ * what goes on the wire. The `from*` helpers fill `minLifetime` and leave `expiresAt` at `0n`;
21
+ * {@link ExpirationTime.atBlock} and {@link ExpirationTime.atDate} do the reverse. The engine takes
22
+ * whichever comes later, which is why a deadline can also carry a floor.
23
+ *
24
+ * Values are plain data — no methods, no prototype — so they log, clone and compare like any other
25
+ * object.
26
+ *
27
+ * @example The 90% case: a duration, and nothing else to think about.
28
+ * await client.createEntity({ payload, contentType, expires: ExpirationTime.fromDays(30) })
29
+ *
30
+ * @example An exact block, or a wall-clock date.
31
+ * expires: ExpirationTime.atBlock(1_200_000n)
32
+ * expires: ExpirationTime.atDate(new Date("2027-01-01"))
33
+ *
34
+ * @example A deadline that still guarantees a minimum life.
35
+ * expires: ExpirationTime.atBlock(1_200_000n, { atLeast: ExpirationTime.fromDays(1) })
36
+ */
37
+ declare const ExpirationTime: {
38
+ /**
39
+ * A raw number of seconds. Must be a whole number of blocks' worth — see the other helpers, which
40
+ * all produce one by construction.
41
+ *
42
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
43
+ */
44
+ fromSeconds: (seconds: number) => Lifetime;
45
+ /**
46
+ * A number of minutes.
47
+ *
48
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
49
+ */
50
+ fromMinutes: (minutes: number) => Lifetime;
51
+ /**
52
+ * A number of hours.
53
+ *
54
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
55
+ */
56
+ fromHours: (hours: number) => Lifetime;
57
+ /**
58
+ * A number of days. The everyday form — `fromDays(30)` is what most creates want.
59
+ *
60
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
61
+ */
62
+ fromDays: (days: number) => Lifetime;
63
+ /**
64
+ * A number of weeks, each of 7 days.
65
+ *
66
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
67
+ */
68
+ fromWeeks: (weeks: number) => Lifetime;
69
+ /**
70
+ * A number of months, each of exactly **30 days** — calendar months are not all the same length,
71
+ * and a lifetime is a duration rather than a date. Use {@link ExpirationTime.atDate} when the
72
+ * expiry has to land on a particular calendar day.
73
+ *
74
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
75
+ */
76
+ fromMonths: (months: number) => Lifetime;
77
+ /**
78
+ * A number of years, each of exactly **365 days** — leap days are not counted, so `fromYears(4)`
79
+ * is a day short of four calendar years. Use {@link ExpirationTime.atDate} for a calendar
80
+ * deadline.
81
+ *
82
+ * @throws {InvalidExpiryError} If the duration is not a positive multiple of the block time.
83
+ */
84
+ fromYears: (years: number) => Lifetime;
85
+ /**
86
+ * A number of blocks, for callers who think in the chain's own unit. Always exact — there is no
87
+ * conversion to be approximate about.
88
+ *
89
+ * @throws {InvalidExpiryError} If the count is not a positive whole number.
90
+ */
91
+ fromBlocks: (blocks: number) => Lifetime;
92
+ /**
93
+ * An absolute block height.
94
+ *
95
+ * @param block - The block the entity expires at.
96
+ * @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.
97
+ * @throws {InvalidExpiryError} If the height is negative.
98
+ */
99
+ atBlock: (block: bigint, options?: DeadlineOptions) => Expiry;
100
+ /**
101
+ * A wall-clock instant, placed against the block the transaction is built on.
102
+ *
103
+ * A date cannot land on a block boundary in general, so it rounds **up** to the next block: the
104
+ * entity lives until at least the instant asked for. This is why a date is never rejected for
105
+ * "not being a whole number of blocks" the way a duration is — it becomes a block height, not a
106
+ * duration.
107
+ *
108
+ * @param date - When the entity should expire.
109
+ * @param options - Optionally, a floor: `{ atLeast: ExpirationTime.fromDays(1) }`.
110
+ * @throws {InvalidExpiryError} If the value is not a valid `Date`.
111
+ */
112
+ atDate: (date: Date, options?: DeadlineOptions) => Expiry;
113
+ /**
114
+ * An entity that should never expire.
115
+ *
116
+ * This is `atBlock(MAX_EXPIRES_AT)` — the largest expiry the `uint64` field holds — and the
117
+ * engine treats it as an ordinary deadline rather than a special case. There is no permanence
118
+ * flag; a block height no chain will reach is what permanence is.
119
+ */
120
+ permanent: () => Expiry;
121
+ };
122
+ //#endregion
123
+ //#region src/utils/payload.d.ts
124
+ /**
125
+ * A JSON-serialisable value as an entity payload — `JSON.stringify` then UTF-8.
126
+ *
127
+ * Pair it with `contentType: "application/json"`, which is what lets `entity.toJson()` read it back.
128
+ *
129
+ * @example
130
+ * await client.createEntity({
131
+ * payload: jsonToPayload({ hello: "world" }),
132
+ * contentType: "application/json",
133
+ * expires: ExpirationTime.fromDays(30),
134
+ * })
135
+ */
136
+ declare function jsonToPayload(json: object): Uint8Array;
137
+ /**
138
+ * A string as an entity payload, encoded as UTF-8.
139
+ *
140
+ * Hex-looking text is encoded as text: `stringToPayload("0xab")` gives the four bytes of that
141
+ * string, not the single byte `0xab`. Read it back with `entity.toText()`.
142
+ *
143
+ * @example
144
+ * await client.createEntity({
145
+ * payload: stringToPayload("hello"),
146
+ * contentType: "text/plain",
147
+ * expires: ExpirationTime.fromDays(30),
148
+ * })
149
+ */
150
+ declare function stringToPayload(data: string): Uint8Array;
151
+ //#endregion
152
+ export { ExpirationTime as i, stringToPayload as n, DeadlineOptions as r, jsonToPayload as t };
153
+ //# sourceMappingURL=payload-hluX1rc0.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload-hluX1rc0.d.cts","names":[],"sources":["../src/utils/expirationTime.ts","../src/utils/payload.ts"],"sourcesContent":[],"mappings":";;;;;;AAWA;AAkCA;;;;AA2B4B,KA7DhB,eAAA,GA6DgB;EAOE;EASE,OAAA,CAAA,EA3EpB,QA2EoB,GAAA,SAAA;CASF;;;;;;;;;;;;ACnF9B;AAiBA;;;;;;;;;cDca;;;;;;;oCAOqB;;;;;;oCAMA;;;;;;gCAOJ;;;;;;8BAOF;;;;;;gCAOE;;;;;;;;kCASE;;;;;;;;gCASF;;;;;;;kCAQE;;;;;;;;qCAgBK,oBAAkB;;;;;;;;;;;;;iBAmBtC,gBAAgB,oBAAkB;;;;;;;;mBAclC;;;;;;;AA/IjB;AAkCA;;;;;;;;AA4DgC,iBC3FhB,aAAA,CD2FgB,IAAA,EAAA,MAAA,CAAA,EC3Fa,UD2Fb;;;;;;;;;;;AC3FhC;AAiBA;;iBAAgB,eAAA,gBAA+B"}
@@ -1,152 +1,29 @@
1
- const require_queryBuilder = require('../queryBuilder-UW2MCaX4.cjs');
2
- require('../consts-AUoL-v42.cjs');
1
+ require('../attributes-CMJlp1wn.cjs');
2
+ require('../errors-51znTSB1.cjs');
3
+ require('../flags-Bh0HJldY.cjs');
4
+ require('../logger-Cr15lPAQ.cjs');
5
+ require('../attr-DlmErkvR.cjs');
6
+ require('../entity-B00Li04j.cjs');
7
+ const require_queryBuilder = require('../queryBuilder-BXR-HxD9.cjs');
3
8
 
4
- //#region src/query/predicate.ts
5
- function or(...predicates) {
6
- return {
7
- type: "or",
8
- predicates: predicates.flat()
9
- };
10
- }
11
- function and(...predicates) {
12
- return {
13
- type: "and",
14
- predicates: predicates.flat()
15
- };
16
- }
17
- /**
18
- * Creates an equality predicate
19
- * @param key - The key to compare
20
- * @param value - The value to compare
21
- * @returns The equality predicate
22
- *
23
- * @example
24
- * const predicate = eq("name", "John")
25
- * // result = { type: "eq", key: "name", value: "John" }
26
- */
27
- function eq(key, value) {
28
- return {
29
- type: "eq",
30
- key,
31
- value
32
- };
33
- }
34
- /**
35
- * Creates a not equal predicate
36
- * @param key - The key to compare
37
- * @param value - The value to compare
38
- * @returns The not equal predicate
39
- *
40
- * @example
41
- * const predicate = neq("name", "John")
42
- * // result = { type: "neq", key: "name", value: "John" }
43
- */
44
- function neq(key, value) {
45
- return {
46
- type: "neq",
47
- key,
48
- value
49
- };
50
- }
51
- /**
52
- * Creates a greater than predicate
53
- * @param key - The key to compare
54
- * @param value - The value to compare
55
- * @returns The greater than predicate
56
- *
57
- * @example
58
- * const predicate = gt("name", "John")
59
- * // result = { type: "gt", key: "name", value: "John" }
60
- */
61
- function gt(key, value) {
62
- return {
63
- type: "gt",
64
- key,
65
- value
66
- };
67
- }
68
- /**
69
- * Creates a greater than or equal predicate
70
- * @param key - The key to compare
71
- * @param value - The value to compare
72
- * @returns The greater than or equal predicate
73
- *
74
- * @example
75
- * const predicate = gte("name", "John")
76
- * // result = { type: "gte", key: "name", value: "John" }
77
- */
78
- function gte(key, value) {
79
- return {
80
- type: "gte",
81
- key,
82
- value
83
- };
84
- }
85
- /**
86
- * Creates a less than predicate
87
- * @param key - The key to compare
88
- * @param value - The value to compare
89
- * @returns The less than predicate
90
- *
91
- * @example
92
- * const predicate = lt("name", "John")
93
- * // result = { type: "lt", key: "name", value: "John" }
94
- */
95
- function lt(key, value) {
96
- return {
97
- type: "lt",
98
- key,
99
- value
100
- };
101
- }
102
- /**
103
- * Creates a less than or equal predicate
104
- * @param key - The key to compare
105
- * @param value - The value to compare
106
- * @returns The less than or equal predicate
107
- *
108
- * @example
109
- * const predicate = lte("name", "John")
110
- * // result = { type: "lte", key: "name", value: "John" }
111
- */
112
- function lte(key, value) {
113
- return {
114
- type: "lte",
115
- key,
116
- value
117
- };
118
- }
119
- /**
120
- * Creates a not predicate
121
- * @param key - The key to compare
122
- * @returns The not predicate
123
- *
124
- * @example
125
- * const predicate = not("name")
126
- * // result = { type: "not", key: "name", value: "" }
127
- */
128
- function not(key) {
129
- return {
130
- type: "not",
131
- key,
132
- value: ""
133
- };
134
- }
135
-
136
- //#endregion
137
- exports.BaseQueryBuilder = require_queryBuilder.BaseQueryBuilder;
138
- exports.QueryBuilder = require_queryBuilder.QueryBuilder;
9
+ exports.InvalidPredicateError = require_queryBuilder.InvalidPredicateError;
10
+ exports.MAX_LIMIT = require_queryBuilder.MAX_LIMIT;
11
+ exports.QueryError = require_queryBuilder.QueryError;
139
12
  exports.QueryResult = require_queryBuilder.QueryResult;
140
13
  exports.SelectQueryBuilder = require_queryBuilder.SelectQueryBuilder;
141
- exports.and = and;
142
- exports.asc = require_queryBuilder.asc;
143
- exports.desc = require_queryBuilder.desc;
144
- exports.eq = eq;
145
- exports.gt = gt;
146
- exports.gte = gte;
147
- exports.lt = lt;
148
- exports.lte = lte;
149
- exports.neq = neq;
150
- exports.not = not;
151
- exports.or = or;
152
- exports.selectionToIncludeData = require_queryBuilder.selectionToIncludeData;
14
+ exports.UnsupportedOperatorError = require_queryBuilder.UnsupportedOperatorError;
15
+ exports.and = require_queryBuilder.and;
16
+ exports.eq = require_queryBuilder.eq;
17
+ exports.exists = require_queryBuilder.exists;
18
+ exports.gt = require_queryBuilder.gt;
19
+ exports.gte = require_queryBuilder.gte;
20
+ exports.hasType = require_queryBuilder.hasType;
21
+ exports.lt = require_queryBuilder.lt;
22
+ exports.lte = require_queryBuilder.lte;
23
+ exports.ne = require_queryBuilder.ne;
24
+ exports.not = require_queryBuilder.not;
25
+ exports.or = require_queryBuilder.or;
26
+ exports.render = require_queryBuilder.render;
27
+ exports.runQuery = require_queryBuilder.runQuery;
28
+ exports.startsWith = require_queryBuilder.startsWith;
29
+ exports.toRpcSelect = require_queryBuilder.toRpcSelect;
@@ -1,3 +1,5 @@
1
- import "../entity-B6g_EPm1.cjs";
2
- import { C as neq, S as lte, T as or, _ as and, a as asc, b as gte, c as FullEntity, d as SelectionFields, f as selectionToIncludeData, g as PredicateType, h as PredicateContainerType, i as SelectQueryBuilder, l as ProjectedEntity, m as Predicate, n as OrderByAttribute, o as desc, p as QueryResult, r as QueryBuilder, s as EntitySelection, t as BaseQueryBuilder, u as SelectArg, v as eq, w as not, x as lt, y as gt } from "../index-Ds9dwqb5.cjs";
3
- export { BaseQueryBuilder, EntitySelection, FullEntity, OrderByAttribute, Predicate, PredicateContainerType, PredicateType, ProjectedEntity, QueryBuilder, QueryResult, SelectArg, SelectQueryBuilder, SelectionFields, and, asc, desc, eq, gt, gte, lt, lte, neq, not, or, selectionToIncludeData };
1
+ import { A as startsWith, C as hasType, D as not, E as ne, O as or, S as gte, T as lte, _ as TypeOfNode, a as SelectionFields, b as exists, d as ComparisonOperator, f as ExistsNode, g as StartsWithNode, h as OrNode, i as SelectArg, k as render, l as AndNode, m as NotNode, n as FullEntity, o as toRpcSelect, p as Expression, r as ProjectedEntity, t as EntitySelection, u as ComparisonNode, v as and, w as lt, x as gt, y as eq } from "../selection-C6KeWJ7g.cjs";
2
+ import "../index-NbfnXxgr.cjs";
3
+ import "../flags-CRjPpoh3.cjs";
4
+ import { a as QueryErrorKind, c as QueryRequest, i as QueryError, l as QueryResponse, n as QueryResult, o as UnsupportedOperatorError, r as InvalidPredicateError, s as MAX_LIMIT, t as SelectQueryBuilder, u as runQuery } from "../index-CMeD8uEq.cjs";
5
+ export { AndNode, ComparisonNode, ComparisonOperator, EntitySelection, ExistsNode, Expression, FullEntity, InvalidPredicateError, MAX_LIMIT, NotNode, OrNode, ProjectedEntity, QueryError, QueryErrorKind, QueryRequest, QueryResponse, QueryResult, SelectArg, SelectQueryBuilder, SelectionFields, StartsWithNode, TypeOfNode, UnsupportedOperatorError, and, eq, exists, gt, gte, hasType, lt, lte, ne, not, or, render, runQuery, startsWith, toRpcSelect };
@@ -1,3 +1,6 @@
1
- import "../entity-qoLMAuuk.js";
2
- import { C as neq, S as lte, T as or, _ as and, a as asc, b as gte, c as FullEntity, d as SelectionFields, f as selectionToIncludeData, g as PredicateType, h as PredicateContainerType, i as SelectQueryBuilder, l as ProjectedEntity, m as Predicate, n as OrderByAttribute, o as desc, p as QueryResult, r as QueryBuilder, s as EntitySelection, t as BaseQueryBuilder, u as SelectArg, v as eq, w as not, x as lt, y as gt } from "../index-DdspxNAA.js";
3
- export { BaseQueryBuilder, EntitySelection, FullEntity, OrderByAttribute, Predicate, PredicateContainerType, PredicateType, ProjectedEntity, QueryBuilder, QueryResult, SelectArg, SelectQueryBuilder, SelectionFields, and, asc, desc, eq, gt, gte, lt, lte, neq, not, or, selectionToIncludeData };
1
+ import { A as startsWith, C as hasType, D as not, E as ne, O as or, S as gte, T as lte, _ as TypeOfNode, a as SelectionFields, b as exists, d as ComparisonOperator, f as ExistsNode, g as StartsWithNode, h as OrNode, i as SelectArg, k as render, l as AndNode, m as NotNode, n as FullEntity, o as toRpcSelect, p as Expression, r as ProjectedEntity, t as EntitySelection, u as ComparisonNode, v as and, w as lt, x as gt, y as eq } from "../selection-mjiiAGDO.js";
2
+ import "../codec-M74UR1_0.js";
3
+ import "../index-D0IzFwMX.js";
4
+ import "../flags-5dTNRnow.js";
5
+ import { a as QueryErrorKind, c as QueryRequest, i as QueryError, l as QueryResponse, n as QueryResult, o as UnsupportedOperatorError, r as InvalidPredicateError, s as MAX_LIMIT, t as SelectQueryBuilder, u as runQuery } from "../index-Dz4SkQWg.js";
6
+ export { AndNode, ComparisonNode, ComparisonOperator, EntitySelection, ExistsNode, Expression, FullEntity, InvalidPredicateError, MAX_LIMIT, NotNode, OrNode, ProjectedEntity, QueryError, QueryErrorKind, QueryRequest, QueryResponse, QueryResult, SelectArg, SelectQueryBuilder, SelectionFields, StartsWithNode, TypeOfNode, UnsupportedOperatorError, and, eq, exists, gt, gte, hasType, lt, lte, ne, not, or, render, runQuery, startsWith, toRpcSelect };
@@ -1,138 +1,9 @@
1
- import { a as desc, i as asc, n as QueryBuilder, o as selectionToIncludeData, r as SelectQueryBuilder, s as QueryResult, t as BaseQueryBuilder } from "../queryBuilder-D2uwP9jI.js";
2
- import "../consts-BV4PR-de.js";
1
+ import "../attributes-BJGuhsqp.js";
2
+ import "../errors-CwPJ16bn.js";
3
+ import "../flags-Cr76ldwF.js";
4
+ import "../logger-CVpvU8ik.js";
5
+ import "../attr-GcQKatub.js";
6
+ import "../entity-BYQR1uoe.js";
7
+ import { _ as MAX_LIMIT, a as eq, b as QueryError, c as gte, d as lte, f as ne, g as startsWith, h as render, i as and, l as hasType, m as or, n as QueryResult, o as exists, p as not, r as toRpcSelect, s as gt, t as SelectQueryBuilder, u as lt, v as runQuery, x as UnsupportedOperatorError, y as InvalidPredicateError } from "../queryBuilder-BwauPaGO.js";
3
8
 
4
- //#region src/query/predicate.ts
5
- function or(...predicates) {
6
- return {
7
- type: "or",
8
- predicates: predicates.flat()
9
- };
10
- }
11
- function and(...predicates) {
12
- return {
13
- type: "and",
14
- predicates: predicates.flat()
15
- };
16
- }
17
- /**
18
- * Creates an equality predicate
19
- * @param key - The key to compare
20
- * @param value - The value to compare
21
- * @returns The equality predicate
22
- *
23
- * @example
24
- * const predicate = eq("name", "John")
25
- * // result = { type: "eq", key: "name", value: "John" }
26
- */
27
- function eq(key, value) {
28
- return {
29
- type: "eq",
30
- key,
31
- value
32
- };
33
- }
34
- /**
35
- * Creates a not equal predicate
36
- * @param key - The key to compare
37
- * @param value - The value to compare
38
- * @returns The not equal predicate
39
- *
40
- * @example
41
- * const predicate = neq("name", "John")
42
- * // result = { type: "neq", key: "name", value: "John" }
43
- */
44
- function neq(key, value) {
45
- return {
46
- type: "neq",
47
- key,
48
- value
49
- };
50
- }
51
- /**
52
- * Creates a greater than predicate
53
- * @param key - The key to compare
54
- * @param value - The value to compare
55
- * @returns The greater than predicate
56
- *
57
- * @example
58
- * const predicate = gt("name", "John")
59
- * // result = { type: "gt", key: "name", value: "John" }
60
- */
61
- function gt(key, value) {
62
- return {
63
- type: "gt",
64
- key,
65
- value
66
- };
67
- }
68
- /**
69
- * Creates a greater than or equal predicate
70
- * @param key - The key to compare
71
- * @param value - The value to compare
72
- * @returns The greater than or equal predicate
73
- *
74
- * @example
75
- * const predicate = gte("name", "John")
76
- * // result = { type: "gte", key: "name", value: "John" }
77
- */
78
- function gte(key, value) {
79
- return {
80
- type: "gte",
81
- key,
82
- value
83
- };
84
- }
85
- /**
86
- * Creates a less than predicate
87
- * @param key - The key to compare
88
- * @param value - The value to compare
89
- * @returns The less than predicate
90
- *
91
- * @example
92
- * const predicate = lt("name", "John")
93
- * // result = { type: "lt", key: "name", value: "John" }
94
- */
95
- function lt(key, value) {
96
- return {
97
- type: "lt",
98
- key,
99
- value
100
- };
101
- }
102
- /**
103
- * Creates a less than or equal predicate
104
- * @param key - The key to compare
105
- * @param value - The value to compare
106
- * @returns The less than or equal predicate
107
- *
108
- * @example
109
- * const predicate = lte("name", "John")
110
- * // result = { type: "lte", key: "name", value: "John" }
111
- */
112
- function lte(key, value) {
113
- return {
114
- type: "lte",
115
- key,
116
- value
117
- };
118
- }
119
- /**
120
- * Creates a not predicate
121
- * @param key - The key to compare
122
- * @returns The not predicate
123
- *
124
- * @example
125
- * const predicate = not("name")
126
- * // result = { type: "not", key: "name", value: "" }
127
- */
128
- function not(key) {
129
- return {
130
- type: "not",
131
- key,
132
- value: ""
133
- };
134
- }
135
-
136
- //#endregion
137
- export { BaseQueryBuilder, QueryBuilder, QueryResult, SelectQueryBuilder, and, asc, desc, eq, gt, gte, lt, lte, neq, not, or, selectionToIncludeData };
138
- //# sourceMappingURL=index.js.map
9
+ export { InvalidPredicateError, MAX_LIMIT, QueryError, QueryResult, SelectQueryBuilder, UnsupportedOperatorError, and, eq, exists, gt, gte, hasType, lt, lte, ne, not, or, render, runQuery, startsWith, toRpcSelect };