@arkiv-network/sdk 0.6.8 → 0.7.0-dev.1
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/consts-Bz0LZQZY.js +7 -0
- package/dist/consts-Bz0LZQZY.js.map +1 -0
- package/dist/consts-CxT1-RXU.cjs +18 -0
- package/dist/entity-BhSXaB23.cjs +81 -0
- package/dist/{query-CO6f35AE.d.cts → entity-CN41IOrq.d.cts} +125 -59
- package/dist/entity-CN41IOrq.d.cts.map +1 -0
- package/dist/entity-DGfVyB-a.js +71 -0
- package/dist/entity-DGfVyB-a.js.map +1 -0
- package/dist/{query-BhdmAzYg.d.ts → entity-NnEVlePN.d.ts} +125 -59
- package/dist/entity-NnEVlePN.d.ts.map +1 -0
- package/dist/index-ClkpS6s_.d.ts +481 -0
- package/dist/index-ClkpS6s_.d.ts.map +1 -0
- package/dist/index-w4qop0Pe.d.cts +481 -0
- package/dist/index-w4qop0Pe.d.cts.map +1 -0
- package/dist/index.cjs +285 -233
- package/dist/index.d.cts +100 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +101 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +280 -230
- package/dist/index.js.map +1 -1
- package/dist/payload-BpNUPOnY.js +13 -0
- package/dist/payload-BpNUPOnY.js.map +1 -0
- package/dist/{payload-Da9gJMG5.d.ts → payload-C2KHOUoj.d.ts} +1 -1
- package/dist/{payload-Da9gJMG5.d.ts.map → payload-C2KHOUoj.d.ts.map} +1 -1
- package/dist/{payload-vwU3Rc6P.cjs → payload-D8YLKcJj.cjs} +1 -18
- package/dist/query/index.cjs +11 -28
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +8 -28
- package/dist/query/index.js.map +1 -1
- package/dist/{queryBuilder-DonAg1aq.js → queryBuilder-BE_XhLLa.js} +303 -152
- package/dist/queryBuilder-BE_XhLLa.js.map +1 -0
- package/dist/{queryBuilder-DM-YO1Y7.cjs → queryBuilder-J37buGCi.cjs} +372 -149
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +4 -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/public/query.ts +10 -0
- package/src/actions/public/subscribeEntityEvents.ts +25 -51
- package/src/actions/wallet/changeOwnership.ts +6 -6
- package/src/actions/wallet/createEntity.ts +19 -6
- package/src/actions/wallet/deleteEntity.ts +2 -3
- package/src/actions/wallet/extendEntity.ts +9 -5
- package/src/actions/wallet/mutateEntities.ts +11 -54
- package/src/actions/wallet/updateEntity.ts +15 -6
- package/src/clients/createPublicClient.test.ts +2 -0
- package/src/clients/decorators/arkivPublic.ts +67 -2
- package/src/clients/decorators/arkivWallet.ts +23 -1
- package/src/consts.ts +2 -1
- package/src/errors.ts +46 -0
- package/src/index.ts +0 -3
- package/src/query/engine.test.ts +45 -0
- package/src/query/engine.ts +28 -14
- package/src/query/index.ts +1 -0
- package/src/query/predicate.test.ts +43 -0
- package/src/query/predicate.ts +14 -10
- package/src/query/queryBuilder.test.ts +22 -0
- package/src/query/queryBuilder.ts +221 -106
- package/src/query/queryResult.ts +13 -7
- package/src/query/selectQueryBuilder.test.ts +213 -0
- package/src/query/selection.test.ts +120 -0
- package/src/query/selection.ts +116 -0
- package/src/types/attributes.ts +25 -1
- package/src/types/entity.ts +12 -2
- package/src/types/events.ts +14 -16
- package/src/types/index.ts +1 -0
- package/src/types/rpcSchema.ts +7 -2
- package/src/utils/arkivTransactions.test.ts +260 -0
- package/src/utils/arkivTransactions.ts +255 -92
- package/src/utils/entities.ts +17 -7
- package/src/utils/index.ts +0 -1
- package/src/utils/payload.ts +4 -2
- package/src/utils/validation.test.ts +106 -0
- package/src/utils/validation.ts +80 -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 +0 -328
- package/dist/queryBuilder-BvoQXa_u.d.ts.map +0 -1
- package/dist/queryBuilder-DonAg1aq.js.map +0 -1
- package/dist/queryBuilder-zTsKXctT.d.cts +0 -328
- package/dist/queryBuilder-zTsKXctT.d.cts.map +0 -1
- package/src/accounts/index.ts +0 -1
- /package/dist/{types-H-TSmRpm.js → types-Ci4BRClw.js} +0 -0
- /package/dist/{types-o3zWarRp.cjs → types-a8gm_IaQ.cjs} +0 -0
package/src/utils/entities.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import { toBytes } from "viem"
|
|
1
|
+
import { type Hex, toBytes } from "viem"
|
|
2
|
+
import type { Attribute } from "../types/attributes"
|
|
2
3
|
import { Entity } from "../types/entity"
|
|
3
4
|
import type { RpcEntity } from "../types/rpcSchema"
|
|
5
|
+
import { RpcAttributeValueType } from "../types/rpcSchema"
|
|
4
6
|
import { getLogger } from "./logger"
|
|
5
7
|
|
|
8
|
+
function decodeAttributeValue(value: string, valueType: RpcAttributeValueType): Attribute["value"] {
|
|
9
|
+
switch (valueType) {
|
|
10
|
+
case RpcAttributeValueType.Uint:
|
|
11
|
+
return Number(BigInt(value as Hex))
|
|
12
|
+
case RpcAttributeValueType.EntityKey:
|
|
13
|
+
return value as Hex
|
|
14
|
+
case RpcAttributeValueType.String:
|
|
15
|
+
default:
|
|
16
|
+
return value
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
const logger = getLogger("utils:entities")
|
|
7
21
|
|
|
8
22
|
export async function entityFromRpcResult(rpcEntity: RpcEntity) {
|
|
@@ -24,13 +38,9 @@ export async function entityFromRpcResult(rpcEntity: RpcEntity) {
|
|
|
24
38
|
: undefined,
|
|
25
39
|
rpcEntity.value !== undefined ? toBytes(rpcEntity.value) : undefined,
|
|
26
40
|
[
|
|
27
|
-
...(rpcEntity.
|
|
28
|
-
key,
|
|
29
|
-
value,
|
|
30
|
-
})),
|
|
31
|
-
...(rpcEntity.numericAttributes ?? []).map(({ key, value }) => ({
|
|
41
|
+
...(rpcEntity.attributes ?? []).map(({ key, value, valueType }) => ({
|
|
32
42
|
key,
|
|
33
|
-
value:
|
|
43
|
+
value: decodeAttributeValue(value, valueType),
|
|
34
44
|
})),
|
|
35
45
|
],
|
|
36
46
|
)
|
package/src/utils/index.ts
CHANGED
package/src/utils/payload.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { toBytes } from "viem"
|
|
1
|
+
import { stringToBytes, toBytes } from "viem"
|
|
2
2
|
|
|
3
3
|
export function jsonToPayload(json: object): Uint8Array {
|
|
4
4
|
return toBytes(JSON.stringify(json))
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export function stringToPayload(data: string): Uint8Array {
|
|
8
|
-
|
|
8
|
+
// stringToBytes, not toBytes: toBytes hex-decodes hex-looking strings, which
|
|
9
|
+
// would corrupt payloads like "0xab" instead of UTF-8 encoding them
|
|
10
|
+
return stringToBytes(data)
|
|
9
11
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test"
|
|
2
|
+
import { BLOCK_TIME } from "../consts"
|
|
3
|
+
import { InvalidAttributeError, InvalidAttributeKeyError, InvalidExpirationError } from "../errors"
|
|
4
|
+
import { validateAttribute, validateAttributeKey, validateExpiresIn } from "./validation"
|
|
5
|
+
|
|
6
|
+
describe("validateExpiresIn", () => {
|
|
7
|
+
it("accepts positive integers that are a multiple of the block time", () => {
|
|
8
|
+
expect(() => validateExpiresIn(BLOCK_TIME)).not.toThrow()
|
|
9
|
+
expect(() => validateExpiresIn(1000)).not.toThrow()
|
|
10
|
+
expect(() => validateExpiresIn(BLOCK_TIME * 12345)).not.toThrow()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it("throws for non-integer values", () => {
|
|
14
|
+
expect(() => validateExpiresIn(51.5)).toThrow(InvalidExpirationError)
|
|
15
|
+
expect(() => validateExpiresIn(1.5)).toThrow(InvalidExpirationError)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it("throws for values that are not a multiple of the block time", () => {
|
|
19
|
+
expect(() => validateExpiresIn(51)).toThrow(InvalidExpirationError)
|
|
20
|
+
expect(() => validateExpiresIn(999)).toThrow(InvalidExpirationError)
|
|
21
|
+
expect(() => validateExpiresIn(1)).toThrow(InvalidExpirationError)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it("throws for zero and negative values", () => {
|
|
25
|
+
expect(() => validateExpiresIn(0)).toThrow(InvalidExpirationError)
|
|
26
|
+
expect(() => validateExpiresIn(-1000)).toThrow(InvalidExpirationError)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it("throws for NaN and non-finite values", () => {
|
|
30
|
+
expect(() => validateExpiresIn(Number.NaN)).toThrow(InvalidExpirationError)
|
|
31
|
+
expect(() => validateExpiresIn(Number.POSITIVE_INFINITY)).toThrow(InvalidExpirationError)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it("includes the offending value in the error message", () => {
|
|
35
|
+
expect(() => validateExpiresIn(51)).toThrow(/51/)
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
describe("validateAttribute", () => {
|
|
40
|
+
it("accepts string values", () => {
|
|
41
|
+
expect(() => validateAttribute({ key: "k", value: "1.5" })).not.toThrow()
|
|
42
|
+
expect(() => validateAttribute({ key: "k", value: "anything" })).not.toThrow()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it("accepts non-negative integer numeric values", () => {
|
|
46
|
+
expect(() => validateAttribute({ key: "k", value: 0 })).not.toThrow()
|
|
47
|
+
expect(() => validateAttribute({ key: "k", value: 123 })).not.toThrow()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("throws for non-integer numeric values", () => {
|
|
51
|
+
expect(() => validateAttribute({ key: "k", value: 1.5 })).toThrow(InvalidAttributeError)
|
|
52
|
+
expect(() => validateAttribute({ key: "k", value: Number.NaN })).toThrow(InvalidAttributeError)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it("throws for negative numeric values", () => {
|
|
56
|
+
expect(() => validateAttribute({ key: "k", value: -5 })).toThrow(InvalidAttributeError)
|
|
57
|
+
expect(() => validateAttribute({ key: "k", value: -0.5 })).toThrow(InvalidAttributeError)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it("includes the attribute key and value in the error message", () => {
|
|
61
|
+
expect(() => validateAttribute({ key: "my_key", value: 1.5 })).toThrow(/my_key/)
|
|
62
|
+
expect(() => validateAttribute({ key: "my_key", value: 1.5 })).toThrow(/1\.5/)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
describe("validateAttributeKey", () => {
|
|
67
|
+
it("accepts valid Ident32 keys", () => {
|
|
68
|
+
expect(() => validateAttributeKey("a")).not.toThrow()
|
|
69
|
+
expect(() => validateAttributeKey("tag")).not.toThrow()
|
|
70
|
+
expect(() => validateAttributeKey("num_attr")).not.toThrow()
|
|
71
|
+
expect(() => validateAttributeKey("a.b-c_d9")).not.toThrow()
|
|
72
|
+
expect(() => validateAttributeKey("a".repeat(32))).not.toThrow()
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("throws for an empty key", () => {
|
|
76
|
+
expect(() => validateAttributeKey("")).toThrow(InvalidAttributeKeyError)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it("throws when the key does not start with a lowercase letter", () => {
|
|
80
|
+
expect(() => validateAttributeKey("Tag")).toThrow(InvalidAttributeKeyError)
|
|
81
|
+
expect(() => validateAttributeKey("1tag")).toThrow(InvalidAttributeKeyError)
|
|
82
|
+
expect(() => validateAttributeKey("_tag")).toThrow(InvalidAttributeKeyError)
|
|
83
|
+
expect(() => validateAttributeKey(".tag")).toThrow(InvalidAttributeKeyError)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it("throws for invalid characters after the first", () => {
|
|
87
|
+
expect(() => validateAttributeKey("strAttr")).toThrow(InvalidAttributeKeyError)
|
|
88
|
+
expect(() => validateAttributeKey("has space")).toThrow(InvalidAttributeKeyError)
|
|
89
|
+
expect(() => validateAttributeKey("has:colon")).toThrow(InvalidAttributeKeyError)
|
|
90
|
+
expect(() => validateAttributeKey("héllo")).toThrow(InvalidAttributeKeyError)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it("throws for keys longer than 32 bytes", () => {
|
|
94
|
+
expect(() => validateAttributeKey("a".repeat(33))).toThrow(InvalidAttributeKeyError)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
it("names the offending character and position", () => {
|
|
98
|
+
expect(() => validateAttributeKey("strAttr")).toThrow(/"A" at position 3/)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it("is applied by validateAttribute", () => {
|
|
102
|
+
expect(() => validateAttribute({ key: "strAttr", value: "x" })).toThrow(
|
|
103
|
+
InvalidAttributeKeyError,
|
|
104
|
+
)
|
|
105
|
+
})
|
|
106
|
+
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Hex } from "viem"
|
|
2
|
+
import { isHex } from "viem"
|
|
3
|
+
import { BLOCK_TIME } from "../consts"
|
|
4
|
+
import { InvalidAttributeError, InvalidAttributeKeyError, InvalidExpirationError } from "../errors"
|
|
5
|
+
import type { Attribute } from "../types"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* True only for hex strings that are exactly 32 bytes (an entity key). This is
|
|
9
|
+
* the single rule deciding whether an attribute string value is stored as the
|
|
10
|
+
* on-chain `EntityKey` type or as a plain string — the query engine applies
|
|
11
|
+
* the same rule, so equality comparisons agree with storage on both paths.
|
|
12
|
+
* Hex-looking strings of any other length are treated as ordinary strings.
|
|
13
|
+
*/
|
|
14
|
+
export function isEntityKey(value: string): value is Hex {
|
|
15
|
+
return isHex(value) && value.length === 66
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Expiration on Arkiv is measured in blocks (1 block =
|
|
20
|
+
* 2 seconds), so the value must be a positive integer that is
|
|
21
|
+
* a multiple of the block time.
|
|
22
|
+
*
|
|
23
|
+
* @param expiresIn - The expiration in seconds.
|
|
24
|
+
* @throws {InvalidExpirationError} If the value is not a positive integer that
|
|
25
|
+
* is a multiple of the block time.
|
|
26
|
+
*/
|
|
27
|
+
export function validateExpiresIn(expiresIn: number): void {
|
|
28
|
+
if (!Number.isInteger(expiresIn) || expiresIn <= 0 || expiresIn % BLOCK_TIME !== 0) {
|
|
29
|
+
throw new InvalidExpirationError(expiresIn)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Validates an attribute key against the on-chain `Ident32` rules (mirrors
|
|
35
|
+
* `Ident32.sol` / `validate_ident32_bytes` in the node): non-empty, at most
|
|
36
|
+
* 32 bytes, leading character `a-z`, remaining characters `a-z 0-9 . - _`.
|
|
37
|
+
*
|
|
38
|
+
* @param key - The attribute key to validate.
|
|
39
|
+
* @throws {InvalidAttributeKeyError} If the key violates the `Ident32` rules.
|
|
40
|
+
*/
|
|
41
|
+
export function validateAttributeKey(key: string): void {
|
|
42
|
+
if (key.length === 0) {
|
|
43
|
+
throw new InvalidAttributeKeyError(key, "key is empty")
|
|
44
|
+
}
|
|
45
|
+
if (!/^[a-z]/.test(key)) {
|
|
46
|
+
throw new InvalidAttributeKeyError(key, `key starts with "${key[0]}"`)
|
|
47
|
+
}
|
|
48
|
+
const invalid = key.match(/[^a-z0-9._-]/)
|
|
49
|
+
if (invalid) {
|
|
50
|
+
throw new InvalidAttributeKeyError(
|
|
51
|
+
key,
|
|
52
|
+
`key contains "${invalid[0]}" at position ${invalid.index}`,
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
// The charset is ASCII-only, so string length equals byte length here.
|
|
56
|
+
if (key.length > 32) {
|
|
57
|
+
throw new InvalidAttributeKeyError(key, `key is ${key.length} bytes long`)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Validates a single attribute. Keys must follow the on-chain `Ident32` rules
|
|
63
|
+
* (see {@link validateAttributeKey}). Arkiv supports string and number
|
|
64
|
+
* attribute values, but numeric values must be non-negative integers — they
|
|
65
|
+
* are stored on-chain as unsigned 256-bit values.
|
|
66
|
+
*
|
|
67
|
+
* @param attribute - The attribute to validate.
|
|
68
|
+
* @throws {InvalidAttributeKeyError} If the key violates the `Ident32` rules.
|
|
69
|
+
* @throws {InvalidAttributeError} If the attribute has a non-integer or
|
|
70
|
+
* negative numeric value.
|
|
71
|
+
*/
|
|
72
|
+
export function validateAttribute(attribute: Attribute): void {
|
|
73
|
+
validateAttributeKey(attribute.key)
|
|
74
|
+
if (
|
|
75
|
+
typeof attribute.value === "number" &&
|
|
76
|
+
(!Number.isInteger(attribute.value) || attribute.value < 0)
|
|
77
|
+
) {
|
|
78
|
+
throw new InvalidAttributeError(attribute.key, attribute.value)
|
|
79
|
+
}
|
|
80
|
+
}
|
package/dist/accounts/index.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var viem_accounts = require("viem/accounts");
|
|
4
|
-
Object.keys(viem_accounts).forEach(function (k) {
|
|
5
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function () { return viem_accounts[k]; }
|
|
8
|
-
});
|
|
9
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "viem/accounts";
|
package/dist/accounts/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "viem/accounts";
|
package/dist/accounts/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "viem/accounts"
|
package/dist/payload-DKBYYjeA.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { toBytes } from "viem";
|
|
2
|
-
|
|
3
|
-
//#region src/consts.ts
|
|
4
|
-
const ARKIV_ADDRESS = "0x00000000000000000000000000000061726b6976";
|
|
5
|
-
const BLOCK_TIME = 2;
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/utils/payload.ts
|
|
9
|
-
function jsonToPayload(json) {
|
|
10
|
-
return toBytes(JSON.stringify(json));
|
|
11
|
-
}
|
|
12
|
-
function stringToPayload(data) {
|
|
13
|
-
return toBytes(data);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
export { BLOCK_TIME as i, stringToPayload as n, ARKIV_ADDRESS as r, jsonToPayload as t };
|
|
18
|
-
//# sourceMappingURL=payload-DKBYYjeA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payload-DKBYYjeA.js","names":[],"sources":["../src/consts.ts","../src/utils/payload.ts"],"sourcesContent":["export const ARKIV_ADDRESS = \"0x00000000000000000000000000000061726b6976\" as `0x${string}`\nexport const BLOCK_TIME = 2 // 2 seconds\n","import { toBytes } from \"viem\"\n\nexport function jsonToPayload(json: object): Uint8Array {\n return toBytes(JSON.stringify(json))\n}\n\nexport function stringToPayload(data: string): Uint8Array {\n return toBytes(data)\n}\n"],"mappings":";;;AAAA,MAAa,gBAAgB;AAC7B,MAAa,aAAa;;;;ACC1B,SAAgB,cAAc,MAA0B;AACtD,QAAO,QAAQ,KAAK,UAAU,KAAK,CAAC;;AAGtC,SAAgB,gBAAgB,MAA0B;AACxD,QAAO,QAAQ,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-BhdmAzYg.d.ts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.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/types/attributes.ts","../src/types/events.ts","../src/types/txParams.ts","../src/types/entity.ts","../src/actions/public/query.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;aAEF;EAJD,cAAS,EAKH,GALG;EACd,mBAAA,EAKgB,GALhB;EACQ,uBAAA,EAKY,GALZ;EAEF,2BAAA,EAIkB,GAJlB;EACK,KAAA,EAIT,GAJS;EACK,OAAA,EAIZ,GAJY;EACI,gBAAA,CAAA,EAAA,CAAA;IACI,GAAA,EAAA,MAAA;IACtB,KAAA,EAAA,MAAA;EACE,CAAA,CAAA;EAEkC,iBAAA,CAAA,EAAA,CAAA;IAAG,GAAA,EAAA,MAAA;IAGpC,KAAA,EAHiC,GAGjC;EAMA,CAAA,CAAA;CACA;AACI,KARJ,mBAAA,GAQI;EACJ,IAAA,EAAA,MAAA;EACO,IAAA,EAAA,QAAA,GAAA,SAAA;EAAG,IAAA,EAAA,OAAA;AAItB,CAAA;AAcY,KAtBA,eAAA,GAsBc;EAGsB,OAAA,CAAA,EAxBpC,GAwBoC;EAEpC,WAAA,CAAA,EAzBI,cAyBJ;EACO,OAAA,CAAA,EAzBP,mBAyBO,EAAA;EAAG,cAAA,CAAA,EAxBH,GAwBG;;;KApBV,cAAA;EC7BA,GAAA,CAAA,EAAA,OAAA;EACQ,UAAA,CAAA,EAAA,OAAA;EAAY,OAAA,CAAA,EAAA,O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A,SAAA,EAAA,UAAA,EYgBO,SZhBP,EAAA;EACE;;;AAKX;AAMA;;EAEgB,MAAA,CAAA,CAAA,EAAA,MAAA;EACJ;;;AAKZ;AAcA;;EAKY,MAAA,CAAA,CAAA,EAAA,GAAA;;;;Ka7CA,uBAAA;EdNA,UAAA,CAAQ,EAAA,OAAA;;;;ACGR,KaQA,mBAAA,GbRS;EACd,IAAA,EAAA,MAAA;EACQ,IAAA,EAAA,QAAA,GAAA,SAAA;EAEF,IAAA,EAAA,KAAA,GAAA,MAAA;CACK;AACK,KaQX,YAAA,GbRW;EACI,WAAA,CAAA,EaQX,uBbRW;EACI,OAAA,CAAA,EAAA,MAAA;EACtB,OAAA,CAAA,EaQG,mBbRH,EAAA;EACE,cAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAEkC,MAAA,CAAA,EAAA,MAAA,GAAA,SAAA;CAAG;AAGpC,KaOA,eAAA,GbPmB;EAMnB,QAAA,EaEA,MbFA,EAAe;EACf,MAAA,EAAA,MAAA,GAAA,SAAA;EACI,WAAA,EAAA,MAAA,GAAA,SAAA;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-CO6f35AE.d.cts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.ts","../src/actions/public/getBlockTiming.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/types/attributes.ts","../src/types/events.ts","../src/types/txParams.ts","../src/types/entity.ts","../src/actions/public/query.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;aAEF;EAJD,cAAS,EAKH,GALG;EACd,mBAAA,EAKgB,GALhB;EACQ,uBAAA,EAKY,GALZ;EAEF,2BAAA,EAIkB,GAJlB;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A,EAAe;EACf,MAAA,EAAA,MAAA,GAAA,SAAA;EACI,WAAA,EAAA,MAAA,GAAA,SAAA;CACJ"}
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
import { D as ArkivClient, a as Entity } from "./query-BhdmAzYg.js";
|
|
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 Input for orderBy method
|
|
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 Input for orderBy method
|
|
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 _createdBy;
|
|
167
|
-
private _orderBy;
|
|
168
|
-
private _validAtBlock;
|
|
169
|
-
private _withAttributes;
|
|
170
|
-
private _withMetadata;
|
|
171
|
-
private _withPayload;
|
|
172
|
-
private _limit;
|
|
173
|
-
private _cursor;
|
|
174
|
-
private _predicates;
|
|
175
|
-
constructor(client: ArkivClient);
|
|
176
|
-
/**
|
|
177
|
-
* Sets the ownedBy filter
|
|
178
|
-
* @param ownedBy - The address of the owner
|
|
179
|
-
* @returns The QueryBuilder instance
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* const builder = new QueryBuilder(client)
|
|
183
|
-
* builder.ownedBy("0x1234567890123456789012345678901234567890")
|
|
184
|
-
*/
|
|
185
|
-
ownedBy(ownedBy: Hex): this;
|
|
186
|
-
/**
|
|
187
|
-
* Sets the createdBy filter
|
|
188
|
-
* @param createdBy - The address of the creator
|
|
189
|
-
* @returns The QueryBuilder instance
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* const builder = new QueryBuilder(client)
|
|
193
|
-
* builder.createdBy("0x1234567890123456789012345678901234567890")
|
|
194
|
-
*/
|
|
195
|
-
createdBy(createdBy: Hex): this;
|
|
196
|
-
/**
|
|
197
|
-
* Sets the orderBy for the query.
|
|
198
|
-
* It can be called multiple times to order by multiple attributes.
|
|
199
|
-
* The order of the attributes is important. The first attribute is the primary order by attribute.
|
|
200
|
-
* You can use the helper functions asc() and desc() as input for this method.
|
|
201
|
-
* @param attributeName - The name of the attribute to order by
|
|
202
|
-
* @param attributeType - The type of the attribute to order by (string or number)
|
|
203
|
-
* @param order - The order to set the order by (asc or desc)
|
|
204
|
-
* @returns The QueryBuilder instance
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* const builder = client.buildQuery()
|
|
208
|
-
* builder.orderBy("name", "string", "desc")
|
|
209
|
-
* builder.orderBy(asc("name", "string"))
|
|
210
|
-
* builder.orderBy(desc("name", "string"))
|
|
211
|
-
*/
|
|
212
|
-
orderBy(attributeName: string, attributeType: "string" | "number", order?: "asc" | "desc"): this;
|
|
213
|
-
/**
|
|
214
|
-
* Sets the orderBy for the query.
|
|
215
|
-
* This method takes the OrderByAttribute object as an argument and is mainly
|
|
216
|
-
* used to use the helper functions asc() and desc() to create the OrderByAttribute instances.
|
|
217
|
-
* @param orderByAttribute - The OrderByAttribute instance to set
|
|
218
|
-
* @returns The QueryBuilder instance
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* const builder = new QueryBuilder(client)
|
|
222
|
-
* builder.orderBy(asc("name", "string"))
|
|
223
|
-
* builder.orderBy(desc("name", "string"))
|
|
224
|
-
*/
|
|
225
|
-
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
|
-
/**
|
|
257
|
-
* Sets the limit for the query
|
|
258
|
-
* @param limit - The number of entities to return
|
|
259
|
-
* @returns The QueryBuilder instance
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* const builder = new QueryBuilder(client)
|
|
263
|
-
* builder.limit(10)
|
|
264
|
-
*/
|
|
265
|
-
limit(limit: number): this;
|
|
266
|
-
/**
|
|
267
|
-
* 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
|
-
* @param cursor - The cursor to set which tells to RPC Query server where to start or continue the query.
|
|
269
|
-
* @returns The QueryBuilder instance
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* const builder = new QueryBuilder(client)
|
|
273
|
-
* builder.offset(10)
|
|
274
|
-
*/
|
|
275
|
-
cursor(cursor: string): this;
|
|
276
|
-
/**
|
|
277
|
-
* Sets the validAtBlock for the query which tells at which block height the state we are intested.
|
|
278
|
-
* If not set, the latest block is used.
|
|
279
|
-
* @param validAtBlock - The block number to set
|
|
280
|
-
* @returns The QueryBuilder instance
|
|
281
|
-
*
|
|
282
|
-
* @example
|
|
283
|
-
* const builder = new QueryBuilder(client)
|
|
284
|
-
* builder.validAtBlock(10000)
|
|
285
|
-
*/
|
|
286
|
-
validAtBlock(validAtBlock: bigint): this;
|
|
287
|
-
/**
|
|
288
|
-
* Sets the predicates for the query limiting the results. It can be a single predicate or an array of predicates combined with 'and'.
|
|
289
|
-
* Predicates can be nested using 'or' and 'and' predicates.
|
|
290
|
-
* @param predicates - The predicates to set
|
|
291
|
-
* @returns The QueryBuilder instance
|
|
292
|
-
*
|
|
293
|
-
* @example
|
|
294
|
-
* const builder = new QueryBuilder(client)
|
|
295
|
-
* builder.where(eq("name", "John"))
|
|
296
|
-
* builder.where([eq("name", "John"), eq("age", 30)])
|
|
297
|
-
* builder.where([eq("name", "John"), or([eq("age", 30), eq("age", 31)])])
|
|
298
|
-
* builder.where([eq("name", "John"), and([eq("age", 30), eq("age", 31)])])
|
|
299
|
-
* builder.where([eq("name", "John"), or([eq("age", 30), and([eq("age", 31), eq("age", 32)])])])
|
|
300
|
-
* builder.where([eq("name", "John"), and([eq("age", 30), or([eq("age", 31), eq("age", 32)])])])
|
|
301
|
-
* builder.where([eq("name", "John"), and([eq("age", 30), or([eq("age", 31), and([eq("age", 32), eq("age", 33)])])])])
|
|
302
|
-
*/
|
|
303
|
-
where(predicates: Predicate[] | Predicate): this;
|
|
304
|
-
/**
|
|
305
|
-
* Fetches the entities from the query. Re
|
|
306
|
-
* It will return a QueryResult instance which can be used to fetch the next and previous pages.
|
|
307
|
-
* @returns The QueryResult instance {@link QueryResult}
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* const builder = new QueryBuilder(client)
|
|
311
|
-
* const result = await builder.where(eq("name", "John")).fetch()
|
|
312
|
-
* // result = { entities: [Entity, Entity, Entity], next: async () => QueryResult, previous: async () => QueryResult }
|
|
313
|
-
*/
|
|
314
|
-
fetch(): Promise<QueryResult>;
|
|
315
|
-
/**
|
|
316
|
-
* Counts the entities from the query.
|
|
317
|
-
* @returns The number of entities
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* const builder = new QueryBuilder(client)
|
|
321
|
-
* const result = await builder.where(eq("name", "John")).count()
|
|
322
|
-
* // result = 10
|
|
323
|
-
*/
|
|
324
|
-
count(): Promise<number>;
|
|
325
|
-
}
|
|
326
|
-
//#endregion
|
|
327
|
-
export { or as _, QueryResult as a, PredicateType as c, gt as d, gte as f, not as g, neq as h, desc as i, and as l, lte as m, QueryBuilder as n, Predicate as o, lt as p, asc as r, PredicateContainerType as s, OrderByAttribute as t, eq as u };
|
|
328
|
-
//# sourceMappingURL=queryBuilder-BvoQXa_u.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryBuilder-BvoQXa_u.d.ts","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;;;;;;;;;;ACCY,iBFgCI,GAAA,CEhCY,UAAA,EFgCI,SEhCJ,EAAA,CAAA,EFgCkB,SEhClB;AAe5B;AAiBA;AAaA;;;;;;;;AAqOa,iBFpOG,EAAA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