@opendatalabs/vana-sdk 3.2.0 → 3.4.0

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.
@@ -35,7 +35,7 @@ export { encryptWithPassword, decryptWithPassword, } from "./crypto/envelope/ope
35
35
  export { parseWeb3SignedHeader, verifyWeb3Signed, type Web3SignedPayload, type VerifiedAuth, } from "./auth/web3-signed";
36
36
  export { buildWeb3SignedHeader, computeBodyHash, type Web3SignedSignFn, } from "./auth/web3-signed-builder";
37
37
  export { MissingAuthError, InvalidSignatureError, ExpiredTokenError, } from "./auth/errors";
38
- export { fileRegistrationDomain, grantRegistrationDomain, grantRevocationDomain, serverRegistrationDomain, builderRegistrationDomain, FILE_REGISTRATION_TYPES, GRANT_REGISTRATION_TYPES, GRANT_REVOCATION_TYPES, SERVER_REGISTRATION_TYPES, BUILDER_REGISTRATION_TYPES, type DataPortabilityContracts, type DataPortabilityGatewayConfig, type FileRegistrationMessage, type GrantRegistrationMessage, type GrantRevocationMessage, type ServerRegistrationMessage, type BuilderRegistrationMessage, } from "./protocol/eip712";
38
+ export { fileRegistrationDomain, fileDeletionDomain, grantRegistrationDomain, grantRevocationDomain, serverRegistrationDomain, builderRegistrationDomain, FILE_REGISTRATION_TYPES, FILE_DELETION_TYPES, GRANT_REGISTRATION_TYPES, GRANT_REVOCATION_TYPES, SERVER_REGISTRATION_TYPES, BUILDER_REGISTRATION_TYPES, type DataPortabilityContracts, type DataPortabilityGatewayConfig, type FileRegistrationMessage, type FileDeletionMessage, type GrantRegistrationMessage, type GrantRevocationMessage, type ServerRegistrationMessage, type BuilderRegistrationMessage, } from "./protocol/eip712";
39
39
  export { PERSONAL_SERVER_REGISTRATION_DEFAULT_CHAIN_ID, PERSONAL_SERVER_REGISTRATION_DEFAULT_VERIFYING_CONTRACT, personalServerRegistrationDomain, createViemPersonalServerRegistrationSigner, buildPersonalServerRegistrationTypedData, buildPersonalServerRegistrationSignature, registerPersonalServerSignature, type PersonalServerRegistrationTypedData, type PersonalServerRegistrationSigner, type PersonalServerRegistrationDomainInput, type ViemPersonalServerRegistrationWalletClient, type ViemPersonalServerRegistrationSignerSource, type BuildPersonalServerRegistrationTypedDataInput, type BuildPersonalServerRegistrationSignatureInput, type PersonalServerRegistrationSignature, } from "./protocol/personal-server-registration";
40
40
  export { PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION, PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE, PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX, buildPersonalServerLiteOwnerBindingMessage, createViemPersonalServerLiteOwnerBindingSigner, buildPersonalServerLiteOwnerBindingSignature, signPersonalServerLiteOwnerBinding, type PersonalServerLiteOwnerBindingPurpose, type PersonalServerLiteOwnerBindingMessage, type PersonalServerLiteOwnerBindingSigner, type ViemPersonalServerLiteOwnerBindingWalletClient, type ViemPersonalServerLiteOwnerBindingSignerSource, type BuildPersonalServerLiteOwnerBindingSignatureInput, type PersonalServerLiteOwnerBindingSignature, } from "./protocol/personal-server-lite-owner-binding";
41
41
  export { ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT, AccountPersonalServerRegistrationError, signPersonalServerRegistrationWithAccount, type AccountPersonalServerRegistrationIntent, type AccountPersonalServerRegistrationSignature, type AccountPersonalServerRegistrationStatus, type AccountPersonalServerRegistrationRequest, type AccountPersonalServerRegistrationConfig, type AccountSignedPersonalServerRegistration, type AccountConfirmationRequiredPersonalServerRegistration, type AccountFallbackSignedPersonalServerRegistration, type AccountPersonalServerRegistrationResult, } from "./account/personal-server-registration";
