@passlock/client 0.9.21 → 0.9.23

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.
Files changed (192) hide show
  1. package/README.md +125 -0
  2. package/dist/authentication/authenticate.d.ts +15 -15
  3. package/dist/authentication/authenticate.fixture.d.ts +20 -6
  4. package/dist/authentication/authenticate.fixture.js +7 -5
  5. package/dist/authentication/authenticate.fixture.js.map +1 -1
  6. package/dist/authentication/authenticate.js +19 -8
  7. package/dist/authentication/authenticate.js.map +1 -1
  8. package/dist/capabilities/capabilities.d.ts +8 -4
  9. package/dist/capabilities/capabilities.js +10 -1
  10. package/dist/capabilities/capabilities.js.map +1 -1
  11. package/dist/connection/connection.d.ts +11 -7
  12. package/dist/connection/connection.fixture.d.ts +2 -2
  13. package/dist/connection/connection.fixture.js +2 -1
  14. package/dist/connection/connection.fixture.js.map +1 -1
  15. package/dist/connection/connection.js +12 -3
  16. package/dist/connection/connection.js.map +1 -1
  17. package/dist/effect.d.ts +22 -45
  18. package/dist/effect.js +55 -51
  19. package/dist/effect.js.map +1 -1
  20. package/dist/email/email.d.ts +38 -11
  21. package/dist/email/email.fixture.d.ts +19 -5
  22. package/dist/email/email.fixture.js +4 -3
  23. package/dist/email/email.fixture.js.map +1 -1
  24. package/dist/email/email.js +43 -7
  25. package/dist/email/email.js.map +1 -1
  26. package/dist/event/event.d.ts +3 -1
  27. package/dist/event/event.js +3 -0
  28. package/dist/event/event.js.map +1 -1
  29. package/dist/index.d.ts +105 -27
  30. package/dist/index.js +101 -50
  31. package/dist/index.js.map +1 -1
  32. package/dist/logging/eventLogger.d.ts +13 -1
  33. package/dist/logging/eventLogger.js +13 -0
  34. package/dist/logging/eventLogger.js.map +1 -1
  35. package/dist/registration/register.d.ts +18 -21
  36. package/dist/registration/register.fixture.d.ts +19 -5
  37. package/dist/registration/register.fixture.js +14 -7
  38. package/dist/registration/register.fixture.js.map +1 -1
  39. package/dist/registration/register.js +18 -9
  40. package/dist/registration/register.js.map +1 -1
  41. package/dist/rpc/authentication.d.ts +0 -1
  42. package/dist/rpc/authentication.js +1 -0
  43. package/dist/rpc/authentication.js.map +1 -1
  44. package/dist/rpc/client.d.ts +4 -1
  45. package/dist/rpc/client.js +12 -2
  46. package/dist/rpc/client.js.map +1 -1
  47. package/dist/rpc/config.d.ts +0 -1
  48. package/dist/rpc/connection.d.ts +0 -1
  49. package/dist/rpc/connection.js +1 -0
  50. package/dist/rpc/connection.js.map +1 -1
  51. package/dist/rpc/registration.d.ts +0 -1
  52. package/dist/rpc/registration.js +1 -0
  53. package/dist/rpc/registration.js.map +1 -1
  54. package/dist/rpc/social.d.ts +0 -1
  55. package/dist/rpc/social.js +1 -0
  56. package/dist/rpc/social.js.map +1 -1
  57. package/dist/rpc/user.d.ts +0 -1
  58. package/dist/rpc/user.js +1 -0
  59. package/dist/rpc/user.js.map +1 -1
  60. package/dist/social/social.d.ts +16 -23
  61. package/dist/social/social.fixture.d.ts +21 -9
  62. package/dist/social/social.fixture.js +8 -14
  63. package/dist/social/social.fixture.js.map +1 -1
  64. package/dist/social/social.js +14 -10
  65. package/dist/social/social.js.map +1 -1
  66. package/dist/storage/storage.d.ts +40 -12
  67. package/dist/storage/storage.fixture.d.ts +2 -2
  68. package/dist/storage/storage.fixture.js +2 -2
  69. package/dist/storage/storage.fixture.js.map +1 -1
  70. package/dist/storage/storage.js +48 -15
  71. package/dist/storage/storage.js.map +1 -1
  72. package/dist/test/fixtures.d.ts +1 -2
  73. package/dist/test/fixtures.js +20 -5
  74. package/dist/test/fixtures.js.map +1 -1
  75. package/dist/user/user.d.ts +8 -5
  76. package/dist/user/user.fixture.d.ts +2 -2
  77. package/dist/user/user.fixture.js +9 -5
  78. package/dist/user/user.fixture.js.map +1 -1
  79. package/dist/user/user.js +9 -3
  80. package/dist/user/user.js.map +1 -1
  81. package/dist/version.d.ts +1 -2
  82. package/dist/version.js +1 -1
  83. package/dist/version.js.map +1 -1
  84. package/package.json +39 -33
  85. package/src/authentication/authenticate.fixture.ts +8 -7
  86. package/src/authentication/authenticate.test.ts +59 -17
  87. package/src/authentication/authenticate.ts +34 -32
  88. package/src/capabilities/capabilities.ts +9 -8
  89. package/src/connection/connection.fixture.ts +2 -1
  90. package/src/connection/connection.test.ts +3 -3
  91. package/src/connection/connection.ts +9 -8
  92. package/src/effect.ts +129 -128
  93. package/src/email/email.fixture.ts +4 -3
  94. package/src/email/email.test.ts +4 -4
  95. package/src/email/email.ts +24 -16
  96. package/src/index.ts +225 -169
  97. package/src/logging/eventLogger.test.ts +1 -1
  98. package/src/logging/eventLogger.ts +2 -2
  99. package/src/registration/register.fixture.ts +14 -8
  100. package/src/registration/register.test.ts +13 -9
  101. package/src/registration/register.ts +37 -34
  102. package/src/rpc/authentication.ts +31 -0
  103. package/src/rpc/client.ts +173 -0
  104. package/src/rpc/config.ts +18 -0
  105. package/src/rpc/connection.ts +24 -0
  106. package/src/rpc/registration.ts +31 -0
  107. package/src/rpc/social.ts +36 -0
  108. package/src/rpc/user.ts +42 -0
  109. package/src/social/social.fixture.ts +10 -18
  110. package/src/social/social.test.ts +13 -29
  111. package/src/social/social.ts +20 -47
  112. package/src/storage/storage.fixture.ts +3 -4
  113. package/src/storage/storage.test.ts +28 -19
  114. package/src/storage/storage.ts +36 -36
  115. package/src/test/fixtures.ts +21 -6
  116. package/src/user/user.fixture.ts +17 -7
  117. package/src/user/user.test.ts +2 -5
  118. package/src/user/user.ts +13 -9
  119. package/src/version.ts +1 -0
  120. package/dist/authentication/authenticate.d.ts.map +0 -1
  121. package/dist/authentication/authenticate.fixture.d.ts.map +0 -1
  122. package/dist/authentication/authenticate.test.d.ts +0 -2
  123. package/dist/authentication/authenticate.test.d.ts.map +0 -1
  124. package/dist/authentication/authenticate.test.js +0 -111
  125. package/dist/authentication/authenticate.test.js.map +0 -1
  126. package/dist/capabilities/capabilities.d.ts.map +0 -1
  127. package/dist/config.d.ts +0 -18
  128. package/dist/config.d.ts.map +0 -1
  129. package/dist/config.js +0 -20
  130. package/dist/config.js.map +0 -1
  131. package/dist/connection/connection.d.ts.map +0 -1
  132. package/dist/connection/connection.fixture.d.ts.map +0 -1
  133. package/dist/connection/connection.test.d.ts +0 -2
  134. package/dist/connection/connection.test.d.ts.map +0 -1
  135. package/dist/connection/connection.test.js +0 -36
  136. package/dist/connection/connection.test.js.map +0 -1
  137. package/dist/effect.d.ts.map +0 -1
  138. package/dist/email/email.d.ts.map +0 -1
  139. package/dist/email/email.fixture.d.ts.map +0 -1
  140. package/dist/email/email.test.d.ts +0 -2
  141. package/dist/email/email.test.d.ts.map +0 -1
  142. package/dist/email/email.test.js +0 -99
  143. package/dist/email/email.test.js.map +0 -1
  144. package/dist/event/event.d.ts.map +0 -1
  145. package/dist/event/event.node.test.d.ts +0 -2
  146. package/dist/event/event.node.test.d.ts.map +0 -1
  147. package/dist/event/event.node.test.js +0 -13
  148. package/dist/event/event.node.test.js.map +0 -1
  149. package/dist/event/event.test.d.ts +0 -2
  150. package/dist/event/event.test.d.ts.map +0 -1
  151. package/dist/event/event.test.js +0 -30
  152. package/dist/event/event.test.js.map +0 -1
  153. package/dist/index.d.ts.map +0 -1
  154. package/dist/logging/eventLogger.d.ts.map +0 -1
  155. package/dist/logging/eventLogger.test.d.ts +0 -2
  156. package/dist/logging/eventLogger.test.d.ts.map +0 -1
  157. package/dist/logging/eventLogger.test.js +0 -67
  158. package/dist/logging/eventLogger.test.js.map +0 -1
  159. package/dist/registration/register.d.ts.map +0 -1
  160. package/dist/registration/register.fixture.d.ts.map +0 -1
  161. package/dist/registration/register.test.d.ts +0 -2
  162. package/dist/registration/register.test.d.ts.map +0 -1
  163. package/dist/registration/register.test.js +0 -104
  164. package/dist/registration/register.test.js.map +0 -1
  165. package/dist/rpc/authentication.d.ts.map +0 -1
  166. package/dist/rpc/client.d.ts.map +0 -1
  167. package/dist/rpc/config.d.ts.map +0 -1
  168. package/dist/rpc/connection.d.ts.map +0 -1
  169. package/dist/rpc/registration.d.ts.map +0 -1
  170. package/dist/rpc/social.d.ts.map +0 -1
  171. package/dist/rpc/user.d.ts.map +0 -1
  172. package/dist/social/social.d.ts.map +0 -1
  173. package/dist/social/social.fixture.d.ts.map +0 -1
  174. package/dist/social/social.test.d.ts +0 -2
  175. package/dist/social/social.test.d.ts.map +0 -1
  176. package/dist/social/social.test.js +0 -110
  177. package/dist/social/social.test.js.map +0 -1
  178. package/dist/storage/storage.d.ts.map +0 -1
  179. package/dist/storage/storage.fixture.d.ts.map +0 -1
  180. package/dist/storage/storage.test.d.ts +0 -2
  181. package/dist/storage/storage.test.d.ts.map +0 -1
  182. package/dist/storage/storage.test.js +0 -120
  183. package/dist/storage/storage.test.js.map +0 -1
  184. package/dist/test/fixtures.d.ts.map +0 -1
  185. package/dist/user/user.d.ts.map +0 -1
  186. package/dist/user/user.fixture.d.ts.map +0 -1
  187. package/dist/user/user.test.d.ts +0 -2
  188. package/dist/user/user.test.d.ts.map +0 -1
  189. package/dist/user/user.test.js +0 -56
  190. package/dist/user/user.test.js.map +0 -1
  191. package/dist/version.d.ts.map +0 -1
  192. package/src/config.ts +0 -42
