@passlock/client 0.9.32 → 2.0.0-beta.2

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 (180) hide show
  1. package/README.md +14 -86
  2. package/README.template.md +16 -88
  3. package/dist/index.d.ts +4 -206
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +2 -158
  6. package/dist/index.js.map +1 -1
  7. package/dist/logger/index.d.ts +24 -0
  8. package/dist/logger/index.d.ts.map +1 -0
  9. package/dist/logger/index.js +47 -0
  10. package/dist/logger/index.js.map +1 -0
  11. package/dist/network.d.ts +39 -0
  12. package/dist/network.d.ts.map +1 -0
  13. package/dist/network.js +83 -0
  14. package/dist/network.js.map +1 -0
  15. package/dist/passkey/authentication/index.d.ts +21 -0
  16. package/dist/passkey/authentication/index.d.ts.map +1 -0
  17. package/dist/passkey/authentication/index.js +22 -0
  18. package/dist/passkey/authentication/index.js.map +1 -0
  19. package/dist/passkey/authentication/micro.d.ts +71 -0
  20. package/dist/passkey/authentication/micro.d.ts.map +1 -0
  21. package/dist/passkey/authentication/micro.js +107 -0
  22. package/dist/passkey/authentication/micro.js.map +1 -0
  23. package/dist/passkey/index.d.ts +7 -0
  24. package/dist/passkey/index.d.ts.map +1 -0
  25. package/dist/passkey/index.js +5 -0
  26. package/dist/passkey/index.js.map +1 -0
  27. package/dist/passkey/registration/index.d.ts +19 -0
  28. package/dist/passkey/registration/index.d.ts.map +1 -0
  29. package/dist/passkey/registration/index.js +20 -0
  30. package/dist/passkey/registration/index.js.map +1 -0
  31. package/dist/passkey/registration/micro.d.ts +101 -0
  32. package/dist/passkey/registration/micro.d.ts.map +1 -0
  33. package/dist/passkey/registration/micro.js +126 -0
  34. package/dist/passkey/registration/micro.js.map +1 -0
  35. package/dist/passkey/shared.d.ts +24 -0
  36. package/dist/passkey/shared.d.ts.map +1 -0
  37. package/dist/passkey/shared.js +10 -0
  38. package/dist/passkey/shared.js.map +1 -0
  39. package/dist/passkey/support.d.ts +3 -0
  40. package/dist/passkey/support.d.ts.map +1 -0
  41. package/dist/passkey/support.js +4 -0
  42. package/dist/passkey/support.js.map +1 -0
  43. package/dist/passkey/types.d.ts +26 -0
  44. package/dist/passkey/types.d.ts.map +1 -0
  45. package/dist/passkey/types.js +2 -0
  46. package/dist/passkey/types.js.map +1 -0
  47. package/dist/promise.d.ts +15 -0
  48. package/dist/promise.d.ts.map +1 -0
  49. package/dist/promise.js +46 -0
  50. package/dist/promise.js.map +1 -0
  51. package/dist/shared.d.ts +15 -0
  52. package/dist/shared.d.ts.map +1 -0
  53. package/dist/shared.js +2 -0
  54. package/dist/shared.js.map +1 -0
  55. package/dist/tenancy.d.ts +8 -0
  56. package/dist/tenancy.d.ts.map +1 -0
  57. package/dist/tenancy.js +4 -0
  58. package/dist/tenancy.js.map +1 -0
  59. package/package.json +52 -58
  60. package/LICENSE +0 -21
  61. package/dist/authentication/authenticate.d.ts +0 -23
  62. package/dist/authentication/authenticate.fixture.d.ts +0 -52
  63. package/dist/authentication/authenticate.fixture.js +0 -50
  64. package/dist/authentication/authenticate.fixture.js.map +0 -1
  65. package/dist/authentication/authenticate.js +0 -72
  66. package/dist/authentication/authenticate.js.map +0 -1
  67. package/dist/capabilities/capabilities.d.ts +0 -19
  68. package/dist/capabilities/capabilities.js +0 -37
  69. package/dist/capabilities/capabilities.js.map +0 -1
  70. package/dist/connection/connection.d.ts +0 -15
  71. package/dist/connection/connection.fixture.d.ts +0 -10
  72. package/dist/connection/connection.fixture.js +0 -13
  73. package/dist/connection/connection.fixture.js.map +0 -1
  74. package/dist/connection/connection.js +0 -23
  75. package/dist/connection/connection.js.map +0 -1
  76. package/dist/effect.d.ts +0 -26
  77. package/dist/effect.js +0 -78
  78. package/dist/effect.js.map +0 -1
  79. package/dist/email/email.d.ts +0 -70
  80. package/dist/email/email.fixture.d.ts +0 -46
  81. package/dist/email/email.fixture.js +0 -25
  82. package/dist/email/email.fixture.js.map +0 -1
  83. package/dist/email/email.js +0 -83
  84. package/dist/email/email.js.map +0 -1
  85. package/dist/event/event.d.ts +0 -8
  86. package/dist/event/event.js +0 -23
  87. package/dist/event/event.js.map +0 -1
  88. package/dist/logging/eventLogger.d.ts +0 -17
  89. package/dist/logging/eventLogger.js +0 -38
  90. package/dist/logging/eventLogger.js.map +0 -1
  91. package/dist/registration/register.d.ts +0 -25
  92. package/dist/registration/register.fixture.d.ts +0 -53
  93. package/dist/registration/register.fixture.js +0 -66
  94. package/dist/registration/register.fixture.js.map +0 -1
  95. package/dist/registration/register.js +0 -77
  96. package/dist/registration/register.js.map +0 -1
  97. package/dist/rpc/client.d.ts +0 -30
  98. package/dist/rpc/client.js +0 -101
  99. package/dist/rpc/client.js.map +0 -1
  100. package/dist/rpc/config.d.ts +0 -15
  101. package/dist/rpc/config.js +0 -6
  102. package/dist/rpc/config.js.map +0 -1
  103. package/dist/rpc/connection.d.ts +0 -8
  104. package/dist/rpc/connection.js +0 -16
  105. package/dist/rpc/connection.js.map +0 -1
  106. package/dist/rpc/passkey/authentication.d.ts +0 -8
  107. package/dist/rpc/passkey/authentication.js +0 -17
  108. package/dist/rpc/passkey/authentication.js.map +0 -1
  109. package/dist/rpc/passkey/registration.d.ts +0 -8
  110. package/dist/rpc/passkey/registration.js +0 -17
  111. package/dist/rpc/passkey/registration.js.map +0 -1
  112. package/dist/rpc/social.d.ts +0 -10
  113. package/dist/rpc/social.js +0 -19
  114. package/dist/rpc/social.js.map +0 -1
  115. package/dist/rpc/user.d.ts +0 -8
  116. package/dist/rpc/user.js +0 -20
  117. package/dist/rpc/user.js.map +0 -1
  118. package/dist/social/social.d.ts +0 -23
  119. package/dist/social/social.fixture.d.ts +0 -46
  120. package/dist/social/social.fixture.js +0 -31
  121. package/dist/social/social.fixture.js.map +0 -1
  122. package/dist/social/social.js +0 -38
  123. package/dist/social/social.js.map +0 -1
  124. package/dist/storage/storage.d.ts +0 -56
  125. package/dist/storage/storage.fixture.d.ts +0 -4
  126. package/dist/storage/storage.fixture.js +0 -10
  127. package/dist/storage/storage.fixture.js.map +0 -1
  128. package/dist/storage/storage.js +0 -111
  129. package/dist/storage/storage.js.map +0 -1
  130. package/dist/test/fixtures.d.ts +0 -15
  131. package/dist/test/fixtures.js +0 -56
  132. package/dist/test/fixtures.js.map +0 -1
  133. package/dist/tsconfig.tsbuildinfo +0 -1
  134. package/dist/user/user.d.ts +0 -25
  135. package/dist/user/user.fixture.d.ts +0 -12
  136. package/dist/user/user.fixture.js +0 -20
  137. package/dist/user/user.fixture.js.map +0 -1
  138. package/dist/user/user.js +0 -37
  139. package/dist/user/user.js.map +0 -1
  140. package/dist/version.d.ts +0 -1
  141. package/dist/version.js +0 -2
  142. package/dist/version.js.map +0 -1
  143. package/src/authentication/authenticate.fixture.ts +0 -73
  144. package/src/authentication/authenticate.test.ts +0 -249
  145. package/src/authentication/authenticate.ts +0 -143
  146. package/src/capabilities/capabilities.ts +0 -83
  147. package/src/connection/connection.fixture.ts +0 -20
  148. package/src/connection/connection.test.ts +0 -60
  149. package/src/connection/connection.ts +0 -51
  150. package/src/effect.ts +0 -280
  151. package/src/email/email.fixture.ts +0 -44
  152. package/src/email/email.test.ts +0 -186
  153. package/src/email/email.ts +0 -148
  154. package/src/event/event.node.test.ts +0 -21
  155. package/src/event/event.test.ts +0 -37
  156. package/src/event/event.ts +0 -25
  157. package/src/index.ts +0 -407
  158. package/src/logging/eventLogger.test.ts +0 -104
  159. package/src/logging/eventLogger.ts +0 -41
  160. package/src/registration/register.fixture.ts +0 -96
  161. package/src/registration/register.test.ts +0 -216
  162. package/src/registration/register.ts +0 -156
  163. package/src/rpc/client.ts +0 -174
  164. package/src/rpc/config.ts +0 -18
  165. package/src/rpc/connection.ts +0 -32
  166. package/src/rpc/passkey/authentication.ts +0 -52
  167. package/src/rpc/passkey/registration.ts +0 -52
  168. package/src/rpc/social.ts +0 -55
  169. package/src/rpc/user.ts +0 -68
  170. package/src/social/social.fixture.ts +0 -44
  171. package/src/social/social.test.ts +0 -179
  172. package/src/social/social.ts +0 -79
  173. package/src/storage/storage.fixture.ts +0 -16
  174. package/src/storage/storage.test.ts +0 -206
  175. package/src/storage/storage.ts +0 -168
  176. package/src/test/fixtures.ts +0 -70
  177. package/src/user/user.fixture.ts +0 -33
  178. package/src/user/user.test.ts +0 -84
  179. package/src/user/user.ts +0 -71
  180. package/src/version.ts +0 -1
