{"version":3,"sources":["../../src/session-store/firestore.ts"],"sourcesContent":["/**\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  FirestoreSessionStore as GcpFirestoreSessionStore,\n  type FirestoreSessionStoreOptions as GcpFirestoreSessionStoreOptions,\n} from '@genkit-ai/google-cloud/beta';\nimport { App } from 'firebase-admin/app';\nimport { getFirestore } from 'firebase-admin/firestore';\n\n/**\n * Options for {@link FirestoreSessionStore}.\n *\n * Extends the core {@link GcpFirestoreSessionStoreOptions} from\n * `@genkit-ai/google-cloud` with Firebase-specific app setup.\n */\nexport interface FirestoreSessionStoreOptions\n  extends GcpFirestoreSessionStoreOptions {\n  /** A Firebase app to derive the Firestore instance from. */\n  firebaseApp?: App;\n}\n\n/**\n * A Firestore-backed `SessionStore` for persisting agent session snapshots.\n *\n * This is a thin Firebase wrapper around the core implementation in\n * `@genkit-ai/google-cloud`; it adds the `firebaseApp` option (deriving the\n * Firestore instance from a Firebase app) and otherwise behaves identically.\n * See {@link GcpFirestoreSessionStore} for the storage layout and tuning\n * options (`collection`, `checkpointInterval`, `shardSize`).\n */\nexport class FirestoreSessionStore<\n  S = unknown,\n> extends GcpFirestoreSessionStore<S> {\n  constructor(opts?: FirestoreSessionStoreOptions) {\n    super({\n      ...opts,\n      db:\n        opts?.db ??\n        (opts?.firebaseApp ? getFirestore(opts.firebaseApp) : getFirestore()),\n    });\n  }\n}\n"],"mappings":"AAgBA;AAAA,EACE,yBAAyB;AAAA,OAEpB;AAEP,SAAS,oBAAoB;AAuBtB,MAAM,8BAEH,yBAA4B;AAAA,EACpC,YAAY,MAAqC;AAC/C,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,IACE,MAAM,OACL,MAAM,cAAc,aAAa,KAAK,WAAW,IAAI,aAAa;AAAA,IACvE,CAAC;AAAA,EACH;AACF;","names":[]}