nestjs-firebase-admin 0.0.1
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/.commitlintrc.json +28 -0
- package/.eslintignore +3 -0
- package/.eslintrc.js +26 -0
- package/.release-it.json +8 -0
- package/LICENSE +21 -0
- package/README.md +79 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/modules/admin/admin.constants.d.ts +3 -0
- package/dist/modules/admin/admin.constants.js +6 -0
- package/dist/modules/admin/admin.module.d.ts +9 -0
- package/dist/modules/admin/admin.module.js +92 -0
- package/dist/modules/admin/admin.service.d.ts +16 -0
- package/dist/modules/admin/admin.service.js +59 -0
- package/dist/modules/admin/interfaces/admin-module.interface.d.ts +12 -0
- package/dist/modules/admin/interfaces/admin-module.interface.js +2 -0
- package/dist/modules/admin/interfaces/index.d.ts +1 -0
- package/dist/modules/admin/interfaces/index.js +17 -0
- package/dist/modules/admin/types/admin.type.d.ts +13 -0
- package/dist/modules/admin/types/admin.type.js +2 -0
- package/dist/modules/admin/types/index.d.ts +1 -0
- package/dist/modules/admin/types/index.js +17 -0
- package/index.d.ts +1 -0
- package/index.js +6 -0
- package/package.json +91 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@commitlint/config-angular"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"subject-case": [
|
|
5
|
+
2,
|
|
6
|
+
"always",
|
|
7
|
+
["sentence-case", "start-case", "pascal-case", "upper-case", "lower-case"]
|
|
8
|
+
],
|
|
9
|
+
"type-enum": [
|
|
10
|
+
2,
|
|
11
|
+
"always",
|
|
12
|
+
[
|
|
13
|
+
"build",
|
|
14
|
+
"chore",
|
|
15
|
+
"ci",
|
|
16
|
+
"docs",
|
|
17
|
+
"feat",
|
|
18
|
+
"fix",
|
|
19
|
+
"perf",
|
|
20
|
+
"refactor",
|
|
21
|
+
"revert",
|
|
22
|
+
"style",
|
|
23
|
+
"test",
|
|
24
|
+
"sample"
|
|
25
|
+
]
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
}
|
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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/.release-it.json
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Hebert Cisco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[](https://codecov.io/gh/hebertcisco/nestjs-firebase-admin)
|
|
2
|
+
|
|
3
|
+
[](https://dl.circleci.com/status-badge/redirect/gh/hebertcisco/nestjs-firebase-admin/tree/master)
|
|
4
|
+
|
|
5
|
+
[](https://github.com/hebertcisco/nestjs-firebase-admin/actions/workflows/npm-publish.yml)
|
|
6
|
+
|
|
7
|
+
[](https://github.com/hebertcisco/nestjs-firebase-admin/actions/workflows/coverage.yml)
|
|
8
|
+
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://nestjs.com/)
|
|
11
|
+
[](https://code.visualstudio.com/)
|
|
12
|
+
[](https://github.com/hebertcisco/nestjs-firebase-admin/actions)
|
|
13
|
+
|
|
14
|
+
> Firebase Admin SDK for Nestjs :fire:
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
> Install with yarn or npm: `yarn` or `npm`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# yarn
|
|
22
|
+
yarn add nestjs-firebase-admin
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# npm
|
|
27
|
+
npm i nestjs-firebase-admin --save
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# pnpm
|
|
32
|
+
pnpm add nestjs-firebase-admin --save
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Usage example
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// common.module.ts
|
|
39
|
+
import { Module } from '@nestjs/common';
|
|
40
|
+
|
|
41
|
+
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
42
|
+
import { AdminModule } from 'nestjs-firebase-admin';
|
|
43
|
+
|
|
44
|
+
import { CommonService } from './common.service';
|
|
45
|
+
|
|
46
|
+
@Module({
|
|
47
|
+
imports: [
|
|
48
|
+
AdminModule.register({
|
|
49
|
+
credential: {
|
|
50
|
+
projectId: 'my-project-id',
|
|
51
|
+
clientEmail: 'my-client-email',
|
|
52
|
+
privateKey: 'my-private-key',
|
|
53
|
+
},
|
|
54
|
+
databaseURL: 'https://my-project-id.firebaseio.com',
|
|
55
|
+
}),
|
|
56
|
+
],
|
|
57
|
+
providers: [CommonService],
|
|
58
|
+
})
|
|
59
|
+
export class CommonModule {}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 🤝 Contributing
|
|
63
|
+
|
|
64
|
+
Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](issues).
|
|
65
|
+
|
|
66
|
+
## Show your support
|
|
67
|
+
|
|
68
|
+
Give a ⭐️ if this project helped you!
|
|
69
|
+
|
|
70
|
+
Or buy me a coffee 🙌🏾
|
|
71
|
+
|
|
72
|
+
<a href="https://www.buymeacoffee.com/hebertcisco">
|
|
73
|
+
<img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=hebertcisco&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff" />
|
|
74
|
+
</a>
|
|
75
|
+
|
|
76
|
+
## 📝 License
|
|
77
|
+
|
|
78
|
+
Copyright © 2022 [Hebert F Barros](https://github.com/hebertcisco).<br />
|
|
79
|
+
This project is [MIT](LICENSE) licensed.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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);
|
|
@@ -0,0 +1,6 @@
|
|
|
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';
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import type { App } from 'firebase-admin/app';
|
|
4
|
+
import type { Agent } from 'node:http';
|
|
5
|
+
import type { AdminModuleOptions } from './types';
|
|
6
|
+
export declare class AdminService {
|
|
7
|
+
protected readonly options: AdminModuleOptions;
|
|
8
|
+
constructor(options: AdminModuleOptions);
|
|
9
|
+
applicationDefault(httpAgent?: Agent): import("firebase-admin/app").Credential;
|
|
10
|
+
deleteApp(app: App): Promise<void>;
|
|
11
|
+
get getApps(): App[];
|
|
12
|
+
get getApp(): App;
|
|
13
|
+
initializeApp(): App;
|
|
14
|
+
initializeAppObservable<T = App>(): Observable<App>;
|
|
15
|
+
get appRef(): App;
|
|
16
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AdminService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const rxjs_1 = require("rxjs");
|
|
18
|
+
const app_1 = require("firebase-admin/app");
|
|
19
|
+
const admin_constants_1 = require("./admin.constants");
|
|
20
|
+
let AdminService = class AdminService {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
applicationDefault(httpAgent) {
|
|
25
|
+
return (0, app_1.applicationDefault)(httpAgent);
|
|
26
|
+
}
|
|
27
|
+
deleteApp(app) {
|
|
28
|
+
return (0, app_1.deleteApp)(app);
|
|
29
|
+
}
|
|
30
|
+
get getApps() {
|
|
31
|
+
return (0, app_1.getApps)();
|
|
32
|
+
}
|
|
33
|
+
get getApp() {
|
|
34
|
+
return (0, app_1.getApp)();
|
|
35
|
+
}
|
|
36
|
+
initializeApp() {
|
|
37
|
+
return (0, app_1.initializeApp)(Object.assign({}, this.options));
|
|
38
|
+
}
|
|
39
|
+
initializeAppObservable() {
|
|
40
|
+
return new rxjs_1.Observable(subscriber => {
|
|
41
|
+
subscriber.next(this.appRef);
|
|
42
|
+
subscriber.complete();
|
|
43
|
+
return () => {
|
|
44
|
+
if (this.appRef.name) {
|
|
45
|
+
return this.appRef;
|
|
46
|
+
}
|
|
47
|
+
return this.getApp;
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
get appRef() {
|
|
52
|
+
return this.initializeApp();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
AdminService = __decorate([
|
|
56
|
+
__param(0, (0, common_1.Inject)(admin_constants_1.FIREBASE_ADMIN_INSTANCE_TOKEN)),
|
|
57
|
+
__metadata("design:paramtypes", [Object])
|
|
58
|
+
], AdminService);
|
|
59
|
+
exports.AdminService = AdminService;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './admin-module.interface';
|
|
@@ -0,0 +1,17 @@
|
|
|
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);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Agent } from 'node:http';
|
|
3
|
+
import type { Credential } from 'firebase-admin/app';
|
|
4
|
+
export declare type AdminConfig = {
|
|
5
|
+
credential: Credential;
|
|
6
|
+
databaseURL?: string;
|
|
7
|
+
databaseAuthVariableOverride?: object | null;
|
|
8
|
+
serviceAccountId?: string;
|
|
9
|
+
storageBucket?: string;
|
|
10
|
+
projectId?: string;
|
|
11
|
+
httpAgent?: Agent;
|
|
12
|
+
};
|
|
13
|
+
export declare type AdminModuleOptions = AdminConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './admin.type';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist';
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nestjs-firebase-admin",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Firebase Admin SDK for Nestjs",
|
|
5
|
+
"author": "Hebert Cisco",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"url": "https://github.com/hebertcisco/nestjs-firebase-admin#readme",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rimraf -rf dist && tsc -p tsconfig.json",
|
|
10
|
+
"format": "prettier --write \"{lib,test}/**/*.ts\"",
|
|
11
|
+
"lint": "eslint 'lib/**/*.ts' --fix",
|
|
12
|
+
"prepublish:npm": "npm run build",
|
|
13
|
+
"publish:npm": "npm publish --access public",
|
|
14
|
+
"prepublish:next": "npm run build",
|
|
15
|
+
"publish:next": "npm publish --access public --tag next",
|
|
16
|
+
"test:e2e": "jest --config ./tests/jest-e2e.json --runInBand",
|
|
17
|
+
"prerelease": "npm run build",
|
|
18
|
+
"release": "release-it",
|
|
19
|
+
"prepare": "npm run build",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:watch": "jest --watch",
|
|
22
|
+
"test:cov": "jest --coverage",
|
|
23
|
+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"axios": "0.27.2",
|
|
27
|
+
"firebase-admin": "^11.0.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@commitlint/cli": "17.1.2",
|
|
31
|
+
"@commitlint/config-angular": "17.1.0",
|
|
32
|
+
"@nestjs/common": "8.4.7",
|
|
33
|
+
"@nestjs/core": "8.4.7",
|
|
34
|
+
"@nestjs/platform-express": "8.4.7",
|
|
35
|
+
"@nestjs/testing": "^8.4.7",
|
|
36
|
+
"@types/jest": "29.0.3",
|
|
37
|
+
"@types/node": "16.11.41",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "5.30.0",
|
|
39
|
+
"@typescript-eslint/parser": "5.30.0",
|
|
40
|
+
"eslint": "8.23.1",
|
|
41
|
+
"eslint-config-prettier": "8.5.0",
|
|
42
|
+
"eslint-plugin-import": "2.26.0",
|
|
43
|
+
"husky": "8.0.1",
|
|
44
|
+
"jest": "29.0.3",
|
|
45
|
+
"lint-staged": "13.0.3",
|
|
46
|
+
"prettier": "2.7.1",
|
|
47
|
+
"reflect-metadata": "0.1.13",
|
|
48
|
+
"release-it": "15.4.2",
|
|
49
|
+
"rimraf": "3.0.2",
|
|
50
|
+
"rxjs": "7.5.6",
|
|
51
|
+
"ts-jest": "29.0.1",
|
|
52
|
+
"typescript": "4.8.3"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@nestjs/common": "^7.0.0 || ^8.0.0",
|
|
56
|
+
"reflect-metadata": "^0.1.12",
|
|
57
|
+
"rxjs": "^6.0.0 || ^7.0.0"
|
|
58
|
+
},
|
|
59
|
+
"lint-staged": {
|
|
60
|
+
"*.ts": [
|
|
61
|
+
"prettier --write"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"husky": {
|
|
65
|
+
"hooks": {
|
|
66
|
+
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS",
|
|
67
|
+
"pre-commit": "lint-staged"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"repository": {
|
|
71
|
+
"type": "git",
|
|
72
|
+
"url": "https://github.com/hebertcisco/nestjs-firebase-admin"
|
|
73
|
+
},
|
|
74
|
+
"jest": {
|
|
75
|
+
"moduleFileExtensions": [
|
|
76
|
+
"js",
|
|
77
|
+
"json",
|
|
78
|
+
"ts"
|
|
79
|
+
],
|
|
80
|
+
"rootDir": "lib",
|
|
81
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
82
|
+
"transform": {
|
|
83
|
+
"^.+\\.(t|j)s$": "ts-jest"
|
|
84
|
+
},
|
|
85
|
+
"collectCoverageFrom": [
|
|
86
|
+
"**/*.(t|j)s"
|
|
87
|
+
],
|
|
88
|
+
"coverageDirectory": "../coverage",
|
|
89
|
+
"testEnvironment": "node"
|
|
90
|
+
}
|
|
91
|
+
}
|