@zodic/shared 0.0.95 → 0.0.97

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.
@@ -50,6 +50,13 @@
50
50
  "when": 1738195592204,
51
51
  "tag": "0006_thankful_chimera",
52
52
  "breakpoints": true
53
+ },
54
+ {
55
+ "idx": 7,
56
+ "version": "6",
57
+ "when": 1738679864680,
58
+ "tag": "0007_quick_red_shift",
59
+ "breakpoints": true
53
60
  }
54
61
  ]
55
62
  }
package/db/schema.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  real,
6
6
  sqliteTable,
7
7
  text,
8
+ unique,
8
9
  } from 'drizzle-orm/sqlite-core';
9
10
 
10
11
  export const timestampFields = {
@@ -58,10 +59,13 @@ export const usersTemp = sqliteTable(
58
59
  name: text('name').notNull(),
59
60
  profileImage: text('profile_image'),
60
61
  oauthProvider: text('oauth_provider'), // e.g., "google", "facebook", "apple", nullable for password-based login
61
- oauthProviderId: text('oauth_provider_id').unique(), // Unique identifier from the provider
62
+ oauthProviderId: text('oauth_provider_id'), // Remove .unique()
62
63
  ...timestampFields,
63
64
  },
64
- (t) => [index('users_temp_email_idx').on(t.email)]
65
+ (t) => [
66
+ index('users_temp_email_idx').on(t.email),
67
+ unique().on(t.oauthProvider, t.oauthProviderId),
68
+ ]
65
69
  );
66
70
 
67
71
  export const creditsTransactions = sqliteTable(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.95",
3
+ "version": "0.0.97",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -281,4 +281,5 @@ export interface SignupBody {
281
281
  longitude: number;
282
282
  birthDate: string; // Expected format: "YYYY-MM-DD"
283
283
  birthTime?: string | null; // Optional, format: "HH:mm" or null
284
- }
284
+ }
285
+
package/utils/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jwtVerify } from 'jose';
2
- import { AuthCtx, Gender, Provider, ProviderInfo, VALID_GENDERS_ARRAY } from '../types';
2
+ import { AuthCtx, Gender, VALID_GENDERS_ARRAY } from '../types';
3
3
 
4
4
  export const verifyToken = async (
5
5
  c: AuthCtx,
@@ -32,20 +32,18 @@ export const verifyToken = async (
32
32
  }
33
33
  };
34
34
 
35
- export const providers: (c: AuthCtx) => Record<Provider, ProviderInfo> = (
36
- c
37
- ) => ({
35
+ export const providers = (c: AuthCtx) => ({
38
36
  google: {
39
- serverUrl: c.env.GOOGLE_SERVER_URL,
40
- clientId: c.env.GOOGLE_CLIENT_ID,
41
- clientSecret: c.env.GOOGLE_CLIENT_SECRET,
42
- resourceUrl: '',
37
+ serverUrl: 'https://accounts.google.com',
38
+ clientId: c.env.GOOGLE_OAUTH_CLIENT_ID,
39
+ clientSecret: c.env.GOOGLE_OAUTH_CLIENT_SECRET,
40
+ resourceUrl: 'https://www.googleapis.com/oauth2/v2/userinfo',
43
41
  },
44
42
  facebook: {
45
- serverUrl: c.env.FACEBOOK_SERVER_URL,
46
- clientId: c.env.FACEBOOK_CLIENT_ID,
47
- clientSecret: c.env.FACEBOOK_CLIENT_SECRET,
48
- resourceUrl: '',
43
+ serverUrl: 'https://www.facebook.com/v11.0/dialog/oauth',
44
+ clientId: c.env.FACEBOOK_OAUTH_CLIENT_ID,
45
+ clientSecret: c.env.FACEBOOK_OAUTH_CLIENT_SECRET,
46
+ resourceUrl: 'https://graph.facebook.com/me?fields=id,name,email,picture',
49
47
  },
50
48
  });
51
49