@arkiv-network/sdk 0.6.8 → 0.7.0

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 (83) hide show
  1. package/README.md +52 -16
  2. package/dist/chains/index.d.cts +25 -25
  3. package/dist/consts-AUoL-v42.cjs +18 -0
  4. package/dist/consts-BV4PR-de.js +7 -0
  5. package/dist/consts-BV4PR-de.js.map +1 -0
  6. package/dist/{query-CO6f35AE.d.cts → entity-B6g_EPm1.d.cts} +78 -31
  7. package/dist/entity-B6g_EPm1.d.cts.map +1 -0
  8. package/dist/{query-BhdmAzYg.d.ts → entity-qoLMAuuk.d.ts} +78 -31
  9. package/dist/entity-qoLMAuuk.d.ts.map +1 -0
  10. package/dist/index-DdspxNAA.d.ts +481 -0
  11. package/dist/index-DdspxNAA.d.ts.map +1 -0
  12. package/dist/index-Ds9dwqb5.d.cts +481 -0
  13. package/dist/index-Ds9dwqb5.d.cts.map +1 -0
  14. package/dist/index.cjs +63 -28
  15. package/dist/index.d.cts +90 -5
  16. package/dist/index.d.cts.map +1 -1
  17. package/dist/index.d.ts +91 -6
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +58 -21
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-Da9gJMG5.d.ts → payload-B2kFJyah.d.ts} +1 -1
  22. package/dist/{payload-Da9gJMG5.d.ts.map → payload-B2kFJyah.d.ts.map} +1 -1
  23. package/dist/payload-Claf2jUO.js +13 -0
  24. package/dist/payload-Claf2jUO.js.map +1 -0
  25. package/dist/{payload-vwU3Rc6P.cjs → payload-DpA5PA-w.cjs} +0 -17
  26. package/dist/query/index.cjs +10 -28
  27. package/dist/query/index.d.cts +3 -3
  28. package/dist/query/index.d.ts +3 -3
  29. package/dist/query/index.js +7 -28
  30. package/dist/query/index.js.map +1 -1
  31. package/dist/{queryBuilder-DonAg1aq.js → queryBuilder-D2uwP9jI.js} +209 -89
  32. package/dist/queryBuilder-D2uwP9jI.js.map +1 -0
  33. package/dist/{queryBuilder-DM-YO1Y7.cjs → queryBuilder-UW2MCaX4.cjs} +237 -87
  34. package/dist/types/index.d.cts +1 -1
  35. package/dist/types/index.d.ts +1 -1
  36. package/dist/utils/index.cjs +4 -10
  37. package/dist/utils/index.d.cts +0 -1
  38. package/dist/utils/index.d.cts.map +1 -1
  39. package/dist/utils/index.d.ts +1 -2
  40. package/dist/utils/index.d.ts.map +1 -1
  41. package/dist/utils/index.js +2 -3
  42. package/dist/utils/index.js.map +1 -1
  43. package/package.json +11 -15
  44. package/src/actions/public/buildQuery.ts +4 -0
  45. package/src/actions/public/query.ts +10 -0
  46. package/src/actions/wallet/createEntity.ts +12 -2
  47. package/src/actions/wallet/extendEntity.ts +6 -1
  48. package/src/actions/wallet/updateEntity.ts +12 -2
  49. package/src/clients/createPublicClient.test.ts +2 -0
  50. package/src/clients/decorators/arkivPublic.ts +67 -2
  51. package/src/clients/decorators/arkivWallet.ts +18 -0
  52. package/src/errors.ts +18 -0
  53. package/src/index.ts +0 -3
  54. package/src/query/engine.ts +22 -13
  55. package/src/query/index.ts +1 -0
  56. package/src/query/predicate.test.ts +43 -0
  57. package/src/query/predicate.ts +14 -10
  58. package/src/query/queryBuilder.test.ts +22 -0
  59. package/src/query/queryBuilder.ts +221 -106
  60. package/src/query/queryResult.ts +13 -7
  61. package/src/query/selectQueryBuilder.test.ts +210 -0
  62. package/src/query/selection.test.ts +120 -0
  63. package/src/query/selection.ts +116 -0
  64. package/src/types/attributes.ts +12 -0
  65. package/src/utils/arkivTransactions.test.ts +62 -0
  66. package/src/utils/arkivTransactions.ts +36 -27
  67. package/src/utils/index.ts +0 -1
  68. package/src/utils/validation.test.ts +60 -0
  69. package/src/utils/validation.ts +32 -0
  70. package/dist/accounts/index.cjs +0 -9
  71. package/dist/accounts/index.d.cts +0 -1
  72. package/dist/accounts/index.d.ts +0 -1
  73. package/dist/accounts/index.js +0 -1
  74. package/dist/payload-DKBYYjeA.js +0 -18
  75. package/dist/payload-DKBYYjeA.js.map +0 -1
  76. package/dist/query-BhdmAzYg.d.ts.map +0 -1
  77. package/dist/query-CO6f35AE.d.cts.map +0 -1
  78. package/dist/queryBuilder-BvoQXa_u.d.ts +0 -328
  79. package/dist/queryBuilder-BvoQXa_u.d.ts.map +0 -1
  80. package/dist/queryBuilder-DonAg1aq.js.map +0 -1
  81. package/dist/queryBuilder-zTsKXctT.d.cts +0 -328
  82. package/dist/queryBuilder-zTsKXctT.d.cts.map +0 -1
  83. package/src/accounts/index.ts +0 -1
