{
  "version": 3,
  "sources": ["../../src/main.ts", "../../src/web5.ts", "../../src/vc-api.ts", "../../src/dwn-api.ts", "../../src/record.ts", "../../src/utils.ts", "../../src/protocol.ts", "../../src/did-api.ts", "../../src/app-storage.ts", "../../src/did-resolution-cache.ts"],
  "sourcesContent": ["export * from './web5.js';", "import type { Web5Agent } from '@tbd54566975/web5-agent';\nimport type { SyncManager } from '@tbd54566975/web5-user-agent';\nimport type { DidState, DidMethodApi, DidResolverCache, DwnServiceEndpoint } from '@tbd54566975/dids';\n\nimport ms from 'ms';\n\n// import  { Web5ProxyAgent } from '@tbd54566975/web5-proxy-agent';\nimport { Dwn } from '@tbd54566975/dwn-sdk-js';\nimport { Web5UserAgent, ProfileApi, SyncApi } from '@tbd54566975/web5-user-agent';\nimport { DidIonApi, DidKeyApi, utils as didUtils } from '@tbd54566975/dids';\n\nimport { VcApi } from './vc-api.js';\nimport { DwnApi } from './dwn-api.js';\nimport { DidApi } from './did-api.js';\nimport { AppStorage } from './app-storage.js';\nimport { getRandomInt } from './utils.js';\nimport { DidResolutionCache } from './did-resolution-cache.js';\n\n/**\n * overrides to defaults configured for technical preview phase\n */\nexport type TechPreviewOptions = {\n  /** overrides default dwnEndpoints provided for technical preview. see `Web5.#enqueueNextSync` */\n  dwnEndpoints?: string[];\n}\n\n/**\n * optional overrides that can be provided when calling {@link Web5.connect}\n */\nexport type Web5ConnectOptions = {\n  /** a custom {@link Web5Agent}. Defaults to creating an embedded {@link Web5UserAgent} if one isnt provided */\n  web5Agent?: Web5Agent;\n  /** additional {@link DidMethodApi}s that can be used to create and resolve DID methods. defaults to did:key and did:ion */\n  didMethodApis?: DidMethodApi[];\n  /** custom cache used to store DidResolutionResults. defaults to a {@link DidResolutionCache} */\n  didResolutionCache?: DidResolverCache;\n  /** overrides to defaults configured for technical preview phase. See {@link TechPreviewOptions} */\n  techPreview?: TechPreviewOptions;\n}\n\n/**\n * @see {@link Web5ConnectOptions}\n */\ntype Web5Options = {\n  web5Agent: Web5Agent;\n  appStorage?: AppStorage;\n  connectedDid: string;\n};\n\nexport class Web5 {\n  appStorage: AppStorage;\n  dwn: DwnApi;\n  vc: VcApi;\n  #connectedDid: string;\n\n  /**\n   * Statically available DID functionality. can be used to create and resolve DIDs without calling {@link connect}.\n   * By default, can create and resolve `did:key` and `did:ion`. DID resolution results are not cached unless `connect`\n   * is called\n   */\n  static did = new DidApi({\n    didMethodApis: [new DidIonApi(), new DidKeyApi()]\n  });\n\n  /**\n   * DID functionality (e.g. creating and resolving DIDs)\n   */\n  get did() { return Web5.did; }\n\n  private static APP_DID_KEY = 'WEB5_APP_DID';\n\n  private constructor(options: Web5Options) {\n    this.#connectedDid = options.connectedDid;\n    this.dwn = new DwnApi(options.web5Agent, this.#connectedDid);\n    this.vc = new VcApi(options.web5Agent, this.#connectedDid);\n    this.appStorage ||= new AppStorage();\n  }\n\n  /**\n   * Connects to a {@link Web5Agent}. defaults to creating an embedded {@link Web5UserAgent} if one isn't provided\n   * @param options - optional overrides\n   * @returns\n   */\n  static async connect(options: Web5ConnectOptions = {}) {\n    // load app's did\n    const appStorage = new AppStorage();\n    const cachedAppDidState = await appStorage.get(Web5.APP_DID_KEY);\n    let appDidState: DidState;\n\n    if (cachedAppDidState) {\n      appDidState = JSON.parse(cachedAppDidState);\n    } else {\n      appDidState = await this.did.create('key');\n      appStorage.set(Web5.APP_DID_KEY, JSON.stringify(appDidState));\n    }\n\n    // TODO: sniff to see if remote agent is available\n    // TODO: if available,connect to remote agent using Web5ProxyAgent\n\n    // fall back to instantiating local agent\n    const profileApi = new ProfileApi();\n    let [ profile ] = await profileApi.listProfiles();\n\n    options.didMethodApis ??= [];\n\n    // override default cache used by `Web5.did`\n    Web5.did = new DidApi({\n      didMethodApis : [new DidIonApi(), new DidKeyApi(), ...options.didMethodApis],\n      cache         : options.didResolutionCache || new DidResolutionCache()\n    });\n\n    const dwn = await Dwn.create();\n    const syncManager = new SyncApi({\n      profileManager : profileApi,\n      didResolver    : Web5.did.resolver, // share the same resolver to share the same underlying cache\n      dwn            : dwn\n    });\n\n    if (!profile) {\n      const dwnUrls = options.techPreview?.dwnEndpoints || await Web5.getTechPreviewDwnEndpoints();\n      const ionCreateOptions = await DidIonApi.generateDwnConfiguration(dwnUrls);\n      const defaultProfileDid = await this.did.create('ion', ionCreateOptions);\n\n      // setting id & name as the app's did to make migration easier\n      profile = await profileApi.createProfile({\n        name        : appDidState.id,\n        did         : defaultProfileDid,\n        connections : [appDidState.id],\n      });\n\n      await syncManager.registerProfile(profile.did.id);\n    }\n\n    const agent = await Web5UserAgent.create({\n      profileManager : profileApi,\n      didResolver    : Web5.did.resolver, // share the same resolver to share the same underlying cache\n      syncManager    : syncManager,\n      dwn            : dwn,\n    });\n\n    const connectedDid = profile.did.id;\n    const web5 = new Web5({ appStorage: appStorage, web5Agent: agent, connectedDid });\n\n    Web5.#enqueueNextSync(syncManager, ms('2m'));\n\n    return { web5, did: connectedDid };\n  }\n\n  /**\n   * Dynamically selects up to 2 DWN endpoints that are provided\n   * by default during the Tech Preview period.\n   */\n  static async getTechPreviewDwnEndpoints(): Promise<string[]> {\n    let response: Response;\n    try {\n      response = await fetch('https://dwn.tbddev.org/.well-known/did.json');\n      if (!response.ok) {\n        throw new Error(`HTTP Error: ${response.status} ${response.statusText}`);\n      }\n    } catch(e) {\n      console.warn('failed to get tech preview dwn endpoints:', e.message);\n      return [];\n    }\n\n    const didDoc = await response.json();\n    const [ service ] = didUtils.getServices(didDoc, { id: '#dwn', type: 'DecentralizedWebNode' });\n    const { nodes } = <DwnServiceEndpoint>service.serviceEndpoint;\n\n    // allocate up to 2 nodes for a user.\n    const dwnUrls = new Set<string>();\n    const numNodesToAllocate = Math.min(nodes.length, 2);\n\n    for (let attempts = 0; attempts < nodes.length && dwnUrls.size < numNodesToAllocate; attempts += 1) {\n      const nodeIdx = getRandomInt(0, nodes.length);\n      const dwnUrl = nodes[nodeIdx];\n\n      try {\n        const healthCheck = await fetch(`${dwnUrl}/health`);\n        if (healthCheck.ok) {\n          dwnUrls.add(dwnUrl);\n        }\n      } catch(e: unknown) {\n        // Ignore healthcheck failures and try the next node.\n      }\n    }\n\n    return Array.from(dwnUrls);\n  }\n\n  static #enqueueNextSync(syncManager: SyncManager, delay = 1_000) {\n    setTimeout(async () => {\n      try {\n        await syncManager.push();\n        await syncManager.pull();\n\n        return this.#enqueueNextSync(syncManager, delay);\n      } catch(e) {\n        console.error('Sync failed due to error: ', e);\n      }\n    }, delay);\n  }\n}", "import type { Web5Agent } from '@tbd54566975/web5-agent';\n\nexport class VcApi {\n  #agent: Web5Agent;\n  #connectedDid: string;\n\n  constructor(agent: Web5Agent, connectedDid: string) {\n    this.#agent = agent;\n    this.#connectedDid = connectedDid;\n  }\n\n  async create() {\n    // TODO: implement\n    throw new Error('Not implemented.');\n  }\n}", "import type { Web5Agent } from '@tbd54566975/web5-agent';\nimport type {\n  UnionMessageReply,\n  RecordsReadOptions,\n  RecordsQueryOptions,\n  RecordsWriteMessage,\n  RecordsWriteOptions,\n  RecordsDeleteOptions,\n  ProtocolsQueryOptions,\n  RecordsQueryReplyEntry,\n  ProtocolsConfigureMessage,\n  ProtocolsConfigureOptions,\n  ProtocolsConfigureDescriptor,\n} from '@tbd54566975/dwn-sdk-js';\n\nimport { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js';\n\nimport { Record } from './record.js';\nimport { Protocol } from './protocol.js';\nimport { dataToBlob, isEmptyObject } from './utils.js';\n\nexport type ProtocolsConfigureRequest = {\n  message: Omit<ProtocolsConfigureOptions, 'authorizationSignatureInput'>;\n}\n\nexport type ProtocolsConfigureResponse = {\n  status: UnionMessageReply['status'];\n  protocol?: Protocol;\n}\n\nexport type ProtocolsQueryReplyEntry = {\n  descriptor: ProtocolsConfigureDescriptor;\n};\n\nexport type ProtocolsQueryRequest = {\n  from?: string;\n  message: Omit<ProtocolsQueryOptions, 'authorizationSignatureInput'>\n}\n\nexport type ProtocolsQueryResponse = {\n  protocols: Protocol[];\n  status: UnionMessageReply['status'];\n}\n\nexport type RecordsCreateRequest = RecordsWriteRequest;\n\nexport type RecordsCreateResponse = RecordsWriteResponse;\n\nexport type RecordsCreateFromRequest = {\n  author: string;\n  data: unknown;\n  message?: Omit<RecordsWriteOptions, 'authorizationSignatureInput'>;\n  record: Record;\n}\n\nexport type RecordsDeleteRequest = {\n  from?: string;\n  message: Omit<RecordsDeleteOptions, 'authorizationSignatureInput'>;\n}\n\nexport type RecordsDeleteResponse = {\n  status: UnionMessageReply['status'];\n};\n\nexport type RecordsQueryRequest = {\n  /** The from property indicates the DID to query from and return results. */\n  from?: string;\n  message: Omit<RecordsQueryOptions, 'authorizationSignatureInput'>;\n}\n\nexport type RecordsQueryResponse = {\n  status: UnionMessageReply['status'];\n  records?: Record[]\n};\n\nexport type RecordsReadRequest = {\n  /** The from property indicates the DID to read from and return results fro. */\n  from?: string;\n  message: Omit<RecordsReadOptions, 'authorizationSignatureInput'>;\n}\n\nexport type RecordsReadResponse = {\n  status: UnionMessageReply['status'];\n  record: Record;\n};\n\nexport type RecordsWriteRequest = {\n  data: unknown;\n  message?: Omit<Partial<RecordsWriteOptions>, 'authorizationSignatureInput'>;\n  store?: boolean;\n}\n\nexport type RecordsWriteResponse = {\n  status: UnionMessageReply['status'];\n  record?: Record\n};\n\n/**\n * TODO: Document class.\n */\nexport class DwnApi {\n  constructor(private web5Agent: Web5Agent, private connectedDid: string) {}\n\n  /**\n * TODO: Document namespace.\n */\n  get protocols() {\n    return {\n      /**\n       * TODO: Document method.\n       */\n      configure: async (request: ProtocolsConfigureRequest): Promise<ProtocolsConfigureResponse> => {\n        const agentResponse = await this.web5Agent.processDwnRequest({\n          target         : this.connectedDid,\n          author         : this.connectedDid,\n          messageOptions : request.message,\n          messageType    : DwnInterfaceName.Protocols + DwnMethodName.Configure\n        });\n\n        const { message, messageCid, reply: { status }} = agentResponse;\n        const response: ProtocolsConfigureResponse = { status };\n\n        if (status.code < 300) {\n          const metadata = { author: this.connectedDid, messageCid };\n          response.protocol = new Protocol(this.web5Agent, message as ProtocolsConfigureMessage, metadata);\n        }\n\n        return response;\n      },\n\n      /**\n       * TODO: Document method.\n       */\n      query: async (request: ProtocolsQueryRequest): Promise<ProtocolsQueryResponse> => {\n        const agentResponse = await this.web5Agent.processDwnRequest({\n          author         : this.connectedDid,\n          messageOptions : request.message,\n          messageType    : DwnInterfaceName.Protocols + DwnMethodName.Query,\n          target         : this.connectedDid\n        });\n\n        const { reply: { entries, status } } = agentResponse;\n        // const protocols = entries as ProtocolsQueryReplyEntry[];\n\n        const protocols = entries.map((entry: ProtocolsQueryReplyEntry) => {\n          const metadata = { author: this.connectedDid, };\n\n          return new Protocol(this.web5Agent, entry, metadata);\n        });\n\n        return { protocols, status };\n      }\n    };\n  }\n\n  /**\n   * TODO: Document namespace.\n   */\n  get records() {\n    return {\n      /**\n       * TODO: Document method.\n       */\n      create: async (request: RecordsCreateRequest): Promise<RecordsCreateResponse> => {\n        return this.records.write(request);\n      },\n\n      /**\n       * TODO: Document method.\n       */\n      createFrom: async (request: RecordsCreateFromRequest): Promise<RecordsWriteResponse> => {\n        const { author: inheritedAuthor, ...inheritedProperties } = request.record.toJSON();\n\n        // Remove target from inherited properties since target is being explicitly defined in method parameters.\n        delete inheritedProperties.target;\n\n\n        // If `data` is being updated then `dataCid` and `dataSize` must not be present.\n        if (request.data !== undefined) {\n          delete inheritedProperties.dataCid;\n          delete inheritedProperties.dataSize;\n        }\n\n        // If `published` is set to false, ensure that `datePublished` is undefined. Otherwise, DWN SDK's schema validation\n        // will throw an error if `published` is false but `datePublished` is set.\n        if (request.message?.published === false && inheritedProperties.datePublished !== undefined) {\n          delete inheritedProperties.datePublished;\n          delete inheritedProperties.published;\n        }\n\n        // If the request changes the `author` or message `descriptor` then the deterministic `recordId` will change.\n        // As a result, we will discard the `recordId` if either of these changes occur.\n        if (!isEmptyObject(request.message) || (request.author && request.author !== inheritedAuthor)) {\n          delete inheritedProperties.recordId;\n        }\n\n        return this.records.write({\n          data    : request.data,\n          message : {\n            ...inheritedProperties,\n            ...request.message,\n          },\n        });\n      },\n\n      /**\n       * TODO: Document method.\n       */\n      delete: async (request: RecordsDeleteRequest): Promise<RecordsDeleteResponse> => {\n        const agentRequest = {\n          author         : this.connectedDid,\n          messageOptions : request.message,\n          messageType    : DwnInterfaceName.Records + DwnMethodName.Delete,\n          target         : request.from || this.connectedDid\n        };\n\n        let agentResponse;\n\n        if (request.from) {\n          agentResponse = await this.web5Agent.sendDwnRequest(agentRequest);\n        } else {\n          agentResponse = await this.web5Agent.processDwnRequest(agentRequest);\n        }\n\n        //! TODO: (Frank -> Moe): This quirk is the result of how 4XX errors are being returned by `dwn-server`\n        //!                       When DWN SDK returns 404, agentResponse is { status: { code: 404 }} and that's it.\n        //!                       Need to decide how to resolve.\n        let status;\n        if (agentResponse.reply) {\n          ({ reply: { status } } = agentResponse);\n        } else {\n          ({ status } = agentResponse);\n        }\n\n        return { status };\n      },\n\n      /**\n       * TODO: Document method.\n       */\n      query: async (request: RecordsQueryRequest): Promise<RecordsQueryResponse> => {\n        const agentRequest = {\n          author         : this.connectedDid,\n          messageOptions : request.message,\n          messageType    : DwnInterfaceName.Records + DwnMethodName.Query,\n          target         : request.from || this.connectedDid\n        };\n\n        let agentResponse;\n\n        if (request.from) {\n          agentResponse = await this.web5Agent.sendDwnRequest(agentRequest);\n        } else {\n          agentResponse = await this.web5Agent.processDwnRequest(agentRequest);\n        }\n\n        const { reply: { entries, status } } = agentResponse;\n\n        const records = entries.map((entry: RecordsQueryReplyEntry) => {\n          const recordOptions = {\n            author : this.connectedDid,\n            target : this.connectedDid,\n            ...entry as RecordsWriteMessage\n          };\n          const record = new Record(this.web5Agent, recordOptions);\n          return record;\n        });\n\n        return { records, status };\n      },\n\n      /**\n       * TODO: Document method.\n       */\n      read: async (request: RecordsReadRequest): Promise<RecordsReadResponse> => {\n        const agentRequest = {\n          author         : this.connectedDid,\n          messageOptions : request.message,\n          messageType    : DwnInterfaceName.Records + DwnMethodName.Read,\n          target         : request.from || this.connectedDid\n        };\n\n        let agentResponse;\n\n        if (request.from) {\n          agentResponse = await this.web5Agent.sendDwnRequest(agentRequest);\n        } else {\n          agentResponse = await this.web5Agent.processDwnRequest(agentRequest);\n        }\n\n        //! TODO: (Frank -> Moe): This quirk is the result of how 4XX errors are being returned by `dwn-server`\n        //!                       When DWN SDK returns 404, agentResponse is { status: { code: 404 }} and that's it.\n        //!                       Need to decide how to resolve.\n        let responseRecord;\n        let status;\n        if (agentResponse.reply) {\n          ({ reply: { record: responseRecord, status } } = agentResponse);\n        } else {\n          ({ status } = agentResponse);\n        }\n\n        let record: Record;\n        if (200 <= status.code && status.code <= 299) {\n          const recordOptions = {\n            author : this.connectedDid,\n            target : this.connectedDid,\n            ...responseRecord,\n          };\n\n          record = new Record(this.web5Agent, recordOptions);\n        }\n\n        return { record, status };\n      },\n\n      /**\n       * TODO: Document method.\n       *\n       * As a convenience, the Record instance returned will cache a copy of the data if the\n       * data size, in bytes, is less than the DWN 'max data size allowed to be encoded'\n       * parameter of 10KB. This is done to maintain consistency with other DWN methods,\n       * like RecordsQuery, that include relatively small data payloads when returning\n       * RecordsWrite message properties. Regardless of data size, methods such as\n       * `record.data.stream()` will return the data when called even if it requires fetching\n       * from the DWN datastore.\n       */\n      write: async (request: RecordsWriteRequest): Promise<RecordsWriteResponse> => {\n        const messageOptions: Partial<RecordsWriteOptions> = {\n          ...request.message\n        };\n\n        const { dataBlob, dataFormat } = dataToBlob(request.data, messageOptions.dataFormat);\n        messageOptions.dataFormat = dataFormat;\n\n        const agentResponse = await this.web5Agent.processDwnRequest({\n          author      : this.connectedDid,\n          dataStream  : dataBlob,\n          messageOptions,\n          messageType : DwnInterfaceName.Records + DwnMethodName.Write,\n          store       : request.store,\n          target      : this.connectedDid\n        });\n\n        const { message, reply: { status } } = agentResponse;\n        const responseMessage = message as RecordsWriteMessage;\n\n        let record: Record;\n        if (200 <= status.code && status.code <= 299) {\n          const recordOptions = {\n            author      : this.connectedDid,\n            encodedData : dataBlob,\n            target      : this.connectedDid,\n            ...responseMessage,\n          };\n\n          record = new Record(this.web5Agent, recordOptions);\n        }\n\n        return { record, status };\n      },\n    };\n  }\n}", "import type { Readable } from 'readable-stream';\nimport type { Web5Agent } from '@tbd54566975/web5-agent';\nimport type { RecordsReadReply, RecordsWriteDescriptor, RecordsWriteMessage, RecordsWriteOptions } from '@tbd54566975/dwn-sdk-js';\n\nimport { ReadableWebToNodeStream } from 'readable-web-to-node-stream';\nimport { DataStream, DwnInterfaceName, DwnMethodName, Encoder } from '@tbd54566975/dwn-sdk-js';\n\nimport { dataToBlob } from './utils.js';\nimport type { RecordsDeleteResponse } from './dwn-api.js';\n\nexport type RecordOptions = RecordsWriteMessage & {\n  author: string;\n  target: string;\n  encodedData?: string | Blob;\n  data?: Readable | ReadableStream;\n};\n\nexport type RecordModel = RecordsWriteDescriptor & Omit<RecordsWriteMessage, 'descriptor' | 'recordId'> & {\n  author: string;\n  recordId?: string;\n  target: string;\n}\n\nexport type RecordUpdateOptions = {\n  data?: unknown;\n  dataCid?: RecordsWriteDescriptor['dataCid'];\n  dataSize?: RecordsWriteDescriptor['dataSize'];\n  dateModified?: RecordsWriteDescriptor['dateModified'];\n  datePublished?: RecordsWriteDescriptor['datePublished'];\n  published?: RecordsWriteDescriptor['published'];\n}\n\n/**\n   * TODO: Document class.\n   */\nexport class Record implements RecordModel {\n  // mutable properties\n  author: string;\n  target: string;\n  isDeleted = false;\n\n  #attestation?: RecordsWriteMessage['attestation'];\n  #contextId?: string;\n  #descriptor: RecordsWriteDescriptor;\n  #encodedData?: string | Blob | null;\n  #encryption?: RecordsWriteMessage['encryption'];\n  #readableStream?: Readable | Promise<Readable>;\n  #recordId: string;\n  #web5Agent: Web5Agent;\n\n  // Immutable DWN Record properties.\n  get attestation(): RecordsWriteMessage['attestation'] { return this.#attestation; }\n  get contextId() { return this.#contextId; }\n  get dataFormat() { return this.#descriptor.dataFormat; }\n  get dateCreated() { return this.#descriptor.dateCreated; }\n  get encryption(): RecordsWriteMessage['encryption'] { return this.#encryption; }\n  get id() { return this.#recordId; }\n  get interface() { return this.#descriptor.interface; }\n  get method() { return this.#descriptor.method; }\n  get parentId() { return this.#descriptor.parentId; }\n  get protocol() { return this.#descriptor.protocol; }\n  get protocolPath() { return this.#descriptor.protocolPath; }\n  get recipient() { return this.#descriptor.recipient; }\n  get schema() { return this.#descriptor.schema; }\n\n  // Mutable DWN Record properties.\n  get dataCid() { return this.#descriptor.dataCid; }\n  get dataSize() { return this.#descriptor.dataSize; }\n  get dateModified() { return this.#descriptor.dateModified; }\n  get datePublished() { return this.#descriptor.datePublished; }\n  get published() { return this.#descriptor.published; }\n\n  constructor(web5Agent: Web5Agent, options: RecordOptions) {\n    this.#web5Agent = web5Agent;\n\n    // Store the target and author DIDs that were used to create the message to use for subsequent reads, etc.\n    this.author = options.author;\n    this.target = options.target;\n\n    // RecordsWriteMessage properties.\n    this.#attestation = options.attestation;\n    this.#contextId = options.contextId;\n    this.#descriptor = options.descriptor;\n    this.#encryption = options.encryption;\n    this.#recordId = options.recordId;\n\n\n    // options.encodedData will either be a base64url encoded string (in the case of RecordsQuery)\n    // OR a Blob in the case of a RecordsWrite.\n    this.#encodedData = options.encodedData ?? null;\n\n    // If the record was created from a RecordsRead reply then it will have a `data` property.\n    if (options.data) {\n      this.#readableStream = Record.isReadableWebStream(options.data) ?\n        new ReadableWebToNodeStream(<ReadableStream>options.data) as Readable : options.data as Readable;\n    }\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  get data() {\n    if (this.isDeleted) throw new Error('Operation failed: Attempted to access `data` of a record that has already been deleted.');\n\n    if (!this.#encodedData && !this.#readableStream) {\n      // `encodedData` will be set if the Record was instantiated by dwn.records.create()/write().\n      // `readableStream` will be set if Record was instantiated by dwn.records.read().\n      // If neither of the above are true, then the record must be fetched from the DWN.\n      this.#readableStream = this.#web5Agent.processDwnRequest({\n        author         : this.author,\n        messageOptions : { recordId: this.id },\n        messageType    : DwnInterfaceName.Records + DwnMethodName.Read,\n        target         : this.target,\n      })\n        .then(response => response.reply as RecordsReadReply)\n        .then(reply => reply.record.data as Readable)\n        .catch(error => { throw new Error(`Error encountered while attempting to read data: ${error.message}`); });\n    }\n\n    if (typeof this.#encodedData === 'string') {\n      // If `encodedData` is set, then it is expected that:\n      // type is Blob if the Record object was instantiated by dwn.records.create()/write().\n      // type is Base64 URL encoded string if the Record object was instantiated by dwn.records.query().\n      // If it is a string, we need to Base64 URL decode to bytes and instantiate a Blob.\n      const dataBytes = Encoder.base64UrlToBytes(this.#encodedData);\n      this.#encodedData = new Blob([dataBytes], { type: this.dataFormat });\n    }\n\n    // Explicitly cast #encodedData as a Blob since if non-null, it has been converted from string to Blob.\n    const dataBlob = this.#encodedData as Blob;\n\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\n    const self = this; // Capture the context of the `Record` instance.\n    const dataObj = {\n      async blob(): Promise<Blob> {\n        if (dataBlob) return dataBlob;\n        if (self.#readableStream) return new Blob([await this.stream().then(DataStream.toBytes)], { type: self.dataFormat });\n      },\n      async json() {\n        if (dataBlob) return this.text().then(JSON.parse);\n        if (self.#readableStream) return this.text().then(JSON.parse);\n        return null;\n      },\n      async text() {\n        if (dataBlob) return dataBlob.text();\n        if (self.#readableStream) return this.stream().then(DataStream.toBytes).then(Encoder.bytesToString);\n        return null;\n      },\n      async stream() {\n        if (dataBlob) return new ReadableWebToNodeStream(dataBlob.stream());\n        if (self.#readableStream) return self.#readableStream;\n        return null;\n      },\n      then(...callbacks) {\n        return this.stream().then(...callbacks);\n      },\n      catch(callback) {\n        return dataObj.then().catch(callback);\n      },\n    };\n    return dataObj;\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  async delete(): Promise<RecordsDeleteResponse> {\n    if (this.isDeleted) throw new Error('Operation failed: Attempted to call `delete()` on a record that has already been deleted.');\n\n    // Attempt to delete the record from the DWN.\n    const agentResponse = await this.#web5Agent.processDwnRequest({\n      author         : this.author,\n      messageOptions : { recordId: this.id },\n      messageType    : DwnInterfaceName.Records + DwnMethodName.Delete,\n      target         : this.target,\n    });\n\n    const { reply: { status } } = agentResponse;\n\n    if (status.code === 202) {\n      // If the record was successfully deleted, mark the instance as deleted to prevent further modifications.\n      this.#setDeletedStatus(true);\n    }\n\n    return { status };\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  async send(target: string): Promise<any> {\n    if (this.isDeleted) throw new Error('Operation failed: Attempted to call `send()` on a record that has already been deleted.');\n\n    const { reply: { status } } = await this.#web5Agent.sendDwnRequest({\n      messageType    : DwnInterfaceName.Records + DwnMethodName.Write,\n      author         : this.author,\n      dataStream     : await this.data.blob(),\n      target         : target,\n      messageOptions : this.toJSON(),\n    });\n\n    return { status };\n  }\n\n  /**\n   * TODO: Document method.\n   *\n   * Called by `JSON.stringify(...)` automatically.\n   */\n  toJSON(): RecordModel {\n    return {\n      attestation   : this.attestation,\n      author        : this.author,\n      contextId     : this.contextId,\n      dataCid       : this.dataCid,\n      dataFormat    : this.dataFormat,\n      dataSize      : this.dataSize,\n      dateCreated   : this.dateCreated,\n      dateModified  : this.dateModified,\n      datePublished : this.datePublished,\n      encryption    : this.encryption,\n      interface     : this.interface,\n      method        : this.method,\n      parentId      : this.parentId,\n      protocol      : this.protocol,\n      protocolPath  : this.protocolPath,\n      published     : this.published,\n      recipient     : this.recipient,\n      recordId      : this.id,\n      schema        : this.schema,\n      target        : this.target,\n    };\n  }\n\n  /**\n   * TODO: Document method.\n   *\n   * Called automatically in string concatenation, String() type conversion, and template literals.\n   */\n  toString() {\n    let str = `Record: {\\n`;\n    str += `  ID: ${this.id}\\n`;\n    str += this.contextId ? `  Context ID: ${this.contextId}\\n` : '';\n    str += this.protocol ? `  Protocol: ${this.protocol}\\n` : '';\n    str += this.schema ? `  Schema: ${this.schema}\\n` : '';\n    str += `  Data CID: ${this.dataCid}\\n`;\n    str += `  Data Format: ${this.dataFormat}\\n`;\n    str += `  Data Size: ${this.dataSize}\\n`;\n    str += `  Created: ${this.dateCreated}\\n`;\n    str += `  Modified: ${this.dateModified}\\n`;\n    str += `}`;\n    return str;\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  async update(options: RecordUpdateOptions = {}) {\n    if (this.isDeleted) throw new Error('Operation failed: Attempted to call `update()` on a record that has already been deleted.');\n\n    // Begin assembling update message.\n    let updateMessage = { ...this.#descriptor, ...options } as Partial<RecordsWriteOptions>;\n\n    let dataBlob: Blob;\n    if (options.data !== undefined) {\n      // If `data` is being updated then `dataCid` and `dataSize` must be undefined and the `data` property is passed as\n      // a top-level property to `web5Agent.processDwnRequest()`.\n      delete updateMessage.dataCid;\n      delete updateMessage.dataSize;\n      delete updateMessage.data;\n\n      ({ dataBlob } = dataToBlob(options.data, updateMessage.dataFormat));\n    }\n\n    // Throw an error if an attempt is made to modify immutable properties. `data` has already been handled.\n    const mutableDescriptorProperties = new Set(['data', 'dataCid', 'dataSize', 'dateModified', 'datePublished', 'published']);\n    Record.#verifyPermittedMutation(Object.keys(options), mutableDescriptorProperties);\n\n    // If a new `dateModified` was not provided, remove it from the updateMessage to let the DWN SDK auto-fill.\n    // This is necessary because otherwise DWN SDK throws an Error 409 Conflict due to attempting to overwrite a record\n    // when the `dateModified` timestamps are identical.\n    if (options.dateModified === undefined) {\n      delete updateMessage.dateModified;\n    }\n\n    // If `published` is set to false, ensure that `datePublished` is undefined. Otherwise, DWN SDK's schema validation\n    // will throw an error if `published` is false but `datePublished` is set.\n    if (options.published === false && updateMessage.datePublished !== undefined) {\n      delete updateMessage.datePublished;\n    }\n\n    // Set the record ID and context ID, if any.\n    updateMessage.recordId = this.#recordId;\n    updateMessage.contextId = this.#contextId;\n\n    const messageOptions: Partial<RecordsWriteOptions> = {\n      ...updateMessage\n    };\n\n    const agentResponse = await this.#web5Agent.processDwnRequest({\n      author      : this.author,\n      dataStream  : dataBlob,\n      messageOptions,\n      messageType : DwnInterfaceName.Records + DwnMethodName.Write,\n      target      : this.target,\n    });\n\n    const { message, reply: { status } } = agentResponse;\n    const responseMessage = message as RecordsWriteMessage;\n\n    if (200 <= status.code && status.code <= 299) {\n      // Only update the local Record instance mutable properties if the record was successfully (over)written.\n      mutableDescriptorProperties.forEach(property => {\n        this.#descriptor[property] = responseMessage.descriptor[property];\n      });\n      // Only cache data if `dataSize` is less than DWN 'max data size allowed to be encoded'.\n      if (options.data !== undefined) {\n        this.#encodedData = dataBlob; // Clear `encodedData` in case it was previously set.\n      }\n    }\n\n    return { status };\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  #setDeletedStatus(status: boolean): void {\n    this.isDeleted = status;\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  static isReadableWebStream(stream) {\n    // TODO: Improve robustness of the check modeled after node:stream.\n    return typeof stream._read !== 'function';\n  }\n\n  /**\n   * TODO: Document method.\n   */\n  static #verifyPermittedMutation(propertiesToMutate: Iterable<string>, mutableDescriptorProperties: Set<string>) {\n    for (const property of propertiesToMutate) {\n      if (!mutableDescriptorProperties.has(property)) {\n        throw new Error(`${property} is an immutable property. Its value cannot be changed.`);\n      }\n    }\n  }\n}", "import { DwnConstant, Encoder } from '@tbd54566975/dwn-sdk-js';\n\nconst textDecoder = new TextDecoder();\n\n// TODO: Remove if this method is ever added to the DWN SDK Encoder class\nexport function base64UrlToString(base64urlString) {\n  const bytes = Encoder.base64UrlToBytes(base64urlString);\n  return Encoder.bytesToString(bytes);\n}\n\n// TODO: Remove if this method is ever added to the DWN SDK Encoder class\nexport function bytesToObject(bytes) {\n  const objectString = textDecoder.decode(bytes);\n  return JSON.parse(objectString);\n}\n\n/**\n * Checks if the provided data size is under the cache limit.\n * The cache limit is based on the maxDataSizeAllowedToBeEncoded defined in the DWN SDK.\n *\n * @export\n * @param {number} dataSize - The size of the data to be checked, in bytes.\n * @returns {boolean} True if the data size is less than or equal to the maximum allowed data size, false otherwise.\n *\n * @example\n * // Returns: true\n * isDataSizeUnderCacheLimit(5000);\n *\n * @example\n * // Returns: false\n * isDataSizeUnderCacheLimit(15000);\n */\nexport function isDataSizeUnderCacheLimit(dataSize: number): boolean {\n  return dataSize <= DwnConstant.maxDataSizeAllowedToBeEncoded;\n}\n\n/**\n * Set/detect the media type and return the data as bytes.\n */\nexport const dataToBlob = (data: any, dataFormat?: string) => {\n  let dataBlob: Blob;\n\n  // Check for Object or String, and if neither, assume bytes.\n  const detectedType = toType(data);\n  if (dataFormat === 'text/plain' || detectedType === 'string') {\n    dataBlob = new Blob([data], { type: 'text/plain' });\n  } else if (dataFormat === 'application/json' || detectedType === 'object') {\n    const dataBytes = Encoder.objectToBytes(data);\n    dataBlob = new Blob([dataBytes], { type: 'application/json' });\n  } else if (data instanceof Uint8Array || data instanceof ArrayBuffer) {\n    dataBlob = new Blob([data], { type: 'application/octet-stream' });\n  } else if (data instanceof Blob) {\n    dataBlob = data;\n  } else {\n    throw new Error('data type not supported.');\n  }\n\n  dataFormat = dataFormat || dataBlob.type || 'application/octet-stream';\n\n  return { dataBlob, dataFormat };\n};\n\nexport function isEmptyObject(obj) {\n  if (typeof obj === 'object' && obj !== null) {\n    return Object.keys(obj).length === 0;\n  }\n  return false;\n}\n\n/**\n * Simplistic initial implementation to check whether messages that are being routed\n * to process locally or be transported to a remote DWN are already signed.\n *\n * TODO: Consider whether cryptographic signature verification is warranted or if\n *       the naive check is sufficient given that DWNs already verify authenticity\n *       and integrity of every message.\n * @param {{}} message\n * @returns boolean\n */\nexport function isUnsignedMessage(message) {\n  return message?.message?.authorization ? false : true;\n}\n\nexport function objectValuesBase64UrlToBytes(obj) {\n  return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, Encoder.base64UrlToBytes(value as string)]));\n}\n\nexport function objectValuesBytesToBase64Url(obj) {\n  return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, Encoder.bytesToBase64Url(value as Uint8Array)]));\n}\n\nexport function parseJson(str) {\n  try {\n    return JSON.parse(str);\n  } catch {\n    return null;\n  }\n}\n\nexport function parseUrl(str) {\n  try {\n    return new URL(str);\n  } catch {\n    return null;\n  }\n}\n\nexport function pascalToKebabCase(str) {\n  return str\n    .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n    .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n    .toLowerCase();\n}\n\nexport function getRandomInt(min, max) {\n  min = Math.ceil(min);\n  max = Math.floor(max);\n  return Math.floor(Math.random() * (max - min)) + min;\n}\n\n/**\n * Credit for toType() function:\n *   Angus Croll\n *   https://github.com/angus-c\n *   https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/\n */\nconst toType = (obj) => {\n  return ({}).toString.call(obj).match(/\\s([a-zA-Z]+)/)[1].toLowerCase();\n};", "import type { Web5Agent } from '@tbd54566975/web5-agent';\nimport type { ProtocolsConfigure } from '@tbd54566975/dwn-sdk-js';\n\n// TODO: export ProtocolsConfigureMessage from dwn-sdk-js\nexport type ProtocolsConfigureMessage = ProtocolsConfigure['message'];\ntype ProtocolMetadata = {\n  author: string;\n  messageCid?: string;\n};\n\nexport class Protocol {\n  #metadata: ProtocolMetadata;\n  #web5Agent: Web5Agent;\n  #protocolsConfigureMessage: ProtocolsConfigureMessage;\n\n  get definition() {\n    return this.#protocolsConfigureMessage.descriptor.definition;\n  }\n\n  constructor(web5Agent: Web5Agent, protocolsConfigureMessage: ProtocolsConfigureMessage, metadata: ProtocolMetadata) {\n    this.#metadata = metadata;\n    this.#web5Agent = web5Agent;\n    this.#protocolsConfigureMessage = protocolsConfigureMessage;\n  }\n\n  toJSON() {\n    return this.#protocolsConfigureMessage;\n  }\n\n  async send(target: string) {\n    const { reply } = await this.#web5Agent.sendDwnRequest({\n      messageType : 'ProtocolsConfigure',\n      author      : this.#metadata.author,\n      target      : target,\n      messageCid  : this.#metadata.messageCid\n    });\n\n    return { status: reply.status };\n  }\n}", "import type {\n  DidKeyOptions,\n  DidIonCreateOptions,\n  DidMethodApi,\n  DidMethodCreator,\n  DidMethodResolver,\n  DidResolverCache,\n  DidResolutionResult,\n  DidState\n} from '@tbd54566975/dids';\n\n\nimport { DidResolver } from '@tbd54566975/dids';\n\n// Map method names to option types\ntype CreateMethodOptions = {\n  ion: DidIonCreateOptions;\n  key: DidKeyOptions;\n};\n\n// A conditional type for inferring options based on the method name\ntype CreateOptions<M extends keyof CreateMethodOptions> = CreateMethodOptions[M];\n\nexport type DidApiOptions = {\n  didMethodApis: DidMethodApi[];\n  cache?: DidResolverCache;\n}\nexport class DidApi {\n  private didResolver: DidResolver;\n  private methodCreatorMap: Map<string, DidMethodCreator> = new Map();\n\n  /**\n   * returns the DID resolver created by this api. useful in scenarios where you want to pass around\n   * the same resolver so that you can leverage the resolver's cache\n   */\n  get resolver() {\n    return this.didResolver;\n  }\n\n  constructor(options: DidApiOptions) {\n    const { didMethodApis, cache } = options;\n\n    this.didResolver = new DidResolver({ methodResolvers: options.didMethodApis, cache });\n\n    for (let methodApi of didMethodApis) {\n      this.methodCreatorMap.set(methodApi.methodName, methodApi);\n    }\n  }\n\n  /**\n   * Creates a DID of the method provided\n   * @param method - the method of DID to create\n   * @param options - method-specific options\n   * @returns the created DID\n   */\n  create<M extends keyof CreateMethodOptions>(method: M, options?: CreateOptions<M>): Promise<DidState> {\n    const didMethodCreator = this.methodCreatorMap.get(method);\n    if (!didMethodCreator) {\n      throw new Error(`no creator available for ${method}`);\n    }\n\n    return didMethodCreator.create(options);\n  }\n\n  /**\n   * Resolves the provided DID\n   * @param did - the did to resolve\n   * @see {@link https://www.w3.org/TR/did-core/#did-resolution | DID Resolution}\n   * @returns DID Resolution Result\n   */\n  resolve(did: string): Promise<DidResolutionResult> {\n    return this.didResolver.resolve(did);\n  }\n\n  /**\n   * can be used to add different did method resolvers\n   * @param _resolver\n   */\n  addMethodResolver(_resolver: DidMethodResolver) {\n    throw new Error('not yet implemented');\n  }\n\n  /**\n   * can be used to add differed did method creators\n   * @param _creator\n   */\n  addMethodCreator(_creator: DidMethodCreator) {\n    throw new Error('not yet implemented');\n  }\n}", "import { Level } from 'level';\n\n// simple isomorphic key/value store\n// TODO: create KeyValueStore interface that this class implements\nexport class AppStorage {\n  private store: Level<string, string>;\n\n  constructor(location = 'data/app/storage') {\n    this.store = new Level(location);\n  }\n\n  async get(key: string): Promise<string | undefined> {\n    try {\n      return await this.store.get(key);\n    } catch(e: any) {\n      if (e.code === 'LEVEL_NOT_FOUND') {\n        return;\n      } else {\n        throw e;\n      }\n    }\n  }\n\n  set(key: string, value: string): Promise<void> {\n    return this.store.put(key, value);\n  }\n\n  async delete(key: string): Promise<void> {\n    return this.store.del(key);\n  }\n\n  async clear(): Promise<void> {\n    return this.store.clear();\n  }\n\n  async close(): Promise<void> {\n    return this.store.close();\n  }\n}", "import type { DidResolutionResult, DidResolverCache } from '@tbd54566975/dids';\n\nimport ms from 'ms';\nimport { Level } from 'level';\n\nexport type DidResolutionCacheOptions = {\n  location?: string;\n  ttl?: string;\n}\n\ntype CacheWrapper = {\n  ttlMillis: number;\n  value: DidResolutionResult;\n}\n\n/**\n * naive level-based cache for did resolution results. It just so happens that level aggressively keeps as much as it\n * can in memory when possible while also writing to the filesystem (in node runtime) and indexedDB (in browser runtime).\n * the persistent aspect is especially useful across page refreshes.\n */\nexport class DidResolutionCache implements DidResolverCache {\n  private cache: Level<string, string>;\n  private ttl: number;\n\n  static #defaultOptions = {\n    location : 'data/did-res-cache',\n    ttl      : '15m'\n  };\n\n  constructor(options: DidResolutionCacheOptions = {}) {\n    options = { ...DidResolutionCache.#defaultOptions, ...options };\n\n    this.cache = new Level(options.location!);\n    this.ttl = ms(options.ttl!);\n  }\n\n  async get(did: string): Promise<DidResolutionResult | void> {\n    try {\n      const str = await this.cache.get(did);\n      const cacheWrapper: CacheWrapper = JSON.parse(str);\n\n      if (Date.now() >= cacheWrapper.ttlMillis) {\n        // defer deletion to be called in the next tick of the js event loop\n        this.cache.nextTick(() => this.cache.del(did));\n\n        return;\n      } else {\n        return cacheWrapper.value;\n      }\n\n\n    } catch(e: any) {\n      // thrown when a key wasn't found\n      if (e.code === 'LEVEL_NOT_FOUND') {\n        return;\n      }\n\n      throw e;\n    }\n  }\n  set(did: string, value: DidResolutionResult): Promise<void> {\n    const cacheWrapper: CacheWrapper = { ttlMillis: Date.now() + this.ttl, value };\n    const str = JSON.stringify(cacheWrapper);\n\n    return this.cache.put(did, str);\n  }\n  delete(did: string): Promise<void> {\n    return this.cache.del(did);\n  }\n  clear(): Promise<void> {\n    return this.cache.clear();\n  }\n  close(): Promise<void> {\n    return this.cache.close();\n  }\n\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,IAAAA,aAAe;AAGf,IAAAC,qBAAoB;AACpB,6BAAmD;AACnD,IAAAC,eAAwD;;;ACTxD;AAEO,IAAM,QAAN,MAAY;AAAA,EAIjB,YAAY,OAAkB,cAAsB;AAHpD;AACA;AAGE,uBAAK,QAAS;AACd,uBAAK,eAAgB;AAAA,EACvB;AAAA,EAEM,SAAS;AAAA;AAEb,YAAM,IAAI,MAAM,kBAAkB;AAAA,IACpC;AAAA;AACF;AAZE;AACA;;;ACWF,IAAAC,qBAAgD;;;ACXhD,yCAAwC;AACxC,IAAAC,qBAAqE;;;ACLrE,wBAAqC;AAErC,IAAM,cAAc,IAAI,YAAY;AAqC7B,IAAM,aAAa,CAAC,MAAW,eAAwB;AAC5D,MAAI;AAGJ,QAAM,eAAe,OAAO,IAAI;AAChC,MAAI,eAAe,gBAAgB,iBAAiB,UAAU;AAC5D,eAAW,IAAI,KAAK,CAAC,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAAA,EACpD,WAAW,eAAe,sBAAsB,iBAAiB,UAAU;AACzE,UAAM,YAAY,0BAAQ,cAAc,IAAI;AAC5C,eAAW,IAAI,KAAK,CAAC,SAAS,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAAA,EAC/D,WAAW,gBAAgB,cAAc,gBAA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