@@ -43,5 +43,5 @@ export { AccountPersonalServerLiteOwnerBindingError, signPersonalServerLiteOwner
43
43
  export { isDataPortabilityGatewayConfig, parseGrantRegistrationPayload, verifyGrantRegistration, type DataPortabilityGrantPayload, type VerifyGrantRegistrationInput, type VerifyGrantRegistrationResult, } from "./protocol/grants";
44
44
  export { ScopeSchema, parseScope, scopeToPathSegments, scopeMatchesPattern, scopeCoveredByGrant, type Scope, type ParsedScope, } from "./protocol/scopes";
45
45
  export { DataFileEnvelopeSchema, createDataFileEnvelope, IngestResponseSchema, type DataFileEnvelope, type IngestResponse, } from "./protocol/data-file";
46
- export { createGatewayClient, type GatewayEnvelope, type GatewayProof, type Builder, type Schema, type ServerInfo, type GatewayGrantResponse, type GrantListItem, type FileRecord, type FileListResult, type RegisterServerParams, type RegisterServerResult, type RegisterFileParams, type CreateGrantParams, type RevokeGrantParams, type GatewayClient, } from "./protocol/gateway";
46
+ export { createGatewayClient, type GatewayEnvelope, type GatewayProof, type Builder, type Schema, type ServerInfo, type GatewayGrantResponse, type GrantListItem, type FileRecord, type FileListResult, type ListFilesOptions, type RegisterServerParams, type RegisterServerResult, type RegisterFileParams, type CreateGrantParams, type RevokeGrantParams, type DeleteFileParams, type GatewayClient, } from "./protocol/gateway";
47
47
  export { PSError, parsePSError, type PSErrorCode } from "./types/ps-errors";
@@ -31896,6 +31896,12 @@ function fileRegistrationDomain(config) {
31896
31896
  config.contracts.dataRegistry
31897
31897
  );
31898
31898
  }
31899
+ function fileDeletionDomain(config) {
31900
+ return buildDomain(
31901
+ config.chainId,
31902
+ config.contracts.dataRegistry
31903
+ );
31904
+ }
31899
31905
  function grantRegistrationDomain(config) {
31900
31906
  return buildDomain(
31901
31907
  config.chainId,
@@ -31927,6 +31933,12 @@ var FILE_REGISTRATION_TYPES = {
31927
31933
  { name: "schemaId", type: "bytes32" }
31928
31934
  ]
31929
31935
  };
31936
+ var FILE_DELETION_TYPES = {
31937
+ FileDeletion: [
31938
+ { name: "ownerAddress", type: "address" },
31939
+ { name: "fileId", type: "bytes32" }
31940
+ ]
31941
+ };
31930
31942
  var GRANT_REGISTRATION_TYPES = {
31931
31943
  GrantRegistration: [
31932
31944
  { name: "grantorAddress", type: "address" },
@@ -32581,7 +32593,8 @@ function createGatewayClient(baseUrl) {
32581
32593
  owner: record.owner ?? record.ownerAddress ?? "",
32582
32594
  url: record.url,
32583
32595
  schemaId: record.schemaId,
32584
- createdAt: record.createdAt ?? record.addedAt ?? ""
32596
+ createdAt: record.createdAt ?? record.addedAt ?? "",
32597
+ deletedAt: record.deletedAt ?? null
32585
32598
  };
32586
32599
  }
32587
32600
  function getMutationId(body, key) {
@@ -32641,11 +32654,14 @@ function createGatewayClient(baseUrl) {
32641
32654
  }
32642
32655
  return normalizeFileRecord(await unwrapEnvelope(res));
32643
32656
  },
32644
- async listFilesSince(owner, cursor) {
32657
+ async listFilesSince(owner, cursor, options) {
32645
32658
  const params = new URLSearchParams({ user: owner });
32646
32659
  if (cursor !== null) {
32647
32660
  params.set("since", cursor);
32648
32661
  }
32662
+ if (options?.includeDeleted) {
32663
+ params.set("includeDeleted", "true");
32664
+ }
32649
32665
  const res = await fetch(`${base}/v1/files?${params.toString()}`);
32650
32666
  if (!res.ok) {
32651
32667
  throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
@@ -32764,6 +32780,22 @@ function createGatewayClient(baseUrl) {
32764
32780
  if (!res.ok) {
32765
32781
  throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
32766
32782
  }
32783
+ },
32784
+ async deleteFile(params) {
32785
+ const res = await fetch(`${base}/v1/files/${params.fileId}`, {
32786
+ method: "DELETE",
32787
+ headers: {
32788
+ "Content-Type": "application/json",
32789
+ Authorization: `Web3Signed ${params.signature}`
32790
+ },
32791
+ body: JSON.stringify({
32792
+ ownerAddress: params.ownerAddress
32793
+ })
32794
+ });
32795
+ if (res.status === 409) return;
32796
+ if (!res.ok) {
32797
+ throw new Error(`Gateway error: ${res.status} ${res.statusText}`);
32798
+ }
32767
32799
  }
32768
32800
  };
32769
32801
  }
@@ -32846,6 +32878,7 @@ export {
32846
32878
  DropboxStorage,
32847
32879
  ECIESError,
32848
32880
  ExpiredTokenError,
32881
+ FILE_DELETION_TYPES,
32849
32882
  FILE_REGISTRATION_TYPES,
32850
32883
  GRANT_REGISTRATION_TYPES,
32851
32884
  GRANT_REVOCATION_TYPES,
@@ -32910,6 +32943,7 @@ export {
32910
32943
  deserializeECIES,
32911
32944
  detectPlatform,
32912
32945
  encryptWithPassword,
32946
+ fileDeletionDomain,
32913
32947
  fileRegistrationDomain,
32914
32948
  generatePkceVerifier,
32915
32949
  getAbi,