@digitalaidseattle/firebase 1.0.6 → 1.0.7

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.
@@ -9,4 +9,10 @@ export declare class FirebaseStorageService implements StorageService {
9
9
  storage: import("@firebase/storage").FirebaseStorage;
10
10
  decoder: TextDecoder;
11
11
  downloadFile: (filepath: string) => Promise<string>;
12
+ getUrlAsync(filepath: string): Promise<string>;
13
+ list(filepath?: string): Promise<any[]>;
14
+ getUrl(filepath: string): string;
15
+ upload(path: string, blob: any): Promise<any>;
16
+ downloadBlob(filepath: string): Promise<Blob | null>;
17
+ removeFile(fileName: string): Promise<any>;
12
18
  }
@@ -132,32 +132,90 @@ var FirebaseAuthService = /*#__PURE__*/function () {
132
132
  }]);
133
133
  }();
134
134
 
135
- var FirebaseStorageService = /*#__PURE__*/_createClass(function FirebaseStorageService() {
136
- var _this = this;
137
- _classCallCheck(this, FirebaseStorageService);
138
- _defineProperty(this, "storage", storage.getStorage(firebaseClient));
139
- _defineProperty(this, "decoder", new TextDecoder("utf-8"));
140
- _defineProperty(this, "downloadFile", /*#__PURE__*/function () {
141
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(filepath) {
142
- var fileRef;
143
- return _regeneratorRuntime__default["default"].wrap(function (_context) {
144
- while (1) switch (_context.prev = _context.next) {
145
- case 0:
146
- fileRef = storage.ref(_this.storage, filepath);
147
- return _context.abrupt("return", storage.getBytes(fileRef).then(function (b) {
148
- return _this.decoder.decode(b);
149
- }));
150
- case 1:
151
- case "end":
152
- return _context.stop();
153
- }
154
- }, _callee);
155
- }));
156
- return function (_x) {
157
- return _ref.apply(this, arguments);
158
- };
159
- }());
160
- });
135
+ var FirebaseStorageService = /*#__PURE__*/function () {
136
+ function FirebaseStorageService() {
137
+ var _this = this;
138
+ _classCallCheck(this, FirebaseStorageService);
139
+ _defineProperty(this, "storage", storage.getStorage(firebaseClient));
140
+ _defineProperty(this, "decoder", new TextDecoder("utf-8"));
141
+ _defineProperty(this, "downloadFile", /*#__PURE__*/function () {
142
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(filepath) {
143
+ var fileRef;
144
+ return _regeneratorRuntime__default["default"].wrap(function (_context) {
145
+ while (1) switch (_context.prev = _context.next) {
146
+ case 0:
147
+ fileRef = storage.ref(_this.storage, filepath);
148
+ return _context.abrupt("return", storage.getBytes(fileRef).then(function (b) {
149
+ return _this.decoder.decode(b);
150
+ }));
151
+ case 1:
152
+ case "end":
153
+ return _context.stop();
154
+ }
155
+ }, _callee);
156
+ }));
157
+ return function (_x) {
158
+ return _ref.apply(this, arguments);
159
+ };
160
+ }());
161
+ }
162
+ return _createClass(FirebaseStorageService, [{
163
+ key: "getUrlAsync",
164
+ value: function () {
165
+ var _getUrlAsync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(filepath) {
166
+ var storageRef, _t;
167
+ return _regeneratorRuntime__default["default"].wrap(function (_context2) {
168
+ while (1) switch (_context2.prev = _context2.next) {
169
+ case 0:
170
+ _context2.prev = 0;
171
+ storageRef = storage.ref(this.storage, filepath);
172
+ _context2.next = 1;
173
+ return storage.getDownloadURL(storageRef);
174
+ case 1:
175
+ return _context2.abrupt("return", _context2.sent);
176
+ case 2:
177
+ _context2.prev = 2;
178
+ _t = _context2["catch"](0);
179
+ console.error("Error getting download URL:", _t);
180
+ throw _t;
181
+ case 3:
182
+ case "end":
183
+ return _context2.stop();
184
+ }
185
+ }, _callee2, this, [[0, 2]]);
186
+ }));
187
+ function getUrlAsync(_x2) {
188
+ return _getUrlAsync.apply(this, arguments);
189
+ }
190
+ return getUrlAsync;
191
+ }()
192
+ }, {
193
+ key: "list",
194
+ value: function list(filepath) {
195
+ throw new Error("Method not implemented.");
196
+ }
197
+ }, {
198
+ key: "getUrl",
199
+ value: function getUrl(filepath) {
200
+ throw new Error("Method not supported.");
201
+ }
202
+ }, {
203
+ key: "upload",
204
+ value: function upload(path, blob) {
205
+ throw new Error("Method not implemented.");
206
+ }
207
+ }, {
208
+ key: "downloadBlob",
209
+ value: function downloadBlob(filepath) {
210
+ throw new Error("Method not implemented.");
211
+ }
212
+ }, {
213
+ key: "removeFile",
214
+ value: function removeFile(fileName) {
215
+ throw new Error("Method not implemented.");
216
+ }
217
+ }]);
218
+ }();
161
219
 
