@contentgrowth/content-auth 0.4.7 → 0.4.8

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.
@@ -72,6 +72,25 @@ declare const createUsersTable: (tableName?: string, fields?: Record<string, str
72
72
  [x: number]: any;
73
73
  [x: symbol]: any;
74
74
  }>;
75
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
76
+ name: string;
77
+ tableName: string;
78
+ dataType: "string";
79
+ columnType: "SQLiteText";
80
+ data: string;
81
+ driverParam: string;
82
+ notNull: true;
83
+ hasDefault: false;
84
+ isPrimaryKey: true;
85
+ isAutoincrement: false;
86
+ hasRuntimeDefault: false;
87
+ enumValues: [string, ...string[]];
88
+ baseColumn: never;
89
+ identity: undefined;
90
+ generated: undefined;
91
+ }, {}, {
92
+ length: number | undefined;
93
+ }>;
75
94
  name: drizzle_orm_sqlite_core.SQLiteColumn<{
76
95
  name: string;
77
96
  tableName: string;
@@ -91,6 +110,42 @@ declare const createUsersTable: (tableName?: string, fields?: Record<string, str
91
110
  }, {}, {
92
111
  length: number | undefined;
93
112
  }>;
113
+ email: drizzle_orm_sqlite_core.SQLiteColumn<{
114
+ name: string;
115
+ tableName: string;
116
+ dataType: "string";
117
+ columnType: "SQLiteText";
118
+ data: string;
119
+ driverParam: string;
120
+ notNull: true;
121
+ hasDefault: false;
122
+ isPrimaryKey: false;
123
+ isAutoincrement: false;
124
+ hasRuntimeDefault: false;
125
+ enumValues: [string, ...string[]];
126
+ baseColumn: never;
127
+ identity: undefined;
128
+ generated: undefined;
129
+ }, {}, {
130
+ length: number | undefined;
131
+ }>;
132
+ emailVerified: drizzle_orm_sqlite_core.SQLiteColumn<{
133
+ name: string;
134
+ tableName: string;
135
+ dataType: "boolean";
136
+ columnType: "SQLiteBoolean";
137
+ data: boolean;
138
+ driverParam: number;
139
+ notNull: true;
140
+ hasDefault: false;
141
+ isPrimaryKey: false;
142
+ isAutoincrement: false;
143
+ hasRuntimeDefault: false;
144
+ enumValues: undefined;
145
+ baseColumn: never;
146
+ identity: undefined;
147
+ generated: undefined;
148
+ }, {}, {}>;
94
149
  image: drizzle_orm_sqlite_core.SQLiteColumn<{
95
150
  name: string;
96
151
  tableName: string;
@@ -110,6 +165,40 @@ declare const createUsersTable: (tableName?: string, fields?: Record<string, str
110
165
  }, {}, {
111
166
  length: number | undefined;
112
167
  }>;
168
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
169
+ name: string;
170
+ tableName: string;
171
+ dataType: "date";
172
+ columnType: "SQLiteTimestamp";
173
+ data: Date;
174
+ driverParam: number;
175
+ notNull: true;
176
+ hasDefault: false;
177
+ isPrimaryKey: false;
178
+ isAutoincrement: false;
179
+ hasRuntimeDefault: false;
180
+ enumValues: undefined;
181
+ baseColumn: never;
182
+ identity: undefined;
183
+ generated: undefined;
184
+ }, {}, {}>;
185
+ updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
186
+ name: string;
187
+ tableName: string;
188
+ dataType: "date";
189
+ columnType: "SQLiteTimestamp";
190
+ data: Date;
191
+ driverParam: number;
192
+ notNull: true;
193
+ hasDefault: false;
194
+ isPrimaryKey: false;
195
+ isAutoincrement: false;
196
+ hasRuntimeDefault: false;
197
+ enumValues: undefined;
198
+ baseColumn: never;
199
+ identity: undefined;
200
+ generated: undefined;
201
+ }, {}, {}>;
113
202
  };
114
203
  dialect: "sqlite";
115
204
  }>;
@@ -138,6 +227,25 @@ declare const createSessionsTable: (tableName?: string, usersTableOrFn?: any, fi
138
227
  [x: number]: any;
139
228
  [x: symbol]: any;
140
229
  }>;
230
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
231
+ name: string;
232
+ tableName: string;
233
+ dataType: "string";
234
+ columnType: "SQLiteText";
235
+ data: string;
236
+ driverParam: string;
237
+ notNull: true;
238
+ hasDefault: false;
239
+ isPrimaryKey: true;
240
+ isAutoincrement: false;
241
+ hasRuntimeDefault: false;
242
+ enumValues: [string, ...string[]];
243
+ baseColumn: never;
244
+ identity: undefined;
245
+ generated: undefined;
246
+ }, {}, {
247
+ length: number | undefined;
248
+ }>;
141
249
  expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
