@passlock/client 0.9.23 → 0.9.24

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 (114) hide show
  1. package/README.md +10 -5
  2. package/README.template.md +130 -0
  3. package/dist/authentication/authenticate.d.ts +2 -2
  4. package/dist/authentication/authenticate.fixture.d.ts +1 -1
  5. package/dist/authentication/authenticate.fixture.js +2 -2
  6. package/dist/authentication/authenticate.fixture.js.map +1 -1
  7. package/dist/authentication/authenticate.js +1 -1
  8. package/dist/authentication/authenticate.js.map +1 -1
  9. package/dist/capabilities/capabilities.d.ts +1 -1
  10. package/dist/capabilities/capabilities.js +1 -1
  11. package/dist/capabilities/capabilities.js.map +1 -1
  12. package/dist/connection/connection.fixture.d.ts +1 -1
  13. package/dist/connection/connection.fixture.js +1 -1
  14. package/dist/connection/connection.fixture.js.map +1 -1
  15. package/dist/connection/connection.js.map +1 -1
  16. package/dist/effect.d.ts +3 -3
  17. package/dist/effect.js +6 -6
  18. package/dist/effect.js.map +1 -1
  19. package/dist/email/email.d.ts +5 -2
  20. package/dist/email/email.fixture.d.ts +1 -1
  21. package/dist/email/email.fixture.js +2 -2
  22. package/dist/email/email.fixture.js.map +1 -1
  23. package/dist/email/email.js +1 -1
  24. package/dist/email/email.js.map +1 -1
  25. package/dist/event/event.d.ts +1 -1
  26. package/dist/event/event.js +1 -1
  27. package/dist/event/event.js.map +1 -1
  28. package/dist/index.js +3 -3
  29. package/dist/index.js.map +1 -1
  30. package/dist/logging/eventLogger.js +1 -1
  31. package/dist/logging/eventLogger.js.map +1 -1
  32. package/dist/registration/register.d.ts +2 -2
  33. package/dist/registration/register.fixture.d.ts +1 -1
  34. package/dist/registration/register.fixture.js +2 -2
  35. package/dist/registration/register.fixture.js.map +1 -1
  36. package/dist/registration/register.js +2 -2
  37. package/dist/registration/register.js.map +1 -1
  38. package/dist/rpc/authentication.d.ts +1 -1
  39. package/dist/rpc/authentication.js +1 -1
  40. package/dist/rpc/authentication.js.map +1 -1
  41. package/dist/rpc/client.d.ts +1 -1
  42. package/dist/rpc/client.js +3 -4
  43. package/dist/rpc/client.js.map +1 -1
  44. package/dist/rpc/connection.d.ts +1 -1
  45. package/dist/rpc/connection.js +1 -1
  46. package/dist/rpc/connection.js.map +1 -1
  47. package/dist/rpc/registration.d.ts +1 -1
  48. package/dist/rpc/registration.js +1 -1
  49. package/dist/rpc/registration.js.map +1 -1
  50. package/dist/rpc/social.d.ts +1 -1
  51. package/dist/rpc/social.js +1 -1
  52. package/dist/rpc/social.js.map +1 -1
  53. package/dist/rpc/user.d.ts +1 -1
  54. package/dist/rpc/user.js +1 -1
  55. package/dist/rpc/user.js.map +1 -1
  56. package/dist/social/social.d.ts +2 -2
  57. package/dist/social/social.fixture.d.ts +1 -1
  58. package/dist/social/social.fixture.js +2 -2
  59. package/dist/social/social.fixture.js.map +1 -1
  60. package/dist/social/social.js +2 -2
  61. package/dist/social/social.js.map +1 -1
  62. package/dist/storage/storage.d.ts +1 -1
  63. package/dist/storage/storage.fixture.js.map +1 -1
  64. package/dist/storage/storage.js +4 -0
  65. package/dist/storage/storage.js.map +1 -1
  66. package/dist/test/fixtures.d.ts +1 -1
  67. package/dist/test/fixtures.js +2 -2
  68. package/dist/test/fixtures.js.map +1 -1
  69. package/dist/user/user.d.ts +1 -1
  70. package/dist/user/user.fixture.d.ts +1 -1
  71. package/dist/user/user.fixture.js +2 -2
  72. package/dist/user/user.fixture.js.map +1 -1
  73. package/dist/user/user.js +4 -1
  74. package/dist/user/user.js.map +1 -1
  75. package/dist/version.d.ts +1 -1
  76. package/dist/version.js +1 -1
  77. package/package.json +20 -16
  78. package/src/authentication/authenticate.fixture.ts +4 -2
  79. package/src/authentication/authenticate.test.ts +2 -1
  80. package/src/authentication/authenticate.ts +3 -1
  81. package/src/capabilities/capabilities.ts +2 -1
  82. package/src/connection/connection.fixture.ts +3 -1
  83. package/src/connection/connection.test.ts +2 -1
  84. package/src/connection/connection.ts +1 -0
  85. package/src/effect.ts +12 -18
  86. package/src/email/email.fixture.ts +4 -2
  87. package/src/email/email.test.ts +2 -1
  88. package/src/email/email.ts +3 -1
  89. package/src/event/event.node.test.ts +1 -0
  90. package/src/event/event.test.ts +1 -0
  91. package/src/event/event.ts +2 -1
  92. package/src/index.ts +39 -33
  93. package/src/logging/eventLogger.test.ts +1 -0
  94. package/src/logging/eventLogger.ts +1 -1
  95. package/src/registration/register.fixture.ts +4 -2
  96. package/src/registration/register.test.ts +4 -2
  97. package/src/registration/register.ts +4 -5
  98. package/src/rpc/authentication.ts +14 -2
  99. package/src/rpc/client.ts +5 -4
  100. package/src/rpc/connection.ts +8 -2
  101. package/src/rpc/registration.ts +12 -2
  102. package/src/rpc/social.ts +11 -2
  103. package/src/rpc/user.ts +16 -1
  104. package/src/social/social.fixture.ts +4 -2
  105. package/src/social/social.test.ts +4 -2
  106. package/src/social/social.ts +4 -2
  107. package/src/storage/storage.fixture.ts +1 -0
  108. package/src/storage/storage.test.ts +1 -0
  109. package/src/storage/storage.ts +4 -3
  110. package/src/test/fixtures.ts +4 -2
  111. package/src/user/user.fixture.ts +4 -2
  112. package/src/user/user.test.ts +2 -1
  113. package/src/user/user.ts +3 -1
  114. package/src/version.ts +1 -1