package/dist/index.d.cts CHANGED
@@ -1,8 +1,7 @@
1
- import { A as RpcIncludeData, C as CreateEntityReturnType, D as ArkivClient, E as GetBlockTimingReturnType, M as RpcQueryOptions, N as MimeType, O as ArkivRpcSchema, S as CreateEntityParameters, T as ChangeOwnershipReturnType, _ as UpdateEntityReturnType, a as Entity, b as DeleteEntityParameters, c as OnEntityDeletedEvent, d as OnEntityOwnerChangedEvent, f as OnEntityUpdatedEvent, g as UpdateEntityParameters, h as MutateEntitiesReturnType, i as QueryReturnType, j as RpcOrderByAttribute, k as RpcEntity, l as OnEntityExpiredEvent, m as MutateEntitiesParameters, n as QueryOptionsIncludeData, o as TxParams, p as Attribute, r as QueryOptionsOrderBy, s as OnEntityCreatedEvent, t as QueryOptions, u as OnEntityExpiresInExtendedEvent, v as ExtendEntityParameters, w as ChangeOwnershipParameters, x as DeleteEntityReturnType, y as ExtendEntityReturnType } from "./query-CO6f35AE.cjs";
2
- import { n as QueryBuilder } from "./queryBuilder-zTsKXctT.cjs";
1
+ import { A as RpcIncludeData, C as QueryOptionsIncludeData, D as ArkivClient, E as GetBlockTimingReturnType, M as RpcQueryOptions, N as MimeType, O as ArkivRpcSchema, S as QueryOptions, T as QueryReturnType, _ as DeleteEntityReturnType, a as OnEntityExpiredEvent, b as ChangeOwnershipParameters, c as OnEntityUpdatedEvent, d as MutateEntitiesReturnType, f as UpdateEntityParameters, g as DeleteEntityParameters, h as ExtendEntityReturnType, i as OnEntityDeletedEvent, j as RpcOrderByAttribute, k as RpcEntity, l as Attribute, m as ExtendEntityParameters, n as TxParams, o as OnEntityExpiresInExtendedEvent, p as UpdateEntityReturnType, r as OnEntityCreatedEvent, s as OnEntityOwnerChangedEvent, t as Entity, u as MutateEntitiesParameters, v as CreateEntityParameters, w as QueryOptionsOrderBy, x as ChangeOwnershipReturnType, y as CreateEntityReturnType } from "./entity-B6g_EPm1.cjs";
2
+ import { c as FullEntity, i as SelectQueryBuilder, l as ProjectedEntity, r as QueryBuilder, s as EntitySelection, u as SelectArg } from "./index-Ds9dwqb5.cjs";
3
3
  import { n as stringToPayload, t as jsonToPayload } from "./payload-CJN8fTvX.cjs";
4
4
  import { Account, Address, Chain, Client, Hex, ParseAccount, Prettify, PublicActions, PublicClientConfig, RpcSchema, Transport, WalletActions, WalletClientConfig } from "viem";
5
- export * from "viem";
6
5
 
7
6
  //#region src/clients/decorators/arkivPublic.d.ts