142
250
  name: string;
143
251
  tableName: string;
@@ -312,6 +420,25 @@ declare const createAccountsTable: (tableName?: string, usersTableOrFn?: any, fi
312
420
  [x: number]: any;
313
421
  [x: symbol]: any;
314
422
  }>;
423
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
424
+ name: string;
425
+ tableName: string;
426
+ dataType: "string";
427
+ columnType: "SQLiteText";
428
+ data: string;
429
+ driverParam: string;
430
+ notNull: true;
431
+ hasDefault: false;
432
+ isPrimaryKey: true;
433
+ isAutoincrement: false;
434
+ hasRuntimeDefault: false;
435
+ enumValues: [string, ...string[]];
436
+ baseColumn: never;
437
+ identity: undefined;
438
+ generated: undefined;
439
+ }, {}, {
440
+ length: number | undefined;
441
+ }>;
315
442
  accountId: drizzle_orm_sqlite_core.SQLiteColumn<{
316
443
  name: string;
317
444
  tableName: string;
@@ -560,6 +687,25 @@ declare const createVerificationsTable: (tableName?: string, fields?: Record<str
560
687
  [x: number]: any;
561
688
  [x: symbol]: any;
562
689
  }>;
690
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
691
+ name: string;
692
+ tableName: string;
693
+ dataType: "string";
694
+ columnType: "SQLiteText";
695
+ data: string;
696
+ driverParam: string;
697
+ notNull: true;
698
+ hasDefault: false;
699
+ isPrimaryKey: true;
700
+ isAutoincrement: false;
701
+ hasRuntimeDefault: false;
702
+ enumValues: [string, ...string[]];
703
+ baseColumn: never;
704
+ identity: undefined;
705
+ generated: undefined;
706
+ }, {}, {
707
+ length: number | undefined;
708
+ }>;
563
709
  identifier: drizzle_orm_sqlite_core.SQLiteColumn<{
564
710
  name: string;
565
711
  tableName: string;
@@ -677,6 +823,25 @@ declare const createOrganizationsTable: (tableName?: string, fields?: Record<str
677
823
  [x: number]: any;
678
824
  [x: symbol]: any;
679
825
  }>;
826
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
827
+ name: string;
828
+ tableName: string;
829
+ dataType: "string";
830
+ columnType: "SQLiteText";
831
+ data: string;
832
+ driverParam: string;
833
+ notNull: true;
834
+ hasDefault: false;
835
+ isPrimaryKey: true;
836
+ isAutoincrement: false;
837
+ hasRuntimeDefault: false;
838
+ enumValues: [string, ...string[]];
839
+ baseColumn: never;
840
+ identity: undefined;
841
+ generated: undefined;
842
+ }, {}, {
843
+ length: number | undefined;
844
+ }>;
680
845
  name: drizzle_orm_sqlite_core.SQLiteColumn<{
681
846
  name: string;
682
847
  tableName: string;
@@ -798,6 +963,25 @@ declare const createMembersTable: (tableName?: string, organizationsTableOrFn?:
798
963
  [x: number]: any;
799
964
  [x: symbol]: any;
800
965
  }>;
966
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
967
+ name: string;
968
+ tableName: string;
969
+ dataType: "string";
970
+ columnType: "SQLiteText";
971
+ data: string;
972
+ driverParam: string;
973
+ notNull: true;
974
+ hasDefault: false;
975
+ isPrimaryKey: true;
976
+ isAutoincrement: false;
977
+ hasRuntimeDefault: false;
978
+ enumValues: [string, ...string[]];
979
+ baseColumn: never;
980
+ identity: undefined;
981
+ generated: undefined;
982
+ }, {}, {
983
+ length: number | undefined;
984
+ }>;
801
985
  organizationId: drizzle_orm_sqlite_core.SQLiteColumn<{
802
986
  name: string;
803
987
  tableName: string;
@@ -900,6 +1084,25 @@ declare const createInvitationsTable: (tableName?: string, organizationsTableOrF
900
1084
  [x: number]: any;
901
1085
  [x: symbol]: any;
902
1086
  }>;
1087
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
1088
+ name: string;
1089
+ tableName: string;
1090
+ dataType: "string";
1091
+ columnType: "SQLiteText";
1092
+ data: string;
1093
+ driverParam: string;
1094
+ notNull: true;
1095
+ hasDefault: false;
1096
+ isPrimaryKey: true;
1097
+ isAutoincrement: false;
1098
+ hasRuntimeDefault: false;
1099
+ enumValues: [string, ...string[]];
1100
+ baseColumn: never;
1101
+ identity: undefined;
1102
+ generated: undefined;
1103
+ }, {}, {
1104
+ length: number | undefined;
1105
+ }>;
903
1106
  organizationId: drizzle_orm_sqlite_core.SQLiteColumn<{
904
1107
  name: string;
905
1108
  tableName: string;
@@ -1057,6 +1260,25 @@ declare const users: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1057
1260
  [x: number]: any;
1058
1261
  [x: symbol]: any;
1059
1262
  }>;
