@gasboost/auth 0.3.0 → 0.4.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/AppsScriptAuth.js +21 -17
- package/dist/AuthPattern.js +4 -1
- package/dist/api/AppsScriptAuthPassword.js +17 -13
- package/dist/api/AppsScriptAuthSession.js +5 -1
- package/dist/api/AppsScriptAuthSignIn.js +12 -8
- package/dist/api/AppsScriptAuthSignOut.js +5 -1
- package/dist/api/AppsScriptAuthSignUp.js +12 -8
- package/dist/api/SignIn.js +7 -3
- package/dist/api/SignUp.js +7 -3
- package/dist/authentication/AppsScriptAuthentication.js +11 -6
- package/dist/authentication/Authentication.js +2 -1
- package/dist/authentication/EmailPasswordAuthentication.js +13 -8
- package/dist/domain/Account.js +5 -1
- package/dist/domain/Errors.js +5 -1
- package/dist/domain/Password.js +7 -2
- package/dist/domain/PasswordCredential.js +18 -14
- package/dist/domain/PasswordReset.js +8 -4
- package/dist/domain/PasswordResetToken.js +5 -1
- package/dist/domain/Session.js +5 -1
- package/dist/domain/User.js +5 -1
- package/dist/factory/sessionStorageFactory.js +8 -5
- package/dist/hooks/AuthHooks.js +2 -1
- package/dist/identity/AppsScriptIdentity.js +7 -3
- package/dist/identity/EmailPasswordIdentity.js +7 -3
- package/dist/identity/ProviderIdentity.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +24 -10
- package/dist/registration/AppsScriptRegistration.js +13 -9
- package/dist/registration/EmailPasswordRegistration.js +15 -11
- package/dist/registration/Registration.js +2 -1
- package/dist/schema/AuthSchema.d.ts +2 -10
- package/dist/schema/AuthSchema.js +30 -31
- package/dist/schema/createAuthTables.d.ts +33 -0
- package/dist/schema/createAuthTables.js +56 -0
- package/dist/storage/AppsScriptAuthRepository.js +2 -1
- package/dist/storage/AppsScriptCacheSessionStorage.js +7 -3
- package/dist/storage/AppsScriptPropertiesSessionStorage.js +8 -4
- package/dist/storage/AppsScriptSessionStorage.js +2 -1
- package/package.json +6 -1
package/dist/AppsScriptAuth.js
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuth = void 0;
|
|
4
|
+
const AppsScriptAuthPassword_1 = require("./api/AppsScriptAuthPassword");
|
|
5
|
+
const AppsScriptAuthSession_1 = require("./api/AppsScriptAuthSession");
|
|
6
|
+
const AppsScriptAuthSignIn_1 = require("./api/AppsScriptAuthSignIn");
|
|
7
|
+
const AppsScriptAuthSignOut_1 = require("./api/AppsScriptAuthSignOut");
|
|
8
|
+
const AppsScriptAuthSignUp_1 = require("./api/AppsScriptAuthSignUp");
|
|
9
|
+
const AppsScriptAuthentication_1 = require("./authentication/AppsScriptAuthentication");
|
|
10
|
+
const EmailPasswordAuthentication_1 = require("./authentication/EmailPasswordAuthentication");
|
|
11
|
+
const sessionStorageFactory_1 = require("./factory/sessionStorageFactory");
|
|
12
|
+
class AppsScriptAuth {
|
|
10
13
|
signIn;
|
|
11
14
|
signUp;
|
|
12
15
|
session;
|
|
13
16
|
signOut;
|
|
14
17
|
password;
|
|
15
18
|
constructor({ repository, session, runtime, emailPassword, appsScript, hooks, }) {
|
|
16
|
-
const sessionStorage = sessionStorageFactory(session.storageType, {
|
|
19
|
+
const sessionStorage = (0, sessionStorageFactory_1.sessionStorageFactory)(session.storageType, {
|
|
17
20
|
cacheService: runtime.cacheService,
|
|
18
21
|
propertiesService: runtime.propertiesService,
|
|
19
22
|
});
|
|
20
23
|
const expiresIn = session.expiresIn ?? 60 * 20;
|
|
21
24
|
const emailPasswordConfig = emailPassword
|
|
22
|
-
? new EmailPasswordAuthConfig(emailPassword)
|
|
25
|
+
? new EmailPasswordAuthentication_1.EmailPasswordAuthConfig(emailPassword)
|
|
23
26
|
: undefined;
|
|
24
27
|
const appsScriptConfig = appsScript
|
|
25
|
-
? new AppsScriptAuthenticationConfig(appsScript)
|
|
28
|
+
? new AppsScriptAuthentication_1.AppsScriptAuthenticationConfig(appsScript)
|
|
26
29
|
: undefined;
|
|
27
|
-
this.signIn = new AppsScriptAuthSignIn({
|
|
30
|
+
this.signIn = new AppsScriptAuthSignIn_1.AppsScriptAuthSignIn({
|
|
28
31
|
sessionStorage,
|
|
29
32
|
repository,
|
|
30
33
|
emailPassword: emailPasswordConfig,
|
|
@@ -38,7 +41,7 @@ export class AppsScriptAuth {
|
|
|
38
41
|
}
|
|
39
42
|
: {}),
|
|
40
43
|
});
|
|
41
|
-
this.signUp = new AppsScriptAuthSignUp({
|
|
44
|
+
this.signUp = new AppsScriptAuthSignUp_1.AppsScriptAuthSignUp({
|
|
42
45
|
sessionStorage,
|
|
43
46
|
expiresIn,
|
|
44
47
|
repository,
|
|
@@ -47,12 +50,12 @@ export class AppsScriptAuth {
|
|
|
47
50
|
utilities: runtime.utilities,
|
|
48
51
|
session: runtime.session,
|
|
49
52
|
});
|
|
50
|
-
this.session = new AppsScriptAuthSession({
|
|
53
|
+
this.session = new AppsScriptAuthSession_1.AppsScriptAuthSession({
|
|
51
54
|
sessionStorage,
|
|
52
55
|
});
|
|
53
|
-
this.signOut = new AppsScriptAuthSignOut(sessionStorage);
|
|
56
|
+
this.signOut = new AppsScriptAuthSignOut_1.AppsScriptAuthSignOut(sessionStorage);
|
|
54
57
|
this.password = (emailPasswordConfig?.passwordReset
|
|
55
|
-
? new AppsScriptAuthPassword({
|
|
58
|
+
? new AppsScriptAuthPassword_1.AppsScriptAuthPassword({
|
|
56
59
|
repository,
|
|
57
60
|
utilities: runtime.utilities,
|
|
58
61
|
emailPassword: emailPasswordConfig,
|
|
@@ -60,3 +63,4 @@ export class AppsScriptAuth {
|
|
|
60
63
|
: undefined);
|
|
61
64
|
}
|
|
62
65
|
}
|
|
66
|
+
exports.AppsScriptAuth = AppsScriptAuth;
|
package/dist/AuthPattern.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuthPassword = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
const Errors_1 = require("../domain/Errors");
|
|
6
|
+
const Password_1 = require("../domain/Password");
|
|
7
|
+
const PasswordCredential_1 = require("../domain/PasswordCredential");
|
|
8
|
+
const PasswordResetToken_1 = require("../domain/PasswordResetToken");
|
|
9
|
+
const EmailPasswordIdentity_1 = require("../identity/EmailPasswordIdentity");
|
|
10
|
+
class AppsScriptAuthPassword {
|
|
8
11
|
repository;
|
|
9
12
|
utilities;
|
|
10
13
|
emailPassword;
|
|
@@ -24,16 +27,16 @@ export class AppsScriptAuthPassword {
|
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
async forgot({ email }) {
|
|
27
|
-
const account = await this.repository.account.findByIdentity(authPattern.emailPassword, email);
|
|
30
|
+
const account = await this.repository.account.findByIdentity(AuthPattern_1.authPattern.emailPassword, email);
|
|
28
31
|
if (account === null) {
|
|
29
32
|
return;
|
|
30
33
|
}
|
|
31
|
-
if (!(account.identity instanceof EmailPasswordIdentity)) {
|
|
34
|
+
if (!(account.identity instanceof EmailPasswordIdentity_1.EmailPasswordIdentity)) {
|
|
32
35
|
throw new Error("Invalid account identity");
|
|
33
36
|
}
|
|
34
37
|
const now = new Date();
|
|
35
38
|
const expiresAt = new Date(now.getTime() + this.config.expiresIn * 1000);
|
|
36
|
-
const { credential, token } = PasswordCredential.generate({
|
|
39
|
+
const { credential, token } = PasswordCredential_1.PasswordCredential.generate({
|
|
37
40
|
account,
|
|
38
41
|
utilities: this.utilities,
|
|
39
42
|
expiresAt,
|
|
@@ -46,12 +49,12 @@ export class AppsScriptAuthPassword {
|
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
async reset({ token, newPassword, }) {
|
|
49
|
-
const passwordResetToken = new PasswordResetToken(token);
|
|
52
|
+
const passwordResetToken = new PasswordResetToken_1.PasswordResetToken(token);
|
|
50
53
|
const credential = await this.repository.passwordCredential.findByResetTokenHash(passwordResetToken.hash(this.utilities));
|
|
51
54
|
if (credential === null) {
|
|
52
|
-
throw new InvalidPasswordResetError();
|
|
55
|
+
throw new Errors_1.InvalidPasswordResetError();
|
|
53
56
|
}
|
|
54
|
-
const password = new Password(newPassword, this.utilities, this.emailPassword.pepper, this.emailPassword.iterations);
|
|
57
|
+
const password = new Password_1.Password(newPassword, this.utilities, this.emailPassword.pepper, this.emailPassword.iterations);
|
|
55
58
|
const hashedPassword = await password.hash(credential.account.id);
|
|
56
59
|
const updatedCredential = credential.resetPassword({
|
|
57
60
|
token,
|
|
@@ -62,3 +65,4 @@ export class AppsScriptAuthPassword {
|
|
|
62
65
|
await this.repository.passwordCredential.save(updatedCredential);
|
|
63
66
|
}
|
|
64
67
|
}
|
|
68
|
+
exports.AppsScriptAuthPassword = AppsScriptAuthPassword;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuthSession = void 0;
|
|
4
|
+
class AppsScriptAuthSession {
|
|
2
5
|
sessionStorage;
|
|
3
6
|
constructor({ sessionStorage, }) {
|
|
4
7
|
this.sessionStorage = sessionStorage;
|
|
@@ -15,3 +18,4 @@ export class AppsScriptAuthSession {
|
|
|
15
18
|
await this.sessionStorage.cleanupExpired();
|
|
16
19
|
}
|
|
17
20
|
}
|
|
21
|
+
exports.AppsScriptAuthSession = AppsScriptAuthSession;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuthSignIn = void 0;
|
|
4
|
+
const AppsScriptAuthentication_1 = require("../authentication/AppsScriptAuthentication");
|
|
5
|
+
const EmailPasswordAuthentication_1 = require("../authentication/EmailPasswordAuthentication");
|
|
6
|
+
const SignIn_1 = require("./SignIn");
|
|
7
|
+
class AppsScriptAuthSignIn {
|
|
5
8
|
email;
|
|
6
9
|
appsScript;
|
|
7
10
|
constructor({ sessionStorage, expiresIn, repository, emailPassword, appsScript, session, utilities, afterSignIn, }) {
|
|
@@ -10,9 +13,9 @@ export class AppsScriptAuthSignIn {
|
|
|
10
13
|
throw new Error("Email and password authentication is disabled");
|
|
11
14
|
}
|
|
12
15
|
emailPassword.ensureSignInEnabled();
|
|
13
|
-
const emailSignIn = new SignIn({
|
|
16
|
+
const emailSignIn = new SignIn_1.SignIn({
|
|
14
17
|
sessionStorage,
|
|
15
|
-
authentication: new EmailPasswordAuthentication(repository, utilities, emailPassword),
|
|
18
|
+
authentication: new EmailPasswordAuthentication_1.EmailPasswordAuthentication(repository, utilities, emailPassword),
|
|
16
19
|
utilities,
|
|
17
20
|
expiresIn,
|
|
18
21
|
...(afterSignIn
|
|
@@ -28,9 +31,9 @@ export class AppsScriptAuthSignIn {
|
|
|
28
31
|
throw new Error("Apps Script authentication is disabled");
|
|
29
32
|
}
|
|
30
33
|
appsScript.ensureSignInEnabled();
|
|
31
|
-
return new SignIn({
|
|
34
|
+
return new SignIn_1.SignIn({
|
|
32
35
|
sessionStorage,
|
|
33
|
-
authentication: new AppsScriptAuthentication(repository, session),
|
|
36
|
+
authentication: new AppsScriptAuthentication_1.AppsScriptAuthentication(repository, session),
|
|
34
37
|
utilities,
|
|
35
38
|
expiresIn,
|
|
36
39
|
...(afterSignIn
|
|
@@ -42,3 +45,4 @@ export class AppsScriptAuthSignIn {
|
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
}
|
|
48
|
+
exports.AppsScriptAuthSignIn = AppsScriptAuthSignIn;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuthSignOut = void 0;
|
|
4
|
+
class AppsScriptAuthSignOut {
|
|
2
5
|
sessionStorage;
|
|
3
6
|
constructor(sessionStorage) {
|
|
4
7
|
this.sessionStorage = sessionStorage;
|
|
@@ -7,3 +10,4 @@ export class AppsScriptAuthSignOut {
|
|
|
7
10
|
await this.sessionStorage.delete(sessionId);
|
|
8
11
|
}
|
|
9
12
|
}
|
|
13
|
+
exports.AppsScriptAuthSignOut = AppsScriptAuthSignOut;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuthSignUp = void 0;
|
|
4
|
+
const AppsScriptRegistration_1 = require("../registration/AppsScriptRegistration");
|
|
5
|
+
const EmailPasswordRegistration_1 = require("../registration/EmailPasswordRegistration");
|
|
6
|
+
const SignUp_1 = require("./SignUp");
|
|
7
|
+
class AppsScriptAuthSignUp {
|
|
5
8
|
email;
|
|
6
9
|
appsScript;
|
|
7
10
|
constructor({ sessionStorage, expiresIn, repository, emailPassword, appsScript, utilities, session, }) {
|
|
@@ -10,10 +13,10 @@ export class AppsScriptAuthSignUp {
|
|
|
10
13
|
throw new Error("Email and password authentication is disabled");
|
|
11
14
|
}
|
|
12
15
|
emailPassword.ensureSignUpEnabled();
|
|
13
|
-
const emailSignUp = new SignUp({
|
|
16
|
+
const emailSignUp = new SignUp_1.SignUp({
|
|
14
17
|
sessionStorage,
|
|
15
18
|
expiresIn,
|
|
16
|
-
registration: new EmailPasswordRegistration(repository, utilities, emailPassword),
|
|
19
|
+
registration: new EmailPasswordRegistration_1.EmailPasswordRegistration(repository, utilities, emailPassword),
|
|
17
20
|
utilities,
|
|
18
21
|
});
|
|
19
22
|
return emailSignUp.execute(input);
|
|
@@ -23,13 +26,14 @@ export class AppsScriptAuthSignUp {
|
|
|
23
26
|
throw new Error("Apps Script authentication is disabled");
|
|
24
27
|
}
|
|
25
28
|
appsScript.ensureSignUpEnabled();
|
|
26
|
-
const appsScriptSignUp = new SignUp({
|
|
29
|
+
const appsScriptSignUp = new SignUp_1.SignUp({
|
|
27
30
|
sessionStorage,
|
|
28
31
|
expiresIn,
|
|
29
|
-
registration: new AppsScriptRegistration(utilities, session, repository),
|
|
32
|
+
registration: new AppsScriptRegistration_1.AppsScriptRegistration(utilities, session, repository),
|
|
30
33
|
utilities,
|
|
31
34
|
});
|
|
32
35
|
return appsScriptSignUp.execute(input);
|
|
33
36
|
};
|
|
34
37
|
}
|
|
35
38
|
}
|
|
39
|
+
exports.AppsScriptAuthSignUp = AppsScriptAuthSignUp;
|
package/dist/api/SignIn.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignIn = void 0;
|
|
4
|
+
const Session_1 = require("../domain/Session");
|
|
5
|
+
class SignIn {
|
|
3
6
|
sessionStorage;
|
|
4
7
|
expiresIn;
|
|
5
8
|
utilities;
|
|
@@ -14,7 +17,7 @@ export class SignIn {
|
|
|
14
17
|
}
|
|
15
18
|
async execute(credential) {
|
|
16
19
|
const user = await this.authentication.verify(credential);
|
|
17
|
-
const session = new Session({
|
|
20
|
+
const session = new Session_1.Session({
|
|
18
21
|
id: this.utilities.getUuid(),
|
|
19
22
|
userId: user.id,
|
|
20
23
|
createdAt: new Date(),
|
|
@@ -50,3 +53,4 @@ export class SignIn {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
}
|
|
56
|
+
exports.SignIn = SignIn;
|
package/dist/api/SignUp.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignUp = void 0;
|
|
4
|
+
const Session_1 = require("../domain/Session");
|
|
5
|
+
class SignUp {
|
|
3
6
|
sessionStorage;
|
|
4
7
|
registration;
|
|
5
8
|
utilities;
|
|
@@ -13,7 +16,7 @@ export class SignUp {
|
|
|
13
16
|
async execute(input) {
|
|
14
17
|
const user = await this.registration.register(input);
|
|
15
18
|
const now = new Date();
|
|
16
|
-
const session = new Session({
|
|
19
|
+
const session = new Session_1.Session({
|
|
17
20
|
id: this.utilities.getUuid(),
|
|
18
21
|
userId: user.id,
|
|
19
22
|
createdAt: now,
|
|
@@ -23,3 +26,4 @@ export class SignUp {
|
|
|
23
26
|
return { user, session };
|
|
24
27
|
}
|
|
25
28
|
}
|
|
29
|
+
exports.SignUp = SignUp;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptAuthentication = exports.AppsScriptAuthenticationConfig = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
const AppsScriptIdentity_1 = require("../identity/AppsScriptIdentity");
|
|
6
|
+
class AppsScriptAuthenticationConfig {
|
|
4
7
|
enabled;
|
|
5
8
|
isSignupEnabled;
|
|
6
9
|
constructor({ enabled = false, isSignupEnabled = true, }) {
|
|
@@ -19,7 +22,8 @@ export class AppsScriptAuthenticationConfig {
|
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
|
-
|
|
25
|
+
exports.AppsScriptAuthenticationConfig = AppsScriptAuthenticationConfig;
|
|
26
|
+
class AppsScriptAuthentication {
|
|
23
27
|
repository;
|
|
24
28
|
session;
|
|
25
29
|
constructor(repository, session) {
|
|
@@ -31,11 +35,11 @@ export class AppsScriptAuthentication {
|
|
|
31
35
|
if (!email) {
|
|
32
36
|
throw new Error("No active user found");
|
|
33
37
|
}
|
|
34
|
-
const account = await this.repository.account.findByIdentity(authPattern.appsScript, email);
|
|
38
|
+
const account = await this.repository.account.findByIdentity(AuthPattern_1.authPattern.appsScript, email);
|
|
35
39
|
if (!account) {
|
|
36
40
|
throw new Error("Account not found");
|
|
37
41
|
}
|
|
38
|
-
if (!(account.identity instanceof AppsScriptIdentity)) {
|
|
42
|
+
if (!(account.identity instanceof AppsScriptIdentity_1.AppsScriptIdentity)) {
|
|
39
43
|
throw new Error("Invalid identity");
|
|
40
44
|
}
|
|
41
45
|
const user = await this.repository.user.find(account.userId);
|
|
@@ -45,3 +49,4 @@ export class AppsScriptAuthentication {
|
|
|
45
49
|
return user;
|
|
46
50
|
}
|
|
47
51
|
}
|
|
52
|
+
exports.AppsScriptAuthentication = AppsScriptAuthentication;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailPasswordAuthentication = exports.EmailPasswordAuthConfig = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
const Password_1 = require("../domain/Password");
|
|
6
|
+
const EmailPasswordIdentity_1 = require("../identity/EmailPasswordIdentity");
|
|
7
|
+
class EmailPasswordAuthConfig {
|
|
5
8
|
static DEFAULT_ITERATIONS = 300;
|
|
6
9
|
static MAX_ITERATIONS = 1000;
|
|
7
10
|
enabled;
|
|
@@ -45,7 +48,8 @@ export class EmailPasswordAuthConfig {
|
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
exports.EmailPasswordAuthConfig = EmailPasswordAuthConfig;
|
|
52
|
+
class EmailPasswordAuthentication {
|
|
49
53
|
repository;
|
|
50
54
|
utilities;
|
|
51
55
|
config;
|
|
@@ -55,14 +59,14 @@ export class EmailPasswordAuthentication {
|
|
|
55
59
|
this.config = config;
|
|
56
60
|
}
|
|
57
61
|
async verify(credential) {
|
|
58
|
-
const account = await this.repository.account.findByIdentity(authPattern.emailPassword, credential.email);
|
|
62
|
+
const account = await this.repository.account.findByIdentity(AuthPattern_1.authPattern.emailPassword, credential.email);
|
|
59
63
|
if (!account) {
|
|
60
64
|
throw new Error("Account not found");
|
|
61
65
|
}
|
|
62
|
-
if (!(account.identity instanceof EmailPasswordIdentity)) {
|
|
66
|
+
if (!(account.identity instanceof EmailPasswordIdentity_1.EmailPasswordIdentity)) {
|
|
63
67
|
throw new Error("Invalid identity");
|
|
64
68
|
}
|
|
65
|
-
const password = new Password(credential.password, this.utilities, this.config.pepper, this.config.iterations);
|
|
69
|
+
const password = new Password_1.Password(credential.password, this.utilities, this.config.pepper, this.config.iterations);
|
|
66
70
|
if (!(await account.identity.verify(password, account.id))) {
|
|
67
71
|
throw new Error("Invalid password");
|
|
68
72
|
}
|
|
@@ -73,3 +77,4 @@ export class EmailPasswordAuthentication {
|
|
|
73
77
|
return user;
|
|
74
78
|
}
|
|
75
79
|
}
|
|
80
|
+
exports.EmailPasswordAuthentication = EmailPasswordAuthentication;
|
package/dist/domain/Account.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Account = void 0;
|
|
4
|
+
class Account {
|
|
2
5
|
id;
|
|
3
6
|
userId;
|
|
4
7
|
identity;
|
|
@@ -8,3 +11,4 @@ export class Account {
|
|
|
8
11
|
this.identity = identity;
|
|
9
12
|
}
|
|
10
13
|
}
|
|
14
|
+
exports.Account = Account;
|
package/dist/domain/Errors.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidPasswordResetError = void 0;
|
|
4
|
+
class InvalidPasswordResetError extends Error {
|
|
2
5
|
constructor() {
|
|
3
6
|
super("Invalid password reset token");
|
|
4
7
|
}
|
|
5
8
|
}
|
|
9
|
+
exports.InvalidPasswordResetError = InvalidPasswordResetError;
|
package/dist/domain/Password.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HashedPassword = exports.Password = void 0;
|
|
4
|
+
class Password {
|
|
2
5
|
value;
|
|
3
6
|
utilities;
|
|
4
7
|
pepper;
|
|
@@ -35,7 +38,8 @@ export class Password {
|
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
exports.Password = Password;
|
|
42
|
+
class HashedPassword {
|
|
39
43
|
value;
|
|
40
44
|
constructor({ value }) {
|
|
41
45
|
this.value = value;
|
|
@@ -52,3 +56,4 @@ export class HashedPassword {
|
|
|
52
56
|
return difference === 0;
|
|
53
57
|
}
|
|
54
58
|
}
|
|
59
|
+
exports.HashedPassword = HashedPassword;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordCredential = void 0;
|
|
4
|
+
const EmailPasswordIdentity_1 = require("../identity/EmailPasswordIdentity");
|
|
5
|
+
const Account_1 = require("./Account");
|
|
6
|
+
const Errors_1 = require("./Errors");
|
|
7
|
+
const PasswordReset_1 = require("./PasswordReset");
|
|
8
|
+
class PasswordCredential {
|
|
6
9
|
account;
|
|
7
10
|
reset;
|
|
8
11
|
constructor({ account, reset, }) {
|
|
@@ -10,10 +13,10 @@ export class PasswordCredential {
|
|
|
10
13
|
this.reset = reset;
|
|
11
14
|
}
|
|
12
15
|
static generate({ account, utilities, expiresAt, }) {
|
|
13
|
-
if (!(account.identity instanceof EmailPasswordIdentity)) {
|
|
16
|
+
if (!(account.identity instanceof EmailPasswordIdentity_1.EmailPasswordIdentity)) {
|
|
14
17
|
throw new Error("Invalid account identity");
|
|
15
18
|
}
|
|
16
|
-
const { reset, token } = PasswordReset.create({
|
|
19
|
+
const { reset, token } = PasswordReset_1.PasswordReset.create({
|
|
17
20
|
accountId: account.id,
|
|
18
21
|
utilities,
|
|
19
22
|
expiresAt,
|
|
@@ -28,25 +31,25 @@ export class PasswordCredential {
|
|
|
28
31
|
}
|
|
29
32
|
resetPassword({ token, newPassword, utilities, now, }) {
|
|
30
33
|
if (this.reset === null) {
|
|
31
|
-
throw new InvalidPasswordResetError();
|
|
34
|
+
throw new Errors_1.InvalidPasswordResetError();
|
|
32
35
|
}
|
|
33
36
|
if (this.reset.accountId !== this.account.id) {
|
|
34
|
-
throw new InvalidPasswordResetError();
|
|
37
|
+
throw new Errors_1.InvalidPasswordResetError();
|
|
35
38
|
}
|
|
36
39
|
if (this.reset.enabled === false) {
|
|
37
|
-
throw new InvalidPasswordResetError();
|
|
40
|
+
throw new Errors_1.InvalidPasswordResetError();
|
|
38
41
|
}
|
|
39
42
|
if (this.reset.isExpired(now)) {
|
|
40
|
-
throw new InvalidPasswordResetError();
|
|
43
|
+
throw new Errors_1.InvalidPasswordResetError();
|
|
41
44
|
}
|
|
42
45
|
if (this.reset.verify(token, utilities) === false) {
|
|
43
|
-
throw new InvalidPasswordResetError();
|
|
46
|
+
throw new Errors_1.InvalidPasswordResetError();
|
|
44
47
|
}
|
|
45
|
-
if (!(this.account.identity instanceof EmailPasswordIdentity)) {
|
|
48
|
+
if (!(this.account.identity instanceof EmailPasswordIdentity_1.EmailPasswordIdentity)) {
|
|
46
49
|
throw new Error("Invalid account identity");
|
|
47
50
|
}
|
|
48
51
|
return new PasswordCredential({
|
|
49
|
-
account: new Account({
|
|
52
|
+
account: new Account_1.Account({
|
|
50
53
|
id: this.account.id,
|
|
51
54
|
userId: this.account.userId,
|
|
52
55
|
identity: this.account.identity.changePassword(newPassword),
|
|
@@ -55,3 +58,4 @@ export class PasswordCredential {
|
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
60
|
}
|
|
61
|
+
exports.PasswordCredential = PasswordCredential;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordReset = void 0;
|
|
4
|
+
const PasswordResetToken_1 = require("./PasswordResetToken");
|
|
5
|
+
class PasswordReset {
|
|
3
6
|
id;
|
|
4
7
|
accountId;
|
|
5
8
|
tokenHash;
|
|
@@ -13,7 +16,7 @@ export class PasswordReset {
|
|
|
13
16
|
this.enabled = enabled;
|
|
14
17
|
}
|
|
15
18
|
static create({ accountId, utilities, expiresAt, }) {
|
|
16
|
-
const token = PasswordResetToken.generate(utilities);
|
|
19
|
+
const token = PasswordResetToken_1.PasswordResetToken.generate(utilities);
|
|
17
20
|
return {
|
|
18
21
|
token: token.value,
|
|
19
22
|
reset: new PasswordReset({
|
|
@@ -26,7 +29,7 @@ export class PasswordReset {
|
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
31
|
verify(token, utilities) {
|
|
29
|
-
const tokenHash = new PasswordResetToken(token).hash(utilities);
|
|
32
|
+
const tokenHash = new PasswordResetToken_1.PasswordResetToken(token).hash(utilities);
|
|
30
33
|
return tokenHash === this.tokenHash;
|
|
31
34
|
}
|
|
32
35
|
isExpired(now) {
|
|
@@ -42,3 +45,4 @@ export class PasswordReset {
|
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
47
|
}
|
|
48
|
+
exports.PasswordReset = PasswordReset;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordResetToken = void 0;
|
|
4
|
+
class PasswordResetToken {
|
|
2
5
|
value;
|
|
3
6
|
constructor(value) {
|
|
4
7
|
this.value = value;
|
|
@@ -15,3 +18,4 @@ export class PasswordResetToken {
|
|
|
15
18
|
return tokenHash;
|
|
16
19
|
}
|
|
17
20
|
}
|
|
21
|
+
exports.PasswordResetToken = PasswordResetToken;
|
package/dist/domain/Session.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Session = void 0;
|
|
4
|
+
class Session {
|
|
2
5
|
id;
|
|
3
6
|
userId;
|
|
4
7
|
createdAt;
|
|
@@ -13,3 +16,4 @@ export class Session {
|
|
|
13
16
|
return now > this.expiresAt;
|
|
14
17
|
}
|
|
15
18
|
}
|
|
19
|
+
exports.Session = Session;
|
package/dist/domain/User.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.User = void 0;
|
|
4
|
+
class User {
|
|
2
5
|
id;
|
|
3
6
|
name;
|
|
4
7
|
accounts;
|
|
@@ -11,3 +14,4 @@ export class User {
|
|
|
11
14
|
return (this.accounts.find((account) => account.identity.providerName === provider) || null);
|
|
12
15
|
}
|
|
13
16
|
}
|
|
17
|
+
exports.User = User;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sessionStorageFactory = sessionStorageFactory;
|
|
4
|
+
const AppsScriptCacheSessionStorage_1 = require("../storage/AppsScriptCacheSessionStorage");
|
|
5
|
+
const AppsScriptPropertiesSessionStorage_1 = require("../storage/AppsScriptPropertiesSessionStorage");
|
|
6
|
+
function sessionStorageFactory(storage, { cacheService, propertiesService, }) {
|
|
4
7
|
if (storage === "properties") {
|
|
5
|
-
return new AppsScriptPropertiesSessionStorage(propertiesService.getScriptProperties());
|
|
8
|
+
return new AppsScriptPropertiesSessionStorage_1.AppsScriptPropertiesSessionStorage(propertiesService.getScriptProperties());
|
|
6
9
|
}
|
|
7
10
|
if (storage === "cache") {
|
|
8
|
-
return new AppsScriptCacheSessionStorage(cacheService.getScriptCache());
|
|
11
|
+
return new AppsScriptCacheSessionStorage_1.AppsScriptCacheSessionStorage(cacheService.getScriptCache());
|
|
9
12
|
}
|
|
10
13
|
throw new Error("Invalid storage type");
|
|
11
14
|
}
|
package/dist/hooks/AuthHooks.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptIdentity = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
class AppsScriptIdentity {
|
|
6
|
+
providerName = AuthPattern_1.authPattern.appsScript;
|
|
4
7
|
accountId;
|
|
5
8
|
constructor({ googleAccountAddress }) {
|
|
6
9
|
this.accountId = googleAccountAddress;
|
|
7
10
|
}
|
|
8
11
|
}
|
|
12
|
+
exports.AppsScriptIdentity = AppsScriptIdentity;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailPasswordIdentity = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
class EmailPasswordIdentity {
|
|
6
|
+
providerName = AuthPattern_1.authPattern.emailPassword;
|
|
4
7
|
accountId;
|
|
5
8
|
password;
|
|
6
9
|
constructor({ accountId, password, }) {
|
|
@@ -17,3 +20,4 @@ export class EmailPasswordIdentity {
|
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
22
|
}
|
|
23
|
+
exports.EmailPasswordIdentity = EmailPasswordIdentity;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { AppsScriptAuth } from "./AppsScriptAuth";
|
|
2
2
|
export type { AppsScriptAuthRepository } from "./storage/AppsScriptAuthRepository";
|
|
3
|
-
export {
|
|
3
|
+
export type { AuthSchema, AuthSchemaOptions } from "./schema/AuthSchema";
|
|
4
|
+
export { createAuthTables } from "./schema/createAuthTables";
|
|
4
5
|
export { authPattern, type AuthPattern } from "./AuthPattern";
|
|
5
6
|
export { Account } from "./domain/Account";
|
|
6
7
|
export { User } from "./domain/User";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailPasswordIdentity = exports.AppsScriptIdentity = exports.PasswordReset = exports.PasswordCredential = exports.Password = exports.HashedPassword = exports.User = exports.Account = exports.authPattern = exports.createAuthTables = exports.AppsScriptAuth = void 0;
|
|
4
|
+
var AppsScriptAuth_1 = require("./AppsScriptAuth");
|
|
5
|
+
Object.defineProperty(exports, "AppsScriptAuth", { enumerable: true, get: function () { return AppsScriptAuth_1.AppsScriptAuth; } });
|
|
6
|
+
var createAuthTables_1 = require("./schema/createAuthTables");
|
|
7
|
+
Object.defineProperty(exports, "createAuthTables", { enumerable: true, get: function () { return createAuthTables_1.createAuthTables; } });
|
|
8
|
+
var AuthPattern_1 = require("./AuthPattern");
|
|
9
|
+
Object.defineProperty(exports, "authPattern", { enumerable: true, get: function () { return AuthPattern_1.authPattern; } });
|
|
10
|
+
var Account_1 = require("./domain/Account");
|
|
11
|
+
Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return Account_1.Account; } });
|
|
12
|
+
var User_1 = require("./domain/User");
|
|
13
|
+
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return User_1.User; } });
|
|
14
|
+
var Password_1 = require("./domain/Password");
|
|
15
|
+
Object.defineProperty(exports, "HashedPassword", { enumerable: true, get: function () { return Password_1.HashedPassword; } });
|
|
16
|
+
Object.defineProperty(exports, "Password", { enumerable: true, get: function () { return Password_1.Password; } });
|
|
17
|
+
var PasswordCredential_1 = require("./domain/PasswordCredential");
|
|
18
|
+
Object.defineProperty(exports, "PasswordCredential", { enumerable: true, get: function () { return PasswordCredential_1.PasswordCredential; } });
|
|
19
|
+
var PasswordReset_1 = require("./domain/PasswordReset");
|
|
20
|
+
Object.defineProperty(exports, "PasswordReset", { enumerable: true, get: function () { return PasswordReset_1.PasswordReset; } });
|
|
21
|
+
var AppsScriptIdentity_1 = require("./identity/AppsScriptIdentity");
|
|
22
|
+
Object.defineProperty(exports, "AppsScriptIdentity", { enumerable: true, get: function () { return AppsScriptIdentity_1.AppsScriptIdentity; } });
|
|
23
|
+
var EmailPasswordIdentity_1 = require("./identity/EmailPasswordIdentity");
|
|
24
|
+
Object.defineProperty(exports, "EmailPasswordIdentity", { enumerable: true, get: function () { return EmailPasswordIdentity_1.EmailPasswordIdentity; } });
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptRegistration = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
const Account_1 = require("../domain/Account");
|
|
6
|
+
const User_1 = require("../domain/User");
|
|
7
|
+
const AppsScriptIdentity_1 = require("../identity/AppsScriptIdentity");
|
|
8
|
+
class AppsScriptRegistration {
|
|
6
9
|
utilities;
|
|
7
10
|
session;
|
|
8
11
|
repository;
|
|
@@ -17,23 +20,23 @@ export class AppsScriptRegistration {
|
|
|
17
20
|
if (!email) {
|
|
18
21
|
throw new Error("No active user found");
|
|
19
22
|
}
|
|
20
|
-
const existingAccount = await this.repository.account.findByIdentity(authPattern.appsScript, email);
|
|
23
|
+
const existingAccount = await this.repository.account.findByIdentity(AuthPattern_1.authPattern.appsScript, email);
|
|
21
24
|
if (existingAccount) {
|
|
22
25
|
throw new Error("Account already registered");
|
|
23
26
|
}
|
|
24
27
|
// AppsScriptIdentity作成
|
|
25
|
-
const appsScriptIdentity = new AppsScriptIdentity({
|
|
28
|
+
const appsScriptIdentity = new AppsScriptIdentity_1.AppsScriptIdentity({
|
|
26
29
|
googleAccountAddress: email,
|
|
27
30
|
});
|
|
28
31
|
const userId = this.utilities.getUuid();
|
|
29
32
|
// Account作成
|
|
30
|
-
const account = new Account({
|
|
33
|
+
const account = new Account_1.Account({
|
|
31
34
|
id: this.utilities.getUuid(),
|
|
32
35
|
userId: userId,
|
|
33
36
|
identity: appsScriptIdentity,
|
|
34
37
|
});
|
|
35
38
|
// User作成
|
|
36
|
-
const user = new User({
|
|
39
|
+
const user = new User_1.User({
|
|
37
40
|
id: userId,
|
|
38
41
|
name: input.name,
|
|
39
42
|
accounts: [account],
|
|
@@ -44,3 +47,4 @@ export class AppsScriptRegistration {
|
|
|
44
47
|
return user;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
50
|
+
exports.AppsScriptRegistration = AppsScriptRegistration;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailPasswordRegistration = void 0;
|
|
4
|
+
const AuthPattern_1 = require("../AuthPattern");
|
|
5
|
+
const Account_1 = require("../domain/Account");
|
|
6
|
+
const Password_1 = require("../domain/Password");
|
|
7
|
+
const User_1 = require("../domain/User");
|
|
8
|
+
const EmailPasswordIdentity_1 = require("../identity/EmailPasswordIdentity");
|
|
9
|
+
class EmailPasswordRegistration {
|
|
7
10
|
repository;
|
|
8
11
|
utilities;
|
|
9
12
|
config;
|
|
@@ -13,24 +16,24 @@ export class EmailPasswordRegistration {
|
|
|
13
16
|
this.config = config;
|
|
14
17
|
}
|
|
15
18
|
async register(input) {
|
|
16
|
-
const existingAccount = await this.repository.account.findByIdentity(authPattern.emailPassword, input.email);
|
|
19
|
+
const existingAccount = await this.repository.account.findByIdentity(AuthPattern_1.authPattern.emailPassword, input.email);
|
|
17
20
|
if (existingAccount) {
|
|
18
21
|
throw new Error("Account already registered");
|
|
19
22
|
}
|
|
20
23
|
const userId = this.utilities.getUuid();
|
|
21
24
|
const accountId = this.utilities.getUuid();
|
|
22
|
-
const password = new Password(input.password, this.utilities, this.config.pepper, this.config.iterations);
|
|
25
|
+
const password = new Password_1.Password(input.password, this.utilities, this.config.pepper, this.config.iterations);
|
|
23
26
|
const hashedPassword = await password.hash(accountId);
|
|
24
|
-
const identity = new EmailPasswordIdentity({
|
|
27
|
+
const identity = new EmailPasswordIdentity_1.EmailPasswordIdentity({
|
|
25
28
|
accountId: input.email,
|
|
26
29
|
password: hashedPassword,
|
|
27
30
|
});
|
|
28
|
-
const account = new Account({
|
|
31
|
+
const account = new Account_1.Account({
|
|
29
32
|
id: accountId,
|
|
30
33
|
userId,
|
|
31
34
|
identity,
|
|
32
35
|
});
|
|
33
|
-
const user = new User({
|
|
36
|
+
const user = new User_1.User({
|
|
34
37
|
id: userId,
|
|
35
38
|
name: input.name,
|
|
36
39
|
accounts: [account],
|
|
@@ -39,3 +42,4 @@ export class EmailPasswordRegistration {
|
|
|
39
42
|
return user;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
45
|
+
exports.EmailPasswordRegistration = EmailPasswordRegistration;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type AuthSchemaOptions = {
|
|
2
|
-
dbId: string;
|
|
3
2
|
user?: {
|
|
4
3
|
modelName?: string;
|
|
5
4
|
fields?: {
|
|
@@ -29,7 +28,6 @@ export type AuthSchemaOptions = {
|
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
30
|
export type AuthSchema = {
|
|
32
|
-
dbId: string;
|
|
33
31
|
user: {
|
|
34
32
|
modelName: string;
|
|
35
33
|
fields: {
|
|
@@ -63,8 +61,7 @@ type Fields<T> = [T] extends [null | undefined] ? undefined : "fields" extends k
|
|
|
63
61
|
type PropertyOrDefault<T, K extends PropertyKey, Default extends string> = [
|
|
64
62
|
T
|
|
65
63
|
] extends [null | undefined] ? Default : K extends keyof NonNullable<T> ? Exclude<NonNullable<T>[K], undefined> extends infer Value ? [Value] extends [never] ? Default : Value extends string ? Value : Default : Default : Default;
|
|
66
|
-
type ResolveAuthSchema<O extends AuthSchemaOptions> = {
|
|
67
|
-
dbId: O["dbId"];
|
|
64
|
+
export type ResolveAuthSchema<O extends AuthSchemaOptions> = {
|
|
68
65
|
user: {
|
|
69
66
|
modelName: PropertyOrDefault<Section<O, "user">, "modelName", "user">;
|
|
70
67
|
fields: {
|
|
@@ -93,10 +90,5 @@ type ResolveAuthSchema<O extends AuthSchemaOptions> = {
|
|
|
93
90
|
};
|
|
94
91
|
};
|
|
95
92
|
};
|
|
96
|
-
export declare
|
|
97
|
-
dbId: "";
|
|
98
|
-
}> {
|
|
99
|
-
readonly schema: ResolveAuthSchema<O>;
|
|
100
|
-
constructor(options?: O);
|
|
101
|
-
}
|
|
93
|
+
export declare function resolveAuthSchema<const O extends AuthSchemaOptions>(options: O): ResolveAuthSchema<O>;
|
|
102
94
|
export {};
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAuthSchema = resolveAuthSchema;
|
|
4
|
+
function resolveAuthSchema(options) {
|
|
5
|
+
return {
|
|
6
|
+
user: {
|
|
7
|
+
modelName: options.user?.modelName ?? "user",
|
|
8
|
+
fields: {
|
|
9
|
+
id: options.user?.fields?.id ?? "id",
|
|
10
|
+
name: options.user?.fields?.name ?? "name",
|
|
12
11
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
},
|
|
13
|
+
account: {
|
|
14
|
+
modelName: options.account?.modelName ?? "account",
|
|
15
|
+
fields: {
|
|
16
|
+
id: options.account?.fields?.id ?? "id",
|
|
17
|
+
userId: options.account?.fields?.userId ?? "userId",
|
|
18
|
+
provider: options.account?.fields?.provider ?? "provider",
|
|
19
|
+
providerAccountId: options.account?.fields?.providerAccountId ?? "providerAccountId",
|
|
20
|
+
passwordHash: options.account?.fields?.passwordHash ?? "passwordHash",
|
|
22
21
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
},
|
|
23
|
+
passwordReset: {
|
|
24
|
+
modelName: options.passwordReset?.modelName ?? "passwordReset",
|
|
25
|
+
fields: {
|
|
26
|
+
id: options.passwordReset?.fields?.id ?? "id",
|
|
27
|
+
accountId: options.passwordReset?.fields?.accountId ?? "accountId",
|
|
28
|
+
tokenHash: options.passwordReset?.fields?.tokenHash ?? "tokenHash",
|
|
29
|
+
expiresAt: options.passwordReset?.fields?.expiresAt ?? "expiresAt",
|
|
30
|
+
enabled: options.passwordReset?.fields?.enabled ?? "enabled",
|
|
32
31
|
},
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
35
34
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type AuthSchema, type AuthSchemaOptions } from "./AuthSchema";
|
|
3
|
+
type UserShape<S extends AuthSchema> = {
|
|
4
|
+
[K in S["user"]["fields"]["id"] | S["user"]["fields"]["name"]]: z.ZodString;
|
|
5
|
+
};
|
|
6
|
+
type AccountShape<S extends AuthSchema> = {
|
|
7
|
+
[K in S["account"]["fields"]["id"] | S["account"]["fields"]["userId"] | S["account"]["fields"]["provider"] | S["account"]["fields"]["providerAccountId"] | S["account"]["fields"]["passwordHash"]]: K extends S["account"]["fields"]["provider"] ? z.ZodEnum<{
|
|
8
|
+
emailPassword: "emailPassword";
|
|
9
|
+
appsScript: "appsScript";
|
|
10
|
+
}> : K extends S["account"]["fields"]["passwordHash"] ? z.ZodNullable<z.ZodString> : z.ZodString;
|
|
11
|
+
};
|
|
12
|
+
type PasswordResetShape<S extends AuthSchema> = {
|
|
13
|
+
[K in S["passwordReset"]["fields"]["id"] | S["passwordReset"]["fields"]["accountId"] | S["passwordReset"]["fields"]["tokenHash"] | S["passwordReset"]["fields"]["expiresAt"] | S["passwordReset"]["fields"]["enabled"]]: K extends S["passwordReset"]["fields"]["expiresAt"] ? z.ZodDate : K extends S["passwordReset"]["fields"]["enabled"] ? z.ZodBoolean : z.ZodString;
|
|
14
|
+
};
|
|
15
|
+
export declare function createAuthTables<const O extends AuthSchemaOptions = Record<never, never>>(options?: O): {
|
|
16
|
+
readonly schema: import("./AuthSchema").ResolveAuthSchema<O>;
|
|
17
|
+
readonly user: import("@gasboost/table").TableDefinition<["user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never] extends [null | undefined] ? "user" : "modelName" extends infer T_1 ? T_1 extends "modelName" ? T_1 extends keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> ? Exclude<NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never>[T_1], undefined> extends infer Value ? [Value] extends [never] ? "user" : Value extends string ? Value : "user" : "user" : "user" : never : never, z.ZodObject<UserShape<import("./AuthSchema").ResolveAuthSchema<O>> extends infer T_2 ? { -readonly [P in keyof T_2]: T_2[P]; } : never, z.core.$strip>> & {
|
|
18
|
+
readonly primaryKey: Extract<keyof z.core.$InferObjectOutput<UserShape<import("./AuthSchema").ResolveAuthSchema<O>> extends infer T_2 ? { -readonly [P in keyof T_2]: T_2[P]; } : never, {}>, string>;
|
|
19
|
+
} & {
|
|
20
|
+
readonly primaryKey: [["user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> ? NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never>[keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> & "fields"] : undefined] extends [null | undefined] ? "id" : "id" extends infer T_3 ? T_3 extends "id" ? T_3 extends keyof NonNullable<["user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> ? NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never>[keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> & "fields"] : undefined> ? Exclude<NonNullable<["user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> ? NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never>[keyof NonNullable<"user" extends infer T ? T extends "user" ? T extends keyof O ? O[T] : undefined : never : never> & "fields"] : undefined>[T_3], undefined> extends infer Value ? [Value] extends [never] ? "id" : Value extends string ? Value : "id" : "id" : "id" : never : never;
|
|
21
|
+
};
|
|
22
|
+
readonly account: import("@gasboost/table").TableDefinition<["account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never] extends [null | undefined] ? "account" : "modelName" extends infer T_5 ? T_5 extends "modelName" ? T_5 extends keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> ? Exclude<NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never>[T_5], undefined> extends infer Value ? [Value] extends [never] ? "account" : Value extends string ? Value : "account" : "account" : "account" : never : never, z.ZodObject<AccountShape<import("./AuthSchema").ResolveAuthSchema<O>> extends infer T_6 ? { -readonly [P in keyof T_6]: T_6[P]; } : never, z.core.$strip>> & {
|
|
23
|
+
readonly primaryKey: Extract<keyof z.core.$InferObjectOutput<AccountShape<import("./AuthSchema").ResolveAuthSchema<O>> extends infer T_6 ? { -readonly [P in keyof T_6]: T_6[P]; } : never, {}>, string>;
|
|
24
|
+
} & {
|
|
25
|
+
readonly primaryKey: [["account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> ? NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never>[keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> & "fields"] : undefined] extends [null | undefined] ? "id" : "id" extends infer T_7 ? T_7 extends "id" ? T_7 extends keyof NonNullable<["account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> ? NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never>[keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> & "fields"] : undefined> ? Exclude<NonNullable<["account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> ? NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never>[keyof NonNullable<"account" extends infer T_4 ? T_4 extends "account" ? T_4 extends keyof O ? O[T_4] : undefined : never : never> & "fields"] : undefined>[T_7], undefined> extends infer Value ? [Value] extends [never] ? "id" : Value extends string ? Value : "id" : "id" : "id" : never : never;
|
|
26
|
+
};
|
|
27
|
+
readonly passwordReset: import("@gasboost/table").TableDefinition<["passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never] extends [null | undefined] ? "passwordReset" : "modelName" extends infer T_9 ? T_9 extends "modelName" ? T_9 extends keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> ? Exclude<NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never>[T_9], undefined> extends infer Value ? [Value] extends [never] ? "passwordReset" : Value extends string ? Value : "passwordReset" : "passwordReset" : "passwordReset" : never : never, z.ZodObject<PasswordResetShape<import("./AuthSchema").ResolveAuthSchema<O>> extends infer T_10 ? { -readonly [P in keyof T_10]: T_10[P]; } : never, z.core.$strip>> & {
|
|
28
|
+
readonly primaryKey: Extract<keyof z.core.$InferObjectOutput<PasswordResetShape<import("./AuthSchema").ResolveAuthSchema<O>> extends infer T_10 ? { -readonly [P in keyof T_10]: T_10[P]; } : never, {}>, string>;
|
|
29
|
+
} & {
|
|
30
|
+
readonly primaryKey: [["passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> ? NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never>[keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> & "fields"] : undefined] extends [null | undefined] ? "id" : "id" extends infer T_11 ? T_11 extends "id" ? T_11 extends keyof NonNullable<["passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> ? NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never>[keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> & "fields"] : undefined> ? Exclude<NonNullable<["passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never] extends [null | undefined] ? undefined : "fields" extends keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> ? NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never>[keyof NonNullable<"passwordReset" extends infer T_8 ? T_8 extends "passwordReset" ? T_8 extends keyof O ? O[T_8] : undefined : never : never> & "fields"] : undefined>[T_11], undefined> extends infer Value ? [Value] extends [never] ? "id" : Value extends string ? Value : "id" : "id" : "id" : never : never;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAuthTables = createAuthTables;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const AuthSchema_1 = require("./AuthSchema");
|
|
6
|
+
function ensureUniqueFieldNames(modelName, fields) {
|
|
7
|
+
const fieldNames = Object.values(fields);
|
|
8
|
+
if (new Set(fieldNames).size !== fieldNames.length) {
|
|
9
|
+
throw new Error(`Field names for '${modelName}' must be unique.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function keyedTable(definition) {
|
|
13
|
+
return definition;
|
|
14
|
+
}
|
|
15
|
+
function createAuthTables(options = {}) {
|
|
16
|
+
const schema = (0, AuthSchema_1.resolveAuthSchema)(options);
|
|
17
|
+
ensureUniqueFieldNames(schema.user.modelName, schema.user.fields);
|
|
18
|
+
ensureUniqueFieldNames(schema.account.modelName, schema.account.fields);
|
|
19
|
+
ensureUniqueFieldNames(schema.passwordReset.modelName, schema.passwordReset.fields);
|
|
20
|
+
const userSchema = zod_1.z.object({
|
|
21
|
+
[schema.user.fields.id]: zod_1.z.string(),
|
|
22
|
+
[schema.user.fields.name]: zod_1.z.string(),
|
|
23
|
+
});
|
|
24
|
+
const accountSchema = zod_1.z.object({
|
|
25
|
+
[schema.account.fields.id]: zod_1.z.string(),
|
|
26
|
+
[schema.account.fields.userId]: zod_1.z.string(),
|
|
27
|
+
[schema.account.fields.provider]: zod_1.z.enum(["emailPassword", "appsScript"]),
|
|
28
|
+
[schema.account.fields.providerAccountId]: zod_1.z.string(),
|
|
29
|
+
[schema.account.fields.passwordHash]: zod_1.z.string().nullable(),
|
|
30
|
+
});
|
|
31
|
+
const passwordResetSchema = zod_1.z.object({
|
|
32
|
+
[schema.passwordReset.fields.id]: zod_1.z.string(),
|
|
33
|
+
[schema.passwordReset.fields.accountId]: zod_1.z.string(),
|
|
34
|
+
[schema.passwordReset.fields.tokenHash]: zod_1.z.string(),
|
|
35
|
+
[schema.passwordReset.fields.expiresAt]: zod_1.z.date(),
|
|
36
|
+
[schema.passwordReset.fields.enabled]: zod_1.z.boolean(),
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
schema,
|
|
40
|
+
user: keyedTable({
|
|
41
|
+
name: schema.user.modelName,
|
|
42
|
+
schema: userSchema,
|
|
43
|
+
primaryKey: schema.user.fields.id,
|
|
44
|
+
}),
|
|
45
|
+
account: keyedTable({
|
|
46
|
+
name: schema.account.modelName,
|
|
47
|
+
schema: accountSchema,
|
|
48
|
+
primaryKey: schema.account.fields.id,
|
|
49
|
+
}),
|
|
50
|
+
passwordReset: keyedTable({
|
|
51
|
+
name: schema.passwordReset.modelName,
|
|
52
|
+
schema: passwordResetSchema,
|
|
53
|
+
primaryKey: schema.passwordReset.fields.id,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptCacheSessionStorage = void 0;
|
|
4
|
+
const Session_1 = require("../domain/Session");
|
|
5
|
+
class AppsScriptCacheSessionStorage {
|
|
3
6
|
storage;
|
|
4
7
|
constructor(storage) {
|
|
5
8
|
this.storage = storage;
|
|
@@ -14,7 +17,7 @@ export class AppsScriptCacheSessionStorage {
|
|
|
14
17
|
return null;
|
|
15
18
|
}
|
|
16
19
|
const data = JSON.parse(value);
|
|
17
|
-
return new Session({
|
|
20
|
+
return new Session_1.Session({
|
|
18
21
|
id: data.id,
|
|
19
22
|
userId: data.userId,
|
|
20
23
|
createdAt: new Date(data.createdAt),
|
|
@@ -28,3 +31,4 @@ export class AppsScriptCacheSessionStorage {
|
|
|
28
31
|
// CacheService handles expiration automatically.
|
|
29
32
|
}
|
|
30
33
|
}
|
|
34
|
+
exports.AppsScriptCacheSessionStorage = AppsScriptCacheSessionStorage;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppsScriptPropertiesSessionStorage = void 0;
|
|
4
|
+
const Session_1 = require("../domain/Session");
|
|
5
|
+
class AppsScriptPropertiesSessionStorage {
|
|
3
6
|
storage;
|
|
4
7
|
prefix = "session:";
|
|
5
8
|
constructor(storage) {
|
|
@@ -14,7 +17,7 @@ export class AppsScriptPropertiesSessionStorage {
|
|
|
14
17
|
return null;
|
|
15
18
|
}
|
|
16
19
|
const stored = JSON.parse(value);
|
|
17
|
-
const session = new Session({
|
|
20
|
+
const session = new Session_1.Session({
|
|
18
21
|
id: stored.id,
|
|
19
22
|
userId: stored.userId,
|
|
20
23
|
createdAt: new Date(stored.createdAt),
|
|
@@ -37,7 +40,7 @@ export class AppsScriptPropertiesSessionStorage {
|
|
|
37
40
|
continue;
|
|
38
41
|
}
|
|
39
42
|
const sessionData = JSON.parse(value);
|
|
40
|
-
const session = new Session({
|
|
43
|
+
const session = new Session_1.Session({
|
|
41
44
|
id: sessionData.id,
|
|
42
45
|
userId: sessionData.userId,
|
|
43
46
|
createdAt: new Date(sessionData.createdAt),
|
|
@@ -49,3 +52,4 @@ export class AppsScriptPropertiesSessionStorage {
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
}
|
|
55
|
+
exports.AppsScriptPropertiesSessionStorage = AppsScriptPropertiesSessionStorage;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasboost/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Modern authentication for Google Apps Script with email/password, Apps Script authentication, sessions, and password reset.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"google-apps-script",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"gasboost"
|
|
15
15
|
],
|
|
16
16
|
"license": "MIT",
|
|
17
|
+
"type": "commonjs",
|
|
17
18
|
"main": "./dist/index.js",
|
|
18
19
|
"types": "./dist/index.d.ts",
|
|
19
20
|
"files": [
|
|
@@ -38,6 +39,10 @@
|
|
|
38
39
|
"publishConfig": {
|
|
39
40
|
"access": "public"
|
|
40
41
|
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@gasboost/table": "^0.1.0",
|
|
44
|
+
"zod": "^4.5.4"
|
|
45
|
+
},
|
|
41
46
|
"devDependencies": {
|
|
42
47
|
"@gasboost/fake-core": "^0.1.2",
|
|
43
48
|
"@gasboost/fake-node": "^0.1.2",
|