Skip to content

Commit a5ed213

Browse files
Merge pull request #814 from supertokens/type-check-schema
fix: type checks and schema
2 parents cc1775f + e2e9228 commit a5ed213

File tree

45 files changed

+84
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+84
-76
lines changed

v2/community/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/community/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/emailpassword/common-customizations/multi-tenancy/new-tenant-config.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function createNewTenant() {
3636

3737
// highlight-start
3838
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
39-
emailPasswordEnabled: true,
39+
firstFactors: ["emailpassword"]
4040
});
4141
// highlight-end
4242

@@ -138,7 +138,7 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multite
138138
--header 'Content-Type: application/json' \
139139
--data-raw '{
140140
"tenantId": "customer1",
141-
"emailPasswordEnabled": true
141+
"firstFactors": ["emailpassword"]
142142
}'
143143
```
144144

v2/emailpassword/custom-ui/init/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/emailpassword/custom-ui/init/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/emailpassword/custom-ui/multitenant-login.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function createNewTenant() {
5353

5454
// highlight-start
5555
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
56-
emailPasswordEnabled: true,
56+
firstFactors: ["emailpassword"]
5757
});
5858
// highlight-end
5959

@@ -155,7 +155,7 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multite
155155
--header 'Content-Type: application/json' \
156156
--data-raw '{
157157
"tenantId": "customer1",
158-
"emailPasswordEnabled": true
158+
"firstFactors": ["emailpassword"]
159159
}'
160160
```
161161

v2/emailpassword/pre-built-ui/multitenant-login.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async function createNewTenant() {
5050

5151
// highlight-start
5252
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
53-
emailPasswordEnabled: true,
53+
firstFactors: ["emailpassword"]
5454
});
5555
// highlight-end
5656

@@ -152,7 +152,7 @@ curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multite
152152
--header 'Content-Type: application/json' \
153153
--data-raw '{
154154
"tenantId": "customer1",
155-
"emailPasswordEnabled": true
155+
"firstFactors": ["emailpassword"]
156156
}'
157157
```
158158

v2/emailpassword/pre-built-ui/setup/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/emailpassword/pre-built-ui/setup/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/mfa/email-sms-otp/otp-for-all-users.mdx

+1-7
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,6 @@ import MultiFactorAuth from "supertokens-node/recipe/multifactorauth"
529529

530530
async function createNewTenant() {
531531
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
532-
emailPasswordEnabled: true,
533-
thirdPartyEnabled: true,
534-
passwordlessEnabled: true,
535532
firstFactors: [
536533
MultiFactorAuth.FactorIds.EMAILPASSWORD,
537534
MultiFactorAuth.FactorIds.THIRDPARTY
@@ -568,14 +565,11 @@ Coming soon. In the meantime, checkout the [legacy method](../legacy-method/how-
568565
<CoreInjector defaultValue="http://localhost:3567" showAppId={false}>
569566

570567
```bash
571-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant' \
568+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant/v2' \
572569
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
573570
--header 'Content-Type: application/json' \
574571
--data-raw '{
575572
"tenantId": "customer1",
576-
"emailPasswordEnabled": true,
577-
"thirdPartyEnabled": true,
578-
"passwordlessEnabled": true,
579573
"firstFactors": ["emailpassword", "thirdparty"],
580574
"requiredSecondaryFactors": ["otp-email"]
581575
}'

v2/mfa/totp/totp-for-all-users.mdx

+1-5
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,6 @@ import MultiFactorAuth from "supertokens-node/recipe/multifactorauth"
825825