1263
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
1264
+ name: string;
1265
+ tableName: string;
1266
+ dataType: "string";
1267
+ columnType: "SQLiteText";
1268
+ data: string;
1269
+ driverParam: string;
1270
+ notNull: true;
1271
+ hasDefault: false;
1272
+ isPrimaryKey: true;
1273
+ isAutoincrement: false;
1274
+ hasRuntimeDefault: false;
1275
+ enumValues: [string, ...string[]];
1276
+ baseColumn: never;
1277
+ identity: undefined;
1278
+ generated: undefined;
1279
+ }, {}, {
1280
+ length: number | undefined;
1281
+ }>;
1060
1282
  name: drizzle_orm_sqlite_core.SQLiteColumn<{
1061
1283
  name: string;
1062
1284
  tableName: string;
@@ -1076,6 +1298,42 @@ declare const users: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1076
1298
  }, {}, {
1077
1299
  length: number | undefined;
1078
1300
  }>;
1301
+ email: drizzle_orm_sqlite_core.SQLiteColumn<{
1302
+ name: string;
1303
+ tableName: string;
1304
+ dataType: "string";
1305
+ columnType: "SQLiteText";
1306
+ data: string;
1307
+ driverParam: string;
1308
+ notNull: true;
1309
+ hasDefault: false;
1310
+ isPrimaryKey: false;
1311
+ isAutoincrement: false;
1312
+ hasRuntimeDefault: false;
1313
+ enumValues: [string, ...string[]];
1314
+ baseColumn: never;
1315
+ identity: undefined;
1316
+ generated: undefined;
1317
+ }, {}, {
1318
+ length: number | undefined;
1319
+ }>;
1320
+ emailVerified: drizzle_orm_sqlite_core.SQLiteColumn<{
1321
+ name: string;
1322
+ tableName: string;
1323
+ dataType: "boolean";
1324
+ columnType: "SQLiteBoolean";
1325
+ data: boolean;
1326
+ driverParam: number;
1327
+ notNull: true;
1328
+ hasDefault: false;
1329
+ isPrimaryKey: false;
1330
+ isAutoincrement: false;
1331
+ hasRuntimeDefault: false;
1332
+ enumValues: undefined;
1333
+ baseColumn: never;
1334
+ identity: undefined;
1335
+ generated: undefined;
1336
+ }, {}, {}>;
1079
1337
  image: drizzle_orm_sqlite_core.SQLiteColumn<{
1080
1338
  name: string;
1081
1339
  tableName: string;
@@ -1095,6 +1353,40 @@ declare const users: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1095
1353
  }, {}, {
1096
1354
  length: number | undefined;
1097
1355
  }>;
1356
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1357
+ name: string;
1358
+ tableName: string;
1359
+ dataType: "date";
1360
+ columnType: "SQLiteTimestamp";
1361
+ data: Date;
1362
+ driverParam: number;
1363
+ notNull: true;
1364
+ hasDefault: false;
1365
+ isPrimaryKey: false;
1366
+ isAutoincrement: false;
1367
+ hasRuntimeDefault: false;
1368
+ enumValues: undefined;
1369
+ baseColumn: never;
1370
+ identity: undefined;
1371
+ generated: undefined;
1372
+ }, {}, {}>;
1373
+ updatedAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1374
+ name: string;
1375
+ tableName: string;
1376
+ dataType: "date";
1377
+ columnType: "SQLiteTimestamp";
1378
+ data: Date;
1379
+ driverParam: number;
1380
+ notNull: true;
1381
+ hasDefault: false;
1382
+ isPrimaryKey: false;
1383
+ isAutoincrement: false;
1384
+ hasRuntimeDefault: false;
1385
+ enumValues: undefined;
1386
+ baseColumn: never;
1387
+ identity: undefined;
1388
+ generated: undefined;
1389
+ }, {}, {}>;
1098
1390
  };
