jazz-browser-auth-clerk 0.8.15 → 0.8.16

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ export class BrowserClerkAuth {
47
47
  accountID: storedCredentials.jazzAccountID,
48
48
  secret: storedCredentials.jazzAccountSecret,
49
49
  },
50
- saveCredentials: async ({ accountID, secret, }) => {
50
+ saveCredentials: async ({ accountID, secret }) => {
51
51
  saveCredentialsToLocalStorage({
52
52
  accountID,
53
53
  secret,
@@ -71,7 +71,7 @@ export class BrowserClerkAuth {
71
71
  this.clerkClient.user.username ||
72
72
  this.clerkClient.user.id,
73
73
  },
74
- saveCredentials: async ({ accountID, secret, }) => {
74
+ saveCredentials: async ({ accountID, secret }) => {
75
75
  saveCredentialsToLocalStorage({
76
76
  accountID,
77
77
  secret,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAiB1C,SAAS,6BAA6B,CAAC,WAAwB;IAC3D,YAAY,CAAC,OAAO,CAChB,eAAe,EACf,IAAI,CAAC,SAAS,CAAC;QACX,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,MAAM,EAAE,WAAW,CAAC,MAAM;KAC7B,CAAC,CACL,CAAC;AACN,CAAC;AAED,MAAM,OAAO,gBAAgB;IACzB,YACW,MAA+B,EACrB,WAA+B;QADzC,WAAM,GAAN,MAAM,CAAyB;QACrB,gBAAW,GAAX,WAAW,CAAoB;IACjD,CAAC;IAEJ,KAAK,CAAC,KAAK;QACP,sCAAsC;QACtC,MAAM,wBAAwB,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAEvE,IAAI,wBAAwB,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC1B,wBAAwB,CACZ,CAAC;gBACjB,OAAO;oBACH,IAAI,EAAE,UAA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gBAC5C,GAAG,eAAe;gBAClB,IAAI,EAAE,IAAI;aACX,CAAC,CAAC;YAEH,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,IAAI,GAAG,IAAI,gBAAgB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;YAC/D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAClC,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;gBAC3B,MAAM,MAAM,CAAC,eAAe,CAAC;oBAC3B,SAAS,EAAE,iBAAgC;oBAC3C,MAAM,EAAE,aAA4B;iBACrC,CAAC,CAAC;YACL,CAAC;YAED,MAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;YAC1D,MAAM,IAAI,GAAG,IAAI,gBAAgB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;YAC/D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAClC,MAAM,CAAC,MAAM,EAAE,CAAC;YAEhB,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,26 +1,22 @@
1
1
  {
2
2
  "name": "jazz-browser-auth-clerk",
3
- "version": "0.8.15",
3
+ "version": "0.8.16",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
7
7
  "license": "MIT",
8
- "lint-staged": {
9
- "*.{ts,tsx}": "eslint --fix",
10
- "*.{js,jsx,mdx,json}": "prettier --write"
11
- },
12
8
  "dependencies": {
13
- "cojson": "0.8.12",
14
- "jazz-browser": "0.8.15",
15
- "jazz-tools": "0.8.15"
9
+ "cojson": "0.8.16",
10
+ "jazz-browser": "0.8.16",
11
+ "jazz-tools": "0.8.16"
16
12
  },
17
13
  "devDependencies": {
18
14
  "typescript": "^5.3.3"
19
15
  },
20
16
  "scripts": {
21
- "lint": "eslint . --ext ts,tsx",
22
- "format": "prettier --write './src/**/*.{ts,tsx}'",
23
- "build": "npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist",
17
+ "format-and-lint": "biome check .",
18
+ "format-and-lint:fix": "biome check . --write",
19
+ "build": "rm -rf ./dist && tsc --sourceMap --outDir dist",
24
20
  "test": "vitest --run --root ../../ --project jazz-browser-auth-clerk",
25
21
  "test:watch": "vitest --watch --root ../../ --project jazz-browser-auth-clerk"
26
22
  }
package/src/index.ts CHANGED
@@ -4,138 +4,132 @@ import { Account, AuthMethod, AuthResult, Credentials, ID } from "jazz-tools";
4
4
  const localStorageKey = "jazz-clerk-auth";
5
5
 
6
6
  export type MinimalClerkClient = {
7
- user: {
7
+ user:
8
+ | {
8
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
10
  unsafeMetadata: Record<string, any>;
10
11
  fullName: string | null;
11
12
  username: string | null;
12
13
  id: string;
13
14
  update: (args: {
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- unsafeMetadata: Record<string, any>;
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ unsafeMetadata: Record<string, any>;
16
17
  }) => Promise<unknown>;
17
- } | null | undefined;
18
- signOut: () => Promise<void>;
19
- }
18
+ }
19
+ | null
20
+ | undefined;
21
+ signOut: () => Promise<void>;
22
+ };
20
23
 
21
24
  function saveCredentialsToLocalStorage(credentials: Credentials) {
22
- localStorage.setItem(
23
- localStorageKey,
24
- JSON.stringify({
25
- accountID: credentials.accountID,
26
- secret: credentials.secret,
27
- }),
28
- );
25
+ localStorage.setItem(
26
+ localStorageKey,
27
+ JSON.stringify({
28
+ accountID: credentials.accountID,
29
+ secret: credentials.secret,
30
+ }),
31
+ );
29
32
  }
30
33
 
31
34
  export class BrowserClerkAuth implements AuthMethod {
32
- constructor(
33
- public driver: BrowserClerkAuth.Driver,
34
- private readonly clerkClient: MinimalClerkClient
35
- ) {}
35
+ constructor(
36
+ public driver: BrowserClerkAuth.Driver,
37
+ private readonly clerkClient: MinimalClerkClient,
38
+ ) {}
36
39
 
37
- async start(): Promise<AuthResult> {
38
- // Check local storage for credentials
39
- const locallyStoredCredentials = localStorage.getItem(localStorageKey);
40
+ async start(): Promise<AuthResult> {
41
+ // Check local storage for credentials
42
+ const locallyStoredCredentials = localStorage.getItem(localStorageKey);
40
43
 
41
- if (locallyStoredCredentials) {
42
- try {
43
- const credentials = JSON.parse(
44
- locallyStoredCredentials,
45
- ) as Credentials;
46
- return {
47
- type: "existing",
48
- credentials,
49
- saveCredentials: async () => {}, // No need to save credentials when recovering from local storage
50
- onSuccess: () => {},
51
- onError: (error: string | Error) => {
52
- this.driver.onError(error);
53
- },
54
- logOut: () => {
55
- localStorage.removeItem(localStorageKey);
56
- void this.clerkClient.signOut();
57
- },
58
- };
59
- } catch (e) {
60
- console.error("Error parsing local storage credentials", e);
61
- }
62
- }
44
+ if (locallyStoredCredentials) {
45
+ try {
46
+ const credentials = JSON.parse(locallyStoredCredentials) as Credentials;
47
+ return {
48
+ type: "existing",
49
+ credentials,
50
+ saveCredentials: async () => {}, // No need to save credentials when recovering from local storage
51
+ onSuccess: () => {},
52
+ onError: (error: string | Error) => {
53
+ this.driver.onError(error);
54
+ },
55
+ logOut: () => {
56
+ localStorage.removeItem(localStorageKey);
57
+ void this.clerkClient.signOut();
58
+ },
59
+ };
60
+ } catch (e) {
61
+ console.error("Error parsing local storage credentials", e);
62
+ }
63
+ }
63
64
 
64
- if (this.clerkClient.user) {
65
- // Check clerk user metadata for credentials
66
- const storedCredentials = this.clerkClient.user.unsafeMetadata;
67
- if (storedCredentials.jazzAccountID) {
68
- if (!storedCredentials.jazzAccountSecret) {
69
- throw new Error("No secret for existing user");
70
- }
71
- return {
72
- type: "existing",
73
- credentials: {
74
- accountID:
75
- storedCredentials.jazzAccountID as ID<Account>,
76
- secret: storedCredentials.jazzAccountSecret as AgentSecret,
77
- },
78
- saveCredentials: async ({
79
- accountID,
80
- secret,
81
- }: Credentials) => {
82
- saveCredentialsToLocalStorage({
83
- accountID,
84
- secret,
85
- });
86
- },
87
- onSuccess: () => {},
88
- onError: (error: string | Error) => {
89
- this.driver.onError(error);
90
- },
91
- logOut: () => {
92
- void this.clerkClient.signOut();
93
- },
94
- };
95
- } else {
96
- // No credentials found, so we need to create new credentials
97
- return {
98
- type: "new",
99
- creationProps: {
100
- name:
101
- this.clerkClient.user.fullName ||
102
- this.clerkClient.user.username ||
103
- this.clerkClient.user.id,
104
- },
105
- saveCredentials: async ({
106
- accountID,
107
- secret,
108
- }: Credentials) => {
109
- saveCredentialsToLocalStorage({
110
- accountID,
111
- secret,
112
- });
113
- await this.clerkClient.user?.update({
114
- unsafeMetadata: {
115
- jazzAccountID: accountID,
116
- jazzAccountSecret: secret,
117
- },
118
- });
119
- },
120
- onSuccess: () => {},
121
- onError: (error: string | Error) => {
122
- this.driver.onError(error);
123
- },
124
- logOut: () => {
125
- void this.clerkClient.signOut();
126
- },
127
- };
128
- }
129
- } else {
130
- // Clerk user not found, so we can't authenticate
131
- throw new Error("Not signed in");
65
+ if (this.clerkClient.user) {
66
+ // Check clerk user metadata for credentials
67
+ const storedCredentials = this.clerkClient.user.unsafeMetadata;
68
+ if (storedCredentials.jazzAccountID) {
69
+ if (!storedCredentials.jazzAccountSecret) {
70
+ throw new Error("No secret for existing user");
132
71
  }
72
+ return {
73
+ type: "existing",
74
+ credentials: {
75
+ accountID: storedCredentials.jazzAccountID as ID<Account>,
76
+ secret: storedCredentials.jazzAccountSecret as AgentSecret,
77
+ },
78
+ saveCredentials: async ({ accountID, secret }: Credentials) => {
79
+ saveCredentialsToLocalStorage({
80
+ accountID,
81
+ secret,
82
+ });
83
+ },
84
+ onSuccess: () => {},
85
+ onError: (error: string | Error) => {
86
+ this.driver.onError(error);
87
+ },
88
+ logOut: () => {
89
+ void this.clerkClient.signOut();
90
+ },
91
+ };
92
+ } else {
93
+ // No credentials found, so we need to create new credentials
94
+ return {
95
+ type: "new",
96
+ creationProps: {
97
+ name:
98
+ this.clerkClient.user.fullName ||
99
+ this.clerkClient.user.username ||
100
+ this.clerkClient.user.id,
101
+ },
102
+ saveCredentials: async ({ accountID, secret }: Credentials) => {
103
+ saveCredentialsToLocalStorage({
104
+ accountID,
105
+ secret,
106
+ });
107
+ await this.clerkClient.user?.update({
108
+ unsafeMetadata: {
109
+ jazzAccountID: accountID,
110
+ jazzAccountSecret: secret,
111
+ },
112
+ });
113
+ },
114
+ onSuccess: () => {},
115
+ onError: (error: string | Error) => {
116
+ this.driver.onError(error);
117
+ },
118
+ logOut: () => {
119
+ void this.clerkClient.signOut();
120
+ },
121
+ };
122
+ }
123
+ } else {
124
+ // Clerk user not found, so we can't authenticate
125
+ throw new Error("Not signed in");
133
126
  }
127
+ }
134
128
  }
135
129
 
136
130
  // eslint-disable-next-line @typescript-eslint/no-namespace
137
131
  export namespace BrowserClerkAuth {
138
- export interface Driver {
139
- onError: (error: string | Error) => void;
140
- }
132
+ export interface Driver {
133
+ onError: (error: string | Error) => void;
134
+ }
141
135
  }
@@ -4,116 +4,116 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
4
4
  import { BrowserClerkAuth, MinimalClerkClient } from "../index.js";
5
5
 
6
6
  describe("BrowserClerkAuth", () => {
7
- let mockLocalStorage: { [key: string]: string };
8
- let mockClerkClient: MinimalClerkClient;
9
- let mockDriver: BrowserClerkAuth.Driver;
10
-
11
- beforeEach(() => {
12
- // Mock localStorage
13
- mockLocalStorage = {};
14
- global.localStorage = {
15
- getItem: vi.fn((key: string) => mockLocalStorage[key] || null),
16
- setItem: vi.fn((key: string, value: string) => {
17
- mockLocalStorage[key] = value;
18
- }),
19
- removeItem: vi.fn((key: string) => {
20
- delete mockLocalStorage[key];
21
- }),
22
- clear: vi.fn(),
23
- length: 0,
24
- key: vi.fn(),
25
- };
26
-
27
- // Mock Clerk client
28
- mockClerkClient = {
29
- user: {
30
- unsafeMetadata: {},
31
- fullName: "Test User",
32
- username: "testuser",
33
- id: "test-id",
34
- update: vi.fn(),
35
- },
36
- signOut: vi.fn(),
37
- };
38
-
39
- // Mock driver
40
- mockDriver = {
41
- onError: vi.fn(),
42
- };
7
+ let mockLocalStorage: { [key: string]: string };
8
+ let mockClerkClient: MinimalClerkClient;
9
+ let mockDriver: BrowserClerkAuth.Driver;
10
+
11
+ beforeEach(() => {
12
+ // Mock localStorage
13
+ mockLocalStorage = {};
14
+ global.localStorage = {
15
+ getItem: vi.fn((key: string) => mockLocalStorage[key] || null),
16
+ setItem: vi.fn((key: string, value: string) => {
17
+ mockLocalStorage[key] = value;
18
+ }),
19
+ removeItem: vi.fn((key: string) => {
20
+ delete mockLocalStorage[key];
21
+ }),
22
+ clear: vi.fn(),
23
+ length: 0,
24
+ key: vi.fn(),
25
+ };
26
+
27
+ // Mock Clerk client
28
+ mockClerkClient = {
29
+ user: {
30
+ unsafeMetadata: {},
31
+ fullName: "Test User",
32
+ username: "testuser",
33
+ id: "test-id",
34
+ update: vi.fn(),
35
+ },
36
+ signOut: vi.fn(),
37
+ };
38
+
39
+ // Mock driver
40
+ mockDriver = {
41
+ onError: vi.fn(),
42
+ };
43
+ });
44
+
45
+ describe("clerk credentials in localStorage", () => {
46
+ it("should get credentials from localStorage when clerk user is not signed in", async () => {
47
+ mockLocalStorage["jazz-clerk-auth"] = JSON.stringify({
48
+ accountID: "test-account-id",
49
+ accountSecret: "test-secret",
50
+ });
51
+
52
+ const auth = new BrowserClerkAuth(mockDriver, {
53
+ ...mockClerkClient,
54
+ user: null,
55
+ });
56
+
57
+ const result = await auth.start();
58
+ expect(result.type).toBe("existing");
43
59
  });
60
+ });
44
61
 
45
- describe("clerk credentials in localStorage", () => {
46
- it("should get credentials from localStorage when clerk user is not signed in", async () => {
47
- mockLocalStorage["jazz-clerk-auth"] = JSON.stringify({
48
- accountID: "test-account-id",
49
- accountSecret: "test-secret",
50
- });
51
-
52
- const auth = new BrowserClerkAuth(mockDriver, {
53
- ...mockClerkClient,
54
- user: null,
55
- });
56
-
57
- const result = await auth.start();
58
- expect(result.type).toBe("existing");
59
- });
62
+ describe("clerk credentials not in localStorage", () => {
63
+ it("should return new credentials when clerk user signs up", async () => {
64
+ const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
65
+ const result = await auth.start();
66
+ expect(result.type).toBe("new");
60
67
  });
61
68
 
62
- describe("clerk credentials not in localStorage", () => {
63
- it("should return new credentials when clerk user signs up", async () => {
64
- const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
65
- const result = await auth.start();
66
- expect(result.type).toBe("new");
67
- });
69
+ it("should return existing credentials when clerk user is signed in", async () => {
70
+ mockClerkClient = {
71
+ user: {
72
+ unsafeMetadata: {
73
+ jazzAccountID: "test-account-id",
74
+ jazzAccountSecret: "test-secret",
75
+ },
76
+ fullName: "Test User",
77
+ username: "testuser",
78
+ id: "test-id",
79
+ update: vi.fn(),
80
+ },
81
+ signOut: vi.fn(),
82
+ };
83
+
84
+ const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
85
+ const result = await auth.start();
86
+ expect(result.type).toBe("existing");
87
+ });
68
88
 
69
- it("should return existing credentials when clerk user is signed in", async () => {
70
- mockClerkClient = {
71
- user: {
72
- unsafeMetadata: {
73
- jazzAccountID: "test-account-id",
74
- jazzAccountSecret: "test-secret",
75
- },
76
- fullName: "Test User",
77
- username: "testuser",
78
- id: "test-id",
79
- update: vi.fn(),
80
- },
81
- signOut: vi.fn(),
82
- };
83
-
84
- const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
85
- const result = await auth.start();
86
- expect(result.type).toBe("existing");
87
- });
89
+ it("should throw error when not signed in", async () => {
90
+ const auth = new BrowserClerkAuth(mockDriver, {
91
+ ...mockClerkClient,
92
+ user: null,
93
+ });
88
94
 
89
- it("should throw error when not signed in", async () => {
90
- const auth = new BrowserClerkAuth(mockDriver, {
91
- ...mockClerkClient,
92
- user: null,
93
- });
95
+ await expect(auth.start()).rejects.toThrow("Not signed in");
96
+ });
94
97
 
95
- await expect(auth.start()).rejects.toThrow("Not signed in");
98
+ it("should save credentials to localStorage", async () => {
99
+ const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
100
+ const result = await auth.start();
101
+ if (result.saveCredentials) {
102
+ await result.saveCredentials({
103
+ accountID: "test-account-id" as ID<Account>,
104
+ secret: "test-secret" as AgentSecret,
96
105
  });
106
+ }
97
107
 
98
- it("should save credentials to localStorage", async () => {
99
- const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
100
- const result = await auth.start();
101
- if (result.saveCredentials) {
102
- await result.saveCredentials({
103
- accountID: "test-account-id" as ID<Account>,
104
- secret: "test-secret" as AgentSecret,
105
- });
106
- }
107
-
108
- expect(mockLocalStorage["jazz-clerk-auth"]).toBeDefined();
109
- });
108
+ expect(mockLocalStorage["jazz-clerk-auth"]).toBeDefined();
109
+ });
110
110
 
111
- it("should call clerk signOut when logging out", async () => {
112
- const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
113
- const result = await auth.start();
114
- result.logOut();
111
+ it("should call clerk signOut when logging out", async () => {
112
+ const auth = new BrowserClerkAuth(mockDriver, mockClerkClient);
113
+ const result = await auth.start();
114
+ result.logOut();
115
115
 
116
- expect(mockClerkClient.signOut).toHaveBeenCalled();
117
- });
116
+ expect(mockClerkClient.signOut).toHaveBeenCalled();
118
117
  });
118
+ });
119
119
  });
package/tsconfig.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "jsx": "react",
11
11
  "forceConsistentCasingInFileNames": true,
12
12
  "noUncheckedIndexedAccess": true,
13
- "esModuleInterop": true,
13
+ "esModuleInterop": true
14
14
  },
15
- "include": ["./src/**/*"],
15
+ "include": ["./src/**/*"]
16
16
  }
package/.eslintrc.cjs DELETED
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- "eslint:recommended",
4
- "plugin:@typescript-eslint/recommended",
5
- "plugin:require-extensions/recommended",
6
- "prettier"
7
- ],
8
- parser: "@typescript-eslint/parser",
9
- plugins: ["@typescript-eslint", "require-extensions"],
10
- parserOptions: {
11
- project: "./tsconfig.json",
12
- tsconfigRootDir: __dirname,
13
- },
14
- ignorePatterns: [".eslint.cjs"],
15
- root: true,
16
- rules: {
17
- "no-unused-vars": "off",
18
- "@typescript-eslint/no-unused-vars": [
19
- "error",
20
- { argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
21
- ],
22
- "@typescript-eslint/no-floating-promises": "error",
23
- },
24
- }
package/.prettierrc.js DELETED
@@ -1,9 +0,0 @@
1
- /** @type {import("prettier").Config} */
2
- const config = {
3
- trailingComma: "all",
4
- tabWidth: 4,
5
- semi: true,
6
- singleQuote: false,
7
- };
8
-
9
- export default config;