firestore-rest
Advanced tools
Comparing version 1.0.1 to 1.0.2
14
index.js
const { google } = require('googleapis') | ||
const { convert } = require('firestore-adapter') | ||
const firestore = google.firestore('v1') | ||
@@ -7,6 +8,14 @@ | ||
/** | ||
* Processes the item for compatibility with the existing Firestore API | ||
* | ||
* @param {Object} item - the item to be processed, which is a single document | ||
*/ | ||
const processItem = (item) => { | ||
// we need to inject the `id` and the `data()` method to make it compatible with existing API | ||
const id = item.name.match(regex)[0] | ||
const data = () => item.fields | ||
// normalize data from typed values into usable values | ||
// https://cloud.google.com/firestore/docs/reference/rest/v1/Value | ||
const data = () => convert(item.fields) | ||
return { | ||
@@ -47,5 +56,2 @@ id, | ||
// reset path state | ||
this.path = '' | ||
let result | ||
@@ -52,0 +58,0 @@ try { |
{ | ||
"name": "firestore-rest", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Makes firestore requests using the Google REST API to avoid the gRPC cold start issue.", | ||
@@ -27,4 +27,5 @@ "main": "index.js", | ||
"dependencies": { | ||
"firestore-adapter": "^1.0.6", | ||
"googleapis": "^37.2.0" | ||
} | ||
} |
@@ -75,3 +75,3 @@ # Firestore REST | ||
const response = await db.collection('users').doc('12312312421321').get() | ||
console.log(response) | ||
console.info(response) | ||
} catch (err) { | ||
@@ -78,0 +78,0 @@ console.error(err) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6905
71
2
+ Addedfirestore-adapter@^1.0.6
+ Addedfirestore-adapter@1.1.0(transitive)