8
7
  type PublicArkivActions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = Pick<PublicActions<transport, chain, account>, "getBalance" | "getBlock" | "getBlockNumber" | "getChainId" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "waitForTransactionReceipt" | "watchEvent"> & {
@@ -29,12 +28,75 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
29
28
  * // }
30
29
  */
31
30
  getEntity: (key: Hex) => Promise<Entity>;
31
+ /**
32
+ * Returns a SelectQueryBuilder for building and executing queries — the recommended way to
33
+ * read entities. You declare up front which parts of an entity you want returned, so results
34
+ * always contain exactly the data you asked for.
35
+ *
36
+ * - Docs: https://docs.arkiv.network/ts-sdk/actions/public/query
37
+ *
38
+ * @param selection - What to include in the results. Omit it (or pass `"*"`) to select everything,
39
+ * or pass an object to select specific parts (at least one field is required). Every part is
40
+ * opt-in, including the `key`. The selection is flat — each field maps to an entity field.
41
+ * {@link SelectArg}
42
+ * @returns A SelectQueryBuilder instance for building and executing queries. {@link SelectQueryBuilder}
43
+ *
44
+ * @example
45
+ * import { createPublicClient, http } from 'arkiv'
46
+ * import { braga } from 'arkiv/chains'
47
+ * import { eq } from 'arkiv/query'
48
+ *
49
+ * const client = createPublicClient({
50
+ * chain: braga,
51
+ * transport: http(),
52
+ * })
53
+ * // select everything
54
+ * await client.select().where(eq("category", "docs")).fetch()
55
+ * await client.select("*").where(eq("category", "docs")).fetch()
56
+ * // only the key
57
+ * await client.select({ key: true }).where(eq("category", "docs")).fetch()
58
+ * // select specific fields — result typed { owner: Hex; attributes: Attribute[] }
59
+ * await client.select({ owner: true, attributes: true }).fetch()
60
+ * // a single field — result typed { owner: Hex }
61
+ * await client.select({ owner: true }).fetch()
62
+ */
63
+ select: {
64
+ /** Select every field. Pass nothing or `"*"`; the returned entities contain all fields. */
65
+ (selection?: "*"): SelectQueryBuilder<FullEntity>;
66
+ /**
67
+ * Pick the entity fields to return. Set the ones you want to `true` (at least one is required);
68
+ * the result is typed to exactly those fields, so reading anything else is a compile error.
69
+ *
70
+ * Available fields: `key`, `owner`, `creator`, `contentType`, `payload`, `attributes`,
71
+ * `expiresAtBlock`, `createdAtBlock`, `lastModifiedAtBlock`, `transactionIndexInBlock`,
72
+ * `operationIndexInTransaction`.
73
+ *
74
+ * Pass the selection inline so its fields stay literal `true`. A selection stored in a `let`/
75
+ * `const` variable widens to `boolean` and the result type can no longer be narrowed — annotate
76
+ * it `as const` (e.g. `const sel = { owner: true } as const`) in that case.
77
+ *
78
+ * @example
79
+ * client.select({ owner: true, attributes: true }) // entities typed { owner, attributes }
80
+ * client.select({ key: true, payload: true }) // includes payload → toText()/toJson() too
81
+ */
82
+ <const S extends EntitySelection>(selection: S): SelectQueryBuilder<ProjectedEntity<S>>;
83
+ /**
84
+ * Dynamic selection: accepts a value typed {@link SelectArg} (e.g. built at runtime). The
85
+ * result cannot be narrowed in this case, so the entities are typed as the full entity.
86
+ */
87
+ (selection: SelectArg): SelectQueryBuilder<FullEntity>;
88
+ };
32
89
  /**
33
90
  * Returns a QueryBuilder instance for building and executing queries.
34
91
  * The QueryBuilder object follows the Builder pattern, allowing you to chain methods to build a query and then execute it.
35
92
  *
36
93
  * - Docs: https://docs.arkiv.network/ts-sdk/actions/public/query
37
94
  *
95
+ * @deprecated Use {@link select} instead. `buildQuery()` returns only the entity `key` unless
96
+ * you remember to opt in to data with `withAttributes()`/`withMetadata()`/`withPayload()`, which
97
+ * is an easy mistake. `select()` makes the selection explicit. This method remains for backwards
98
+ * compatibility and will be removed in a future release.
99
+ *
38
100
  * @returns A QueryBuilder instance for building and executing queries. {@link QueryBuilder}
39
101
  *
40
102
  * @example
@@ -73,7 +135,6 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
73
135
  * payload: true,
74
136
  * metadata: true,
75
137
  * },
76
- * orderBy: [{ name: "key", type: "string", desc: "asc" }],
77
138
  * resultsPerPage: 10,
78
139
  * cursor: undefined,
79
140
  * atBlock: undefined,
@@ -192,6 +253,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
192
253
  * @param txParams - Optional transaction parameters
193
254
  * @returns The created entity with transaction hash
194
255
  *
256
+ * @throws {InvalidExpirationError} If `expiresIn` is not a positive integer
257
+ * that is a multiple of the block time (2 seconds).
258
+ * @throws {InvalidAttributeError} If a numeric attribute value is not an
259
+ * integer.
260
+ *
195
261
  * @example
196
262
  * import { createPublicClient, http } from 'arkiv'
197
263
  * import { braga } from 'arkiv/chains'
@@ -223,6 +289,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
223
289
  * @param txParams - Optional transaction parameters
224
290
  * @returns The updated entity with transaction hash
225
291
  *
292
+ * @throws {InvalidExpirationError} If `expiresIn` is not a positive integer
293
+ * that is a multiple of the block time (2 seconds).
294
+ * @throws {InvalidAttributeError} If a numeric attribute value is not an
295
+ * integer.
296
+ *
226
297
  * @example
227
298
  * import { createWalletClient, http } from 'arkiv'
228
299
  * import { braga } from 'arkiv/chains'
@@ -270,6 +341,9 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
270
341
  * @param txParams - Optional transaction parameters
271
342
  * @returns The updated entity with transaction hash
272
343
  *
344
+ * @throws {InvalidExpirationError} If `expiresIn` is not a positive integer
345
+ * that is a multiple of the block time (2 seconds).
346
+ *
273
347
  * @example
274
348
  * import { createWalletClient, http } from 'arkiv'
275
349
  * import { braga } from 'arkiv/chains'
@@ -310,6 +384,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
310
384
  * @param txParams - Optional transaction parameters
311
385
  * @returns The mutation result with transaction hash
312
386
  *
387
+ * @throws {InvalidExpirationError} If any create/update/extension `expiresIn`
388
+ * is not a positive integer that is a multiple of the block time (2 seconds).
389
+ * @throws {InvalidAttributeError} If a numeric attribute value is not an
390
+ * integer.
391
+ *
313
392
  * @example
314
393
  * import { createWalletClient, http } from 'arkiv'
315
394
  * import { braga } from 'arkiv/chains'
@@ -375,6 +454,12 @@ declare function createWalletClient<transport extends Transport, chain extends C
375
454
  declare class EntityMutationError extends Error {
376
455
  constructor(message: string);
377
456
  }
457
+ declare class InvalidExpirationError extends Error {
458
+ constructor(expiresIn: unknown);
459
+ }
460
+ declare class InvalidAttributeError extends Error {
461
+ constructor(key: string, value: number);
462
+ }
378
463
  declare class NoMoreResultsError extends Error {
379
464
  constructor();
380
465
  }
@@ -394,5 +479,5 @@ declare class NoEntityFoundError extends Error {
394
479
  */
395
480
  declare function chainFromName(name: string): Chain;
396
481
  //#endregion
397
- export { type ArkivClient, ArkivRpcSchema, Attribute, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityMutationError, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, MimeType, MutateEntitiesParameters, MutateEntitiesReturnType, NoCursorOrLimitError, NoEntityFoundError, NoMoreResultsError, OnEntityCreatedEvent, OnEntityDeletedEvent, OnEntityExpiredEvent, OnEntityExpiresInExtendedEvent, OnEntityOwnerChangedEvent, OnEntityUpdatedEvent, type PublicArkivActions, type PublicArkivClient, QueryOptions, QueryOptionsIncludeData, QueryOptionsOrderBy, QueryReturnType, RpcEntity, RpcIncludeData, RpcOrderByAttribute, RpcQueryOptions, TxParams, UpdateEntityParameters, UpdateEntityReturnType, type WalletArkivActions, type WalletArkivClient, chainFromName, createPublicClient, createWalletClient, jsonToPayload, stringToPayload };
482
+ export { type ArkivClient, ArkivRpcSchema, Attribute, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityMutationError, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, InvalidAttributeError, InvalidExpirationError, MimeType, MutateEntitiesParameters, MutateEntitiesReturnType, NoCursorOrLimitError, NoEntityFoundError, NoMoreResultsError, OnEntityCreatedEvent, OnEntityDeletedEvent, OnEntityExpiredEvent, OnEntityExpiresInExtendedEvent, OnEntityOwnerChangedEvent, OnEntityUpdatedEvent, type PublicArkivActions, type PublicArkivClient, QueryOptions, QueryOptionsIncludeData, QueryOptionsOrderBy, QueryReturnType, RpcEntity, RpcIncludeData, RpcOrderByAttribute, RpcQueryOptions, TxParams, UpdateEntityParameters, UpdateEntityReturnType, type WalletArkivActions, type WalletArkivClient, chainFromName, createPublicClient, createWalletClient, jsonToPayload, stringToPayload };
398
483
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts","../src/errors.ts","../src/utils/chains.ts"],"sourcesContent":[],"mappings":";;;;;;;KAgBY,qCACQ,YAAY,yBAChB,oBAAoB,mCAClB,sBAAsB,uBACpC,KACF,cAAc,WAAW,OAAO;;;AALlC;;;;;;;;;;;;;;;;;;;;EAmIwB,SAAA,EAAA,CAAA,GAAA,EA5FL,GA4FK,EAAA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iBH2BiB,CG3BC,SH2BD,EG3BY,KH2BZ,EG3BmB,YH2BnB,CG3BgC,gBH2BhC,CAAA,EG3BmD,SH2BnD,CAAA;;;cI7EP,mBAAA,SAA4B,KAAA;;;cAO5B,kBAAA,SAA2B,KAAA;;;cAO3B,oBAAA,SAA6B,KAAA;;AJE1C;AACoB,cIIP,kBAAA,SAA2B,KAAA,CJJpB;EAAY,WAAA,CAAA;;;;;;;;;;iBKLhB,aAAA,gBAA6B"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts","../src/errors.ts","../src/utils/chains.ts"],"sourcesContent":[],"mappings":";;;;;;AAiBY,KAAA,kBAAkB,CAAA,kBACV,SADU,GACE,SADF,EAAA,cAEd,KAFc,GAAA,SAAA,GAEM,KAFN,GAAA,SAAA,EAAA,gBAGZ,OAHY,GAAA,SAAA,GAGU,OAHV,GAAA,SAAA,CAAA,GAI1B,IAJ0B,CAK5B,aAL4B,CAKd,SALc,EAKH,KALG,EAKI,OALJ,CAAA,EAAA,YAAA,GAAA,UAAA,GAAA,gBAAA,GAAA,YAAA,GAAA,SAAA,GAAA,gBAAA,GAAA,qBAAA,GAAA,uBAAA,GAAA,2BAAA,GAAA,YAAA,CAAA,GAAA;EACV;;;;;;;;;;;;;;;;;;;;;;EAgG2B,SAAA,EAAA,CAAA,GAAA,EA1D5B,GA0D4B,EAAA,GA1DpB,OA0DoB,CA1DZ,MA0DY,CAAA;EAAnB;;;;;;;;;;;;;;;;;;;;;;;ACnG5B;;;;;;;;;EAMoB,MAAA,EAAA;IAAO;IAAkB,CAAA,SAAA,CAAA,EAAA,GAAA,CAAA,EDuEtB,kBCvEsB,CDuEH,UCvEG,CAAA;IAA8B;;;;;;AAsB3E;;;;;;;;;;IAMqE,CAAA,gBD4DhD,eC5DgD,CAAA,CAAA,SAAA,ED4DpB,CC5DoB,CAAA,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;;;;;;;;AALF;AACoB,iBKNJ,aAAA,CLMI,IAAA,EAAA,MAAA,CAAA,EKNyB,KLMzB"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { A as RpcIncludeData, C as CreateEntityReturnType, D as ArkivClient, E as GetBlockTimingReturnType, M as RpcQueryOptions, N as MimeType, O as ArkivRpcSchema, S as CreateEntityParameters, T as ChangeOwnershipReturnType, _ as UpdateEntityReturnType, a as Entity, b as DeleteEntityParameters, c as OnEntityDeletedEvent, d as OnEntityOwnerChangedEvent, f as OnEntityUpdatedEvent, g as UpdateEntityParameters, h as MutateEntitiesReturnType, i as QueryReturnType, j as RpcOrderByAttribute, k as RpcEntity, l as OnEntityExpiredEvent, m as MutateEntitiesParameters, n as QueryOptionsIncludeData, o as TxParams, p as Attribute, r as QueryOptionsOrderBy, s as OnEntityCreatedEvent, t as QueryOptions, u as OnEntityExpiresInExtendedEvent, v as ExtendEntityParameters, w as ChangeOwnershipParameters, x as DeleteEntityReturnType, y as ExtendEntityReturnType } from "./query-BhdmAzYg.js";
2
- import { n as QueryBuilder } from "./queryBuilder-BvoQXa_u.js";
3
- import { n as stringToPayload, t as jsonToPayload } from "./payload-Da9gJMG5.js";
1
+ import { A as RpcIncludeData, C as QueryOptionsIncludeData, D as ArkivClient, E as GetBlockTimingReturnType, M as RpcQueryOptions, N as MimeType, O as ArkivRpcSchema, S as QueryOptions, T as QueryReturnType, _ as DeleteEntityReturnType, a as OnEntityExpiredEvent, b as ChangeOwnershipParameters, c as OnEntityUpdatedEvent, d as MutateEntitiesReturnType, f as UpdateEntityParameters, g as DeleteEntityParameters, h as ExtendEntityReturnType, i as OnEntityDeletedEvent, j as RpcOrderByAttribute, k as RpcEntity, l as Attribute, m as ExtendEntityParameters, n as TxParams, o as OnEntityExpiresInExtendedEvent, p as UpdateEntityReturnType, r as OnEntityCreatedEvent, s as OnEntityOwnerChangedEvent, t as Entity, u as MutateEntitiesParameters, v as CreateEntityParameters, w as QueryOptionsOrderBy, x as ChangeOwnershipReturnType, y as CreateEntityReturnType } from "./entity-qoLMAuuk.js";
2
+ import { c as FullEntity, i as SelectQueryBuilder, l as ProjectedEntity, r as QueryBuilder, s as EntitySelection, u as SelectArg } from "./index-DdspxNAA.js";
3
+ import { n as stringToPayload, t as jsonToPayload } from "./payload-B2kFJyah.js";
4
4
  import { Account, Address, Chain, Client, Hex, ParseAccount, Prettify, PublicActions, PublicClientConfig, RpcSchema, Transport, WalletActions, WalletClientConfig } from "viem";