1099
1391
  dialect: "sqlite";
1100
1392
  }>;
@@ -1123,6 +1415,25 @@ declare const organizations: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1123
1415
  [x: number]: any;
1124
1416
  [x: symbol]: any;
1125
1417
  }>;
1418
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
1419
+ name: string;
1420
+ tableName: string;
1421
+ dataType: "string";
1422
+ columnType: "SQLiteText";
1423
+ data: string;
1424
+ driverParam: string;
1425
+ notNull: true;
1426
+ hasDefault: false;
1427
+ isPrimaryKey: true;
1428
+ isAutoincrement: false;
1429
+ hasRuntimeDefault: false;
1430
+ enumValues: [string, ...string[]];
1431
+ baseColumn: never;
1432
+ identity: undefined;
1433
+ generated: undefined;
1434
+ }, {}, {
1435
+ length: number | undefined;
1436
+ }>;
1126
1437
  name: drizzle_orm_sqlite_core.SQLiteColumn<{
1127
1438
  name: string;
1128
1439
  tableName: string;
@@ -1244,6 +1555,25 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1244
1555
  [x: number]: any;
1245
1556
  [x: symbol]: any;
1246
1557
  }>;
1558
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
1559
+ name: string;
1560
+ tableName: string;
1561
+ dataType: "string";
1562
+ columnType: "SQLiteText";
1563
+ data: string;
1564
+ driverParam: string;
1565
+ notNull: true;
1566
+ hasDefault: false;
1567
+ isPrimaryKey: true;
1568
+ isAutoincrement: false;
1569
+ hasRuntimeDefault: false;
1570
+ enumValues: [string, ...string[]];
1571
+ baseColumn: never;
1572
+ identity: undefined;
1573
+ generated: undefined;
1574
+ }, {}, {
1575
+ length: number | undefined;
1576
+ }>;
1247
1577
  expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
1248
1578
  name: string;
1249
1579
  tableName: string;
@@ -1418,6 +1748,25 @@ declare const accounts: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1418
1748
  [x: number]: any;
1419
1749
  [x: symbol]: any;
1420
1750
  }>;
1751
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
1752
+ name: string;
1753
+ tableName: string;
1754
+ dataType: "string";
1755
+ columnType: "SQLiteText";
1756
+ data: string;
1757
+ driverParam: string;
1758
+ notNull: true;
1759
+ hasDefault: false;
1760
+ isPrimaryKey: true;
1761
+ isAutoincrement: false;
1762
+ hasRuntimeDefault: false;
1763
+ enumValues: [string, ...string[]];
1764
+ baseColumn: never;
1765
+ identity: undefined;
1766
+ generated: undefined;
1767
+ }, {}, {
1768
+ length: number | undefined;
1769
+ }>;
1421
1770
  accountId: drizzle_orm_sqlite_core.SQLiteColumn<{
1422
1771
  name: string;
1423
1772
  tableName: string;
@@ -1666,6 +2015,25 @@ declare const verifications: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1666
2015
  [x: number]: any;
1667
2016
  [x: symbol]: any;
1668
2017
  }>;
2018
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
2019
+ name: string;
2020
+ tableName: string;
2021
+ dataType: "string";
2022
+ columnType: "SQLiteText";
2023
+ data: string;
2024
+ driverParam: string;
2025
+ notNull: true;
2026
+ hasDefault: false;
2027
+ isPrimaryKey: true;
2028
+ isAutoincrement: false;
2029
+ hasRuntimeDefault: false;
2030
+ enumValues: [string, ...string[]];
2031
+ baseColumn: never;
2032
+ identity: undefined;
2033
+ generated: undefined;
2034
+ }, {}, {
2035
+ length: number | undefined;
2036
+ }>;
1669
2037
  identifier: drizzle_orm_sqlite_core.SQLiteColumn<{
1670
2038
  name: string;
1671
2039
  tableName: string;
@@ -1783,6 +2151,25 @@ declare const members: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1783
2151
  [x: number]: any;
1784
2152
  [x: symbol]: any;
1785
2153
  }>;
