@supertokens-plugins/rownd-nodejs 0.3.0-beta.2 → 0.3.0-beta.3
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/dist/index.js +9 -7
- package/dist/index.mjs +9 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1648,13 +1648,9 @@ async function validateRowndToken(token) {
|
|
|
1648
1648
|
const tokenInfo = await client.validateToken(token);
|
|
1649
1649
|
return tokenInfo.user_id;
|
|
1650
1650
|
}
|
|
1651
|
-
async function
|
|
1651
|
+
async function fetchOptionalRowndUserInfo(userId) {
|
|
1652
1652
|
const client = getRowndClient();
|
|
1653
|
-
|
|
1654
|
-
if (!rowndUser) {
|
|
1655
|
-
throw new RowndPluginError("ROWND_USER_NOT_FOUND");
|
|
1656
|
-
}
|
|
1657
|
-
return rowndUser;
|
|
1653
|
+
return client.fetchUserInfo({ user_id: userId });
|
|
1658
1654
|
}
|
|
1659
1655
|
|
|
1660
1656
|
// src/supertokens-repository.ts
|
|
@@ -2188,9 +2184,15 @@ function handleMigrate(deps) {
|
|
|
2188
2184
|
const appVariantId = getRequestedAppVariantIdFromRequest(req);
|
|
2189
2185
|
assertRowndAppVariantIsConfigured(appVariantId);
|
|
2190
2186
|
rowndUserId = await validateRowndToken(parsed.token);
|
|
2187
|
+
const rowndUser = await fetchOptionalRowndUserInfo(rowndUserId);
|
|
2188
|
+
if (!rowndUser) {
|
|
2189
|
+
logDebugMessage(
|
|
2190
|
+
`Skipping migration because user does not exist in Rownd. tenantId: ${PUBLIC_TENANT_ID}, rowndUserId: ${rowndUserId}`
|
|
2191
|
+
);
|
|
2192
|
+
return { status: "OK" };
|
|
2193
|
+
}
|
|
2191
2194
|
user = await import_supertokens_node3.default.getUser(rowndUserId, userContext);
|
|
2192
2195
|
if (!user) {
|
|
2193
|
-
const rowndUser = await fetchRowndUserInfo(rowndUserId);
|
|
2194
2196
|
const stUserImport = mapRowndUserToSuperTokens(rowndUser);
|
|
2195
2197
|
try {
|
|
2196
2198
|
const importedUser = await importUser(
|
package/dist/index.mjs
CHANGED
|
@@ -1625,13 +1625,9 @@ async function validateRowndToken(token) {
|
|
|
1625
1625
|
const tokenInfo = await client.validateToken(token);
|
|
1626
1626
|
return tokenInfo.user_id;
|
|
1627
1627
|
}
|
|
1628
|
-
async function
|
|
1628
|
+
async function fetchOptionalRowndUserInfo(userId) {
|
|
1629
1629
|
const client = getRowndClient();
|
|
1630
|
-
|
|
1631
|
-
if (!rowndUser) {
|
|
1632
|
-
throw new RowndPluginError("ROWND_USER_NOT_FOUND");
|
|
1633
|
-
}
|
|
1634
|
-
return rowndUser;
|
|
1630
|
+
return client.fetchUserInfo({ user_id: userId });
|
|
1635
1631
|
}
|
|
1636
1632
|
|
|
1637
1633
|
// src/supertokens-repository.ts
|
|
@@ -2165,9 +2161,15 @@ function handleMigrate(deps) {
|
|
|
2165
2161
|
const appVariantId = getRequestedAppVariantIdFromRequest(req);
|
|
2166
2162
|
assertRowndAppVariantIsConfigured(appVariantId);
|
|
2167
2163
|
rowndUserId = await validateRowndToken(parsed.token);
|
|
2164
|
+
const rowndUser = await fetchOptionalRowndUserInfo(rowndUserId);
|
|
2165
|
+
if (!rowndUser) {
|
|
2166
|
+
logDebugMessage(
|
|
2167
|
+
`Skipping migration because user does not exist in Rownd. tenantId: ${PUBLIC_TENANT_ID}, rowndUserId: ${rowndUserId}`
|
|
2168
|
+
);
|
|
2169
|
+
return { status: "OK" };
|
|
2170
|
+
}
|
|
2168
2171
|
user = await SuperTokens3.getUser(rowndUserId, userContext);
|
|
2169
2172
|
if (!user) {
|
|
2170
|
-
const rowndUser = await fetchRowndUserInfo(rowndUserId);
|
|
2171
2173
|
const stUserImport = mapRowndUserToSuperTokens(rowndUser);
|
|
2172
2174
|
try {
|
|
2173
2175
|
const importedUser = await importUser(
|