@@ -0,0 +1,101 @@
1
+ import { Micro } from "effect";
2
+ import { type UnexpectedError } from "../../network";
3
+ import { OtherPasskeyError as OtherPasskeyError, PasskeysUnsupportedError } from "../shared";
4
+ import { type PasslockOptions } from "../../shared";
5
+ import { Logger } from "../../logger";
6
+ import type { UserVerification } from "../types";
7
+ export declare const isDuplicatePasskeyError: (err: unknown) => err is DuplicatePasskeyError;
8
+ declare const DuplicatePasskeyError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Micro.YieldableError & {
9
+ readonly _tag: "@error/DuplicatePasskeyError";
10
+ } & Readonly<A>;
11
+ /**
12
+ * Raised if excludeCredentials or userId was provided and the
13
+ * device recognises one of the passkey ids i.e. the user currently
14
+ * has a passkey registered on the current device for a given userId.
15
+ */
16
+ export declare class DuplicatePasskeyError extends DuplicatePasskeyError_base<{
17
+ readonly message: string;
18
+ }> {
19
+ static isDuplicatePasskeyError: (err: unknown) => err is DuplicatePasskeyError;
20
+ }
21
+ /**
22
+ * Passkey registration options
23
+ */
24
+ export interface RegistrationOptions extends PasslockOptions {
25
+ /**
26
+ * The username associated with the newly reguistered passkey..
27
+ *
28
+ * @see {@link https://passlock.dev/getting-started/passkey-registration/#passkey-username|username}
29
+ */
30
+ username: string;
31
+ /**
32
+ * Human palateable username
33
+ */
34
+ userDisplayName?: string | undefined;
35
+ /**
36
+ * Passlock userId. Essentially a shortcut to look up any
37
+ * currently registered passkeys (excludeCredentials) for a given user.
38
+ */
39
+ userId?: string | undefined;
40
+ /**
41
+ * Prevents the user registering a passkey if they already have one
42
+ * (for the same user account) registered on the current device.
43
+ *
44
+ * @see {@link https://passlock.dev/passkeys/registration/#excludecredentials|excludeCredentials}
45
+ */
46
+ excludeCredentials?: Array<string> | undefined;
47
+ /**
48
+ * Whether the device should re-authenticate the user locally before registering the passkey.
49
+ *
50
+ * @see {@link https://passlock.dev/passkeys/user-verification/|userVerification}
51
+ */
52
+ userVerification?: UserVerification | undefined;
53
+ timeout?: number | undefined;
54
+ }
55
+ declare const RegistrationSuccessTag: "RegistrationSuccess";
56
+ type RegistrationSuccessTag = typeof RegistrationSuccessTag;
57
+ /**
58
+ * Represents the outcome of a successfull passkey registration.
59
+ * Submit the code and/or id_token to your backend, then either
60
+ * exchange the code with the passlock REST API or decode and
61
+ * verify the id_token (JWT).
62
+ *
63
+ * Note: The @passlock/node library includes utilities to do this
64
+ * for you.
65
+ */
66
+ export interface RegistrationSuccess {
67
+ _tag: RegistrationSuccessTag;
68
+ principal: {
69
+ authenticatorId: string;
70
+ userId: string;
71
+ };
72
+ /**
73
+ * A signed JWT representing the newly registered passkey.
74
+ * Decode and verify this in your backend or use one of the @passlock/node
75
+ * helper utilities.
76
+ *
77
+ * @see {@link https://passlock.dev/principal/idtoken-verification/|id_token}
78
+ */
79
+ id_token: string;
80
+ /**
81
+ * Call the Passlock API to exchange this code for details about the newly
82
+ * registered passkey.
83
+ *
84
+ * @see {@link https://passlock.dev/principal/code-exchange//|code exchange}
85
+ */
86
+ code: string;
87
+ }
88
+ export declare const isRegistrationSuccess: (payload: unknown) => payload is RegistrationSuccess;
89
+ /**
90
+ * Potential errors associated with Passkey registration
91
+ */
92
+ export type RegistrationError = PasskeysUnsupportedError | DuplicatePasskeyError | OtherPasskeyError | UnexpectedError;
93
+ /**
94
+ * Register a passkey on the local device and store the
95
+ * associated public key in the Passlock vault.
96
+ * @param options
97
+ * @returns
98
+ */
99
+ export declare const registerPasskey: (options: RegistrationOptions) => Micro.Micro<RegistrationSuccess, RegistrationError, Logger>;
100
+ export {};
101
+ //# sourceMappingURL=micro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"micro.d.ts","sourceRoot":"","sources":["../../../src/passkey/registration/micro.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,EAAQ,MAAM,QAAQ,CAAC;AAGrC,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,IAAI,iBAAiB,EACtC,wBAAwB,EACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAOjD,eAAO,MAAM,uBAAuB,GAClC,KAAK,OAAO,KACX,GAAG,IAAI,qBAA6D,CAAC;;;;AAExE;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,2BAEzC;IACA,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;IACA,MAAM,CAAC,uBAAuB,QAbzB,OAAO,KACX,GAAG,IAAI,qBAAqB,CAY4B;CAC1D;AAgBD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC/C;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAChD,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAmCD,QAAA,MAAM,sBAAsB,EAAG,qBAA8B,CAAC;AAC9D,KAAK,sBAAsB,GAAG,OAAO,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,SAAS,EAAE;QACT,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,qBAAqB,GAChC,SAAS,OAAO,KACf,OAAO,IAAI,mBASb,CAAC;AAkEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,wBAAwB,GACxB,qBAAqB,GACrB,iBAAiB,GACjB,eAAe,CAAC;AAEpB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,mBAAmB,KAC3B,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,CAc5D,CAAC"}
@@ -0,0 +1,126 @@
1
+ import { browserSupportsWebAuthn, startRegistration as simpleRegistration, WebAuthnError, } from "@simplewebauthn/browser";
2
+ import { Micro, pipe } from "effect";
3
+ import { TenancyId } from "../../tenancy";
4
+ import { buildEndpoint, Endpoint, makeRequest, } from "../../network";
5
+ import { OtherPasskeyError as OtherPasskeyError, PasskeysUnsupportedError, } from "../shared";
6
+ import {} from "../../shared";
7
+ import { Logger } from "../../logger";
8
+ export const isDuplicatePasskeyError = (err) => err instanceof DuplicatePasskeyError;
9
+ /**
10
+ * Raised if excludeCredentials or userId was provided and the
11
+ * device recognises one of the passkey ids i.e. the user currently
12
+ * has a passkey registered on the current device for a given userId.
13
+ */
14
+ export class DuplicatePasskeyError extends Micro.TaggedError("@error/DuplicatePasskeyError") {
15
+ static isDuplicatePasskeyError = isDuplicatePasskeyError;
16
+ }
17
+ const isOptionsResponse = (payload) => {
18
+ if (typeof payload !== "object")
19
+ return false;
20
+ if (payload === null)
21
+ return false;
22
+ if (!("optionsJSON" in payload))
23
+ return false;
24
+ if (typeof payload.optionsJSON !== "object")
25
+ return false;
26
+ if (payload.optionsJSON === null)
27
+ return false;
28
+ if (!("sessionToken" in payload))
29
+ return false;
30
+ if (typeof payload.sessionToken !== "string")
31
+ return false;
32
+ return true;
33
+ };
34
+ const fetchOptions = ({ username, userDisplayName, userId, excludeCredentials, userVerification, timeout, }) => Micro.gen(function* () {
35
+ const logger = yield* Micro.service(Logger);
36
+ const { endpoint } = yield* Micro.service(Endpoint);
37
+ const { tenancyId } = yield* Micro.service(TenancyId);
38
+ const url = new URL(`${tenancyId}/passkey/registration/options`, endpoint);
39
+ yield* logger.logInfo("Fetching passkey registration options from Passlock");
40
+ return yield* makeRequest({
41
+ url,
42
+ payload: {
43
+ username,
44
+ userDisplayName,
45
+ userId,
46
+ excludeCredentials,
47
+ userVerification,
48
+ timeout,
49
+ },
50
+ responsePredicate: isOptionsResponse,
51
+ label: "registration options",
52
+ });
53
+ });
54
+ const RegistrationSuccessTag = "RegistrationSuccess";
55
+ export const isRegistrationSuccess = (payload) => {
56
+ if (typeof payload !== "object")
57
+ return false;
58
+ if (payload === null)
59
+ return false;
60
+ if (!("_tag" in payload))
61
+ return false;
62
+ if (typeof payload._tag !== "string")
63
+ return false;
64
+ if (payload._tag !== RegistrationSuccessTag)
65
+ return false;
66
+ return true;
67
+ };
68
+ const verifyCredential = (sessionToken, response) => Micro.gen(function* () {
69
+ const logger = yield* Micro.service(Logger);
70
+ const { endpoint } = yield* Micro.service(Endpoint);
71
+ const { tenancyId } = yield* Micro.service(TenancyId);
72
+ const url = new URL(`${tenancyId}/passkey/registration/verification`, endpoint);
73
+ yield* logger.logInfo("Registering passkey in Passlock vault");
74
+ const registrationResponse = yield* makeRequest({
75
+ url,
76
+ payload: { sessionToken, response },
77
+ responsePredicate: isRegistrationSuccess,
78
+ label: "registration verification",
79
+ });
80
+ yield* logger.logInfo(`Passkey registered with id ${registrationResponse.principal.authenticatorId}`);
81
+ return registrationResponse;
82
+ });
83
+ const startRegistration = (optionsJSON) => Micro.gen(function* () {
84
+ const logger = yield* Micro.service(Logger);
85
+ yield* logger.logInfo("Registering passkey on device");
86
+ const isSupport = browserSupportsWebAuthn();
87
+ if (!isSupport)
88
+ yield* new PasskeysUnsupportedError({
89
+ message: "Device does not support passkeys",
90
+ });
91
+ return yield* Micro.tryPromise({
92
+ try: () => simpleRegistration({ optionsJSON }),
93
+ catch: (error) => {
94
+ if (error instanceof WebAuthnError &&
95
+ error.code === "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED") {
96
+ return new DuplicatePasskeyError({ message: error.message });
97
+ }
98
+ else if (error instanceof WebAuthnError) {
99
+ return new OtherPasskeyError({
100
+ error: error.cause,
101
+ message: error.message,
102
+ code: error.code,
103
+ });
104
+ }
105
+ else {
106
+ return new OtherPasskeyError({ error, message: "Unexpected error" });
107
+ }
108
+ },
109
+ });
110
+ });
111
+ /**
112
+ * Register a passkey on the local device and store the
113
+ * associated public key in the Passlock vault.
114
+ * @param options
115
+ * @returns
116
+ */
117
+ export const registerPasskey = (options) => {
118
+ const endpoint = buildEndpoint(options);
119
+ const effect = Micro.gen(function* () {
120
+ const { sessionToken, optionsJSON } = yield* fetchOptions(options);
121
+ const response = yield* startRegistration(optionsJSON);
122
+ return yield* verifyCredential(sessionToken, response);
123
+ });
124
+ return pipe(effect, Micro.provideService(TenancyId, options), Micro.provideService(Endpoint, endpoint));
125
+ };
126
+ //# sourceMappingURL=micro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"micro.js","sourceRoot":"","sources":["../../../src/passkey/registration/micro.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAGvB,iBAAiB,IAAI,kBAAkB,EACvC,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,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,CAAC,SAAS,EAAE,OAAO,CAAC,EACxC,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACzC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { Micro } from "effect";
2
+ export declare const isPasskeysUnsupportedError: (error: unknown) => error is PasskeysUnsupportedError;
3
+ declare const PasskeysUnsupportedError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Micro.YieldableError & {
4
+ readonly _tag: "@error/PasskeysUnsupportedError";
5
+ } & Readonly<A>;
6
+ export declare class PasskeysUnsupportedError extends PasskeysUnsupportedError_base<{
7
+ readonly message: string;
8
+ }> {
9
+ static isPasskeysUnsupportedError: (error: unknown) => error is PasskeysUnsupportedError;
10
+ }
11
+ export type ErrorCode = "ERROR_CEREMONY_ABORTED" | "ERROR_INVALID_DOMAIN" | "ERROR_INVALID_RP_ID" | "ERROR_INVALID_USER_ID_LENGTH" | "ERROR_MALFORMED_PUBKEYCREDPARAMS" | "ERROR_AUTHENTICATOR_GENERAL_ERROR" | "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT" | "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT" | "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED" | "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG" | "ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE" | "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY";
12
+ export declare const isOtherPasskeyError: (error: unknown) => error is OtherPasskeyError;
13
+ declare const OtherPasskeyError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Micro.YieldableError & {
14
+ readonly _tag: "@error/OtherPasskeyError";
15
+ } & Readonly<A>;
16
+ export declare class OtherPasskeyError extends OtherPasskeyError_base<{
17
+ readonly error: unknown;
18
+ readonly message: string;
19
+ readonly code?: ErrorCode;
20
+ }> {
21
+ static isOtherPasskeyError: (error: unknown) => error is OtherPasskeyError;
22
+ }
23
+ export {};
24
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/passkey/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,eAAO,MAAM,0BAA0B,GACrC,OAAO,OAAO,KACb,KAAK,IAAI,wBAC+B,CAAC;;;;AAE5C,qBAAa,wBAAyB,SAAQ,8BAE5C;IACA,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;IACA,MAAM,CAAC,0BAA0B,UAT1B,OAAO,KACb,KAAK,IAAI,wBAAwB,CAQ6B;CAChE;AAED,MAAM,MAAM,SAAS,GACjB,wBAAwB,GACxB,sBAAsB,GACtB,qBAAqB,GACrB,8BAA8B,GAC9B,kCAAkC,GAClC,mCAAmC,GACnC,6DAA6D,GAC7D,uDAAuD,GACvD,2CAA2C,GAC3C,uDAAuD,GACvD,+CAA+C,GAC/C,sCAAsC,CAAC;AAE3C,eAAO,MAAM,mBAAmB,GAC9B,OAAO,OAAO,KACb,KAAK,IAAI,iBAAuD,CAAC;;;;AAEpE,qBAAa,iBAAkB,SAAQ,uBAErC;IACA,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B,CAAC;IACA,MAAM,CAAC,mBAAmB,UAVnB,OAAO,KACb,KAAK,IAAI,iBAAiB,CASsB;CAClD"}
@@ -0,0 +1,10 @@
1
+ import { Micro } from "effect";
2
+ export const isPasskeysUnsupportedError = (error) => error instanceof PasskeysUnsupportedError;
3
+ export class PasskeysUnsupportedError extends Micro.TaggedError("@error/PasskeysUnsupportedError") {
4
+ static isPasskeysUnsupportedError = isPasskeysUnsupportedError;
5
+ }
6
+ export const isOtherPasskeyError = (error) => error instanceof OtherPasskeyError;
7
+ export class OtherPasskeyError extends Micro.TaggedError("@error/OtherPasskeyError") {
8
+ static isOtherPasskeyError = isOtherPasskeyError;
9
+ }
10
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/passkey/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,KAAc,EACqB,EAAE,CACrC,KAAK,YAAY,wBAAwB,CAAC;AAE5C,MAAM,OAAO,wBAAyB,SAAQ,KAAK,CAAC,WAAW,CAC7D,iCAAiC,CAGjC;IACA,MAAM,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;;AAiBjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAc,EACc,EAAE,CAAC,KAAK,YAAY,iBAAiB,CAAC;AAEpE,MAAM,OAAO,iBAAkB,SAAQ,KAAK,CAAC,WAAW,CACtD,0BAA0B,CAK1B;IACA,MAAM,CAAC,mBAAmB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const isPasskeySupport: () => boolean;
2
+ export declare const isAutofillSupport: () => Promise<boolean>;
3
+ //# sourceMappingURL=support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../../src/passkey/support.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,QAAO,OAAoC,CAAC;AAEzE,eAAO,MAAM,iBAAiB,QAAO,OAAO,CAAC,OAAO,CACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { browserSupportsWebAuthn, browserSupportsWebAuthnAutofill, } from "@simplewebauthn/browser";
2
+ export const isPasskeySupport = () => browserSupportsWebAuthn();
3
+ export const isAutofillSupport = () => browserSupportsWebAuthnAutofill();
4
+ //# sourceMappingURL=support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/passkey/support.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAY,EAAE,CAAC,uBAAuB,EAAE,CAAC;AAEzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAqB,EAAE,CACtD,+BAA+B,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ export type UserVerification = "discouraged" | "preferred" | "required";
2
+ /**
3
+ * https://w3c.github.io/webauthn/#enumdef-publickeycredentialhint
4
+ */
5
+ export type PublicKeyCredentialHint = "hybrid" | "security-key" | "client-device";
6
+ /**
7
+ * https://www.iana.org/assignments/webauthn/webauthn.xhtml#webauthn-attestation-statement-format-ids
8
+ */
9
+ export type AttestationFormat = "fido-u2f" | "packed" | "android-safetynet" | "android-key" | "tpm" | "apple" | "none";
10
+ /**
11
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
12
+ */
13
+ export interface PublicKeyCredentialCreationOptionsJSON {
14
+ rp: PublicKeyCredentialRpEntity;
15
+ user: PublicKeyCredentialUserEntityJSON;
16
+ challenge: Base64URLString;
17
+ pubKeyCredParams: Array<PublicKeyCredentialParameters>;
18
+ timeout?: number;
19
+ excludeCredentials?: Array<PublicKeyCredentialDescriptorJSON>;
20
+ authenticatorSelection?: AuthenticatorSelectionCriteria;
21
+ hints?: Array<PublicKeyCredentialHint>;
22
+ attestation?: AttestationConveyancePreference;
23
+ attestationFormats?: Array<AttestationFormat>;
24
+ extensions?: AuthenticationExtensionsClientInputs;
25
+ }
26
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/passkey/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,cAAc,GACd,eAAe,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,KAAK,GACL,OAAO,GACP,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACrD,EAAE,EAAE,2BAA2B,CAAC;IAChC,IAAI,EAAE,iCAAiC,CAAC;IACxC,SAAS,EAAE,eAAe,CAAC;IAC3B,gBAAgB,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC9D,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IACxD,KAAK,CAAC,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,+BAA+B,CAAC;IAC9C,kBAAkB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,oCAAoC,CAAC;CACnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/passkey/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { Micro } from "effect";
2
+ /**
3
+ * Run a Micro and return a success or failure.
4
+ * Note: function could still throw for an unexpected error.
5
+ * @param micro
6
+ * @returns
7
+ */
8
+ export declare const runToPromise: <A, E>(micro: Micro.Micro<A, E>) => Promise<A | E>;
9
+ /**
10
+ * Run a Micro and return a success or throw an error
11
+ * @param micro
12
+ * @returns
13
+ */
14
+ export declare const runToPromiseUnsafe: <A, E>(micro: Micro.Micro<A, E>) => Promise<A>;
15
+ //# sourceMappingURL=promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,EAAQ,MAAM,QAAQ,CAAC;AAGvD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAU,CAAC,EAAE,CAAC,EACrC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KACvB,OAAO,CAAC,CAAC,GAAG,CAAC,CAOf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAU,CAAC,EAAE,CAAC,EAC3C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KACvB,OAAO,CAAC,CAAC,CAqBX,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { Either, identity, Micro, pipe } from "effect";
2
+ import { error } from "effect/Brand";
3
+ /**
4
+ * Run a Micro and return a success or failure.
5
+ * Note: function could still throw for an unexpected error.
6
+ * @param micro
7
+ * @returns
8
+ */
9
+ export const runToPromise = async (micro) => {
10
+ const either = await pipe(micro, Micro.either, Micro.runPromise);
11
+ return Either.match(either, {
12
+ onLeft: identity,
13
+ onRight: identity,
14
+ });
15
+ };
16
+ /**
17
+ * Run a Micro and return a success or throw an error
18
+ * @param micro
19
+ * @returns
20
+ */
21
+ export const runToPromiseUnsafe = async (micro) => {
22
+ const exit = await Micro.runPromiseExit(micro);
23
+ if (Micro.exitIsSuccess(exit))
24
+ return exit.value;
25
+ if (Micro.exitIsFail(exit)) {
26
+ if (error instanceof Error) {
27
+ throw exit.cause;
28
+ }
29
+ else
30
+ throw new Error(String(exit.cause.error));
31
+ }
32
+ if (Micro.exitIsDie(exit)) {
33
+ if (exit.cause.defect instanceof Error) {
34
+ throw exit.cause.defect;
35
+ }
36
+ else
37
+ new Error(String(exit.cause.defect));
38
+ }
39
+ if (Micro.exitIsInterrupt(exit))
40
+ throw new Error(exit.cause.message);
41
+ if (Micro.exitIsFailure(exit))
42
+ throw new Error(exit.cause.message);
43
+ else
44
+ throw new Error("Unexpected error");
45
+ };
46
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise.js","sourceRoot":"","sources":["../src/promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAC/B,KAAwB,EACR,EAAE;IAClB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAEjE,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;QAC1B,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,QAAQ;KAClB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,KAAwB,EACZ,EAAE;IACd,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAE/C,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC;IAEjD,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,MAAM,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;;YAAM,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,YAAY,KAAK,EAAE,CAAC;YACvC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1B,CAAC;;YAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAErE,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;;QAC9D,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;AAC3C,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Options that are not directly related to passkeys or
3
+ * other authentication mechanisms, but required by the
4
+ * Passlock framework
5
+ */
6
+ export interface PasslockOptions {
7
+ /**
8
+ * Obtain this from the settings tab in your Passlock console.
9
+ * Please note this is environment specific, so your dev
10
+ * environment will have a different tenancyId to prod.
11
+ */
12
+ tenancyId: string;
13
+ endpoint?: string;
14
+ }
15
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
package/dist/shared.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { Context } from "effect";
2
+ declare const TenancyId_base: Context.TagClass<TenancyId, "TenancyId", {
3
+ readonly tenancyId: string;
4
+ }>;
5
+ export declare class TenancyId extends TenancyId_base {
6
+ }
7
+ export {};
8
+ //# sourceMappingURL=tenancy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenancy.d.ts","sourceRoot":"","sources":["../src/tenancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;;wBAIT,MAAM;;AAF9B,qBAAa,SAAU,SAAQ,cAG5B;CAAG"}
@@ -0,0 +1,4 @@
1
+ import { Context } from "effect";
2
+ export class TenancyId extends Context.Tag("TenancyId")() {
3
+ }
4
+ //# sourceMappingURL=tenancy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenancy.js","sourceRoot":"","sources":["../src/tenancy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,OAAO,SAAU,SAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAGpD;CAAG"}
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@passlock/client",
3
- "version": "0.9.32",
4
- "description": "Passkey authentication and social login for web apps (Typescript). Framework agnostic",
3
+ "version": "2.0.0-beta.2",
4
+ "description": "Flexible passkey authentication for Astro, SvelteKit, NextJS and other frameworks",
5
5
  "keywords": [
6
6
  "passkey",
7
- "passkeys",
8
7
  "webauthn",
9
- "google one tap",
10
- "sign in with google",
11
- "sign in with apple",
8
+ "astro",
12
9
  "svelte",
13
10
  "sveltekit",
14
11
  "react",
@@ -16,79 +13,76 @@
16
13
  "vue",
17
14
  "nuxt"
18
15
  ],