2154
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
2155
+ name: string;
2156
+ tableName: string;
2157
+ dataType: "string";
2158
+ columnType: "SQLiteText";
2159
+ data: string;
2160
+ driverParam: string;
2161
+ notNull: true;
2162
+ hasDefault: false;
2163
+ isPrimaryKey: true;
2164
+ isAutoincrement: false;
2165
+ hasRuntimeDefault: false;
2166
+ enumValues: [string, ...string[]];
2167
+ baseColumn: never;
2168
+ identity: undefined;
2169
+ generated: undefined;
2170
+ }, {}, {
2171
+ length: number | undefined;
2172
+ }>;
1786
2173
  organizationId: drizzle_orm_sqlite_core.SQLiteColumn<{
1787
2174
  name: string;
1788
2175
  tableName: string;
@@ -1885,6 +2272,25 @@ declare const invitations: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
1885
2272
  [x: number]: any;
1886
2273
  [x: symbol]: any;
1887
2274
  }>;
2275
+ id: drizzle_orm_sqlite_core.SQLiteColumn<{
2276
+ name: string;
2277
+ tableName: string;
2278
+ dataType: "string";
2279
+ columnType: "SQLiteText";
2280
+ data: string;
2281
+ driverParam: string;
2282
+ notNull: true;
2283
+ hasDefault: false;
2284
+ isPrimaryKey: true;
2285
+ isAutoincrement: false;
2286
+ hasRuntimeDefault: false;
2287
+ enumValues: [string, ...string[]];
2288
+ baseColumn: never;
2289
+ identity: undefined;
2290
+ generated: undefined;
2291
+ }, {}, {
2292
+ length: number | undefined;
2293
+ }>;
1888
2294
  organizationId: drizzle_orm_sqlite_core.SQLiteColumn<{
1889
2295
  name: string;
1890
2296
  tableName: string;
@@ -9,7 +9,7 @@ import {
9
9
  normalizeEmail,
10
10
  schema_exports,
11
11
  verifyTurnstile
12
- } from "../chunk-SGGYHP5S.js";
12
+ } from "../chunk-WI4UHTAT.js";
13
13
  import "../chunk-R5U7XKVJ.js";
14
14
  export {
15
15
  Hono,
@@ -147,93 +147,206 @@ var createAdditionalColumns = (additionalFields) => {
147
147
  });
148
148
  return columns;
149
149
  };
150
- var createUsersTable = (tableName = "users", fields, additionalFields) => sqliteTable(tableName, {
151
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
152
- name: text(fields?.name || "name").notNull(),
153
- [fields?.email || "email"]: text(fields?.email || "email").notNull().unique(),
154
- [fields?.emailVerified || "emailVerified"]: integer(fields?.emailVerified || "emailVerified", { mode: "boolean" }).notNull(),
155
- image: text(fields?.image || "image"),
156
- [fields?.createdAt || "createdAt"]: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
157
- [fields?.updatedAt || "updatedAt"]: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull(),
158
- ...createAdditionalColumns(additionalFields)
159
- });
150
+ var createUsersTable = (tableName = "users", fields, additionalFields) => {
151
+ const idCol = text(fields?.id || "id").primaryKey();
152
+ const nameCol = text(fields?.name || "name").notNull();
153
+ const emailCol = text(fields?.email || "email").notNull().unique();
154
+ const emailVerifiedCol = integer(fields?.emailVerified || "emailVerified", { mode: "boolean" }).notNull();
155
+ const imageCol = text(fields?.image || "image");
156
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
157
+ const updatedAtCol = integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull();
158
+ return sqliteTable(tableName, {
159
+ id: idCol,
160
+ [fields?.id || "id"]: idCol,
161
+ name: nameCol,
162
+ [fields?.name || "name"]: nameCol,
163
+ email: emailCol,
164
+ [fields?.email || "email"]: emailCol,
165
+ emailVerified: emailVerifiedCol,
166
+ [fields?.emailVerified || "emailVerified"]: emailVerifiedCol,
167
+ image: imageCol,
168
+ [fields?.image || "image"]: imageCol,
169
+ createdAt: createdAtCol,
170
+ [fields?.createdAt || "createdAt"]: createdAtCol,
171
+ updatedAt: updatedAtCol,
172
+ [fields?.updatedAt || "updatedAt"]: updatedAtCol,
173
+ ...createAdditionalColumns(additionalFields)
174
+ });
175
+ };
160
176
  var createSessionsTable = (tableName = "sessions", usersTableOrFn = users, fields, userPkField = "id", additionalFields) => {
161
177
  const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
178
+ const idCol = text(fields?.id || "id").primaryKey();
179
+ const expiresAtCol = integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull();
180
+ const tokenCol = text(fields?.token || "token").notNull().unique();
181
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
182
+ const updatedAtCol = integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull();
183
+ const ipAddressCol = text(fields?.ipAddress || "ipAddress");
184
+ const userAgentCol = text(fields?.userAgent || "userAgent");
185
+ const userIdCol = text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
186
+ const activeOrganizationIdCol = text(fields?.activeOrganizationId || "activeOrganizationId");
162
187
  return sqliteTable(tableName, {
163
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
164
- expiresAt: integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull(),
165
- token: text(fields?.token || "token").notNull().unique(),
166
- createdAt: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
167
- updatedAt: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull(),
168
- ipAddress: text(fields?.ipAddress || "ipAddress"),
169
- userAgent: text(fields?.userAgent || "userAgent"),
170
- userId: text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField], { onDelete: "cascade" }),
171
- activeOrganizationId: text(fields?.activeOrganizationId || "activeOrganizationId"),
188
+ id: idCol,
189
+ [fields?.id || "id"]: idCol,
190
+ expiresAt: expiresAtCol,
191
+ [fields?.expiresAt || "expiresAt"]: expiresAtCol,
192
+ token: tokenCol,
193
+ [fields?.token || "token"]: tokenCol,
194
+ createdAt: createdAtCol,
195
+ [fields?.createdAt || "createdAt"]: createdAtCol,
196
+ updatedAt: updatedAtCol,
197
+ [fields?.updatedAt || "updatedAt"]: updatedAtCol,
198
+ ipAddress: ipAddressCol,
199
+ [fields?.ipAddress || "ipAddress"]: ipAddressCol,
200
+ userAgent: userAgentCol,
201
+ [fields?.userAgent || "userAgent"]: userAgentCol,
202
+ userId: userIdCol,
203
+ [fields?.userId || "userId"]: userIdCol,
204
+ activeOrganizationId: activeOrganizationIdCol,
205
+ [fields?.activeOrganizationId || "activeOrganizationId"]: activeOrganizationIdCol,
172
206
  ...createAdditionalColumns(additionalFields)
173
207
  });
