@speakableio/core 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -87,6 +87,8 @@ var FirebaseAPI = class _FirebaseAPI {
87
87
  id: docSnap.id,
88
88
  ...docSnap.data()
89
89
  } : null;
90
+ console.log("getDoc", path);
91
+ console.log("getDoc db", this.db);
90
92
  return {
91
93
  id: docSnap.id,
92
94
  data
@@ -97,6 +99,8 @@ var FirebaseAPI = class _FirebaseAPI {
97
99
  const collectionRef = collection(this.db, path);
98
100
  const q = queryConstraints.length > 0 ? query(collectionRef, ...queryConstraints) : collectionRef;
99
101
  const querySnapshot = await getDocs(q);
102
+ console.log("getDocs", path, queryConstraints);
103
+ console.log("getDocs db", this.db);
100
104
  const data = querySnapshot.docs.map((doc) => ({
101
105
  id: doc.id,
102
106
  data: doc.data()
@@ -118,16 +122,22 @@ var FirebaseAPI = class _FirebaseAPI {
118
122
  async setDoc(path, data, options = {}) {
119
123
  const { setDoc, doc } = this.helpers;
120
124
  const docRef = doc(this.db, path);
125
+ console.log("setDoc", path, data);
126
+ console.log("setDoc db", this.db);
121
127
  await setDoc(docRef, data, options);
122
128
  }
123
129
  async updateDoc(path, data) {
124
130
  const { updateDoc, doc } = this.helpers;
131
+ console.log("updateDoc", path, data);
132
+ console.log("updateDoc db", this.db);
125
133
  const docRef = doc(this.db, path);
126
134
  await updateDoc(docRef, data);
127
135
  }
128
136
  async deleteDoc(path) {
129
137
  const { deleteDoc, doc } = this.helpers;
130
138
  const docRef = doc(this.db, path);
139
+ console.log("deleteDoc", path);
140
+ console.log("deleteDoc db", this.db);
131
141
  await deleteDoc(docRef);
132
142
  }
133
143
  async runTransaction(updateFunction) {
@@ -1869,8 +1879,8 @@ function useActivity({
1869
1879
  enabled: isAssignment
1870
1880
  });
1871
1881
  const activeAssignment = assignmentQuery.data;
1872
- const activityId = isAssignment ? _nullishCoalesce(_optionalChain([activeAssignment, 'optionalAccess', _62 => _62.setId]), () => ( "")) : id;
1873
- const querySet = useSet({ setId: _nullishCoalesce(activityId, () => ( "")) });
1882
+ const activityId = isAssignment ? _nullishCoalesce(_optionalChain([activeAssignment, 'optionalAccess', _62 => _62.id]), () => ( "")) : id;
1883
+ const querySet = useSet({ setId: _nullishCoalesce(id, () => ( "")), enabled: isAssignment });
1874
1884
  const setData = querySet.data;
1875
1885
  const { cardsObject, cardsQueries, cards } = useCards({
1876
1886
  cardIds: _nullishCoalesce(_optionalChain([setData, 'optionalAccess', _63 => _63.content]), () => ( [])),
package/dist/index.mjs CHANGED
@@ -87,6 +87,8 @@ var FirebaseAPI = class _FirebaseAPI {
87
87
  id: docSnap.id,
88
88
  ...docSnap.data()
89
89
  } : null;
90
+ console.log("getDoc", path);
91
+ console.log("getDoc db", this.db);
90
92
  return {
91
93
  id: docSnap.id,
92
94
  data
@@ -97,6 +99,8 @@ var FirebaseAPI = class _FirebaseAPI {
97
99
  const collectionRef = collection(this.db, path);
98
100
  const q = queryConstraints.length > 0 ? query(collectionRef, ...queryConstraints) : collectionRef;
99
101
  const querySnapshot = await getDocs(q);
102
+ console.log("getDocs", path, queryConstraints);
103
+ console.log("getDocs db", this.db);
100
104
  const data = querySnapshot.docs.map((doc) => ({
101
105
  id: doc.id,
102
106
  data: doc.data()
@@ -118,16 +122,22 @@ var FirebaseAPI = class _FirebaseAPI {
118
122
  async setDoc(path, data, options = {}) {
119
123
  const { setDoc, doc } = this.helpers;
120
124
  const docRef = doc(this.db, path);
125
+ console.log("setDoc", path, data);
126
+ console.log("setDoc db", this.db);
121
127
  await setDoc(docRef, data, options);
122
128
  }
123
129
  async updateDoc(path, data) {
124
130
  const { updateDoc, doc } = this.helpers;
131
+ console.log("updateDoc", path, data);
132
+ console.log("updateDoc db", this.db);
125
133
  const docRef = doc(this.db, path);
126
134
  await updateDoc(docRef, data);
127
135
  }
128
136
  async deleteDoc(path) {
129
137
  const { deleteDoc, doc } = this.helpers;
130
138
  const docRef = doc(this.db, path);
139
+ console.log("deleteDoc", path);
140
+ console.log("deleteDoc db", this.db);
131
141
  await deleteDoc(docRef);
132
142
  }
133
143
  async runTransaction(updateFunction) {
@@ -1869,8 +1879,8 @@ function useActivity({
1869
1879
  enabled: isAssignment
1870
1880
  });
1871
1881
  const activeAssignment = assignmentQuery.data;
1872
- const activityId = isAssignment ? activeAssignment?.setId ?? "" : id;
1873
- const querySet = useSet({ setId: activityId ?? "" });
1882
+ const activityId = isAssignment ? activeAssignment?.id ?? "" : id;
1883
+ const querySet = useSet({ setId: id ?? "", enabled: isAssignment });
1874
1884
  const setData = querySet.data;
1875
1885
  const { cardsObject, cardsQueries, cards } = useCards({
1876
1886
  cardIds: setData?.content ?? [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speakableio/core",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Speakable-io/speakable-core.git"