826826
async function createNewTenant() {
827827
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
828-
emailPasswordEnabled: true,
829-
thirdPartyEnabled: true,
830828
firstFactors: [
831829
MultiFactorAuth.FactorIds.EMAILPASSWORD,
832830
MultiFactorAuth.FactorIds.THIRDPARTY
@@ -863,13 +861,11 @@ Coming soon.
863861
<CoreInjector defaultValue="http://localhost:3567" showAppId={false}>
864862

865863
```bash
866-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant' \
864+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/appid-<APP_ID>/recipe/multitenancy/tenant/v2' \
867865
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
868866
--header 'Content-Type: application/json' \
869867
--data-raw '{
870868
"tenantId": "customer1",
871-
"emailPasswordEnabled": true,
872-
"thirdPartyEnabled": true,
873869
"firstFactors": ["emailpassword", "thirdparty"],
874870
"requiredSecondaryFactors": ["totp"]
875871
}'

v2/passwordless/common-customizations/multi-tenancy/new-tenant-config.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ The configuration mapped to each tenant contains information about which login m
3131

3232
```tsx
3333
import Multitenancy from "supertokens-node/recipe/multitenancy";
34+
import { FactorIds } from "supertokens-node/recipe/multifactorauth"
3435

3536
async function createNewTenant() {
3637

3738
// highlight-start
3839
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
39-
passwordlessEnabled: true,
40+
firstFactors: [FactorIds.OTP_PHONE, FactorIds.OTP_EMAIL, FactorIds.LINK_PHONE, FactorIds.LINK_EMAIL]
4041
});
4142
// highlight-end
4243

@@ -131,12 +132,12 @@ else:
131132
<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>
132133

133134
```bash
134-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
135+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
135136
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
136137
--header 'Content-Type: application/json' \
137138
--data-raw '{
138139
"tenantId": "customer1",
139-
"passwordlessEnabled": true
140+
"firstFactors": ["otp-email", "otp-phone", "link-email", "link-phone"]
140141
}'
141142
```
142143

v2/passwordless/custom-ui/init/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/passwordless/custom-ui/init/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/passwordless/custom-ui/multitenant-login.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ You can create a new tenant using our backend SDKs or via a `cURL` command to th
4848

4949
```tsx
5050
import Multitenancy from "supertokens-node/recipe/multitenancy";
51+
import { FactorIds } from "supertokens-node/recipe/multifactorauth"
5152

5253
async function createNewTenant() {
5354

5455
// highlight-start
5556
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
56-
passwordlessEnabled: true,
57+
firstFactors: [FactorIds.OTP_PHONE, FactorIds.OTP_EMAIL, FactorIds.LINK_PHONE, FactorIds.LINK_EMAIL]
5758
});
5859
// highlight-end
5960

@@ -148,12 +149,12 @@ else:
148149
<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>
149150

150151
```bash
151-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
152+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
152153
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
153154
--header 'Content-Type: application/json' \
154155
--data-raw '{
155156
"tenantId": "customer1",
156-
"passwordlessEnabled": true
157+
"firstFactors": ["otp-email", "otp-phone", "link-email", "link-phone"]
157158
}'
158159
```
159160

v2/passwordless/pre-built-ui/multitenant-login.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ You can create a new tenant using our backend SDKs or via a `cURL` command to th
4545

4646
```tsx
4747
import Multitenancy from "supertokens-node/recipe/multitenancy";
48+
import { FactorIds } from "supertokens-node/recipe/multifactorauth"
4849