174
208
  };
175
209
  var createAccountsTable = (tableName = "accounts", usersTableOrFn = users, fields, userPkField = "id", additionalFields) => {
176
210
  const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
211
+ const idCol = text(fields?.id || "id").primaryKey();
212
+ const accountIdCol = text(fields?.accountId || "accountId").notNull();
213
+ const providerIdCol = text(fields?.providerId || "providerId").notNull();
214
+ const userIdCol = text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
215
+ const accessTokenCol = text(fields?.accessToken || "accessToken");
216
+ const refreshTokenCol = text(fields?.refreshToken || "refreshToken");
217
+ const idTokenCol = text(fields?.idToken || "idToken");
218
+ const accessTokenExpiresAtCol = integer(fields?.accessTokenExpiresAt || "accessTokenExpiresAt", { mode: "timestamp" });
219
+ const refreshTokenExpiresAtCol = integer(fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt", { mode: "timestamp" });
220
+ const scopeCol = text(fields?.scope || "scope");
221
+ const passwordCol = text(fields?.password || "password");
222
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
223
+ const updatedAtCol = integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull();
177
224
  return sqliteTable(tableName, {
178
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
179
- accountId: text(fields?.accountId || "accountId").notNull(),
180
- providerId: text(fields?.providerId || "providerId").notNull(),
181
- userId: text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField], { onDelete: "cascade" }),
182
- accessToken: text(fields?.accessToken || "accessToken"),
183
- refreshToken: text(fields?.refreshToken || "refreshToken"),
184
- idToken: text(fields?.idToken || "idToken"),
185
- accessTokenExpiresAt: integer(fields?.accessTokenExpiresAt || "accessTokenExpiresAt", { mode: "timestamp" }),
186
- refreshTokenExpiresAt: integer(fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt", { mode: "timestamp" }),
187
- scope: text(fields?.scope || "scope"),
188
- password: text(fields?.password || "password"),
189
- createdAt: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
190
- updatedAt: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }).notNull(),
225
+ id: idCol,
226
+ [fields?.id || "id"]: idCol,
227
+ accountId: accountIdCol,
228
+ [fields?.accountId || "accountId"]: accountIdCol,
229
+ providerId: providerIdCol,
230
+ [fields?.providerId || "providerId"]: providerIdCol,
231
+ userId: userIdCol,
232
+ [fields?.userId || "userId"]: userIdCol,
233
+ accessToken: accessTokenCol,
234
+ [fields?.accessToken || "accessToken"]: accessTokenCol,
235
+ refreshToken: refreshTokenCol,
236
+ [fields?.refreshToken || "refreshToken"]: refreshTokenCol,
237
+ idToken: idTokenCol,
238
+ [fields?.idToken || "idToken"]: idTokenCol,
239
+ accessTokenExpiresAt: accessTokenExpiresAtCol,
240
+ [fields?.accessTokenExpiresAt || "accessTokenExpiresAt"]: accessTokenExpiresAtCol,
241
+ refreshTokenExpiresAt: refreshTokenExpiresAtCol,
242
+ [fields?.refreshTokenExpiresAt || "refreshTokenExpiresAt"]: refreshTokenExpiresAtCol,
243
+ scope: scopeCol,
244
+ [fields?.scope || "scope"]: scopeCol,
245
+ password: passwordCol,
246
+ [fields?.password || "password"]: passwordCol,
247
+ createdAt: createdAtCol,
248
+ [fields?.createdAt || "createdAt"]: createdAtCol,
249
+ updatedAt: updatedAtCol,
250
+ [fields?.updatedAt || "updatedAt"]: updatedAtCol,
251
+ ...createAdditionalColumns(additionalFields)
252
+ });
253
+ };
254
+ var createVerificationsTable = (tableName = "verifications", fields, additionalFields) => {
255
+ const idCol = text(fields?.id || "id").primaryKey();
256
+ const identifierCol = text(fields?.identifier || "identifier").notNull();
257
+ const valueCol = text(fields?.value || "value").notNull();
258
+ const expiresAtCol = integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull();
259
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" });
260
+ const updatedAtCol = integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" });
261
+ return sqliteTable(tableName, {
262
+ id: idCol,
263
+ [fields?.id || "id"]: idCol,
264
+ identifier: identifierCol,
265
+ [fields?.identifier || "identifier"]: identifierCol,
266
+ value: valueCol,
267
+ [fields?.value || "value"]: valueCol,
268
+ expiresAt: expiresAtCol,
269
+ [fields?.expiresAt || "expiresAt"]: expiresAtCol,
270
+ createdAt: createdAtCol,
271
+ [fields?.createdAt || "createdAt"]: createdAtCol,
272
+ updatedAt: updatedAtCol,
273
+ [fields?.updatedAt || "updatedAt"]: updatedAtCol,
274
+ ...createAdditionalColumns(additionalFields)
275
+ });
276
+ };
277
+ var createOrganizationsTable = (tableName = "organizations", fields, additionalFields) => {
278
+ const idCol = text(fields?.id || "id").primaryKey();
279
+ const nameCol = text(fields?.name || "name").notNull();
280
+ const slugCol = text(fields?.slug || "slug").unique();
281
+ const logoCol = text(fields?.logo || "logo");
282
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
283
+ const metadataCol = text(fields?.metadata || "metadata");
284
+ return sqliteTable(tableName, {
285
+ id: idCol,
286
+ [fields?.id || "id"]: idCol,
287
+ name: nameCol,
288
+ [fields?.name || "name"]: nameCol,
289
+ slug: slugCol,
290
+ [fields?.slug || "slug"]: slugCol,
291
+ logo: logoCol,
292
+ [fields?.logo || "logo"]: logoCol,
293
+ createdAt: createdAtCol,
294
+ [fields?.createdAt || "createdAt"]: createdAtCol,
295
+ metadata: metadataCol,
296
+ [fields?.metadata || "metadata"]: metadataCol,
191
297
  ...createAdditionalColumns(additionalFields)
192
298
  });
193
299
  };
