@arkiv-network/sdk 0.8.1-dev.1 → 0.9.0-next.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 (184) hide show
  1. package/README.md +180 -61
  2. package/dist/chains/index.d.ts +17 -17
  3. package/dist/changeOwnership-Cy9gfyjN.d.cts +1160 -0
  4. package/dist/changeOwnership-Cy9gfyjN.d.cts.map +1 -0
  5. package/dist/changeOwnership-gXf-lBqI.d.ts +1160 -0
  6. package/dist/changeOwnership-gXf-lBqI.d.ts.map +1 -0
  7. package/dist/entity/index.cjs +4 -10
  8. package/dist/entity/index.d.cts +3 -3
  9. package/dist/entity/index.d.ts +3 -3
  10. package/dist/entity/index.js +3 -4
  11. package/dist/entity-BM1unrQf.cjs +41 -0
  12. package/dist/{entity-DJ0Gml9c.cjs → entity-BgaFJSaV.cjs} +4 -4
  13. package/dist/entity-CFAI1KyG.js +36 -0
  14. package/dist/entity-CFAI1KyG.js.map +1 -0
  15. package/dist/{entity-CniBgBSd.js → entity-CGqx_AU0.js} +4 -4
  16. package/dist/entity-CGqx_AU0.js.map +1 -0
  17. package/dist/{payload-AfUfSctb.d.ts → expirationTime-C7PZK49K.d.ts} +8 -37
  18. package/dist/expirationTime-C7PZK49K.d.ts.map +1 -0
  19. package/dist/expirationTime-CkIGNAg8.cjs +140 -0
  20. package/dist/{payload-D167BlJR.d.cts → expirationTime-DOB8V4B8.d.cts} +8 -37
  21. package/dist/expirationTime-DOB8V4B8.d.cts.map +1 -0
  22. package/dist/{expiry-Cgdb_dbq.js → expirationTime-UKPuA-LM.js} +62 -27
  23. package/dist/expirationTime-UKPuA-LM.js.map +1 -0
  24. package/dist/expiry-B48I-yTA.d.cts +40 -0
  25. package/dist/expiry-B48I-yTA.d.cts.map +1 -0
  26. package/dist/expiry-S2PUL8Hg.d.ts +40 -0
  27. package/dist/expiry-S2PUL8Hg.d.ts.map +1 -0
  28. package/dist/index-C-mMF5WZ.d.cts +735 -0
  29. package/dist/index-C-mMF5WZ.d.cts.map +1 -0
  30. package/dist/{index-BkqSnGJH.d.ts → index-C4zZqJ9S.d.ts} +5 -27
  31. package/dist/index-C4zZqJ9S.d.ts.map +1 -0
  32. package/dist/{index-CLhsFyVH.d.cts → index-CcVWYB6v.d.cts} +5 -27
  33. package/dist/index-CcVWYB6v.d.cts.map +1 -0
  34. package/dist/index-DCx2XC6S.d.ts +489 -0
  35. package/dist/index-DCx2XC6S.d.ts.map +1 -0
  36. package/dist/index-DLb7BfIw.d.ts +735 -0
  37. package/dist/index-DLb7BfIw.d.ts.map +1 -0
  38. package/dist/index-DzriOUm8.d.cts +489 -0
  39. package/dist/index-DzriOUm8.d.cts.map +1 -0
  40. package/dist/index.cjs +162 -146
  41. package/dist/index.d.cts +180 -133
  42. package/dist/index.d.cts.map +1 -1
  43. package/dist/index.d.ts +180 -133
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +93 -83
  46. package/dist/index.js.map +1 -1
  47. package/dist/params-BuIrJA9a.cjs +45 -0
  48. package/dist/params-DDJOnsNi.js +22 -0
  49. package/dist/params-DDJOnsNi.js.map +1 -0
  50. package/dist/query/index.cjs +9 -4
  51. package/dist/query/index.d.cts +6 -6
  52. package/dist/query/index.d.ts +6 -6
  53. package/dist/query/index.js +4 -5
  54. package/dist/query-D0KtuFh2.cjs +1625 -0
  55. package/dist/query-DpRDozmj.js +1417 -0
  56. package/dist/query-DpRDozmj.js.map +1 -0
  57. package/dist/schema/index.cjs +46 -0
  58. package/dist/schema/index.d.cts +2 -0
  59. package/dist/schema/index.d.ts +2 -0
  60. package/dist/schema/index.js +3 -0
  61. package/dist/{attr-BXTkpnoc.cjs → schema-B9AyXcgU.cjs} +513 -246
  62. package/dist/{attr-tmyREHtw.js → schema-DY4sqehl.js} +427 -244
  63. package/dist/schema-DY4sqehl.js.map +1 -0
  64. package/dist/types/index.cjs +1 -1
  65. package/dist/types/index.d.cts +5 -5
  66. package/dist/types/index.d.ts +5 -5
  67. package/dist/types/index.js +1 -1
  68. package/dist/utils/index.cjs +3 -5
  69. package/dist/utils/index.d.cts +3 -3
  70. package/dist/utils/index.d.ts +3 -3
  71. package/dist/utils/index.js +3 -3
  72. package/package.json +9 -12
  73. package/src/actions/public/getEntity.test.ts +69 -0
  74. package/src/actions/public/getEntity.ts +34 -20
  75. package/src/actions/public/predictEntityKeys.ts +8 -7
  76. package/src/actions/public/query.test.ts +58 -0
  77. package/src/actions/public/query.ts +41 -13
  78. package/src/actions/wallet/createEntity.ts +34 -63
  79. package/src/actions/wallet/executeBatch.test.ts +38 -0
  80. package/src/actions/wallet/executeBatch.ts +26 -9
  81. package/src/actions/wallet/extendEntity.ts +9 -8
  82. package/src/actions/wallet/patchEntity.ts +43 -52
  83. package/src/clients/createPublicClient.test.ts +10 -2
  84. package/src/clients/createWalletClient.ts +4 -1
  85. package/src/clients/decorators/arkivPublic.ts +123 -80
  86. package/src/clients/decorators/arkivWallet.ts +113 -65
  87. package/src/entity/create.test.ts +25 -21
  88. package/src/entity/expiry.ts +8 -6
  89. package/src/entity/flags.ts +1 -1
  90. package/src/entity/index.ts +2 -4
  91. package/src/entity/key.ts +3 -3
  92. package/src/entity/operations.ts +1 -1
  93. package/src/errors.ts +2 -11
  94. package/src/index.ts +18 -6
  95. package/src/query/builderBase.ts +166 -0
  96. package/src/query/countBuilder.test.ts +91 -0
  97. package/src/query/countBuilder.ts +67 -0
  98. package/src/query/engine.ts +9 -3
  99. package/src/query/errors.ts +24 -14
  100. package/src/query/expression.test.ts +129 -21
  101. package/src/query/expression.ts +323 -94
  102. package/src/query/index.ts +26 -4
  103. package/src/query/injection.test.ts +5 -11
  104. package/src/query/queryBuilder.test.ts +467 -58
  105. package/src/query/queryBuilder.ts +191 -98
  106. package/src/query/queryResult.ts +35 -9
  107. package/src/query/selection.test.ts +278 -24
  108. package/src/query/selection.ts +427 -86
  109. package/src/schema/attributes.test.ts +266 -0
  110. package/src/schema/attributes.ts +212 -0
  111. package/src/{attr → schema}/codec.test.ts +37 -5
  112. package/src/{attr → schema}/codec.ts +40 -11
  113. package/src/schema/column.ts +193 -0
  114. package/src/{attr → schema}/errors.ts +67 -10
  115. package/src/schema/index.ts +76 -0
  116. package/src/{attr → schema}/names.ts +4 -2
  117. package/src/schema/schema.test.ts +171 -0
  118. package/src/schema/schema.ts +250 -0
  119. package/src/{attr → schema}/types.ts +36 -30
  120. package/src/{attr → schema}/values.test.ts +62 -3
  121. package/src/{attr → schema}/values.ts +246 -65
  122. package/src/types/entity.test.ts +1 -44
  123. package/src/types/entity.ts +9 -55
  124. package/src/types/events.ts +1 -1
  125. package/src/types/index.ts +11 -4
  126. package/src/types/rpcSchema.ts +22 -16
  127. package/src/utils/arkivTransactions.test.ts +356 -116
  128. package/src/utils/arkivTransactions.ts +30 -38
  129. package/src/utils/entities.ts +10 -9
  130. package/src/utils/expirationTime.ts +5 -5
  131. package/src/utils/index.ts +0 -1
  132. package/src/utils/logger.test.ts +45 -0
  133. package/src/utils/logger.ts +5 -39
  134. package/src/utils/revert.test.ts +25 -0
  135. package/src/utils/revert.ts +28 -3
  136. package/dist/attr/index.cjs +0 -34
  137. package/dist/attr/index.d.cts +0 -2
  138. package/dist/attr/index.d.ts +0 -2
  139. package/dist/attr/index.js +0 -3
  140. package/dist/attr-tmyREHtw.js.map +0 -1
  141. package/dist/entity-B0t6sN7F.cjs +0 -71
  142. package/dist/entity-BIp_df9u.js +0 -67
  143. package/dist/entity-BIp_df9u.js.map +0 -1
  144. package/dist/entity-CniBgBSd.js.map +0 -1
  145. package/dist/expiry-BxOlvVWC.d.ts +0 -79
  146. package/dist/expiry-BxOlvVWC.d.ts.map +0 -1
  147. package/dist/expiry-CG9GhVXv.cjs +0 -135
  148. package/dist/expiry-Cgdb_dbq.js.map +0 -1
  149. package/dist/expiry-DRV29F1r.d.cts +0 -79
  150. package/dist/expiry-DRV29F1r.d.cts.map +0 -1
  151. package/dist/flags-DCD26uhe.cjs +0 -43
  152. package/dist/flags-DUT2gHEU.js +0 -33
  153. package/dist/flags-DUT2gHEU.js.map +0 -1
  154. package/dist/index-BkqSnGJH.d.ts.map +0 -1
  155. package/dist/index-C7fbakoI.d.cts +0 -278
  156. package/dist/index-C7fbakoI.d.cts.map +0 -1
  157. package/dist/index-CIcHPx2j.d.cts +0 -424
  158. package/dist/index-CIcHPx2j.d.cts.map +0 -1
  159. package/dist/index-CLhsFyVH.d.cts.map +0 -1
  160. package/dist/index-Cd2aaWme.d.ts +0 -424
  161. package/dist/index-Cd2aaWme.d.ts.map +0 -1
  162. package/dist/index-Cq6fa8AI.d.ts +0 -278
  163. package/dist/index-Cq6fa8AI.d.ts.map +0 -1
  164. package/dist/index-DaNeJUw8.d.ts +0 -955
  165. package/dist/index-DaNeJUw8.d.ts.map +0 -1
  166. package/dist/index-Dv16LO2s.d.cts +0 -955
  167. package/dist/index-Dv16LO2s.d.cts.map +0 -1
  168. package/dist/payload-AfUfSctb.d.ts.map +0 -1
  169. package/dist/payload-D167BlJR.d.cts.map +0 -1
  170. package/dist/payload-DE7wMztL.js +0 -92
  171. package/dist/payload-DE7wMztL.js.map +0 -1
  172. package/dist/payload-DqFweqiO.cjs +0 -108
  173. package/dist/query-9oojUdM7.cjs +0 -1128
  174. package/dist/query-Ber-lOJQ.js +0 -968
  175. package/dist/query-Ber-lOJQ.js.map +0 -1
  176. package/src/actions/public/getEntityCount.ts +0 -10
  177. package/src/attr/attributes.test.ts +0 -120
  178. package/src/attr/attributes.ts +0 -196
  179. package/src/attr/index.ts +0 -50
  180. package/src/types/mimeTypes.ts +0 -27
  181. package/src/utils/compression.test.ts +0 -32
  182. package/src/utils/compression.ts +0 -102
  183. package/src/utils/payload.ts +0 -36
  184. /package/src/{attr → schema}/decimal.ts +0 -0
