@opendatalabs/vana-sdk 3.17.0 → 3.18.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 +6 -3
- package/dist/direct/personal-server-read.cjs +20 -1
- package/dist/direct/personal-server-read.cjs.map +1 -1
- package/dist/direct/personal-server-read.js +23 -1
- package/dist/direct/personal-server-read.js.map +1 -1
- package/dist/errors.cjs +27 -0
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +67 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.browser.d.ts +2 -1
- package/dist/index.browser.js +731 -311
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +743 -313
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +2 -1
- package/dist/index.node.js +731 -311
- package/dist/index.node.js.map +4 -4
- package/dist/protocol/data-point-deletion.cjs +220 -0
- package/dist/protocol/data-point-deletion.cjs.map +1 -0
- package/dist/protocol/data-point-deletion.d.ts +180 -0
- package/dist/protocol/data-point-deletion.js +193 -0
- package/dist/protocol/data-point-deletion.js.map +1 -0
- package/dist/protocol/data-point-deletion.test.d.ts +1 -0
- package/dist/protocol/gateway.cjs +145 -32
- package/dist/protocol/gateway.cjs.map +1 -1
- package/dist/protocol/gateway.d.ts +42 -3
- package/dist/protocol/gateway.js +156 -32
- package/dist/protocol/gateway.js.map +1 -1
- package/dist/protocol/lineage.cjs +9 -4
- package/dist/protocol/lineage.cjs.map +1 -1
- package/dist/protocol/lineage.d.ts +21 -12
- package/dist/protocol/lineage.js +9 -4
- package/dist/protocol/lineage.js.map +1 -1
- package/dist/protocol/personal-server-data.cjs +20 -1
- package/dist/protocol/personal-server-data.cjs.map +1 -1
- package/dist/protocol/personal-server-data.js +23 -1
- package/dist/protocol/personal-server-data.js.map +1 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/providers/vana-storage.cjs +66 -0
- package/dist/storage/providers/vana-storage.cjs.map +1 -1
- package/dist/storage/providers/vana-storage.d.ts +26 -0
- package/dist/storage/providers/vana-storage.js +66 -0
- package/dist/storage/providers/vana-storage.js.map +1 -1
- package/dist/utils/response-body.cjs +46 -0
- package/dist/utils/response-body.cjs.map +1 -0
- package/dist/utils/response-body.d.ts +26 -0
- package/dist/utils/response-body.js +20 -0
- package/dist/utils/response-body.js.map +1 -0
- package/dist/utils/response-body.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1349,6 +1349,27 @@ var LineageReadError = class extends VanaError {
|
|
|
1349
1349
|
errorCode;
|
|
1350
1350
|
details;
|
|
1351
1351
|
};
|
|
1352
|
+
var DataPointDeletedError = class extends VanaError {
|
|
1353
|
+
constructor(message, details = {}) {
|
|
1354
|
+
super(message, "DATA_POINT_DELETED");
|
|
1355
|
+
this.details = details;
|
|
1356
|
+
}
|
|
1357
|
+
details;
|
|
1358
|
+
};
|
|
1359
|
+
var DataPointNotFoundError = class extends VanaError {
|
|
1360
|
+
constructor(message, details = {}) {
|
|
1361
|
+
super(message, "DATA_POINT_NOT_FOUND");
|
|
1362
|
+
this.details = details;
|
|
1363
|
+
}
|
|
1364
|
+
details;
|
|
1365
|
+
};
|
|
1366
|
+
var DataPointVersionConflictError = class extends VanaError {
|
|
1367
|
+
constructor(message, details = {}) {
|
|
1368
|
+
super(message, "DATA_POINT_VERSION_CONFLICT");
|
|
1369
|
+
this.details = details;
|
|
1370
|
+
}
|
|
1371
|
+
details;
|
|
1372
|
+
};
|
|
1352
1373
|
|
|
1353
1374
|
// src/contracts/contractController.ts
|
|
1354
1375
|
import {
|
|
@@ -29111,6 +29132,22 @@ function getProtocolNetworkChainId(network) {
|
|
|
29111
29132
|
return PROTOCOL_NETWORK_CHAIN_IDS[network];
|
|
29112
29133
|
}
|
|
29113
29134
|
|
|
29135
|
+
// src/utils/response-body.ts
|
|
29136
|
+
function isPlainObject(value) {
|
|
29137
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29138
|
+
}
|
|
29139
|
+
async function readJsonValue(res) {
|
|
29140
|
+
try {
|
|
29141
|
+
return await res.json();
|
|
29142
|
+
} catch {
|
|
29143
|
+
return null;
|
|
29144
|
+
}
|
|
29145
|
+
}
|
|
29146
|
+
async function readJsonObject(res) {
|
|
29147
|
+
const value = await readJsonValue(res);
|
|
29148
|
+
return isPlainObject(value) ? value : {};
|
|
29149
|
+
}
|
|
29150
|
+
|
|
29114
29151
|
// src/storage/providers/vana-storage.ts
|
|
29115
29152
|
var DEFAULT_ENDPOINT = "https://storage.vana.org";
|
|
29116
29153
|
var LEGACY_BLOB_PATH_PREFIX = "/v1/blobs";
|
|
@@ -29282,6 +29319,65 @@ var VanaStorage = class {
|
|
|
29282
29319
|
}
|
|
29283
29320
|
return true;
|
|
29284
29321
|
}
|
|
29322
|
+
/**
|
|
29323
|
+
* Delete every version's blob under `(owner, scope)` --
|
|
29324
|
+
* `DELETE {prefix}/{owner}/{scope}` on vana-storage, signed with the same
|
|
29325
|
+
* Web3Signed header as uploads (aud = endpoint origin, empty bodyHash).
|
|
29326
|
+
* The worker accepts the owner's own signature or a personal server the
|
|
29327
|
+
* owner registered with the gateway.
|
|
29328
|
+
*
|
|
29329
|
+
* @param ownerAddress - Must equal the provider's configured owner; a
|
|
29330
|
+
* mismatch throws before anything is signed so this wallet can never be
|
|
29331
|
+
* induced to sign a delete for another namespace.
|
|
29332
|
+
* @param scope - The scope segment, e.g. `"instagram.profile"`.
|
|
29333
|
+
*/
|
|
29334
|
+
async deleteScope(ownerAddress, scope) {
|
|
29335
|
+
if (ownerAddress.toLowerCase() !== this.ownerAddress) {
|
|
29336
|
+
throw new StorageError(
|
|
29337
|
+
`deleteScope owner '${ownerAddress}' does not match the configured owner '${this.ownerAddress}'`,
|
|
29338
|
+
"INVALID_OWNER",
|
|
29339
|
+
"vana-storage"
|
|
29340
|
+
);
|
|
29341
|
+
}
|
|
29342
|
+
if (scope.length === 0 || scope.includes("/") || isTraversalSegment(scope)) {
|
|
29343
|
+
throw new StorageError(
|
|
29344
|
+
`scope must be a single non-empty path segment, got '${scope}'`,
|
|
29345
|
+
"INVALID_SCOPE",
|
|
29346
|
+
"vana-storage"
|
|
29347
|
+
);
|
|
29348
|
+
}
|
|
29349
|
+
const path = `${this.blobPathPrefix}/${this.ownerAddress}/${encodeURIComponent(scope)}`;
|
|
29350
|
+
const header = await this.signRequest("DELETE", path);
|
|
29351
|
+
let response;
|
|
29352
|
+
try {
|
|
29353
|
+
response = await this.fetchImpl(`${this.endpoint}${path}`, {
|
|
29354
|
+
method: "DELETE",
|
|
29355
|
+
headers: { authorization: header }
|
|
29356
|
+
});
|
|
29357
|
+
} catch (cause) {
|
|
29358
|
+
throw new StorageError(
|
|
29359
|
+
`vana-storage scope delete network error: ${describe(cause)}`,
|
|
29360
|
+
"DELETE_ERROR",
|
|
29361
|
+
"vana-storage",
|
|
29362
|
+
{ cause: cause instanceof Error ? cause : void 0 }
|
|
29363
|
+
);
|
|
29364
|
+
}
|
|
29365
|
+
if (!response.ok) {
|
|
29366
|
+
const responseText = await safeText(response);
|
|
29367
|
+
throw new StorageError(
|
|
29368
|
+
`vana-storage scope delete failed: ${response.status} ${response.statusText} - ${responseText}`,
|
|
29369
|
+
"DELETE_FAILED",
|
|
29370
|
+
"vana-storage"
|
|
29371
|
+
);
|
|
29372
|
+
}
|
|
29373
|
+
const body = await readJsonObject(response);
|
|
29374
|
+
return {
|
|
29375
|
+
deleted: typeof body["deleted"] === "boolean" ? body["deleted"] : true,
|
|
29376
|
+
scope: typeof body["scope"] === "string" ? body["scope"] : scope,
|
|
29377
|
+
count: nonNegativeInteger(body["count"]) ?? 0,
|
|
29378
|
+
totalBytes: nonNegativeInteger(body["totalBytes"]) ?? 0
|
|
29379
|
+
};
|
|
29380
|
+
}
|
|
29285
29381
|
getConfig() {
|
|
29286
29382
|
return {
|
|
29287
29383
|
name: "vana-storage",
|
|
@@ -29410,6 +29506,12 @@ function encodeRelativePath(filename) {
|
|
|
29410
29506
|
}
|
|
29411
29507
|
return parts.map((p) => encodeURIComponent(p)).join("/");
|
|
29412
29508
|
}
|
|
29509
|
+
function isTraversalSegment(segment) {
|
|
29510
|
+
return segment === "." || segment === "..";
|
|
29511
|
+
}
|
|
29512
|
+
function nonNegativeInteger(value) {
|
|
29513
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
29514
|
+
}
|
|
29413
29515
|
function describe(value) {
|
|
29414
29516
|
if (value instanceof Error) return value.message;
|
|
29415
29517
|
return String(value);
|
|
@@ -32905,266 +33007,13 @@ function buildMarkDataPointUnavailableRequest(config, input) {
|
|
|
32905
33007
|
});
|
|
32906
33008
|
}
|
|
32907
33009
|
|
|
32908
|
-
// src/protocol/data-
|
|
32909
|
-
import {
|
|
32910
|
-
|
|
32911
|
-
|
|
32912
|
-
|
|
32913
|
-
|
|
32914
|
-
|
|
32915
|
-
collectedAt: z.string().datetime(),
|
|
32916
|
-
data: z.record(z.string(), z.unknown())
|
|
32917
|
-
});
|
|
32918
|
-
function createDataFileEnvelope(scope, collectedAt, data, schemaUrl, schemaId) {
|
|
32919
|
-
return {
|
|
32920
|
-
...schemaUrl !== void 0 && { $schema: schemaUrl },
|
|
32921
|
-
...schemaId !== void 0 && { schemaId },
|
|
32922
|
-
version: "1.0",
|
|
32923
|
-
scope,
|
|
32924
|
-
collectedAt,
|
|
32925
|
-
data
|
|
32926
|
-
};
|
|
32927
|
-
}
|
|
32928
|
-
var IngestResponseSchema = z.object({
|
|
32929
|
-
scope: z.string(),
|
|
32930
|
-
collectedAt: z.string().datetime(),
|
|
32931
|
-
status: z.enum(["stored", "syncing"])
|
|
32932
|
-
});
|
|
32933
|
-
|
|
32934
|
-
// src/protocol/personal-server-data.ts
|
|
32935
|
-
function personalServerDataReadPath(scope) {
|
|
32936
|
-
return `/v1/data/${encodeURIComponent(scope)}`;
|
|
32937
|
-
}
|
|
32938
|
-
async function buildPersonalServerDataReadRequest(params) {
|
|
32939
|
-
const path = personalServerDataReadPath(params.scope);
|
|
32940
|
-
const baseUrl = params.personalServerUrl.replace(/\/+$/, "");
|
|
32941
|
-
const audience = params.audience ?? baseUrl;
|
|
32942
|
-
const headers = new Headers(params.headers);
|
|
32943
|
-
headers.set(
|
|
32944
|
-
"Authorization",
|
|
32945
|
-
await buildWeb3SignedHeader({
|
|
32946
|
-
aud: audience,
|
|
32947
|
-
grantId: params.grantId,
|
|
32948
|
-
method: "GET",
|
|
32949
|
-
signMessage: params.signMessage,
|
|
32950
|
-
uri: path
|
|
32951
|
-
})
|
|
32952
|
-
);
|
|
32953
|
-
return new Request(`${baseUrl}${path}`, {
|
|
32954
|
-
headers,
|
|
32955
|
-
method: "GET"
|
|
32956
|
-
});
|
|
32957
|
-
}
|
|
32958
|
-
async function readPersonalServerData(params) {
|
|
32959
|
-
const fetchFn = params.fetch ?? globalThis.fetch;
|
|
32960
|
-
if (fetchFn === void 0) {
|
|
32961
|
-
throw new Error("No fetch implementation available");
|
|
32962
|
-
}
|
|
32963
|
-
const request = await buildPersonalServerDataReadRequest(params);
|
|
32964
|
-
const response = await fetchFn(request);
|
|
32965
|
-
if (!response.ok) {
|
|
32966
|
-
throw new Error(
|
|
32967
|
-
`Personal Server data read failed: ${response.status} ${response.statusText}`
|
|
32968
|
-
);
|
|
32969
|
-
}
|
|
32970
|
-
return DataFileEnvelopeSchema.parse(await response.json());
|
|
32971
|
-
}
|
|
32972
|
-
|
|
32973
|
-
// src/protocol/scopes.ts
|
|
32974
|
-
import { z as z2 } from "zod";
|
|
32975
|
-
var SOURCE_RE = /^[a-z0-9][a-z0-9_]*$/;
|
|
32976
|
-
var TAIL_SEGMENT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_]*$/;
|
|
32977
|
-
var ScopeSchema = z2.string().refine(
|
|
32978
|
-
(scope) => {
|
|
32979
|
-
const parts = scope.split(".");
|
|
32980
|
-
if (parts.length < 2 || parts.length > 3) return false;
|
|
32981
|
-
const [source, ...tail] = parts;
|
|
32982
|
-
return SOURCE_RE.test(source) && tail.every((part) => TAIL_SEGMENT_RE.test(part));
|
|
32983
|
-
},
|
|
32984
|
-
{
|
|
32985
|
-
message: "Scope must be {source}.{category}[.{subcategory}]; source lowercase, tail may keep the historical camelCase form (e.g. spotify.savedTracks)"
|
|
32986
|
-
}
|
|
32987
|
-
);
|
|
32988
|
-
function parseScope(scope) {
|
|
32989
|
-
const validated = ScopeSchema.parse(scope);
|
|
32990
|
-
const parts = validated.split(".");
|
|
32991
|
-
return {
|
|
32992
|
-
source: parts[0],
|
|
32993
|
-
category: parts[1],
|
|
32994
|
-
subcategory: parts[2],
|
|
32995
|
-
raw: validated
|
|
32996
|
-
};
|
|
32997
|
-
}
|
|
32998
|
-
function scopeToPathSegments(scope) {
|
|
32999
|
-
const parsed = parseScope(scope);
|
|
33000
|
-
const segments = [parsed.source, parsed.category];
|
|
33001
|
-
if (parsed.subcategory) {
|
|
33002
|
-
segments.push(parsed.subcategory);
|
|
33003
|
-
}
|
|
33004
|
-
return segments;
|
|
33005
|
-
}
|
|
33006
|
-
function scopeMatchesPattern(requestedScope, grantPattern) {
|
|
33007
|
-
if (grantPattern === "*") return true;
|
|
33008
|
-
if (grantPattern.endsWith(".*")) {
|
|
33009
|
-
const prefix = grantPattern.slice(0, -1);
|
|
33010
|
-
return requestedScope.startsWith(prefix);
|
|
33011
|
-
}
|
|
33012
|
-
return requestedScope === grantPattern;
|
|
33013
|
-
}
|
|
33014
|
-
function scopeCoveredByGrant(requestedScope, grantedScopes) {
|
|
33015
|
-
return grantedScopes.some(
|
|
33016
|
-
(pattern) => scopeMatchesPattern(requestedScope, pattern)
|
|
33017
|
-
);
|
|
33018
|
-
}
|
|
33019
|
-
|
|
33020
|
-
// src/protocol/scope-actions.ts
|
|
33021
|
-
var SCOPE_ACTIONS = ["read", "write"];
|
|
33022
|
-
var InvalidScopeEntryError = class extends Error {
|
|
33023
|
-
/** The offending entry, verbatim (unknown because it may not be a string). */
|
|
33024
|
-
entry;
|
|
33025
|
-
constructor(entry, reason) {
|
|
33026
|
-
super(`Invalid scope entry ${describeValue(entry)}: ${reason}`);
|
|
33027
|
-
this.name = "InvalidScopeEntryError";
|
|
33028
|
-
this.entry = entry;
|
|
33029
|
-
}
|
|
33030
|
-
};
|
|
33031
|
-
var OPERATION_SEPARATOR = ":";
|
|
33032
|
-
function describeValue(value) {
|
|
33033
|
-
if (typeof value === "string") return JSON.stringify(value);
|
|
33034
|
-
if (value === null) return "null";
|
|
33035
|
-
return `[${typeof value}]`;
|
|
33036
|
-
}
|
|
33037
|
-
var OPERATION_BY_PREFIX = {
|
|
33038
|
-
write: "write"
|
|
33039
|
-
};
|
|
33040
|
-
function assertScopePart(entry, scope) {
|
|
33041
|
-
if (scope.length === 0) {
|
|
33042
|
-
throw new InvalidScopeEntryError(entry, "scope part is empty");
|
|
33043
|
-
}
|
|
33044
|
-
if (scope.includes(OPERATION_SEPARATOR)) {
|
|
33045
|
-
throw new InvalidScopeEntryError(
|
|
33046
|
-
entry,
|
|
33047
|
-
`scope part must not contain "${OPERATION_SEPARATOR}"`
|
|
33048
|
-
);
|
|
33049
|
-
}
|
|
33050
|
-
}
|
|
33051
|
-
function parseScopeEntry(entry) {
|
|
33052
|
-
const raw = entry;
|
|
33053
|
-
if (typeof raw !== "string") {
|
|
33054
|
-
throw new InvalidScopeEntryError(raw, "entry must be a string");
|
|
33055
|
-
}
|
|
33056
|
-
const separatorIndex = entry.indexOf(OPERATION_SEPARATOR);
|
|
33057
|
-
if (separatorIndex === -1) {
|
|
33058
|
-
assertScopePart(entry, entry);
|
|
33059
|
-
return { scope: entry, action: "read" };
|
|
33060
|
-
}
|
|
33061
|
-
const prefix = entry.slice(0, separatorIndex);
|
|
33062
|
-
const scope = entry.slice(separatorIndex + 1);
|
|
33063
|
-
const action = Object.hasOwn(OPERATION_BY_PREFIX, prefix) ? OPERATION_BY_PREFIX[prefix] : void 0;
|
|
33064
|
-
if (action === void 0) {
|
|
33065
|
-
throw new InvalidScopeEntryError(
|
|
33066
|
-
entry,
|
|
33067
|
-
`unknown operation "${prefix}" (known: ${Object.keys(OPERATION_BY_PREFIX).join(", ")}; read has no prefix)`
|
|
33068
|
-
);
|
|
33069
|
-
}
|
|
33070
|
-
assertScopePart(entry, scope);
|
|
33071
|
-
return { scope, action };
|
|
33072
|
-
}
|
|
33073
|
-
function formatScopeEntry(parsed) {
|
|
33074
|
-
const { scope, action } = parsed;
|
|
33075
|
-
assertScopePart(scope, scope);
|
|
33076
|
-
if (action === "read") return scope;
|
|
33077
|
-
const prefix = Object.entries(OPERATION_BY_PREFIX).find(
|
|
33078
|
-
([, candidate]) => candidate === action
|
|
33079
|
-
)?.[0];
|
|
33080
|
-
if (prefix === void 0) {
|
|
33081
|
-
throw new InvalidScopeEntryError(
|
|
33082
|
-
scope,
|
|
33083
|
-
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33084
|
-
);
|
|
33085
|
-
}
|
|
33086
|
-
return `${prefix}${OPERATION_SEPARATOR}${scope}`;
|
|
33087
|
-
}
|
|
33088
|
-
function compareScopes(a, b) {
|
|
33089
|
-
if (a < b) return -1;
|
|
33090
|
-
if (a > b) return 1;
|
|
33091
|
-
return 0;
|
|
33092
|
-
}
|
|
33093
|
-
function sortActions(actions) {
|
|
33094
|
-
const present = new Set(actions);
|
|
33095
|
-
return SCOPE_ACTIONS.filter((action) => present.has(action));
|
|
33096
|
-
}
|
|
33097
|
-
function grantPermissions(scopes) {
|
|
33098
|
-
const byScope = /* @__PURE__ */ new Map();
|
|
33099
|
-
for (const entry of scopes) {
|
|
33100
|
-
const { scope, action } = parseScopeEntry(entry);
|
|
33101
|
-
let actions = byScope.get(scope);
|
|
33102
|
-
if (actions === void 0) {
|
|
33103
|
-
actions = /* @__PURE__ */ new Set();
|
|
33104
|
-
byScope.set(scope, actions);
|
|
33105
|
-
}
|
|
33106
|
-
actions.add(action);
|
|
33107
|
-
}
|
|
33108
|
-
return [...byScope.keys()].sort(compareScopes).map((scope) => ({
|
|
33109
|
-
scope,
|
|
33110
|
-
actions: sortActions(byScope.get(scope) ?? [])
|
|
33111
|
-
}));
|
|
33112
|
-
}
|
|
33113
|
-
function permissionsToScopes(permissions) {
|
|
33114
|
-
const byScope = /* @__PURE__ */ new Map();
|
|
33115
|
-
for (const { scope, actions } of permissions) {
|
|
33116
|
-
let merged = byScope.get(scope);
|
|
33117
|
-
if (merged === void 0) {
|
|
33118
|
-
merged = /* @__PURE__ */ new Set();
|
|
33119
|
-
byScope.set(scope, merged);
|
|
33120
|
-
}
|
|
33121
|
-
for (const action of actions) {
|
|
33122
|
-
if (!SCOPE_ACTIONS.includes(action)) {
|
|
33123
|
-
throw new InvalidScopeEntryError(
|
|
33124
|
-
scope,
|
|
33125
|
-
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33126
|
-
);
|
|
33127
|
-
}
|
|
33128
|
-
merged.add(action);
|
|
33129
|
-
}
|
|
33130
|
-
}
|
|
33131
|
-
const entries = [];
|
|
33132
|
-
for (const scope of [...byScope.keys()].sort(compareScopes)) {
|
|
33133
|
-
for (const action of sortActions(byScope.get(scope) ?? [])) {
|
|
33134
|
-
entries.push(formatScopeEntry({ scope, action }));
|
|
33135
|
-
}
|
|
33136
|
-
}
|
|
33137
|
-
return entries;
|
|
33138
|
-
}
|
|
33139
|
-
function hasAction(scopes, scope, action) {
|
|
33140
|
-
if (scope.includes(OPERATION_SEPARATOR)) return false;
|
|
33141
|
-
for (const entry of scopes) {
|
|
33142
|
-
let parsed;
|
|
33143
|
-
try {
|
|
33144
|
-
parsed = parseScopeEntry(entry);
|
|
33145
|
-
} catch (error) {
|
|
33146
|
-
if (error instanceof InvalidScopeEntryError) continue;
|
|
33147
|
-
throw error;
|
|
33148
|
-
}
|
|
33149
|
-
if (parsed.action === action && scopeMatchesPattern(scope, parsed.scope)) {
|
|
33150
|
-
return true;
|
|
33151
|
-
}
|
|
33152
|
-
}
|
|
33153
|
-
return false;
|
|
33154
|
-
}
|
|
33155
|
-
function tryGrantPermissions(scopes) {
|
|
33156
|
-
try {
|
|
33157
|
-
return grantPermissions(scopes);
|
|
33158
|
-
} catch (error) {
|
|
33159
|
-
if (error instanceof InvalidScopeEntryError) return void 0;
|
|
33160
|
-
throw error;
|
|
33161
|
-
}
|
|
33162
|
-
}
|
|
33163
|
-
|
|
33164
|
-
// src/protocol/personal-server-write.ts
|
|
33165
|
-
import { sha256 as sha2565 } from "@noble/hashes/sha2";
|
|
33166
|
-
import { bytesToHex as bytesToHex2, isAddress as isAddress5 } from "viem";
|
|
33167
|
-
import { z as z4 } from "zod";
|
|
33010
|
+
// src/protocol/data-point-deletion.ts
|
|
33011
|
+
import {
|
|
33012
|
+
isAddress as isAddress5,
|
|
33013
|
+
keccak256 as keccak2562,
|
|
33014
|
+
maxUint256,
|
|
33015
|
+
stringToBytes as stringToBytes3
|
|
33016
|
+
} from "viem";
|
|
33168
33017
|
|
|
33169
33018
|
// src/protocol/lineage.ts
|
|
33170
33019
|
import {
|
|
@@ -33172,7 +33021,7 @@ import {
|
|
|
33172
33021
|
isAddress as isAddress4,
|
|
33173
33022
|
keccak256
|
|
33174
33023
|
} from "viem";
|
|
33175
|
-
import { z
|
|
33024
|
+
import { z } from "zod";
|
|
33176
33025
|
|
|
33177
33026
|
// src/protocol/personal-server-error-body.ts
|
|
33178
33027
|
function isRecord2(value) {
|
|
@@ -33264,10 +33113,10 @@ function deriveDataPointId(ownerAddress, scope) {
|
|
|
33264
33113
|
)
|
|
33265
33114
|
);
|
|
33266
33115
|
}
|
|
33267
|
-
var DataPointIdSchema =
|
|
33116
|
+
var DataPointIdSchema = z.string().regex(DATA_POINT_ID_PATTERN).transform((value) => value.toLowerCase());
|
|
33268
33117
|
var VERSION_PATTERN = /^[1-9]\d*$/;
|
|
33269
33118
|
var NODE_VERSION_PATTERN = /^(0|[1-9]\d*)$/;
|
|
33270
|
-
var VersionSchema =
|
|
33119
|
+
var VersionSchema = z.union([z.string(), z.number()]).transform(String).refine((value) => NODE_VERSION_PATTERN.test(value), {
|
|
33271
33120
|
message: "version must be a decimal integer"
|
|
33272
33121
|
});
|
|
33273
33122
|
var ViewVersionSchema = VersionSchema.refine(
|
|
@@ -33291,44 +33140,49 @@ function assertDerivedScopeNaming(derivedScope, sourceScopes) {
|
|
|
33291
33140
|
}
|
|
33292
33141
|
}
|
|
33293
33142
|
}
|
|
33294
|
-
var LineageNodeSchema =
|
|
33143
|
+
var LineageNodeSchema = z.object({
|
|
33295
33144
|
dataPointId: DataPointIdSchema,
|
|
33296
|
-
scope:
|
|
33145
|
+
scope: z.string(),
|
|
33297
33146
|
/**
|
|
33298
33147
|
* The node's current version, decimal string; `"0"` for a source that no
|
|
33299
33148
|
* longer resolves to a registered data point.
|
|
33300
33149
|
*/
|
|
33301
33150
|
version: VersionSchema,
|
|
33302
33151
|
/** The node's tombstone time, or `null` when live. */
|
|
33303
|
-
deletedAt:
|
|
33152
|
+
deletedAt: z.string().nullable(),
|
|
33153
|
+
/**
|
|
33154
|
+
* Never present on a visible node. Declared so a node that carries
|
|
33155
|
+
* `redacted: true` next to an id, scope and version cannot slip through
|
|
33156
|
+
* this branch of {@link LineageEntrySchema} with the key stripped.
|
|
33157
|
+
*/
|
|
33158
|
+
redacted: z.never().optional()
|
|
33304
33159
|
});
|
|
33305
|
-
var RedactedLineageNodeSchema =
|
|
33306
|
-
|
|
33307
|
-
redacted: z3.literal(true)
|
|
33160
|
+
var RedactedLineageNodeSchema = z.strictObject({
|
|
33161
|
+
redacted: z.literal(true)
|
|
33308
33162
|
});
|
|
33309
|
-
var LineageEntrySchema =
|
|
33163
|
+
var LineageEntrySchema = z.union([
|
|
33310
33164
|
RedactedLineageNodeSchema,
|
|
33311
33165
|
LineageNodeSchema
|
|
33312
33166
|
]);
|
|
33313
|
-
var LineageGraphSchema =
|
|
33167
|
+
var LineageGraphSchema = z.object({
|
|
33314
33168
|
dataPointId: DataPointIdSchema,
|
|
33315
33169
|
/** The data point owner; every node in the view belongs to it. */
|
|
33316
|
-
ownerAddress:
|
|
33317
|
-
scope:
|
|
33170
|
+
ownerAddress: z.string().optional(),
|
|
33171
|
+
scope: z.string(),
|
|
33318
33172
|
/**
|
|
33319
33173
|
* The derived record's version whose lineage is shown: the requested one,
|
|
33320
33174
|
* else the current one, else (current is a tombstone) the last version
|
|
33321
33175
|
* that carried lineage.
|
|
33322
33176
|
*/
|
|
33323
33177
|
version: ViewVersionSchema,
|
|
33324
|
-
deletedAt:
|
|
33325
|
-
sources:
|
|
33326
|
-
derivatives:
|
|
33178
|
+
deletedAt: z.string().nullable(),
|
|
33179
|
+
sources: z.array(LineageEntrySchema),
|
|
33180
|
+
derivatives: z.array(LineageEntrySchema),
|
|
33327
33181
|
/** `true` when `derivatives` was cut at the server's cap (1000). */
|
|
33328
|
-
derivativesTruncated:
|
|
33182
|
+
derivativesTruncated: z.boolean().optional()
|
|
33329
33183
|
});
|
|
33330
33184
|
function isRedactedLineageNode(entry) {
|
|
33331
|
-
return "redacted" in entry && entry.redacted === true;
|
|
33185
|
+
return "redacted" in entry && entry.redacted === true && Object.keys(entry).length === 1;
|
|
33332
33186
|
}
|
|
33333
33187
|
function personalServerLineagePath(scope, version) {
|
|
33334
33188
|
return `/v1/data/${encodeURIComponent(scope)}/lineage${version === void 0 ? "" : `/${String(version)}`}`;
|
|
@@ -33470,7 +33324,449 @@ function getLineage(params) {
|
|
|
33470
33324
|
return "personalServerUrl" in params ? getPersonalServerLineage(params) : getGatewayLineage(params);
|
|
33471
33325
|
}
|
|
33472
33326
|
|
|
33327
|
+
// src/protocol/data-point-deletion.ts
|
|
33328
|
+
var TOMBSTONE_DATA_HASH_PREIMAGE = "vana.data-point.tombstone.v1";
|
|
33329
|
+
var TOMBSTONE_METADATA_HASH_PREIMAGE = "vana.data-point.tombstone.metadata.v1";
|
|
33330
|
+
var TOMBSTONE_DATA_HASH = "0x30c45ee72fe56d1927701316925ab7ceacd3b6f9267061735d59396f075c6222";
|
|
33331
|
+
var TOMBSTONE_METADATA_HASH = "0xc5255a141acd6a2ae55971b62c0a85977c2511989dc114ad2abc2b7644f57d90";
|
|
33332
|
+
function computeTombstoneHash(preimage) {
|
|
33333
|
+
return keccak2562(stringToBytes3(preimage));
|
|
33334
|
+
}
|
|
33335
|
+
function isTombstoneHashes(dataHash, metadataHash) {
|
|
33336
|
+
return typeof dataHash === "string" && typeof metadataHash === "string" && dataHash.toLowerCase() === TOMBSTONE_DATA_HASH && metadataHash.toLowerCase() === TOMBSTONE_METADATA_HASH;
|
|
33337
|
+
}
|
|
33338
|
+
function isDataPointTombstone(value) {
|
|
33339
|
+
if (!isPlainObject(value)) return false;
|
|
33340
|
+
if (typeof value["deletedAt"] === "string") return true;
|
|
33341
|
+
return isTombstoneHashes(
|
|
33342
|
+
typeof value["dataHash"] === "string" ? value["dataHash"] : void 0,
|
|
33343
|
+
typeof value["metadataHash"] === "string" ? value["metadataHash"] : void 0
|
|
33344
|
+
);
|
|
33345
|
+
}
|
|
33346
|
+
function tombstoneDeletedAt(value) {
|
|
33347
|
+
if (!isPlainObject(value)) return null;
|
|
33348
|
+
const deletedAt = value["deletedAt"];
|
|
33349
|
+
return typeof deletedAt === "string" ? deletedAt : null;
|
|
33350
|
+
}
|
|
33351
|
+
function assertAddress4(value, name) {
|
|
33352
|
+
if (!isAddress5(value)) {
|
|
33353
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
33354
|
+
}
|
|
33355
|
+
}
|
|
33356
|
+
function assertUint256(value, name) {
|
|
33357
|
+
if (value < 0n || value > maxUint256) {
|
|
33358
|
+
throw new Error(`${name} must fit in uint256, got ${value}`);
|
|
33359
|
+
}
|
|
33360
|
+
}
|
|
33361
|
+
function getAccountAddress3(account) {
|
|
33362
|
+
if (!account) return void 0;
|
|
33363
|
+
return typeof account === "string" ? account : account.address;
|
|
33364
|
+
}
|
|
33365
|
+
function isDataPointDeletionSigner(source) {
|
|
33366
|
+
return "address" in source && typeof source.signTypedData === "function";
|
|
33367
|
+
}
|
|
33368
|
+
function createViemDataPointDeletionSigner(source, options = {}) {
|
|
33369
|
+
if (isDataPointDeletionSigner(source)) {
|
|
33370
|
+
return source;
|
|
33371
|
+
}
|
|
33372
|
+
const accountAddress2 = getAccountAddress3(options.account) ?? getAccountAddress3(source.account);
|
|
33373
|
+
if (accountAddress2) {
|
|
33374
|
+
return {
|
|
33375
|
+
address: accountAddress2,
|
|
33376
|
+
signTypedData: (typedData) => source.signTypedData({
|
|
33377
|
+
...typedData,
|
|
33378
|
+
account: options.account ?? source.account ?? accountAddress2
|
|
33379
|
+
})
|
|
33380
|
+
};
|
|
33381
|
+
}
|
|
33382
|
+
throw new Error(
|
|
33383
|
+
"Viem wallet client requires an account option or account property"
|
|
33384
|
+
);
|
|
33385
|
+
}
|
|
33386
|
+
function buildDataPointDeletionTypedData(input) {
|
|
33387
|
+
assertAddress4(input.ownerAddress, "ownerAddress");
|
|
33388
|
+
if (input.scope.length === 0) {
|
|
33389
|
+
throw new Error("scope must be a non-empty string");
|
|
33390
|
+
}
|
|
33391
|
+
if (input.expectedVersion <= 0n) {
|
|
33392
|
+
throw new Error("expectedVersion must be a positive version number");
|
|
33393
|
+
}
|
|
33394
|
+
assertUint256(input.expectedVersion, "expectedVersion");
|
|
33395
|
+
return {
|
|
33396
|
+
domain: dataRegistryDomain(input.config),
|
|
33397
|
+
types: ADD_DATA_TYPES,
|
|
33398
|
+
primaryType: "AddData",
|
|
33399
|
+
message: {
|
|
33400
|
+
ownerAddress: input.ownerAddress,
|
|
33401
|
+
scope: input.scope,
|
|
33402
|
+
dataHash: TOMBSTONE_DATA_HASH,
|
|
33403
|
+
metadataHash: TOMBSTONE_METADATA_HASH,
|
|
33404
|
+
expectedVersion: input.expectedVersion
|
|
33405
|
+
}
|
|
33406
|
+
};
|
|
33407
|
+
}
|
|
33408
|
+
async function buildDataPointDeletionSignature(input) {
|
|
33409
|
+
const typedData = buildDataPointDeletionTypedData({
|
|
33410
|
+
ownerAddress: input.signer.address,
|
|
33411
|
+
scope: input.scope,
|
|
33412
|
+
expectedVersion: input.expectedVersion,
|
|
33413
|
+
config: input.config
|
|
33414
|
+
});
|
|
33415
|
+
const signature = await input.signer.signTypedData(typedData);
|
|
33416
|
+
return {
|
|
33417
|
+
signature,
|
|
33418
|
+
signerAddress: input.signer.address,
|
|
33419
|
+
typedData
|
|
33420
|
+
};
|
|
33421
|
+
}
|
|
33422
|
+
function toError(value) {
|
|
33423
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
33424
|
+
}
|
|
33425
|
+
function parseExpectedVersion(value) {
|
|
33426
|
+
if (typeof value !== "string" || !/^\d+$/.test(value)) {
|
|
33427
|
+
throw new Error(
|
|
33428
|
+
`Gateway returned a malformed expectedVersion: ${JSON.stringify(value)}`
|
|
33429
|
+
);
|
|
33430
|
+
}
|
|
33431
|
+
const parsed = BigInt(value);
|
|
33432
|
+
assertUint256(parsed, "Gateway expectedVersion");
|
|
33433
|
+
return parsed;
|
|
33434
|
+
}
|
|
33435
|
+
async function deleteDataPoint(input) {
|
|
33436
|
+
const ownerAddress = input.signer.address;
|
|
33437
|
+
const dataPointId = deriveDataPointId(ownerAddress, input.scope);
|
|
33438
|
+
let currentVersion = input.currentVersion;
|
|
33439
|
+
if (currentVersion === void 0) {
|
|
33440
|
+
const record = await input.gateway.getDataPoint(dataPointId);
|
|
33441
|
+
if (record === null) {
|
|
33442
|
+
throw new DataPointNotFoundError(
|
|
33443
|
+
`No data point registered for scope '${input.scope}' owned by ${ownerAddress}`,
|
|
33444
|
+
{ dataPointId, scope: input.scope, ownerAddress }
|
|
33445
|
+
);
|
|
33446
|
+
}
|
|
33447
|
+
if (isDataPointTombstone(record)) {
|
|
33448
|
+
throw new DataPointDeletedError(
|
|
33449
|
+
`Data point ${dataPointId} (scope '${input.scope}') is already deleted`,
|
|
33450
|
+
{
|
|
33451
|
+
dataPointId,
|
|
33452
|
+
scope: input.scope,
|
|
33453
|
+
ownerAddress,
|
|
33454
|
+
deletedAt: tombstoneDeletedAt(record)
|
|
33455
|
+
}
|
|
33456
|
+
);
|
|
33457
|
+
}
|
|
33458
|
+
currentVersion = parseExpectedVersion(record.expectedVersion);
|
|
33459
|
+
}
|
|
33460
|
+
if (currentVersion < 0n || currentVersion >= maxUint256) {
|
|
33461
|
+
throw new Error(
|
|
33462
|
+
`currentVersion ${currentVersion} cannot be incremented to a uint256 tombstone version`
|
|
33463
|
+
);
|
|
33464
|
+
}
|
|
33465
|
+
const tombstoneVersion = currentVersion + 1n;
|
|
33466
|
+
const signed = await buildDataPointDeletionSignature({
|
|
33467
|
+
signer: input.signer,
|
|
33468
|
+
scope: input.scope,
|
|
33469
|
+
expectedVersion: tombstoneVersion,
|
|
33470
|
+
config: input.config
|
|
33471
|
+
});
|
|
33472
|
+
const tombstone = await input.gateway.deleteDataPoint({
|
|
33473
|
+
ownerAddress,
|
|
33474
|
+
scope: input.scope,
|
|
33475
|
+
expectedVersion: tombstoneVersion.toString(),
|
|
33476
|
+
signature: signed.signature
|
|
33477
|
+
});
|
|
33478
|
+
const base = {
|
|
33479
|
+
dataPointId,
|
|
33480
|
+
ownerAddress,
|
|
33481
|
+
scope: input.scope,
|
|
33482
|
+
version: tombstoneVersion.toString(),
|
|
33483
|
+
signature: signed.signature,
|
|
33484
|
+
tombstone
|
|
33485
|
+
};
|
|
33486
|
+
try {
|
|
33487
|
+
const storage = await input.storage.deleteScope(ownerAddress, input.scope);
|
|
33488
|
+
return { ...base, status: "deleted", storage };
|
|
33489
|
+
} catch (cause) {
|
|
33490
|
+
return { ...base, status: "partial", storageError: toError(cause) };
|
|
33491
|
+
}
|
|
33492
|
+
}
|
|
33493
|
+
|
|
33494
|
+
// src/protocol/data-file.ts
|
|
33495
|
+
import { z as z2 } from "zod";
|
|
33496
|
+
var DataFileEnvelopeSchema = z2.object({
|
|
33497
|
+
$schema: z2.string().url().optional(),
|
|
33498
|
+
version: z2.literal("1.0"),
|
|
33499
|
+
scope: z2.string(),
|
|
33500
|
+
schemaId: z2.string().optional(),
|
|
33501
|
+
collectedAt: z2.string().datetime(),
|
|
33502
|
+
data: z2.record(z2.string(), z2.unknown())
|
|
33503
|
+
});
|
|
33504
|
+
function createDataFileEnvelope(scope, collectedAt, data, schemaUrl, schemaId) {
|
|
33505
|
+
return {
|
|
33506
|
+
...schemaUrl !== void 0 && { $schema: schemaUrl },
|
|
33507
|
+
...schemaId !== void 0 && { schemaId },
|
|
33508
|
+
version: "1.0",
|
|
33509
|
+
scope,
|
|
33510
|
+
collectedAt,
|
|
33511
|
+
data
|
|
33512
|
+
};
|
|
33513
|
+
}
|
|
33514
|
+
var IngestResponseSchema = z2.object({
|
|
33515
|
+
scope: z2.string(),
|
|
33516
|
+
collectedAt: z2.string().datetime(),
|
|
33517
|
+
status: z2.enum(["stored", "syncing"])
|
|
33518
|
+
});
|
|
33519
|
+
|
|
33520
|
+
// src/protocol/personal-server-data.ts
|
|
33521
|
+
function personalServerDataReadPath(scope) {
|
|
33522
|
+
return `/v1/data/${encodeURIComponent(scope)}`;
|
|
33523
|
+
}
|
|
33524
|
+
async function buildPersonalServerDataReadRequest(params) {
|
|
33525
|
+
const path = personalServerDataReadPath(params.scope);
|
|
33526
|
+
const baseUrl = params.personalServerUrl.replace(/\/+$/, "");
|
|
33527
|
+
const audience = params.audience ?? baseUrl;
|
|
33528
|
+
const headers = new Headers(params.headers);
|
|
33529
|
+
headers.set(
|
|
33530
|
+
"Authorization",
|
|
33531
|
+
await buildWeb3SignedHeader({
|
|
33532
|
+
aud: audience,
|
|
33533
|
+
grantId: params.grantId,
|
|
33534
|
+
method: "GET",
|
|
33535
|
+
signMessage: params.signMessage,
|
|
33536
|
+
uri: path
|
|
33537
|
+
})
|
|
33538
|
+
);
|
|
33539
|
+
return new Request(`${baseUrl}${path}`, {
|
|
33540
|
+
headers,
|
|
33541
|
+
method: "GET"
|
|
33542
|
+
});
|
|
33543
|
+
}
|
|
33544
|
+
async function readPersonalServerData(params) {
|
|
33545
|
+
const fetchFn = params.fetch ?? globalThis.fetch;
|
|
33546
|
+
if (fetchFn === void 0) {
|
|
33547
|
+
throw new Error("No fetch implementation available");
|
|
33548
|
+
}
|
|
33549
|
+
const request = await buildPersonalServerDataReadRequest(params);
|
|
33550
|
+
const response = await fetchFn(request);
|
|
33551
|
+
if (response.status === 410) {
|
|
33552
|
+
throw new DataPointDeletedError(
|
|
33553
|
+
`Personal Server scope '${params.scope}' has been deleted`,
|
|
33554
|
+
{
|
|
33555
|
+
scope: params.scope,
|
|
33556
|
+
deletedAt: tombstoneDeletedAt(await readJsonValue(response))
|
|
33557
|
+
}
|
|
33558
|
+
);
|
|
33559
|
+
}
|
|
33560
|
+
if (!response.ok) {
|
|
33561
|
+
throw new Error(
|
|
33562
|
+
`Personal Server data read failed: ${response.status} ${response.statusText}`
|
|
33563
|
+
);
|
|
33564
|
+
}
|
|
33565
|
+
const body = await response.json();
|
|
33566
|
+
if (isDataPointTombstone(body)) {
|
|
33567
|
+
throw new DataPointDeletedError(
|
|
33568
|
+
`Personal Server scope '${params.scope}' has been deleted`,
|
|
33569
|
+
{ scope: params.scope, deletedAt: tombstoneDeletedAt(body) }
|
|
33570
|
+
);
|
|
33571
|
+
}
|
|
33572
|
+
return DataFileEnvelopeSchema.parse(body);
|
|
33573
|
+
}
|
|
33574
|
+
|
|
33575
|
+
// src/protocol/scopes.ts
|
|
33576
|
+
import { z as z3 } from "zod";
|
|
33577
|
+
var SOURCE_RE = /^[a-z0-9][a-z0-9_]*$/;
|
|
33578
|
+
var TAIL_SEGMENT_RE = /^[a-zA-Z0-9][a-zA-Z0-9_]*$/;
|
|
33579
|
+
var ScopeSchema = z3.string().refine(
|
|
33580
|
+
(scope) => {
|
|
33581
|
+
const parts = scope.split(".");
|
|
33582
|
+
if (parts.length < 2 || parts.length > 3) return false;
|
|
33583
|
+
const [source, ...tail] = parts;
|
|
33584
|
+
return SOURCE_RE.test(source) && tail.every((part) => TAIL_SEGMENT_RE.test(part));
|
|
33585
|
+
},
|
|
33586
|
+
{
|
|
33587
|
+
message: "Scope must be {source}.{category}[.{subcategory}]; source lowercase, tail may keep the historical camelCase form (e.g. spotify.savedTracks)"
|
|
33588
|
+
}
|
|
33589
|
+
);
|
|
33590
|
+
function parseScope(scope) {
|
|
33591
|
+
const validated = ScopeSchema.parse(scope);
|
|
33592
|
+
const parts = validated.split(".");
|
|
33593
|
+
return {
|
|
33594
|
+
source: parts[0],
|
|
33595
|
+
category: parts[1],
|
|
33596
|
+
subcategory: parts[2],
|
|
33597
|
+
raw: validated
|
|
33598
|
+
};
|
|
33599
|
+
}
|
|
33600
|
+
function scopeToPathSegments(scope) {
|
|
33601
|
+
const parsed = parseScope(scope);
|
|
33602
|
+
const segments = [parsed.source, parsed.category];
|
|
33603
|
+
if (parsed.subcategory) {
|
|
33604
|
+
segments.push(parsed.subcategory);
|
|
33605
|
+
}
|
|
33606
|
+
return segments;
|
|
33607
|
+
}
|
|
33608
|
+
function scopeMatchesPattern(requestedScope, grantPattern) {
|
|
33609
|
+
if (grantPattern === "*") return true;
|
|
33610
|
+
if (grantPattern.endsWith(".*")) {
|
|
33611
|
+
const prefix = grantPattern.slice(0, -1);
|
|
33612
|
+
return requestedScope.startsWith(prefix);
|
|
33613
|
+
}
|
|
33614
|
+
return requestedScope === grantPattern;
|
|
33615
|
+
}
|
|
33616
|
+
function scopeCoveredByGrant(requestedScope, grantedScopes) {
|
|
33617
|
+
return grantedScopes.some(
|
|
33618
|
+
(pattern) => scopeMatchesPattern(requestedScope, pattern)
|
|
33619
|
+
);
|
|
33620
|
+
}
|
|
33621
|
+
|
|
33622
|
+
// src/protocol/scope-actions.ts
|
|
33623
|
+
var SCOPE_ACTIONS = ["read", "write"];
|
|
33624
|
+
var InvalidScopeEntryError = class extends Error {
|
|
33625
|
+
/** The offending entry, verbatim (unknown because it may not be a string). */
|
|
33626
|
+
entry;
|
|
33627
|
+
constructor(entry, reason) {
|
|
33628
|
+
super(`Invalid scope entry ${describeValue(entry)}: ${reason}`);
|
|
33629
|
+
this.name = "InvalidScopeEntryError";
|
|
33630
|
+
this.entry = entry;
|
|
33631
|
+
}
|
|
33632
|
+
};
|
|
33633
|
+
var OPERATION_SEPARATOR = ":";
|
|
33634
|
+
function describeValue(value) {
|
|
33635
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
33636
|
+
if (value === null) return "null";
|
|
33637
|
+
return `[${typeof value}]`;
|
|
33638
|
+
}
|
|
33639
|
+
var OPERATION_BY_PREFIX = {
|
|
33640
|
+
write: "write"
|
|
33641
|
+
};
|
|
33642
|
+
function assertScopePart(entry, scope) {
|
|
33643
|
+
if (scope.length === 0) {
|
|
33644
|
+
throw new InvalidScopeEntryError(entry, "scope part is empty");
|
|
33645
|
+
}
|
|
33646
|
+
if (scope.includes(OPERATION_SEPARATOR)) {
|
|
33647
|
+
throw new InvalidScopeEntryError(
|
|
33648
|
+
entry,
|
|
33649
|
+
`scope part must not contain "${OPERATION_SEPARATOR}"`
|
|
33650
|
+
);
|
|
33651
|
+
}
|
|
33652
|
+
}
|
|
33653
|
+
function parseScopeEntry(entry) {
|
|
33654
|
+
const raw = entry;
|
|
33655
|
+
if (typeof raw !== "string") {
|
|
33656
|
+
throw new InvalidScopeEntryError(raw, "entry must be a string");
|
|
33657
|
+
}
|
|
33658
|
+
const separatorIndex = entry.indexOf(OPERATION_SEPARATOR);
|
|
33659
|
+
if (separatorIndex === -1) {
|
|
33660
|
+
assertScopePart(entry, entry);
|
|
33661
|
+
return { scope: entry, action: "read" };
|
|
33662
|
+
}
|
|
33663
|
+
const prefix = entry.slice(0, separatorIndex);
|
|
33664
|
+
const scope = entry.slice(separatorIndex + 1);
|
|
33665
|
+
const action = Object.hasOwn(OPERATION_BY_PREFIX, prefix) ? OPERATION_BY_PREFIX[prefix] : void 0;
|
|
33666
|
+
if (action === void 0) {
|
|
33667
|
+
throw new InvalidScopeEntryError(
|
|
33668
|
+
entry,
|
|
33669
|
+
`unknown operation "${prefix}" (known: ${Object.keys(OPERATION_BY_PREFIX).join(", ")}; read has no prefix)`
|
|
33670
|
+
);
|
|
33671
|
+
}
|
|
33672
|
+
assertScopePart(entry, scope);
|
|
33673
|
+
return { scope, action };
|
|
33674
|
+
}
|
|
33675
|
+
function formatScopeEntry(parsed) {
|
|
33676
|
+
const { scope, action } = parsed;
|
|
33677
|
+
assertScopePart(scope, scope);
|
|
33678
|
+
if (action === "read") return scope;
|
|
33679
|
+
const prefix = Object.entries(OPERATION_BY_PREFIX).find(
|
|
33680
|
+
([, candidate]) => candidate === action
|
|
33681
|
+
)?.[0];
|
|
33682
|
+
if (prefix === void 0) {
|
|
33683
|
+
throw new InvalidScopeEntryError(
|
|
33684
|
+
scope,
|
|
33685
|
+
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33686
|
+
);
|
|
33687
|
+
}
|
|
33688
|
+
return `${prefix}${OPERATION_SEPARATOR}${scope}`;
|
|
33689
|
+
}
|
|
33690
|
+
function compareScopes(a, b) {
|
|
33691
|
+
if (a < b) return -1;
|
|
33692
|
+
if (a > b) return 1;
|
|
33693
|
+
return 0;
|
|
33694
|
+
}
|
|
33695
|
+
function sortActions(actions) {
|
|
33696
|
+
const present = new Set(actions);
|
|
33697
|
+
return SCOPE_ACTIONS.filter((action) => present.has(action));
|
|
33698
|
+
}
|
|
33699
|
+
function grantPermissions(scopes) {
|
|
33700
|
+
const byScope = /* @__PURE__ */ new Map();
|
|
33701
|
+
for (const entry of scopes) {
|
|
33702
|
+
const { scope, action } = parseScopeEntry(entry);
|
|
33703
|
+
let actions = byScope.get(scope);
|
|
33704
|
+
if (actions === void 0) {
|
|
33705
|
+
actions = /* @__PURE__ */ new Set();
|
|
33706
|
+
byScope.set(scope, actions);
|
|
33707
|
+
}
|
|
33708
|
+
actions.add(action);
|
|
33709
|
+
}
|
|
33710
|
+
return [...byScope.keys()].sort(compareScopes).map((scope) => ({
|
|
33711
|
+
scope,
|
|
33712
|
+
actions: sortActions(byScope.get(scope) ?? [])
|
|
33713
|
+
}));
|
|
33714
|
+
}
|
|
33715
|
+
function permissionsToScopes(permissions) {
|
|
33716
|
+
const byScope = /* @__PURE__ */ new Map();
|
|
33717
|
+
for (const { scope, actions } of permissions) {
|
|
33718
|
+
let merged = byScope.get(scope);
|
|
33719
|
+
if (merged === void 0) {
|
|
33720
|
+
merged = /* @__PURE__ */ new Set();
|
|
33721
|
+
byScope.set(scope, merged);
|
|
33722
|
+
}
|
|
33723
|
+
for (const action of actions) {
|
|
33724
|
+
if (!SCOPE_ACTIONS.includes(action)) {
|
|
33725
|
+
throw new InvalidScopeEntryError(
|
|
33726
|
+
scope,
|
|
33727
|
+
`unknown action ${describeValue(action)} (known: ${SCOPE_ACTIONS.join(", ")})`
|
|
33728
|
+
);
|
|
33729
|
+
}
|
|
33730
|
+
merged.add(action);
|
|
33731
|
+
}
|
|
33732
|
+
}
|
|
33733
|
+
const entries = [];
|
|
33734
|
+
for (const scope of [...byScope.keys()].sort(compareScopes)) {
|
|
33735
|
+
for (const action of sortActions(byScope.get(scope) ?? [])) {
|
|
33736
|
+
entries.push(formatScopeEntry({ scope, action }));
|
|
33737
|
+
}
|
|
33738
|
+
}
|
|
33739
|
+
return entries;
|
|
33740
|
+
}
|
|
33741
|
+
function hasAction(scopes, scope, action) {
|
|
33742
|
+
if (scope.includes(OPERATION_SEPARATOR)) return false;
|
|
33743
|
+
for (const entry of scopes) {
|
|
33744
|
+
let parsed;
|
|
33745
|
+
try {
|
|
33746
|
+
parsed = parseScopeEntry(entry);
|
|
33747
|
+
} catch (error) {
|
|
33748
|
+
if (error instanceof InvalidScopeEntryError) continue;
|
|
33749
|
+
throw error;
|
|
33750
|
+
}
|
|
33751
|
+
if (parsed.action === action && scopeMatchesPattern(scope, parsed.scope)) {
|
|
33752
|
+
return true;
|
|
33753
|
+
}
|
|
33754
|
+
}
|
|
33755
|
+
return false;
|
|
33756
|
+
}
|
|
33757
|
+
function tryGrantPermissions(scopes) {
|
|
33758
|
+
try {
|
|
33759
|
+
return grantPermissions(scopes);
|
|
33760
|
+
} catch (error) {
|
|
33761
|
+
if (error instanceof InvalidScopeEntryError) return void 0;
|
|
33762
|
+
throw error;
|
|
33763
|
+
}
|
|
33764
|
+
}
|
|
33765
|
+
|
|
33473
33766
|
// src/protocol/personal-server-write.ts
|
|
33767
|
+
import { sha256 as sha2565 } from "@noble/hashes/sha2";
|
|
33768
|
+
import { bytesToHex as bytesToHex2, isAddress as isAddress6 } from "viem";
|
|
33769
|
+
import { z as z4 } from "zod";
|
|
33474
33770
|
var WRITE_SESSION_PATH = "/v1/write/session";
|
|
33475
33771
|
var WRITE_SIGNATURE_HEADER = "X-Vana-Write-Signature";
|
|
33476
33772
|
var WRITE_METADATA_HEADER = "X-Vana-Metadata";
|
|
@@ -33773,7 +34069,7 @@ function normalizeLineage(lineage, derivedScope) {
|
|
|
33773
34069
|
for (const entry of lineage) {
|
|
33774
34070
|
let id;
|
|
33775
34071
|
if (isLineagePair(entry)) {
|
|
33776
|
-
if (!
|
|
34072
|
+
if (!isAddress6(entry.ownerAddress, { strict: false })) {
|
|
33777
34073
|
throw new WriteRequestError(
|
|
33778
34074
|
"lineage source ownerAddress must be an EVM address",
|
|
33779
34075
|
{ ownerAddress: entry.ownerAddress }
|
|
@@ -34035,14 +34331,44 @@ function withGrantPermissions(grant) {
|
|
|
34035
34331
|
}
|
|
34036
34332
|
function createGatewayClient(baseUrl) {
|
|
34037
34333
|
const base = baseUrl.replace(/\/+$/, "");
|
|
34334
|
+
function malformedBody(res) {
|
|
34335
|
+
return new Error(
|
|
34336
|
+
`Gateway error: ${res.status} malformed response body (expected a JSON envelope)`
|
|
34337
|
+
);
|
|
34338
|
+
}
|
|
34339
|
+
async function readEnvelope(res) {
|
|
34340
|
+
const envelope = await readJsonValue(res);
|
|
34341
|
+
if (!isPlainObject(envelope) || !("data" in envelope)) {
|
|
34342
|
+
throw malformedBody(res);
|
|
34343
|
+
}
|
|
34344
|
+
return envelope;
|
|
34345
|
+
}
|
|
34038
34346
|
async function unwrapEnvelope(res) {
|
|
34039
|
-
|
|
34040
|
-
return envelope.data;
|
|
34347
|
+
return (await readEnvelope(res)).data;
|
|
34041
34348
|
}
|
|
34042
34349
|
function getMutationId(body, key) {
|
|
34350
|
+
if (!isPlainObject(body)) return void 0;
|
|
34043
34351
|
const value = body[key] ?? body["id"];
|
|
34044
34352
|
return typeof value === "string" ? value : void 0;
|
|
34045
34353
|
}
|
|
34354
|
+
async function readBody(res) {
|
|
34355
|
+
const raw = await readJsonObject(res);
|
|
34356
|
+
const data = raw["data"];
|
|
34357
|
+
if (isPlainObject(data) && "proof" in raw) {
|
|
34358
|
+
return data;
|
|
34359
|
+
}
|
|
34360
|
+
return raw;
|
|
34361
|
+
}
|
|
34362
|
+
function stringOrUndefined(value) {
|
|
34363
|
+
return typeof value === "string" ? value : void 0;
|
|
34364
|
+
}
|
|
34365
|
+
async function deletedError(res, details) {
|
|
34366
|
+
const body = await readBody(res);
|
|
34367
|
+
return new DataPointDeletedError(
|
|
34368
|
+
`Data point ${details.dataPointId ?? details.scope ?? ""} has been deleted`,
|
|
34369
|
+
{ ...details, deletedAt: tombstoneDeletedAt(body) }
|
|
34370
|
+
);
|
|
34371
|
+
}
|
|
34046
34372
|
return {
|
|
34047
34373
|
async isRegisteredBuilder(address) {
|
|
34048
34374
|
const builder = await this.getBuilder(address);
|
|
@@ -34099,13 +34425,29 @@ function createGatewayClient(baseUrl) {
|
|
|
34099
34425
|
}
|
|
34100
34426
|
return await res.json();
|
|
34101
34427
|
},
|
|
34102
|
-
async getDataPoint(dataPointId) {
|
|
34103
|
-
const
|
|
34428
|
+
async getDataPoint(dataPointId, options) {
|
|
34429
|
+
const query = options?.includeDeleted ? "?includeDeleted=true" : "";
|
|
34430
|
+
const res = await fetch(`${base}/v1/data/${dataPointId}${query}`);
|
|
34104
34431
|
if (res.status === 404) return null;
|
|
34432
|
+
if (res.status === 410) {
|
|
34433
|
+
throw await deletedError(res, { dataPointId });
|
|
34434
|
+
}
|
|
34105
34435
|
if (!res.ok) {
|
|
34106
34436
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34107
34437
|
}
|
|
34108
|
-
|
|
34438
|
+
const record = await unwrapEnvelope(res);
|
|
34439
|
+
if (!options?.includeDeleted && isDataPointTombstone(record)) {
|
|
34440
|
+
throw new DataPointDeletedError(
|
|
34441
|
+
`Data point ${dataPointId} has been deleted`,
|
|
34442
|
+
{
|
|
34443
|
+
dataPointId,
|
|
34444
|
+
scope: record.scope,
|
|
34445
|
+
ownerAddress: record.ownerAddress,
|
|
34446
|
+
deletedAt: tombstoneDeletedAt(record)
|
|
34447
|
+
}
|
|
34448
|
+
);
|
|
34449
|
+
}
|
|
34450
|
+
return record;
|
|
34109
34451
|
},
|
|
34110
34452
|
async listDataPointsByOwner(owner, cursor, options) {
|
|
34111
34453
|
const params = new URLSearchParams({ user: owner });
|
|
@@ -34118,14 +34460,24 @@ function createGatewayClient(baseUrl) {
|
|
|
34118
34460
|
if (options?.limit !== void 0) {
|
|
34119
34461
|
params.set("limit", String(options.limit));
|
|
34120
34462
|
}
|
|
34463
|
+
if (options?.includeDeleted) {
|
|
34464
|
+
params.set("includeDeleted", "true");
|
|
34465
|
+
}
|
|
34121
34466
|
const res = await fetch(`${base}/v1/data?${params.toString()}`);
|
|
34122
34467
|
if (!res.ok) {
|
|
34123
34468
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34124
34469
|
}
|
|
34125
|
-
const envelope = await res
|
|
34126
|
-
|
|
34470
|
+
const envelope = await readEnvelope(res);
|
|
34471
|
+
if (!isPlainObject(envelope.data) || !Array.isArray(envelope.data["dataPoints"])) {
|
|
34472
|
+
throw malformedBody(res);
|
|
34473
|
+
}
|
|
34474
|
+
const rows = envelope.data["dataPoints"];
|
|
34475
|
+
const pagination = isPlainObject(envelope["pagination"]) ? envelope["pagination"] : void 0;
|
|
34476
|
+
const rawCursor = pagination?.["nextCursor"];
|
|
34477
|
+
const nextCursor = pagination?.["hasMore"] === false || typeof rawCursor !== "string" ? null : rawCursor;
|
|
34478
|
+
const dataPoints = options?.includeDeleted ? rows : rows.filter((row) => !isDataPointTombstone(row));
|
|
34127
34479
|
return {
|
|
34128
|
-
dataPoints
|
|
34480
|
+
dataPoints,
|
|
34129
34481
|
cursor: nextCursor
|
|
34130
34482
|
};
|
|
34131
34483
|
},
|
|
@@ -34152,7 +34504,7 @@ function createGatewayClient(baseUrl) {
|
|
|
34152
34504
|
})
|
|
34153
34505
|
});
|
|
34154
34506
|
if (res.status === 409) {
|
|
34155
|
-
const body2 = await res
|
|
34507
|
+
const body2 = await readJsonObject(res);
|
|
34156
34508
|
return {
|
|
34157
34509
|
serverId: getMutationId(body2, "serverId"),
|
|
34158
34510
|
alreadyRegistered: true
|
|
@@ -34161,7 +34513,7 @@ function createGatewayClient(baseUrl) {
|
|
|
34161
34513
|
if (!res.ok) {
|
|
34162
34514
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34163
34515
|
}
|
|
34164
|
-
const body = await res
|
|
34516
|
+
const body = await readJsonObject(res);
|
|
34165
34517
|
return {
|
|
34166
34518
|
serverId: getMutationId(body, "serverId"),
|
|
34167
34519
|
alreadyRegistered: false
|
|
@@ -34182,19 +34534,16 @@ function createGatewayClient(baseUrl) {
|
|
|
34182
34534
|
})
|
|
34183
34535
|
});
|
|
34184
34536
|
if (res.status === 409) {
|
|
34185
|
-
const body2 = await res
|
|
34537
|
+
const body2 = await readJsonObject(res);
|
|
34186
34538
|
return {
|
|
34187
|
-
builderId: getMutationId(
|
|
34188
|
-
body2,
|
|
34189
|
-
"builderId"
|
|
34190
|
-
),
|
|
34539
|
+
builderId: getMutationId(body2, "builderId"),
|
|
34191
34540
|
alreadyRegistered: true
|
|
34192
34541
|
};
|
|
34193
34542
|
}
|
|
34194
34543
|
if (!res.ok) {
|
|
34195
34544
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34196
34545
|
}
|
|
34197
|
-
const body = await res
|
|
34546
|
+
const body = await readJsonObject(res);
|
|
34198
34547
|
return {
|
|
34199
34548
|
builderId: getMutationId(body, "builderId"),
|
|
34200
34549
|
alreadyRegistered: false
|
|
@@ -34216,17 +34565,77 @@ function createGatewayClient(baseUrl) {
|
|
|
34216
34565
|
})
|
|
34217
34566
|
});
|
|
34218
34567
|
if (!res.ok) {
|
|
34219
|
-
const body2 = await res
|
|
34220
|
-
const detail = body2
|
|
34568
|
+
const body2 = await readJsonObject(res);
|
|
34569
|
+
const detail = stringOrUndefined(body2["error"]) ?? res.statusText;
|
|
34221
34570
|
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
34222
34571
|
}
|
|
34223
|
-
const body = await res
|
|
34572
|
+
const body = await readJsonObject(res);
|
|
34224
34573
|
return {
|
|
34225
|
-
dataPointId: getMutationId(
|
|
34226
|
-
|
|
34227
|
-
|
|
34228
|
-
|
|
34229
|
-
|
|
34574
|
+
dataPointId: getMutationId(body, "dataPointId"),
|
|
34575
|
+
expectedVersion: stringOrUndefined(body["expectedVersion"])
|
|
34576
|
+
};
|
|
34577
|
+
},
|
|
34578
|
+
async deleteDataPoint(params) {
|
|
34579
|
+
const dataPointId = deriveDataPointId(
|
|
34580
|
+
params.ownerAddress,
|
|
34581
|
+
params.scope
|
|
34582
|
+
);
|
|
34583
|
+
const details = {
|
|
34584
|
+
dataPointId,
|
|
34585
|
+
scope: params.scope,
|
|
34586
|
+
ownerAddress: params.ownerAddress
|
|
34587
|
+
};
|
|
34588
|
+
const res = await fetch(`${base}/v1/data/${dataPointId}`, {
|
|
34589
|
+
method: "DELETE",
|
|
34590
|
+
headers: {
|
|
34591
|
+
"Content-Type": "application/json",
|
|
34592
|
+
Authorization: `Web3Signed ${params.signature}`
|
|
34593
|
+
},
|
|
34594
|
+
body: JSON.stringify({
|
|
34595
|
+
ownerAddress: params.ownerAddress,
|
|
34596
|
+
scope: params.scope,
|
|
34597
|
+
expectedVersion: params.expectedVersion,
|
|
34598
|
+
signature: params.signature
|
|
34599
|
+
})
|
|
34600
|
+
});
|
|
34601
|
+
if (res.status === 404) {
|
|
34602
|
+
throw new DataPointNotFoundError(
|
|
34603
|
+
`Data point ${dataPointId} (scope '${params.scope}') is not registered`,
|
|
34604
|
+
details
|
|
34605
|
+
);
|
|
34606
|
+
}
|
|
34607
|
+
if (res.status === 409) {
|
|
34608
|
+
const body2 = await readBody(res);
|
|
34609
|
+
const currentExpectedVersion = stringOrUndefined(
|
|
34610
|
+
body2["currentExpectedVersion"]
|
|
34611
|
+
);
|
|
34612
|
+
const detail = stringOrUndefined(body2["error"]) ?? res.statusText;
|
|
34613
|
+
throw new DataPointVersionConflictError(
|
|
34614
|
+
`Gateway error: 409 ${detail}`,
|
|
34615
|
+
{
|
|
34616
|
+
...details,
|
|
34617
|
+
expectedVersion: params.expectedVersion,
|
|
34618
|
+
currentExpectedVersion
|
|
34619
|
+
}
|
|
34620
|
+
);
|
|
34621
|
+
}
|
|
34622
|
+
if (res.status === 410) {
|
|
34623
|
+
throw await deletedError(res, details);
|
|
34624
|
+
}
|
|
34625
|
+
if (!res.ok) {
|
|
34626
|
+
const body2 = await readBody(res);
|
|
34627
|
+
const detail = stringOrUndefined(body2["error"]) ?? res.statusText;
|
|
34628
|
+
throw new Error(`Gateway error: ${res.status} ${detail}`);
|
|
34629
|
+
}
|
|
34630
|
+
const body = await readBody(res);
|
|
34631
|
+
return {
|
|
34632
|
+
dataPointId: getMutationId(body, "dataPointId") ?? dataPointId,
|
|
34633
|
+
ownerAddress: stringOrUndefined(body["ownerAddress"]),
|
|
34634
|
+
scope: stringOrUndefined(body["scope"]),
|
|
34635
|
+
dataHash: stringOrUndefined(body["dataHash"]),
|
|
34636
|
+
metadataHash: stringOrUndefined(body["metadataHash"]),
|
|
34637
|
+
expectedVersion: stringOrUndefined(body["expectedVersion"]),
|
|
34638
|
+
deletedAt: tombstoneDeletedAt(body)
|
|
34230
34639
|
};
|
|
34231
34640
|
},
|
|
34232
34641
|
async createGrant(params) {
|
|
@@ -34245,18 +34654,14 @@ function createGatewayClient(baseUrl) {
|
|
|
34245
34654
|
})
|
|
34246
34655
|
});
|
|
34247
34656
|
if (res.status === 409) {
|
|
34248
|
-
const body2 = await res
|
|
34249
|
-
return {
|
|
34250
|
-
grantId: getMutationId(body2, "grantId")
|
|
34251
|
-
};
|
|
34657
|
+
const body2 = await readJsonObject(res);
|
|
34658
|
+
return { grantId: getMutationId(body2, "grantId") };
|
|
34252
34659
|
}
|
|
34253
34660
|
if (!res.ok) {
|
|
34254
34661
|
throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
|
|
34255
34662
|
}
|
|
34256
|
-
const body = await res
|
|
34257
|
-
return {
|
|
34258
|
-
grantId: getMutationId(body, "grantId")
|
|
34259
|
-
};
|
|
34663
|
+
const body = await readJsonObject(res);
|
|
34664
|
+
return { grantId: getMutationId(body, "grantId") };
|
|
34260
34665
|
},
|
|
34261
34666
|
async revokeGrant(params) {
|
|
34262
34667
|
const res = await fetch(`${base}/v1/grants/${params.grantId}`, {
|
|
@@ -34526,7 +34931,10 @@ export {
|
|
|
34526
34931
|
ContractNotFoundError,
|
|
34527
34932
|
DATA_REGISTRY_STATUS_ABI,
|
|
34528
34933
|
DataFileEnvelopeSchema,
|
|
34934
|
+
DataPointDeletedError,
|
|
34935
|
+
DataPointNotFoundError,
|
|
34529
34936
|
DataPointStatus,
|
|
34937
|
+
DataPointVersionConflictError,
|
|
34530
34938
|
DropboxStorage,
|
|
34531
34939
|
ECIESError,
|
|
34532
34940
|
ESCROW_DEPOSIT_ABI2 as ESCROW_DEPOSIT_ABI,
|
|
@@ -34583,6 +34991,10 @@ export {
|
|
|
34583
34991
|
SignatureError,
|
|
34584
34992
|
StorageError,
|
|
34585
34993
|
StorageManager,
|
|
34994
|
+
TOMBSTONE_DATA_HASH,
|
|
34995
|
+
TOMBSTONE_DATA_HASH_PREIMAGE,
|
|
34996
|
+
TOMBSTONE_METADATA_HASH,
|
|
34997
|
+
TOMBSTONE_METADATA_HASH_PREIMAGE,
|
|
34586
34998
|
TransactionPendingError,
|
|
34587
34999
|
UserRejectedRequestError,
|
|
34588
35000
|
VanaError,
|
|
@@ -34605,6 +35017,8 @@ export {
|
|
|
34605
35017
|
assertDerivedScopeNaming,
|
|
34606
35018
|
assertValidPkceVerifier,
|
|
34607
35019
|
binaryWriteSignedBytes,
|
|
35020
|
+
buildDataPointDeletionSignature,
|
|
35021
|
+
buildDataPointDeletionTypedData,
|
|
34608
35022
|
buildDepositNativeRequest,
|
|
34609
35023
|
buildDepositTokenRequest,
|
|
34610
35024
|
buildMarkDataPointUnavailableRequest,
|
|
@@ -34620,6 +35034,7 @@ export {
|
|
|
34620
35034
|
clearContractCache,
|
|
34621
35035
|
computeBodyHash,
|
|
34622
35036
|
computePkceChallenge,
|
|
35037
|
+
computeTombstoneHash,
|
|
34623
35038
|
contractCacheForTesting,
|
|
34624
35039
|
createBrowserPlatformAdapter,
|
|
34625
35040
|
createDataFileEnvelope,
|
|
@@ -34627,11 +35042,13 @@ export {
|
|
|
34627
35042
|
createGatewayClient,
|
|
34628
35043
|
createPlatformAdapterSafe,
|
|
34629
35044
|
createVanaStorageProvider,
|
|
35045
|
+
createViemDataPointDeletionSigner,
|
|
34630
35046
|
createViemPersonalServerLiteOwnerBindingSigner,
|
|
34631
35047
|
createViemPersonalServerRegistrationSigner,
|
|
34632
35048
|
dataRegistryContractAddress,
|
|
34633
35049
|
dataRegistryDomain,
|
|
34634
35050
|
decryptWithPassword,
|
|
35051
|
+
deleteDataPoint,
|
|
34635
35052
|
deriveDataPointId,
|
|
34636
35053
|
deriveMasterKey,
|
|
34637
35054
|
deriveScopeKey,
|
|
@@ -34667,10 +35084,12 @@ export {
|
|
|
34667
35084
|
grantRevocationDomain,
|
|
34668
35085
|
hasAction,
|
|
34669
35086
|
isDataPointId,
|
|
35087
|
+
isDataPointTombstone,
|
|
34670
35088
|
isDataPortabilityGatewayConfig,
|
|
34671
35089
|
isECIESEncrypted,
|
|
34672
35090
|
isPlatformSupported,
|
|
34673
35091
|
isRedactedLineageNode,
|
|
35092
|
+
isTombstoneHashes,
|
|
34674
35093
|
mainnetServices,
|
|
34675
35094
|
moksha,
|
|
34676
35095
|
mokshaServices,
|
|
@@ -34700,6 +35119,7 @@ export {
|
|
|
34700
35119
|
signPersonalServerLiteOwnerBinding,
|
|
34701
35120
|
signPersonalServerLiteOwnerBindingWithAccountClient,
|
|
34702
35121
|
signPersonalServerRegistrationWithAccount,
|
|
35122
|
+
tombstoneDeletedAt,
|
|
34703
35123
|
tryGrantPermissions,
|
|
34704
35124
|
vanaMainnet2 as vanaMainnet,
|
|
34705
35125
|
verifyGrantRegistration,
|