@redredgroup/nestjs-google-auth 1.0.0 → 1.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/dist/index.d.ts +1 -1
- package/dist/index.js +32 -33
- package/package.json +13 -19
package/dist/index.d.ts
CHANGED
|
@@ -36,4 +36,4 @@ declare class GoogleAuthenticationService {
|
|
|
36
36
|
}>;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export { GoogleAuthModule, GoogleAuthModuleAsyncOptions, GoogleAuthModuleOptions, GoogleAuthOptionsFactory, GoogleAuthenticationService };
|
|
39
|
+
export { GoogleAuthModule, type GoogleAuthModuleAsyncOptions, type GoogleAuthModuleOptions, type GoogleAuthOptionsFactory, GoogleAuthenticationService };
|
package/dist/index.js
CHANGED
|
@@ -17,18 +17,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var __publicField = (obj, key, value) =>
|
|
21
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
-
return value;
|
|
23
|
-
};
|
|
20
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
21
|
|
|
25
22
|
// src/index.ts
|
|
26
|
-
var
|
|
27
|
-
__export(
|
|
23
|
+
var index_exports = {};
|
|
24
|
+
__export(index_exports, {
|
|
28
25
|
GoogleAuthModule: () => GoogleAuthModule,
|
|
29
26
|
GoogleAuthenticationService: () => GoogleAuthenticationService
|
|
30
27
|
});
|
|
31
|
-
module.exports = __toCommonJS(
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
32
29
|
|
|
33
30
|
// src/authentication.module.ts
|
|
34
31
|
var import_common2 = require("@nestjs/common");
|
|
@@ -41,18 +38,13 @@ var import_common = require("@nestjs/common");
|
|
|
41
38
|
var import_googleapis = require("googleapis");
|
|
42
39
|
function _ts_decorate(decorators, target, key, desc) {
|
|
43
40
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
44
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
45
|
-
|
|
46
|
-
else
|
|
47
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
48
|
-
if (d = decorators[i])
|
|
49
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
41
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
42
|
+
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;
|
|
50
43
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
51
44
|
}
|
|
52
45
|
__name(_ts_decorate, "_ts_decorate");
|
|
53
46
|
function _ts_metadata(k, v) {
|
|
54
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
55
|
-
return Reflect.metadata(k, v);
|
|
47
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
56
48
|
}
|
|
57
49
|
__name(_ts_metadata, "_ts_metadata");
|
|
58
50
|
function _ts_param(paramIndex, decorator) {
|
|
@@ -61,7 +53,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
61
53
|
};
|
|
62
54
|
}
|
|
63
55
|
__name(_ts_param, "_ts_param");
|
|
64
|
-
var
|
|
56
|
+
var _GoogleAuthenticationService = class _GoogleAuthenticationService {
|
|
65
57
|
constructor(options) {
|
|
66
58
|
__publicField(this, "options");
|
|
67
59
|
__publicField(this, "googleAuth");
|
|
@@ -86,11 +78,13 @@ var GoogleAuthenticationService = class {
|
|
|
86
78
|
payload
|
|
87
79
|
};
|
|
88
80
|
} catch (error) {
|
|
89
|
-
|
|
81
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
82
|
+
throw new Error(`Failed to verify Google ID token: ${message}`);
|
|
90
83
|
}
|
|
91
84
|
}
|
|
92
85
|
};
|
|
93
|
-
__name(
|
|
86
|
+
__name(_GoogleAuthenticationService, "GoogleAuthenticationService");
|
|
87
|
+
var GoogleAuthenticationService = _GoogleAuthenticationService;
|
|
94
88
|
GoogleAuthenticationService = _ts_decorate([
|
|
95
89
|
(0, import_common.Injectable)(),
|
|
96
90
|
_ts_param(0, (0, import_common.Inject)(GOOGLE_AUTH_SERVICE_OPTIONS)),
|
|
@@ -103,20 +97,16 @@ GoogleAuthenticationService = _ts_decorate([
|
|
|
103
97
|
// src/authentication.module.ts
|
|
104
98
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
105
99
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
106
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
107
|
-
|
|
108
|
-
else
|
|
109
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
110
|
-
if (d = decorators[i])
|
|
111
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
100
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
101
|
+
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;
|
|
112
102
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
113
103
|
}
|
|
114
104
|
__name(_ts_decorate2, "_ts_decorate");
|
|
115
|
-
var
|
|
105
|
+
var _GoogleAuthModule = class _GoogleAuthModule {
|
|
116
106
|
static forRoot(options) {
|
|
117
107
|
return {
|
|
118
108
|
global: options.isGlobal,
|
|
119
|
-
module:
|
|
109
|
+
module: _GoogleAuthModule,
|
|
120
110
|
providers: [
|
|
121
111
|
{
|
|
122
112
|
provide: GOOGLE_AUTH_SERVICE_OPTIONS,
|
|
@@ -128,17 +118,20 @@ var GoogleAuthModule = class {
|
|
|
128
118
|
static forRootAsync(options) {
|
|
129
119
|
return {
|
|
130
120
|
global: options.isGlobal,
|
|
131
|
-
module:
|
|
121
|
+
module: _GoogleAuthModule,
|
|
132
122
|
imports: options.imports || [],
|
|
133
|
-
providers:
|
|
123
|
+
providers: _GoogleAuthModule.createAsyncProviders(options)
|
|
134
124
|
};
|
|
135
125
|
}
|
|
136
126
|
static createAsyncProviders(options) {
|
|
137
127
|
if (options.useExisting || options.useFactory) {
|
|
138
|
-
return
|
|
128
|
+
return _GoogleAuthModule.createAsyncOptionsProvider(options);
|
|
129
|
+
}
|
|
130
|
+
if (!options.useClass) {
|
|
131
|
+
return _GoogleAuthModule.createAsyncOptionsProvider(options);
|
|
139
132
|
}
|
|
140
133
|
return [
|
|
141
|
-
...
|
|
134
|
+
..._GoogleAuthModule.createAsyncOptionsProvider(options),
|
|
142
135
|
{
|
|
143
136
|
provide: options.useClass,
|
|
144
137
|
useClass: options.useClass
|
|
@@ -146,6 +139,7 @@ var GoogleAuthModule = class {
|
|
|
146
139
|
];
|
|
147
140
|
}
|
|
148
141
|
static createAsyncOptionsProvider(options) {
|
|
142
|
+
var _a;
|
|
149
143
|
if (options.useFactory) {
|
|
150
144
|
return [
|
|
151
145
|
{
|
|
@@ -155,18 +149,23 @@ var GoogleAuthModule = class {
|
|
|
155
149
|
}
|
|
156
150
|
];
|
|
157
151
|
}
|
|
152
|
+
const injectToken = (_a = options.useExisting) != null ? _a : options.useClass;
|
|
153
|
+
if (!injectToken) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
158
156
|
return [
|
|
159
157
|
{
|
|
160
158
|
provide: GOOGLE_AUTH_SERVICE_OPTIONS,
|
|
161
|
-
useFactory: async (optionsFactory) => await optionsFactory.createGoogleAuthOptions(),
|
|
159
|
+
useFactory: /* @__PURE__ */ __name(async (optionsFactory) => await optionsFactory.createGoogleAuthOptions(), "useFactory"),
|
|
162
160
|
inject: [
|
|
163
|
-
|
|
161
|
+
injectToken
|
|
164
162
|
]
|
|
165
163
|
}
|
|
166
164
|
];
|
|
167
165
|
}
|
|
168
166
|
};
|
|
169
|
-
__name(
|
|
167
|
+
__name(_GoogleAuthModule, "GoogleAuthModule");
|
|
168
|
+
var GoogleAuthModule = _GoogleAuthModule;
|
|
170
169
|
GoogleAuthModule = _ts_decorate2([
|
|
171
170
|
(0, import_common2.Module)({
|
|
172
171
|
providers: [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redredgroup/nestjs-google-auth",
|
|
3
3
|
"description": "Google Authentication integration to a NestJS application",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -29,22 +29,16 @@
|
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"google-auth-library": "10.
|
|
33
|
-
"googleapis": "
|
|
32
|
+
"google-auth-library": "10.6.2",
|
|
33
|
+
"googleapis": "171.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@nestjs/common": "11.1.
|
|
37
|
-
"@nestjs/core": "11.1.
|
|
38
|
-
"@swc/core": "1.
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"eslint": "8.52.0",
|
|
43
|
-
"eslint-config-prettier": "9.0.0",
|
|
44
|
-
"eslint-plugin-prettier": "5.0.1",
|
|
45
|
-
"prettier": "3.0.3",
|
|
46
|
-
"tsup": "6.7.0",
|
|
47
|
-
"vitest": "0.34.6"
|
|
36
|
+
"@nestjs/common": "11.1.21",
|
|
37
|
+
"@nestjs/core": "11.1.21",
|
|
38
|
+
"@swc/core": "1.15.33",
|
|
39
|
+
"@vitest/coverage-v8": "4.1.6",
|
|
40
|
+
"tsup": "8.5.1",
|
|
41
|
+
"vitest": "4.1.6"
|
|
48
42
|
},
|
|
49
43
|
"peerDependencies": {
|
|
50
44
|
"@nestjs/common": "^9.0.0 || ^10.0.0 || ^11.0.0"
|
|
@@ -53,15 +47,15 @@
|
|
|
53
47
|
"access": "public"
|
|
54
48
|
},
|
|
55
49
|
"engines": {
|
|
56
|
-
"node": "
|
|
50
|
+
"node": "24.13.0"
|
|
57
51
|
},
|
|
58
52
|
"scripts": {
|
|
59
53
|
"build": "tsup-node",
|
|
60
54
|
"build:production": "NODE_ENV=production tsup-node",
|
|
61
55
|
"build:watch": "tsup-node --watch",
|
|
62
|
-
"format": "
|
|
63
|
-
"lint": "
|
|
64
|
-
"lint:format": "
|
|
56
|
+
"format": "pnpm exec biome format --write .",
|
|
57
|
+
"lint": "pnpm exec biome check --write .",
|
|
58
|
+
"lint:format": "pnpm exec biome check .",
|
|
65
59
|
"syncpack:fix": "syncpack fix-mismatches --config ./.syncpackrc.js",
|
|
66
60
|
"syncpack:format": "syncpack format --config ./.syncpackrc.js",
|
|
67
61
|
"syncpack:lint": "syncpack lint --config ./.syncpackrc.js",
|