4950
async function createNewTenant() {
5051

5152
// highlight-start
5253
let resp = await Multitenancy.createOrUpdateTenant("customer1", {
53-
passwordlessEnabled: true,
54+
firstFactors: [FactorIds.OTP_PHONE, FactorIds.OTP_EMAIL, FactorIds.LINK_PHONE, FactorIds.LINK_EMAIL]
5455
});
5556
// highlight-end
5657

@@ -145,12 +146,12 @@ else:
145146
<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>
146147

147148
```bash
148-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
149+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
149150
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
150151
--header 'Content-Type: application/json' \
151152
--data-raw '{
152153
"tenantId": "customer1",
153-
"passwordlessEnabled": true
154+
"firstFactors": ["otp-email", "otp-phone", "link-email", "link-phone"]
154155
}'
155156
```
156157

v2/passwordless/pre-built-ui/setup/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/passwordless/pre-built-ui/setup/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/session/quick-setup/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/session/quick-setup/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/src/plugins/codeTypeChecking/jsEnv/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"socket.io": "^4.6.1",
5757
"socketio": "^1.0.0",
5858
"supertokens-auth-react": "^0.42.0",
59-
"supertokens-node": "github:supertokens/supertokens-node#19.0",
59+
"supertokens-node": "^19.0.0",
6060
"supertokens-node7": "npm:[email protected]",
6161
"supertokens-react-native": "^5.0.0",
6262
"supertokens-web-js": "^0.12.0",

v2/thirdparty/common-customizations/multi-tenancy/new-tenant-config.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Multiteancy from "supertokens-node/recipe/multitenancy";
3333

3434
async function createTenant() {
3535
let resp = await Multiteancy.createOrUpdateTenant("customer1", {
36-
thirdPartyEnabled: true,
36+
firstFactors: ["thirdparty"]
3737
});
3838

3939
if (resp.createdNew) {
@@ -127,12 +127,12 @@ else:
127127
<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>
128128

129129
```bash
130-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
130+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
131131
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
132132
--header 'Content-Type: application/json' \
133133
--data-raw '{
134134
"tenantId": "customer1",
135-
"thirdPartyEnabled": true
135+
"firstFactors": ["thirdparty"]
136136
}'
137137
```
138138

v2/thirdparty/common-customizations/saml/with-boxyhq/integration-steps.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ import Multiteancy from "supertokens-node/recipe/multitenancy";
120120

121121
async function createTenant() {
122122
let resp = await Multiteancy.createOrUpdateTenant("customer1", {
123-
thirdPartyEnabled: true,
123+
firstFactors: ["thirdparty"]
124124
});
125125

126126
if (resp.createdNew) {
@@ -214,12 +214,12 @@ else:
214214
<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>
215215

216216
```bash
217-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
217+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
218218
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
219219
--header 'Content-Type: application/json' \
220220
--data-raw '{
221221
"tenantId": "customer1",
222-
"thirdPartyEnabled": true
222+
"firstFactors": ["thirdparty"]
223223
}'
224224
```
225225

v2/thirdparty/custom-ui/init/database-setup/mysql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ CREATE TABLE `tenant_configs` (
117117
`email_password_enabled` tinyint(1) DEFAULT NULL,
118118
`passwordless_enabled` tinyint(1) DEFAULT NULL,
119119
`third_party_enabled` tinyint(1) DEFAULT NULL,
120+
`is_first_factors_null` tinyint(1) DEFAULT NULL,
120121
PRIMARY KEY (`connection_uri_domain`,`app_id`,`tenant_id`)
121122
);
122123

v2/thirdparty/custom-ui/init/database-setup/postgresql.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ CREATE TABLE tenant_configs (
124124
email_password_enabled BOOLEAN,
125125
passwordless_enabled BOOLEAN,
126126
third_party_enabled BOOLEAN,
127+
is_first_factors_null BOOLEAN,
127128
CONSTRAINT tenant_configs_pkey PRIMARY KEY (connection_uri_domain, app_id, tenant_id)
128129
);
129130

v2/thirdparty/custom-ui/multitenant-login.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import Multiteancy from "supertokens-node/recipe/multitenancy";
6262

6363
async function createTenant() {
6464
let resp = await Multiteancy.createOrUpdateTenant("customer1", {
65-
thirdPartyEnabled: true,
65+
firstFactors: ["thirdparty"]
6666
});
6767

6868
if (resp.createdNew) {
@@ -156,12 +156,12 @@ else:
156156
<CoreInjector defaultValue="http://localhost:3567" showTenantId={false}>
157157

158158
```bash
159-
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant' \
159+
curl --location --request PUT '^{coreInjector_uri_without_quotes}/recipe/multitenancy/tenant/v2' \
160160
--header 'api-key: ^{coreInjector_api_key_without_quotes}' \
161161
--header 'Content-Type: application/json' \
162162
--data-raw '{
163163
"tenantId": "customer1",
164-
"thirdPartyEnabled": true
164+
"firstFactors": ["thirdparty"]
165165
}'
166166
```
167167

0 commit comments

Comments
 (0)