162
220
  var FirestoreService = /*#__PURE__*/function () {
163
221
  function FirestoreService(collectionName) {
@@ -132,32 +132,90 @@ var FirebaseAuthService = /*#__PURE__*/function () {
132
132
  }]);
133
133
  }();
134
134
 
135
- var FirebaseStorageService = /*#__PURE__*/_createClass(function FirebaseStorageService() {
136
- var _this = this;
137
- _classCallCheck(this, FirebaseStorageService);
138
- _defineProperty(this, "storage", storage.getStorage(firebaseClient));
139
- _defineProperty(this, "decoder", new TextDecoder("utf-8"));
140
- _defineProperty(this, "downloadFile", /*#__PURE__*/function () {
141
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(filepath) {
142
- var fileRef;
143
- return _regeneratorRuntime__default["default"].wrap(function (_context) {
144
- while (1) switch (_context.prev = _context.next) {
145
- case 0:
146
- fileRef = storage.ref(_this.storage, filepath);
147
- return _context.abrupt("return", storage.getBytes(fileRef).then(function (b) {
148
- return _this.decoder.decode(b);
149
- }));
150
- case 1:
151
- case "end":
152
- return _context.stop();
153
- }
154
- }, _callee);
155
- }));
156
- return function (_x) {
157
- return _ref.apply(this, arguments);
158
- };
159
- }());
160
- });
135
+ var FirebaseStorageService = /*#__PURE__*/function () {
136
+ function FirebaseStorageService() {
137
+ var _this = this;
138
+ _classCallCheck(this, FirebaseStorageService);
139
+ _defineProperty(this, "storage", storage.getStorage(firebaseClient));
140
+ _defineProperty(this, "decoder", new TextDecoder("utf-8"));
141
+ _defineProperty(this, "downloadFile", /*#__PURE__*/function () {
142
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(filepath) {
143
+ var fileRef;
144
+ return _regeneratorRuntime__default["default"].wrap(function (_context) {
145
+ while (1) switch (_context.prev = _context.next) {
146
+ case 0:
147
+ fileRef = storage.ref(_this.storage, filepath);
148
+ return _context.abrupt("return", storage.getBytes(fileRef).then(function (b) {
149
+ return _this.decoder.decode(b);
150
+ }));
151
+ case 1:
152
+ case "end":
153
+ return _context.stop();
154
+ }
155
+ }, _callee);
156
+ }));
157
+ return function (_x) {
158
+ return _ref.apply(this, arguments);
159
+ };
160
+ }());
161
+ }
162
+ return _createClass(FirebaseStorageService, [{
163
+ key: "getUrlAsync",
164
+ value: function () {
165
+ var _getUrlAsync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(filepath) {
166
+ var storageRef, _t;
167
+ return _regeneratorRuntime__default["default"].wrap(function (_context2) {
168
+ while (1) switch (_context2.prev = _context2.next) {
169
+ case 0:
170
+ _context2.prev = 0;
171
+ storageRef = storage.ref(this.storage, filepath);
172
+ _context2.next = 1;
173
+ return storage.getDownloadURL(storageRef);
174
+ case 1:
175
+ return _context2.abrupt("return", _context2.sent);
176
+ case 2:
177
+ _context2.prev = 2;
178
+ _t = _context2["catch"](0);
179
+ console.error("Error getting download URL:", _t);
180
+ throw _t;
181
+ case 3:
182
+ case "end":
183
+ return _context2.stop();
184
+ }
185
+ }, _callee2, this, [[0, 2]]);
186
+ }));
187
+ function getUrlAsync(_x2) {
188
+ return _getUrlAsync.apply(this, arguments);
189
+ }
190
+ return getUrlAsync;
191
+ }()
192
+ }, {
193
+ key: "list",
194
+ value: function list(filepath) {
195
+ throw new Error("Method not implemented.");
196
+ }
197
+ }, {
198
+ key: "getUrl",
199
+ value: function getUrl(filepath) {
200
+ throw new Error("Method not supported.");
201
+ }
202
+ }, {
203
+ key: "upload",
204
+ value: function upload(path, blob) {
205
+ throw new Error("Method not implemented.");
206
+ }
207
+ }, {
208
+ key: "downloadBlob",
209
+ value: function downloadBlob(filepath) {
210
+ throw new Error("Method not implemented.");
211
+ }
212
+ }, {
213
+ key: "removeFile",
214
+ value: function removeFile(fileName) {
215
+ throw new Error("Method not implemented.");
216
+ }
217
+ }]);
218
+ }();
161
219
 