194
- var createVerificationsTable = (tableName = "verifications", fields, additionalFields) => sqliteTable(tableName, {
195
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
196
- identifier: text(fields?.identifier || "identifier").notNull(),
197
- value: text(fields?.value || "value").notNull(),
198
- expiresAt: integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull(),
199
- createdAt: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }),
200
- updatedAt: integer(fields?.updatedAt || "updatedAt", { mode: "timestamp" }),
201
- ...createAdditionalColumns(additionalFields)
202
- });
203
- var createOrganizationsTable = (tableName = "organizations", fields, additionalFields) => sqliteTable(tableName, {
204
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
205
- name: text(fields?.name || "name").notNull(),
206
- slug: text(fields?.slug || "slug").unique(),
207
- logo: text(fields?.logo || "logo"),
208
- createdAt: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
209
- metadata: text(fields?.metadata || "metadata"),
210
- ...createAdditionalColumns(additionalFields)
211
- });
212
300
  var createMembersTable = (tableName = "members", organizationsTableOrFn = organizations, usersTableOrFn = users, fields, userPkField = "id", additionalFields) => {
213
301
  const organizationsTable = typeof organizationsTableOrFn === "function" ? organizationsTableOrFn() : organizationsTableOrFn;
214
302
  const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
303
+ const idCol = text(fields?.id || "id").primaryKey();
304
+ const organizationIdCol = text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable[fields?.organizationId || "id"] || organizationsTable.id, { onDelete: "cascade" });
305
+ const userIdCol = text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
306
+ const roleCol = text(fields?.role || "role").notNull();
307
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
215
308
  return sqliteTable(tableName, {
216
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
217
- organizationId: text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable[fields?.organizationId || "id"] || organizationsTable.id, { onDelete: "cascade" }),
218
- // Partial fix for org FK too?
219
- userId: text(fields?.userId || "userId").notNull().references(() => usersTable[userPkField], { onDelete: "cascade" }),
220
- role: text(fields?.role || "role").notNull(),
221
- createdAt: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
309
+ id: idCol,
310
+ [fields?.id || "id"]: idCol,
311
+ organizationId: organizationIdCol,
312
+ [fields?.organizationId || "organizationId"]: organizationIdCol,
313
+ userId: userIdCol,
314
+ [fields?.userId || "userId"]: userIdCol,
315
+ role: roleCol,
316
+ [fields?.role || "role"]: roleCol,
317
+ createdAt: createdAtCol,
318
+ [fields?.createdAt || "createdAt"]: createdAtCol,
222
319
  ...createAdditionalColumns(additionalFields)
223
320
  });