package/src/rpc/social.ts CHANGED
@@ -1,5 +1,14 @@
1
- import { AuthOidcErrors, AuthOidcReq, PrincipalRes, RegisterOidcErrors, RegisterOidcReq, type SocialService } from '@passlock/shared/dist/rpc/social.js'
2
1
  import { Context, Effect as E, Layer } from 'effect'
2
+
3
+ import {
4
+ AuthOidcErrors,
5
+ AuthOidcReq,
6
+ PrincipalRes,
7
+ RegisterOidcErrors,
8
+ RegisterOidcReq,
9
+ type SocialService,
10
+ } from '@passlock/shared/dist/rpc/social.js'
11
+
3
12
  import { Dispatcher, makePostRequest } from './client.js'
4
13
 
5
14
  /* Client */
@@ -33,4 +42,4 @@ export const SocialClientLive = Layer.effect(
33
42
  authenticateOidc: req => authenticateResolver(OIDC_AUTH_ENDPOINT, req),
34
43
  }
35
44
  }),
36
- )
45
+ )
package/src/rpc/user.ts CHANGED
@@ -1,6 +1,21 @@
1
1
  import * as S from '@effect/schema/Schema'
2
- import { IsExistingUserReq, IsExistingUserRes, RESEND_EMAIL_ENDPOINT, ResendEmailErrors, ResendEmailReq, ResendEmailRes, USER_STATUS_ENDPOINT, VERIFY_EMAIL_ENDPOINT, VerifyEmailErrors, VerifyEmailReq, VerifyEmailRes, type UserService } from '@passlock/shared/dist/rpc/user.js'
3
2
  import { Context, Effect as E, Layer } from 'effect'
