@entropic-bond/firebase 1.12.0 → 1.13.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/.firebaserc +5 -0
- package/.github/workflows/release.yml +27 -0
- package/CHANGELOG.md +331 -0
- package/firebase.json +30 -0
- package/firestore.indexes.json +4 -0
- package/firestore.rules +8 -0
- package/functions/package-lock.json +2344 -0
- package/functions/package.json +26 -0
- package/functions/src/index.ts +33 -0
- package/functions/tsconfig.json +19 -0
- package/package.json +15 -12
- package/src/auth/firebase-auth.spec.ts +90 -0
- package/src/auth/firebase-auth.ts +212 -0
- package/src/cloud-functions/firebase-cloud-functions.spec.ts +47 -0
- package/src/cloud-functions/firebase-cloud-functions.ts +25 -0
- package/src/cloud-storage/firebase-cloud-storage.spec.ts +135 -0
- package/src/cloud-storage/firebase-cloud-storage.ts +67 -0
- package/src/firebase-helper.ts +92 -0
- package/src/index.ts +5 -0
- package/src/mocks/mock-data.json +148 -0
- package/src/mocks/test-user.ts +121 -0
- package/src/store/firebase-datasource.spec.ts +555 -0
- package/src/store/firebase-datasource.ts +146 -0
- package/storage.rules +8 -0
- package/tsconfig-build.json +7 -0
- package/tsconfig.json +30 -0
- package/vite.config.ts +23 -0
- package/lib/auth/firebase-auth.d.ts +0 -20
- package/lib/auth/firebase-auth.js +0 -189
- package/lib/auth/firebase-auth.js.map +0 -1
- package/lib/cloud-functions/firebase-cloud-functions.d.ts +0 -7
- package/lib/cloud-functions/firebase-cloud-functions.js +0 -27
- package/lib/cloud-functions/firebase-cloud-functions.js.map +0 -1
- package/lib/cloud-storage/firebase-cloud-storage.d.ts +0 -10
- package/lib/cloud-storage/firebase-cloud-storage.js +0 -70
- package/lib/cloud-storage/firebase-cloud-storage.js.map +0 -1
- package/lib/firebase-helper.d.ts +0 -38
- package/lib/firebase-helper.js +0 -57
- package/lib/firebase-helper.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -22
- package/lib/index.js.map +0 -1
- package/lib/mocks/test-user.d.ts +0 -49
- package/lib/mocks/test-user.js +0 -134
- package/lib/mocks/test-user.js.map +0 -1
- package/lib/store/firebase-datasource.d.ts +0 -19
- package/lib/store/firebase-datasource.js +0 -117
- package/lib/store/firebase-datasource.js.map +0 -1
package/tsconfig.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"outDir": "lib",
|
|
10
|
+
"rootDir": "src/",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"lib": [
|
|
13
|
+
"esnext", "DOM"
|
|
14
|
+
],
|
|
15
|
+
"declaration": true,
|
|
16
|
+
"experimentalDecorators": true,
|
|
17
|
+
"allowJs": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"strictNullChecks": true, // should be enabled progressively to end having all code base compliant with this rule
|
|
20
|
+
"strictPropertyInitialization": true, // should be enabled progressively to end having all code base compliant with this rule
|
|
21
|
+
"noUncheckedIndexedAccess": true, // this causes errors when accessing arrays elements without checking if they exist
|
|
22
|
+
"noImplicitOverride": true, // this causes errors when overriding methods of base classes. Annoying for React components
|
|
23
|
+
"forceConsistentCasingInFileNames": true,
|
|
24
|
+
"noImplicitThis": true,
|
|
25
|
+
"types": [
|
|
26
|
+
"vitest/globals",
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"include": ["src"]
|
|
30
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { resolve } from 'path'
|
|
2
|
+
import { defineConfig } from 'vitest/config'
|
|
3
|
+
import dts from 'vite-plugin-dts'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
test: {
|
|
7
|
+
globals: true,
|
|
8
|
+
environment: 'node',
|
|
9
|
+
exclude: ['**/node_modules', '**/dist', '.idea', '.git', '.cache','**/lib', '**/out'],
|
|
10
|
+
},
|
|
11
|
+
build: {
|
|
12
|
+
lib: {
|
|
13
|
+
entry: resolve( __dirname, 'src/index.ts' ),
|
|
14
|
+
name: 'entropic-bond-firebase',
|
|
15
|
+
fileName: 'entropic-bond-firebase'
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
"outDir": "lib",
|
|
19
|
+
},
|
|
20
|
+
plugins: [
|
|
21
|
+
dts()
|
|
22
|
+
]
|
|
23
|
+
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AuthProvider, SignData, UserCredentials, AuthService } from 'entropic-bond';
|
|
2
|
-
import { User, UserCredential } from 'firebase/auth';
|
|
3
|
-
import { EmulatorConfig } from '../firebase-helper';
|
|
4
|
-
export declare class FirebaseAuth extends AuthService {
|
|
5
|
-
constructor(emulator?: EmulatorConfig);
|
|
6
|
-
signUp<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
|
|
7
|
-
login<T extends {}>(signData: SignData): Promise<UserCredentials<T>>;
|
|
8
|
-
logout(): Promise<void>;
|
|
9
|
-
resetEmailPassword(email: string): Promise<void>;
|
|
10
|
-
resendVerificationEmail(email: string, password: string, verificationLink: string): Promise<void>;
|
|
11
|
-
refreshToken(): Promise<void>;
|
|
12
|
-
onAuthStateChange<T extends {}>(onChange: (userCredentials: UserCredentials<T> | undefined) => void): void;
|
|
13
|
-
linkAdditionalProvider(provider: AuthProvider): Promise<unknown>;
|
|
14
|
-
unlinkProvider(provider: AuthProvider): Promise<unknown>;
|
|
15
|
-
private toUserCredentials;
|
|
16
|
-
static convertCredentials<T extends {}>(nativeUserCredential: User, claims: T): UserCredentials<T>;
|
|
17
|
-
registerCredentialProvider(name: string, providerFactory: (singData: SignData) => Promise<UserCredential>): void;
|
|
18
|
-
private registerCredentialProviders;
|
|
19
|
-
private credentialProviders;
|
|
20
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FirebaseAuth = void 0;
|
|
4
|
-
const entropic_bond_1 = require("entropic-bond");
|
|
5
|
-
const auth_1 = require("firebase/auth");
|
|
6
|
-
const firebase_helper_1 = require("../firebase-helper");
|
|
7
|
-
const providerFactory = {
|
|
8
|
-
'twitter': () => new auth_1.TwitterAuthProvider(),
|
|
9
|
-
'facebook': () => new auth_1.FacebookAuthProvider(),
|
|
10
|
-
'google': () => new auth_1.GoogleAuthProvider()
|
|
11
|
-
};
|
|
12
|
-
class FirebaseAuth extends entropic_bond_1.AuthService {
|
|
13
|
-
constructor(emulator) {
|
|
14
|
-
var _a;
|
|
15
|
-
super();
|
|
16
|
-
this.credentialProviders = {};
|
|
17
|
-
if (emulator)
|
|
18
|
-
firebase_helper_1.FirebaseHelper.useEmulator(emulator);
|
|
19
|
-
if ((_a = firebase_helper_1.FirebaseHelper.emulator) === null || _a === void 0 ? void 0 : _a.emulate) {
|
|
20
|
-
const { host, authPort } = firebase_helper_1.FirebaseHelper.emulator;
|
|
21
|
-
if (!host || !authPort)
|
|
22
|
-
throw new Error(`You should define a host and an auth emulator port to use the emulator`);
|
|
23
|
-
(0, auth_1.connectAuthEmulator)(firebase_helper_1.FirebaseHelper.instance.auth(), `http://${host}:${authPort}`);
|
|
24
|
-
}
|
|
25
|
-
this.registerCredentialProviders();
|
|
26
|
-
}
|
|
27
|
-
signUp(signData) {
|
|
28
|
-
const { authProvider, verificationLink } = signData;
|
|
29
|
-
if (authProvider.slice(0, 5) === 'email') {
|
|
30
|
-
return new Promise(async (resolve, reject) => {
|
|
31
|
-
try {
|
|
32
|
-
const credentialFactory = this.credentialProviders['email-sign-up'];
|
|
33
|
-
if (!credentialFactory)
|
|
34
|
-
throw new Error(`The provider ${authProvider} is not registered`);
|
|
35
|
-
const userCredentials = await credentialFactory(signData);
|
|
36
|
-
if (signData.name) {
|
|
37
|
-
await (0, auth_1.updateProfile)(userCredentials.user, {
|
|
38
|
-
displayName: signData.name
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
if (verificationLink) {
|
|
42
|
-
await (0, auth_1.sendEmailVerification)(userCredentials.user, {
|
|
43
|
-
url: verificationLink
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
resolve(await this.toUserCredentials(userCredentials.user));
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
reject({
|
|
50
|
-
code: (0, entropic_bond_1.camelCase)(error.code.slice(5)),
|
|
51
|
-
message: error.message
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
else
|
|
57
|
-
return this.login(signData);
|
|
58
|
-
}
|
|
59
|
-
login(signData) {
|
|
60
|
-
const { authProvider } = signData;
|
|
61
|
-
return new Promise(async (resolve, reject) => {
|
|
62
|
-
try {
|
|
63
|
-
const credentialFactory = this.credentialProviders[authProvider];
|
|
64
|
-
if (!credentialFactory)
|
|
65
|
-
throw new Error(`The provider ${authProvider} is not registered`);
|
|
66
|
-
const userCredentials = await credentialFactory(signData);
|
|
67
|
-
resolve(await this.toUserCredentials(userCredentials.user));
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
reject({
|
|
71
|
-
code: error.code === 400 ? 'missingPassword' : (0, entropic_bond_1.camelCase)(error.code.slice(5)),
|
|
72
|
-
message: error.message
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
logout() {
|
|
78
|
-
return firebase_helper_1.FirebaseHelper.instance.auth().signOut();
|
|
79
|
-
}
|
|
80
|
-
resetEmailPassword(email) {
|
|
81
|
-
return new Promise(async (resolve, reject) => {
|
|
82
|
-
try {
|
|
83
|
-
await (0, auth_1.sendPasswordResetEmail)(firebase_helper_1.FirebaseHelper.instance.auth(), email);
|
|
84
|
-
resolve();
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
reject({
|
|
88
|
-
code: (0, entropic_bond_1.camelCase)(error.code.slice(5)),
|
|
89
|
-
message: error.message
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
resendVerificationEmail(email, password, verificationLink) {
|
|
95
|
-
return new Promise(async (resolve, reject) => {
|
|
96
|
-
try {
|
|
97
|
-
await (0, auth_1.signInWithEmailAndPassword)(firebase_helper_1.FirebaseHelper.instance.auth(), email, password);
|
|
98
|
-
const user = firebase_helper_1.FirebaseHelper.instance.auth().currentUser;
|
|
99
|
-
if (!user) {
|
|
100
|
-
reject({
|
|
101
|
-
code: 'userNotFound',
|
|
102
|
-
message: `There is no logged in user`
|
|
103
|
-
});
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
await (0, auth_1.sendEmailVerification)(user, {
|
|
107
|
-
url: verificationLink
|
|
108
|
-
});
|
|
109
|
-
resolve();
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
reject({
|
|
113
|
-
code: (0, entropic_bond_1.camelCase)(error.code.slice(5)),
|
|
114
|
-
message: verificationLink
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
refreshToken() {
|
|
120
|
-
var _a;
|
|
121
|
-
return (_a = firebase_helper_1.FirebaseHelper.instance.auth().currentUser) === null || _a === void 0 ? void 0 : _a.getIdToken(true);
|
|
122
|
-
}
|
|
123
|
-
onAuthStateChange(onChange) {
|
|
124
|
-
firebase_helper_1.FirebaseHelper.instance.auth().onAuthStateChanged(async (credentials) => {
|
|
125
|
-
onChange(credentials ? await this.toUserCredentials(credentials) : undefined);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
linkAdditionalProvider(provider) {
|
|
129
|
-
const providerInstance = providerFactory[provider]();
|
|
130
|
-
const currentUser = firebase_helper_1.FirebaseHelper.instance.auth().currentUser;
|
|
131
|
-
if (!currentUser)
|
|
132
|
-
throw new Error(`There is no logged in user`);
|
|
133
|
-
return (0, auth_1.linkWithPopup)(currentUser, providerInstance);
|
|
134
|
-
}
|
|
135
|
-
unlinkProvider(provider) {
|
|
136
|
-
const { currentUser } = firebase_helper_1.FirebaseHelper.instance.auth();
|
|
137
|
-
if (!currentUser)
|
|
138
|
-
throw new Error(`There is no logged in user`);
|
|
139
|
-
currentUser.providerData;
|
|
140
|
-
return (0, auth_1.unlink)(currentUser, providerFactory[provider]().providerId);
|
|
141
|
-
}
|
|
142
|
-
async toUserCredentials(nativeUserCredential) {
|
|
143
|
-
if (!nativeUserCredential)
|
|
144
|
-
throw new Error(`The user in user credentials is not defined`);
|
|
145
|
-
const claims = (await nativeUserCredential.getIdTokenResult()).claims;
|
|
146
|
-
return FirebaseAuth.convertCredentials(nativeUserCredential, claims);
|
|
147
|
-
}
|
|
148
|
-
static convertCredentials(nativeUserCredential, claims) {
|
|
149
|
-
var _a, _b, _c, _d;
|
|
150
|
-
return ({
|
|
151
|
-
id: nativeUserCredential.uid,
|
|
152
|
-
email: (_a = nativeUserCredential.email) !== null && _a !== void 0 ? _a : '',
|
|
153
|
-
name: (_b = nativeUserCredential.displayName) !== null && _b !== void 0 ? _b : undefined,
|
|
154
|
-
pictureUrl: (_c = nativeUserCredential.photoURL) !== null && _c !== void 0 ? _c : undefined,
|
|
155
|
-
phoneNumber: (_d = nativeUserCredential.phoneNumber) !== null && _d !== void 0 ? _d : undefined,
|
|
156
|
-
emailVerified: nativeUserCredential.emailVerified,
|
|
157
|
-
customData: { ...claims },
|
|
158
|
-
lastLogin: Date.now(),
|
|
159
|
-
creationDate: nativeUserCredential.metadata.creationTime ? new Date(nativeUserCredential.metadata.creationTime).getTime() : undefined,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
registerCredentialProvider(name, providerFactory) {
|
|
163
|
-
this.credentialProviders[name] = providerFactory;
|
|
164
|
-
}
|
|
165
|
-
registerCredentialProviders() {
|
|
166
|
-
this.registerCredentialProvider('email-sign-up', signData => {
|
|
167
|
-
if (!signData.email || !signData.password)
|
|
168
|
-
throw new Error(`Email and password are required`);
|
|
169
|
-
return (0, auth_1.createUserWithEmailAndPassword)(firebase_helper_1.FirebaseHelper.instance.auth(), signData.email, signData.password);
|
|
170
|
-
});
|
|
171
|
-
this.registerCredentialProvider('email', signData => {
|
|
172
|
-
if (!signData.email || !signData.password)
|
|
173
|
-
throw new Error(`Email and password are required`);
|
|
174
|
-
return (0, auth_1.signInWithEmailAndPassword)(firebase_helper_1.FirebaseHelper.instance.auth(), signData.email, signData.password);
|
|
175
|
-
});
|
|
176
|
-
this.registerCredentialProvider('google', () => (0, auth_1.signInWithPopup)(firebase_helper_1.FirebaseHelper.instance.auth(), new auth_1.GoogleAuthProvider()));
|
|
177
|
-
this.registerCredentialProvider('facebook', () => (0, auth_1.signInWithPopup)(firebase_helper_1.FirebaseHelper.instance.auth(), new auth_1.FacebookAuthProvider()));
|
|
178
|
-
this.registerCredentialProvider('twitter', () => (0, auth_1.signInWithPopup)(firebase_helper_1.FirebaseHelper.instance.auth(), new auth_1.TwitterAuthProvider()));
|
|
179
|
-
this.registerCredentialProvider('link-twitter', () => {
|
|
180
|
-
const currentUser = firebase_helper_1.FirebaseHelper.instance.auth().currentUser;
|
|
181
|
-
if (!currentUser)
|
|
182
|
-
throw new Error(`There is no logged in user`);
|
|
183
|
-
return (0, auth_1.linkWithPopup)(currentUser, new auth_1.TwitterAuthProvider());
|
|
184
|
-
});
|
|
185
|
-
this.registerCredentialProvider('anonymous', () => (0, auth_1.signInAnonymously)(firebase_helper_1.FirebaseHelper.instance.auth()));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
exports.FirebaseAuth = FirebaseAuth;
|
|
189
|
-
//# sourceMappingURL=firebase-auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-auth.js","sourceRoot":"","sources":["../../src/auth/firebase-auth.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UAAU,EAAE,GAAG,EAAE,CAAC,IAAA,sBAAe,EACjE,gCAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,2BAAoB,EAAE,CAC1D,CAAC,CAAA;QACF,IAAI,CAAC,0BAA0B,CAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAA,sBAAe,EAChE,gCAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,0BAAmB,EAAE,CACzD,CAAC,CAAA;QACF,IAAI,CAAC,0BAA0B,CAAE,cAAc,EAAE,GAAG,EAAE;YACrD,MAAM,WAAW,GAAG,gCAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,CAAA;YAC9D,IAAK,CAAC,WAAW;gBAAG,MAAM,IAAI,KAAK,CAAE,4BAA4B,CAAE,CAAA;YACnE,OAAO,IAAA,oBAAa,EAAE,WAAW,EAAE,IAAI,0BAAmB,EAAE,CAAE,CAAA;QAC/D,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,0BAA0B,CAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAA,wBAAiB,EACpE,gCAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,CAC9B,CAAC,CAAA;IACH,CAAC;CAGD;AArMD,oCAqMC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CloudFunction, CloudFunctionsService } from 'entropic-bond';
|
|
2
|
-
import { EmulatorConfig } from '../firebase-helper';
|
|
3
|
-
export declare class FirebaseCloudFunctions implements CloudFunctionsService {
|
|
4
|
-
constructor(region?: string, emulator?: Partial<EmulatorConfig>);
|
|
5
|
-
retrieveFunction<P, R>(cloudFunction: string): CloudFunction<P, R>;
|
|
6
|
-
callFunction<P, R>(func: CloudFunction<P, R>, params: P): Promise<R>;
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FirebaseCloudFunctions = void 0;
|
|
4
|
-
const functions_1 = require("firebase/functions");
|
|
5
|
-
const firebase_helper_1 = require("../firebase-helper");
|
|
6
|
-
class FirebaseCloudFunctions {
|
|
7
|
-
constructor(region, emulator) {
|
|
8
|
-
var _a;
|
|
9
|
-
if (region)
|
|
10
|
-
firebase_helper_1.FirebaseHelper.setRegion(region);
|
|
11
|
-
if (emulator)
|
|
12
|
-
firebase_helper_1.FirebaseHelper.useEmulator(emulator);
|
|
13
|
-
if ((_a = firebase_helper_1.FirebaseHelper.emulator) === null || _a === void 0 ? void 0 : _a.emulate) {
|
|
14
|
-
const { host, functionsPort } = firebase_helper_1.FirebaseHelper.emulator;
|
|
15
|
-
(0, functions_1.connectFunctionsEmulator)(firebase_helper_1.FirebaseHelper.instance.functions(), host, functionsPort);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
retrieveFunction(cloudFunction) {
|
|
19
|
-
return (0, functions_1.httpsCallable)(firebase_helper_1.FirebaseHelper.instance.functions(), cloudFunction);
|
|
20
|
-
}
|
|
21
|
-
async callFunction(func, params) {
|
|
22
|
-
const res = await func(params);
|
|
23
|
-
return res.data;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.FirebaseCloudFunctions = FirebaseCloudFunctions;
|
|
27
|
-
//# sourceMappingURL=firebase-cloud-functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-cloud-functions.js","sourceRoot":"","sources":["../../src/cloud-functions/firebase-cloud-functions.ts"],"names":[],"mappings":";;;AACA,kDAA4E;AAC5E,wDAAmE;AAEnE,MAAa,sBAAsB;IAClC,YAAa,MAAe,EAAE,QAAkC;;QAC/D,IAAK,MAAM;YAAG,gCAAc,CAAC,SAAS,CAAE,MAAM,CAAE,CAAA;QAChD,IAAK,QAAQ;YAAG,gCAAc,CAAC,WAAW,CAAE,QAAQ,CAAE,CAAA;QAEtD,IAAK,MAAA,gCAAc,CAAC,QAAQ,0CAAE,OAAO,EAAG,CAAC;YACxC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,gCAAc,CAAC,QAAQ,CAAA;YACvD,IAAA,oCAAwB,EAAE,gCAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,aAAa,CAAE,CAAA;QACrF,CAAC;IAEF,CAAC;IAED,gBAAgB,CAAQ,aAAqB;QAC5C,OAAO,IAAA,yBAAa,EAAO,gCAAc,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,aAAa,CAAoC,CAAA;IAClH,CAAC;IAED,KAAK,CAAC,YAAY,CAAQ,IAAyB,EAAE,MAAS;QAC7D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAE,MAAM,CAAS,CAAA;QACvC,OAAO,GAAG,CAAC,IAAI,CAAA;IAChB,CAAC;CACD;AApBD,wDAoBC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CloudStorage, UploadControl, UploadProgress } from 'entropic-bond';
|
|
2
|
-
import { EmulatorConfig } from '../firebase-helper';
|
|
3
|
-
export declare class FirebaseCloudStorage extends CloudStorage {
|
|
4
|
-
constructor(emulator?: EmulatorConfig);
|
|
5
|
-
save(id: string, data: Blob | Uint8Array | ArrayBuffer, progress?: UploadProgress): Promise<string>;
|
|
6
|
-
getUrl(reference: string): Promise<string>;
|
|
7
|
-
uploadControl(): UploadControl;
|
|
8
|
-
delete(reference: string): Promise<void>;
|
|
9
|
-
private _uploadTask;
|
|
10
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.FirebaseCloudStorage = void 0;
|
|
10
|
-
const entropic_bond_1 = require("entropic-bond");
|
|
11
|
-
const storage_1 = require("firebase/storage");
|
|
12
|
-
const firebase_helper_1 = require("../firebase-helper");
|
|
13
|
-
let FirebaseCloudStorage = class FirebaseCloudStorage extends entropic_bond_1.CloudStorage {
|
|
14
|
-
constructor(emulator) {
|
|
15
|
-
var _a;
|
|
16
|
-
super();
|
|
17
|
-
if (emulator)
|
|
18
|
-
firebase_helper_1.FirebaseHelper.useEmulator(emulator);
|
|
19
|
-
if ((_a = firebase_helper_1.FirebaseHelper.emulator) === null || _a === void 0 ? void 0 : _a.emulate) {
|
|
20
|
-
const { host, storagePort } = firebase_helper_1.FirebaseHelper.emulator;
|
|
21
|
-
(0, storage_1.connectStorageEmulator)(firebase_helper_1.FirebaseHelper.instance.storage(), host, storagePort);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
save(id, data, progress) {
|
|
25
|
-
const storage = firebase_helper_1.FirebaseHelper.instance.storage();
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
this._uploadTask = (0, storage_1.uploadBytesResumable)((0, storage_1.ref)(storage, id), data);
|
|
28
|
-
if (progress) {
|
|
29
|
-
var unsubscribe = this._uploadTask.on('state_changed', snapshot => {
|
|
30
|
-
progress(snapshot.bytesTransferred, snapshot.totalBytes);
|
|
31
|
-
}, null, () => unsubscribe());
|
|
32
|
-
}
|
|
33
|
-
this._uploadTask
|
|
34
|
-
.then(() => resolve(id))
|
|
35
|
-
.catch(error => reject(error));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
getUrl(reference) {
|
|
39
|
-
if (!reference)
|
|
40
|
-
return Promise.reject('needs a reference');
|
|
41
|
-
const storage = firebase_helper_1.FirebaseHelper.instance.storage();
|
|
42
|
-
return (0, storage_1.getDownloadURL)((0, storage_1.ref)(storage, reference));
|
|
43
|
-
}
|
|
44
|
-
uploadControl() {
|
|
45
|
-
if (!this._uploadTask)
|
|
46
|
-
throw new Error(`You should call save() before uploadControl()`);
|
|
47
|
-
return {
|
|
48
|
-
cancel: () => { var _a; return (_a = this._uploadTask) === null || _a === void 0 ? void 0 : _a.cancel(); },
|
|
49
|
-
pause: () => { var _a; return (_a = this._uploadTask) === null || _a === void 0 ? void 0 : _a.pause(); },
|
|
50
|
-
resume: () => { var _a; return (_a = this._uploadTask) === null || _a === void 0 ? void 0 : _a.resume(); },
|
|
51
|
-
onProgress: (callback) => {
|
|
52
|
-
var _a;
|
|
53
|
-
return (_a = this._uploadTask) === null || _a === void 0 ? void 0 : _a.on('state_changed', snapShot => {
|
|
54
|
-
if (callback) {
|
|
55
|
-
callback(snapShot.bytesTransferred, snapShot.totalBytes);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
delete(reference) {
|
|
62
|
-
const storage = firebase_helper_1.FirebaseHelper.instance.storage();
|
|
63
|
-
return (0, storage_1.deleteObject)((0, storage_1.ref)(storage, reference));
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
exports.FirebaseCloudStorage = FirebaseCloudStorage;
|
|
67
|
-
exports.FirebaseCloudStorage = FirebaseCloudStorage = __decorate([
|
|
68
|
-
(0, entropic_bond_1.registerCloudStorage)('FirebaseCloudStorage', () => new FirebaseCloudStorage())
|
|
69
|
-
], FirebaseCloudStorage);
|
|
70
|
-
//# sourceMappingURL=firebase-cloud-storage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-cloud-storage.js","sourceRoot":"","sources":["../../src/cloud-storage/firebase-cloud-storage.ts"],"names":[],"mappings":";;;;;;;;;AAAA,iDAAiG;AACjG,8CAA8H;AAC9H,wD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A,oCAAoB,EAAE,sBAAsB,EAAE,GAAE,EAAE,CAAC,IAAI,oBAAoB,EAAE,CAAE;GACnE,oBAAoB,CA6DhC"}
|
package/lib/firebase-helper.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { CollectionReference, DocumentData, Query } from 'firebase/firestore';
|
|
2
|
-
export type FirebaseQuery = CollectionReference<DocumentData> | Query<DocumentData>;
|
|
3
|
-
export interface FirebaseConfig {
|
|
4
|
-
apiKey?: string;
|
|
5
|
-
authDomain?: string;
|
|
6
|
-
projectId: string;
|
|
7
|
-
databaseURL?: string;
|
|
8
|
-
storageBucket?: string;
|
|
9
|
-
messagingSenderId?: string;
|
|
10
|
-
appId?: string;
|
|
11
|
-
measurementId?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface EmulatorConfig {
|
|
14
|
-
host: string;
|
|
15
|
-
firestorePort: number;
|
|
16
|
-
storagePort: number;
|
|
17
|
-
authPort: number;
|
|
18
|
-
functionsPort: number;
|
|
19
|
-
emulate: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare class FirebaseHelper {
|
|
22
|
-
static setFirebaseConfig(config: FirebaseConfig): void;
|
|
23
|
-
private static defaultEmulatorConfig;
|
|
24
|
-
static useEmulator(emulatorConfig?: Partial<EmulatorConfig>): void;
|
|
25
|
-
static get emulator(): EmulatorConfig;
|
|
26
|
-
private constructor();
|
|
27
|
-
static get instance(): FirebaseHelper;
|
|
28
|
-
firestore(): import("@firebase/firestore").Firestore;
|
|
29
|
-
storage(): import("@firebase/storage").FirebaseStorage;
|
|
30
|
-
auth(): import("@firebase/auth").Auth;
|
|
31
|
-
functions(): import("@firebase/functions").Functions;
|
|
32
|
-
static setRegion(region: string): void;
|
|
33
|
-
private static _instance;
|
|
34
|
-
private static _firebaseConfig;
|
|
35
|
-
private static _emulatorConfig;
|
|
36
|
-
private static _region;
|
|
37
|
-
private _firebaseApp;
|
|
38
|
-
}
|
package/lib/firebase-helper.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FirebaseHelper = void 0;
|
|
4
|
-
const app_1 = require("firebase/app");
|
|
5
|
-
const firestore_1 = require("firebase/firestore");
|
|
6
|
-
const auth_1 = require("firebase/auth");
|
|
7
|
-
const storage_1 = require("firebase/storage");
|
|
8
|
-
const functions_1 = require("firebase/functions");
|
|
9
|
-
class FirebaseHelper {
|
|
10
|
-
static setFirebaseConfig(config) {
|
|
11
|
-
FirebaseHelper._firebaseConfig = config;
|
|
12
|
-
}
|
|
13
|
-
static useEmulator(emulatorConfig) {
|
|
14
|
-
this._emulatorConfig = {
|
|
15
|
-
...FirebaseHelper.defaultEmulatorConfig,
|
|
16
|
-
emulate: true,
|
|
17
|
-
...emulatorConfig
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
static get emulator() {
|
|
21
|
-
return this._emulatorConfig;
|
|
22
|
-
}
|
|
23
|
-
constructor() {
|
|
24
|
-
if (!FirebaseHelper._firebaseConfig)
|
|
25
|
-
throw new Error('You should set a firebase config object before using Firebase');
|
|
26
|
-
this._firebaseApp = (0, app_1.initializeApp)(FirebaseHelper._firebaseConfig);
|
|
27
|
-
}
|
|
28
|
-
static get instance() {
|
|
29
|
-
return this._instance || (this._instance = new FirebaseHelper());
|
|
30
|
-
}
|
|
31
|
-
firestore() {
|
|
32
|
-
return (0, firestore_1.getFirestore)(this._firebaseApp);
|
|
33
|
-
}
|
|
34
|
-
storage() {
|
|
35
|
-
return (0, storage_1.getStorage)(this._firebaseApp);
|
|
36
|
-
}
|
|
37
|
-
auth() {
|
|
38
|
-
return (0, auth_1.getAuth)(this._firebaseApp);
|
|
39
|
-
}
|
|
40
|
-
functions() {
|
|
41
|
-
return (0, functions_1.getFunctions)(this._firebaseApp, FirebaseHelper._region);
|
|
42
|
-
}
|
|
43
|
-
static setRegion(region) {
|
|
44
|
-
this._region = region;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.FirebaseHelper = FirebaseHelper;
|
|
48
|
-
FirebaseHelper.defaultEmulatorConfig = {
|
|
49
|
-
host: 'localhost',
|
|
50
|
-
firestorePort: 8080,
|
|
51
|
-
storagePort: 9199,
|
|
52
|
-
authPort: 9099,
|
|
53
|
-
functionsPort: 5001,
|
|
54
|
-
emulate: false
|
|
55
|
-
};
|
|
56
|
-
FirebaseHelper._emulatorConfig = FirebaseHelper.defaultEmulatorConfig;
|
|
57
|
-
//# sourceMappingURL=firebase-helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firebase-helper.js","sourceRoot":"","sources":["../src/firebase-helper.ts"],"names":[],"mappings":";;;AAAA,sCAAyD;AACzD,kDAA2F;AAC3F,wCAAuC;AACvC,8CAA6C;AAC7C,kDAAiD;AAyBjD,MAAa,cAAc;IAE1B,MAAM,CAAC,iBAAiB,CAAE,MAAsB;QAC/C,cAAc,CAAC,eAAe,GAAG,MAAM,CAAA;IACxC,CAAC;IAWD,MAAM,CAAC,WAAW,CAAE,cAAwC;QAE3D,IAAI,CAAC,eAAe,GAAG;YACtB,GAAG,cAAc,CAAC,qBAAqB;YACvC,OAAO,EAAE,IAAI;YACb,GAAG,cAAc;SACjB,CAAA;IACF,CAAC;IAED,MAAM,KAAK,QAAQ;QAClB,OAAO,IAAI,CAAC,eAAe,CAAA;IAC5B,CAAC;IAED;QACC,IAAK,CAAC,cAAc,CAAC,eAAe;YAAG,MAAM,IAAI,KAAK,CAAE,+DAA+D,CAAE,CAAA;QACzH,IAAI,CAAC,YAAY,GAAG,IAAA,mBAAa,EAAE,cAAc,CAAC,eAAe,CAAE,CAAA;IACpE,CAAC;IAED,MAAM,KAAK,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,IAAI,CAAE,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,EAAE,CAAE,CAAA;IACnE,CAAC;IAED,SAAS;QACR,OAAO,IAAA,wBAAY,EAAE,IAAI,CAAC,YAAY,CAAE,CAAA;IACzC,CAAC;IAED,OAAO;QACN,OAAO,IAAA,oBAAU,EAAE,IAAI,CAAC,YAAY,CAAE,CAAA;IACvC,CAAC;IAED,IAAI;QACH,OAAO,IAAA,cAAO,EAAE,IAAI,CAAC,YAAY,CAAE,CAAA;IACpC,CAAC;IAED,SAAS;QACR,OAAO,IAAA,wBAAY,EAAE,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,OAAO,CAAE,CAAA;IACjE,CAAC;IAED,MAAM,CAAC,SAAS,CAAE,MAAc;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;IACtB,CAAC;;AAvDF,wCA8DC;AAxDe,oCAAqB,GAAG;IACtC,IAAI,EAAE,WAAW;IACjB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,KAAK;CACd,CAAA;AA8Cc,8BAAe,GAAmB,cAAc,CAAC,qBAAqB,CAAA"}
|
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./store/firebase-datasource"), exports);
|
|
18
|
-
__exportStar(require("./firebase-helper"), exports);
|
|
19
|
-
__exportStar(require("./cloud-storage/firebase-cloud-storage"), exports);
|
|
20
|
-
__exportStar(require("./auth/firebase-auth"), exports);
|
|
21
|
-
__exportStar(require("./cloud-functions/firebase-cloud-functions"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C;AAC3C,oDAAiC;AACjC,yEAAsD;AACtD,uDAAoC;AACpC,6EAA0D"}
|
package/lib/mocks/test-user.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Persistent } from 'entropic-bond';
|
|
2
|
-
interface Name {
|
|
3
|
-
firstName: string;
|
|
4
|
-
lastName: string;
|
|
5
|
-
ancestorName?: {
|
|
6
|
-
father?: string;
|
|
7
|
-
mother?: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare class SubClass extends Persistent {
|
|
11
|
-
set year(value: number | undefined);
|
|
12
|
-
get year(): number | undefined;
|
|
13
|
-
private _year;
|
|
14
|
-
}
|
|
15
|
-
export declare class TestUser extends Persistent {
|
|
16
|
-
set name(value: Name | undefined);
|
|
17
|
-
get name(): Name | undefined;
|
|
18
|
-
set age(value: number | undefined);
|
|
19
|
-
get age(): number | undefined;
|
|
20
|
-
set admin(value: boolean | undefined);
|
|
21
|
-
get admin(): boolean | undefined;
|
|
22
|
-
set skills(value: string[] | undefined);
|
|
23
|
-
get skills(): string[] | undefined;
|
|
24
|
-
set documentRef(value: SubClass | undefined);
|
|
25
|
-
get documentRef(): SubClass | undefined;
|
|
26
|
-
set manyRefs(value: SubClass[]);
|
|
27
|
-
get manyRefs(): SubClass[];
|
|
28
|
-
set derived(value: DerivedUser | undefined);
|
|
29
|
-
get derived(): DerivedUser | undefined;
|
|
30
|
-
set manyDerived(value: DerivedUser[] | undefined);
|
|
31
|
-
get manyDerived(): DerivedUser[] | undefined;
|
|
32
|
-
set colleagues(value: TestUser[]);
|
|
33
|
-
get colleagues(): TestUser[];
|
|
34
|
-
private _colleagues;
|
|
35
|
-
private _name;
|
|
36
|
-
private _age;
|
|
37
|
-
private _admin;
|
|
38
|
-
private _skills;
|
|
39
|
-
private _documentRef;
|
|
40
|
-
private _manyRefs;
|
|
41
|
-
private _derived;
|
|
42
|
-
private _manyDerived;
|
|
43
|
-
}
|
|
44
|
-
export declare class DerivedUser extends TestUser {
|
|
45
|
-
set salary(value: number | undefined);
|
|
46
|
-
get salary(): number | undefined;
|
|
47
|
-
private _salary;
|
|
48
|
-
}
|
|
49
|
-
export {};
|