najm-auth 2.0.14 → 3.0.0
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.
- package/README.md +172 -50
- package/dist/{NajmAuthClient-Cn9bObLB.d.ts → NajmAuthClient-D2fSvQ_H.d.ts} +30 -5
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +15 -8
- package/dist/client/react/index.d.ts +10 -6
- package/dist/client/react/index.js +10 -3
- package/dist/client/server/index.d.ts +102 -2
- package/dist/client/server/index.js +203 -20
- package/dist/identity/ma.d.ts +1 -0
- package/dist/identity/ma.js +64 -0
- package/dist/index.d.ts +395 -91
- package/dist/index.js +1733 -862
- package/dist/ma-sNHnUGLO.d.ts +88 -0
- package/dist/schema/pg.d.ts +260 -1
- package/dist/schema/pg.js +13 -0
- package/dist/schema/sqlite.d.ts +284 -1
- package/dist/schema/sqlite.js +14 -1
- package/package.json +6 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A normalizer turns one raw login identifier into the canonical form stored on
|
|
3
|
+
* the user record. Returning `null`/`undefined` means "not mine" and hands the
|
|
4
|
+
* value to the next normalizer in the pipeline.
|
|
5
|
+
*/
|
|
6
|
+
type IdentityNormalizer = (value: string) => string | null | undefined;
|
|
7
|
+
interface IdentityPreset {
|
|
8
|
+
/** Stable preset name, e.g. `ma`. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Local-format normalization for that country. */
|
|
11
|
+
normalize: IdentityNormalizer;
|
|
12
|
+
}
|
|
13
|
+
/** Built-in country presets. */
|
|
14
|
+
type IdentityPresetName = 'ma' | 'tn';
|
|
15
|
+
interface IdentityConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Country preset for local phone numbers (default: `'ma'`). Pass another
|
|
18
|
+
* preset to replace Morocco, or `null` to keep only generic email/E.164
|
|
19
|
+
* handling. Local numbers are country-ambiguous, so presets replace each
|
|
20
|
+
* other instead of stacking.
|
|
21
|
+
*/
|
|
22
|
+
preset?: IdentityPresetName | IdentityPreset | null;
|
|
23
|
+
/**
|
|
24
|
+
* Project-specific identifiers (employee number, student number…). These run
|
|
25
|
+
* before the selected country preset.
|
|
26
|
+
*/
|
|
27
|
+
extend?: IdentityNormalizer[];
|
|
28
|
+
}
|
|
29
|
+
/** Identity policy resolved once for one auth plugin/server instance. */
|
|
30
|
+
interface ResolvedIdentityConfig {
|
|
31
|
+
resolve(value: unknown): string | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Strips the separators people type into phone fields, keeping a leading `+`. */
|
|
35
|
+
declare const compactPhone: (value: string) => string;
|
|
36
|
+
/** `06…` / `212…` / `+212…` → `+212…`. */
|
|
37
|
+
declare const normalizeMoroccanPhone: IdentityNormalizer;
|
|
38
|
+
declare const moroccoIdentityPreset: IdentityPreset;
|
|
39
|
+
/** `71234567` / `216…` / `+216…` → `+216…`. */
|
|
40
|
+
declare const normalizeTunisianPhone: IdentityNormalizer;
|
|
41
|
+
declare const tunisiaIdentityPreset: IdentityPreset;
|
|
42
|
+
declare const IDENTITY_PRESETS: Record<IdentityPresetName, IdentityPreset>;
|
|
43
|
+
declare const DEFAULT_IDENTITY_PRESET: IdentityPresetName;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A temporary credential is the value a provisioned user signs in with exactly
|
|
47
|
+
* once, before Najm forces them to replace it. It is hashed like any password;
|
|
48
|
+
* the only difference is that its *kind* decides how the submitted value is
|
|
49
|
+
* canonicalized before comparison.
|
|
50
|
+
*/
|
|
51
|
+
interface TemporaryCredential {
|
|
52
|
+
kind: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}
|
|
55
|
+
type TemporaryCredentialInput = string | TemporaryCredential;
|
|
56
|
+
interface TemporaryCredentialKind {
|
|
57
|
+
name: string;
|
|
58
|
+
/** Canonical form hashed at provisioning and compared at login. */
|
|
59
|
+
normalize(value: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* True when a proposed replacement password still has the temporary shape.
|
|
62
|
+
* Used to refuse "replacing" a CIN with another CIN.
|
|
63
|
+
*/
|
|
64
|
+
isTemporaryShape?(value: string): boolean;
|
|
65
|
+
}
|
|
66
|
+
/** Default kind: byte-for-byte, case-sensitive, no transformation. */
|
|
67
|
+
declare const EXACT_TEMPORARY_CREDENTIAL_KIND = "exact";
|
|
68
|
+
declare const MOROCCAN_CIN_TEMPORARY_CREDENTIAL_KIND = "ma-cin";
|
|
69
|
+
/** A Moroccan CIN is 1–3 letters followed by digits, 8–20 characters overall. */
|
|
70
|
+
declare function isMoroccanCin(value: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* People type their CIN in either case. Anything that is not a CIN is left
|
|
73
|
+
* exactly as submitted, so a user-chosen password is never lowercased.
|
|
74
|
+
*/
|
|
75
|
+
declare function normalizeMoroccanCin(value: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve a stored kind. Fails closed: an unknown kind never falls back to a
|
|
78
|
+
* different normalizer, because that would silently widen what the stored hash
|
|
79
|
+
* accepts.
|
|
80
|
+
*/
|
|
81
|
+
declare function resolveTemporaryCredentialKind(name?: string | null): TemporaryCredentialKind;
|
|
82
|
+
declare function isTemporaryCredentialKind(name: string): boolean;
|
|
83
|
+
/** Normalize provisioning input into `{ kind, value }`; strings mean `exact`. */
|
|
84
|
+
declare function toTemporaryCredential(input: TemporaryCredentialInput): TemporaryCredential;
|
|
85
|
+
/** The structured `ma-cin` temporary credential used by provisioning. */
|
|
86
|
+
declare function moroccanCinTemporaryCredential(value: string): TemporaryCredential;
|
|
87
|
+
|
|
88
|
+
export { DEFAULT_IDENTITY_PRESET as D, EXACT_TEMPORARY_CREDENTIAL_KIND as E, type IdentityConfig as I, MOROCCAN_CIN_TEMPORARY_CREDENTIAL_KIND as M, type ResolvedIdentityConfig as R, type TemporaryCredentialInput as T, IDENTITY_PRESETS as a, type IdentityNormalizer as b, type IdentityPreset as c, type IdentityPresetName as d, type TemporaryCredential as e, type TemporaryCredentialKind as f, compactPhone as g, isTemporaryCredentialKind as h, isMoroccanCin as i, moroccoIdentityPreset as j, normalizeMoroccanPhone as k, normalizeTunisianPhone as l, moroccanCinTemporaryCredential as m, normalizeMoroccanCin as n, tunisiaIdentityPreset as o, resolveTemporaryCredentialKind as r, toTemporaryCredential as t };
|
package/dist/schema/pg.d.ts
CHANGED
|
@@ -987,6 +987,137 @@ declare const credentialSetupSessionsTable: drizzle_orm_pg_core.PgTableWithColum
|
|
|
987
987
|
};
|
|
988
988
|
dialect: "pg";
|
|
989
989
|
}>;
|
|
990
|
+
/**
|
|
991
|
+
* Durable record that a user still owes a credential-setup purpose. Survives
|
|
992
|
+
* browser sessions, unlike credential_setup_sessions — the composite key lets
|
|
993
|
+
* one user owe more than one purpose at a time.
|
|
994
|
+
*/
|
|
995
|
+
declare const credentialSetupRequirementsTable: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
996
|
+
name: "credential_setup_requirements";
|
|
997
|
+
schema: undefined;
|
|
998
|
+
columns: {
|
|
999
|
+
userId: drizzle_orm_pg_core.PgColumn<{
|
|
1000
|
+
name: "user_id";
|
|
1001
|
+
tableName: "credential_setup_requirements";
|
|
1002
|
+
dataType: "string";
|
|
1003
|
+
columnType: "PgText";
|
|
1004
|
+
data: string;
|
|
1005
|
+
driverParam: string;
|
|
1006
|
+
notNull: true;
|
|
1007
|
+
hasDefault: false;
|
|
1008
|
+
isPrimaryKey: false;
|
|
1009
|
+
isAutoincrement: false;
|
|
1010
|
+
hasRuntimeDefault: false;
|
|
1011
|
+
enumValues: [string, ...string[]];
|
|
1012
|
+
baseColumn: never;
|
|
1013
|
+
identity: undefined;
|
|
1014
|
+
generated: undefined;
|
|
1015
|
+
}, {}, {}>;
|
|
1016
|
+
purpose: drizzle_orm_pg_core.PgColumn<{
|
|
1017
|
+
name: "purpose";
|
|
1018
|
+
tableName: "credential_setup_requirements";
|
|
1019
|
+
dataType: "string";
|
|
1020
|
+
columnType: "PgText";
|
|
1021
|
+
data: string;
|
|
1022
|
+
driverParam: string;
|
|
1023
|
+
notNull: true;
|
|
1024
|
+
hasDefault: false;
|
|
1025
|
+
isPrimaryKey: false;
|
|
1026
|
+
isAutoincrement: false;
|
|
1027
|
+
hasRuntimeDefault: false;
|
|
1028
|
+
enumValues: [string, ...string[]];
|
|
1029
|
+
baseColumn: never;
|
|
1030
|
+
identity: undefined;
|
|
1031
|
+
generated: undefined;
|
|
1032
|
+
}, {}, {}>;
|
|
1033
|
+
temporaryCredentialKind: drizzle_orm_pg_core.PgColumn<{
|
|
1034
|
+
name: "temporary_credential_kind";
|
|
1035
|
+
tableName: "credential_setup_requirements";
|
|
1036
|
+
dataType: "string";
|
|
1037
|
+
columnType: "PgText";
|
|
1038
|
+
data: string;
|
|
1039
|
+
driverParam: string;
|
|
1040
|
+
notNull: false;
|
|
1041
|
+
hasDefault: false;
|
|
1042
|
+
isPrimaryKey: false;
|
|
1043
|
+
isAutoincrement: false;
|
|
1044
|
+
hasRuntimeDefault: false;
|
|
1045
|
+
enumValues: [string, ...string[]];
|
|
1046
|
+
baseColumn: never;
|
|
1047
|
+
identity: undefined;
|
|
1048
|
+
generated: undefined;
|
|
1049
|
+
}, {}, {}>;
|
|
1050
|
+
required: drizzle_orm_pg_core.PgColumn<{
|
|
1051
|
+
name: "required";
|
|
1052
|
+
tableName: "credential_setup_requirements";
|
|
1053
|
+
dataType: "boolean";
|
|
1054
|
+
columnType: "PgBoolean";
|
|
1055
|
+
data: boolean;
|
|
1056
|
+
driverParam: boolean;
|
|
1057
|
+
notNull: true;
|
|
1058
|
+
hasDefault: true;
|
|
1059
|
+
isPrimaryKey: false;
|
|
1060
|
+
isAutoincrement: false;
|
|
1061
|
+
hasRuntimeDefault: false;
|
|
1062
|
+
enumValues: undefined;
|
|
1063
|
+
baseColumn: never;
|
|
1064
|
+
identity: undefined;
|
|
1065
|
+
generated: undefined;
|
|
1066
|
+
}, {}, {}>;
|
|
1067
|
+
completedAt: drizzle_orm_pg_core.PgColumn<{
|
|
1068
|
+
name: "completed_at";
|
|
1069
|
+
tableName: "credential_setup_requirements";
|
|
1070
|
+
dataType: "string";
|
|
1071
|
+
columnType: "PgTimestampString";
|
|
1072
|
+
data: string;
|
|
1073
|
+
driverParam: string;
|
|
1074
|
+
notNull: false;
|
|
1075
|
+
hasDefault: false;
|
|
1076
|
+
isPrimaryKey: false;
|
|
1077
|
+
isAutoincrement: false;
|
|
1078
|
+
hasRuntimeDefault: false;
|
|
1079
|
+
enumValues: undefined;
|
|
1080
|
+
baseColumn: never;
|
|
1081
|
+
identity: undefined;
|
|
1082
|
+
generated: undefined;
|
|
1083
|
+
}, {}, {}>;
|
|
1084
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1085
|
+
name: "created_at";
|
|
1086
|
+
tableName: "credential_setup_requirements";
|
|
1087
|
+
dataType: "string";
|
|
1088
|
+
columnType: "PgTimestampString";
|
|
1089
|
+
data: string;
|
|
1090
|
+
driverParam: string;
|
|
1091
|
+
notNull: false;
|
|
1092
|
+
hasDefault: true;
|
|
1093
|
+
isPrimaryKey: false;
|
|
1094
|
+
isAutoincrement: false;
|
|
1095
|
+
hasRuntimeDefault: false;
|
|
1096
|
+
enumValues: undefined;
|
|
1097
|
+
baseColumn: never;
|
|
1098
|
+
identity: undefined;
|
|
1099
|
+
generated: undefined;
|
|
1100
|
+
}, {}, {}>;
|
|
1101
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
1102
|
+
name: "updated_at";
|
|
1103
|
+
tableName: "credential_setup_requirements";
|
|
1104
|
+
dataType: "string";
|
|
1105
|
+
columnType: "PgTimestampString";
|
|
1106
|
+
data: string;
|
|
1107
|
+
driverParam: string;
|
|
1108
|
+
notNull: false;
|
|
1109
|
+
hasDefault: true;
|
|
1110
|
+
isPrimaryKey: false;
|
|
1111
|
+
isAutoincrement: false;
|
|
1112
|
+
hasRuntimeDefault: false;
|
|
1113
|
+
enumValues: undefined;
|
|
1114
|
+
baseColumn: never;
|
|
1115
|
+
identity: undefined;
|
|
1116
|
+
generated: undefined;
|
|
1117
|
+
}, {}, {}>;
|
|
1118
|
+
};
|
|
1119
|
+
dialect: "pg";
|
|
1120
|
+
}>;
|
|
990
1121
|
/**
|
|
991
1122
|
* Junction table for many-to-many relationship between roles and permissions
|
|
992
1123
|
*/
|
|
@@ -1791,6 +1922,132 @@ declare const authSchema: {
|
|
|
1791
1922
|
};
|
|
1792
1923
|
dialect: "pg";
|
|
1793
1924
|
}>;
|
|
1925
|
+
readonly credentialSetupRequirements: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1926
|
+
name: "credential_setup_requirements";
|
|
1927
|
+
schema: undefined;
|
|
1928
|
+
columns: {
|
|
1929
|
+
userId: drizzle_orm_pg_core.PgColumn<{
|
|
1930
|
+
name: "user_id";
|
|
1931
|
+
tableName: "credential_setup_requirements";
|
|
1932
|
+
dataType: "string";
|
|
1933
|
+
columnType: "PgText";
|
|
1934
|
+
data: string;
|
|
1935
|
+
driverParam: string;
|
|
1936
|
+
notNull: true;
|
|
1937
|
+
hasDefault: false;
|
|
1938
|
+
isPrimaryKey: false;
|
|
1939
|
+
isAutoincrement: false;
|
|
1940
|
+
hasRuntimeDefault: false;
|
|
1941
|
+
enumValues: [string, ...string[]];
|
|
1942
|
+
baseColumn: never;
|
|
1943
|
+
identity: undefined;
|
|
1944
|
+
generated: undefined;
|
|
1945
|
+
}, {}, {}>;
|
|
1946
|
+
purpose: drizzle_orm_pg_core.PgColumn<{
|
|
1947
|
+
name: "purpose";
|
|
1948
|
+
tableName: "credential_setup_requirements";
|
|
1949
|
+
dataType: "string";
|
|
1950
|
+
columnType: "PgText";
|
|
1951
|
+
data: string;
|
|
1952
|
+
driverParam: string;
|
|
1953
|
+
notNull: true;
|
|
1954
|
+
hasDefault: false;
|
|
1955
|
+
isPrimaryKey: false;
|
|
1956
|
+
isAutoincrement: false;
|
|
1957
|
+
hasRuntimeDefault: false;
|
|
1958
|
+
enumValues: [string, ...string[]];
|
|
1959
|
+
baseColumn: never;
|
|
1960
|
+
identity: undefined;
|
|
1961
|
+
generated: undefined;
|
|
1962
|
+
}, {}, {}>;
|
|
1963
|
+
temporaryCredentialKind: drizzle_orm_pg_core.PgColumn<{
|
|
1964
|
+
name: "temporary_credential_kind";
|
|
1965
|
+
tableName: "credential_setup_requirements";
|
|
1966
|
+
dataType: "string";
|
|
1967
|
+
columnType: "PgText";
|
|
1968
|
+
data: string;
|
|
1969
|
+
driverParam: string;
|
|
1970
|
+
notNull: false;
|
|
1971
|
+
hasDefault: false;
|
|
1972
|
+
isPrimaryKey: false;
|
|
1973
|
+
isAutoincrement: false;
|
|
1974
|
+
hasRuntimeDefault: false;
|
|
1975
|
+
enumValues: [string, ...string[]];
|
|
1976
|
+
baseColumn: never;
|
|
1977
|
+
identity: undefined;
|
|
1978
|
+
generated: undefined;
|
|
1979
|
+
}, {}, {}>;
|
|
1980
|
+
required: drizzle_orm_pg_core.PgColumn<{
|
|
1981
|
+
name: "required";
|
|
1982
|
+
tableName: "credential_setup_requirements";
|
|
1983
|
+
dataType: "boolean";
|
|
1984
|
+
columnType: "PgBoolean";
|
|
1985
|
+
data: boolean;
|
|
1986
|
+
driverParam: boolean;
|
|
1987
|
+
notNull: true;
|
|
1988
|
+
hasDefault: true;
|
|
1989
|
+
isPrimaryKey: false;
|
|
1990
|
+
isAutoincrement: false;
|
|
1991
|
+
hasRuntimeDefault: false;
|
|
1992
|
+
enumValues: undefined;
|
|
1993
|
+
baseColumn: never;
|
|
1994
|
+
identity: undefined;
|
|
1995
|
+
generated: undefined;
|
|
1996
|
+
}, {}, {}>;
|
|
1997
|
+
completedAt: drizzle_orm_pg_core.PgColumn<{
|
|
1998
|
+
name: "completed_at";
|
|
1999
|
+
tableName: "credential_setup_requirements";
|
|
2000
|
+
dataType: "string";
|
|
2001
|
+
columnType: "PgTimestampString";
|
|
2002
|
+
data: string;
|
|
2003
|
+
driverParam: string;
|
|
2004
|
+
notNull: false;
|
|
2005
|
+
hasDefault: false;
|
|
2006
|
+
isPrimaryKey: false;
|
|
2007
|
+
isAutoincrement: false;
|
|
2008
|
+
hasRuntimeDefault: false;
|
|
2009
|
+
enumValues: undefined;
|
|
2010
|
+
baseColumn: never;
|
|
2011
|
+
identity: undefined;
|
|
2012
|
+
generated: undefined;
|
|
2013
|
+
}, {}, {}>;
|
|
2014
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
2015
|
+
name: "created_at";
|
|
2016
|
+
tableName: "credential_setup_requirements";
|
|
2017
|
+
dataType: "string";
|
|
2018
|
+
columnType: "PgTimestampString";
|
|
2019
|
+
data: string;
|
|
2020
|
+
driverParam: string;
|
|
2021
|
+
notNull: false;
|
|
2022
|
+
hasDefault: true;
|
|
2023
|
+
isPrimaryKey: false;
|
|
2024
|
+
isAutoincrement: false;
|
|
2025
|
+
hasRuntimeDefault: false;
|
|
2026
|
+
enumValues: undefined;
|
|
2027
|
+
baseColumn: never;
|
|
2028
|
+
identity: undefined;
|
|
2029
|
+
generated: undefined;
|
|
2030
|
+
}, {}, {}>;
|
|
2031
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2032
|
+
name: "updated_at";
|
|
2033
|
+
tableName: "credential_setup_requirements";
|
|
2034
|
+
dataType: "string";
|
|
2035
|
+
columnType: "PgTimestampString";
|
|
2036
|
+
data: string;
|
|
2037
|
+
driverParam: string;
|
|
2038
|
+
notNull: false;
|
|
2039
|
+
hasDefault: true;
|
|
2040
|
+
isPrimaryKey: false;
|
|
2041
|
+
isAutoincrement: false;
|
|
2042
|
+
hasRuntimeDefault: false;
|
|
2043
|
+
enumValues: undefined;
|
|
2044
|
+
baseColumn: never;
|
|
2045
|
+
identity: undefined;
|
|
2046
|
+
generated: undefined;
|
|
2047
|
+
}, {}, {}>;
|
|
2048
|
+
};
|
|
2049
|
+
dialect: "pg";
|
|
2050
|
+
}>;
|
|
1794
2051
|
readonly roles: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1795
2052
|
name: "roles";
|
|
1796
2053
|
schema: undefined;
|
|
@@ -2080,7 +2337,9 @@ type Token = typeof tokensTable.$inferSelect;
|
|
|
2080
2337
|
type NewToken = typeof tokensTable.$inferInsert;
|
|
2081
2338
|
type CredentialSetupSession = typeof credentialSetupSessionsTable.$inferSelect;
|
|
2082
2339
|
type NewCredentialSetupSession = typeof credentialSetupSessionsTable.$inferInsert;
|
|
2340
|
+
type CredentialSetupRequirement = typeof credentialSetupRequirementsTable.$inferSelect;
|
|
2341
|
+
type NewCredentialSetupRequirement = typeof credentialSetupRequirementsTable.$inferInsert;
|
|
2083
2342
|
type RolePermission = typeof rolePermissionsTable.$inferSelect;
|
|
2084
2343
|
type NewRolePermission = typeof rolePermissionsTable.$inferInsert;
|
|
2085
2344
|
|
|
2086
|
-
export { type CredentialSetupSession, type NewCredentialSetupSession, type NewOAuthAccount, type NewPermission, type NewRoleEntity, type NewRolePermission, type NewToken, type NewUser, type OAuthAccount, type Permission, type RoleEntity, type RolePermission, type Token, type User, authSchema, baseFields, credentialSetupSessionsTable, oauthAccountsTable, permissionsTable, rolePermissionsTable, rolesTable, tokenStatusEnum, tokenTypeEnum, tokensTable, userStatusEnum, usersTable };
|
|
2345
|
+
export { type CredentialSetupRequirement, type CredentialSetupSession, type NewCredentialSetupRequirement, type NewCredentialSetupSession, type NewOAuthAccount, type NewPermission, type NewRoleEntity, type NewRolePermission, type NewToken, type NewUser, type OAuthAccount, type Permission, type RoleEntity, type RolePermission, type Token, type User, authSchema, baseFields, credentialSetupRequirementsTable, credentialSetupSessionsTable, oauthAccountsTable, permissionsTable, rolePermissionsTable, rolesTable, tokenStatusEnum, tokenTypeEnum, tokensTable, userStatusEnum, usersTable };
|
package/dist/schema/pg.js
CHANGED
|
@@ -86,6 +86,17 @@ var credentialSetupSessionsTable = pgTable("credential_setup_sessions", {
|
|
|
86
86
|
userPurposeIdx: index("credential_setup_sessions_user_purpose_idx").on(table.userId, table.purpose),
|
|
87
87
|
expiresAtIdx: index("credential_setup_sessions_expires_at_idx").on(table.expiresAt)
|
|
88
88
|
}));
|
|
89
|
+
var credentialSetupRequirementsTable = pgTable("credential_setup_requirements", {
|
|
90
|
+
userId: text("user_id").references(() => usersTable.id, { onDelete: "cascade" }).notNull(),
|
|
91
|
+
purpose: text("purpose").notNull(),
|
|
92
|
+
temporaryCredentialKind: text("temporary_credential_kind"),
|
|
93
|
+
required: boolean("required").default(true).notNull(),
|
|
94
|
+
completedAt: timestamp("completed_at", { mode: "string" }),
|
|
95
|
+
createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
|
|
96
|
+
updatedAt: timestamp("updated_at", { mode: "string" }).defaultNow().$onUpdate(() => sql`CURRENT_TIMESTAMP`)
|
|
97
|
+
}, (table) => ({
|
|
98
|
+
pk: primaryKey({ columns: [table.userId, table.purpose] })
|
|
99
|
+
}));
|
|
89
100
|
var rolePermissionsTable = pgTable("role_permissions", {
|
|
90
101
|
roleId: text("role_id").notNull().references(() => rolesTable.id, { onDelete: "cascade" }),
|
|
91
102
|
permissionId: text("permission_id").notNull().references(() => permissionsTable.id, { onDelete: "cascade" }),
|
|
@@ -98,6 +109,7 @@ var authSchema = {
|
|
|
98
109
|
oauthAccounts: oauthAccountsTable,
|
|
99
110
|
tokens: tokensTable,
|
|
100
111
|
credentialSetupSessions: credentialSetupSessionsTable,
|
|
112
|
+
credentialSetupRequirements: credentialSetupRequirementsTable,
|
|
101
113
|
roles: rolesTable,
|
|
102
114
|
permissions: permissionsTable,
|
|
103
115
|
rolePermissions: rolePermissionsTable
|
|
@@ -105,6 +117,7 @@ var authSchema = {
|
|
|
105
117
|
export {
|
|
106
118
|
authSchema,
|
|
107
119
|
baseFields,
|
|
120
|
+
credentialSetupRequirementsTable,
|
|
108
121
|
credentialSetupSessionsTable,
|
|
109
122
|
oauthAccountsTable,
|
|
110
123
|
permissionsTable,
|