nestjs-firebase-admin 0.0.74 → 0.0.76
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/.eslintrc +21 -0
- package/.gitpod.yml +10 -0
- package/package.json +54 -31
- package/tsconfig.build.json +4 -0
- package/.eslintrc.js +0 -26
- package/SECURITY.md +0 -21
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -20
- package/dist/modules/admin/admin.constants.d.ts +0 -3
- package/dist/modules/admin/admin.constants.js +0 -6
- package/dist/modules/admin/admin.module.d.ts +0 -9
- package/dist/modules/admin/admin.module.js +0 -92
- package/dist/modules/admin/admin.service.d.ts +0 -18
- package/dist/modules/admin/admin.service.js +0 -95
- package/dist/modules/admin/interfaces/admin-module.interface.d.ts +0 -12
- package/dist/modules/admin/interfaces/admin-module.interface.js +0 -2
- package/dist/modules/admin/interfaces/index.d.ts +0 -1
- package/dist/modules/admin/interfaces/index.js +0 -17
- package/dist/modules/admin/types/admin.type.d.ts +0 -13
- package/dist/modules/admin/types/admin.type.js +0 -2
- package/dist/modules/admin/types/index.d.ts +0 -1
- package/dist/modules/admin/types/index.js +0 -17
- package/index.d.ts +0 -1
- package/index.js +0 -6
package/.eslintrc
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": [
|
|
5
|
+
"@typescript-eslint",
|
|
6
|
+
"jest"
|
|
7
|
+
],
|
|
8
|
+
"extends": [
|
|
9
|
+
"eslint:recommended",
|
|
10
|
+
"plugin:@typescript-eslint/recommended",
|
|
11
|
+
"plugin:jest/recommended"
|
|
12
|
+
],
|
|
13
|
+
"rules": {
|
|
14
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
15
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
16
|
+
"jest/no-export": "off",
|
|
17
|
+
"jest/no-disabled-tests": "off",
|
|
18
|
+
"jest/expect-expect": "off",
|
|
19
|
+
"jest/valid-title": "off"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/.gitpod.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This configuration file was automatically generated by Gitpod.
|
|
2
|
+
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
|
|
3
|
+
# and commit this file to your remote git repository to share the goodness with others.
|
|
4
|
+
|
|
5
|
+
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart
|
|
6
|
+
|
|
7
|
+
tasks:
|
|
8
|
+
- init: npm install && npm run build
|
|
9
|
+
|
|
10
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-firebase-admin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"description": "Firebase Admin SDK for Nestjs",
|
|
5
5
|
"author": "Hebert Cisco",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,50 +9,73 @@
|
|
|
9
9
|
"node": ">=16.17.1",
|
|
10
10
|
"npm": ">=8.15.0"
|
|
11
11
|
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
12
14
|
"scripts": {
|
|
13
|
-
"build": "
|
|
14
|
-
"
|
|
15
|
-
"
|
|
15
|
+
"build": "npx tsc",
|
|
16
|
+
"prebuild": "rimraf dist",
|
|
17
|
+
"format": "npx prettier --write \"{lib,test}/**/*.ts\"",
|
|
18
|
+
"lint": "npx eslint 'lib/**/*.ts' --fix",
|
|
16
19
|
"prepublish:npm": "npm run build",
|
|
17
20
|
"publish:npm": "npm publish --access public",
|
|
18
21
|
"prepublish:next": "npm run build",
|
|
19
22
|
"publish:next": "npm publish --access public --tag next",
|
|
20
|
-
"test:e2e": "jest --config ./tests/jest-e2e.json --runInBand",
|
|
23
|
+
"test:e2e": "npx jest --config ./tests/jest-e2e.json --runInBand",
|
|
21
24
|
"prerelease": "npm run build",
|
|
22
25
|
"release": "release-it",
|
|
23
26
|
"prepare": "npm run build",
|
|
24
|
-
"test": "jest",
|
|
25
|
-
"test:watch": "jest --watch",
|
|
26
|
-
"test:cov": "jest --coverage",
|
|
27
|
-
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"
|
|
27
|
+
"test": "npx jest",
|
|
28
|
+
"test:watch": "npx jest --watch",
|
|
29
|
+
"test:cov": "npx jest --coverage",
|
|
30
|
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
31
|
+
"prepublishOnly": "npm test && npm run lint",
|
|
32
|
+
"preversion": "npm run lint",
|
|
33
|
+
"version": "npm run format && git add -A lib",
|
|
34
|
+
"postversion": "git push && git push --tags"
|
|
28
35
|
},
|
|
29
36
|
"dependencies": {
|
|
30
|
-
"firebase-admin": "11.
|
|
37
|
+
"firebase-admin": "11.7.0",
|
|
38
|
+
"nest-shared": "^5.0.1",
|
|
39
|
+
"nestjs-firebase-admin": "0.0.74"
|
|
31
40
|
},
|
|
41
|
+
"os": [
|
|
42
|
+
"!darwin",
|
|
43
|
+
"linux",
|
|
44
|
+
"win32"
|
|
45
|
+
],
|
|
46
|
+
"cpu": [
|
|
47
|
+
"x64",
|
|
48
|
+
"arm",
|
|
49
|
+
"!mips"
|
|
50
|
+
],
|
|
32
51
|
"devDependencies": {
|
|
33
|
-
"@commitlint/cli": "17.
|
|
34
|
-
"@commitlint/config-angular": "17.
|
|
35
|
-
"@nestjs/common": "9.
|
|
36
|
-
"@nestjs/core": "9.
|
|
37
|
-
"@nestjs/platform-express": "9.
|
|
38
|
-
"@nestjs/testing": "9.
|
|
39
|
-
"@types/jest": "29.
|
|
40
|
-
"@types/node": "18.
|
|
41
|
-
"@
|
|
42
|
-
"@typescript-eslint/
|
|
43
|
-
"eslint": "
|
|
44
|
-
"eslint
|
|
45
|
-
"eslint-
|
|
46
|
-
"
|
|
47
|
-
"jest": "
|
|
48
|
-
"
|
|
49
|
-
"
|
|
52
|
+
"@commitlint/cli": "17.6.1",
|
|
53
|
+
"@commitlint/config-angular": "17.6.1",
|
|
54
|
+
"@nestjs/common": "9.4.0",
|
|
55
|
+
"@nestjs/core": "9.4.0",
|
|
56
|
+
"@nestjs/platform-express": "9.4.0",
|
|
57
|
+
"@nestjs/testing": "9.4.0",
|
|
58
|
+
"@types/jest": "29.5.1",
|
|
59
|
+
"@types/node": "18.15.12",
|
|
60
|
+
"@types/supertest": "^2.0.12",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
62
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
63
|
+
"eslint": "8.38.0",
|
|
64
|
+
"eslint-config-prettier": "8.8.0",
|
|
65
|
+
"eslint-plugin-import": "2.27.5",
|
|
66
|
+
"eslint-plugin-jest": "^27.2.1",
|
|
67
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
68
|
+
"husky": "8.0.3",
|
|
69
|
+
"jest": "29.5.0",
|
|
70
|
+
"lint-staged": "13.2.1",
|
|
71
|
+
"prettier": "^2.8.7",
|
|
50
72
|
"reflect-metadata": "0.1.13",
|
|
51
|
-
"release-it": "15.
|
|
52
|
-
"rimraf": "
|
|
73
|
+
"release-it": "15.10.1",
|
|
74
|
+
"rimraf": "5.0.0",
|
|
53
75
|
"rxjs": "7.8.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
76
|
+
"supertest": "^6.3.3",
|
|
77
|
+
"ts-jest": "29.1.0",
|
|
78
|
+
"typescript": "5.0.4"
|
|
56
79
|
},
|
|
57
80
|
"peerDependencies": {
|
|
58
81
|
"@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.2.1",
|
package/.eslintrc.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
|
-
sourceType: 'module',
|
|
6
|
-
},
|
|
7
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
8
|
-
extends: [
|
|
9
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
10
|
-
'plugin:@typescript-eslint/recommended',
|
|
11
|
-
'prettier',
|
|
12
|
-
'prettier/@typescript-eslint',
|
|
13
|
-
],
|
|
14
|
-
root: true,
|
|
15
|
-
env: {
|
|
16
|
-
node: true,
|
|
17
|
-
jest: true,
|
|
18
|
-
},
|
|
19
|
-
rules: {
|
|
20
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
21
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
22
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
23
|
-
'@typescript-eslint/no-use-before-define': 'off',
|
|
24
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
25
|
-
},
|
|
26
|
-
};
|
package/SECURITY.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Supported Versions
|
|
4
|
-
|
|
5
|
-
Use this section to tell people about which versions of your project are
|
|
6
|
-
currently being supported with security updates.
|
|
7
|
-
|
|
8
|
-
| Version | Supported |
|
|
9
|
-
| ------- | ------------------ |
|
|
10
|
-
| 5.1.x | :white_check_mark: |
|
|
11
|
-
| 5.0.x | :x: |
|
|
12
|
-
| 4.0.x | :white_check_mark: |
|
|
13
|
-
| < 4.0 | :x: |
|
|
14
|
-
|
|
15
|
-
## Reporting a Vulnerability
|
|
16
|
-
|
|
17
|
-
Use this section to tell people how to report a vulnerability.
|
|
18
|
-
|
|
19
|
-
Tell them where to go, how often they can expect to get an update on a
|
|
20
|
-
reported vulnerability, what to expect if the vulnerability is accepted or
|
|
21
|
-
declined, etc.
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,20 +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("./modules/admin/admin.module"), exports);
|
|
18
|
-
__exportStar(require("./modules/admin/admin.service"), exports);
|
|
19
|
-
__exportStar(require("./modules/admin/interfaces"), exports);
|
|
20
|
-
__exportStar(require("./modules/admin/types"), exports);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ADMIN_MODULE_OPTIONS = exports.ADMIN_MODULE_ID = exports.FIREBASE_ADMIN_INSTANCE_TOKEN = void 0;
|
|
4
|
-
exports.FIREBASE_ADMIN_INSTANCE_TOKEN = 'FIREBASE_ADMIN_INSTANCE_TOKEN';
|
|
5
|
-
exports.ADMIN_MODULE_ID = 'ADMIN_MODULE_ID';
|
|
6
|
-
exports.ADMIN_MODULE_OPTIONS = 'ADMIN_MODULE_OPTIONS';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import type { AdminModuleAsyncOptions } from './interfaces';
|
|
3
|
-
import type { AdminModuleOptions } from './types';
|
|
4
|
-
export declare class AdminModule {
|
|
5
|
-
static register(options: AdminModuleOptions): DynamicModule;
|
|
6
|
-
static registerAsync(options: AdminModuleAsyncOptions): DynamicModule;
|
|
7
|
-
private static createAsyncProviders;
|
|
8
|
-
private static createAsyncOptionsProvider;
|
|
9
|
-
}
|
|
@@ -1,92 +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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var AdminModule_1;
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.AdminModule = void 0;
|
|
20
|
-
const common_1 = require("@nestjs/common");
|
|
21
|
-
const random_string_generator_util_1 = require("@nestjs/common/utils/random-string-generator.util");
|
|
22
|
-
const admin_constants_1 = require("./admin.constants");
|
|
23
|
-
const admin_service_1 = require("./admin.service");
|
|
24
|
-
let AdminModule = AdminModule_1 = class AdminModule {
|
|
25
|
-
static register(options) {
|
|
26
|
-
return {
|
|
27
|
-
module: AdminModule_1,
|
|
28
|
-
providers: [
|
|
29
|
-
{
|
|
30
|
-
provide: admin_constants_1.FIREBASE_ADMIN_INSTANCE_TOKEN,
|
|
31
|
-
useValue: options,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
provide: admin_constants_1.ADMIN_MODULE_ID,
|
|
35
|
-
useValue: (0, random_string_generator_util_1.randomStringGenerator)(),
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
static registerAsync(options) {
|
|
41
|
-
return {
|
|
42
|
-
module: AdminModule_1,
|
|
43
|
-
imports: options.imports,
|
|
44
|
-
providers: [
|
|
45
|
-
...this.createAsyncProviders(options),
|
|
46
|
-
{
|
|
47
|
-
provide: admin_constants_1.FIREBASE_ADMIN_INSTANCE_TOKEN,
|
|
48
|
-
useFactory: (options) => options,
|
|
49
|
-
inject: [admin_constants_1.ADMIN_MODULE_OPTIONS],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
provide: admin_constants_1.ADMIN_MODULE_ID,
|
|
53
|
-
useValue: (0, random_string_generator_util_1.randomStringGenerator)(),
|
|
54
|
-
},
|
|
55
|
-
...(options.extraProviders || []),
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
static createAsyncProviders(options) {
|
|
60
|
-
if (options.useExisting || options.useFactory) {
|
|
61
|
-
return [this.createAsyncOptionsProvider(options)];
|
|
62
|
-
}
|
|
63
|
-
return [
|
|
64
|
-
this.createAsyncOptionsProvider(options),
|
|
65
|
-
{
|
|
66
|
-
provide: options.useClass,
|
|
67
|
-
useClass: options.useClass,
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
static createAsyncOptionsProvider(options) {
|
|
72
|
-
if (options.useFactory) {
|
|
73
|
-
return {
|
|
74
|
-
provide: admin_constants_1.ADMIN_MODULE_OPTIONS,
|
|
75
|
-
useFactory: options.useFactory,
|
|
76
|
-
inject: options.inject || [],
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
provide: admin_constants_1.ADMIN_MODULE_OPTIONS,
|
|
81
|
-
useFactory: (optionsFactory) => __awaiter(this, void 0, void 0, function* () { return optionsFactory.createAdminOptions(); }),
|
|
82
|
-
inject: [options.useExisting || options.useClass],
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
AdminModule = AdminModule_1 = __decorate([
|
|
87
|
-
(0, common_1.Module)({
|
|
88
|
-
providers: [admin_service_1.AdminService],
|
|
89
|
-
exports: [admin_service_1.AdminService],
|
|
90
|
-
})
|
|
91
|
-
], AdminModule);
|
|
92
|
-
exports.AdminModule = AdminModule;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import Admin from 'firebase-admin';
|
|
4
|
-
import type { App } from 'firebase-admin/app';
|
|
5
|
-
import type { Agent } from 'node:http';
|
|
6
|
-
import type { AdminModuleOptions } from './types';
|
|
7
|
-
export declare class AdminService {
|
|
8
|
-
protected readonly options: AdminModuleOptions;
|
|
9
|
-
constructor(options: AdminModuleOptions);
|
|
10
|
-
applicationDefault(httpAgent?: Agent): import("firebase-admin/app").Credential;
|
|
11
|
-
deleteApp(app: App): Promise<void>;
|
|
12
|
-
get getApps(): App[];
|
|
13
|
-
get getApp(): App;
|
|
14
|
-
admin(): typeof Admin;
|
|
15
|
-
initializeAppObservable<T = App>(): Observable<App>;
|
|
16
|
-
get appRef(): App;
|
|
17
|
-
initializeApp(): App;
|
|
18
|
-
}
|
|
@@ -1,95 +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
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.AdminService = void 0;
|
|
19
|
-
const common_1 = require("@nestjs/common");
|
|
20
|
-
const rxjs_1 = require("rxjs");
|
|
21
|
-
const app_1 = require("firebase-admin/app");
|
|
22
|
-
const firebase_admin_1 = __importDefault(require("firebase-admin"));
|
|
23
|
-
const admin_constants_1 = require("./admin.constants");
|
|
24
|
-
let AdminService = class AdminService {
|
|
25
|
-
constructor(options) {
|
|
26
|
-
this.options = options;
|
|
27
|
-
firebase_admin_1.default.initializeApp(Object.assign(Object.assign({}, this.options), { credential: firebase_admin_1.default.credential.cert(this.options.credential) }));
|
|
28
|
-
}
|
|
29
|
-
applicationDefault(httpAgent) {
|
|
30
|
-
return (0, app_1.applicationDefault)(httpAgent);
|
|
31
|
-
}
|
|
32
|
-
deleteApp(app) {
|
|
33
|
-
return (0, app_1.deleteApp)(app);
|
|
34
|
-
}
|
|
35
|
-
get getApps() {
|
|
36
|
-
return (0, app_1.getApps)();
|
|
37
|
-
}
|
|
38
|
-
get getApp() {
|
|
39
|
-
return (0, app_1.getApp)();
|
|
40
|
-
}
|
|
41
|
-
admin() {
|
|
42
|
-
return firebase_admin_1.default;
|
|
43
|
-
}
|
|
44
|
-
initializeAppObservable() {
|
|
45
|
-
return new rxjs_1.Observable(subscriber => {
|
|
46
|
-
subscriber.next(this.appRef);
|
|
47
|
-
subscriber.complete();
|
|
48
|
-
return () => {
|
|
49
|
-
if (this.appRef.name) {
|
|
50
|
-
return this.appRef;
|
|
51
|
-
}
|
|
52
|
-
return this.getApp;
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
get appRef() {
|
|
57
|
-
return this.initializeApp();
|
|
58
|
-
}
|
|
59
|
-
initializeApp() {
|
|
60
|
-
let options = undefined;
|
|
61
|
-
if ('credential' in this.options) {
|
|
62
|
-
options.credential = this.options.credential;
|
|
63
|
-
}
|
|
64
|
-
if ('databaseAuthVariableOverride' in this.options) {
|
|
65
|
-
options.databaseAuthVariableOverride = this.options.databaseAuthVariableOverride;
|
|
66
|
-
}
|
|
67
|
-
if ('databaseURL' in this.options) {
|
|
68
|
-
options.databaseURL = this.options.databaseURL;
|
|
69
|
-
}
|
|
70
|
-
if ('httpAgent' in this.options) {
|
|
71
|
-
options.httpAgent = this.options.httpAgent;
|
|
72
|
-
}
|
|
73
|
-
if ('projectId' in this.options) {
|
|
74
|
-
options.projectId = this.options.projectId;
|
|
75
|
-
}
|
|
76
|
-
if ('serviceAccountId' in this.options) {
|
|
77
|
-
options.serviceAccountId = this.options.serviceAccountId;
|
|
78
|
-
}
|
|
79
|
-
if ('storageBucket' in this.options) {
|
|
80
|
-
options.storageBucket = this.options.storageBucket;
|
|
81
|
-
}
|
|
82
|
-
if (!options && this.options.credential) {
|
|
83
|
-
return firebase_admin_1.default.initializeApp({
|
|
84
|
-
credential: firebase_admin_1.default.credential.cert(this.options.credential)
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return this.admin().initializeApp(Object.assign(Object.assign({}, options), { credential: firebase_admin_1.default.credential.cert(this.options.credential) }));
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
AdminService = __decorate([
|
|
91
|
-
(0, common_1.Injectable)(),
|
|
92
|
-
__param(0, (0, common_1.Inject)(admin_constants_1.FIREBASE_ADMIN_INSTANCE_TOKEN)),
|
|
93
|
-
__metadata("design:paramtypes", [Object])
|
|
94
|
-
], AdminService);
|
|
95
|
-
exports.AdminService = AdminService;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ModuleMetadata, Provider, Type } from '@nestjs/common';
|
|
2
|
-
import { AdminModuleOptions } from '../types';
|
|
3
|
-
export interface AdminModuleOptionsFactory {
|
|
4
|
-
createAdminOptions(): Promise<AdminModuleOptions> | AdminModuleOptions;
|
|
5
|
-
}
|
|
6
|
-
export interface AdminModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
7
|
-
useExisting?: Type<AdminModuleOptionsFactory>;
|
|
8
|
-
useClass?: Type<AdminModuleOptionsFactory>;
|
|
9
|
-
useFactory?: (...args: any[]) => Promise<AdminModuleOptions> | AdminModuleOptions;
|
|
10
|
-
inject?: any[];
|
|
11
|
-
extraProviders?: Provider[];
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './admin-module.interface';
|
|
@@ -1,17 +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("./admin-module.interface"), exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Agent } from 'node:http';
|
|
3
|
-
import type { ServiceAccount } from 'firebase-admin/app';
|
|
4
|
-
export type AdminConfig = {
|
|
5
|
-
credential: ServiceAccount;
|
|
6
|
-
databaseURL?: string;
|
|
7
|
-
databaseAuthVariableOverride?: object | null;
|
|
8
|
-
serviceAccountId?: string;
|
|
9
|
-
storageBucket?: string;
|
|
10
|
-
projectId?: string;
|
|
11
|
-
httpAgent?: Agent;
|
|
12
|
-
};
|
|
13
|
-
export type AdminModuleOptions = AdminConfig;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './admin.type';
|
|
@@ -1,17 +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("./admin.type"), exports);
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist';
|