@arkiv-network/sdk 0.6.8-dev.1 → 0.6.8-dev.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.
- package/README.md +52 -16
- package/dist/chains/index.d.cts +25 -25
- package/dist/chains/index.d.cts.map +1 -1
- package/dist/chains/index.d.ts +25 -25
- package/dist/consts-AUoL-v42.cjs +18 -0
- package/dist/consts-BV4PR-de.js +7 -0
- package/dist/consts-BV4PR-de.js.map +1 -0
- package/dist/{query-CO6f35AE.d.cts → entity-BSU5-vyY.d.cts} +68 -31
- package/dist/entity-BSU5-vyY.d.cts.map +1 -0
- package/dist/{query-BhdmAzYg.d.ts → entity-CHiZ2Qu1.d.ts} +68 -31
- package/dist/entity-CHiZ2Qu1.d.ts.map +1 -0
- package/dist/{queryBuilder-BvoQXa_u.d.ts → index-CzqHiUAo.d.ts} +202 -74
- package/dist/index-CzqHiUAo.d.ts.map +1 -0
- package/dist/{queryBuilder-zTsKXctT.d.cts → index-gj33r3rd.d.cts} +202 -74
- package/dist/index-gj33r3rd.d.cts.map +1 -0
- package/dist/index.cjs +63 -28
- package/dist/index.d.cts +90 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +91 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -21
- package/dist/index.js.map +1 -1
- package/dist/{payload-Da9gJMG5.d.ts → payload-B2kFJyah.d.ts} +1 -1
- package/dist/{payload-Da9gJMG5.d.ts.map → payload-B2kFJyah.d.ts.map} +1 -1
- package/dist/payload-Claf2jUO.js +13 -0
- package/dist/payload-Claf2jUO.js.map +1 -0
- package/dist/{payload-vwU3Rc6P.cjs → payload-DpA5PA-w.cjs} +0 -17
- package/dist/query/index.cjs +6 -2
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +3 -2
- package/dist/query/index.js.map +1 -1
- package/dist/{queryBuilder-DM-YO1Y7.cjs → queryBuilder-CTPwve9u.cjs} +229 -70
- package/dist/{queryBuilder-DonAg1aq.js → queryBuilder-D-ACo-g_.js} +201 -72
- package/dist/queryBuilder-D-ACo-g_.js.map +1 -0
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs +4 -10
- package/dist/utils/index.d.cts +0 -1
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -3
- package/dist/utils/index.js.map +1 -1
- package/package.json +11 -15
- package/src/actions/public/buildQuery.ts +4 -0
- package/src/actions/wallet/createEntity.ts +12 -2
- package/src/actions/wallet/extendEntity.ts +6 -1
- package/src/actions/wallet/updateEntity.ts +12 -2
- package/src/clients/createPublicClient.test.ts +2 -0
- package/src/clients/decorators/arkivPublic.ts +67 -1
- package/src/clients/decorators/arkivWallet.ts +18 -0
- package/src/errors.ts +18 -0
- package/src/index.ts +0 -3
- package/src/query/engine.ts +22 -13
- package/src/query/index.ts +1 -0
- package/src/query/queryBuilder.ts +189 -94
- package/src/query/queryResult.ts +13 -7
- package/src/query/selectQueryBuilder.test.ts +210 -0
- package/src/query/selection.test.ts +120 -0
- package/src/query/selection.ts +116 -0
- package/src/types/attributes.ts +12 -0
- package/src/utils/arkivTransactions.test.ts +62 -0
- package/src/utils/arkivTransactions.ts +36 -27
- package/src/utils/index.ts +0 -1
- package/src/utils/validation.test.ts +60 -0
- package/src/utils/validation.ts +32 -0
- package/dist/accounts/index.cjs +0 -9
- package/dist/accounts/index.d.cts +0 -1
- package/dist/accounts/index.d.ts +0 -1
- package/dist/accounts/index.js +0 -1
- package/dist/payload-DKBYYjeA.js +0 -18
- package/dist/payload-DKBYYjeA.js.map +0 -1
- package/dist/query-BhdmAzYg.d.ts.map +0 -1
- package/dist/query-CO6f35AE.d.cts.map +0 -1
- package/dist/queryBuilder-BvoQXa_u.d.ts.map +0 -1
- package/dist/queryBuilder-DonAg1aq.js.map +0 -1
- package/dist/queryBuilder-zTsKXctT.d.cts.map +0 -1
- package/src/accounts/index.ts +0 -1
|
@@ -81,6 +81,30 @@ type GetBlockTimingReturnType = {
|
|
|
81
81
|
blockDuration: number;
|
|
82
82
|
};
|
|
83
83
|
//#endregion
|
|
84
|
+
//#region src/actions/public/query.d.ts
|
|
85
|
+
type QueryOptionsIncludeData = {
|
|
86
|
+
attributes?: boolean;
|
|
87
|
+
payload?: boolean;
|
|
88
|
+
metadata?: boolean;
|
|
89
|
+
};
|
|
90
|
+
type QueryOptionsOrderBy = {
|
|
91
|
+
name: string;
|
|
92
|
+
type: "string" | "numeric";
|
|
93
|
+
desc: "asc" | "desc";
|
|
94
|
+
};
|
|
95
|
+
type QueryOptions = {
|
|
96
|
+
includeData?: QueryOptionsIncludeData;
|
|
97
|
+
atBlock?: bigint;
|
|
98
|
+
orderBy?: QueryOptionsOrderBy[];
|
|
99
|
+
resultsPerPage?: number | undefined;
|
|
100
|
+
cursor?: string | undefined;
|
|
101
|
+
};
|
|
102
|
+
type QueryReturnType = {
|
|
103
|
+
entities: Entity[];
|
|
104
|
+
cursor: string | undefined;
|
|
105
|
+
blockNumber: bigint | undefined;
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
84
108
|
//#region src/actions/wallet/changeOwnership.d.ts
|
|
85
109
|
/**
|
|
86
110
|
* Parameters for the deleteEntity function.
|
|
@@ -104,14 +128,24 @@ type ChangeOwnershipReturnType = {
|
|
|
104
128
|
/**
|
|
105
129
|
* Parameters for the createEntity function.
|
|
106
130
|
* - payload: The payload of the entity.
|
|
107
|
-
* - attributes: The attributes of the entity.
|
|
131
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
132
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
133
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
134
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
135
|
+
* {@link InvalidAttributeError}.
|
|
108
136
|
* - contentType: The content type of the entity.
|
|
109
|
-
* - expiresIn:
|
|
137
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
138
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
139
|
+
* positive integer and a multiple of the block time (2 seconds)**
|
|
140
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
110
141
|
*/
|
|
111
142
|
type CreateEntityParameters = {
|
|
112
143
|
payload: Uint8Array;
|
|
144
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
113
145
|
attributes: Attribute[];
|
|
114
146
|
contentType: MimeType | string;
|
|
147
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
148
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
115
149
|
expiresIn: number;
|
|
116
150
|
};
|
|
117
151
|
/**
|
|
@@ -146,10 +180,15 @@ type DeleteEntityReturnType = {
|
|
|
146
180
|
/**
|
|
147
181
|
* Parameters for the extendEntity function.
|
|
148
182
|
* - entityKey: The key of the entity to extend.
|
|
149
|
-
* - expiresIn:
|
|
183
|
+
* - expiresIn: How long to extend the entity by, in seconds. Because Arkiv
|
|
184
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
185
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
186
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
150
187
|
*/
|
|
151
188
|
type ExtendEntityParameters = {
|
|
152
189
|
entityKey: Hex;
|
|
190
|
+
/** Seconds to extend by. Must be a positive integer and a multiple of the 2s block time.
|
|
191
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
153
192
|
expiresIn: number;
|
|
154
193
|
};
|
|
155
194
|
/**
|
|
@@ -167,15 +206,25 @@ type ExtendEntityReturnType = {
|
|
|
167
206
|
* Parameters for the updateEntity function.
|
|
168
207
|
* - entityKey: The key of the entity to update.
|
|
169
208
|
* - payload: The payload of the entity.
|
|
170
|
-
* - attributes: The attributes of the entity.
|
|
209
|
+
* - attributes: The attributes of the entity. Attribute values may be strings
|
|
210
|
+
* or numbers, but numeric values **must be integers**. To store a non-integer,
|
|
211
|
+
* scale it to an integer (e.g. `1.5` -> `1500`) to preserve numeric ordering,
|
|
212
|
+
* or pass it as a string (e.g. `"1.5"`). A non-integer numeric value throws an
|
|
213
|
+
* {@link InvalidAttributeError}.
|
|
171
214
|
* - contentType: The content type of the entity.
|
|
172
|
-
* - expiresIn:
|
|
215
|
+
* - expiresIn: How long until the entity expires, in seconds. Because Arkiv
|
|
216
|
+
* measures expiration in blocks (1 block = 2 seconds), this **must be a
|
|
217
|
+
* positive integer and a multiple of the block time (2 seconds)**.
|
|
218
|
+
* Invalid values throw an {@link InvalidExpirationError}.
|
|
173
219
|
*/
|
|
174
220
|
type UpdateEntityParameters = {
|
|
175
221
|
entityKey: Hex;
|
|
176
222
|
payload: Uint8Array;
|
|
223
|
+
/** Entity attributes. Numeric values must be integers (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
177
224
|
attributes: Attribute[];
|
|
178
225
|
contentType: MimeType | string;
|
|
226
|
+
/** Seconds until expiry. Must be a positive integer and a multiple of the 2s block time.
|
|
227
|
+
* Throws {@link InvalidExpirationError} otherwise. */
|
|
179
228
|
expiresIn: number;
|
|
180
229
|
};
|
|
181
230
|
/**
|
|
@@ -222,8 +271,20 @@ type MutateEntitiesReturnType = {
|
|
|
222
271
|
};
|
|
223
272
|
//#endregion
|
|
224
273
|
//#region src/types/attributes.d.ts
|
|
274
|
+
/**
|
|
275
|
+
* An entity attribute (key/value pair).
|
|
276
|
+
*
|
|
277
|
+
* Arkiv supports both string and number values. Numeric values **must be
|
|
278
|
+
* integers** — passing a non-integer number (e.g. `1.5`) throws an
|
|
279
|
+
* {@link InvalidAttributeError} at mutation time. To store a non-integer value:
|
|
280
|
+
* - Scale it to an integer (e.g. `1.5` -> `1500`, dividing by the same factor on
|
|
281
|
+
* read) to keep numeric ordering and range queries working.
|
|
282
|
+
* - Or pass it as a string (e.g. `"1.5"`), which sorts lexicographically and so
|
|
283
|
+
* does not support numeric comparisons.
|
|
284
|
+
*/
|
|
225
285
|
type Attribute = {
|
|
226
286
|
key: string;
|
|
287
|
+
/** Attribute value. A `number` must be an integer (scale non-integers, e.g. `1.5` -> `1500`, or use a string). Throws {@link InvalidAttributeError} otherwise. */
|
|
227
288
|
value: string | number;
|
|
228
289
|
};
|
|
229
290
|
//#endregion
|
|
@@ -307,29 +368,5 @@ declare class Entity {
|
|
|
307
368
|
toJson(): any;
|
|
308
369
|
}
|
|
309
370
|
//#endregion
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
attributes?: boolean;
|
|
313
|
-
payload?: boolean;
|
|
314
|
-
metadata?: boolean;
|
|
315
|
-
};
|
|
316
|
-
type QueryOptionsOrderBy = {
|
|
317
|
-
name: string;
|
|
318
|
-
type: "string" | "numeric";
|
|
319
|
-
desc: "asc" | "desc";
|
|
320
|
-
};
|
|
321
|
-
type QueryOptions = {
|
|
322
|
-
includeData?: QueryOptionsIncludeData;
|
|
323
|
-
atBlock?: bigint;
|
|
324
|
-
orderBy?: QueryOptionsOrderBy[];
|
|
325
|
-
resultsPerPage?: number | undefined;
|
|
326
|
-
cursor?: string | undefined;
|
|
327
|
-
};
|
|
328
|
-
type QueryReturnType = {
|
|
329
|
-
entities: Entity[];
|
|
330
|
-
cursor: string | undefined;
|
|
331
|
-
blockNumber: bigint | undefined;
|
|
332
|
-
};
|
|
333
|
-
//#endregion
|
|
334
|
-
export { RpcIncludeData as A, CreateEntityReturnType as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, CreateEntityParameters as S, ChangeOwnershipReturnType as T, UpdateEntityReturnType as _, Entity as a, DeleteEntityParameters as b, OnEntityDeletedEvent as c, OnEntityOwnerChangedEvent as d, OnEntityUpdatedEvent as f, UpdateEntityParameters as g, MutateEntitiesReturnType as h, QueryReturnType as i, RpcOrderByAttribute as j, RpcEntity as k, OnEntityExpiredEvent as l, MutateEntitiesParameters as m, QueryOptionsIncludeData as n, TxParams as o, Attribute as p, QueryOptionsOrderBy as r, OnEntityCreatedEvent as s, QueryOptions as t, OnEntityExpiresInExtendedEvent as u, ExtendEntityParameters as v, ChangeOwnershipParameters as w, DeleteEntityReturnType as x, ExtendEntityReturnType as y };
|
|
335
|
-
//# sourceMappingURL=query-BhdmAzYg.d.ts.map
|
|
371
|
+
export { RpcIncludeData as A, QueryOptionsIncludeData as C, ArkivClient as D, GetBlockTimingReturnType as E, RpcQueryOptions as M, MimeType as N, ArkivRpcSchema as O, QueryOptions as S, QueryReturnType as T, DeleteEntityReturnType as _, OnEntityExpiredEvent as a, ChangeOwnershipParameters as b, OnEntityUpdatedEvent as c, MutateEntitiesReturnType as d, UpdateEntityParameters as f, DeleteEntityParameters as g, ExtendEntityReturnType as h, OnEntityDeletedEvent as i, RpcOrderByAttribute as j, RpcEntity as k, Attribute as l, ExtendEntityParameters as m, TxParams as n, OnEntityExpiresInExtendedEvent as o, UpdateEntityReturnType as p, OnEntityCreatedEvent as r, OnEntityOwnerChangedEvent as s, Entity as t, MutateEntitiesParameters as u, CreateEntityParameters as v, QueryOptionsOrderBy as w, ChangeOwnershipReturnType as x, CreateEntityReturnType as y };
|
|
372
|
+
//# sourceMappingURL=entity-CHiZ2Qu1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-CHiZ2Qu1.d.ts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.ts","../src/actions/public/query.ts","../src/actions/wallet/changeOwnership.ts","../src/actions/wallet/createEntity.ts","../src/actions/wallet/deleteEntity.ts","../src/actions/wallet/extendEntity.ts","../src/actions/wallet/updateEntity.ts","../src/actions/wallet/mutateEntities.ts","../src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I,GbTJ,GAAA,SAAA,EAAA,cAAA,EAAA,MAAA,GAAA,SAAA,EAAA,cAAA,EAAA,MAAA,GAAA,SAAA,EAAA,mBAAA,EAAA,MAAA,GAAA,SAAA,EAAA,uBAAA,EAAA,MAAA,GAAA,SAAA,EAAA,2BAAA,EAAA,MAAA,GAAA,SAAA,EAAA,OAAA,EaeI,UbfJ,GAAA,SAAA,EAAA,UAAA,EagBO,SbhBP,EAAA;EACE;;;AAKX;AAMA;;EAEgB,MAAA,CAAA,CAAA,EAAA,MAAA;EACJ;;;AAKZ;AAcA;;EAKY,MAAA,CAAA,CAAA,EAAA,GAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as ArkivClient,
|
|
1
|
+
import { A as RpcIncludeData, D as ArkivClient, j as RpcOrderByAttribute, k as RpcEntity, t as Entity } from "./entity-CHiZ2Qu1.js";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
|
|
4
4
|
//#region src/query/predicate.d.ts
|
|
@@ -114,20 +114,79 @@ declare function lte(key: string, value: string | number): Predicate;
|
|
|
114
114
|
declare function not(key: string): Predicate;
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/query/queryResult.d.ts
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
/**
|
|
118
|
+
* The result of a query. Holds the fetched entities and supports cursor-based pagination.
|
|
119
|
+
*
|
|
120
|
+
* @typeParam TEntity - The shape of each entity, inferred from the query builder
|
|
121
|
+
* (a full {@link Entity}, or a projected object inferred from a `select()` selection).
|
|
122
|
+
*/
|
|
123
|
+
declare class QueryResult<TEntity = Entity> {
|
|
124
|
+
entities: TEntity[];
|
|
119
125
|
private _endOfIteration;
|
|
120
126
|
private _cursor;
|
|
121
127
|
private _limit;
|
|
122
128
|
private _validAtBlock;
|
|
123
129
|
private _queryBuilder;
|
|
124
|
-
get queryBuilder():
|
|
130
|
+
get queryBuilder(): BaseQueryBuilder<TEntity>;
|
|
125
131
|
get cursor(): string | undefined;
|
|
126
|
-
constructor(entities:
|
|
132
|
+
constructor(entities: TEntity[], queryBuilder: BaseQueryBuilder<TEntity>, cursor: string | undefined, limit: number | undefined, validAtBlock: bigint | undefined);
|
|
127
133
|
next(): Promise<void>;
|
|
128
134
|
hasNextPage(): boolean;
|
|
129
135
|
}
|
|
130
136
|
//#endregion
|
|
137
|
+
//#region src/query/selection.d.ts
|
|
138
|
+
/** The entity fields that can be selected. These match the fields of {@link Entity} one-to-one. */
|
|
139
|
+
type DataKey = "key" | "contentType" | "owner" | "creator" | "expiresAtBlock" | "createdAtBlock" | "lastModifiedAtBlock" | "transactionIndexInBlock" | "operationIndexInTransaction" | "attributes" | "payload";
|
|
140
|
+
/**
|
|
141
|
+
* The parts of an entity that can be selected. Every field is opt-in (including the `key`) and maps
|
|
142
|
+
* directly to a field of the returned {@link Entity} — the selection is flat.
|
|
143
|
+
*/
|
|
144
|
+
type SelectionFields = { [K in DataKey]?: boolean };
|
|
145
|
+
/**
|
|
146
|
+
* Requires at least one property of `T` to be present.
|
|
147
|
+
* `{}` is not assignable, which is how `select({})` is rejected at compile time.
|
|
148
|
+
*/
|
|
149
|
+
type AtLeastOne<T, K$1 extends keyof T = keyof T> = { [P in K$1]: Required<Pick<T, P>> & Partial<Omit<T, P>> }[K$1];
|
|
150
|
+
/**
|
|
151
|
+
* A non-empty entity selection — the object form accepted by `select()`. At least one field must be
|
|
152
|
+
* selected.
|
|
153
|
+
*/
|
|
154
|
+
type EntitySelection = AtLeastOne<SelectionFields>;
|
|
155
|
+
/** Argument accepted by `select()` — a non-empty {@link EntitySelection}, or `"*"` for everything. */
|
|
156
|
+
type SelectArg = EntitySelection | "*";
|
|
157
|
+
/**
|
|
158
|
+
* The result of a selection `S`: an {@link Entity} narrowed to exactly the selected fields (each
|
|
159
|
+
* non-`undefined`). The shape is flat and backwards compatible — e.g. `select({ owner: true })`
|
|
160
|
+
* yields `{ owner: Hex }` accessed as `entity.owner`. Accessing an unselected field is a compile
|
|
161
|
+
* error.
|
|
162
|
+
*
|
|
163
|
+
* The `toText()` / `toJson()` helpers operate on the payload, so they are only present when
|
|
164
|
+
* `payload` was selected — calling them otherwise would always throw.
|
|
165
|
+
*/
|
|
166
|
+
type ProjectedEntity<S> = { readonly [K in keyof S as S[K] extends true ? K : never]: K extends keyof Entity ? NonNullable<Entity[K]> : never } & (S extends {
|
|
167
|
+
payload: true;
|
|
168
|
+
} ? Pick<Entity, "toText" | "toJson"> : unknown);
|
|
169
|
+
/** A selection of every field, used to type the result of `select()` / `select("*")`. */
|
|
170
|
+
type AllSelected = { [K in DataKey]: true };
|
|
171
|
+
/** The projected entity type when everything is selected — every field, plus the methods. */
|
|
172
|
+
type FullEntity = ProjectedEntity<AllSelected>;
|
|
173
|
+
/**
|
|
174
|
+
* Converts a {@link SelectArg} into the {@link RpcIncludeData} understood by the query engine.
|
|
175
|
+
* Every field is opt-in — anything not explicitly selected defaults to `false`, including the key.
|
|
176
|
+
* `undefined` or `"*"` selects everything.
|
|
177
|
+
*
|
|
178
|
+
* @param selection - The selection to convert
|
|
179
|
+
* @returns The fully-resolved include-data object for the RPC query
|
|
180
|
+
* @throws If an empty selection object is provided
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* selectionToIncludeData() // everything
|
|
184
|
+
* selectionToIncludeData("*") // everything
|
|
185
|
+
* selectionToIncludeData({ key: true }) // only the key
|
|
186
|
+
* selectionToIncludeData({ owner: true }) // only the owner
|
|
187
|
+
*/
|
|
188
|
+
declare function selectionToIncludeData(selection?: SelectArg): RpcIncludeData;
|
|
189
|
+
//#endregion
|
|
131
190
|
//#region src/query/queryBuilder.d.ts
|
|
132
191
|
type OrderByAttribute = {
|
|
133
192
|
name: string;
|
|
@@ -155,41 +214,52 @@ declare function asc(attributeName: string, attributeType: "string" | "number"):
|
|
|
155
214
|
*/
|
|
156
215
|
declare function desc(attributeName: string, attributeType: "string" | "number"): OrderByAttribute;
|
|
157
216
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* @param client - The Arkiv client
|
|
161
|
-
* @returns The QueryBuilder instance {@link QueryBuilder}
|
|
217
|
+
* Data-selection parameters forwarded to the query engine on each fetch.
|
|
218
|
+
* Subclasses of {@link BaseQueryBuilder} decide which parts of an entity are fetched.
|
|
162
219
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
220
|
+
type SelectionParams = {
|
|
221
|
+
withAttributes?: boolean | undefined;
|
|
222
|
+
withMetadata?: boolean | undefined;
|
|
223
|
+
withPayload?: boolean | undefined;
|
|
224
|
+
includeData?: RpcIncludeData | undefined;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* BaseQueryBuilder holds the query-building logic shared by every query builder
|
|
228
|
+
* (filtering, ordering, pagination, execution). It follows the Builder pattern,
|
|
229
|
+
* allowing methods to be chained. Subclasses decide how data selection is expressed
|
|
230
|
+
* by implementing the protected `selectionParams` method.
|
|
231
|
+
*
|
|
232
|
+
* Use {@link SelectQueryBuilder} via `client.select()` to build and execute queries.
|
|
233
|
+
*
|
|
234
|
+
* @typeParam TEntity - The shape of each entity produced by {@link BaseQueryBuilder.fetch}.
|
|
235
|
+
*/
|
|
236
|
+
declare abstract class BaseQueryBuilder<TEntity> {
|
|
237
|
+
protected _client: ArkivClient;
|
|
238
|
+
protected _ownedBy: Hex | undefined;
|
|
239
|
+
protected _createdBy: Hex | undefined;
|
|
240
|
+
protected _orderBy: RpcOrderByAttribute[] | undefined;
|
|
241
|
+
protected _validAtBlock: bigint | undefined;
|
|
242
|
+
protected _limit: number | undefined;
|
|
243
|
+
protected _cursor: string | undefined;
|
|
244
|
+
protected _predicates: Predicate[];
|
|
175
245
|
constructor(client: ArkivClient);
|
|
176
246
|
/**
|
|
177
247
|
* Sets the ownedBy filter
|
|
178
248
|
* @param ownedBy - The address of the owner
|
|
179
|
-
* @returns The
|
|
249
|
+
* @returns The query builder instance
|
|
180
250
|
*
|
|
181
251
|
* @example
|
|
182
|
-
* const builder =
|
|
252
|
+
* const builder = client.select()
|
|
183
253
|
* builder.ownedBy("0x1234567890123456789012345678901234567890")
|
|
184
254
|
*/
|
|
185
255
|
ownedBy(ownedBy: Hex): this;
|
|
186
256
|
/**
|
|
187
257
|
* Sets the createdBy filter
|
|
188
258
|
* @param createdBy - The address of the creator
|
|
189
|
-
* @returns The
|
|
259
|
+
* @returns The query builder instance
|
|
190
260
|
*
|
|
191
261
|
* @example
|
|
192
|
-
* const builder =
|
|
262
|
+
* const builder = client.select()
|
|
193
263
|
* builder.createdBy("0x1234567890123456789012345678901234567890")
|
|
194
264
|
*/
|
|
195
265
|
createdBy(createdBy: Hex): this;
|
|
@@ -201,10 +271,10 @@ declare class QueryBuilder {
|
|
|
201
271
|
* @param attributeName - The name of the attribute to order by
|
|
202
272
|
* @param attributeType - The type of the attribute to order by (string or number)
|
|
203
273
|
* @param order - The order to set the order by (asc or desc)
|
|
204
|
-
* @returns The
|
|
274
|
+
* @returns The query builder instance
|
|
205
275
|
*
|
|
206
276
|
* @example
|
|
207
|
-
* const builder = client.
|
|
277
|
+
* const builder = client.select()
|
|
208
278
|
* builder.orderBy("name", "string", "desc")
|
|
209
279
|
* builder.orderBy(asc("name", "string"))
|
|
210
280
|
* builder.orderBy(desc("name", "string"))
|
|
@@ -215,72 +285,42 @@ declare class QueryBuilder {
|
|
|
215
285
|
* This method takes the OrderByAttribute object as an argument and is mainly
|
|
216
286
|
* used to use the helper functions asc() and desc() to create the OrderByAttribute instances.
|
|
217
287
|
* @param orderByAttribute - The OrderByAttribute instance to set
|
|
218
|
-
* @returns The
|
|
288
|
+
* @returns The query builder instance
|
|
219
289
|
*
|
|
220
290
|
* @example
|
|
221
|
-
* const builder =
|
|
291
|
+
* const builder = client.select()
|
|
222
292
|
* builder.orderBy(asc("name", "string"))
|
|
223
293
|
* builder.orderBy(desc("name", "string"))
|
|
224
294
|
*/
|
|
225
295
|
orderBy(orderByAttribute: OrderByAttribute): this;
|
|
226
|
-
/**
|
|
227
|
-
* Sets the withAttributes flag which will return the attributes for the entities if true
|
|
228
|
-
* @param withAttributes - The boolean value to set
|
|
229
|
-
* @returns The QueryBuilder instance
|
|
230
|
-
*
|
|
231
|
-
* @example
|
|
232
|
-
* const builder = new QueryBuilder(client)
|
|
233
|
-
* builder.withAttributes(true)
|
|
234
|
-
*/
|
|
235
|
-
withAttributes(withAttributes?: boolean): this;
|
|
236
|
-
/**
|
|
237
|
-
* Sets the withMetadata flag which will return the metadata (like owner, expiredAt, etc.) for the entities if true
|
|
238
|
-
* @param withMetadata - The boolean value to set
|
|
239
|
-
* @returns The QueryBuilder instance
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* const builder = new QueryBuilder(client)
|
|
243
|
-
* builder.withMetadata(true)
|
|
244
|
-
*/
|
|
245
|
-
withMetadata(withMetadata?: boolean): this;
|
|
246
|
-
/**
|
|
247
|
-
* Sets the withPayload flag which will return the payload for the entities if true
|
|
248
|
-
* @param withPayload - The boolean value to set
|
|
249
|
-
* @returns The QueryBuilder instance
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* const builder = new QueryBuilder(client)
|
|
253
|
-
* builder.withPayload(true)
|
|
254
|
-
*/
|
|
255
|
-
withPayload(withPayload?: boolean): this;
|
|
256
296
|
/**
|
|
257
297
|
* Sets the limit for the query
|
|
258
298
|
* @param limit - The number of entities to return
|
|
259
|
-
* @returns The
|
|
299
|
+
* @returns The query builder instance
|
|
260
300
|
*
|
|
261
301
|
* @example
|
|
262
|
-
* const builder =
|
|
302
|
+
* const builder = client.select()
|
|
263
303
|
* builder.limit(10)
|
|
264
304
|
*/
|
|
265
305
|
limit(limit: number): this;
|
|
266
306
|
/**
|
|
267
307
|
* 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).
|
|
268
308
|
* @param cursor - The cursor to set which tells to RPC Query server where to start or continue the query.
|
|
269
|
-
* @returns The
|
|
309
|
+
* @returns The query builder instance
|
|
270
310
|
*
|
|
271
311
|
* @example
|
|
272
|
-
* const builder =
|
|
273
|
-
* builder.
|
|
312
|
+
* const builder = client.select()
|
|
313
|
+
* builder.cursor("0xABC123")
|
|
274
314
|
*/
|
|
275
315
|
cursor(cursor: string): this;
|
|
276
316
|
/**
|
|
277
317
|
* Sets the validAtBlock for the query which tells at which block height the state we are intested.
|
|
278
318
|
* If not set, the latest block is used.
|
|
279
319
|
* @param validAtBlock - The block number to set
|
|
280
|
-
* @returns The
|
|
320
|
+
* @returns The query builder instance
|
|
281
321
|
*
|
|
282
322
|
* @example
|
|
283
|
-
* const builder =
|
|
323
|
+
* const builder = client.select()
|
|
284
324
|
* builder.validAtBlock(10000)
|
|
285
325
|
*/
|
|
286
326
|
validAtBlock(validAtBlock: bigint): this;
|
|
@@ -288,10 +328,10 @@ declare class QueryBuilder {
|
|
|
288
328
|
* Sets the predicates for the query limiting the results. It can be a single predicate or an array of predicates combined with 'and'.
|
|
289
329
|
* Predicates can be nested using 'or' and 'and' predicates.
|
|
290
330
|
* @param predicates - The predicates to set
|
|
291
|
-
* @returns The
|
|
331
|
+
* @returns The query builder instance
|
|
292
332
|
*
|
|
293
333
|
* @example
|
|
294
|
-
* const builder =
|
|
334
|
+
* const builder = client.select()
|
|
295
335
|
* builder.where(eq("name", "John"))
|
|
296
336
|
* builder.where([eq("name", "John"), eq("age", 30)])
|
|
297
337
|
* builder.where([eq("name", "John"), or([eq("age", 30), eq("age", 31)])])
|
|
@@ -302,27 +342,115 @@ declare class QueryBuilder {
|
|
|
302
342
|
*/
|
|
303
343
|
where(predicates: Predicate[] | Predicate): this;
|
|
304
344
|
/**
|
|
305
|
-
*
|
|
345
|
+
* Returns the data-selection parameters forwarded to the query engine.
|
|
346
|
+
* Subclasses decide which parts of an entity are fetched.
|
|
347
|
+
*/
|
|
348
|
+
protected abstract selectionParams(): SelectionParams;
|
|
349
|
+
/**
|
|
350
|
+
* Builds a single result entity from a raw RPC entity. Subclasses decide the produced shape
|
|
351
|
+
* (a full {@link Entity}, or a projected object inferred from the selection).
|
|
352
|
+
*/
|
|
353
|
+
protected abstract projectEntity(rpcEntity: RpcEntity): TEntity | Promise<TEntity>;
|
|
354
|
+
/**
|
|
355
|
+
* Fetches the entities from the query.
|
|
306
356
|
* It will return a QueryResult instance which can be used to fetch the next and previous pages.
|
|
307
357
|
* @returns The QueryResult instance {@link QueryResult}
|
|
308
358
|
*
|
|
309
359
|
* @example
|
|
310
|
-
* const builder =
|
|
360
|
+
* const builder = client.select()
|
|
311
361
|
* const result = await builder.where(eq("name", "John")).fetch()
|
|
312
362
|
* // result = { entities: [Entity, Entity, Entity], next: async () => QueryResult, previous: async () => QueryResult }
|
|
313
363
|
*/
|
|
314
|
-
fetch(): Promise<QueryResult
|
|
364
|
+
fetch(): Promise<QueryResult<TEntity>>;
|
|
315
365
|
/**
|
|
316
366
|
* Counts the entities from the query.
|
|
317
367
|
* @returns The number of entities
|
|
318
368
|
*
|
|
319
369
|
* @example
|
|
320
|
-
* const builder =
|
|
370
|
+
* const builder = client.select()
|
|
321
371
|
* const result = await builder.where(eq("name", "John")).count()
|
|
322
372
|
* // result = 10
|
|
323
373
|
*/
|
|
324
374
|
count(): Promise<number>;
|
|
325
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* QueryBuilder is a helper class to build queries to the Arkiv DBChains.
|
|
378
|
+
* It can be used to fetch entities from the Arkiv DBChains. It follows the Builder pattern allowing chaining of methods.
|
|
379
|
+
*
|
|
380
|
+
* By default the result includes only the entity `key`. Additional data is opt-in through
|
|
381
|
+
* `withAttributes()`, `withMetadata()` and `withPayload()`.
|
|
382
|
+
*
|
|
383
|
+
* @deprecated Use {@link SelectQueryBuilder} via `client.select()` instead. Declaring the
|
|
384
|
+
* selection up front avoids the common mistake of forgetting to opt in to data and getting back
|
|
385
|
+
* entities with only their `key` populated. This class remains for backwards compatibility and
|
|
386
|
+
* will be removed in a future release.
|
|
387
|
+
*
|
|
388
|
+
* @param client - The Arkiv client
|
|
389
|
+
* @returns The QueryBuilder instance {@link QueryBuilder}
|
|
390
|
+
*/
|
|
391
|
+
declare class QueryBuilder extends BaseQueryBuilder<Entity> {
|
|
392
|
+
private _withAttributes;
|
|
393
|
+
private _withMetadata;
|
|
394
|
+
private _withPayload;
|
|
395
|
+
/**
|
|
396
|
+
* Sets the withAttributes flag which will return the attributes for the entities if true
|
|
397
|
+
* @param withAttributes - The boolean value to set
|
|
398
|
+
* @returns The QueryBuilder instance
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* const builder = client.buildQuery()
|
|
402
|
+
* builder.withAttributes(true)
|
|
403
|
+
*/
|
|
404
|
+
withAttributes(withAttributes?: boolean): this;
|
|
405
|
+
/**
|
|
406
|
+
* Sets the withMetadata flag which will return the metadata (like owner, expiredAt, etc.) for the entities if true
|
|
407
|
+
* @param withMetadata - The boolean value to set
|
|
408
|
+
* @returns The QueryBuilder instance
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* const builder = client.buildQuery()
|
|
412
|
+
* builder.withMetadata(true)
|
|
413
|
+
*/
|
|
414
|
+
withMetadata(withMetadata?: boolean): this;
|
|
415
|
+
/**
|
|
416
|
+
* Sets the withPayload flag which will return the payload for the entities if true
|
|
417
|
+
* @param withPayload - The boolean value to set
|
|
418
|
+
* @returns The QueryBuilder instance
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* const builder = client.buildQuery()
|
|
422
|
+
* builder.withPayload(true)
|
|
423
|
+
*/
|
|
424
|
+
withPayload(withPayload?: boolean): this;
|
|
425
|
+
protected selectionParams(): SelectionParams;
|
|
426
|
+
protected projectEntity(rpcEntity: RpcEntity): Promise<Entity>;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* SelectQueryBuilder is the recommended query builder. It requires the selection to be declared
|
|
430
|
+
* up front, so results always contain exactly the data you asked for — and the type of each
|
|
431
|
+
* returned entity is narrowed to exactly the selected fields.
|
|
432
|
+
*
|
|
433
|
+
* The selection is fixed at construction time and is flat — each field maps to an entity field.
|
|
434
|
+
* Create one via `client.select(...)` rather than constructing it directly, so the result type is
|
|
435
|
+
* inferred from the selection.
|
|
436
|
+
*
|
|
437
|
+
* @typeParam TEntity - The projected entity shape, inferred from the selection by `client.select()`.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* // everything
|
|
441
|
+
* await client.select().where(eq("name", "John")).fetch()
|
|
442
|
+
* await client.select("*").where(eq("name", "John")).fetch()
|
|
443
|
+
* // specific fields
|
|
444
|
+
* await client.select({ owner: true, attributes: true }).fetch()
|
|
445
|
+
* // a single field — result is typed (flat) { owner: Hex }
|
|
446
|
+
* await client.select({ owner: true }).fetch()
|
|
447
|
+
*/
|
|
448
|
+
declare class SelectQueryBuilder<TEntity> extends BaseQueryBuilder<TEntity> {
|
|
449
|
+
private _includeData;
|
|
450
|
+
constructor(client: ArkivClient, selection?: SelectArg);
|
|
451
|
+
protected selectionParams(): SelectionParams;
|
|
452
|
+
protected projectEntity(rpcEntity: RpcEntity): Promise<TEntity>;
|
|
453
|
+
}
|
|
326
454
|
//#endregion
|
|
327
|
-
export { or as _,
|
|
328
|
-
//# sourceMappingURL=
|
|
455
|
+
export { neq as C, lte as S, or as T, and as _, asc as a, gte as b, FullEntity as c, SelectionFields as d, selectionToIncludeData as f, PredicateType as g, PredicateContainerType as h, SelectQueryBuilder as i, ProjectedEntity as l, Predicate as m, OrderByAttribute as n, desc as o, QueryResult as p, QueryBuilder as r, EntitySelection as s, BaseQueryBuilder as t, SelectArg as u, eq as v, not as w, lt as x, gt as y };
|
|
456
|
+
//# sourceMappingURL=index-CzqHiUAo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CzqHiUAo.d.ts","names":[],"sources":["../src/query/predicate.ts","../src/query/queryResult.ts","../src/query/selection.ts","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