@@ -1,7 +1,7 @@
1
- import { AuthenticationClient } from '@passlock/shared/dist/rpc/authentication.js'
2
- import { Effect as E, Layer as L, Layer, LogLevel, Logger, pipe } from 'effect'
1
+ import { Effect as E, Layer as L, Layer, LogLevel, Logger, Option as O, pipe } from 'effect'
3
2
  import { describe, expect, test, vi } from 'vitest'
4
3
  import { mock } from 'vitest-mock-extended'
4
+ import { AuthenticationClient } from '../rpc/authentication.js'
5
5
  import { StorageService } from '../storage/storage.js'
6
6
  import * as Fixture from './authenticate.fixture.js'
7
7
  import { AuthenticateServiceLive, AuthenticationService, GetCredential } from './authenticate.js'
@@ -10,7 +10,13 @@ describe('authenticate should', () => {
10
10
  test('return a valid principal', async () => {
11
11
  const assertions = E.gen(function* (_) {
12
12
  const service = yield* _(AuthenticationService)
13
- const result = yield* _(service.authenticatePasskey({ userVerification: 'preferred' }))
13
+
14
+ const result = yield* _(
15
+ service.authenticatePasskey({
16
+ email: O.none(),
17
+ userVerification: O.some('preferred'),
18
+ }),
19
+ )
14
20
 
15
21
  expect(result).toEqual(Fixture.principal)
16
22
  })
@@ -31,7 +37,13 @@ describe('authenticate should', () => {
31
37
  test('pass the authentication request to the backend', async () => {
32
38
  const assertions = E.gen(function* (_) {
33
39
  const service = yield* _(AuthenticationService)
34
- yield* _(service.authenticatePasskey({ userVerification: 'preferred' }))
40
+
41
+ yield* _(
42
+ service.authenticatePasskey({
43
+ email: O.none(),
44
+ userVerification: O.some('preferred'),
45
+ }),
46
+ )
35
47
 
36
48
  const rpcClient = yield* _(AuthenticationClient)
37
49
  expect(rpcClient.getAuthenticationOptions).toHaveBeenCalledOnce()
@@ -44,7 +56,9 @@ describe('authenticate should', () => {
44
56
  const rpcMock = mock<AuthenticationClient['Type']>()
45
57
 
46
58
  rpcMock.getAuthenticationOptions.mockReturnValue(E.succeed(Fixture.rpcOptionsRes))
47
- rpcMock.verifyAuthenticationCredential.mockReturnValue(E.succeed(Fixture.rpcVerificationRes))
59
+ rpcMock.verifyAuthenticationCredential.mockReturnValue(
60
+ E.succeed(Fixture.rpcVerificationRes),
61
+ )
48
62
 
49
63
  return rpcMock
50
64
  }),
@@ -67,11 +81,19 @@ describe('authenticate should', () => {
67
81
  test('send the credential to the backend', async () => {
68
82
  const assertions = E.gen(function* (_) {
69
83
  const service = yield* _(AuthenticationService)
70
- yield* _(service.authenticatePasskey({ userVerification: 'preferred' }))
84
+
85
+ yield* _(
86
+ service.authenticatePasskey({
87
+ email: O.none(),
88
+ userVerification: O.some('preferred'),
89
+ }),
90
+ )
71
91
 
72
92
  const rpcClient = yield* _(AuthenticationClient)
73
93
  expect(rpcClient.getAuthenticationOptions).toHaveBeenCalledOnce()
74
- expect(rpcClient.verifyAuthenticationCredential).toHaveBeenCalledWith(Fixture.rpcVerificationReq)
94
+ expect(rpcClient.verifyAuthenticationCredential).toHaveBeenCalledWith(
95
+ Fixture.rpcVerificationReq,
96
+ )
75
97
  })
76
98
 
77
99
  const rpcClientTest = L.effect(
@@ -80,7 +102,9 @@ describe('authenticate should', () => {
80
102
  const rpcMock = mock<AuthenticationClient['Type']>()
81
103
 
82
104
  rpcMock.getAuthenticationOptions.mockReturnValue(E.succeed(Fixture.rpcOptionsRes))
83
- rpcMock.verifyAuthenticationCredential.mockReturnValue(E.succeed(Fixture.rpcVerificationRes))
105
+ rpcMock.verifyAuthenticationCredential.mockReturnValue(
106
+ E.succeed(Fixture.rpcVerificationRes),
107
+ )
84
108
 
85
109
  return rpcMock
86
110
  }),
@@ -103,7 +127,13 @@ describe('authenticate should', () => {
103
127
  test('store the credential in local storage', async () => {
104
128
  const assertions = E.gen(function* (_) {
105
129
  const service = yield* _(AuthenticationService)
106
- yield* _(service.authenticatePasskey({ userVerification: 'preferred' }))
130
+
131
+ yield* _(
132
+ service.authenticatePasskey({
133
+ email: O.none(),
134
+ userVerification: O.some('preferred'),
135
+ }),
136
+ )
107
137
 
108
138
  const storageService = yield* _(StorageService)
109
139
  expect(storageService.storeToken).toHaveBeenCalledWith(Fixture.principal)
@@ -112,7 +142,7 @@ describe('authenticate should', () => {
112
142
  const storageServiceTest = L.effect(
113
143
  StorageService,
114
144
  E.sync(() => {
115
- const storageMock = mock<StorageService>()
145
+ const storageMock = mock<StorageService['Type']>()
116
146
 
117
147
  storageMock.storeToken.mockReturnValue(E.void)
118
148
  storageMock.clearExpiredToken.mockReturnValue(E.void)
@@ -138,7 +168,13 @@ describe('authenticate should', () => {
138
168
  test('schedule deletion of the local token', async () => {
139
169
  const assertions = E.gen(function* (_) {
140
170
  const service = yield* _(AuthenticationService)
141
- yield* _(service.authenticatePasskey({ userVerification: 'preferred' }))
171
+
172
+ yield* _(
173
+ service.authenticatePasskey({
174
+ email: O.none(),
175
+ userVerification: O.some('preferred'),
176
+ }),
177
+ )
142
178
 
143
179
  const storageService = yield* _(StorageService)
144
180
  expect(storageService.clearExpiredToken).toHaveBeenCalledWith('passkey')
@@ -147,7 +183,7 @@ describe('authenticate should', () => {
147
183
  const storageServiceTest = L.effect(
148
184
  StorageService,
149
185
  E.sync(() => {
150
- const storageMock = mock<StorageService>()
186
+ const storageMock = mock<StorageService['Type']>()
151
187
 
152
188
  storageMock.storeToken.mockReturnValue(E.void)
153
189
  storageMock.clearExpiredToken.mockReturnValue(E.void)
@@ -173,20 +209,26 @@ describe('authenticate should', () => {
173
209
  test("return an error if the browser can't create a credential", async () => {
174
210
  const assertions = E.gen(function* (_) {
175
211
  const service = yield* _(AuthenticationService)
176
- yield* _(service.authenticatePasskey({ userVerification: 'preferred' }))
177
212
 
178
- const getCredential = yield* _(GetCredential)
213
+ yield* _(
214
+ service.authenticatePasskey({
215
+ email: O.none(),
216
+ userVerification: O.some('preferred'),
217
+ }),
218
+ )
219
+
220
+ const { getCredential } = yield* _(GetCredential)
179
221
  expect(getCredential).toHaveBeenCalledOnce()
180
222
  })
181
223
 
182
224
  const getCredentialTest = L.effect(
183
225
  GetCredential,
184
226
  E.sync(() => {
185
- const getCredentialMock = vi.fn()
227
+ const getCredential = vi.fn()
186
228
 
187
- getCredentialMock.mockReturnValue(E.succeed(Fixture.credential))
229
+ getCredential.mockReturnValue(E.succeed(Fixture.credential))
188
230
 
189
- return getCredentialMock
231
+ return { getCredential }
190
232
  }),
191
233
  )
192
234
 
@@ -2,52 +2,51 @@
2
2
  * Passkey authentication effects
3
3
  */
4
4
  import {
5
- parseRequestOptionsFromJSON,
6
5
  type CredentialRequestOptionsJSON,
6
+ parseRequestOptionsFromJSON,
7
7
  } from '@github/webauthn-json/browser-ponyfill'
8
+ import { InternalBrowserError, type NotSupported } from '@passlock/shared/dist/error/error.js'
8
9
  import {
9
- InternalBrowserError,
10
- type NotSupported,
11
- } from '@passlock/shared/dist/error/error.js'
12
- import type { OptionsErrors, VerificationErrors } from '@passlock/shared/dist/rpc/authentication.js'
13
- import { AuthenticationClient, OptionsReq, VerificationReq } from '@passlock/shared/dist/rpc/authentication.js'
14
- import type {
15
- AuthenticationCredential,
16
- UserVerification,
17
- } from '@passlock/shared/dist/schema/passkey.js'
18
- import { Principal } from '@passlock/shared/dist/schema/principal.js'
10
+ type OptionsErrors,
11
+ type OptionsReq,
12
+ type VerificationErrors,
13
+ VerificationReq,
14
+ } from '@passlock/shared/dist/rpc/authentication.js'
15
+ import type { AuthenticationCredential } from '@passlock/shared/dist/schema/passkey.js'
16
+ import type { Principal } from '@passlock/shared/dist/schema/principal.js'
19
17
  import { Context, Effect as E, Layer, flow, pipe } from 'effect'
20
18
  import { Capabilities } from '../capabilities/capabilities.js'
19
+ import { AuthenticationClient } from '../rpc/authentication.js'
21
20
  import { StorageService } from '../storage/storage.js'
22
21
 
23
22
  /* Requests */
24
23
 
25
- export type AuthenticationRequest = {
26
- email?: string,
27
- userVerification?: UserVerification
28
- }
29
-
24
+ export type AuthenticationRequest = OptionsReq
30
25
  /* Errors */
31
26
 
32
27
  export type AuthenticationErrors = NotSupported | OptionsErrors | VerificationErrors
33
28
 
34
29
  /* Dependencies */
35
30
 
36
- export type GetCredential = (
37
- request: CredentialRequestOptions,
38
- ) => E.Effect<AuthenticationCredential, InternalBrowserError>
39
-
40
- export const GetCredential = Context.GenericTag<GetCredential>('@services/Get')
31
+ export class GetCredential extends Context.Tag('@services/GetCredential')<
32
+ GetCredential,
33
+ {
34
+ getCredential: (
35
+ request: CredentialRequestOptions,
36
+ ) => E.Effect<AuthenticationCredential, InternalBrowserError>
37
+ }
38
+ >() {}
41
39
 
42
40
  /* Service */
43
41
 
44
- export type AuthenticationService = {
45
- authenticatePasskey: (request: AuthenticationRequest) => E.Effect<Principal, AuthenticationErrors>
46
- }
47
-
48
- export const AuthenticationService = Context.GenericTag<AuthenticationService>(
49
- '@services/AuthenticationService',
50
- )
42
+ export class AuthenticationService extends Context.Tag('@services/AuthenticationService')<
43
+ AuthenticationService,
44
+ {
45
+ authenticatePasskey: (
46
+ request: AuthenticationRequest,
47
+ ) => E.Effect<Principal, AuthenticationErrors>
48
+ }
49
+ >() {}
51
50
 
52
51
  /* Utilities */
53
52
 
@@ -102,11 +101,12 @@ export const authenticatePasskey = (
102
101
  yield* _(capabilities.passkeySupport)
103
102
 
104
103
  yield* _(E.logInfo('Fetching authentication options from Passlock'))
105
- const { options, session } = yield* _(fetchOptions(new OptionsReq(request)))
104
+
105
+ const { options, session } = yield* _(fetchOptions(request))
106
106
 
107
107
  yield* _(E.logInfo('Looking up credential'))
108
- const get = yield* _(GetCredential)
109
- const credential = yield* _(get(options))
108
+ const { getCredential } = yield* _(GetCredential)
109
+ const credential = yield* _(getCredential(options))
110
110
 
111
111
  yield* _(E.logInfo('Verifying credential with Passlock'))
112
112
  const principal = yield* _(verifyCredential(new VerificationReq({ credential, session })))
@@ -135,7 +135,9 @@ export const authenticatePasskey = (
135
135
  export const AuthenticateServiceLive = Layer.effect(
136
136
  AuthenticationService,
137
137
  E.gen(function* (_) {
138
- const context = yield* _(E.context<GetCredential | AuthenticationClient | Capabilities | StorageService>())
138
+ const context = yield* _(
139
+ E.context<GetCredential | AuthenticationClient | Capabilities | StorageService>(),
140
+ )
139
141
 
140
142
  return AuthenticationService.of({
141
143
  authenticatePasskey: flow(authenticatePasskey, E.provide(context)),
@@ -6,14 +6,15 @@ import { Context, Effect as E, Layer, identity, pipe } from 'effect'
6
6
 
7
7
  /* Service */
8
8
 
9
- export type Capabilities = {
10
- passkeySupport: E.Effect<void, NotSupported>
11
- isPasskeySupport: E.Effect<boolean>
12
- autofillSupport: E.Effect<void, NotSupported>
13
- isAutofillSupport: E.Effect<boolean>
14
- }
15
-
16
- export const Capabilities = Context.GenericTag<Capabilities>('@services/Capabilities')
9
+ export class Capabilities extends Context.Tag('@services/Capabilities')<
10
+ Capabilities,
11
+ {
12
+ passkeySupport: E.Effect<void, NotSupported>
13
+ isPasskeySupport: E.Effect<boolean>
14
+ autofillSupport: E.Effect<void, NotSupported>
15
+ isAutofillSupport: E.Effect<boolean>
16
+ }
17
+ >() {}
17
18
 
18
19
  /* Effects */
19
20
 
@@ -1,5 +1,6 @@
1
- import { ConnectionClient, ConnectRes } from '@passlock/shared/dist/rpc/connection.js'
1
+ import { ConnectRes } from '@passlock/shared/dist/rpc/connection.js'
2
2
  import { Effect as E, Layer as L } from 'effect'
3
+ import { ConnectionClient } from '../rpc/connection.js'
3
4
 
4
5
  export const preConnectRes = new ConnectRes({ warmed: true })
5
6
 
@@ -1,9 +1,9 @@
1
- import { RpcConfig } from '@passlock/shared/dist/rpc/config.js'
2
- import { ConnectionClient } from '@passlock/shared/dist/rpc/connection.js'
3
- import { Dispatcher } from '@passlock/shared/dist/rpc/dispatcher.js'
4
1
  import { Effect as E, Layer as L, Layer, LogLevel, Logger, pipe } from 'effect'
5
2
  import { describe, expect, test } from 'vitest'
6
3
  import { mock } from 'vitest-mock-extended'
4
+ import { Dispatcher } from '../rpc/client.js'
5
+ import { RpcConfig } from '../rpc/config.js'
6
+ import { ConnectionClient } from '../rpc/connection.js'
7
7
  import * as Fixture from './connection.fixture.js'
8
8
  import { ConnectionService, ConnectionServiceLive } from './connection.js'
9
9
 
@@ -1,18 +1,19 @@
1
1
  /**
2
2
  * Hits the rpc endpoint to warm up a lambda
3
3
  */
4
- import type { RpcConfig } from '@passlock/shared/dist/rpc/config.js'
5
- import { ConnectionClient } from '@passlock/shared/dist/rpc/connection.js'
6
- import { Dispatcher } from '@passlock/shared/dist/rpc/dispatcher.js'
7
4
  import { Context, Effect as E, Layer, flow, pipe } from 'effect'
5
+ import { Dispatcher } from '../rpc/client.js'
6
+ import type { RpcConfig } from '../rpc/config.js'
7
+ import { ConnectionClient } from '../rpc/connection.js'
8
8
 
9
9
  /* Service */
10
10
 
11
- export type ConnectionService = {
12
- preConnect: () => E.Effect<void>
13
- }
14
-
15
- export const ConnectionService = Context.GenericTag<ConnectionService>('@services/ConnectService')
11
+ export class ConnectionService extends Context.Tag('@services/ConnectionService')<
12
+ ConnectionService,
13
+ {
14
+ preConnect: () => E.Effect<void>
15
+ }
16
+ >() {}
16
17
 
17
18
  /* Effects */
18
19