@passlock/client 0.9.29 → 0.9.32
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/README.md +1 -1
- package/README.template.md +1 -1
- package/dist/authentication/authenticate.d.ts +5 -6
- package/dist/authentication/authenticate.fixture.d.ts +15 -15
- package/dist/authentication/authenticate.fixture.js +8 -8
- package/dist/authentication/authenticate.fixture.js.map +1 -1
- package/dist/authentication/authenticate.js +4 -5
- package/dist/authentication/authenticate.js.map +1 -1
- package/dist/connection/connection.d.ts +3 -3
- package/dist/connection/connection.fixture.d.ts +2 -2
- package/dist/connection/connection.fixture.js +2 -2
- package/dist/connection/connection.fixture.js.map +1 -1
- package/dist/connection/connection.js +2 -2
- package/dist/connection/connection.js.map +1 -1
- package/dist/effect.js +2 -2
- package/dist/effect.js.map +1 -1
- package/dist/email/email.d.ts +7 -7
- package/dist/email/email.fixture.d.ts +10 -10
- package/dist/email/email.fixture.js +3 -3
- package/dist/email/email.fixture.js.map +1 -1
- package/dist/email/email.js +2 -2
- package/dist/email/email.js.map +1 -1
- package/dist/index.d.ts +33 -31
- package/dist/index.js +5 -12
- package/dist/index.js.map +1 -1
- package/dist/registration/register.d.ts +5 -7
- package/dist/registration/register.fixture.d.ts +14 -14
- package/dist/registration/register.fixture.js +6 -6
- package/dist/registration/register.fixture.js.map +1 -1
- package/dist/registration/register.js +5 -6
- package/dist/registration/register.js.map +1 -1
- package/dist/rpc/client.js +1 -1
- package/dist/rpc/client.js.map +1 -1
- package/dist/rpc/connection.d.ts +1 -1
- package/dist/rpc/connection.js +3 -2
- package/dist/rpc/connection.js.map +1 -1
- package/dist/rpc/{authentication.d.ts → passkey/authentication.d.ts} +4 -4
- package/dist/rpc/passkey/authentication.js +17 -0
- package/dist/rpc/passkey/authentication.js.map +1 -0
- package/dist/rpc/{registration.d.ts → passkey/registration.d.ts} +3 -3
- package/dist/rpc/passkey/registration.js +17 -0
- package/dist/rpc/passkey/registration.js.map +1 -0
- package/dist/rpc/social.d.ts +1 -1
- package/dist/rpc/social.js +6 -5
- package/dist/rpc/social.js.map +1 -1
- package/dist/rpc/user.d.ts +1 -1
- package/dist/rpc/user.js +5 -4
- package/dist/rpc/user.js.map +1 -1
- package/dist/social/social.d.ts +7 -8
- package/dist/social/social.fixture.d.ts +11 -11
- package/dist/social/social.fixture.js +7 -7
- package/dist/social/social.fixture.js.map +1 -1
- package/dist/social/social.js +7 -8
- package/dist/social/social.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/user/user.d.ts +3 -3
- package/dist/user/user.fixture.d.ts +6 -6
- package/dist/user/user.fixture.js +6 -6
- package/dist/user/user.fixture.js.map +1 -1
- package/dist/user/user.js +5 -6
- package/dist/user/user.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +14 -14
- package/src/authentication/authenticate.fixture.ts +11 -11
- package/src/authentication/authenticate.test.ts +1 -1
- package/src/authentication/authenticate.ts +10 -16
- package/src/connection/connection.fixture.ts +2 -2
- package/src/connection/connection.ts +3 -3
- package/src/effect.ts +2 -2
- package/src/email/email.fixture.ts +3 -3
- package/src/email/email.ts +2 -2
- package/src/index.ts +10 -17
- package/src/registration/register.fixture.ts +11 -11
- package/src/registration/register.test.ts +1 -1
- package/src/registration/register.ts +11 -13
- package/src/rpc/client.ts +1 -1
- package/src/rpc/connection.ts +4 -2
- package/src/rpc/{authentication.ts → passkey/authentication.ts} +22 -13
- package/src/rpc/passkey/registration.ts +52 -0
- package/src/rpc/social.ts +24 -14
- package/src/rpc/user.ts +23 -12
- package/src/social/social.fixture.ts +7 -8
- package/src/social/social.test.ts +8 -8
- package/src/social/social.ts +13 -16
- package/src/user/user.fixture.ts +10 -10
- package/src/user/user.ts +7 -9
- package/dist/rpc/authentication.js +0 -16
- package/dist/rpc/authentication.js.map +0 -1
- package/dist/rpc/registration.js +0 -16
- package/dist/rpc/registration.js.map +0 -1
- package/src/rpc/registration.ts +0 -41
package/src/user/user.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
import { Context, Effect as E, Layer, flow } from 'effect'
|
|
5
5
|
|
|
6
6
|
import type { BadRequest, Disabled, NotFound } from '@passlock/shared/dist/error/error.js'
|
|
7
|
-
import { IsExistingUserReq, ResendEmailReq } from '@passlock/shared/dist/rpc/user.js'
|
|
8
7
|
import type { VerifyEmail } from '@passlock/shared/dist/schema/email.js'
|
|
9
|
-
|
|
10
|
-
import { UserClient } from '../rpc/user.js'
|
|
8
|
+
import * as RPC from '../rpc/user.js'
|
|
11
9
|
|
|
12
10
|
/* Requests */
|
|
13
11
|
|
|
@@ -30,15 +28,15 @@ export class UserService extends Context.Tag('@services/UserService')<
|
|
|
30
28
|
|
|
31
29
|
/* Effects */
|
|
32
30
|
|
|
33
|
-
type Dependencies = UserClient
|
|
31
|
+
type Dependencies = RPC.UserClient
|
|
34
32
|
|
|
35
33
|
export const isExistingUser = (request: Email): E.Effect<boolean, BadRequest, Dependencies> => {
|
|
36
34
|
return E.gen(function* (_) {
|
|
37
35
|
yield* _(E.logInfo('Checking registration status'))
|
|
38
|
-
const rpcClient = yield* _(UserClient)
|
|
36
|
+
const rpcClient = yield* _(RPC.UserClient)
|
|
39
37
|
|
|
40
38
|
yield* _(E.logDebug('Making RPC request'))
|
|
41
|
-
const { existingUser } = yield* _(rpcClient.isExistingUser(new
|
|
39
|
+
const { existingUser } = yield* _(rpcClient.isExistingUser(new RPC.IsExistingUserRequest(request)))
|
|
42
40
|
|
|
43
41
|
return existingUser
|
|
44
42
|
})
|
|
@@ -49,11 +47,11 @@ export const resendVerificationEmail = (
|
|
|
49
47
|
): E.Effect<void, ResendEmailErrors, Dependencies> => {
|
|
50
48
|
return E.gen(function* (_) {
|
|
51
49
|
yield* _(E.logInfo('Resending verification email'))
|
|
52
|
-
const rpcClient = yield* _(UserClient)
|
|
50
|
+
const rpcClient = yield* _(RPC.UserClient)
|
|
53
51
|
|
|
54
52
|
yield* _(E.logDebug('Making RPC request'))
|
|
55
53
|
const { userId, ...verifyEmail } = request
|
|
56
|
-
yield* _(rpcClient.resendVerificationEmail(new
|
|
54
|
+
yield* _(rpcClient.resendVerificationEmail(new RPC.ResendEmailRequest({ userId, verifyEmail })))
|
|
57
55
|
})
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -63,7 +61,7 @@ export const resendVerificationEmail = (
|
|
|
63
61
|
export const UserServiceLive = Layer.effect(
|
|
64
62
|
UserService,
|
|
65
63
|
E.gen(function* (_) {
|
|
66
|
-
const context = yield* _(E.context<UserClient>())
|
|
64
|
+
const context = yield* _(E.context<RPC.UserClient>())
|
|
67
65
|
return UserService.of({
|
|
68
66
|
isExistingUser: flow(isExistingUser, E.provide(context)),
|
|
69
67
|
resendVerificationEmail: flow(resendVerificationEmail, E.provide(context)),
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context, Effect as E, Layer } from 'effect';
|
|
2
|
-
import { OPTIONS_ENDPOINT, OptionsErrors, OptionsReq, OptionsRes, VERIFY_ENDPOINT, VerificationErrors, VerificationReq, VerificationRes, } from '@passlock/shared/dist/rpc/authentication.js';
|
|
3
|
-
import { Dispatcher, makePostRequest } from './client.js';
|
|
4
|
-
/* Client */
|
|
5
|
-
export class AuthenticationClient extends Context.Tag('@passkey/auth/client')() {
|
|
6
|
-
}
|
|
7
|
-
export const AuthenticationClientLive = Layer.effect(AuthenticationClient, E.gen(function* (_) {
|
|
8
|
-
const dispatcher = yield* _(Dispatcher);
|
|
9
|
-
const optionsResolver = makePostRequest(OptionsReq, OptionsRes, OptionsErrors, dispatcher);
|
|
10
|
-
const verifyResolver = makePostRequest(VerificationReq, VerificationRes, VerificationErrors, dispatcher);
|
|
11
|
-
return {
|
|
12
|
-
getAuthenticationOptions: req => optionsResolver(OPTIONS_ENDPOINT, req),
|
|
13
|
-
verifyAuthenticationCredential: req => verifyResolver(VERIFY_ENDPOINT, req),
|
|
14
|
-
};
|
|
15
|
-
}));
|
|
16
|
-
//# sourceMappingURL=authentication.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/rpc/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEpD,OAAO,EAEL,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,6CAA6C,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEzD,YAAY;AAEZ,MAAM,OAAO,oBAAqB,SAAQ,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAG1E;CAAG;AAEN,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAClD,oBAAoB,EACpB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAChB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IAEvC,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;IAE1F,MAAM,cAAc,GAAG,eAAe,CACpC,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,UAAU,CACX,CAAA;IAED,OAAO;QACL,wBAAwB,EAAE,GAAG,CAAC,EAAE,CAAC,eAAe,CAAC,gBAAgB,EAAE,GAAG,CAAC;QACvE,8BAA8B,EAAE,GAAG,CAAC,EAAE,CAAC,cAAc,CAAC,eAAe,EAAE,GAAG,CAAC;KAC5E,CAAA;AACH,CAAC,CAAC,CACH,CAAA"}
|
package/dist/rpc/registration.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context, Effect as E, Layer } from 'effect';
|
|
2
|
-
import { OptionsErrors, OptionsReq, OptionsRes, VerificationErrors, VerificationReq, VerificationRes, } from '@passlock/shared/dist/rpc/registration.js';
|
|
3
|
-
import { Dispatcher, makePostRequest } from './client.js';
|
|
4
|
-
/* Client */
|
|
5
|
-
export class RegistrationClient extends Context.Tag('@passkey/register/client')() {
|
|
6
|
-
}
|
|
7
|
-
export const RegistrationClientLive = Layer.effect(RegistrationClient, E.gen(function* (_) {
|
|
8
|
-
const dispatcher = yield* _(Dispatcher);
|
|
9
|
-
const optionsResolver = makePostRequest(OptionsReq, OptionsRes, OptionsErrors, dispatcher);
|
|
10
|
-
const verifyResolver = makePostRequest(VerificationReq, VerificationRes, VerificationErrors, dispatcher);
|
|
11
|
-
return {
|
|
12
|
-
getRegistrationOptions: req => optionsResolver('/passkey/register/options', req),
|
|
13
|
-
verifyRegistrationCredential: req => verifyResolver('/passkey/register/verify', req),
|
|
14
|
-
};
|
|
15
|
-
}));
|
|
16
|
-
//# sourceMappingURL=registration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../src/rpc/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEpD,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EAEV,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,2CAA2C,CAAA;AAElD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEzD,YAAY;AAEZ,MAAM,OAAO,kBAAmB,SAAQ,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,EAG5E;CAAG;AAEN,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CAChD,kBAAkB,EAClB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAChB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IAEvC,MAAM,eAAe,GAAG,eAAe,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,CAAA;IAE1F,MAAM,cAAc,GAAG,eAAe,CACpC,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,UAAU,CACX,CAAA;IAED,OAAO;QACL,sBAAsB,EAAE,GAAG,CAAC,EAAE,CAAC,eAAe,CAAC,2BAA2B,EAAE,GAAG,CAAC;QAChF,4BAA4B,EAAE,GAAG,CAAC,EAAE,CAAC,cAAc,CAAC,0BAA0B,EAAE,GAAG,CAAC;KACrF,CAAA;AACH,CAAC,CAAC,CACH,CAAA"}
|
package/src/rpc/registration.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Context, Effect as E, Layer } from 'effect'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
OptionsErrors,
|
|
5
|
-
OptionsReq,
|
|
6
|
-
OptionsRes,
|
|
7
|
-
type RegistrationService,
|
|
8
|
-
VerificationErrors,
|
|
9
|
-
VerificationReq,
|
|
10
|
-
VerificationRes,
|
|
11
|
-
} from '@passlock/shared/dist/rpc/registration.js'
|
|
12
|
-
|
|
13
|
-
import { Dispatcher, makePostRequest } from './client.js'
|
|
14
|
-
|
|
15
|
-
/* Client */
|
|
16
|
-
|
|
17
|
-
export class RegistrationClient extends Context.Tag('@passkey/register/client')<
|
|
18
|
-
RegistrationClient,
|
|
19
|
-
RegistrationService
|
|
20
|
-
>() {}
|
|
21
|
-
|
|
22
|
-
export const RegistrationClientLive = Layer.effect(
|
|
23
|
-
RegistrationClient,
|
|
24
|
-
E.gen(function* (_) {
|
|
25
|
-
const dispatcher = yield* _(Dispatcher)
|
|
26
|
-
|
|
27
|
-
const optionsResolver = makePostRequest(OptionsReq, OptionsRes, OptionsErrors, dispatcher)
|
|
28
|
-
|
|
29
|
-
const verifyResolver = makePostRequest(
|
|
30
|
-
VerificationReq,
|
|
31
|
-
VerificationRes,
|
|
32
|
-
VerificationErrors,
|
|
33
|
-
dispatcher,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
getRegistrationOptions: req => optionsResolver('/passkey/register/options', req),
|
|
38
|
-
verifyRegistrationCredential: req => verifyResolver('/passkey/register/verify', req),
|
|
39
|
-
}
|
|
40
|
-
}),
|
|
41
|
-
)
|