@opendatalabs/vana-sdk 0.1.0-alpha.a0a948f → 0.1.0-alpha.a1d5b24
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/controllers/data.cjs +38 -14
- package/dist/controllers/data.cjs.map +1 -1
- package/dist/controllers/data.d.ts +3 -3
- package/dist/controllers/data.js +38 -14
- package/dist/controllers/data.js.map +1 -1
- package/dist/controllers/permissions.cjs +82 -26
- package/dist/controllers/permissions.cjs.map +1 -1
- package/dist/controllers/permissions.d.ts +8 -8
- package/dist/controllers/permissions.js +82 -26
- package/dist/controllers/permissions.js.map +1 -1
- package/dist/server/relayerHandler.cjs +28 -23
- package/dist/server/relayerHandler.cjs.map +1 -1
- package/dist/server/relayerHandler.d.ts +2 -1
- package/dist/server/relayerHandler.js +28 -23
- package/dist/server/relayerHandler.js.map +1 -1
- package/dist/types/data.cjs.map +1 -1
- package/dist/types/data.d.ts +7 -0
- package/package.json +1 -1
|
@@ -53,12 +53,13 @@ class DataController extends import_base.BaseController {
|
|
|
53
53
|
permissions = [],
|
|
54
54
|
encrypt = true,
|
|
55
55
|
providerName,
|
|
56
|
-
owner
|
|
56
|
+
owner,
|
|
57
|
+
schemaValidation = "strict"
|
|
57
58
|
} = params;
|
|
58
59
|
try {
|
|
59
60
|
let isValid = true;
|
|
60
61
|
let validationErrors = [];
|
|
61
|
-
if (schemaId !== void 0) {
|
|
62
|
+
if (schemaId !== void 0 && schemaValidation !== "skip") {
|
|
62
63
|
try {
|
|
63
64
|
const { SchemaController } = await import("./schemas");
|
|
64
65
|
const schemaController = new SchemaController(this.context);
|
|
@@ -82,15 +83,20 @@ class DataController extends import_base.BaseController {
|
|
|
82
83
|
}
|
|
83
84
|
(0, import_schemaValidation.validateDataAgainstSchema)(parsedContent, schema);
|
|
84
85
|
} catch (error) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
if (schemaValidation === "strict") {
|
|
87
|
+
throw error;
|
|
88
|
+
} else if (schemaValidation === "warn") {
|
|
89
|
+
console.warn(
|
|
90
|
+
'[Vana SDK] Schema validation failed, but continuing due to validation mode "warn"'
|
|
91
|
+
);
|
|
92
|
+
if (error instanceof Error) {
|
|
93
|
+
console.warn(" Validation error:", error.message);
|
|
94
|
+
if (typeof error === "object" && "errors" in error && Array.isArray(error.errors)) {
|
|
95
|
+
console.warn(" Detailed errors:", error.errors);
|
|
96
|
+
}
|
|
91
97
|
}
|
|
92
|
-
|
|
93
|
-
validationErrors = ["Schema validation failed"];
|
|
98
|
+
isValid = false;
|
|
99
|
+
validationErrors = error instanceof Error ? [error.message] : ["Schema validation failed"];
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
102
|
}
|
|
@@ -1429,7 +1435,7 @@ class DataController extends import_base.BaseController {
|
|
|
1429
1435
|
* with specific permissions on the DataRegistry contract. It can be used
|
|
1430
1436
|
* by both direct transactions and relayer services.
|
|
1431
1437
|
*/
|
|
1432
|
-
async addFileWithPermissions(url, ownerAddress, permissions = []) {
|
|
1438
|
+
async addFileWithPermissions(url, ownerAddress, permissions = [], options) {
|
|
1433
1439
|
this.assertWallet();
|
|
1434
1440
|
try {
|
|
1435
1441
|
const chainId = this.context.publicClient.chain?.id;
|
|
@@ -1447,7 +1453,16 @@ class DataController extends import_base.BaseController {
|
|
|
1447
1453
|
functionName: "addFileWithPermissions",
|
|
1448
1454
|
args: [url, ownerAddress, permissions],
|
|
1449
1455
|
account,
|
|
1450
|
-
chain: this.context.walletClient.chain ?? null
|
|
1456
|
+
chain: this.context.walletClient.chain ?? null,
|
|
1457
|
+
...options && {
|
|
1458
|
+
gas: options.gasLimit,
|
|
1459
|
+
nonce: options.nonce,
|
|
1460
|
+
// Use EIP-1559 gas pricing if available, otherwise legacy
|
|
1461
|
+
...options.maxFeePerGas || options.maxPriorityFeePerGas ? {
|
|
1462
|
+
maxFeePerGas: options.maxFeePerGas,
|
|
1463
|
+
maxPriorityFeePerGas: options.maxPriorityFeePerGas
|
|
1464
|
+
} : options.gasPrice ? { gasPrice: options.gasPrice } : {}
|
|
1465
|
+
}
|
|
1451
1466
|
});
|
|
1452
1467
|
const { tx } = await import("../utils/transactionHelpers");
|
|
1453
1468
|
return tx({
|
|
@@ -1583,7 +1598,7 @@ class DataController extends import_base.BaseController {
|
|
|
1583
1598
|
* console.log(`File registered in tx ${result.hash}`);
|
|
1584
1599
|
* ```
|
|
1585
1600
|
*/
|
|
1586
|
-
async addFileWithEncryptedPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0) {
|
|
1601
|
+
async addFileWithEncryptedPermissionsAndSchema(url, ownerAddress, permissions = [], schemaId = 0, options) {
|
|
1587
1602
|
try {
|
|
1588
1603
|
const chainId = this.context.publicClient.chain?.id;
|
|
1589
1604
|
if (!chainId) {
|
|
@@ -1600,7 +1615,16 @@ class DataController extends import_base.BaseController {
|
|
|
1600
1615
|
functionName: "addFileWithPermissionsAndSchema",
|
|
1601
1616
|
args: [url, ownerAddress, permissions, BigInt(schemaId)],
|
|
1602
1617
|
account,
|
|
1603
|
-
chain: this.context.walletClient.chain ?? null
|
|
1618
|
+
chain: this.context.walletClient.chain ?? null,
|
|
1619
|
+
...options && {
|
|
1620
|
+
gas: options.gasLimit,
|
|
1621
|
+
nonce: options.nonce,
|
|
1622
|
+
// Use EIP-1559 gas pricing if available, otherwise legacy
|
|
1623
|
+
...options.maxFeePerGas || options.maxPriorityFeePerGas ? {
|
|
1624
|
+
maxFeePerGas: options.maxFeePerGas,
|
|
1625
|
+
maxPriorityFeePerGas: options.maxPriorityFeePerGas
|
|
1626
|
+
} : options.gasPrice ? { gasPrice: options.gasPrice } : {}
|
|
1627
|
+
}
|
|
1604
1628
|
});
|
|
1605
1629
|
const { tx } = await import("../utils/transactionHelpers");
|
|
1606
1630
|
return tx({
|