{"version":3,"file":"in_memory.cjs","names":["BaseEntityStore"],"sources":["../../../../src/memory/stores/entity/in_memory.ts"],"sourcesContent":["import { BaseEntityStore } from \"./base.js\";\n\n/**\n * An entity store that keeps data in memory. It extends from the\n * `BaseEntityStore` class and is used to store and manage entities.\n */\nexport class InMemoryEntityStore extends BaseEntityStore {\n  lc_namespace = [\"langchain\", \"stores\", \"entity\", \"in_memory\"];\n\n  private store: Record<string, string | undefined>;\n\n  constructor() {\n    super();\n    this.store = Object.create(null);\n  }\n\n  /**\n   * Retrieves the value associated with the given key from the store. If\n   * the key does not exist in the store, it returns the provided default\n   * value.\n   * @param key The key to retrieve the value for.\n   * @param defaultValue The default value to return if the key does not exist in the store.\n   * @returns The value associated with the key, or the default value if the key does not exist in the store.\n   */\n  async get(\n    key: string,\n    defaultValue: string | undefined\n  ): Promise<string | undefined> {\n    return key in this.store ? this.store[key] : defaultValue;\n  }\n\n  /**\n   * Sets the value associated with the given key in the store.\n   * @param key The key to set the value for.\n   * @param value The value to set.\n   */\n  async set(key: string, value: string | undefined): Promise<void> {\n    this.store[key] = value;\n  }\n\n  /**\n   * Removes the key and its associated value from the store.\n   * @param key The key to remove.\n   */\n  async delete(key: string): Promise<void> {\n    delete this.store[key];\n  }\n\n  /**\n   * Checks if a key exists in the store.\n   * @param key The key to check.\n   * @returns A boolean indicating whether the key exists in the store.\n   */\n  async exists(key: string): Promise<boolean> {\n    return key in this.store;\n  }\n\n  /**\n   * Removes all keys and their associated values from the store.\n   */\n  async clear(): Promise<void> {\n    this.store = Object.create(null);\n  }\n}\n"],"mappings":";;;;;;AAMA,IAAa,sBAAb,cAAyCA,aAAAA,gBAAgB;CACvD,eAAe;EAAC;EAAa;EAAU;EAAU;EAAY;CAE7D;CAEA,cAAc;AACZ,SAAO;AACP,OAAK,QAAQ,OAAO,OAAO,KAAK;;;;;;;;;;CAWlC,MAAM,IACJ,KACA,cAC6B;AAC7B,SAAO,OAAO,KAAK,QAAQ,KAAK,MAAM,OAAO;;;;;;;CAQ/C,MAAM,IAAI,KAAa,OAA0C;AAC/D,OAAK,MAAM,OAAO;;;;;;CAOpB,MAAM,OAAO,KAA4B;AACvC,SAAO,KAAK,MAAM;;;;;;;CAQpB,MAAM,OAAO,KAA+B;AAC1C,SAAO,OAAO,KAAK;;;;;CAMrB,MAAM,QAAuB;AAC3B,OAAK,QAAQ,OAAO,OAAO,KAAK"}