162
220
  var FirestoreService = /*#__PURE__*/function () {
163
221
  function FirestoreService(collectionName) {
@@ -5,7 +5,7 @@ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
5
5
  import _regeneratorRuntime from '@babel/runtime/regenerator';
6
6
  import { getAuth, GoogleAuthProvider, signInWithPopup } from 'firebase/auth';
7
7
  import { initializeApp } from 'firebase/app';
8
- import { getStorage, ref, getBytes } from 'firebase/storage';
8
+ import { ref, getDownloadURL, getStorage, getBytes } from 'firebase/storage';
9
9
  import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
10
10
  import { getDocs, collection, getDoc, doc, addDoc, updateDoc, deleteDoc, getFirestore } from 'firebase/firestore';
11
11
 
@@ -124,32 +124,90 @@ var FirebaseAuthService = /*#__PURE__*/function () {
124
124
  }]);
125
125
  }();
126
126
 
127
- var FirebaseStorageService = /*#__PURE__*/_createClass(function FirebaseStorageService() {
128
- var _this = this;
129
- _classCallCheck(this, FirebaseStorageService);
130
- _defineProperty(this, "storage", getStorage(firebaseClient));
131
- _defineProperty(this, "decoder", new TextDecoder("utf-8"));
132
- _defineProperty(this, "downloadFile", /*#__PURE__*/function () {
133
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(filepath) {
134
- var fileRef;
135
- return _regeneratorRuntime.wrap(function (_context) {
136
- while (1) switch (_context.prev = _context.next) {
137
- case 0:
138
- fileRef = ref(_this.storage, filepath);
139
- return _context.abrupt("return", getBytes(fileRef).then(function (b) {
140
- return _this.decoder.decode(b);
141
- }));
142
- case 1:
143
- case "end":
144
- return _context.stop();
145
- }
146
- }, _callee);
147
- }));
148
- return function (_x) {
149
- return _ref.apply(this, arguments);
150
- };
151
- }());
152
- });
127
+ var FirebaseStorageService = /*#__PURE__*/function () {
128
+ function FirebaseStorageService() {
129
+ var _this = this;
130
+ _classCallCheck(this, FirebaseStorageService);
131
+ _defineProperty(this, "storage", getStorage(firebaseClient));
132
+ _defineProperty(this, "decoder", new TextDecoder("utf-8"));
133
+ _defineProperty(this, "downloadFile", /*#__PURE__*/function () {
134
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(filepath) {
135
+ var fileRef;
136
+ return _regeneratorRuntime.wrap(function (_context) {
137
+ while (1) switch (_context.prev = _context.next) {
138
+ case 0:
139
+ fileRef = ref(_this.storage, filepath);
140
+ return _context.abrupt("return", getBytes(fileRef).then(function (b) {
141
+ return _this.decoder.decode(b);
142
+ }));
143
+ case 1:
144
+ case "end":
145
+ return _context.stop();
146
+ }
147
+ }, _callee);
148
+ }));
149
+ return function (_x) {
150
+ return _ref.apply(this, arguments);
151
+ };
152
+ }());
153
+ }
154
+ return _createClass(FirebaseStorageService, [{
155
+ key: "getUrlAsync",
156
+ value: function () {
157
+ var _getUrlAsync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(filepath) {
158
+ var storageRef, _t;
159
+ return _regeneratorRuntime.wrap(function (_context2) {
160
+ while (1) switch (_context2.prev = _context2.next) {
161
+ case 0:
162
+ _context2.prev = 0;
163
+ storageRef = ref(this.storage, filepath);
164
+ _context2.next = 1;
165
+ return getDownloadURL(storageRef);
166
+ case 1:
167
+ return _context2.abrupt("return", _context2.sent);
168
+ case 2:
169
+ _context2.prev = 2;
170
+ _t = _context2["catch"](0);
171
+ console.error("Error getting download URL:", _t);
172
+ throw _t;
173
+ case 3:
174
+ case "end":
175
+ return _context2.stop();
176
+ }
177
+ }, _callee2, this, [[0, 2]]);
178
+ }));
179
+ function getUrlAsync(_x2) {
180
+ return _getUrlAsync.apply(this, arguments);
181
+ }
182
+ return getUrlAsync;
183
+ }()
184
+ }, {
185
+ key: "list",
186
+ value: function list(filepath) {
187
+ throw new Error("Method not implemented.");
188
+ }
189
+ }, {
190
+ key: "getUrl",
191
+ value: function getUrl(filepath) {
192
+ throw new Error("Method not supported.");
193
+ }
194
+ }, {
195
+ key: "upload",
196
+ value: function upload(path, blob) {
197
+ throw new Error("Method not implemented.");
198
+ }
199
+ }, {
200
+ key: "downloadBlob",
201
+ value: function downloadBlob(filepath) {
202
+ throw new Error("Method not implemented.");
203
+ }
204
+ }, {
205
+ key: "removeFile",
206
+ value: function removeFile(fileName) {
207
+ throw new Error("Method not implemented.");
208
+ }
209
+ }]);
210
+ }();
153
211
 
154
212
  var FirestoreService = /*#__PURE__*/function () {
155
213
  function FirestoreService(collectionName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalaidseattle/firebase",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Wrapper for firebase that works with DAS Component library",
5
5
  "repository": "null//github.com/null/github.com/tree/master/packages/firebase",
6
6
  "main": "dist/digitalaidseattle-firebase.cjs.js",
@@ -8,7 +8,7 @@
8
8
  "types": "dist/declarations/src/index.d.ts",
9
9
  "dependencies": {
10
10
  "@babel/runtime": "^7.25.0",
11
- "@digitalaidseattle/core": "1.0.10",
11
+ "@digitalaidseattle/core": "1.0.12",
12
12
  "firebase": "^11.2.0",
13
13
  "react": "^18.3.1",
14
14
  "uuid": "^11.0.5"