19
- "author": {
20
- "name": "Toby Hobson",
21
- "email": "toby@passlock.dev"
22
- },
23
- "license": "MIT",
24
16
  "homepage": "https://passlock.dev",
17
+ "bugs": {
18
+ "url": "https://github.com/passlock-dev/passlock/issues",
19
+ "email": "team@passlock.dev"
20
+ },
25
21
  "repository": {
26
22
  "type": "git",
27
23
  "url": "git+https://github.com/passlock-dev/passlock.git",
28
24
  "directory": "packages/client"
29
25
  },
30
- "bugs": {
31
- "url": "https://github.com/passlock-dev/passlock/issues",
32
- "email": "team@passlock.dev"
26
+ "license": "MIT",
27
+ "author": {
28
+ "name": "Toby Hobson",
29
+ "email": "toby@passlock.dev"
33
30
  },
34
31
  "type": "module",
35
32
  "exports": {
36
33
  ".": {
37
34
  "types": "./dist/index.d.ts",
38
- "import": "./dist/index.js"
35
+ "import": "./dist/index.js",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./passkey": {
39
+ "types": "./dist/passkey/index.d.ts",
40
+ "import": "./dist/passkey/index.js",
41
+ "default": "./dist/passkey/index.js"
42
+ },
43
+ "./logger": {
44
+ "types": "./dist/logger/index.d.ts",
45
+ "import": "./dist/logger/index.js",
46
+ "default": "./dist/logger/index.js"
39
47
  }
40
48
  },
49
+ "module": "./dist/index.js",
50
+ "types": "./dist/index.d.ts",
41
51
  "files": [
42
- "src",
43
- "dist",
44
- "!dist/**/*.test.*",
45
- "!dist/**/*.spec.*"
52
+ "dist"
46
53
  ],
47
54
  "dependencies": {
48
- "@effect/schema": "0.74.1",
49
- "@github/webauthn-json": "^2.1.1",
50
- "effect": "3.8.4",
51
- "@passlock/shared": "0.9.32"
55
+ "@simplewebauthn/browser": "^13.2.2",
56
+ "effect": "3.19.10"
52
57
  },
53
58
  "devDependencies": {
54
- "@qetza/replacetokens": "^1.7.0",
55
- "@total-typescript/tsconfig": "^1.0.4",
56
- "@trivago/prettier-plugin-sort-imports": "^4.3.0",
57
- "@tsconfig/node20": "^20.1.4",
58
- "@types/node": "^22.7.4",
59
- "@typescript-eslint/eslint-plugin": "^8.8.0",
60
- "@typescript-eslint/parser": "^8.8.0",
61
- "@vitest/coverage-v8": "^2.1.2",
62
- "@vitest/ui": "^2.1.2",
63
- "eslint": "^9.12.0",
64
- "eslint-config-prettier": "^9.1.0",
65
- "globals": "^15.10.0",
66
- "jsdom": "^25.0.1",
67
- "prettier": "^3.3.3",
68
- "publint": "^0.2.11",
69
- "rimraf": "^6.0.1",
70
- "tslib": "^2.7.0",
71
- "tsx": "^4.19.1",
72
- "typescript": "^5.6.2",
73
- "vite": "^5.4.8",
74
- "vitest": "^2.1.2",
75
- "vitest-mock-extended": "^2.0.2"
59
+ "@eslint/compat": "^2.0.0",
60
+ "@eslint/js": "^9.39.1",
61
+ "eslint": "^9.39.1",
62
+ "globals": "^16.5.0",
63
+ "npm-check-updates": "^19.1.2",
64
+ "prettier": "^3.7.4",
65
+ "publint": "0.3.15",
66
+ "rimraf": "^6.1.2",
67
+ "tsx": "4.21.0",
68
+ "typescript": "^5.9.3",
69
+ "typescript-eslint": "^8.49.0"
76
70
  },
77
71
  "scripts": {
78
- "clean": "rimraf ./dist",
79
- "typecheck": "tsc --noEmit",
72
+ "build": "tsc --build",
73
+ "build:clean": "$npm_execpath run clean:full && $npm_execpath run build",
74
+ "build:production": "$npm_execpath run build:clean && $npm_execpath run build:readme && $npm_execpath run replaceTokens && echo '' && publint",
75
+ "build:readme": "LATEST=${npm_package_version} tsx ../../scripts/replace-readme-tokens.ts ./packages/client",
76
+ "clean": "tsc --build --clean",
77
+ "clean:full": "rimraf dist tsconfig.tsbuildinfo",
78
+ "format": "prettier --write \"src/**/*.+(js|ts|json)\"",
79
+ "lint": "prettier --check \"src/**/*.+(js|ts|json)\" && eslint ./src",
80
+ "lint:fix": "prettier --check \"src/**/*.+(js|ts|json)\" && eslint ./src --fix",
81
+ "replaceTokens": "LATEST=${npm_package_version} tsx ../../scripts/replace-tokens.ts ./packages/client",
80
82
  "test": "vitest run",
81
- "test:watch": "vitest dev",
82
- "test:ui": "vitest --coverage.enabled=true --ui",
83
83
  "test:coverage": "vitest run --coverage",
84
- "build": "tsc --build",
85
- "build:clean": "pnpm run clean && pnpm run build",
86
- "build:readme": "LATEST=${npm_package_version} tsx ../shared/scripts/replace-readme-tokens.ts ./packages/client",
87
- "replaceTokens": "LATEST=${npm_package_version} tsx ../shared/scripts/replace-tokens.ts ./packages/client",
88
- "build:production": "pnpm run build:clean && pnpm run build:readme && pnpm run replaceTokens && echo '' && publint",
89
- "format": "prettier --write \"(src|scripts)/**/*.+(js|ts|json)\"",
90
- "lint": "eslint ./src",
91
- "lint:fix": "pnpm run lint --fix",
92
- "upgrade:deps": "ncu --peer -x effect -x @effect/* -i -u"
84
+ "test:ui": "vitest --coverage.enabled=true --ui",
85
+ "test:watch": "vitest dev",
86
+ "typecheck": "tsc --noEmit"
93
87
  }
94
88
  }