@@ -0,0 +1,735 @@
1
+ import { Address, Hex } from "viem";
2
+
3
+ //#region src/schema/types.d.ts
4
+
5
+ /**
6
+ * The protocol's attribute type vocabulary, mapping each short **tag** (the name used by the
7
+ * client, the query language and this SDK) to its **typeId** (the byte carried on the wire and in
8
+ * the entity record).
9
+ *
10
+ * The typeIds are consensus-critical: they are written into entity records and mixed into index
11
+ * keys, so this table must never drift from the node's `AttributeType`.
12
+ *
13
+ * | tag | typeId | ABI wire type | when indexed |
14
+ * | --------- | ------ | -------------------- | ----------------- |
15
+ * | `bool` | 1 | `bool` | equality |
16
+ * | `i32` | 2 | `int32` | equality + range |
17
+ * | `u64` | 3 | `uint64` | equality + range |
18
+ * | `u256` | 4 | `uint256` | equality + range |
19
+ * | `dec` | 5 | `int256` (18 dp) | equality + range |
20
+ * | `bytes32` | 6 | `bytes32` | equality |
21
+ * | `bytes` | 7 | `bytes` (<= 128 KiB) | never indexed |
22
+ * | `str` | 8 | `string` (<= 128 B) | equality + prefix |
23
+ * | `addr` | 9 | `address` | equality |
24
+ * | `key` | 10 | `bytes32` | equality |
25
+ *
26
+ * On the wire the typeId shares its byte with the indexed flag — see {@link INDEXED_FLAG}.
27
+ */
28
+ declare const TYPE_IDS: {
29
+ readonly bool: 1;
30
+ readonly i32: 2;
31
+ readonly u64: 3;
32
+ readonly u256: 4;
33
+ readonly dec: 5;
34
+ readonly bytes32: 6;
35
+ readonly bytes: 7;
36
+ readonly str: 8;
37
+ readonly addr: 9;
38
+ readonly key: 10;
39
+ };
40
+ /**
41
+ * Bit 7 of the `typeId` byte: set when the node should index the attribute. The low seven bits are
42
+ * the type itself, so `str` travels as `8` unindexed and `0x88` indexed.
43
+ */
44
+ declare const INDEXED_FLAG = 128;
45
+ /** Every type tag. */
46
+ type TypeTag = keyof typeof TYPE_IDS;
47
+ /**
48
+ * The tags an attribute may be indexed with — every type except `bytes`, which is stored but never
49
+ * indexed, and so can never be filtered on.
50
+ */
51
+ type IndexableTypeTag = Exclude<TypeTag, "bytes">;
52
+ /**
53
+ * Marks a value as having passed its constructor's validation. The symbol is module-private, so a
54
+ * hand-written object literal is not assignable to {@link ArkivValue} — every value crossing the
55
+ * wire has been range-, length- and format-checked by `i32`, `u256`, `dec`, and friends.
56
+ */
57
+ declare const validated: unique symbol;
58
+ /**
59
+ * A typed attribute value: the tag it was created with, plus the JavaScript representation of that
60
+ * type. Constructed only by the tagged constructors in `@arkiv-network/sdk/schema`.
61
+ *
62
+ * @typeParam tag - The type tag, which also discriminates the {@link ArkivValue} union.
63
+ * @typeParam value - The decoded JavaScript representation.
64
+ */
65
+ type Value<tag$1 extends TypeTag, value> = {
66
+ readonly type: tag$1;
67
+ readonly value: value;
68
+ readonly [validated]: tag$1;
69
+ };
70
+ /** A boolean. */
71
+ type BoolValue = Value<"bool", boolean>;
72
+ /** A 32-bit signed integer — the default for an untagged number. */
73
+ type I32Value = Value<"i32", number>;
74
+ /**
75
+ * A 64-bit unsigned integer — block heights, the
76
+ * entity-nonce and `$expiresAt` are all `u64` */
77
+ type U64Value = Value<"u64", bigint>;
78
+ /** A 256-bit unsigned integer. */
79
+ type U256Value = Value<"u256", bigint>;
80
+ /**
81
+ * A fixed-point decimal with 18 decimal places, held as its canonical decimal string (`"3.5"`).
82
+ * Use {@link decUnits} for the exact scaled integer when you need to do arithmetic.
83
+ */
84
+ type DecValue = Value<"dec", string>;
85
+ /** 32 opaque bytes, as lowercase `0x` hex. */
86
+ type Bytes32Value = Value<"bytes32", Hex>;
87
+ /** A UTF-8 string of at most 128 bytes, free of C0 control characters and DEL. */
88
+ type StrValue = Value<"str", string>;
89
+ /** A 20-byte Ethereum address, as EIP-55 checksummed hex. */
90
+ type AddrValue = Value<"addr", Address>;
91
+ /** A reference to another entity. Weak by spec: dangling references are permitted. */
92
+ type KeyValue = Value<"key", Hex>;
93
+ /**
94
+ * Opaque variable-length bytes, as lowercase `0x` hex — a blob. Stored but never indexed, so it can
95
+ * be selected but not filtered on.
96
+ */
97
+ type BytesValue = Value<"bytes", Hex>;
98
+ /** Any attribute value. */
99
+ type ArkivValue = BoolValue | I32Value | U64Value | U256Value | DecValue | Bytes32Value | BytesValue | StrValue | AddrValue | KeyValue;
100
+ /** Any value of a type that can be indexed, and so can appear in a query — everything but `bytes`. */
101
+ type IndexableValue = Exclude<ArkivValue, BytesValue>;
102
+ /** The value type for a given tag — e.g. `ValueOf<"u256">` is {@link U256Value}. */
103
+ type ValueOf<tag$1 extends TypeTag> = Extract<ArkivValue, {
104
+ type: tag$1;
105
+ }>;
106
+ /**
107
+ * Whether `input` has the *shape* of an {@link ArkivValue} — a known type tag and a value.
108
+ */
109
+ declare function isArkivValue(input: unknown): input is ArkivValue;
110
+ //#endregion
111
+ //#region src/schema/column.d.ts
112
+ /**
113
+ * What each type's constructor accepts as a value — `dec("4.1")`, `addr("0x…")`, `bytes(buf)`.
114
+ * A column's `.default(...)` takes the same thing, or an already-typed value.
115
+ */
116
+ type ValueArgument<T extends TypeTag> = {
117
+ bool: boolean;
118
+ i32: number | bigint;
119
+ u64: bigint | number | string;
120
+ u256: bigint | number | string;
121
+ dec: string | number | bigint;
122
+ bytes32: Hex | Uint8Array;
123
+ bytes: Hex | Uint8Array;
124
+ str: string;
125
+ addr: string;
126
+ key: Hex | Uint8Array;
127
+ }[T];
128
+ /**
129
+ * A column: the declaration of one attribute in a schema — its type, whether the node indexes it,
130
+ * whether an entity may leave it unset, and the value the SDK writes when a create leaves it out.
131
+ *
132
+ * Built by calling a type constructor with no arguments — `str()`, `dec()`, `bytes()` — and refined
133
+ * by chaining. Every refinement returns a new column; a column is never modified in place.
134
+ *
135
+ * @typeParam T - The attribute's type tag.
136
+ * @typeParam I - Whether the attribute is indexed.
137
+ * @typeParam O - Whether the attribute may be absent.
138
+ * @typeParam D - Whether the column has a default.
139
+ *
140
+ * @example
141
+ * str() // stored, not indexed, required
142
+ * str().indexed() // filterable with eq / ne / startsWith
143
+ * dec().indexed().optional() // filterable, and an entity may leave it unset
144
+ * str().default("text/markdown") // filled in on create when left out
145
+ * bytes() // a blob; bytes has no .indexed()
146
+ */
147
+ type Column<T extends TypeTag = TypeTag, I extends boolean = boolean, O extends boolean = boolean, D extends boolean = boolean> = ColumnProperties<T, I, O, D> & (T extends IndexableTypeTag ? IndexableColumn<T, O, D> : unknown);
148
+ /**
149
+ * Any column, whatever its type and flags — the shape a schema is built from. Written out rather
150
+ * than derived from {@link Column}, whose refinement methods would make every column's type
151
+ * invariant in its tag.
152
+ */
153
+ type AnyColumn = {
154
+ readonly type: TypeTag;
155
+ readonly isIndexed: boolean;
156
+ readonly isOptional: boolean;
157
+ readonly defaultValue: ArkivValue | undefined;
158
+ };
159
+ type ColumnProperties<T extends TypeTag, I extends boolean, O extends boolean, D extends boolean> = {
160
+ /** The attribute's type tag. */
161
+ readonly type: T;
162
+ /** Whether the node indexes the attribute, which is what makes it usable in `where`. */
163
+ readonly isIndexed: I;
164
+ /**
165
+ * Whether an entity may leave the attribute unset. A create may then omit it, a patch may unset
166
+ * it, and a read gives back `undefined` where it is missing.
167
+ */
168
+ readonly isOptional: O;
169
+ /** The value a create writes when the attribute is left out, if the column has one. */
170
+ readonly defaultValue: D extends true ? ValueOf<T> : undefined;
171
+ /** The same column, allowed to be absent. */
172
+ optional(): Column<T, I, true, D>;
173
+ /**
174
+ * The same column, with a value that a create writes whenever the attribute is left out. The
175
+ * default is applied by the SDK, not the node, and only on create.
176
+ *
177
+ * @param value - What the type's constructor would accept — `dec().default("4.1")` — or a value
178
+ * of the column's type.
179
+ * @throws {InvalidValueError} If the value does not fit the column's type.
180
+ */
181
+ default(value: ValueArgument<T> | ValueOf<T>): Column<T, I, O, true>;
182
+ };
183
+ type IndexableColumn<T extends IndexableTypeTag, O extends boolean, D extends boolean> = {
184
+ /**
185
+ * The same column, indexed by the node. Only indexed attributes can be filtered on in `where`;
186
+ * an unindexed one can be stored and selected, and does not pay for an index.
187
+ */
188
+ indexed(): Column<T, true, O, D>;
189
+ };
190
+ /** Resolves the input to `.default(...)` into a value of the column's type. */
191
+
192
+ /** Whether `input` is a column, as opposed to a value or anything else. */
193
+ declare function isColumn(input: unknown): input is AnyColumn;
194
+ //#endregion
195
+ //#region src/schema/values.d.ts
196
+ /** The widest `i32`. */
197
+ declare const I32_MAX = 2147483647;
198
+ /** The narrowest `i32`. */
199
+ declare const I32_MIN = -2147483648;
200
+ /** The widest `u64`. */
201
+ declare const U64_MAX: bigint;
202
+ /** The widest `u256`. */
203
+ declare const U256_MAX: bigint;
204
+ /**
205
+ * The longest `str`, in UTF-8 bytes
206
+ */
207
+ declare const MAX_STRING_BYTES = 128;
208
+ /**
209
+ * The longest `bytes` value, in bytes. The cap applies to each `bytes` attribute separately, but
210
+ * all the `bytes` values of one create or patch also share the `MAX_ENTITY_BYTES` budget.
211
+ */
212
+ declare const MAX_BYTES_LENGTH: number;
213
+ /** A `bool` column, indexed for equality once `.indexed()`. */
214
+ declare function bool(): Column<"bool", false, false, false>;
215
+ /**
216
+ * A boolean.
217
+ *
218
+ * This is the default type for a bare boolean, so `{ flagged: true }` and
219
+ * `{ flagged: bool(true) }` are the same value.
220
+ *
221
+ * @example
222
+ * bool(true) // { type: "bool", value: true }
223
+ */
224
+ declare function bool(value: boolean): BoolValue;
225
+ /** An `i32` column, indexed for equality and range queries once `.indexed()`. */
226
+ declare function i32(): Column<"i32", false, false, false>;
227
+ /**
228
+ * A 32-bit signed integer. This is the default type for a bare number, so `{ level: 10 }` and
229
+ * `{ level: i32(10) }` are the same value.
230
+ *
231
+ * @param value - An integer in [-2147483648, 2147483647].
232
+ * @throws {InvalidValueError} If the value is not an integer, or does not fit an `i32`.
233
+ *
234
+ * @example
235
+ * i32(10) // { type: "i32", value: 10 }
236
+ * i32(-42) // negative values are fine — i32 is the signed integer
237
+ */
238
+ declare function i32(value: number | bigint): I32Value;
239
+ /** A `u256` column, indexed for equality and range queries once `.indexed()`. */
240
+ declare function u256(): Column<"u256", false, false, false>;
241
+ /**
242
+ * A 256-bit unsigned integer. The type for token amounts and anything else that can outgrow 2⁶⁴ —
243
+ * reach for {@link u64} first for counters, timestamps and block heights.
244
+ *
245
+ * @param value - A non-negative integer, as a `bigint`, a safe `number`, or a decimal or `0x` hex
246
+ * string.
247
+ * @throws {InvalidValueError} If the value is negative, non-integral, or wider than 256 bits.
248
+ *
249
+ * @example
250
+ * u256(1_000_000n)
251
+ * u256(Date.now()) // safe integers are accepted
252
+ * u256("0xf4240") // hex, as it comes back over JSON-RPC
253
+ */
254
+ declare function u256(value: bigint | number | string): U256Value;
255
+ /** A `u64` column, indexed for equality and range queries once `.indexed()`. */
256
+ declare function u64(): Column<"u64", false, false, false>;
257
+ /**
258
+ * A 64-bit unsigned integer.
259
+ *
260
+ * This is the width the protocol counts in: block heights, `$expiresAt` and the entity-nonce are
261
+ * all `u64`, so it is the type to reach for when a value has to line up with one of them. Use
262
+ * {@link u256} for token amounts and anything else that can exceed 2⁶⁴.
263
+ *
264
+ * @param value - A non-negative integer, as a `bigint`, a safe `number`, or a decimal or `0x` hex
265
+ * string.
266
+ * @throws {InvalidValueError} If the value is negative, non-integral, or wider than 64 bits.
267
+ *
268
+ * @example
269
+ * u64(1_200_000n) // a block height
270
+ * u64(Date.now()) // safe integers are accepted
271
+ * u64("0x124f80") // hex, as it comes back over JSON-RPC
272
+ */
273
+ declare function u64(value: bigint | number | string): U64Value;
274
+ /** A `dec` column, indexed for equality and range queries once `.indexed()`. */
275
+ declare function dec(): Column<"dec", false, false, false>;
276
+ /**
277
+ * A signed fixed-point decimal with exactly 18 decimal places.
278
+ *
279
+ * Pass fractional values as **strings**. A JavaScript number cannot represent most decimals
280
+ * exactly, so accepting `dec(0.1 + 0.2)` would quietly store `0.30000000000000004`; requiring the
281
+ * string keeps what you write and what is stored the same thing. Excess precision is likewise an
282
+ * error rather than a rounding.
283
+ *
284
+ * @param value - A decimal string, or an integral `number` / `bigint`.
285
+ * @throws {InvalidValueError} If the value is malformed, has more than 18 fractional digits, or
286
+ * falls outside the `int256` range.
287
+ *
288
+ * @example
289
+ * dec("3.5")
290
+ * dec("-0.000000000000000001") // the smallest step
291
+ * dec(5) // integers may be passed as a number
292
+ */
293
+ declare function dec(value: string | number | bigint): DecValue;
294
+ /**
295
+ * The exact scaled integer behind a `dec` — the value multiplied by 10 ** 18, which is what the
296
+ * protocol stores and compares. Use it when you need exact arithmetic; JavaScript has no native
297
+ * decimal type, so the SDK carries the canonical string and leaves the maths to you.
298
+ *
299
+ * @example
300
+ * decUnits(dec("3.5")) // 3500000000000000000n
301
+ */
302
+ declare function decUnits(value: DecValue): bigint;
303
+ /**
304
+ * A `dec` built from its scaled integer units — the inverse of {@link decUnits}.
305
+ *
306
+ * @example
307
+ * decFromUnits(3_500_000_000_000_000_000n) // dec("3.5")
308
+ */
309
+ declare function decFromUnits(units: bigint): DecValue;
310
+ /** A `str` column, indexed for equality and prefix (`STARTSWITH`) matching once `.indexed()`. */
311
+ declare function str(): Column<"str", false, false, false>;
312
+ /**
313
+ * A UTF-8 string of at most 128 bytes.
314
+ *
315
+ * The limit is on **bytes**, not characters: a string of 128 emoji does not fit.
316
+ *
317
+ * C0 control characters and DEL are rejected: the query language writes a `str` as `str('...')`,
318
+ * whose only escape is a doubled quote, so a control character could be stored but never queried.
319
+ *
320
+ * @throws {InvalidValueError} If the value is not a string, holds a control character, or exceeds
321
+ * 128 UTF-8 bytes.
322
+ *
323
+ * @example
324
+ * str("Bob")
325
+ */
326
+ declare function str(value: string): StrValue;
327
+ /** An `addr` column, indexed for equality once `.indexed()`. */
328
+ declare function addr(): Column<"addr", false, false, false>;
329
+ /**
330
+ * A 20-byte Ethereum address.
331
+ *
332
+ * All-lowercase and all-uppercase input carries no checksum and is accepted as-is; mixed-case
333
+ * input is checked against its EIP-55 checksum, so a mistyped address is caught here rather than
334
+ * being written to a wrong account. The stored value is always EIP-55 checksummed.
335
+ *
336
+ * @throws {InvalidValueError} If the value is not 20 hex bytes, or fails its EIP-55 checksum.
337
+ *
338
+ * @example
339
+ * addr("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")
340
+ */
341
+ declare function addr(value: string): AddrValue;
342
+ /** A `key` column — a reference to another entity — indexed for equality once `.indexed()`. */
343
+ declare function key(): Column<"key", false, false, false>;
344
+ /**
345
+ * A reference to another entity.
346
+ *
347
+ * References are **weak**: nothing checks that the target exists when you write it, and a
348
+ * reference to a deleted or expired entity is allowed to dangle.
349
+ *
350
+ * @param value - A 32-byte entity key, as `0x` hex or raw bytes.
351
+ * @throws {InvalidValueError} If the value is not exactly 32 bytes.
352
+ *
353
+ * @example
354
+ * key(parentEntityKey)
355
+ */
356
+ declare function key(value: Hex | Uint8Array): KeyValue;
357
+ /** A `bytes32` column, indexed for equality once `.indexed()`. */
358
+ declare function bytes32(): Column<"bytes32", false, false, false>;
359
+ /**
360
+ * 32 opaque bytes — a hash, a digest, an identifier from another system.
361
+ *
362
+ * Use {@link key} instead when the bytes are an Arkiv entity key: same wire width, but the
363
+ * distinct type makes the reference visible to readers and to the query language.
364
+ *
365
+ * @param value - 32 bytes, as `0x` hex or raw bytes.
366
+ * @throws {InvalidValueError} If the value is not exactly 32 bytes.
367
+ *
368
+ * @example
369
+ * bytes32(keccak256(toBytes("hello")))
370
+ */
371
+ declare function bytes32(value: Hex | Uint8Array): Bytes32Value;
372
+ /**
373
+ * A `bytes` column — a blob. Bytes are stored but never indexed, so a bytes column has no
374
+ * `.indexed()`: it can be selected, not filtered on. A schema may have several, within the
375
+ * `MAX_ATTRIBUTES` cap on columns — but the `bytes` values of one create or patch share a single
376
+ * `MAX_ENTITY_BYTES` budget.
377
+ */
378
+ declare function bytes(): Column<"bytes", false, false, false>;
379
+ /**
380
+ * Opaque bytes of any length up to 128 KiB — a document, an image, a serialized object. This is the
381
+ * default type for a bare `Uint8Array`, so `{ body: buf }` and `{ body: bytes(buf) }` are the same
382
+ * value.
383
+ *
384
+ * @param value - The bytes, raw or as `0x` hex. Hex is taken as the bytes it spells, never as text.
385
+ * @throws {InvalidValueError} If the value is not bytes or hex, or exceeds 128 KiB.
386
+ *
387
+ * @example
388
+ * bytes(new TextEncoder().encode("# Hello"))
389
+ * bytes("0xdeadbeef")
390
+ */
391
+ declare function bytes(value: Hex | Uint8Array): BytesValue;
392
+ /**
393
+ * A JavaScript value accepted wherever a typed value is expected: either a tagged value, or one of
394
+ * the five bare forms that map unambiguously onto a single type.
395
+ *
396
+ * | bare form | type |
397
+ * | ------------ | ------- |
398
+ * | `boolean` | `bool` |
399
+ * | `number` | `i32` |
400
+ * | `bigint` | `u256` |
401
+ * | `string` | `str` |
402
+ * | `Uint8Array` | `bytes` |
403
+ *
404
+ * Anything else — a large number, a decimal, an address, an entity key — must name its type, which
405
+ * is what keeps `"0x1234..."` a string rather than silently becoming a key.
406
+ *
407
+ * These defaults apply identically when writing and when querying, so a value written bare and
408
+ * queried bare always agrees with itself. The mismatch to watch for is a bare value where its
409
+ * column has another type: a bare `bigint` is a `u256`, not a {@link u64}. Through a schema that is
410
+ * caught — a write throws `SchemaMismatchError` and a query throws `InvalidPredicateError` — but a
411
+ * query without a schema sends the predicate as written, and the engine, for which a type mismatch
412
+ * is not an error, simply matches nothing.
413
+ */
414
+ type ValueInput = ArkivValue | boolean | number | bigint | string | Uint8Array;
415
+ /**
416
+ * The type a {@link ValueInput} resolves to — the tag of a tagged value, or the default of a bare
417
+ * form. `never` for anything else.
418
+ */
419
+ type TagOf<input> = input extends {
420
+ readonly type: infer tag extends TypeTag;
421
+ } ? tag : input extends boolean ? "bool" : input extends number ? "i32" : input extends bigint ? "u256" : input extends string ? "str" : input extends Uint8Array ? "bytes" : never;
422
+ /**
423
+ * The bare JavaScript form that defaults to `tag`, where there is one — `boolean` for `bool`,
424
+ * `number` for `i32`, `bigint` for `u256`, `string` for `str`, `Uint8Array` for `bytes`. The other
425
+ * types — `u64`, `dec`, `bytes32`, `addr` and `key` — must be written tagged.
426
+ */
427
+ type BareOf<tag$1 extends TypeTag> = {
428
+ bool: boolean;
429
+ i32: number;
430
+ u64: never;
431
+ u256: bigint;
432
+ dec: never;
433
+ bytes32: never;
434
+ bytes: Uint8Array;
435
+ str: string;
436
+ addr: never;
437
+ key: never;
438
+ }[tag$1];
439
+ /**
440
+ * Resolves a {@link ValueInput} to a typed value, applying the bare-form defaults above. Tagged
441
+ * values pass through untouched.
442
+ *
443
+ * @param input - The value to resolve.
444
+ * @param attributeName - The attribute this value belongs to, used to make errors name it.
445
+ *
446
+ * @throws {MissingValueError} If the input is `undefined` or `null` — an attribute is either set
447
+ * with a value and a type, or not set at all.
448
+ * @throws {UntypedValueError} If the input is not a tagged value or a bare boolean, number, bigint,
449
+ * string or `Uint8Array`.
450
+ * @throws {InvalidValueError} If a bare value does not fit the type it defaults to.
451
+ *
452
+ * @example
453
+ * toValue(10) // i32(10)
454
+ * toValue(10n) // u256(10n)
455
+ * toValue("hello") // str("hello")
456
+ * toValue(dec("3.5")) // unchanged
457
+ */
458
+ declare function toValue(input: ValueInput, attributeName?: string): ArkivValue;
459
+ //#endregion
460
+ //#region src/schema/schema.d.ts
461
+ /**
462
+ * The most attributes one entity operation may carry, and so the most columns a schema may have —
463
+ * one fewer for a named schema, whose tag is one more attribute on every create.
464
+ */
465
+ declare const MAX_ATTRIBUTES = 32;
466
+ /**
467
+ * The attribute a named schema tags its entities with: an indexed `str` holding the schema's name.
468
+ * Creates write it, and `.from(schema)` filters on it, so a query through a schema only ever sees
469
+ * entities written through it.
470
+ */
471
+ declare const SCHEMA_ATTRIBUTE = "arkiv.schema";
472
+ /** A schema's columns, keyed by attribute name. */
473
+ type Columns = {
474
+ readonly [name: string]: AnyColumn;
475
+ };
476
+ /**
477
+ * A schema: the named, typed attributes an entity of one kind carries, and which of them the node
478
+ * indexes. Built with {@link defineSchema}.
479
+ *
480
+ * A schema is an SDK-side convention. The node sees only attributes, each with a type and an
481
+ * indexed flag; the schema is what types the SDK's writes and reads, and checks them at runtime.
482
+ *
483
+ * A named schema also tags every entity it creates with its name, in the indexed
484
+ * {@link SCHEMA_ATTRIBUTE} attribute, so that a query through it sees only its own entities.
485
+ *
486
+ * @typeParam C - The columns, keyed by attribute name.
487
+ */
488
+ declare class Schema<C extends Columns = Columns> {
489
+ /** The name entities are tagged with, or `undefined` for an untagged schema. */
490
+ readonly name: string | undefined;
491
+ /** The columns, keyed by attribute name, in the order they were declared. */
492
+ readonly columns: C;
493
+ /** The tag every create writes and every query filters on, if the schema is named. */
494
+ readonly tag: StrValue | undefined;
495
+ /** Use {@link defineSchema}. */
496
+ constructor(name: string | undefined, columns: C);
497
+ }
498
+ /**
499
+ * Declares a schema: the attributes an entity carries, their types, and which of them are indexed.
500
+ *
501
+ * Each column is a type constructor called with no arguments — `str()`, `dec()`, `bytes()` —
502
+ * refined with `.indexed()`, `.optional()` or `.default(...)`. Only indexed columns can be
503
+ * filtered on; the rest are stored and selectable, and do not pay for an index.
504
+ *
505
+ * Give the schema a name to tag its entities: every create then also writes an indexed
506
+ * `arkiv.schema` attribute holding the name, and `.from(schema)` filters on it — the way a
507
+ * collection keeps one model's documents apart from another's. Without a name, a query through the
508
+ * schema sees every entity its `where` matches, whatever wrote it — though the columns it selects
509
+ * are still checked against the schema, so an entity that does not fit is left out of the page, or
510
+ * fails the query with `{ onMismatch: "throw" }`.
511
+ *
512
+ * @param name - The name entities are tagged with — a `str`, so at most 128 bytes. Optional.
513
+ * @param columns - The columns, keyed by attribute name.
514
+ * @throws {InvalidAttributeNameError} If a name violates the attribute-name grammar.
515
+ * @throws {SchemaDefinitionError} If the name is not a valid `str`, an entry is not a column, or a
516
+ * column is named after the schema tag.
517
+ * @throws {TooManyAttributesError} If there are more columns than one create can carry — at most
518
+ * {@link MAX_ATTRIBUTES}, or one fewer for a named schema, whose tag counts as an attribute.
519
+ *
520
+ * @example
521
+ * import { addr, bytes, dec, defineSchema, str } from "@arkiv-network/sdk/schema"
522
+ *
523
+ * const Posts = defineSchema("posts", {
524
+ * author: addr().indexed(),
525
+ * category: str().indexed(),
526
+ * score: dec().indexed(),
527
+ * title: str(), // stored, not indexed
528
+ * body: bytes(), // a blob; bytes can never be indexed
529
+ * thumbnail: bytes().optional(), // bytes columns share one MAX_ENTITY_BYTES budget
530
+ * mimeType: str().default("text/markdown"), // written on create when left out
531
+ * })
532
+ */
533
+ declare function defineSchema<const C extends Columns>(name: string, columns: C): Schema<C>;
534
+ declare function defineSchema<const C extends Columns>(columns: C): Schema<C>;
535
+ /** Whether `input` is a schema built with {@link defineSchema}. */
536
+ declare function isSchema(input: unknown): input is Schema;
537
+ /**
538
+ * The column `name` of `schema`, or `undefined` if it has none. Only the schema's own columns
539
+ * count, so an inherited key such as `toString` or `__proto__` is not mistaken for one.
540
+ */
541
+ declare function lookupColumn(schema: Schema, name: string): AnyColumn | undefined;
542
+ /** The schema's column names, for an error message that has to say what would have worked. */
543
+ declare function describeColumns(schema: Schema): string;
544
+ /** The columns of a schema. */
545
+ type ColumnsOf<S extends Schema> = S["columns"];
546
+ /**
547
+ * What a write accepts for a column of type `T`: a value of that type, or the bare form that
548
+ * defaults to it — a `string` for `str`, a `Uint8Array` for `bytes`, a `number` for `i32`, a
549
+ * `bigint` for `u256`, a `boolean` for `bool`. Every other type is written tagged.
550
+ */
551
+ type ColumnInput<T extends TypeTag> = ValueOf<T> | BareOf<T>;
552
+ /** The columns a create must provide: neither optional nor defaulted. */
553
+ type RequiredColumnName<C extends Columns> = { [K in keyof C]: C[K] extends {
554
+ readonly isOptional: false;
555
+ readonly defaultValue: undefined;
556
+ } ? K : never }[keyof C];
557
+ /** The columns an entity may leave unset — which is to say, the ones a patch may unset. */
558
+ type OptionalColumnName<S extends Schema> = { [K in keyof ColumnsOf<S>]: true extends ColumnsOf<S>[K]["isOptional"] ? K : never }[keyof ColumnsOf<S>] & string;
559
+ /** The indexed columns, which are the only ones `where` can filter on. */
560
+ type IndexedColumnName<S extends Schema> = { [K in keyof ColumnsOf<S>]: true extends ColumnsOf<S>[K]["isIndexed"] ? K : never }[keyof ColumnsOf<S>] & string;
561
+ /**
562
+ * The values a create takes for schema `S`: every required column, plus any optional or
563
+ * defaulted one. A defaulted column left out is written with its default.
564
+ *
565
+ * @example
566
+ * const values: CreateEntityValues<typeof Posts> = {
567
+ * author: addr("0x…"),
568
+ * category: "docs", // bare string -> str
569
+ * score: dec("4.1"),
570
+ * title: "Cells, not entities",
571
+ * body: new Uint8Array(), // bare Uint8Array -> bytes
572
+ * }
573
+ */
574
+ type CreateEntityValues<S extends Schema> = Prettify$1<{ readonly [K in RequiredColumnName<ColumnsOf<S>>]: ColumnInput<ColumnsOf<S>[K]["type"]> } & { readonly [K in Exclude<keyof ColumnsOf<S>, RequiredColumnName<ColumnsOf<S>>>]?: ColumnInput<ColumnsOf<S>[K]["type"]> | undefined }>;
575
+ /**
576
+ * What a patch writes for schema `S`: any subset of its columns. Defaults do not apply — a patch
577
+ * changes only what it names — and a column given as `undefined` is left alone, as a create
578
+ * leaves it out.
579
+ */
580
+ type PatchEntityValues<S extends Schema> = { readonly [K in keyof ColumnsOf<S>]?: ColumnInput<ColumnsOf<S>[K]["type"]> | undefined };
581
+ type Prettify$1<T> = { [K in keyof T]: T[K] } & {};
582
+ //#endregion
583
+ //#region src/schema/attributes.d.ts
584
+ /**
585
+ * The most data the `bytes` columns of one create or patch may hold together, in bytes. Each
586
+ * `bytes` value is also capped on its own, at `MAX_BYTES_LENGTH`.
587
+ *
588
+ * Provisional: the protocol has not settled a per-entity cap yet, so this keeps the budget the
589
+ * single payload had — and an operation much larger than it would not fit in a transaction the
590
+ * node accepts anyway.
591
+ */
592
+ declare const MAX_ENTITY_BYTES: number;
593
+ /**
594
+ * An entity's attributes as a whole — what the `$attributes` selection returns — keyed by name,
595
+ * every value typed.
596
+ *
597
+ * The vocabulary is the same in both directions, so a value read from here drops straight back into
598
+ * a write — as long as its name is a column of the schema the write goes through.
599
+ */
600
+ type Attributes = Readonly<Record<string, ArkivValue>>;
601
+ /**
602
+ * The names, types and indexing of an entity's attributes, with no values — what the
603
+ * `$attributeSchema` selection returns. `indexed` is `undefined` when the node did not say.
604
+ *
605
+ * It is for finding out what entities hold before fetching their values. Values can be large — a
606
+ * `bytes` attribute holds up to 128 KiB — and an RPC endpoint may cap how big a response it sends,
607
+ * so a page of 100 entities with every attribute can be more than it will return. The schema is a
608
+ * few bytes per attribute: select it for a page, then fetch the attributes you need by name, or the
609
+ * large ones a few entities at a time.
610
+ *
611
+ * It also tells apart two entities that use the same name with different types, and shows which
612
+ * attributes are indexed, and so can be filtered on.
613
+ */
614
+ type AttributeSchema = Readonly<Record<string, {
615
+ type: TypeTag;
616
+ indexed: boolean | undefined;
617
+ }>>;
618
+ //#endregion
619
+ //#region src/schema/decimal.d.ts
620
+ /**
621
+ * Decimal places a `dec` value is scaled by. Fixed by the protocol, so any two decimals are
622
+ * directly comparable — and range-indexable — as plain integers.
623
+ */
624
+ declare const DECIMAL_SCALE = 18;
625
+ /** 10 ** {@link DECIMAL_SCALE} — the scaling factor between a `dec` and its integer units. */
626
+ declare const DECIMAL_UNIT: bigint;
627
+ //#endregion
628
+ //#region src/schema/errors.d.ts
629
+ /**
630
+ * A value was rejected by its tagged constructor — out of range, wrong length, bad checksum, too
631
+ * much precision, and so on.
632
+ *
633
+ * The message names the offending value and, where there is one, the type that *would* hold it, so
634
+ * the fix is in the error rather than in the docs.
635
+ */
636
+ declare class InvalidValueError extends Error {
637
+ /** The type tag whose constructor rejected the value. */
638
+ readonly tag: TypeTag;
639
+ /** The rejected input, as given. */
640
+ readonly input: unknown;
641
+ constructor(tag: TypeTag, input: unknown, reason: string, hint?: string);
642
+ }
643
+ /**
644
+ * A bare JavaScript value could not be given a type. Raised when an attribute or predicate is
645
+ * handed something that is neither a tagged value nor one of the five bare forms
646
+ * (`boolean`, `number`, `bigint`, `string`, `Uint8Array`).
647
+ */
648
+ declare class UntypedValueError extends Error {
649
+ readonly input: unknown;
650
+ constructor(input: unknown);
651
+ }
652
+ /**
653
+ * An attribute was given `undefined` or `null` as its value.
654
+ *
655
+ * There is no such thing as an attribute with no value: an attribute either exists with a type, or
656
+ * is not set. The fix is always to leave the name out rather than to write an empty value — or, to
657
+ * remove a column from an existing entity, to `unset` it in a patch — so this is called out
658
+ * separately from {@link UntypedValueError}: the remedy is different.
659
+ *
660
+ * `createEntity` and `patchEntity` already treat a column given as `undefined` as left out, so
661
+ * through them only `null` raises this.
662
+ */
663
+ declare class MissingValueError extends Error {
664
+ /** The attribute whose value was missing, when raised from an attribute map. */
665
+ readonly attributeName: string | undefined;
666
+ constructor(input: null | undefined, attributeName?: string);
667
+ }
668
+ /** An attribute name violated the on-chain name grammar. */
669
+ declare class InvalidAttributeNameError extends Error {
670
+ readonly attributeName: string;
671
+ constructor(attributeName: string, reason: string);
672
+ }
673
+ /**
674
+ * One patch tried to both write and remove the same attribute.
675
+ */
676
+ declare class ConflictingMutationError extends Error {
677
+ readonly attributeName: string;
678
+ constructor(attributeName: string);
679
+ }
680
+ /**
681
+ * More attributes were supplied than an entity operation can carry — raised by `defineSchema` for a
682
+ * schema with more columns than one create could write.
683
+ */
684
+ declare class TooManyAttributesError extends Error {
685
+ /**
686
+ * @param tagged - Whether `count` includes a named schema's tag, which the message then calls out:
687
+ * the tag is not among the declared columns, so the count would otherwise look off by one.
688
+ */
689
+ constructor(count: number, max: number, tagged?: boolean);
690
+ }
691
+ /** The `bytes` values of one create or patch add up to more than `MAX_ENTITY_BYTES`. */
692
+ declare class EntityTooLargeError extends Error {
693
+ constructor(total: number, max: number);
694
+ }
695
+ /** A schema, or one of its columns, was defined in a way the SDK or the protocol cannot honour. */
696
+ declare class SchemaDefinitionError extends Error {
697
+ /** The column at fault, when there is one. */
698
+ readonly columnName: string | undefined;
699
+ constructor(reason: string, columnName?: string);
700
+ }
701
+ /**
702
+ * Data did not fit its schema: a write named a column the schema does not have, left out one it
703
+ * requires, or gave one a value of the wrong type — or an entity read back through a schema lacks a
704
+ * required column or holds one with a different type.
705
+ */
706
+ declare class SchemaMismatchError extends Error {
707
+ /** The column at fault. */
708
+ readonly columnName: string;
709
+ constructor(columnName: string, reason: string);
710
+ }
711
+ /** The node sent back an attribute this SDK cannot decode. */
712
+ declare class UnknownAttributeTypeError extends Error {
713
+ /** The type as the node named it — a tag over JSON-RPC, a typeId on the wire. */
714
+ readonly type: string | number;
715
+ constructor(type: string | number);
716
+ }
717
+ //#endregion
718
+ //#region src/schema/names.d.ts
719
+ /** The longest attribute name, in bytes — the width of the on-chain `Ident32` name cell. */
720
+ declare const MAX_NAME_BYTES = 32;
721
+ /**
722
+ * Validates an attribute name against the engine's `Ident32` grammar and the query language's
723
+ * reserved words.
724
+ *
725
+ * @param name - The attribute name.
726
+ * @throws {InvalidAttributeNameError} If the name is empty, starts with `$` (reserved for system
727
+ * attributes), too long, uses characters outside the grammar, contains `--` (which opens a query
728
+ * comment), or collides with a reserved word.
729
+ */
730
+ declare function validateAttributeName(name: string): void;
731
+ /** Whether `name` is a valid attribute name — the non-throwing form of {@link validateAttributeName}. */
732
+ declare function isValidAttributeName(name: string): boolean;
733
+ //#endregion
734
+ export { u256 as $, describeColumns as A, U64_MAX as B, IndexedColumnName as C, SCHEMA_ATTRIBUTE as D, PatchEntityValues as E, I32_MIN as F, bytes32 as G, addr as H, MAX_BYTES_LENGTH as I, decUnits as J, dec as K, MAX_STRING_BYTES as L, lookupColumn as M, BareOf as N, Schema as O, I32_MAX as P, toValue as Q, TagOf as R, CreateEntityValues as S, OptionalColumnName as T, bool as U, ValueInput as V, bytes as W, key as X, i32 as Y, str as Z, Attributes as _, TypeTag as _t, EntityTooLargeError as a, AddrValue as at, Columns as b, ValueOf as bt, MissingValueError as c, Bytes32Value as ct, TooManyAttributesError as d, I32Value as dt, u64 as et, UnknownAttributeTypeError as f, INDEXED_FLAG as ft, AttributeSchema as g, StrValue as gt, DECIMAL_UNIT as h, KeyValue as ht, ConflictingMutationError as i, isColumn as it, isSchema as j, defineSchema as k, SchemaDefinitionError as l, BytesValue as lt, DECIMAL_SCALE as m, IndexableValue as mt, isValidAttributeName as n, Column as nt, InvalidAttributeNameError as o, ArkivValue as ot, UntypedValueError as p, IndexableTypeTag as pt, decFromUnits as q, validateAttributeName as r, ValueArgument as rt, InvalidValueError as s, BoolValue as st, MAX_NAME_BYTES as t, AnyColumn as tt, SchemaMismatchError as u, DecValue as ut, MAX_ENTITY_BYTES as v, U256Value as vt, MAX_ATTRIBUTES as w, ColumnsOf as x, isArkivValue as xt, ColumnInput as y, U64Value as yt, U256_MAX as z };
735
+ //# sourceMappingURL=index-C-mMF5WZ.d.cts.map