@zs-soft/firebase-storage-engine 0.10.0

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/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # FirebaseStorageEngine
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.0.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build firebase-storage-engine
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+
35
+ ```bash
36
+ cd dist/firebase-storage-engine
37
+ ```
38
+
39
+ 2. Run the `npm publish` command to publish your library to the npm registry:
40
+ ```bash
41
+ npm publish
42
+ ```
43
+
44
+ ## Running unit tests
45
+
46
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
47
+
48
+ ```bash
49
+ ng test
50
+ ```
51
+
52
+ ## Running end-to-end tests
53
+
54
+ For end-to-end (e2e) testing, run:
55
+
56
+ ```bash
57
+ ng e2e
58
+ ```
59
+
60
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
61
+
62
+ ## Additional Resources
63
+
64
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,151 @@
1
+ import { Observable, map, catchError, of, switchMap } from 'rxjs';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+ import { Storage, ref, uploadBytesResumable, getDownloadURL, getMetadata, getBlob, listAll, deleteObject } from '@angular/fire/storage';
5
+ import { StorageEngine } from '@zs-soft/core-api';
6
+
7
+ class FirebaseStorageEngine extends StorageEngine {
8
+ storage = inject(Storage);
9
+ upload(path, file, options) {
10
+ const storageRef = ref(this.storage, path);
11
+ const meta = {
12
+ contentType: options?.contentType || file.type,
13
+ customMetadata: options?.metadata,
14
+ };
15
+ const task = uploadBytesResumable(storageRef, file, meta);
16
+ return new Observable((subscriber) => {
17
+ const unsubscribe = task.on('state_changed', (snapshot) => {
18
+ const progress = {
19
+ bytesTransferred: snapshot.bytesTransferred,
20
+ totalBytes: snapshot.totalBytes,
21
+ progress: (snapshot.bytesTransferred / snapshot.totalBytes) * 100,
22
+ state: snapshot.state,
23
+ };
24
+ options?.onProgress?.(progress);
25
+ }, (error) => {
26
+ const storageError = {
27
+ code: error.code,
28
+ message: error.message,
29
+ serverResponse: error,
30
+ };
31
+ subscriber.error(storageError);
32
+ }, async () => {
33
+ try {
34
+ const downloadUrl = await getDownloadURL(task.snapshot.ref);
35
+ const metadata = await getMetadata(task.snapshot.ref);
36
+ const result = {
37
+ name: metadata.name,
38
+ path: metadata.fullPath,
39
+ size: metadata.size,
40
+ contentType: metadata.contentType || 'application/octet-stream',
41
+ lastModified: new Date(metadata.updated),
42
+ downloadUrl,
43
+ };
44
+ subscriber.next(result);
45
+ subscriber.complete();
46
+ }
47
+ catch (err) {
48
+ subscriber.error(err);
49
+ }
50
+ });
51
+ return () => unsubscribe();
52
+ });
53
+ }
54
+ download(path) {
55
+ const storageRef = ref(this.storage, path);
56
+ return new Observable((subscriber) => {
57
+ getBlob(storageRef)
58
+ .then((blob) => {
59
+ subscriber.next(blob);
60
+ subscriber.complete();
61
+ })
62
+ .catch((err) => subscriber.error(err));
63
+ });
64
+ }
65
+ getDownloadUrl(path) {
66
+ const storageRef = ref(this.storage, path);
67
+ return new Observable((subscriber) => {
68
+ getDownloadURL(storageRef)
69
+ .then((url) => {
70
+ subscriber.next(url);
71
+ subscriber.complete();
72
+ })
73
+ .catch((err) => subscriber.error(err));
74
+ });
75
+ }
76
+ getMetadata(path) {
77
+ const storageRef = ref(this.storage, path);
78
+ return new Observable((subscriber) => {
79
+ getMetadata(storageRef)
80
+ .then((metadata) => {
81
+ const file = {
82
+ name: metadata.name,
83
+ path: metadata.fullPath,
84
+ size: metadata.size,
85
+ contentType: metadata.contentType || 'application/octet-stream',
86
+ lastModified: new Date(metadata.updated),
87
+ };
88
+ subscriber.next(file);
89
+ subscriber.complete();
90
+ })
91
+ .catch((err) => subscriber.error(err));
92
+ });
93
+ }
94
+ list(path, _options) {
95
+ const storageRef = ref(this.storage, path);
96
+ return new Observable((subscriber) => {
97
+ listAll(storageRef)
98
+ .then(async (res) => {
99
+ const items = await Promise.all(res.items.map(async (item) => {
100
+ const md = await getMetadata(item);
101
+ return {
102
+ name: md.name,
103
+ path: md.fullPath,
104
+ size: md.size,
105
+ contentType: md.contentType || 'application/octet-stream',
106
+ lastModified: new Date(md.updated),
107
+ };
108
+ }));
109
+ subscriber.next({ items, prefixes: res.prefixes.map((p) => p.fullPath) });
110
+ subscriber.complete();
111
+ })
112
+ .catch((err) => subscriber.error(err));
113
+ });
114
+ }
115
+ delete(path, _options) {
116
+ const storageRef = ref(this.storage, path);
117
+ return new Observable((subscriber) => {
118
+ deleteObject(storageRef)
119
+ .then(() => {
120
+ subscriber.next();
121
+ subscriber.complete();
122
+ })
123
+ .catch((err) => subscriber.error(err));
124
+ });
125
+ }
126
+ exists(path) {
127
+ return this.getMetadata(path).pipe(map(() => true), catchError(() => of(false)));
128
+ }
129
+ copy(sourcePath, destinationPath) {
130
+ return this.download(sourcePath).pipe(switchMap((blob) => this.upload(destinationPath, blob)));
131
+ }
132
+ move(sourcePath, destinationPath) {
133
+ return this.copy(sourcePath, destinationPath).pipe(switchMap((file) => this.delete(sourcePath).pipe(map(() => file))));
134
+ }
135
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: FirebaseStorageEngine, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
136
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: FirebaseStorageEngine });
137
+ }
138
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: FirebaseStorageEngine, decorators: [{
139
+ type: Injectable
140
+ }] });
141
+
142
+ /*
143
+ * Public API Surface of firebase-storage-engine
144
+ */
145
+
146
+ /**
147
+ * Generated bundle index. Do not edit.
148
+ */
149
+
150
+ export { FirebaseStorageEngine };
151
+ //# sourceMappingURL=zs-soft-firebase-storage-engine.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zs-soft-firebase-storage-engine.mjs","sources":["../../../projects/firebase-storage-engine/src/lib/firebase-storage-engine.ts","../../../projects/firebase-storage-engine/src/public-api.ts","../../../projects/firebase-storage-engine/src/zs-soft-firebase-storage-engine.ts"],"sourcesContent":["import { catchError, map, Observable, of, switchMap } from 'rxjs';\n\nimport { inject, Injectable } from '@angular/core';\nimport {\n deleteObject,\n getBlob,\n getDownloadURL,\n getMetadata as getFirebaseMetadata,\n listAll,\n ref,\n Storage as NgFireStorage,\n uploadBytesResumable,\n} from '@angular/fire/storage';\nimport {\n StorageDeleteOptions,\n StorageEngine,\n StorageError,\n StorageFile,\n StorageListOptions,\n StorageListResult,\n StorageUploadOptions,\n StorageUploadProgress,\n} from '@zs-soft/core-api';\n\n@Injectable()\nexport class FirebaseStorageEngine extends StorageEngine {\n private readonly storage = inject(NgFireStorage);\n\n override upload(\n path: string,\n file: File | Blob,\n options?: StorageUploadOptions,\n ): Observable<StorageFile> {\n const storageRef = ref(this.storage, path);\n const meta = {\n contentType: options?.contentType || (file as File).type,\n customMetadata: options?.metadata,\n } as const;\n\n const task = uploadBytesResumable(storageRef, file, meta);\n\n return new Observable<StorageFile>((subscriber) => {\n const unsubscribe = task.on(\n 'state_changed',\n (snapshot) => {\n const progress: StorageUploadProgress = {\n bytesTransferred: snapshot.bytesTransferred,\n totalBytes: snapshot.totalBytes,\n progress: (snapshot.bytesTransferred / snapshot.totalBytes) * 100,\n state: snapshot.state as StorageUploadProgress['state'],\n };\n options?.onProgress?.(progress);\n },\n (error) => {\n const storageError: StorageError = {\n code: error.code,\n message: error.message,\n serverResponse: error,\n };\n subscriber.error(storageError);\n },\n async () => {\n try {\n const downloadUrl = await getDownloadURL(task.snapshot.ref);\n const metadata = await getFirebaseMetadata(task.snapshot.ref);\n const result: StorageFile = {\n name: metadata.name,\n path: metadata.fullPath,\n size: metadata.size,\n contentType: metadata.contentType || 'application/octet-stream',\n lastModified: new Date(metadata.updated),\n downloadUrl,\n };\n subscriber.next(result);\n subscriber.complete();\n } catch (err) {\n subscriber.error(err);\n }\n },\n );\n\n return () => unsubscribe();\n });\n }\n\n override download(path: string): Observable<Blob> {\n const storageRef = ref(this.storage, path);\n return new Observable<Blob>((subscriber) => {\n getBlob(storageRef)\n .then((blob) => {\n subscriber.next(blob);\n subscriber.complete();\n })\n .catch((err) => subscriber.error(err));\n });\n }\n\n override getDownloadUrl(path: string): Observable<string> {\n const storageRef = ref(this.storage, path);\n return new Observable<string>((subscriber) => {\n getDownloadURL(storageRef)\n .then((url) => {\n subscriber.next(url);\n subscriber.complete();\n })\n .catch((err) => subscriber.error(err));\n });\n }\n\n override getMetadata(path: string): Observable<StorageFile> {\n const storageRef = ref(this.storage, path);\n return new Observable<StorageFile>((subscriber) => {\n getFirebaseMetadata(storageRef)\n .then((metadata) => {\n const file: StorageFile = {\n name: metadata.name,\n path: metadata.fullPath,\n size: metadata.size,\n contentType: metadata.contentType || 'application/octet-stream',\n lastModified: new Date(metadata.updated),\n };\n subscriber.next(file);\n subscriber.complete();\n })\n .catch((err) => subscriber.error(err));\n });\n }\n\n override list(path: string, _options?: StorageListOptions): Observable<StorageListResult> {\n const storageRef = ref(this.storage, path);\n return new Observable<StorageListResult>((subscriber) => {\n listAll(storageRef)\n .then(async (res) => {\n const items: StorageFile[] = await Promise.all(\n res.items.map(async (item) => {\n const md = await getFirebaseMetadata(item);\n return {\n name: md.name,\n path: md.fullPath,\n size: md.size,\n contentType: md.contentType || 'application/octet-stream',\n lastModified: new Date(md.updated),\n } satisfies StorageFile;\n }),\n );\n subscriber.next({ items, prefixes: res.prefixes.map((p) => p.fullPath) });\n subscriber.complete();\n })\n .catch((err) => subscriber.error(err));\n });\n }\n\n override delete(path: string, _options?: StorageDeleteOptions): Observable<void> {\n const storageRef = ref(this.storage, path);\n return new Observable<void>((subscriber) => {\n deleteObject(storageRef)\n .then(() => {\n subscriber.next();\n subscriber.complete();\n })\n .catch((err) => subscriber.error(err));\n });\n }\n\n override exists(path: string): Observable<boolean> {\n return this.getMetadata(path).pipe(\n map(() => true),\n catchError(() => of(false)),\n );\n }\n\n override copy(sourcePath: string, destinationPath: string): Observable<StorageFile> {\n return this.download(sourcePath).pipe(switchMap((blob) => this.upload(destinationPath, blob)));\n }\n\n override move(sourcePath: string, destinationPath: string): Observable<StorageFile> {\n return this.copy(sourcePath, destinationPath).pipe(\n switchMap((file) => this.delete(sourcePath).pipe(map(() => file))),\n );\n }\n}\n","/*\n * Public API Surface of firebase-storage-engine\n */\n\nexport * from './lib/firebase-storage-engine';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["NgFireStorage","getFirebaseMetadata"],"mappings":";;;;;;AAyBM,MAAO,qBAAsB,SAAQ,aAAa,CAAA;AACrC,IAAA,OAAO,GAAG,MAAM,CAACA,OAAa,CAAC;AAEvC,IAAA,MAAM,CACb,IAAY,EACZ,IAAiB,EACjB,OAA8B,EAAA;QAE9B,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;AAC1C,QAAA,MAAM,IAAI,GAAG;AACX,YAAA,WAAW,EAAE,OAAO,EAAE,WAAW,IAAK,IAAa,CAAC,IAAI;YACxD,cAAc,EAAE,OAAO,EAA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AI,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;IAChG;IAES,IAAI,CAAC,UAAkB,EAAE,eAAuB,EAAA;AACvD,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,IAAI,CAChD,SAAS,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CACnE;IACH;uGA1JW,qBAAqB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAArB,qBAAqB,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBADjC;;;ACxBD;;AAEG;;ACFH;;AAEG;;;;"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@zs-soft/firebase-storage-engine",
3
+ "version": "0.10.0",
4
+ "description": "Firebase Storage engine for Angular applications",
5
+ "author": "zssz-soft",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/zssz-soft/libraries.git",
10
+ "directory": "projects/firebase-storage-engine"
11
+ },
12
+ "homepage": "https://github.com/zssz-soft/libraries/tree/main/projects/firebase-storage-engine",
13
+ "bugs": {
14
+ "url": "https://github.com/zssz-soft/libraries/issues"
15
+ },
16
+ "keywords": [
17
+ "angular",
18
+ "firebase",
19
+ "storage"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "@angular/common": "^21.2.0",
26
+ "@angular/core": "^21.2.0",
27
+ "@angular/fire": "^21.2.0",
28
+ "@zs-soft/core-api": "^0.10.0",
29
+ "rxjs": "^7.0.0"
30
+ },
31
+ "dependencies": {
32
+ "tslib": "^2.3.0"
33
+ },
34
+ "sideEffects": false,
35
+ "tags": [
36
+ "type:engine",
37
+ "scope:shared"
38
+ ],
39
+ "module": "fesm2022/zs-soft-firebase-storage-engine.mjs",
40
+ "typings": "types/zs-soft-firebase-storage-engine.d.ts",
41
+ "exports": {
42
+ "./package.json": {
43
+ "default": "./package.json"
44
+ },
45
+ ".": {
46
+ "types": "./types/zs-soft-firebase-storage-engine.d.ts",
47
+ "default": "./fesm2022/zs-soft-firebase-storage-engine.mjs"
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,20 @@
1
+ import { Observable } from 'rxjs';
2
+ import { StorageEngine, StorageUploadOptions, StorageFile, StorageListOptions, StorageListResult, StorageDeleteOptions } from '@zs-soft/core-api';
3
+ import * as i0 from '@angular/core';
4
+
5
+ declare class FirebaseStorageEngine extends StorageEngine {
6
+ private readonly storage;
7
+ upload(path: string, file: File | Blob, options?: StorageUploadOptions): Observable<StorageFile>;
8
+ download(path: string): Observable<Blob>;
9
+ getDownloadUrl(path: string): Observable<string>;
10
+ getMetadata(path: string): Observable<StorageFile>;
11
+ list(path: string, _options?: StorageListOptions): Observable<StorageListResult>;
12
+ delete(path: string, _options?: StorageDeleteOptions): Observable<void>;
13
+ exists(path: string): Observable<boolean>;
14
+ copy(sourcePath: string, destinationPath: string): Observable<StorageFile>;
15
+ move(sourcePath: string, destinationPath: string): Observable<StorageFile>;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<FirebaseStorageEngine, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<FirebaseStorageEngine>;
18
+ }
19
+
20
+ export { FirebaseStorageEngine };