1 line
No EOL
5.7 KiB
Text
1 line
No EOL
5.7 KiB
Text
{"version":3,"file":"index.cjs.js","sources":["../../../firestore/lite/document/index.ts","../../../firestore/lite/collection/index.ts","../../../firestore/lite/fromRef.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2018 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 */\nimport { map } from 'rxjs/operators';\nimport { from } from 'rxjs';\nimport { getDoc } from 'firebase/firestore/lite';\nexport function doc(ref) {\n return from(getDoc(ref));\n}\n/**\n * Returns a stream of a document, mapped to its data payload and optionally the document ID\n * @param query\n */\nexport function docData(ref, options) {\n if (options === void 0) { options = {}; }\n return doc(ref).pipe(map(function (snap) { return snapToData(snap, options); }));\n}\nexport function snapToData(snapshot, options) {\n if (options === void 0) { options = {}; }\n // TODO clean up the typings\n var data = snapshot.data();\n // match the behavior of the JS SDK when the snapshot doesn't exist\n // it's possible with data converters too that the user didn't return an object\n if (!snapshot.exists() || typeof data !== 'object' || data === null) {\n return data;\n }\n if (options.idField) {\n data[options.idField] = snapshot.id;\n }\n return data;\n}\n","/**\n * @license\n * Copyright 2023 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 */\nimport { from } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { snapToData } from '../document';\nimport { getDocs, getCount } from 'firebase/firestore/lite';\n/**\n * Return a stream of document snapshots on a query. These results are in sort order.\n * @param query\n */\nexport function collection(query) {\n return from(getDocs(query)).pipe(map(function (changes) { return changes.docs; }));\n}\n/**\n * Returns a stream of documents mapped to their data payload, and optionally the document ID\n * @param query\n */\nexport function collectionData(query, options) {\n if (options === void 0) { options = {}; }\n return collection(query).pipe(map(function (arr) {\n return arr.map(function (snap) { return snapToData(snap, options); });\n }));\n}\nexport function collectionCountSnap(query) {\n return from(getCount(query));\n}\nexport function collectionCount(query) {\n return collectionCountSnap(query).pipe(map(function (snap) { return snap.data().count; }));\n}\n","import { getDoc, getDocs } from 'firebase/firestore/lite';\nimport { from } from 'rxjs';\nexport function fromRef(ref) {\n if (ref.type === 'document') {\n return from(getDoc(ref));\n }\n else {\n return from(getDocs(ref));\n }\n}\n"],"names":["from","getDoc","map","getDocs","getCount"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIO,SAAS,GAAG,CAAC,GAAG,EAAE;AACzB,IAAI,OAAOA,SAAI,CAACC,WAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7B,CAAC;AACD;AACA;AACA;AACA;AACO,SAAS,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE;AACtC,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AAC7C,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAACC,aAAG,CAAC,UAAU,IAAI,EAAE,EAAE,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrF,CAAC;AACM,SAAS,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE;AAC9C,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CA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