224
321
  };
225
322
  var createInvitationsTable = (tableName = "invitations", organizationsTableOrFn = organizations, usersTableOrFn = users, fields, userPkField = "id", additionalFields) => {
226
323
  const organizationsTable = typeof organizationsTableOrFn === "function" ? organizationsTableOrFn() : organizationsTableOrFn;
227
324
  const usersTable = typeof usersTableOrFn === "function" ? usersTableOrFn() : usersTableOrFn;
325
+ const idCol = text(fields?.id || "id").primaryKey();
326
+ const organizationIdCol = text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable[fields?.organizationId || "id"] || organizationsTable.id, { onDelete: "cascade" });
327
+ const emailCol = text(fields?.email || "email").notNull();
328
+ const roleCol = text(fields?.role || "role");
329
+ const statusCol = text(fields?.status || "status").notNull();
330
+ const expiresAtCol = integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull();
331
+ const inviterIdCol = text(fields?.inviterId || "inviterId").notNull().references(() => usersTable[userPkField] || usersTable.id, { onDelete: "cascade" });
332
+ const createdAtCol = integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull();
228
333
  return sqliteTable(tableName, {
229
- [fields?.id || "id"]: text(fields?.id || "id").primaryKey(),
230
- organizationId: text(fields?.organizationId || "organizationId").notNull().references(() => organizationsTable[fields?.organizationId || "id"] || organizationsTable.id, { onDelete: "cascade" }),
231
- email: text(fields?.email || "email").notNull(),
232
- role: text(fields?.role || "role"),
233
- status: text(fields?.status || "status").notNull(),
234
- expiresAt: integer(fields?.expiresAt || "expiresAt", { mode: "timestamp" }).notNull(),
235
- inviterId: text(fields?.inviterId || "inviterId").notNull().references(() => usersTable[userPkField], { onDelete: "cascade" }),
236
- createdAt: integer(fields?.createdAt || "createdAt", { mode: "timestamp" }).notNull(),
334
+ id: idCol,
335
+ [fields?.id || "id"]: idCol,
336
+ organizationId: organizationIdCol,
337
+ [fields?.organizationId || "organizationId"]: organizationIdCol,
338
+ email: emailCol,
339
+ [fields?.email || "email"]: emailCol,
340
+ role: roleCol,
341
+ [fields?.role || "role"]: roleCol,
342
+ status: statusCol,
343
+ [fields?.status || "status"]: statusCol,
344
+ expiresAt: expiresAtCol,
345
+ [fields?.expiresAt || "expiresAt"]: expiresAtCol,
346
+ inviterId: inviterIdCol,
347
+ [fields?.inviterId || "inviterId"]: inviterIdCol,
348
+ createdAt: createdAtCol,
349
+ [fields?.createdAt || "createdAt"]: createdAtCol,
237
350
  ...createAdditionalColumns(additionalFields)
238
351
  });
239
352
  };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  normalizeEmail,
10
10
  schema_exports,
11
11
  verifyTurnstile
12
- } from "./chunk-SGGYHP5S.js";
12
+ } from "./chunk-WI4UHTAT.js";
13
13
  import {
14
14
  AuthForm,
15
15
  CreateOrganizationForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-auth",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages. Includes custom schema mapping, Turnstile bot protection, and email normalization.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",