3
+
4
+ import {
5
+ IsExistingUserReq,
6
+ IsExistingUserRes,
7
+ RESEND_EMAIL_ENDPOINT,
8
+ ResendEmailErrors,
9
+ ResendEmailReq,
10
+ ResendEmailRes,
11
+ USER_STATUS_ENDPOINT,
12
+ type UserService,
13
+ VERIFY_EMAIL_ENDPOINT,
14
+ VerifyEmailErrors,
15
+ VerifyEmailReq,
16
+ VerifyEmailRes,
17
+ } from '@passlock/shared/dist/rpc/user.js'
18
+
4
19
  import { Dispatcher, makePostRequest } from './client.js'
5
20
 
6
21
  /* Client */
@@ -1,7 +1,9 @@
1
- import * as Shared from '@passlock/shared/dist/rpc/social.js'
2
1
  import { Effect as E, Layer as L, Option as O } from 'effect'
3
- import { SocialClient } from '../rpc/social.js'
2
+
3
+ import * as Shared from '@passlock/shared/dist/rpc/social.js'
4
+
4
5
  import * as Fixtures from '../test/fixtures.js'
6
+ import { SocialClient } from '../rpc/social.js'
5
7
  import type { AuthenticateOidcReq } from './social.js'
6
8
 
7
9
  export const session = 'session'
@@ -1,9 +1,11 @@
1
- import { Duplicate, NotFound } from '@passlock/shared/dist/error/error.js'
2
1
  import { Effect as E, Layer as L, Layer, LogLevel, Logger, pipe } from 'effect'
3
2
  import { describe, expect, test } from 'vitest'
4
3
  import { mock } from 'vitest-mock-extended'
5
- import { SocialClient } from '../rpc/social.js'
4
+
5
+ import { Duplicate, NotFound } from '@passlock/shared/dist/error/error.js'
6
+
6
7
  import * as Fixture from './social.fixture.js'
8
+ import { SocialClient } from '../rpc/social.js'
7
9
  import { SocialService, SocialServiceLive } from './social.js'
8
10
 
