@logto/schemas 1.0.0-beta.12 → 1.0.0-beta.14
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/alterations/1.0.0_beta.14-1665300135-sign-in-sign-up.ts +174 -0
- package/alterations/1.0.0_beta.14-1667283640-remove-forgot-password.ts +18 -0
- package/alterations/1.0.0_beta.14-1667292082-remove-sign-in-method.ts +18 -0
- package/alterations/1.0.0_beta.14-1667374974-user-suspend.ts +18 -0
- package/alterations/1.0.0_beta.14-1667900481-add-passcode-type-continue.ts +19 -0
- package/alterations/README.md +9 -5
- package/alterations-js/1.0.0_beta.14-1665300135-sign-in-sign-up.d.ts +3 -0
- package/alterations-js/1.0.0_beta.14-1665300135-sign-in-sign-up.js +124 -0
- package/alterations-js/1.0.0_beta.14-1667283640-remove-forgot-password.d.ts +3 -0
- package/alterations-js/1.0.0_beta.14-1667283640-remove-forgot-password.js +16 -0
- package/alterations-js/1.0.0_beta.14-1667292082-remove-sign-in-method.d.ts +3 -0
- package/alterations-js/1.0.0_beta.14-1667292082-remove-sign-in-method.js +16 -0
- package/alterations-js/1.0.0_beta.14-1667374974-user-suspend.d.ts +3 -0
- package/alterations-js/1.0.0_beta.14-1667374974-user-suspend.js +16 -0
- package/alterations-js/1.0.0_beta.14-1667900481-add-passcode-type-continue.d.ts +3 -0
- package/alterations-js/1.0.0_beta.14-1667900481-add-passcode-type-continue.js +17 -0
- package/lib/db-entries/application.d.ts +1 -1
- package/lib/db-entries/connector.d.ts +1 -1
- package/lib/db-entries/custom-phrase.d.ts +1 -1
- package/lib/db-entries/custom-types.d.ts +2 -1
- package/lib/db-entries/custom-types.js +1 -0
- package/lib/db-entries/log.d.ts +1 -1
- package/lib/db-entries/logto-config.d.ts +1 -1
- package/lib/db-entries/oidc-model-instance.d.ts +1 -1
- package/lib/db-entries/passcode.d.ts +1 -1
- package/lib/db-entries/resource.d.ts +1 -1
- package/lib/db-entries/role.d.ts +1 -1
- package/lib/db-entries/setting.d.ts +1 -1
- package/lib/db-entries/sign-in-experience.d.ts +5 -3
- package/lib/db-entries/sign-in-experience.js +8 -4
- package/lib/db-entries/user.d.ts +3 -1
- package/lib/db-entries/user.js +4 -0
- package/lib/foundations/jsonb-types.d.ts +55 -24
- package/lib/foundations/jsonb-types.js +29 -19
- package/lib/foundations/schemas.d.ts +1 -1
- package/lib/seeds/application.d.ts +1 -1
- package/lib/seeds/resource.d.ts +1 -1
- package/lib/seeds/roles.d.ts +1 -1
- package/lib/seeds/setting.d.ts +1 -1
- package/lib/seeds/sign-in-experience.d.ts +1 -1
- package/lib/seeds/sign-in-experience.js +14 -5
- package/lib/types/connector.d.ts +2 -2
- package/lib/types/log.d.ts +64 -2
- package/lib/types/log.js +18 -0
- package/lib/types/logto-config.d.ts +1 -1
- package/lib/types/oidc-config.d.ts +1 -1
- package/lib/types/user.d.ts +2 -2
- package/lib/types/user.js +1 -0
- package/package.json +22 -24
- package/tables/passcodes.sql +1 -1
- package/tables/sign_in_experiences.sql +2 -1
- package/tables/users.sql +1 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration';
|
|
4
|
+
|
|
5
|
+
enum SignInMethodState {
|
|
6
|
+
Primary = 'primary',
|
|
7
|
+
Secondary = 'secondary',
|
|
8
|
+
Disabled = 'disabled',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
enum SignInMethodKey {
|
|
12
|
+
Username = 'username',
|
|
13
|
+
Email = 'email',
|
|
14
|
+
Sms = 'sms',
|
|
15
|
+
Social = 'social',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type SignInExperience = {
|
|
19
|
+
signInMethods: {
|
|
20
|
+
[SignInMethodKey.Username]: SignInMethodState;
|
|
21
|
+
[SignInMethodKey.Email]: SignInMethodState;
|
|
22
|
+
[SignInMethodKey.Sms]: SignInMethodState;
|
|
23
|
+
[SignInMethodKey.Social]: SignInMethodState;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
enum SignUpIdentifier {
|
|
28
|
+
Email = 'email',
|
|
29
|
+
Sms = 'sms',
|
|
30
|
+
Username = 'username',
|
|
31
|
+
EmailOrSms = 'emailOrSms',
|
|
32
|
+
None = 'none',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
enum SignInIdentifier {
|
|
36
|
+
Email = 'email',
|
|
37
|
+
Sms = 'Sms',
|
|
38
|
+
Username = 'username',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type SignIn = {
|
|
42
|
+
methods: Array<{
|
|
43
|
+
identifier: SignInIdentifier;
|
|
44
|
+
password: boolean;
|
|
45
|
+
verificationCode: boolean;
|
|
46
|
+
isPasswordPrimary: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type SignUp = {
|
|
51
|
+
identifier: SignUpIdentifier;
|
|
52
|
+
password: boolean;
|
|
53
|
+
verify: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const parseSignInMethodToSignInIdentifier = (
|
|
57
|
+
method: SignInMethodKey
|
|
58
|
+
): SignInIdentifier | undefined => {
|
|
59
|
+
if (method === SignInMethodKey.Username) {
|
|
60
|
+
return SignInIdentifier.Username;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (method === SignInMethodKey.Email) {
|
|
64
|
+
return SignInIdentifier.Email;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (method === SignInMethodKey.Sms) {
|
|
68
|
+
return SignInIdentifier.Sms;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const parseSignInMethodToSignUpIdentifier = (method?: SignInMethodKey): SignUpIdentifier => {
|
|
73
|
+
if (method === SignInMethodKey.Username) {
|
|
74
|
+
return SignUpIdentifier.Username;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (method === SignInMethodKey.Email) {
|
|
78
|
+
return SignUpIdentifier.Email;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (method === SignInMethodKey.Sms) {
|
|
82
|
+
return SignUpIdentifier.Sms;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return SignUpIdentifier.None;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const alteration: AlterationScript = {
|
|
89
|
+
up: async (pool) => {
|
|
90
|
+
await pool.query(sql`
|
|
91
|
+
alter table sign_in_experiences add column sign_in jsonb
|
|
92
|
+
`);
|
|
93
|
+
await pool.query(sql`
|
|
94
|
+
alter table sign_in_experiences add column sign_up jsonb
|
|
95
|
+
`);
|
|
96
|
+
await pool.query(sql`
|
|
97
|
+
alter table sign_in_experiences add column forgot_password boolean not null default false
|
|
98
|
+
`);
|
|
99
|
+
|
|
100
|
+
const id = 'default';
|
|
101
|
+
const data = await pool.maybeOne<SignInExperience>(
|
|
102
|
+
sql`select * from sign_in_experiences where id = ${id}`
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
/* eslint-disable @silverhand/fp/no-mutating-methods */
|
|
106
|
+
if (data) {
|
|
107
|
+
const { signInMethods } = data;
|
|
108
|
+
const methodKeys = Object.values(SignInMethodKey);
|
|
109
|
+
const primaryMethod = methodKeys.find(
|
|
110
|
+
(key) => signInMethods[key] === SignInMethodState.Primary
|
|
111
|
+
);
|
|
112
|
+
const secondaryMethods = methodKeys.filter(
|
|
113
|
+
(key) => signInMethods[key] === SignInMethodState.Secondary
|
|
114
|
+
);
|
|
115
|
+
const signIn: SignIn = {
|
|
116
|
+
methods: [],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const methods = [primaryMethod, ...secondaryMethods];
|
|
120
|
+
|
|
121
|
+
for (const method of methods) {
|
|
122
|
+
if (!method) {
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const identifier = parseSignInMethodToSignInIdentifier(method);
|
|
127
|
+
|
|
128
|
+
if (identifier) {
|
|
129
|
+
signIn.methods.push({
|
|
130
|
+
identifier,
|
|
131
|
+
password: identifier === SignInIdentifier.Username,
|
|
132
|
+
verificationCode: identifier !== SignInIdentifier.Username,
|
|
133
|
+
isPasswordPrimary: false,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const signUpIdentifier = parseSignInMethodToSignUpIdentifier(primaryMethod);
|
|
139
|
+
const signUp: SignUp = {
|
|
140
|
+
identifier: signUpIdentifier,
|
|
141
|
+
verify: true,
|
|
142
|
+
password: signUpIdentifier === SignUpIdentifier.Username,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
await pool.query(sql`
|
|
146
|
+
update sign_in_experiences set sign_in = ${JSON.stringify(signIn)} where id = ${id}
|
|
147
|
+
`);
|
|
148
|
+
await pool.query(sql`
|
|
149
|
+
update sign_in_experiences set sign_up = ${JSON.stringify(signUp)} where id = ${id}
|
|
150
|
+
`);
|
|
151
|
+
}
|
|
152
|
+
/* eslint-enable @silverhand/fp/no-mutating-methods */
|
|
153
|
+
|
|
154
|
+
await pool.query(sql`
|
|
155
|
+
alter table sign_in_experiences alter column sign_in set not null
|
|
156
|
+
`);
|
|
157
|
+
await pool.query(sql`
|
|
158
|
+
alter table sign_in_experiences alter column sign_up set not null
|
|
159
|
+
`);
|
|
160
|
+
},
|
|
161
|
+
down: async (pool) => {
|
|
162
|
+
await pool.query(sql`
|
|
163
|
+
alter table sign_in_experiences drop column sign_in
|
|
164
|
+
`);
|
|
165
|
+
await pool.query(sql`
|
|
166
|
+
alter table sign_in_experiences drop column sign_up
|
|
167
|
+
`);
|
|
168
|
+
await pool.query(sql`
|
|
169
|
+
alter table sign_in_experiences drop column forgot_password
|
|
170
|
+
`);
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export default alteration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table sign_in_experiences drop column forgot_password
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
alter table sign_in_experiences add column forgot_password boolean not null default false
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table sign_in_experiences drop column sign_in_methods
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
alter table sign_in_experiences add column sign_in_methods jsonb not null default '{}'::jsonb,
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table users add column is_suspended boolean not null default false;
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
alter table users drop column is_suspended;
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter type passcode_type add value 'Continue'
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
drop type passcode_type
|
|
14
|
+
create type passcode_type as enum ('SignIn', 'Register', 'ForgotPassword');
|
|
15
|
+
`);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default alteration;
|
package/alterations/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Database
|
|
1
|
+
# Database alteration
|
|
2
2
|
|
|
3
3
|
The folder for all alteration files.
|
|
4
4
|
|
|
@@ -10,6 +10,10 @@ As for development, the `version` is "next" until the package is released.
|
|
|
10
10
|
|
|
11
11
|
Note that, you SHOULD NOT change the content of the alteration files after they are created. If you need to change the alteration, you should create a new alteration file with the new content.
|
|
12
12
|
|
|
13
|
+
## Deploy unreleased alterations
|
|
14
|
+
|
|
15
|
+
To deploy scripts with the `next` version, run `pnpm alteration deploy next`. This is helpful if you want to test your alteration scripts.
|
|
16
|
+
|
|
13
17
|
## Typing
|
|
14
18
|
|
|
15
19
|
```ts
|
|
@@ -28,15 +32,15 @@ The `down` function is designed for the future downgrade feature.
|
|
|
28
32
|
```ts
|
|
29
33
|
export const up = async (connection) => {
|
|
30
34
|
await connection.query(`
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
alter table "user"
|
|
36
|
+
add column "email" varchar(255) not null;
|
|
33
37
|
`);
|
|
34
38
|
};
|
|
35
39
|
|
|
36
40
|
export const down = async (connection) => {
|
|
37
41
|
await connection.query(`
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
alter table "user"
|
|
43
|
+
drop column "email";
|
|
40
44
|
`);
|
|
41
45
|
};
|
|
42
46
|
```
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const slonik_1 = require("slonik");
|
|
4
|
+
var SignInMethodState;
|
|
5
|
+
(function (SignInMethodState) {
|
|
6
|
+
SignInMethodState["Primary"] = "primary";
|
|
7
|
+
SignInMethodState["Secondary"] = "secondary";
|
|
8
|
+
SignInMethodState["Disabled"] = "disabled";
|
|
9
|
+
})(SignInMethodState || (SignInMethodState = {}));
|
|
10
|
+
var SignInMethodKey;
|
|
11
|
+
(function (SignInMethodKey) {
|
|
12
|
+
SignInMethodKey["Username"] = "username";
|
|
13
|
+
SignInMethodKey["Email"] = "email";
|
|
14
|
+
SignInMethodKey["Sms"] = "sms";
|
|
15
|
+
SignInMethodKey["Social"] = "social";
|
|
16
|
+
})(SignInMethodKey || (SignInMethodKey = {}));
|
|
17
|
+
var SignUpIdentifier;
|
|
18
|
+
(function (SignUpIdentifier) {
|
|
19
|
+
SignUpIdentifier["Email"] = "email";
|
|
20
|
+
SignUpIdentifier["Sms"] = "sms";
|
|
21
|
+
SignUpIdentifier["Username"] = "username";
|
|
22
|
+
SignUpIdentifier["EmailOrSms"] = "emailOrSms";
|
|
23
|
+
SignUpIdentifier["None"] = "none";
|
|
24
|
+
})(SignUpIdentifier || (SignUpIdentifier = {}));
|
|
25
|
+
var SignInIdentifier;
|
|
26
|
+
(function (SignInIdentifier) {
|
|
27
|
+
SignInIdentifier["Email"] = "email";
|
|
28
|
+
SignInIdentifier["Sms"] = "Sms";
|
|
29
|
+
SignInIdentifier["Username"] = "username";
|
|
30
|
+
})(SignInIdentifier || (SignInIdentifier = {}));
|
|
31
|
+
const parseSignInMethodToSignInIdentifier = (method) => {
|
|
32
|
+
if (method === SignInMethodKey.Username) {
|
|
33
|
+
return SignInIdentifier.Username;
|
|
34
|
+
}
|
|
35
|
+
if (method === SignInMethodKey.Email) {
|
|
36
|
+
return SignInIdentifier.Email;
|
|
37
|
+
}
|
|
38
|
+
if (method === SignInMethodKey.Sms) {
|
|
39
|
+
return SignInIdentifier.Sms;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const parseSignInMethodToSignUpIdentifier = (method) => {
|
|
43
|
+
if (method === SignInMethodKey.Username) {
|
|
44
|
+
return SignUpIdentifier.Username;
|
|
45
|
+
}
|
|
46
|
+
if (method === SignInMethodKey.Email) {
|
|
47
|
+
return SignUpIdentifier.Email;
|
|
48
|
+
}
|
|
49
|
+
if (method === SignInMethodKey.Sms) {
|
|
50
|
+
return SignUpIdentifier.Sms;
|
|
51
|
+
}
|
|
52
|
+
return SignUpIdentifier.None;
|
|
53
|
+
};
|
|
54
|
+
const alteration = {
|
|
55
|
+
up: async (pool) => {
|
|
56
|
+
await pool.query((0, slonik_1.sql) `
|
|
57
|
+
alter table sign_in_experiences add column sign_in jsonb
|
|
58
|
+
`);
|
|
59
|
+
await pool.query((0, slonik_1.sql) `
|
|
60
|
+
alter table sign_in_experiences add column sign_up jsonb
|
|
61
|
+
`);
|
|
62
|
+
await pool.query((0, slonik_1.sql) `
|
|
63
|
+
alter table sign_in_experiences add column forgot_password boolean not null default false
|
|
64
|
+
`);
|
|
65
|
+
const id = 'default';
|
|
66
|
+
const data = await pool.maybeOne((0, slonik_1.sql) `select * from sign_in_experiences where id = ${id}`);
|
|
67
|
+
/* eslint-disable @silverhand/fp/no-mutating-methods */
|
|
68
|
+
if (data) {
|
|
69
|
+
const { signInMethods } = data;
|
|
70
|
+
const methodKeys = Object.values(SignInMethodKey);
|
|
71
|
+
const primaryMethod = methodKeys.find((key) => signInMethods[key] === SignInMethodState.Primary);
|
|
72
|
+
const secondaryMethods = methodKeys.filter((key) => signInMethods[key] === SignInMethodState.Secondary);
|
|
73
|
+
const signIn = {
|
|
74
|
+
methods: [],
|
|
75
|
+
};
|
|
76
|
+
const methods = [primaryMethod, ...secondaryMethods];
|
|
77
|
+
for (const method of methods) {
|
|
78
|
+
if (!method) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const identifier = parseSignInMethodToSignInIdentifier(method);
|
|
82
|
+
if (identifier) {
|
|
83
|
+
signIn.methods.push({
|
|
84
|
+
identifier,
|
|
85
|
+
password: identifier === SignInIdentifier.Username,
|
|
86
|
+
verificationCode: identifier !== SignInIdentifier.Username,
|
|
87
|
+
isPasswordPrimary: false,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const signUpIdentifier = parseSignInMethodToSignUpIdentifier(primaryMethod);
|
|
92
|
+
const signUp = {
|
|
93
|
+
identifier: signUpIdentifier,
|
|
94
|
+
verify: true,
|
|
95
|
+
password: signUpIdentifier === SignUpIdentifier.Username,
|
|
96
|
+
};
|
|
97
|
+
await pool.query((0, slonik_1.sql) `
|
|
98
|
+
update sign_in_experiences set sign_in = ${JSON.stringify(signIn)} where id = ${id}
|
|
99
|
+
`);
|
|
100
|
+
await pool.query((0, slonik_1.sql) `
|
|
101
|
+
update sign_in_experiences set sign_up = ${JSON.stringify(signUp)} where id = ${id}
|
|
102
|
+
`);
|
|
103
|
+
}
|
|
104
|
+
/* eslint-enable @silverhand/fp/no-mutating-methods */
|
|
105
|
+
await pool.query((0, slonik_1.sql) `
|
|
106
|
+
alter table sign_in_experiences alter column sign_in set not null
|
|
107
|
+
`);
|
|
108
|
+
await pool.query((0, slonik_1.sql) `
|
|
109
|
+
alter table sign_in_experiences alter column sign_up set not null
|
|
110
|
+
`);
|
|
111
|
+
},
|
|
112
|
+
down: async (pool) => {
|
|
113
|
+
await pool.query((0, slonik_1.sql) `
|
|
114
|
+
alter table sign_in_experiences drop column sign_in
|
|
115
|
+
`);
|
|
116
|
+
await pool.query((0, slonik_1.sql) `
|
|
117
|
+
alter table sign_in_experiences drop column sign_up
|
|
118
|
+
`);
|
|
119
|
+
await pool.query((0, slonik_1.sql) `
|
|
120
|
+
alter table sign_in_experiences drop column forgot_password
|
|
121
|
+
`);
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
exports.default = alteration;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const slonik_1 = require("slonik");
|
|
4
|
+
const alteration = {
|
|
5
|
+
up: async (pool) => {
|
|
6
|
+
await pool.query((0, slonik_1.sql) `
|
|
7
|
+
alter table sign_in_experiences drop column forgot_password
|
|
8
|
+
`);
|
|
9
|
+
},
|
|
10
|
+
down: async (pool) => {
|
|
11
|
+
await pool.query((0, slonik_1.sql) `
|
|
12
|
+
alter table sign_in_experiences add column forgot_password boolean not null default false
|
|
13
|
+
`);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
exports.default = alteration;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const slonik_1 = require("slonik");
|
|
4
|
+
const alteration = {
|
|
5
|
+
up: async (pool) => {
|
|
6
|
+
await pool.query((0, slonik_1.sql) `
|
|
7
|
+
alter table sign_in_experiences drop column sign_in_methods
|
|
8
|
+
`);
|
|
9
|
+
},
|
|
10
|
+
down: async (pool) => {
|
|
11
|
+
await pool.query((0, slonik_1.sql) `
|
|
12
|
+
alter table sign_in_experiences add column sign_in_methods jsonb not null default '{}'::jsonb,
|
|
13
|
+
`);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
exports.default = alteration;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const slonik_1 = require("slonik");
|
|
4
|
+
const alteration = {
|
|
5
|
+
up: async (pool) => {
|
|
6
|
+
await pool.query((0, slonik_1.sql) `
|
|
7
|
+
alter table users add column is_suspended boolean not null default false;
|
|
8
|
+
`);
|
|
9
|
+
},
|
|
10
|
+
down: async (pool) => {
|
|
11
|
+
await pool.query((0, slonik_1.sql) `
|
|
12
|
+
alter table users drop column is_suspended;
|
|
13
|
+
`);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
exports.default = alteration;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const slonik_1 = require("slonik");
|
|
4
|
+
const alteration = {
|
|
5
|
+
up: async (pool) => {
|
|
6
|
+
await pool.query((0, slonik_1.sql) `
|
|
7
|
+
alter type passcode_type add value 'Continue'
|
|
8
|
+
`);
|
|
9
|
+
},
|
|
10
|
+
down: async (pool) => {
|
|
11
|
+
await pool.query((0, slonik_1.sql) `
|
|
12
|
+
drop type passcode_type
|
|
13
|
+
create type passcode_type as enum ('SignIn', 'Register', 'ForgotPassword');
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
exports.default = alteration;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OidcClientMetadata, CustomClientMetadata, RoleNames, GeneratedSchema } from '../foundations';
|
|
1
|
+
import type { OidcClientMetadata, CustomClientMetadata, RoleNames, GeneratedSchema } from '../foundations';
|
|
2
2
|
import { ApplicationType } from './custom-types';
|
|
3
3
|
export declare type CreateApplication = {
|
|
4
4
|
id: string;
|
|
@@ -7,7 +7,8 @@ export declare enum ApplicationType {
|
|
|
7
7
|
export declare enum PasscodeType {
|
|
8
8
|
SignIn = "SignIn",
|
|
9
9
|
Register = "Register",
|
|
10
|
-
ForgotPassword = "ForgotPassword"
|
|
10
|
+
ForgotPassword = "ForgotPassword",
|
|
11
|
+
Continue = "Continue"
|
|
11
12
|
}
|
|
12
13
|
export declare enum SignInMode {
|
|
13
14
|
SignIn = "SignIn",
|
|
@@ -14,6 +14,7 @@ var PasscodeType;
|
|
|
14
14
|
PasscodeType["SignIn"] = "SignIn";
|
|
15
15
|
PasscodeType["Register"] = "Register";
|
|
16
16
|
PasscodeType["ForgotPassword"] = "ForgotPassword";
|
|
17
|
+
PasscodeType["Continue"] = "Continue";
|
|
17
18
|
})(PasscodeType = exports.PasscodeType || (exports.PasscodeType = {}));
|
|
18
19
|
var SignInMode;
|
|
19
20
|
(function (SignInMode) {
|
package/lib/db-entries/log.d.ts
CHANGED
package/lib/db-entries/role.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Color, Branding, LanguageInfo, TermsOfUse,
|
|
1
|
+
import type { Color, Branding, LanguageInfo, TermsOfUse, SignIn, SignUp, ConnectorTargets, GeneratedSchema } from '../foundations';
|
|
2
2
|
import { SignInMode } from './custom-types';
|
|
3
3
|
export declare type CreateSignInExperience = {
|
|
4
4
|
id: string;
|
|
@@ -6,7 +6,8 @@ export declare type CreateSignInExperience = {
|
|
|
6
6
|
branding: Branding;
|
|
7
7
|
languageInfo: LanguageInfo;
|
|
8
8
|
termsOfUse: TermsOfUse;
|
|
9
|
-
|
|
9
|
+
signIn: SignIn;
|
|
10
|
+
signUp: SignUp;
|
|
10
11
|
socialSignInConnectorTargets?: ConnectorTargets;
|
|
11
12
|
signInMode?: SignInMode;
|
|
12
13
|
};
|
|
@@ -16,7 +17,8 @@ export declare type SignInExperience = {
|
|
|
16
17
|
branding: Branding;
|
|
17
18
|
languageInfo: LanguageInfo;
|
|
18
19
|
termsOfUse: TermsOfUse;
|
|
19
|
-
|
|
20
|
+
signIn: SignIn;
|
|
21
|
+
signUp: SignUp;
|
|
20
22
|
socialSignInConnectorTargets: ConnectorTargets;
|
|
21
23
|
signInMode: SignInMode;
|
|
22
24
|
};
|
|
@@ -11,7 +11,8 @@ const createGuard = zod_1.z.object({
|
|
|
11
11
|
branding: foundations_1.brandingGuard,
|
|
12
12
|
languageInfo: foundations_1.languageInfoGuard,
|
|
13
13
|
termsOfUse: foundations_1.termsOfUseGuard,
|
|
14
|
-
|
|
14
|
+
signIn: foundations_1.signInGuard,
|
|
15
|
+
signUp: foundations_1.signUpGuard,
|
|
15
16
|
socialSignInConnectorTargets: foundations_1.connectorTargetsGuard.optional(),
|
|
16
17
|
signInMode: zod_1.z.nativeEnum(custom_types_1.SignInMode).optional(),
|
|
17
18
|
});
|
|
@@ -21,7 +22,8 @@ const guard = zod_1.z.object({
|
|
|
21
22
|
branding: foundations_1.brandingGuard,
|
|
22
23
|
languageInfo: foundations_1.languageInfoGuard,
|
|
23
24
|
termsOfUse: foundations_1.termsOfUseGuard,
|
|
24
|
-
|
|
25
|
+
signIn: foundations_1.signInGuard,
|
|
26
|
+
signUp: foundations_1.signUpGuard,
|
|
25
27
|
socialSignInConnectorTargets: foundations_1.connectorTargetsGuard,
|
|
26
28
|
signInMode: zod_1.z.nativeEnum(custom_types_1.SignInMode),
|
|
27
29
|
});
|
|
@@ -34,7 +36,8 @@ exports.SignInExperiences = Object.freeze({
|
|
|
34
36
|
branding: 'branding',
|
|
35
37
|
languageInfo: 'language_info',
|
|
36
38
|
termsOfUse: 'terms_of_use',
|
|
37
|
-
|
|
39
|
+
signIn: 'sign_in',
|
|
40
|
+
signUp: 'sign_up',
|
|
38
41
|
socialSignInConnectorTargets: 'social_sign_in_connector_targets',
|
|
39
42
|
signInMode: 'sign_in_mode',
|
|
40
43
|
},
|
|
@@ -44,7 +47,8 @@ exports.SignInExperiences = Object.freeze({
|
|
|
44
47
|
'branding',
|
|
45
48
|
'languageInfo',
|
|
46
49
|
'termsOfUse',
|
|
47
|
-
'
|
|
50
|
+
'signIn',
|
|
51
|
+
'signUp',
|
|
48
52
|
'socialSignInConnectorTargets',
|
|
49
53
|
'signInMode',
|
|
50
54
|
],
|