@arkiv-network/sdk 0.5.0-dev.1 → 0.5.0-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/dist/chains/index.cjs +1 -1
- package/dist/{chains-XCO31x6G.cjs → chains-DVQiGmF6.cjs} +13 -2
- package/dist/index-B801JxcV.d.ts +1003 -0
- package/dist/index-B801JxcV.d.ts.map +1 -0
- package/dist/index-DQGx5KZ6.d.cts +1003 -0
- package/dist/index-DQGx5KZ6.d.cts.map +1 -0
- package/dist/index.cjs +32 -11
- package/dist/index.d.cts +3 -392
- package/dist/index.d.ts +3 -392
- package/dist/index.js +30 -8
- package/dist/index.js.map +1 -1
- package/dist/{payload-Da9gJMG5.d.ts → payload-BI2NXPDf.d.ts} +1 -1
- package/dist/{payload-Da9gJMG5.d.ts.map → payload-BI2NXPDf.d.ts.map} +1 -1
- package/dist/{payload-CJN8fTvX.d.cts → payload-D3fyOBWn.d.cts} +1 -1
- package/dist/{payload-CJN8fTvX.d.cts.map → payload-D3fyOBWn.d.cts.map} +1 -1
- package/dist/{payload-eB1a8vZH.cjs → payload-vwU3Rc6P.cjs} +0 -1
- package/dist/query/index.cjs +1 -2
- package/dist/query/index.d.cts +3 -6
- package/dist/query/index.d.cts.map +1 -1
- package/dist/query/index.d.ts +3 -6
- package/dist/query/index.d.ts.map +1 -1
- package/dist/query/index.js +2 -2
- package/dist/{queryBuilder-DS2Q9bgk.cjs → queryBuilder-B7063DYt.cjs} +111 -17
- package/dist/{queryBuilder-Cy7vf54g.js → queryBuilder-DMzL_J5-.js} +113 -11
- package/dist/queryBuilder-DMzL_J5-.js.map +1 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +6 -5
- package/src/actions/public/query.ts +49 -2
- package/src/actions/public/subscribeEntityEvents.ts +2 -2
- package/src/clients/createPublicClient.ts +1 -1
- package/src/clients/createWalletClient.ts +2 -2
- package/src/clients/decorators/arkivPublic.ts +26 -11
- package/src/clients/decorators/arkivWallet.ts +21 -15
- package/src/index.ts +6 -0
- package/src/query/errors.ts +0 -6
- package/src/query/queryBuilder.ts +7 -4
- package/src/types/index.ts +21 -1
- package/src/types/rpcSchema.ts +10 -10
- package/src/utils/compression.ts +1 -1
- package/src/utils/logger.ts +202 -5
- package/dist/chunk-pbleEpgJ.cjs +0 -44
- package/dist/entity-BNSCqNpu.d.cts +0 -254
- package/dist/entity-BNSCqNpu.d.cts.map +0 -1
- package/dist/entity-D7fzI0Hc.d.ts +0 -254
- package/dist/entity-D7fzI0Hc.d.ts.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/queryBuilder-BGz98Y1C.d.ts +0 -314
- package/dist/queryBuilder-BGz98Y1C.d.ts.map +0 -1
- package/dist/queryBuilder-CvAx57pq.d.cts +0 -314
- package/dist/queryBuilder-CvAx57pq.d.cts.map +0 -1
- package/dist/queryBuilder-Cy7vf54g.js.map +0 -1
|
@@ -6,7 +6,7 @@ import { processQuery } from "./engine"
|
|
|
6
6
|
import type { Predicate } from "./predicate"
|
|
7
7
|
import { QueryResult } from "./queryResult"
|
|
8
8
|
|
|
9
|
-
type OrderByAttribute = {
|
|
9
|
+
export type OrderByAttribute = {
|
|
10
10
|
name: string
|
|
11
11
|
type: "string" | "number"
|
|
12
12
|
order: "asc" | "desc"
|
|
@@ -16,7 +16,7 @@ type OrderByAttribute = {
|
|
|
16
16
|
* Helper function to create an ascending order by attribute
|
|
17
17
|
* @param attributeName - The name of the attribute to order by
|
|
18
18
|
* @param attributeType - The type of the attribute to order by (string or number)
|
|
19
|
-
* @returns
|
|
19
|
+
* @returns Input for orderBy method
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* const ascAttribute = asc("name", "string")
|
|
@@ -33,7 +33,7 @@ export function asc(attributeName: string, attributeType: "string" | "number"):
|
|
|
33
33
|
* Helper function to create a descending order by attribute
|
|
34
34
|
* @param attributeName - The name of the attribute to order by
|
|
35
35
|
* @param attributeType - The type of the attribute to order by (string or number)
|
|
36
|
-
* @returns
|
|
36
|
+
* @returns Input for orderBy method
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* const descAttribute = desc("name", "string")
|
|
@@ -86,14 +86,17 @@ export class QueryBuilder {
|
|
|
86
86
|
* Sets the orderBy for the query.
|
|
87
87
|
* It can be called multiple times to order by multiple attributes.
|
|
88
88
|
* The order of the attributes is important. The first attribute is the primary order by attribute.
|
|
89
|
+
* You can use the helper functions asc() and desc() as input for this method.
|
|
89
90
|
* @param attributeName - The name of the attribute to order by
|
|
90
91
|
* @param attributeType - The type of the attribute to order by (string or number)
|
|
91
92
|
* @param order - The order to set the order by (asc or desc)
|
|
92
93
|
* @returns The QueryBuilder instance
|
|
93
94
|
*
|
|
94
95
|
* @example
|
|
95
|
-
* const builder =
|
|
96
|
+
* const builder = client.buildQuery()
|
|
96
97
|
* builder.orderBy("name", "string", "desc")
|
|
98
|
+
* builder.orderBy(asc("name", "string"))
|
|
99
|
+
* builder.orderBy(desc("name", "string"))
|
|
97
100
|
*/
|
|
98
101
|
orderBy(attributeName: string, attributeType: "string" | "number", order?: "asc" | "desc"): this
|
|
99
102
|
/**
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export type { GetBlockTimingReturnType } from "../actions/public/getBlockTiming"
|
|
2
|
+
export type {
|
|
3
|
+
QueryOptions,
|
|
4
|
+
QueryOptionsIncludeData,
|
|
5
|
+
QueryOptionsOrderBy,
|
|
6
|
+
} from "../actions/public/query"
|
|
1
7
|
export type {
|
|
2
8
|
ChangeOwnershipParameters,
|
|
3
9
|
ChangeOwnershipReturnType,
|
|
@@ -12,6 +18,20 @@ export type {
|
|
|
12
18
|
export type { UpdateEntityParameters, UpdateEntityReturnType } from "../actions/wallet/updateEntity"
|
|
13
19
|
export type { Attribute } from "./attributes"
|
|
14
20
|
export type { Entity } from "./entity"
|
|
21
|
+
export type {
|
|
22
|
+
OnEntityCreatedEvent,
|
|
23
|
+
OnEntityDeletedEvent,
|
|
24
|
+
OnEntityExpiredEvent,
|
|
25
|
+
OnEntityExpiresInExtendedEvent,
|
|
26
|
+
OnEntityOwnerChangedEvent,
|
|
27
|
+
OnEntityUpdatedEvent,
|
|
28
|
+
} from "./events"
|
|
15
29
|
export type { MimeType } from "./mimeTypes"
|
|
16
|
-
export type {
|
|
30
|
+
export type {
|
|
31
|
+
ArkivRpcSchema,
|
|
32
|
+
RpcEntity,
|
|
33
|
+
RpcIncludeData,
|
|
34
|
+
RpcOrderByAttribute,
|
|
35
|
+
RpcQueryOptions,
|
|
36
|
+
} from "./rpcSchema"
|
|
17
37
|
export type { TxParams } from "./txParams"
|
package/src/types/rpcSchema.ts
CHANGED
|
@@ -30,16 +30,16 @@ export type RpcQueryOptions = {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export type RpcIncludeData = {
|
|
33
|
-
key
|
|
34
|
-
attributes
|
|
35
|
-
payload
|
|
36
|
-
contentType
|
|
37
|
-
expiration
|
|
38
|
-
owner
|
|
39
|
-
createdAtBlock
|
|
40
|
-
lastModifiedAtBlock
|
|
41
|
-
transactionIndexInBlock
|
|
42
|
-
operationIndexInTransaction
|
|
33
|
+
key?: boolean
|
|
34
|
+
attributes?: boolean
|
|
35
|
+
payload?: boolean
|
|
36
|
+
contentType?: boolean
|
|
37
|
+
expiration?: boolean
|
|
38
|
+
owner?: boolean
|
|
39
|
+
createdAtBlock?: boolean
|
|
40
|
+
lastModifiedAtBlock?: boolean
|
|
41
|
+
transactionIndexInBlock?: boolean
|
|
42
|
+
operationIndexInTransaction?: boolean
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export type ArkivRpcSchema = [
|
package/src/utils/compression.ts
CHANGED
|
@@ -32,7 +32,7 @@ async function getBrotli(): Promise<BrotliWasmType | null> {
|
|
|
32
32
|
|
|
33
33
|
try {
|
|
34
34
|
const brotliModule = await import("brotli-wasm")
|
|
35
|
-
brotli = brotliModule.default
|
|
35
|
+
brotli = (brotliModule.default ? await brotliModule.default : brotliModule) as BrotliWasmType
|
|
36
36
|
} catch (error) {
|
|
37
37
|
console.error("Error importing brotli-wasm", error)
|
|
38
38
|
return null
|
package/src/utils/logger.ts
CHANGED
|
@@ -1,13 +1,210 @@
|
|
|
1
|
-
import createDebug from "debug"
|
|
2
|
-
|
|
3
1
|
const ROOT_NAMESPACE = "arkiv"
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
// Debug logger type - returns a function that can be called to log messages
|
|
4
|
+
type DebugLogger = (...args: unknown[]) => void
|
|
5
|
+
|
|
6
|
+
// Get DEBUG environment variable (works in both Node.js and browser)
|
|
7
|
+
function getDebugEnv(): string {
|
|
8
|
+
if (typeof process !== "undefined") {
|
|
9
|
+
const debugEnv = process?.env?.DEBUG
|
|
10
|
+
if (debugEnv) {
|
|
11
|
+
return debugEnv
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// Browser: check localStorage
|
|
15
|
+
if (typeof globalThis !== "undefined" && "localStorage" in globalThis) {
|
|
16
|
+
try {
|
|
17
|
+
const storage = (globalThis as { localStorage?: Storage }).localStorage
|
|
18
|
+
return storage?.getItem("DEBUG") || ""
|
|
19
|
+
} catch {
|
|
20
|
+
// localStorage might not be available
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return ""
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Parse debug patterns and check if a namespace matches
|
|
27
|
+
function matchesPattern(namespace: string, pattern: string): boolean {
|
|
28
|
+
// Exact match
|
|
29
|
+
if (pattern === namespace) return true
|
|
30
|
+
|
|
31
|
+
// Wildcard match: "arkiv:*" matches "arkiv:query", "arkiv:rpc", etc.
|
|
32
|
+
if (pattern.endsWith("*")) {
|
|
33
|
+
const prefix = pattern.slice(0, -1)
|
|
34
|
+
return namespace.startsWith(prefix)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Negative match: "-arkiv:query" excludes "arkiv:query"
|
|
38
|
+
if (pattern.startsWith("-")) {
|
|
39
|
+
const excludePattern = pattern.slice(1)
|
|
40
|
+
return !matchesPattern(namespace, excludePattern)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return false
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Check if a namespace is enabled for debugging
|
|
47
|
+
function isEnabled(namespace: string): boolean {
|
|
48
|
+
const debugEnv = getDebugEnv()
|
|
49
|
+
if (!debugEnv) return false
|
|
50
|
+
|
|
51
|
+
// Split by comma/space and check each pattern
|
|
52
|
+
const patterns = debugEnv.split(/[\s,]+/).filter((p) => p.length > 0)
|
|
53
|
+
|
|
54
|
+
// If no patterns, nothing is enabled
|
|
55
|
+
if (patterns.length === 0) return false
|
|
56
|
+
|
|
57
|
+
// Check if any pattern matches (or if explicitly excluded)
|
|
58
|
+
let enabled = false
|
|
59
|
+
for (const pattern of patterns) {
|
|
60
|
+
if (pattern.startsWith("-")) {
|
|
61
|
+
// Exclude pattern - if it matches, disable
|
|
62
|
+
if (matchesPattern(namespace, pattern)) {
|
|
63
|
+
return false
|
|
64
|
+
}
|
|
65
|
+
} else if (matchesPattern(namespace, pattern)) {
|
|
66
|
+
enabled = true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return enabled
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Store enabled namespaces (for programmatic enable/disable)
|
|
74
|
+
const enabledNamespaces: Set<string> = new Set()
|
|
75
|
+
const disabledNamespaces: Set<string> = new Set()
|
|
76
|
+
|
|
77
|
+
// Color palette for namespace coloring (distinct, readable colors)
|
|
78
|
+
const COLOR_PALETTE = [
|
|
79
|
+
"#0000FF", // blue
|
|
80
|
+
"#008000", // green
|
|
81
|
+
"#FF0000", // red
|
|
82
|
+
"#FF00FF", // magenta
|
|
83
|
+
"#FFA500", // orange
|
|
84
|
+
"#800080", // purple
|
|
85
|
+
"#00CED1", // dark turquoise
|
|
86
|
+
"#FF1493", // deep pink
|
|
87
|
+
"#32CD32", // lime green
|
|
88
|
+
"#1E90FF", // dodger blue
|
|
89
|
+
"#FF4500", // orange red
|
|
90
|
+
"#9370DB", // medium purple
|
|
91
|
+
"#00FA9A", // medium spring green
|
|
92
|
+
"#FFD700", // gold
|
|
93
|
+
"#DC143C", // crimson
|
|
94
|
+
"#00BFFF", // deep sky blue
|
|
95
|
+
"#FF69B4", // hot pink
|
|
96
|
+
"#20B2AA", // light sea green
|
|
97
|
+
"#DA70D6", // orchid
|
|
98
|
+
"#4682B4", // steel blue
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
// Detect if we're in Node.js (for ANSI colors) or browser (for CSS colors)
|
|
102
|
+
const isNode = typeof process !== "undefined" && process.versions?.node != null
|
|
103
|
+
|
|
104
|
+
// ANSI color codes for Node.js (bright, distinct colors)
|
|
105
|
+
const ANSI_COLORS = [
|
|
106
|
+
"\x1b[94m", // bright blue
|
|
107
|
+
"\x1b[92m", // bright green
|
|
108
|
+
"\x1b[91m", // bright red
|
|
109
|
+
"\x1b[95m", // bright magenta
|
|
110
|
+
"\x1b[93m", // bright yellow
|
|
111
|
+
"\x1b[96m", // bright cyan
|
|
112
|
+
"\x1b[35m", // magenta
|
|
113
|
+
"\x1b[36m", // cyan
|
|
114
|
+
"\x1b[32m", // green
|
|
115
|
+
"\x1b[34m", // blue
|
|
116
|
+
"\x1b[33m", // yellow
|
|
117
|
+
"\x1b[31m", // red
|
|
118
|
+
"\x1b[90m", // bright black (gray)
|
|
119
|
+
"\x1b[37m", // white
|
|
120
|
+
"\x1b[1m", // bold (as a color option)
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
const ANSI_RESET = "\x1b[0m"
|
|
124
|
+
const ANSI_BOLD = "\x1b[1m"
|
|
125
|
+
|
|
126
|
+
// Cache colors for namespaces (same namespace = same color)
|
|
127
|
+
const namespaceColors = new Map<string, { css: string; ansi: string }>()
|
|
128
|
+
|
|
129
|
+
// Generate a consistent color for a namespace based on its hash
|
|
130
|
+
function getColorForNamespace(namespace: string): { css: string; ansi: string } {
|
|
131
|
+
// Check cache first
|
|
132
|
+
const cachedColor = namespaceColors.get(namespace)
|
|
133
|
+
if (cachedColor) {
|
|
134
|
+
return cachedColor
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Simple hash function to convert string to number
|
|
138
|
+
let hash = 0
|
|
139
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
140
|
+
const char = namespace.charCodeAt(i)
|
|
141
|
+
hash = (hash << 5) - hash + char
|
|
142
|
+
hash = hash & hash // Convert to 32-bit integer
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Use absolute value and modulo to get index
|
|
146
|
+
const colorIndex = Math.abs(hash) % COLOR_PALETTE.length
|
|
147
|
+
const cssColor = COLOR_PALETTE[colorIndex]
|
|
148
|
+
const ansiColor = ANSI_COLORS[colorIndex % ANSI_COLORS.length]
|
|
149
|
+
|
|
150
|
+
const color = { css: cssColor, ansi: ansiColor }
|
|
151
|
+
|
|
152
|
+
// Cache the color
|
|
153
|
+
namespaceColors.set(namespace, color)
|
|
154
|
+
|
|
155
|
+
return color
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Create a debug logger function
|
|
159
|
+
function createDebugLogger(namespace: string): DebugLogger {
|
|
160
|
+
// Get the color for this namespace (consistent across calls)
|
|
161
|
+
const colors = getColorForNamespace(namespace)
|
|
162
|
+
|
|
163
|
+
return (...args: unknown[]) => {
|
|
164
|
+
// Check if enabled via environment variable or programmatically
|
|
165
|
+
const envEnabled = isEnabled(namespace)
|
|
166
|
+
const progEnabled = enabledNamespaces.has(namespace) && !disabledNamespaces.has(namespace)
|
|
167
|
+
|
|
168
|
+
if (envEnabled || progEnabled) {
|
|
169
|
+
if (isNode) {
|
|
170
|
+
// Node.js: use ANSI color codes
|
|
171
|
+
const coloredNamespace = `${ANSI_BOLD}${colors.ansi}${namespace}${ANSI_RESET}`
|
|
172
|
+
console.log(coloredNamespace, ...args)
|
|
173
|
+
} else {
|
|
174
|
+
// Browser: use CSS styling with %c
|
|
175
|
+
// The format is: console.log("%cstyled%cnormal", style1, style2, ...args)
|
|
176
|
+
// This colors the namespace, then resets for the rest
|
|
177
|
+
const style1 = `color: ${colors.css}; font-weight: bold`
|
|
178
|
+
const style2 = "color: inherit; font-weight: normal"
|
|
179
|
+
// Combine namespace with a space, then log with styles
|
|
180
|
+
console.log(`%c${namespace}%c`, style1, style2, ...args)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const getLogger = (scope: string): DebugLogger => {
|
|
187
|
+
const namespace = `${ROOT_NAMESPACE}:${scope}`
|
|
188
|
+
return createDebugLogger(namespace)
|
|
189
|
+
}
|
|
6
190
|
|
|
7
191
|
export const enableDebug = (namespaces: string): void => {
|
|
8
|
-
|
|
192
|
+
// Parse and add namespaces to enabled set
|
|
193
|
+
const patterns = namespaces.split(/[\s,]+/).filter((p) => p.length > 0)
|
|
194
|
+
for (const pattern of patterns) {
|
|
195
|
+
if (pattern.startsWith("-")) {
|
|
196
|
+
// Remove from enabled, add to disabled
|
|
197
|
+
const namespace = pattern.slice(1)
|
|
198
|
+
enabledNamespaces.delete(namespace)
|
|
199
|
+
disabledNamespaces.add(namespace)
|
|
200
|
+
} else {
|
|
201
|
+
enabledNamespaces.add(pattern)
|
|
202
|
+
disabledNamespaces.delete(pattern)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
9
205
|
}
|
|
10
206
|
|
|
11
207
|
export const disableDebug = (): void => {
|
|
12
|
-
|
|
208
|
+
enabledNamespaces.clear()
|
|
209
|
+
disabledNamespaces.clear()
|
|
13
210
|
}
|
package/dist/chunk-pbleEpgJ.cjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (all) => {
|
|
9
|
-
let target = {};
|
|
10
|
-
for (var name in all) __defProp(target, name, {
|
|
11
|
-
get: all[name],
|
|
12
|
-
enumerable: true
|
|
13
|
-
});
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
-
key = keys[i];
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
-
get: ((k) => from[k]).bind(null, key),
|
|
21
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
-
value: mod,
|
|
28
|
-
enumerable: true
|
|
29
|
-
}) : target, mod));
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
|
|
33
|
-
Object.defineProperty(exports, '__export', {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return __export;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(exports, '__toESM', {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
get: function () {
|
|
42
|
-
return __toESM;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { Account, Chain, Client, Hash, Hex, RpcSchema, Transport } from "viem";
|
|
2
|
-
|
|
3
|
-
//#region src/types/mimeTypes.d.ts
|
|
4
|
-
type MimeType = "text/plain" | "text/html" | "text/css" | "text/csv" | "text/xml" | "text/javascript" | "application/json" | "application/xml" | "application/pdf" | "application/zip" | "application/gzip" | "application/octet-stream" | "application/javascript" | "application/x-www-form-urlencoded" | "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "image/svg+xml" | "audio/mpeg" | "audio/wav" | "audio/ogg" | "video/mp4" | "video/webm" | "video/ogg" | "multipart/form-data";
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/types/rpcSchema.d.ts
|
|
7
|
-
type RpcEntity = {
|
|
8
|
-
key: Hex;
|
|
9
|
-
contentType: MimeType;
|
|
10
|
-
value: string;
|
|
11
|
-
expiresAt: string;
|
|
12
|
-
createdAtBlock: string;
|
|
13
|
-
lastModifiedAtBlock: string;
|
|
14
|
-
transactionIndexInBlock: string;
|
|
15
|
-
operationIndexInTransaction: string;
|
|
16
|
-
owner: Hex;
|
|
17
|
-
stringAttributes?: [{
|
|
18
|
-
key: string;
|
|
19
|
-
value: string;
|
|
20
|
-
}];
|
|
21
|
-
numericAttributes?: [{
|
|
22
|
-
key: string;
|
|
23
|
-
value: number;
|
|
24
|
-
}];
|
|
25
|
-
};
|
|
26
|
-
type RpcOrderByAttribute = {
|
|
27
|
-
name: string;
|
|
28
|
-
type: "string" | "numeric";
|
|
29
|
-
desc: boolean;
|
|
30
|
-
};
|
|
31
|
-
type RpcQueryOptions = {
|
|
32
|
-
atBlock?: number;
|
|
33
|
-
includeData?: RpcIncludeData;
|
|
34
|
-
orderBy?: RpcOrderByAttribute[];
|
|
35
|
-
resultsPerPage?: number;
|
|
36
|
-
cursor?: string;
|
|
37
|
-
};
|
|
38
|
-
type RpcIncludeData = {
|
|
39
|
-
key: boolean;
|
|
40
|
-
attributes: boolean;
|
|
41
|
-
payload: boolean;
|
|
42
|
-
contentType: boolean;
|
|
43
|
-
expiration: boolean;
|
|
44
|
-
owner: boolean;
|
|
45
|
-
createdAtBlock: boolean;
|
|
46
|
-
lastModifiedAtBlock: boolean;
|
|
47
|
-
transactionIndexInBlock: boolean;
|
|
48
|
-
operationIndexInTransaction: boolean;
|
|
49
|
-
};
|
|
50
|
-
type ArkivRpcSchema = [{
|
|
51
|
-
Method: "arkiv_query";
|
|
52
|
-
Parameters?: [query: string, queryOptions?: RpcQueryOptions];
|
|
53
|
-
ReturnType: {
|
|
54
|
-
data: RpcEntity[];
|
|
55
|
-
blockNumber: bigint;
|
|
56
|
-
cursor: string;
|
|
57
|
-
};
|
|
58
|
-
}, {
|
|
59
|
-
Method: "arkiv_getBlockTiming";
|
|
60
|
-
Parameters?: [];
|
|
61
|
-
ReturnType: {
|
|
62
|
-
current_block: bigint;
|
|
63
|
-
current_block_time: number;
|
|
64
|
-
duration: number;
|
|
65
|
-
};
|
|
66
|
-
}, {
|
|
67
|
-
Method: "arkiv_getEntityCount";
|
|
68
|
-
Parameters?: [];
|
|
69
|
-
ReturnType: number;
|
|
70
|
-
}];
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/clients/baseClient.d.ts
|
|
73
|
-
type ArkivClient<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined, accountOrAddress extends Account | undefined = Account | undefined, rpcSchema extends RpcSchema | undefined = ArkivRpcSchema> = Client<transport, chain, accountOrAddress, rpcSchema>;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/actions/wallet/changeOwnership.d.ts
|
|
76
|
-
/**
|
|
77
|
-
* Parameters for the deleteEntity function.
|
|
78
|
-
* - entityKey: The key of the entity to delete.
|
|
79
|
-
*/
|
|
80
|
-
type ChangeOwnershipParameters = {
|
|
81
|
-
entityKey: Hex;
|
|
82
|
-
newOwner: Hex;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Return type for the deleteEntity function.
|
|
86
|
-
* - entityKey: The key of the entity.
|
|
87
|
-
* - txHash: The transaction hash.
|
|
88
|
-
*/
|
|
89
|
-
type ChangeOwnershipReturnType = {
|
|
90
|
-
entityKey: Hex;
|
|
91
|
-
txHash: string;
|
|
92
|
-
};
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/actions/wallet/createEntity.d.ts
|
|
95
|
-
/**
|
|
96
|
-
* Parameters for the createEntity function.
|
|
97
|
-
* - payload: The payload of the entity.
|
|
98
|
-
* - attributes: The attributes of the entity.
|
|
99
|
-
* - contentType: The content type of the entity.
|
|
100
|
-
* - expiresIn: The expires in of the entity in seconds.
|
|
101
|
-
*/
|
|
102
|
-
type CreateEntityParameters = {
|
|
103
|
-
payload: Uint8Array;
|
|
104
|
-
attributes: Attribute[];
|
|
105
|
-
contentType: MimeType;
|
|
106
|
-
expiresIn: number;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Return type for the createEntity function.
|
|
110
|
-
* - entityKey: The key of the entity.
|
|
111
|
-
* - txHash: The transaction hash.
|
|
112
|
-
*/
|
|
113
|
-
type CreateEntityReturnType = {
|
|
114
|
-
entityKey: Hex;
|
|
115
|
-
txHash: Hash;
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/actions/wallet/deleteEntity.d.ts
|
|
119
|
-
/**
|
|
120
|
-
* Parameters for the deleteEntity function.
|
|
121
|
-
* - entityKey: The key of the entity to delete.
|
|
122
|
-
*/
|
|
123
|
-
type DeleteEntityParameters = {
|
|
124
|
-
entityKey: Hex;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Return type for the deleteEntity function.
|
|
128
|
-
* - entityKey: The key of the entity.
|
|
129
|
-
* - txHash: The transaction hash.
|
|
130
|
-
*/
|
|
131
|
-
type DeleteEntityReturnType = {
|
|
132
|
-
entityKey: Hex;
|
|
133
|
-
txHash: Hash;
|
|
134
|
-
};
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region src/actions/wallet/extendEntity.d.ts
|
|
137
|
-
/**
|
|
138
|
-
* Parameters for the extendEntity function.
|
|
139
|
-
* - entityKey: The key of the entity to extend.
|
|
140
|
-
* - expiresIn: The expires in of the entity in seconds.
|
|
141
|
-
*/
|
|
142
|
-
type ExtendEntityParameters = {
|
|
143
|
-
entityKey: Hex;
|
|
144
|
-
expiresIn: number;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Return type for the extendEntity function.
|
|
148
|
-
* - entityKey: The key of the entity.
|
|
149
|
-
* - txHash: The transaction hash.
|
|
150
|
-
*/
|
|
151
|
-
type ExtendEntityReturnType = {
|
|
152
|
-
entityKey: Hex;
|
|
153
|
-
txHash: Hash;
|
|
154
|
-
};
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region src/actions/wallet/updateEntity.d.ts
|
|
157
|
-
/**
|
|
158
|
-
* Parameters for the updateEntity function.
|
|
159
|
-
* - entityKey: The key of the entity to update.
|
|
160
|
-
* - payload: The payload of the entity.
|
|
161
|
-
* - attributes: The attributes of the entity.
|
|
162
|
-
* - contentType: The content type of the entity.
|
|
163
|
-
* - expiresIn: The expires in of the entity in seconds.
|
|
164
|
-
*/
|
|
165
|
-
type UpdateEntityParameters = {
|
|
166
|
-
entityKey: Hex;
|
|
167
|
-
payload: Uint8Array;
|
|
168
|
-
attributes: Attribute[];
|
|
169
|
-
contentType: MimeType;
|
|
170
|
-
expiresIn: number;
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* Return type for the updateEntity function.
|
|
174
|
-
* - entityKey: The key of the entity.
|
|
175
|
-
* - txHash: The transaction hash.
|
|
176
|
-
*/
|
|
177
|
-
type UpdateEntityReturnType = {
|
|
178
|
-
entityKey: Hex;
|
|
179
|
-
txHash: Hash;
|
|
180
|
-
};
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/actions/wallet/mutateEntities.d.ts
|
|
183
|
-
/**
|
|
184
|
-
* Parameters for the mutateEntities function.
|
|
185
|
-
* - creates: The creates to perform.
|
|
186
|
-
* - updates: The updates to perform.
|
|
187
|
-
* - deletes: The deletes to perform.
|
|
188
|
-
* - extensions: The extensions to perform.
|
|
189
|
-
*/
|
|
190
|
-
type MutateEntitiesParameters = {
|
|
191
|
-
creates?: CreateEntityParameters[];
|
|
192
|
-
updates?: UpdateEntityParameters[];
|
|
193
|
-
deletes?: DeleteEntityParameters[];
|
|
194
|
-
extensions?: ExtendEntityParameters[];
|
|
195
|
-
ownershipChanges?: ChangeOwnershipParameters[];
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* Return type for the mutateEntities function.
|
|
199
|
-
* - txHash: The transaction hash.
|
|
200
|
-
* - createdEntities: The keys of the created entities.
|
|
201
|
-
* - updatedEntities: The keys of the updated entities.
|
|
202
|
-
* - deletedEntities: The keys of the deleted entities.
|
|
203
|
-
* - extendedEntities: The keys of the extended entities.
|
|
204
|
-
* - ownershipChanges: The keys of the ownership changes.
|
|
205
|
-
*/
|
|
206
|
-
type MutateEntitiesReturnType = {
|
|
207
|
-
txHash: Hash;
|
|
208
|
-
createdEntities: Hex[];
|
|
209
|
-
updatedEntities: Hex[];
|
|
210
|
-
deletedEntities: Hex[];
|
|
211
|
-
extendedEntities: Hex[];
|
|
212
|
-
ownershipChanges: Hex[];
|
|
213
|
-
};
|
|
214
|
-
//#endregion
|
|
215
|
-
//#region src/types/attributes.d.ts
|
|
216
|
-
type Attribute = {
|
|
217
|
-
key: string;
|
|
218
|
-
value: string | number;
|
|
219
|
-
};
|
|
220
|
-
//#endregion
|
|
221
|
-
//#region src/types/txParams.d.ts
|
|
222
|
-
type TxParams = {
|
|
223
|
-
gas?: bigint;
|
|
224
|
-
nonce?: number;
|
|
225
|
-
gasPrice?: bigint;
|
|
226
|
-
maxFeePerGas?: never;
|
|
227
|
-
maxPriorityFeePerGas?: never;
|
|
228
|
-
} | {
|
|
229
|
-
gas?: bigint;
|
|
230
|
-
nonce?: number;
|
|
231
|
-
maxFeePerGas?: bigint;
|
|
232
|
-
maxPriorityFeePerGas?: bigint;
|
|
233
|
-
gasPrice?: never;
|
|
234
|
-
};
|
|
235
|
-
//#endregion
|
|
236
|
-
//#region src/types/entity.d.ts
|
|
237
|
-
declare class Entity {
|
|
238
|
-
key: Hex;
|
|
239
|
-
contentType: MimeType | undefined;
|
|
240
|
-
owner: Hex | undefined;
|
|
241
|
-
expiresAtBlock: bigint | undefined;
|
|
242
|
-
createdAtBlock: bigint | undefined;
|
|
243
|
-
lastModifiedAtBlock: bigint | undefined;
|
|
244
|
-
transactionIndexInBlock: bigint | undefined;
|
|
245
|
-
operationIndexInTransaction: bigint | undefined;
|
|
246
|
-
payload: Uint8Array | undefined;
|
|
247
|
-
attributes: Attribute[];
|
|
248
|
-
constructor(key: Hex, contentType: MimeType | undefined, owner: Hex | undefined, expiresAtBlock: bigint | undefined, createdAtBlock: bigint | undefined, lastModifiedAtBlock: bigint | undefined, transactionIndexInBlock: bigint | undefined, operationIndexInTransaction: bigint | undefined, payload: Uint8Array | undefined, attributes: Attribute[]);
|
|
249
|
-
toText(): string;
|
|
250
|
-
toJson(): any;
|
|
251
|
-
}
|
|
252
|
-
//#endregion
|
|
253
|
-
export { ArkivRpcSchema as _, MutateEntitiesReturnType as a, RpcQueryOptions as b, ExtendEntityParameters as c, DeleteEntityReturnType as d, CreateEntityParameters as f, ArkivClient as g, ChangeOwnershipReturnType as h, MutateEntitiesParameters as i, ExtendEntityReturnType as l, ChangeOwnershipParameters as m, TxParams as n, UpdateEntityParameters as o, CreateEntityReturnType as p, Attribute as r, UpdateEntityReturnType as s, Entity as t, DeleteEntityParameters as u, RpcEntity as v, MimeType as x, RpcIncludeData as y };
|
|
254
|
-
//# sourceMappingURL=entity-BNSCqNpu.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity-BNSCqNpu.d.cts","names":[],"sources":["../src/types/mimeTypes.ts","../src/types/rpcSchema.ts","../src/clients/baseClient.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/txParams.ts","../src/types/entity.ts"],"sourcesContent":[],"mappings":";;;KAAY,QAAA;;;KCGA,SAAA;EDHA,GAAA,ECIL,GDJK;eCKG;;;EAFH,cAAS,EAAA,MAAA;EACd,mBAAA,EAAA,MAAA;EACQ,uBAAA,EAAA,MAAA;EAON,2BAAA,EAAA,MAAA;EAAG,KAAA,EAAH,GAAG;EAKA,gBAAA,CAAA,EAAA,CAAA;IAMA,GAAA,EAAA,MAAA;IAQA,KAAA,EAAA,MAAc;EAad,CAAA,CAAA;;;;ECzCA,CAAA,CAAA;CACQ;AAAY,KDapB,mBAAA,GCboB;EAChB,IAAA,EAAA,MAAA;EAAoB,IAAA,EAAA,QAAA,GAAA,SAAA;EACT,IAAA,EAAA,OAAA;CAAsB;AAC7B,KDgBR,eAAA,GChBQ;EAAwB,OAAA,CAAA,EAAA,MAAA;EACjC,WAAA,CAAA,EDiBK,cCjBL;EAAW,OAAA,CAAA,EDkBV,mBClBU,EAAA;EAAO,cAAA,CAAA,EAAA,MAAA;EAAkB,MAAA,CAAA,EAAA,MAAA;CAA3C;AAAM,KDuBE,cAAA,GCvBF;;;;ECIE,WAAA,EAAA,OAAA;EAUA,UAAA,EAAA,OAAA;;;;ECPA,uBAAA,EAAsB,OAAA;EACvB,2BAAA,EAAA,OAAA;CACG;AACC,KH0BH,cAAA,GG1BG,CAAQ;EASX,MAAA,EAAA,aAAsB;8CHoBc;;UAEpC;IIrCA,WAAA,EAAA,MAAsB;IAStB,MAAA,EAAA,MAAA;;;ECRA,MAAA,EAAA,sBAAsB;EAUtB,UAAA,CAAA,EAAA,EAAA;;;;ICPA,QAAA,EAAA,MAAA;EACC,CAAA;AACF,CAAA,EACG;EACC,MAAA,EAAA,sBAAA;EAAQ,UAAA,CAAA,EAAA,EAAA;EASX,UAAA,EAAA,MAAA;;;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