5
- export * from "viem";
6
5
 
7
6
  //#region src/clients/decorators/arkivPublic.d.ts
8
7
  type PublicArkivActions<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = Pick<PublicActions<transport, chain, account>, "getBalance" | "getBlock" | "getBlockNumber" | "getChainId" | "getLogs" | "getTransaction" | "getTransactionCount" | "getTransactionReceipt" | "waitForTransactionReceipt" | "watchEvent"> & {
@@ -29,12 +28,75 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
29
28
  * // }
30
29
  */
31
30
  getEntity: (key: Hex) => Promise<Entity>;
31
+ /**
32
+ * Returns a SelectQueryBuilder for building and executing queries — the recommended way to
33
+ * read entities. You declare up front which parts of an entity you want returned, so results
34
+ * always contain exactly the data you asked for.
35
+ *
36
+ * - Docs: https://docs.arkiv.network/ts-sdk/actions/public/query
37
+ *
38
+ * @param selection - What to include in the results. Omit it (or pass `"*"`) to select everything,
39
+ * or pass an object to select specific parts (at least one field is required). Every part is
40
+ * opt-in, including the `key`. The selection is flat — each field maps to an entity field.
41
+ * {@link SelectArg}
42
+ * @returns A SelectQueryBuilder instance for building and executing queries. {@link SelectQueryBuilder}
43
+ *
44
+ * @example
45
+ * import { createPublicClient, http } from 'arkiv'
46
+ * import { braga } from 'arkiv/chains'
47
+ * import { eq } from 'arkiv/query'
48
+ *
49
+ * const client = createPublicClient({
50
+ * chain: braga,
51
+ * transport: http(),
52
+ * })
53
+ * // select everything
54
+ * await client.select().where(eq("category", "docs")).fetch()
55
+ * await client.select("*").where(eq("category", "docs")).fetch()
56
+ * // only the key
57
+ * await client.select({ key: true }).where(eq("category", "docs")).fetch()
58
+ * // select specific fields — result typed { owner: Hex; attributes: Attribute[] }
59
+ * await client.select({ owner: true, attributes: true }).fetch()
60
+ * // a single field — result typed { owner: Hex }
61
+ * await client.select({ owner: true }).fetch()
62
+ */
63
+ select: {
64
+ /** Select every field. Pass nothing or `"*"`; the returned entities contain all fields. */
65
+ (selection?: "*"): SelectQueryBuilder<FullEntity>;
66
+ /**
67
+ * Pick the entity fields to return. Set the ones you want to `true` (at least one is required);
68
+ * the result is typed to exactly those fields, so reading anything else is a compile error.
69
+ *
70
+ * Available fields: `key`, `owner`, `creator`, `contentType`, `payload`, `attributes`,
71
+ * `expiresAtBlock`, `createdAtBlock`, `lastModifiedAtBlock`, `transactionIndexInBlock`,
72
+ * `operationIndexInTransaction`.
73
+ *
74
+ * Pass the selection inline so its fields stay literal `true`. A selection stored in a `let`/
75
+ * `const` variable widens to `boolean` and the result type can no longer be narrowed — annotate
76
+ * it `as const` (e.g. `const sel = { owner: true } as const`) in that case.
77
+ *
78
+ * @example
79
+ * client.select({ owner: true, attributes: true }) // entities typed { owner, attributes }
80
+ * client.select({ key: true, payload: true }) // includes payload → toText()/toJson() too
81
+ */
82
+ <const S extends EntitySelection>(selection: S): SelectQueryBuilder<ProjectedEntity<S>>;
83
+ /**
84
+ * Dynamic selection: accepts a value typed {@link SelectArg} (e.g. built at runtime). The
85
+ * result cannot be narrowed in this case, so the entities are typed as the full entity.
86
+ */
87
+ (selection: SelectArg): SelectQueryBuilder<FullEntity>;
88
+ };
32
89
  /**
33
90
  * Returns a QueryBuilder instance for building and executing queries.
34
91
  * The QueryBuilder object follows the Builder pattern, allowing you to chain methods to build a query and then execute it.
35
92
  *
36
93
  * - Docs: https://docs.arkiv.network/ts-sdk/actions/public/query
37
94
  *
95
+ * @deprecated Use {@link select} instead. `buildQuery()` returns only the entity `key` unless
96
+ * you remember to opt in to data with `withAttributes()`/`withMetadata()`/`withPayload()`, which
97
+ * is an easy mistake. `select()` makes the selection explicit. This method remains for backwards
98
+ * compatibility and will be removed in a future release.
99
+ *
38
100
  * @returns A QueryBuilder instance for building and executing queries. {@link QueryBuilder}
39
101
  *
40
102
  * @example
@@ -73,7 +135,6 @@ type PublicArkivActions<transport extends Transport = Transport, chain extends C
73
135
  * payload: true,
74
136
  * metadata: true,
75
137
  * },
76
- * orderBy: [{ name: "key", type: "string", desc: "asc" }],
77
138
  * resultsPerPage: 10,
78
139
  * cursor: undefined,
79
140
  * atBlock: undefined,
@@ -192,6 +253,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
192
253
  * @param txParams - Optional transaction parameters
193
254
  * @returns The created entity with transaction hash
194
255
  *
256
+ * @throws {InvalidExpirationError} If `expiresIn` is not a positive integer
257
+ * that is a multiple of the block time (2 seconds).
258
+ * @throws {InvalidAttributeError} If a numeric attribute value is not an
259
+ * integer.
260
+ *
195
261
  * @example
196
262
  * import { createPublicClient, http } from 'arkiv'
197
263
  * import { braga } from 'arkiv/chains'
@@ -223,6 +289,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
223
289
  * @param txParams - Optional transaction parameters
224
290
  * @returns The updated entity with transaction hash
225
291
  *
292
+ * @throws {InvalidExpirationError} If `expiresIn` is not a positive integer
293
+ * that is a multiple of the block time (2 seconds).
294
+ * @throws {InvalidAttributeError} If a numeric attribute value is not an
295
+ * integer.
296
+ *
226
297
  * @example
227
298
  * import { createWalletClient, http } from 'arkiv'
228
299
  * import { braga } from 'arkiv/chains'
@@ -270,6 +341,9 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
270
341
  * @param txParams - Optional transaction parameters
271
342
  * @returns The updated entity with transaction hash
272
343
  *
344
+ * @throws {InvalidExpirationError} If `expiresIn` is not a positive integer
345
+ * that is a multiple of the block time (2 seconds).
346
+ *
273
347
  * @example
274
348
  * import { createWalletClient, http } from 'arkiv'
275
349
  * import { braga } from 'arkiv/chains'
@@ -310,6 +384,11 @@ type WalletArkivActions<transport extends Transport = Transport, chain extends C
310
384
  * @param txParams - Optional transaction parameters
311
385
  * @returns The mutation result with transaction hash
312
386
  *
387
+ * @throws {InvalidExpirationError} If any create/update/extension `expiresIn`
388
+ * is not a positive integer that is a multiple of the block time (2 seconds).
389
+ * @throws {InvalidAttributeError} If a numeric attribute value is not an
390
+ * integer.
391
+ *
313
392
  * @example
314
393
  * import { createWalletClient, http } from 'arkiv'
315
394
  * import { braga } from 'arkiv/chains'
@@ -375,6 +454,12 @@ declare function createWalletClient<transport extends Transport, chain extends C
375
454
  declare class EntityMutationError extends Error {
376
455
  constructor(message: string);
377
456
  }
457
+ declare class InvalidExpirationError extends Error {
458
+ constructor(expiresIn: unknown);
459
+ }
460
+ declare class InvalidAttributeError extends Error {
461
+ constructor(key: string, value: number);
462
+ }
378
463
  declare class NoMoreResultsError extends Error {
379
464
  constructor();
380
465
  }
@@ -394,5 +479,5 @@ declare class NoEntityFoundError extends Error {
394
479
  */
395
480
  declare function chainFromName(name: string): Chain;
396
481
  //#endregion
397
- export { type ArkivClient, ArkivRpcSchema, Attribute, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityMutationError, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, MimeType, MutateEntitiesParameters, MutateEntitiesReturnType, NoCursorOrLimitError, NoEntityFoundError, NoMoreResultsError, OnEntityCreatedEvent, OnEntityDeletedEvent, OnEntityExpiredEvent, OnEntityExpiresInExtendedEvent, OnEntityOwnerChangedEvent, OnEntityUpdatedEvent, type PublicArkivActions, type PublicArkivClient, QueryOptions, QueryOptionsIncludeData, QueryOptionsOrderBy, QueryReturnType, RpcEntity, RpcIncludeData, RpcOrderByAttribute, RpcQueryOptions, TxParams, UpdateEntityParameters, UpdateEntityReturnType, type WalletArkivActions, type WalletArkivClient, chainFromName, createPublicClient, createWalletClient, jsonToPayload, stringToPayload };
482
+ export { type ArkivClient, ArkivRpcSchema, Attribute, ChangeOwnershipParameters, ChangeOwnershipReturnType, CreateEntityParameters, CreateEntityReturnType, DeleteEntityParameters, DeleteEntityReturnType, Entity, EntityMutationError, ExtendEntityParameters, ExtendEntityReturnType, GetBlockTimingReturnType, InvalidAttributeError, InvalidExpirationError, MimeType, MutateEntitiesParameters, MutateEntitiesReturnType, NoCursorOrLimitError, NoEntityFoundError, NoMoreResultsError, OnEntityCreatedEvent, OnEntityDeletedEvent, OnEntityExpiredEvent, OnEntityExpiresInExtendedEvent, OnEntityOwnerChangedEvent, OnEntityUpdatedEvent, type PublicArkivActions, type PublicArkivClient, QueryOptions, QueryOptionsIncludeData, QueryOptionsOrderBy, QueryReturnType, RpcEntity, RpcIncludeData, RpcOrderByAttribute, RpcQueryOptions, TxParams, UpdateEntityParameters, UpdateEntityReturnType, type WalletArkivActions, type WalletArkivClient, chainFromName, createPublicClient, createWalletClient, jsonToPayload, stringToPayload };
398
483
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts","../src/errors.ts","../src/utils/chains.ts"],"sourcesContent":[],"mappings":";;;;;;;KAgBY,qCACQ,YAAY,yBAChB,oBAAoB,mCAClB,sBAAsB,uBACpC,KACF,cAAc,WAAW,OAAO;;;AALlC;;;;;;;;;;;;;;;;;;;;EAmIwB,SAAA,EAAA,CAAA,GAAA,EA5FL,GA4FK,EAAA,GA5FG,OA4FH,CA5FW,MA4FX,CAAA;EA4BlB;;;;;;;;;;;;;;;;AChKN;;;;EAEoC,UAAA,EAAA,GAAA,GD4DhB,YC5DgB;EACT;;;;;;;;;;;;;AAyB3B;;;;;;;;;;;;;;;;;EAOG,KAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,YAA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,kBAAA,SAA2B,KAAA,CJJpB;EAAY,WAAA,CAAA;;;;;;;;;;iBKLhB,aAAA,gBAA6B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/clients/decorators/arkivPublic.ts","../src/clients/createPublicClient.ts","../src/clients/decorators/arkivWallet.ts","../src/clients/createWalletClient.ts","../src/errors.ts","../src/utils/chains.ts"],"sourcesContent":[],"mappings":";;;;;;AAiBY,KAAA,kBAAkB,CAAA,kBACV,SADU,GACE,SADF,EAAA,cAEd,KAFc,GAAA,SAAA,GAEM,KAFN,GAAA,SAAA,EAAA,gBAGZ,OAHY,GAAA,SAAA,GAGU,OAHV,GAAA,SAAA,CAAA,GAI1B,IAJ0B,CAK5B,aAL4B,CAKd,SALc,EAKH,KALG,EAKI,OALJ,CAAA,EAAA,YAAA,GAAA,UAAA,GAAA,gBAAA,GAAA,YAAA,GAAA,SAAA,GAAA,gBAAA,GAAA,qBAAA,GAAA,uBAAA,GAAA,2BAAA,GAAA,YAAA,CAAA,GAAA;EACV;;;;;;;;;;;;;;;;;;;;;;EAgG2B,SAAA,EAAA,CAAA,GAAA,EA1D5B,GA0D4B,EAAA,GA1DpB,OA0DoB,CA1DZ,MA0DY,CAAA;EAAnB;;;;;;;;;;;;;;;;;;;;;;;ACnG5B;;;;;;;;;EAMoB,MAAA,EAAA;IAAO;IAAkB,CAAA,SAAA,CAAA,EAAA,GAAA,CAAA,EDuEtB,kBCvEsB,CDuEH,UCvEG,CAAA;IAA8B;;;;;;AAsB3E;;;;;;;;;;IAMqE,CAAA,gBD4DhD,eC5DgD,CAAA,CAAA,SAAA,ED4DpB,CC5DoB,CAAA,ED4DhB,kBC5DgB,CD4DG,eC5DH,CD4DmB,CC5DnB,CAAA,CAAA;IAAvD;;;;IACyB,CAAA,SAAA,EDgEvB,SChEuB,CAAA,EDgEX,kBChEW,CDgEQ,UChER,CAAA;EAAgC,CAAA;EAApE;;;;;ACjBH;;;;;;;;;;;;;;;;;;;;EAgFY,UAAA,E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;;;;;;;;;;;ACzCA;AAMA;AAQA;AASA;AAOA;AAOA;;;;AC3BA;;yBH8OY,qCACK,aACR,QAAQ;;;;KC7OL,oCACQ,YAAY,yBAChB,oBAAoB,mCAClB,sBAAsB,uCACpB,wBAAwB,kBACxC,SACF,OAAO,WAAW,OAAO,SAAS,WAAW,mBAAmB,WAAW,OAAO;;;AHJpF;;;;;;;;;;;;;;;;;AA4FqB,iBGlEL,kBHkEK,CAAA,kBGjED,SHiEC,EAAA,cGhEL,KHgEK,GAAA,SAAA,GAAA,SAAA,EAAA,yBG/DM,OH+DN,GG/DgB,OH+DhB,GAAA,SAAA,GAAA,SAAA,EAAA,kBG9DD,SH8DC,GAAA,SAAA,GG9DuB,cH8DvB,CAAA,CAAA,UAAA,EG5DP,kBH4DO,CG5DY,SH4DZ,EG5DuB,KH4DvB,EG5D8B,gBH4D9B,EG5DgD,SH4DhD,CAAA,CAAA,EG3DlB,iBH2DkB,CG3DA,SH2DA,EG3DW,KH2DX,EG3DkB,YH2DlB,CG3D+B,gBH2D/B,CAAA,EG3DkD,SH2DlD,CAAA;;;cI3GR,mBAAA,SAA4B,KAAA;;;cAM5B,sBAAA,SAA+B,KAAA;;;AJShC,cIDC,qBAAA,SAA8B,KAAA,CJCb;EACV,WAAA,CAAA,GAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA;;AACJ,cIMH,kBAAA,SAA2B,KAAA,CJNxB;EAAoB,WAAA,CAAA;;AACI,cIY3B,oBAAA,SAA6B,KAAA,CJZF;EAExB,WAAA,CAAA;;AAAkB,cIiBrB,kBAAA,SAA2B,KAAA,CJjBN;EAAhC,WAAA,CAAA;;;;;;;;;AALF;AACoB,iBKNJ,aAAA,CLMI,IAAA,EAAA,MAAA,CAAA,EKNyB,KLMzB"}
package/dist/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  import { t as chains_exports } from "./chains-CrtkVbBh.js";
2
- import { a as entityFromRpcResult, c as NoEntityFoundError, l as NoMoreResultsError, o as EntityMutationError, s as NoCursorOrLimitError, t as QueryBuilder, u as getLogger } from "./queryBuilder-DonAg1aq.js";
3
- import { i as BLOCK_TIME, n as stringToPayload, r as ARKIV_ADDRESS, t as jsonToPayload } from "./payload-DKBYYjeA.js";
2
+ import { c as entityFromRpcResult, d as InvalidExpirationError, f as NoCursorOrLimitError, h as getLogger, l as EntityMutationError, m as NoMoreResultsError, n as QueryBuilder, p as NoEntityFoundError, r as SelectQueryBuilder, u as InvalidAttributeError } from "./queryBuilder-D2uwP9jI.js";
3
+ import { n as BLOCK_TIME, t as ARKIV_ADDRESS } from "./consts-BV4PR-de.js";
4
4
  import "./types-H-TSmRpm.js";
5
+ import { n as stringToPayload, t as jsonToPayload } from "./payload-Claf2jUO.js";
5
6
  import { TransactionExecutionError, bytesToHex, createClient, decodeEventLog, hexToBytes, hexToString, numberToHex, parseAbi, publicActions, toBytes, toHex, toRlp, walletActions } from "viem";
6
7
 
7
- export * from "viem"
8
-
9
8
  //#region src/actions/public/getBlockTiming.ts
10
9
  const logger$9 = getLogger("actions:public:get-block-timing");
11
10
  async function getBlockTiming(client) {
@@ -189,6 +188,7 @@ function publicArkivActions(client) {
189
188
  getEntity: (key) => getEntity(client, key),
190
189
  query: (rawQuery, queryOptions) => query(client, rawQuery, queryOptions),
191
190
  buildQuery: () => new QueryBuilder(client),
191
+ select: (selection) => new SelectQueryBuilder(client, selection),
192
192
  getBlockTiming: () => getBlockTiming(client),
193
193
  getEntityCount: () => getEntityCount(client),
194
194
  subscribeEntityEvents: ({ onError, onEntityCreated, onEntityUpdated, onEntityDeleted, onEntityExpired, onEntityExpiresInExtended }, pollingInterval, fromBlock) => subscribeEntityEvents(client, {
@@ -283,6 +283,32 @@ async function compress(data) {
283
283
  return brotliCompressed;
284
284
  }
285
285
 
286
+ //#endregion
287
+ //#region src/utils/validation.ts
288
+ /**
289
+ * Expiration on Arkiv is measured in blocks (1 block =
290
+ * 2 seconds), so the value must be a positive integer that is
291
+ * a multiple of the block time.
292
+ *
293
+ * @param expiresIn - The expiration in seconds.
294
+ * @throws {InvalidExpirationError} If the value is not a positive integer that
295
+ * is a multiple of the block time.
296
+ */
297
+ function validateExpiresIn(expiresIn) {
298
+ if (!Number.isInteger(expiresIn) || expiresIn <= 0 || expiresIn % BLOCK_TIME !== 0) throw new InvalidExpirationError(expiresIn);
299
+ }
300
+ /**
301
+ * Validates a single attribute. Arkiv supports string and number attribute
302
+ * values, but numeric values must be integers.
303
+ *
304
+ * @param attribute - The attribute to validate.
305
+ * @throws {InvalidAttributeError} If the attribute has a non-integer numeric
306
+ * value.
307
+ */
308
+ function validateAttribute(attribute) {
309
+ if (typeof attribute.value === "number" && !Number.isInteger(attribute.value)) throw new InvalidAttributeError(attribute.key, attribute.value);
310
+ }
311
+
286
312
  //#endregion
287
313
  //#region src/utils/arkivTransactions.ts
288
314
  const logger$6 = getLogger("utils:arkiv-transactions");
@@ -291,23 +317,34 @@ function opsToTxData({ creates, updates, deletes, extensions, ownershipChanges }
291
317
  return [toHex(attribute.key), toHex(typeof attribute.value === "number" && attribute.value === 0 ? "" : attribute.value)];
292
318
  }
293
319
  const payload = [
294
- (creates ?? []).map((item) => [
295
- toHex(Math.ceil(item.expiresIn / BLOCK_TIME)),
296
- toHex(item.contentType),
297
- toHex(item.payload),
298
- item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
299
- item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
300
- ]),
301
- (updates ?? []).map((item) => [
302
- item.entityKey,
303
- toHex(item.contentType),
304
- toHex(Math.ceil(item.expiresIn / BLOCK_TIME)),
305
- toHex(item.payload),
306
- item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
307
- item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
308
- ]),
320
+ (creates ?? []).map((item) => {
321
+ validateExpiresIn(item.expiresIn);
322
+ item.attributes.forEach(validateAttribute);
323
+ return [
324
+ toHex(item.expiresIn / BLOCK_TIME),
325
+ toHex(item.contentType),
326
+ toHex(item.payload),
327
+ item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
328
+ item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
329
+ ];
330
+ }),
331
+ (updates ?? []).map((item) => {
332
+ validateExpiresIn(item.expiresIn);
333
+ item.attributes.forEach(validateAttribute);
334
+ return [
335
+ item.entityKey,
336
+ toHex(item.contentType),
337
+ toHex(item.expiresIn / BLOCK_TIME),
338
+ toHex(item.payload),
339
+ item.attributes.filter((attribute) => typeof attribute.value === "string").map(formatAttributes),
340
+ item.attributes.filter((attribute) => typeof attribute.value === "number").map(formatAttributes)
341
+ ];
342
+ }),
309
343
  (deletes ?? []).map((item) => item.entityKey),
310
- (extensions ?? []).map((item) => [item.entityKey, toHex(Math.ceil(item.expiresIn / BLOCK_TIME))]),
344
+ (extensions ?? []).map((item) => {
345
+ validateExpiresIn(item.expiresIn);
346
+ return [item.entityKey, toHex(item.expiresIn / BLOCK_TIME)];
347
+ }),
311
348
  (ownershipChanges ?? []).map((item) => [item.entityKey, item.newOwner])
312
349
  ];
313
350
  logger$6("txData to send as RLP %o length %d", payload, payload.length);
@@ -535,5 +572,5 @@ function chainFromName(name) {
535
572
  }
536
573
 
537
574
  //#endregion
538
- export { EntityMutationError, NoCursorOrLimitError, NoEntityFoundError, NoMoreResultsError, chainFromName, createPublicClient, createWalletClient, jsonToPayload, stringToPayload };
575
+ export { EntityMutationError, InvalidAttributeError, InvalidExpirationError, NoCursorOrLimitError, NoEntityFoundError, NoMoreResultsError, chainFromName, createPublicClient, createWalletClient, jsonToPayload, stringToPayload };
539
576
  //# sourceMappingURL=index.js.map