@arkiv-network/sdk 0.4.5 → 0.5.0-dev.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 (77) hide show
  1. package/dist/chains/index.cjs +5 -88
  2. package/dist/chains/index.d.cts +33 -33
  3. package/dist/chains/index.d.ts +33 -33
  4. package/dist/chains/index.d.ts.map +1 -1
  5. package/dist/chains/index.js +2 -85
  6. package/dist/chains-BDsOtN2a.js +107 -0
  7. package/dist/chains-BDsOtN2a.js.map +1 -0
  8. package/dist/chains-XCO31x6G.cjs +124 -0
  9. package/dist/chunk-pbleEpgJ.cjs +44 -0
  10. package/dist/index-B801JxcV.d.ts +1003 -0
  11. package/dist/index-B801JxcV.d.ts.map +1 -0
  12. package/dist/index-DQGx5KZ6.d.cts +1003 -0
  13. package/dist/index-DQGx5KZ6.d.cts.map +1 -0
  14. package/dist/index.cjs +57 -15
  15. package/dist/index.d.cts +3 -362
  16. package/dist/index.d.ts +3 -362
  17. package/dist/index.js +49 -11
  18. package/dist/index.js.map +1 -1
  19. package/dist/payload-BI2NXPDf.d.ts +6 -0
  20. package/dist/payload-BI2NXPDf.d.ts.map +1 -0
  21. package/dist/payload-D3fyOBWn.d.cts +6 -0
  22. package/dist/payload-D3fyOBWn.d.cts.map +1 -0
  23. package/dist/payload-DKBYYjeA.js +18 -0
  24. package/dist/payload-DKBYYjeA.js.map +1 -0
  25. package/dist/payload-eB1a8vZH.cjs +41 -0
  26. package/dist/query/index.cjs +1 -2
  27. package/dist/query/index.d.cts +3 -6
  28. package/dist/query/index.d.cts.map +1 -1
  29. package/dist/query/index.d.ts +3 -6
  30. package/dist/query/index.d.ts.map +1 -1
  31. package/dist/query/index.js +2 -2
  32. package/dist/{queryBuilder-DVs4ZIyZ.js → queryBuilder-DNUwJvf0.js} +4 -9
  33. package/dist/queryBuilder-DNUwJvf0.js.map +1 -0
  34. package/dist/{queryBuilder-Cn5JJRMM.cjs → queryBuilder-KrdIUVZv.cjs} +4 -43
  35. package/dist/types/index.cjs +1 -1
  36. package/dist/types/index.d.cts +3 -2
  37. package/dist/types/index.d.ts +3 -2
  38. package/dist/types/index.js +1 -1
  39. package/dist/utils/index.cjs +4 -15
  40. package/dist/utils/index.d.cts +1 -4
  41. package/dist/utils/index.d.cts.map +1 -1
  42. package/dist/utils/index.d.ts +1 -4
  43. package/dist/utils/index.d.ts.map +1 -1
  44. package/dist/utils/index.js +1 -11
  45. package/dist/utils/index.js.map +1 -1
  46. package/package.json +8 -5
  47. package/src/actions/public/query.ts +49 -2
  48. package/src/actions/public/subscribeEntityEvents.ts +3 -3
  49. package/src/clients/createPublicClient.ts +1 -1
  50. package/src/clients/createWalletClient.ts +2 -2
  51. package/src/clients/decorators/arkivPublic.ts +42 -7
  52. package/src/clients/decorators/arkivWallet.ts +21 -15
  53. package/src/index.ts +10 -0
  54. package/src/query/errors.ts +0 -6
  55. package/src/query/queryBuilder.ts +7 -4
  56. package/src/types/index.ts +21 -1
  57. package/src/types/rpcSchema.ts +10 -10
  58. package/src/utils/chains.test.ts +97 -0
  59. package/src/utils/chains.ts +19 -0
  60. package/src/utils/compression.ts +1 -1
  61. package/dist/chains/index.js.map +0 -1
  62. package/dist/consts-BV9DVKgE.cjs +0 -18
  63. package/dist/consts-CHtLBwGd.js +0 -7
  64. package/dist/consts-CHtLBwGd.js.map +0 -1
  65. package/dist/entity-BNSCqNpu.d.cts +0 -254
  66. package/dist/entity-BNSCqNpu.d.cts.map +0 -1
  67. package/dist/entity-CWj4qVCX.d.ts +0 -254
  68. package/dist/entity-CWj4qVCX.d.ts.map +0 -1
  69. package/dist/index.d.cts.map +0 -1
  70. package/dist/index.d.ts.map +0 -1
  71. package/dist/queryBuilder-CXcMv0Uc.d.ts +0 -314
  72. package/dist/queryBuilder-CXcMv0Uc.d.ts.map +0 -1
  73. package/dist/queryBuilder-CvAx57pq.d.cts +0 -314
  74. package/dist/queryBuilder-CvAx57pq.d.cts.map +0 -1
  75. package/dist/queryBuilder-DVs4ZIyZ.js.map +0 -1
  76. /package/dist/{types-CBTc19th.cjs → types-H-TSmRpm.js} +0 -0
  77. /package/dist/{types-Cv8NMtbo.js → types-o3zWarRp.cjs} +0 -0