9
11
  describe('registerOidc should', () => {
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Passkey authentication effects
3
3
  */
4
- import { type BadRequest, type NotSupported } from '@passlock/shared/dist/error/error.js'
4
+ import { Context, Effect as E, Layer, flow } from 'effect'
5
+
5
6
  import * as RPC from '@passlock/shared/dist/rpc/social.js'
7
+ import { type BadRequest, type NotSupported } from '@passlock/shared/dist/error/error.js'
6
8
  import type { Principal } from '@passlock/shared/dist/schema/principal.js'
7
- import { Context, Effect as E, Layer, flow } from 'effect'
9
+
8
10
  import { SocialClient } from '../rpc/social.js'
9
11
 
10
12
  /* Requests */
@@ -1,5 +1,6 @@
1
1
  import { Effect as E, Layer, pipe } from 'effect'
2
2
  import { mock } from 'vitest-mock-extended'
3
+
3
4
  import { BrowserStorage, StorageServiceLive } from './storage.js'
4
5
 
5
6
  const storageTest = Layer.effect(
@@ -1,6 +1,7 @@
1
1
  import { Effect as E, Layer, LogLevel, Logger, identity, pipe } from 'effect'
2
2
  import { describe, expect, test } from 'vitest'
3
3
  import { mock } from 'vitest-mock-extended'
4
+
4
5
  import { principal, testLayers } from './storage.fixture.js'
5
6
  import {
6
7
  BrowserStorage,
@@ -2,10 +2,11 @@
2
2
  * Wrapper around local storage that allows us to store
3
3
  * authentication tokens in local storage for a short period.
4
4
  */
5
- import type { Principal } from '@passlock/shared/dist/schema/principal.js'
6
5
  import { Context, Effect as E, Layer, Option as O, flow, pipe } from 'effect'
7
6
  import type { NoSuchElementException } from 'effect/Cause'
8
7
 
8
+ import type { Principal } from '@passlock/shared/dist/schema/principal.js'
9
+
9
10
  /* Requests */
10
11
 
11
12
  export type AuthType = 'email' | 'passkey' | 'apple' | 'google'
@@ -46,8 +47,8 @@ export const expandToken =
46
47
  (s: string): O.Option<StoredToken> => {
47
48
  const tokens = s.split(':')
48
49
  if (tokens.length !== 2) return O.none()
49
-
50
- const [token, expireAtString] = tokens
50
+
51
+ const [token, expireAtString] = tokens
51
52
  if (token === undefined || expireAtString === undefined) return O.none()
52
53
 
53
54
  const parse = O.liftThrowable(Number.parseInt)
@@ -1,6 +1,8 @@
1
+ import { Effect as E, Layer as L } from 'effect'
2
+
1
3
  import { BadRequest } from '@passlock/shared/dist/error/error.js'
2
4
  import type { Principal } from '@passlock/shared/dist/schema/principal.js'
3
- import { Effect as E, Layer as L } from 'effect'
5
+
4
6
  import { Capabilities } from '../capabilities/capabilities.js'
5
7
  import { StorageService, type StoredToken } from '../storage/storage.js'
6
8
 
@@ -32,7 +34,7 @@ export const principal: Principal = {
32
34
  givenName: 'john',
33
35
  familyName: 'doe',
34
36
  email: 'john.doe@gmail.com',
35
- emailVerified: false
37
+ emailVerified: false,
36
38
  },
37
39
  authStatement: {
38
40
  authType: 'passkey',
@@ -1,3 +1,5 @@
1
+ import { Effect as E, Layer as L, Option as O } from 'effect'
2
+
1
3
  import {
2
4
  IsExistingUserReq,
3
5
  IsExistingUserRes,
@@ -5,9 +7,9 @@ import {
5
7
  ResendEmailRes,
6
8
  VerifyEmailRes,
7
9
  } from '@passlock/shared/dist/rpc/user.js'
8
- import { Effect as E, Layer as L, Option as O } from 'effect'
9
- import { UserClient } from '../rpc/user.js'
10
+
10
11
  import * as Fixtures from '../test/fixtures.js'
12
+ import { UserClient } from '../rpc/user.js'
11
13
  import type { ResendEmail } from './user.js'
12
14
 
13
15
  export const email = 'jdoe@gmail.com'
@@ -1,8 +1,9 @@
1
1
  import { Effect as E, Layer as L, Layer, LogLevel, Logger, pipe } from 'effect'
2
2
  import { describe, expect, test } from 'vitest'
3
3
  import { mock } from 'vitest-mock-extended'
4
- import { UserClient } from '../rpc/user.js'
4
+
5
5
  import * as Fixture from './user.fixture.js'
6
+ import { UserClient } from '../rpc/user.js'
6
7
  import { UserService, UserServiceLive } from './user.js'
7
8
 
8
9
  describe('isExistingUser should', () => {
package/src/user/user.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Check for an existing user
3
3
  */
4
+ import { Context, Effect as E, Layer, flow } from 'effect'
5
+
4
6
  import type { BadRequest, Disabled, NotFound } from '@passlock/shared/dist/error/error.js'
5
7
  import { IsExistingUserReq, ResendEmailReq } from '@passlock/shared/dist/rpc/user.js'
6
8
  import type { VerifyEmail } from '@passlock/shared/dist/schema/email.js'
7
- import { Context, Effect as E, Layer, flow } from 'effect'
9
+
8
10
  import { UserClient } from '../rpc/user.js'
9
11
 
10
12
  /* Requests */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const PASSLOCK_CLIENT_VERSION = '#{LATEST}#'
1
+ export const PASSLOCK_CLIENT_VERSION = '#{LATEST}#'