@@ -1,314 +0,0 @@
1
- import { g as ArkivClient, t as Entity } from "./entity-BNSCqNpu.cjs";
2
- import { Hex } from "viem";
3
-
4
- //#region src/query/predicate.d.ts
5
- type PredicateType = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "not";
6
- type PredicateContainerType = "or" | "and";
7
- type Predicate = {
8
- type: PredicateType;
9
- key: string;
10
- value: string | number;
11
- } | {
12
- type: PredicateContainerType;
13
- predicates: Predicate[];
14
- };
15
- /**
16
- * Creates an OR predicate
17
- * @param predicates - The predicates to combine
18
- * @returns The OR predicate
19
- *
20
- * @example
21
- * const predicates = [eq("name", "John"), eq("age", 30)]
22
- * const result = or(predicates)
23
- * // result = { type: "or", predicates: [eq("name", "John"), eq("age", 30)] }
24
- *
25
- */
26
- declare function or(predicates: Predicate[]): Predicate;
27
- /**
28
- * Creates an AND predicate
29
- * @param predicates - The predicates to combine
30
- * @returns The AND predicate
31
- *
32
- * @example
33
- * const predicates = [eq("name", "John"), eq("age", 30)]
34
- * const result = and(predicates)
35
- * // result = { type: "and", predicates: [eq("name", "John"), eq("age", 30)] }
36
- *
37
- */
38
- declare function and(predicates: Predicate[]): Predicate;
39
- /**
40
- * Creates an equality predicate
41
- * @param key - The key to compare
42
- * @param value - The value to compare
43
- * @returns The equality predicate
44
- *
45
- * @example
46
- * const predicate = eq("name", "John")
47
- * // result = { type: "eq", key: "name", value: "John" }
48
- */
49
- declare function eq(key: string, value: string | number): Predicate;
50
- /**
51
- * Creates a not equal predicate
52
- * @param key - The key to compare
53
- * @param value - The value to compare
54
- * @returns The not equal predicate
55
- *
56
- * @example
57
- * const predicate = neq("name", "John")
58
- * // result = { type: "neq", key: "name", value: "John" }
59
- */
60
- declare function neq(key: string, value: string | number): Predicate;
61
- /**
62
- * Creates a greater than predicate
63
- * @param key - The key to compare
64
- * @param value - The value to compare
65
- * @returns The greater than predicate
66
- *
67
- * @example
68
- * const predicate = gt("name", "John")
69
- * // result = { type: "gt", key: "name", value: "John" }
70
- */
71
- declare function gt(key: string, value: string | number): Predicate;
72
- /**
73
- * Creates a greater than or equal predicate
74
- * @param key - The key to compare
75
- * @param value - The value to compare
76
- * @returns The greater than or equal predicate
77
- *
78
- * @example
79
- * const predicate = gte("name", "John")
80
- * // result = { type: "gte", key: "name", value: "John" }
81
- */
82
- declare function gte(key: string, value: string | number): Predicate;
83
- /**
84
- * Creates a less than predicate
85
- * @param key - The key to compare
86
- * @param value - The value to compare
87
- * @returns The less than predicate
88
- *
89
- * @example
90
- * const predicate = lt("name", "John")
91
- * // result = { type: "lt", key: "name", value: "John" }
92
- */
93
- declare function lt(key: string, value: string | number): Predicate;
94
- /**
95
- * Creates a less than or equal predicate
96
- * @param key - The key to compare
97
- * @param value - The value to compare
98
- * @returns The less than or equal predicate
99
- *
100
- * @example
101
- * const predicate = lte("name", "John")
102
- * // result = { type: "lte", key: "name", value: "John" }
103
- */
104
- declare function lte(key: string, value: string | number): Predicate;
105
- /**
106
- * Creates a not predicate
107
- * @param key - The key to compare
108
- * @returns The not predicate
109
- *
110
- * @example
111
- * const predicate = not("name")
112
- * // result = { type: "not", key: "name", value: "" }
113
- */
114
- declare function not(key: string): Predicate;
115
- //#endregion
116
- //#region src/query/queryResult.d.ts
117
- declare class QueryResult {
118
- entities: Entity[];
119
- private _endOfIteration;
120
- private _cursor;
121
- private _limit;
122
- private _validAtBlock;
123
- private _queryBuilder;
124
- get queryBuilder(): QueryBuilder;
125
- get cursor(): string | undefined;
126
- constructor(entities: Entity[], queryBuilder: QueryBuilder, cursor: string | undefined, limit: number | undefined, validAtBlock: bigint | undefined);
127
- next(): Promise<void>;
128
- hasNextPage(): boolean;
129
- }
130
- //#endregion
131
- //#region src/query/queryBuilder.d.ts
132
- type OrderByAttribute = {
133
- name: string;
134
- type: "string" | "number";
135
- order: "asc" | "desc";
136
- };
137
- /**
138
- * Helper function to create an ascending order by attribute
139
- * @param attributeName - The name of the attribute to order by
140
- * @param attributeType - The type of the attribute to order by (string or number)
141
- * @returns The OrderByAttribute instance
142
- *
143
- * @example
144
- * const ascAttribute = asc("name", "string")
145
- */
146
- declare function asc(attributeName: string, attributeType: "string" | "number"): OrderByAttribute;
147
- /**
148
- * Helper function to create a descending order by attribute
149
- * @param attributeName - The name of the attribute to order by
150
- * @param attributeType - The type of the attribute to order by (string or number)
151
- * @returns The OrderByAttribute instance
152
- *
153
- * @example
154
- * const descAttribute = desc("name", "string")
155
- */
156
- declare function desc(attributeName: string, attributeType: "string" | "number"): OrderByAttribute;
157
- /**
158
- * QueryBuilder is a helper class to build queries to the Arkiv DBChains.
159
- * It can be used to fetch entities from the Arkiv DBChains. It follows the Builder pattern allowing chaining of methods.
160
- * @param client - The Arkiv client
161
- * @returns The QueryBuilder instance {@link QueryBuilder}
162
- */
163
- declare class QueryBuilder {
164
- private _client;
165
- private _ownedBy;
166
- private _orderBy;
167
- private _validAtBlock;
168
- private _withAttributes;
169
- private _withMetadata;
170
- private _withPayload;
171
- private _limit;
172
- private _cursor;
173
- private _predicates;
174
- constructor(client: ArkivClient);
175
- /**
176
- * Sets the ownedBy filter
177
- * @param ownedBy - The address of the owner
178
- * @returns The QueryBuilder instance
179
- *
180
- * @example
181
- * const builder = new QueryBuilder(client)
182
- * builder.ownedBy("0x1234567890123456789012345678901234567890")
183
- */
184
- ownedBy(ownedBy: Hex): this;
185
- /**
186
- * Sets the orderBy for the query.
187
- * It can be called multiple times to order by multiple attributes.
188
- * The order of the attributes is important. The first attribute is the primary order by attribute.
189
- * @param attributeName - The name of the attribute to order by
190
- * @param attributeType - The type of the attribute to order by (string or number)
191
- * @param order - The order to set the order by (asc or desc)
192
- * @returns The QueryBuilder instance
193
- *
194
- * @example
195
- * const builder = new QueryBuilder(client)
196
- * builder.orderBy("name", "string", "desc")
197
- */
198
- orderBy(attributeName: string, attributeType: "string" | "number", order?: "asc" | "desc"): this;
199
- /**
200
- * Sets the orderBy for the query.
201
- * This method takes the OrderByAttribute object as an argument and is mainly
202
- * used to use the helper functions asc() and desc() to create the OrderByAttribute instances.
203
- * @param orderByAttribute - The OrderByAttribute instance to set
204
- * @returns The QueryBuilder instance
205
- *
206
- * @example
207
- * const builder = new QueryBuilder(client)
208
- * builder.orderBy(asc("name", "string"))
209
- * builder.orderBy(desc("name", "string"))
210
- */
211
- orderBy(orderByAttribute: OrderByAttribute): this;
212
- /**
213
- * Sets the withAttributes flag which will return the attributes for the entities if true
214
- * @param withAttributes - The boolean value to set
215
- * @returns The QueryBuilder instance
216
- *
217
- * @example
218
- * const builder = new QueryBuilder(client)
219
- * builder.withAttributes(true)
220
- */
221
- withAttributes(withAttributes?: boolean): this;
222
- /**
223
- * Sets the withMetadata flag which will return the metadata (like owner, expiredAt, etc.) for the entities if true
224
- * @param withMetadata - The boolean value to set
225
- * @returns The QueryBuilder instance
226
- *
227
- * @example
228
- * const builder = new QueryBuilder(client)
229
- * builder.withMetadata(true)
230
- */
231
- withMetadata(withMetadata?: boolean): this;
232
- /**
233
- * Sets the withPayload flag which will return the payload for the entities if true
234
- * @param withPayload - The boolean value to set
235
- * @returns The QueryBuilder instance
236
- *
237
- * @example
238
- * const builder = new QueryBuilder(client)
239
- * builder.withPayload(true)
240
- */
241
- withPayload(withPayload?: boolean): this;
242
- /**
243
- * Sets the limit for the query
244
- * @param limit - The number of entities to return
245
- * @returns The QueryBuilder instance
246
- *
247
- * @example
248
- * const builder = new QueryBuilder(client)
249
- * builder.limit(10)
250
- */
251
- limit(limit: number): this;
252
- /**
253
- * Sets the cursor for the query - it is advances setting which rather shouldn't be used manually but it is provided from query result if limit is used (pagination).
254
- * @param cursor - The cursor to set which tells to RPC Query server where to start or continue the query.
255
- * @returns The QueryBuilder instance
256
- *
257
- * @example
258
- * const builder = new QueryBuilder(client)
259
- * builder.offset(10)
260
- */
261
- cursor(cursor: string): this;
262
- /**
263
- * Sets the validAtBlock for the query which tells at which block height the state we are intested.
264
- * If not set, the latest block is used.
265
- * @param validAtBlock - The block number to set
266
- * @returns The QueryBuilder instance
267
- *
268
- * @example
269
- * const builder = new QueryBuilder(client)
270
- * builder.validAtBlock(10000)
271
- */
272
- validAtBlock(validAtBlock: bigint): this;
273
- /**
274
- * Sets the predicates for the query limiting the results. It can be a single predicate or an array of predicates combined with 'and'.
275
- * Predicates can be nested using 'or' and 'and' predicates.
276
- * @param predicates - The predicates to set
277
- * @returns The QueryBuilder instance
278
- *
279
- * @example
280
- * const builder = new QueryBuilder(client)
281
- * builder.where(eq("name", "John"))
282
- * builder.where([eq("name", "John"), eq("age", 30)])
283
- * builder.where([eq("name", "John"), or([eq("age", 30), eq("age", 31)])])
284
- * builder.where([eq("name", "John"), and([eq("age", 30), eq("age", 31)])])
285
- * builder.where([eq("name", "John"), or([eq("age", 30), and([eq("age", 31), eq("age", 32)])])])
286
- * builder.where([eq("name", "John"), and([eq("age", 30), or([eq("age", 31), eq("age", 32)])])])
287
- * builder.where([eq("name", "John"), and([eq("age", 30), or([eq("age", 31), and([eq("age", 32), eq("age", 33)])])])])
288
- */
289
- where(predicates: Predicate[] | Predicate): this;
290
- /**
291
- * Fetches the entities from the query. Re
292
- * It will return a QueryResult instance which can be used to fetch the next and previous pages.
293
- * @returns The QueryResult instance {@link QueryResult}
294
- *
295
- * @example
296
- * const builder = new QueryBuilder(client)
297
- * const result = await builder.where(eq("name", "John")).fetch()
298
- * // result = { entities: [Entity, Entity, Entity], next: async () => QueryResult, previous: async () => QueryResult }
299
- */
300
- fetch(): Promise<QueryResult>;
301
- /**
302
- * Counts the entities from the query.
303
- * @returns The number of entities
304
- *
305
- * @example
306
- * const builder = new QueryBuilder(client)
307
- * const result = await builder.where(eq("name", "John")).count()
308
- * // result = 10
309
- */
310
- count(): Promise<number>;
311
- }
312
- //#endregion
313
- export { Predicate as a, and as c, gte as d, lt as f, or as g, not as h, QueryResult as i, eq as l, neq as m, asc as n, PredicateContainerType as o, lte as p, desc as r, PredicateType as s, QueryBuilder as t, gt as u };
314
- //# sourceMappingURL=queryBuilder-CvAx57pq.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryBuilder-CvAx57pq.d.cts","names":[],"sources":["../src/query/predicate.ts","../src/query/queryResult.ts","../src/query/queryBuilder.ts"],"sourcesContent":[],"mappings":";;;;KAAY,aAAA;KACA,sBAAA;KAEA,SAAA;QAEA;EALA,GAAA,EAAA,MAAA;EACA,KAAA,EAAA,MAAA,GAAA,MAAA;AAEZ,CAAA,GAAY;EAEA,IAAA,EAKA,sBALA;EAKA,UAAA,EACM,SADN,EAAA;CACM;;AAclB;AAeA;AAcA;AAcA;AAcA;AAcA;AAcA;AAcA;AAaA;;iBAhHgB,EAAA,aAAe,cAAc;;AClB7C;;;;;;;;;;ACCK,iBFgCW,GAAA,CEhCK,UAAA,EFgCW,SEhCX,EAAA,CAAA,EFgCyB,SEhCzB;AAerB;AAiBA;AAaA;;;;;;;;AAmPa,iBFlPG,EAAA,CEkPH,GAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,GAAA,MAAA,CAAA,EFlP4C,SEkP5C;;;;;;;;;;;iBFpOG,GAAA,uCAA0C;;;;;;;;;;;iBAc1C,EAAA,uCAAyC;;;;;;;;;;;iBAczC,GAAA,uCAA0C;;;;;;;;;;;iBAc1C,EAAA,uCAAyC;;;;;;;;;;;iBAczC,GAAA,uCAA0C;;;;;;;;;;iBAa1C,GAAA,eAAkB;;;cClIrB,WAAA;YACD;EDRA,QAAA,eAAa;EACb,QAAA,OAAA;EAEA,QAAA,MAAS;EAET,QAAA,aAAA;EAKA,QAAA,aAAA;EACM,IAAA,YAAA,CAAA,CAAA,ECKI,YDLJ;EAAS,IAAA,MAAA,CAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAcX,WAAE,CAAA,QAAa,ECAjB,MDA+B,EAAA,EAAA,YAAS,ECCpC,YDDoC,EAAA,MAAA,EAAA,MAAA,GAAA,SAAA,EAAA,KAAA,EAAA,MAAA,GAAA,SAAA,EAAA,YAAA,EAAA,MAAA,GAAA,SAAA;EAetC,IAAA,CAAA,CAAG,ECDP,ODCO,CAAA,IAAa,CAAA;EAchB,WAAE,CAAA,CAAA,EAAA,OAAuC;AAczD;;;AApEA,KEQK,gBAAA,GFRoB;EACb,IAAA,EAAA,MAAA;EAEA,IAAA,EAAA,QAAS,GAAA,QAAA;EAET,KAAA,EAAA,KAAA,GAAA,MAAA;CAKA;;;AAeZ;AAeA;AAcA;AAcA;AAcA;AAcA;AAcA;AAcgB,iBErGA,GAAA,CFqG0C,aAAS,EAAA,MAAA,EAAA,aAAA,EAAA,QAAA,GAAA,QAAA,CAAA,EErGa,gBFqGb;AAanE;;;;AClIA;;;;;AAgCY,iBCCI,IAAA,CDDJ,aAAA,EAAA,MAAA,EAAA,aAAA,EAAA,QAAA,GAAA,QAAA,CAAA,ECCqE,gBDDrE;;;;;ACjC+B;AAiB3C;AAiBgB,cAaH,YAAA,CAboE;EAapE,QAAA,OAAY;EAYH,QAAA,QAAA;EAcH,QAAA,QAAA;EA+BS,QAAA,aAAA;EAuIR,QAAA,eAAA;EAAc,QAAA,aAAA;EAmBrB,QAAA,YAAA;EAAA,QAAA,MAAA;EAgCA,QAAA,OAAA;EAAA,QAAA,WAAA;sBAvOS;;;;;;;;;;mBAcH;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA+BS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAuIR,cAAc;;;;;;;;;;;WAmBrB,QAAA;;;;;;;;;;WAgCA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"queryBuilder-DVs4ZIyZ.js","names":["logger","logger","predicate","queryOptions: RpcQueryOptions","order"],"sources":["../src/utils/logger.ts","../src/query/errors.ts","../src/types/entity.ts","../src/utils/entities.ts","../src/query/engine.ts","../src/query/queryResult.ts","../src/query/queryBuilder.ts"],"sourcesContent":["import createDebug from \"debug\"\n\nconst ROOT_NAMESPACE = \"arkiv\"\n\nexport const getLogger = (scope: string) => createDebug(`${ROOT_NAMESPACE}:${scope}`)\n\nexport const enableDebug = (namespaces: string): void => {\n createDebug.enable(namespaces)\n}\n\nexport const disableDebug = (): void => {\n createDebug.disable()\n}\n","export class NoMoreResultsError extends Error {\n constructor() {\n super(\"No more results\")\n }\n}\n\nexport class NoCursorOrLimitError extends Error {\n constructor() {\n super(\"Cursor and limit must be defined to fetch next\")\n }\n}\n\nexport class OffsetCannotBeLessThanZeroError extends Error {\n constructor() {\n super(\"Offset cannot be less than 0\")\n }\n}\n\nexport class NoEntityFoundError extends Error {\n constructor() {\n super(\"No entity found\")\n }\n}\n","import { bytesToString, type Hex } from \"viem\"\nimport type { MimeType } from \"../types\"\nimport type { Attribute } from \"./attributes\"\n\nexport class Entity {\n key: Hex\n contentType: MimeType | undefined\n owner: Hex | undefined\n expiresAtBlock: bigint | undefined\n createdAtBlock: bigint | undefined\n lastModifiedAtBlock: bigint | undefined\n transactionIndexInBlock: bigint | undefined\n operationIndexInTransaction: bigint | undefined\n payload: Uint8Array | undefined\n attributes: Attribute[]\n\n constructor(\n key: Hex,\n contentType: MimeType | undefined = undefined,\n owner: Hex | undefined = undefined,\n expiresAtBlock: bigint | undefined = undefined,\n createdAtBlock: bigint | undefined = undefined,\n lastModifiedAtBlock: bigint | undefined = undefined,\n transactionIndexInBlock: bigint | undefined = undefined,\n operationIndexInTransaction: bigint | undefined = undefined,\n payload: Uint8Array | undefined = undefined,\n attributes: Attribute[],\n ) {\n this.key = key\n this.owner = owner\n this.expiresAtBlock = expiresAtBlock\n this.createdAtBlock = createdAtBlock\n this.lastModifiedAtBlock = lastModifiedAtBlock\n this.transactionIndexInBlock = transactionIndexInBlock\n this.operationIndexInTransaction = operationIndexInTransaction\n this.payload = payload\n this.attributes = attributes\n this.contentType = contentType\n }\n\n toText(): string {\n return this.payload ? bytesToString(this.payload) : \"\"\n }\n\n toJson(): any {\n return this.payload ? JSON.parse(bytesToString(this.payload)) : {}\n }\n}\n","import { toBytes } from \"viem\"\nimport { Entity } from \"../types/entity\"\nimport type { RpcEntity } from \"../types/rpcSchema\"\nimport { getLogger } from \"./logger\"\n\nconst logger = getLogger(\"utils:entities\")\n\nexport async function entityFromRpcResult(rpcEntity: RpcEntity) {\n logger(\"entityFromRpcResult %o\", rpcEntity)\n\n return new Entity(\n rpcEntity.key,\n rpcEntity.contentType,\n rpcEntity.owner,\n rpcEntity.expiresAt !== undefined ? BigInt(rpcEntity.expiresAt) : undefined,\n rpcEntity.createdAtBlock !== undefined ? BigInt(rpcEntity.createdAtBlock) : undefined,\n rpcEntity.lastModifiedAtBlock !== undefined ? BigInt(rpcEntity.lastModifiedAtBlock) : undefined,\n rpcEntity.transactionIndexInBlock !== undefined\n ? BigInt(rpcEntity.transactionIndexInBlock)\n : undefined,\n rpcEntity.operationIndexInTransaction !== undefined\n ? BigInt(rpcEntity.operationIndexInTransaction)\n : undefined,\n rpcEntity.value !== undefined ? toBytes(rpcEntity.value) : undefined,\n [\n ...(rpcEntity.stringAttributes ?? []).map(({ key, value }) => ({\n key,\n value,\n })),\n ...(rpcEntity.numericAttributes ?? []).map(({ key, value }) => ({\n key,\n value: Number(value),\n })),\n ],\n )\n}\n","import type { Hex } from \"viem\"\nimport type { ArkivClient } from \"../clients/baseClient\"\nimport type { RpcIncludeData, RpcOrderByAttribute, RpcQueryOptions } from \"../types/rpcSchema\"\nimport { getLogger } from \"../utils/logger\"\nimport type { Predicate } from \"./predicate\"\n\nconst logger = getLogger(\"query:engine\")\n\nfunction processPredicates(predicates: Predicate[]): string {\n const processValue = (value: string | number) => {\n if (typeof value === \"string\") {\n return `\"${value}\"`\n }\n return value\n }\n return predicates\n .map((predicate) => {\n switch (predicate.type) {\n case \"eq\":\n return `${predicate.key} = ${processValue(predicate.value)}`\n case \"neq\":\n return `${predicate.key} != ${processValue(predicate.value)}`\n case \"gt\":\n return `${predicate.key} > ${processValue(predicate.value)}`\n case \"gte\":\n return `${predicate.key} >= ${processValue(predicate.value)}`\n case \"lt\":\n return `${predicate.key} < ${processValue(predicate.value)}`\n case \"lte\":\n return `${predicate.key} <= ${processValue(predicate.value)}`\n case \"not\":\n return `!${predicate.key}`\n case \"or\":\n return `(${predicate.predicates.map((predicate) => processPredicates([predicate])).join(\" || \")})`\n case \"and\":\n return `(${predicate.predicates.map((predicate) => processPredicates([predicate])).join(\" && \")})`\n default:\n return \"\"\n }\n })\n .join(\" && \")\n}\n\nexport async function processQuery(\n client: ArkivClient,\n queryParams: {\n predicates: Predicate[]\n limit: number | undefined\n cursor: string | undefined\n ownedBy: Hex | undefined\n orderBy: RpcOrderByAttribute[] | undefined\n validAtBlock?: bigint | undefined\n withAttributes?: boolean | undefined\n withMetadata?: boolean | undefined\n withPayload?: boolean | undefined\n },\n) {\n const {\n predicates,\n limit,\n cursor,\n ownedBy,\n orderBy,\n validAtBlock,\n withAttributes,\n withMetadata,\n withPayload,\n } = queryParams\n\n logger(\"Processing query with params %o\", {\n predicates,\n cursor,\n limit,\n ownedBy,\n orderBy,\n validAtBlock,\n withAttributes,\n withMetadata,\n withPayload,\n })\n\n let query = processPredicates(predicates)\n if (ownedBy) {\n query += ` && $owner=${ownedBy}`\n }\n\n // remove leading and trailing spaces and leading &&\n query = query.trim()\n if (query.startsWith(\"&& \")) {\n query = query.slice(3)\n }\n\n const queryOptions: RpcQueryOptions = {\n includeData: {\n key: true,\n attributes: withAttributes ?? false,\n payload: withPayload ?? false,\n contentType: withMetadata ?? false,\n expiration: withMetadata ?? false,\n owner: withMetadata ?? false,\n createdAtBlock: withMetadata ?? false,\n lastModifiedAtBlock: withMetadata ?? false,\n transactionIndexInBlock: withMetadata ?? false,\n operationIndexInTransaction: withMetadata ?? false,\n } as RpcIncludeData,\n }\n\n if (validAtBlock !== undefined) {\n queryOptions.atBlock = Number(validAtBlock)\n }\n if (limit !== undefined) {\n queryOptions.resultsPerPage = limit\n }\n if (cursor !== undefined) {\n queryOptions.cursor = cursor\n }\n if (orderBy !== undefined) {\n queryOptions.orderBy = orderBy\n }\n\n logger(\"Built query to send %s %o\", query, {\n includeData: queryOptions.includeData,\n atBlock: queryOptions.atBlock?.toString(),\n orderBy: queryOptions.orderBy,\n resultsPerPage: queryOptions.resultsPerPage,\n cursor: queryOptions.cursor,\n })\n\n const result = await client.request({\n method: \"arkiv_query\",\n params: [query, queryOptions],\n })\n logger(\"Raw result from query %o\", result)\n\n return result\n}\n","import type { Entity } from \"../types/entity\"\nimport { getLogger } from \"../utils/logger\"\nimport { NoCursorOrLimitError, NoMoreResultsError } from \"./errors\"\nimport type { QueryBuilder } from \"./queryBuilder\"\n\nconst logger = getLogger(\"query:result\")\n\nexport class QueryResult {\n entities: Entity[]\n private _endOfIteration: boolean\n private _cursor: string | undefined\n private _limit: number | undefined\n private _validAtBlock: bigint | undefined\n private _queryBuilder: QueryBuilder\n\n // Public getters for internal state\n get queryBuilder(): QueryBuilder {\n return this._queryBuilder\n }\n\n get cursor(): string | undefined {\n return this._cursor\n }\n\n constructor(\n entities: Entity[],\n queryBuilder: QueryBuilder,\n cursor: string | undefined,\n limit: number | undefined,\n validAtBlock: bigint | undefined,\n ) {\n this.entities = entities\n this._queryBuilder = queryBuilder\n this._endOfIteration = !limit || entities.length < limit\n this._cursor = cursor\n this._limit = limit\n this._validAtBlock = validAtBlock\n }\n\n async next() {\n if (this._cursor === undefined || this._limit === undefined) {\n throw new NoCursorOrLimitError()\n }\n if (this._endOfIteration) {\n throw new NoMoreResultsError()\n }\n this._queryBuilder.cursor(this._cursor)\n const result = await this._queryBuilder.fetch()\n this.entities = result.entities\n // Update the query builder reference\n this._queryBuilder = result.queryBuilder\n // Check if we've reached the end (no more cursor or we got fewer entities than limit)\n this._endOfIteration = !result.cursor || result.entities.length < this._limit\n // Update the cursor\n this._cursor = result.cursor\n\n // TODO check current block height and if it is not too old\n logger(\"Current block height for next page %s\", this._validAtBlock?.toString() ?? \"unknown\")\n }\n\n hasNextPage() {\n return !this._endOfIteration\n }\n}\n","import type { Hex } from \"viem\"\nimport type { ArkivClient } from \"../clients/baseClient\"\nimport type { RpcOrderByAttribute } from \"../types/rpcSchema\"\nimport { entityFromRpcResult } from \"../utils/entities\"\nimport { processQuery } from \"./engine\"\nimport type { Predicate } from \"./predicate\"\nimport { QueryResult } from \"./queryResult\"\n\ntype OrderByAttribute = {\n name: string\n type: \"string\" | \"number\"\n order: \"asc\" | \"desc\"\n}\n\n/**\n * Helper function to create an ascending order by attribute\n * @param attributeName - The name of the attribute to order by\n * @param attributeType - The type of the attribute to order by (string or number)\n * @returns The OrderByAttribute instance\n *\n * @example\n * const ascAttribute = asc(\"name\", \"string\")\n */\nexport function asc(attributeName: string, attributeType: \"string\" | \"number\"): OrderByAttribute {\n return {\n name: attributeName,\n type: attributeType,\n order: \"asc\",\n }\n}\n\n/**\n * Helper function to create a descending order by attribute\n * @param attributeName - The name of the attribute to order by\n * @param attributeType - The type of the attribute to order by (string or number)\n * @returns The OrderByAttribute instance\n *\n * @example\n * const descAttribute = desc(\"name\", \"string\")\n */\nexport function desc(attributeName: string, attributeType: \"string\" | \"number\"): OrderByAttribute {\n return {\n name: attributeName,\n type: attributeType,\n order: \"desc\",\n }\n}\n/**\n * QueryBuilder is a helper class to build queries to the Arkiv DBChains.\n * It can be used to fetch entities from the Arkiv DBChains. It follows the Builder pattern allowing chaining of methods.\n * @param client - The Arkiv client\n * @returns The QueryBuilder instance {@link QueryBuilder}\n */\nexport class QueryBuilder {\n private _client: ArkivClient\n private _ownedBy: Hex | undefined\n private _orderBy: RpcOrderByAttribute[] | undefined\n private _validAtBlock: bigint | undefined\n private _withAttributes: boolean | undefined\n private _withMetadata: boolean | undefined\n private _withPayload: boolean | undefined\n private _limit: number | undefined\n private _cursor: string | undefined\n private _predicates: Predicate[]\n\n constructor(client: ArkivClient) {\n this._client = client\n this._predicates = []\n }\n\n /**\n * Sets the ownedBy filter\n * @param ownedBy - The address of the owner\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.ownedBy(\"0x1234567890123456789012345678901234567890\")\n */\n ownedBy(ownedBy: Hex) {\n this._ownedBy = ownedBy\n return this\n }\n\n /**\n * Sets the orderBy for the query.\n * It can be called multiple times to order by multiple attributes.\n * The order of the attributes is important. The first attribute is the primary order by attribute.\n * @param attributeName - The name of the attribute to order by\n * @param attributeType - The type of the attribute to order by (string or number)\n * @param order - The order to set the order by (asc or desc)\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.orderBy(\"name\", \"string\", \"desc\")\n */\n orderBy(attributeName: string, attributeType: \"string\" | \"number\", order?: \"asc\" | \"desc\"): this\n /**\n * Sets the orderBy for the query.\n * This method takes the OrderByAttribute object as an argument and is mainly\n * used to use the helper functions asc() and desc() to create the OrderByAttribute instances.\n * @param orderByAttribute - The OrderByAttribute instance to set\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.orderBy(asc(\"name\", \"string\"))\n * builder.orderBy(desc(\"name\", \"string\"))\n */\n orderBy(orderByAttribute: OrderByAttribute): this\n orderBy(\n attributeNameOrOrderByAttribute: string | OrderByAttribute,\n attributeType?: \"string\" | \"number\",\n order: \"asc\" | \"desc\" = \"asc\",\n ) {\n if (!this._orderBy) {\n this._orderBy = []\n }\n\n const pushOrderByAttribute = ({ name, type, order }: OrderByAttribute) => {\n this._orderBy?.push({\n name,\n type: type === \"number\" ? \"numeric\" : type,\n desc: order === \"desc\",\n })\n }\n\n if (typeof attributeNameOrOrderByAttribute === \"string\") {\n if (!attributeType) {\n throw new Error(\"attributeType is required when using positional orderBy arguments\")\n }\n pushOrderByAttribute({\n name: attributeNameOrOrderByAttribute,\n type: attributeType,\n order,\n })\n } else {\n pushOrderByAttribute(attributeNameOrOrderByAttribute)\n }\n\n return this\n }\n\n /**\n * Sets the withAttributes flag which will return the attributes for the entities if true\n * @param withAttributes - The boolean value to set\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.withAttributes(true)\n */\n withAttributes(withAttributes: boolean = true) {\n this._withAttributes = withAttributes\n return this\n }\n\n /**\n * Sets the withMetadata flag which will return the metadata (like owner, expiredAt, etc.) for the entities if true\n * @param withMetadata - The boolean value to set\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.withMetadata(true)\n */\n withMetadata(withMetadata: boolean = true) {\n this._withMetadata = withMetadata\n return this\n }\n\n /**\n * Sets the withPayload flag which will return the payload for the entities if true\n * @param withPayload - The boolean value to set\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.withPayload(true)\n */\n withPayload(withPayload: boolean = true) {\n this._withPayload = withPayload\n return this\n }\n\n /**\n * Sets the limit for the query\n * @param limit - The number of entities to return\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.limit(10)\n */\n limit(limit: number) {\n this._limit = limit\n return this\n }\n\n /**\n * Sets the cursor for the query - it is advances setting which rather shouldn't be used manually but it is provided from query result if limit is used (pagination).\n * @param cursor - The cursor to set which tells to RPC Query server where to start or continue the query.\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.offset(10)\n */\n cursor(cursor: string) {\n this._cursor = cursor\n return this\n }\n\n /**\n * Sets the validAtBlock for the query which tells at which block height the state we are intested.\n * If not set, the latest block is used.\n * @param validAtBlock - The block number to set\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.validAtBlock(10000)\n */\n validAtBlock(validAtBlock: bigint) {\n this._validAtBlock = validAtBlock\n return this\n }\n\n /**\n * Sets the predicates for the query limiting the results. It can be a single predicate or an array of predicates combined with 'and'.\n * Predicates can be nested using 'or' and 'and' predicates.\n * @param predicates - The predicates to set\n * @returns The QueryBuilder instance\n *\n * @example\n * const builder = new QueryBuilder(client)\n * builder.where(eq(\"name\", \"John\"))\n * builder.where([eq(\"name\", \"John\"), eq(\"age\", 30)])\n * builder.where([eq(\"name\", \"John\"), or([eq(\"age\", 30), eq(\"age\", 31)])])\n * builder.where([eq(\"name\", \"John\"), and([eq(\"age\", 30), eq(\"age\", 31)])])\n * builder.where([eq(\"name\", \"John\"), or([eq(\"age\", 30), and([eq(\"age\", 31), eq(\"age\", 32)])])])\n * builder.where([eq(\"name\", \"John\"), and([eq(\"age\", 30), or([eq(\"age\", 31), eq(\"age\", 32)])])])\n * builder.where([eq(\"name\", \"John\"), and([eq(\"age\", 30), or([eq(\"age\", 31), and([eq(\"age\", 32), eq(\"age\", 33)])])])])\n */\n where(predicates: Predicate[] | Predicate) {\n if (Array.isArray(predicates)) {\n this._predicates.push(...predicates)\n } else {\n this._predicates.push(predicates)\n }\n return this\n }\n\n /**\n * Fetches the entities from the query. Re\n * It will return a QueryResult instance which can be used to fetch the next and previous pages.\n * @returns The QueryResult instance {@link QueryResult}\n *\n * @example\n * const builder = new QueryBuilder(client)\n * const result = await builder.where(eq(\"name\", \"John\")).fetch()\n * // result = { entities: [Entity, Entity, Entity], next: async () => QueryResult, previous: async () => QueryResult }\n */\n async fetch() {\n const queryResult = await processQuery(this._client, {\n predicates: this._predicates,\n limit: this._limit,\n cursor: this._cursor,\n ownedBy: this._ownedBy,\n orderBy: this._orderBy,\n validAtBlock: this._validAtBlock,\n withAttributes: this._withAttributes,\n withMetadata: this._withMetadata,\n withPayload: this._withPayload,\n })\n\n const entities = await Promise.all(\n queryResult.data.map((entity) => entityFromRpcResult(entity)),\n )\n\n this.cursor(queryResult.cursor)\n this.validAtBlock(queryResult.blockNumber)\n\n return new QueryResult(entities, this, this._cursor, this._limit, this._validAtBlock)\n }\n\n /**\n * Counts the entities from the query.\n * @returns The number of entities\n *\n * @example\n * const builder = new QueryBuilder(client)\n * const result = await builder.where(eq(\"name\", \"John\")).count()\n * // result = 10\n */\n async count() {\n const queryResult = await processQuery(this._client, {\n predicates: this._predicates,\n limit: this._limit,\n cursor: this._cursor,\n ownedBy: this._ownedBy,\n orderBy: undefined,\n validAtBlock: this._validAtBlock,\n withAttributes: false,\n withMetadata: false,\n withPayload: false,\n })\n\n return queryResult.data.length ?? 0\n }\n}\n"],"mappings":";;;;AAEA,MAAM,iBAAiB;AAEvB,MAAa,aAAa,UAAkB,YAAY,GAAG,eAAe,GAAG,QAAQ;;;;ACJrF,IAAa,qBAAb,cAAwC,MAAM;CAC5C,cAAc;AACZ,QAAM,kBAAkB;;;AAI5B,IAAa,uBAAb,cAA0C,MAAM;CAC9C,cAAc;AACZ,QAAM,iDAAiD;;;AAI3D,IAAa,kCAAb,cAAqD,MAAM;CACzD,cAAc;AACZ,QAAM,+BAA+B;;;AAIzC,IAAa,qBAAb,cAAwC,MAAM;CAC5C,cAAc;AACZ,QAAM,kBAAkB;;;;;;AChB5B,IAAa,SAAb,MAAoB;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,KACA,cAAoC,QACpC,QAAyB,QACzB,iBAAqC,QACrC,iBAAqC,QACrC,sBAA0C,QAC1C,0BAA8C,QAC9C,8BAAkD,QAClD,UAAkC,QAClC,YACA;AACA,OAAK,MAAM;AACX,OAAK,QAAQ;AACb,OAAK,iBAAiB;AACtB,OAAK,iBAAiB;AACtB,OAAK,sBAAsB;AAC3B,OAAK,0BAA0B;AAC/B,OAAK,8BAA8B;AACnC,OAAK,UAAU;AACf,OAAK,aAAa;AAClB,OAAK,cAAc;;CAGrB,SAAiB;AACf,SAAO,KAAK,UAAU,cAAc,KAAK,QAAQ,GAAG;;CAGtD,SAAc;AACZ,SAAO,KAAK,UAAU,KAAK,MAAM,cAAc,KAAK,QAAQ,CAAC,GAAG,EAAE;;;;;;ACxCtE,MAAMA,WAAS,UAAU,iBAAiB;AAE1C,eAAsB,oBAAoB,WAAsB;AAC9D,UAAO,0BAA0B,UAAU;AAE3C,QAAO,IAAI,OACT,UAAU,KACV,UAAU,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