@supertokens-plugins/rownd-nodejs 0.3.0-beta.4 → 0.3.0-beta.5

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 CHANGED
@@ -2199,16 +2199,14 @@ function handleMigrate(deps) {
2199
2199
  if (!user) {
2200
2200
  const stUserImport = mapRowndUserToSuperTokens(rowndUser);
2201
2201
  try {
2202
- const importedUser = await importUser(
2203
- stUserImport,
2204
- deps.stConfig.supertokens
2205
- );
2206
- superTokensUserId = importedUser.id;
2207
- if (importedUser.loginMethods[0]?.recipeUserId) {
2208
- recipeUserId = import_supertokens_node3.default.convertToRecipeUserId(
2209
- importedUser.loginMethods[0].recipeUserId
2210
- );
2202
+ await importUser(stUserImport, deps.stConfig.supertokens);
2203
+ clearSuperTokensCoreCallCache(userContext);
2204
+ user = await import_supertokens_node3.default.getUser(rowndUserId, userContext);
2205
+ if (!user) {
2206
+ throw new Error("Imported user could not be resolved");
2211
2207
  }
2208
+ superTokensUserId = user.id;
2209
+ recipeUserId = user.loginMethods[0]?.recipeUserId;
2212
2210
  } catch (err) {
2213
2211
  user = await import_supertokens_node3.default.getUser(rowndUserId, userContext);
2214
2212
  if (!user) {
@@ -2274,6 +2272,12 @@ function handleMigrate(deps) {
2274
2272
  }
2275
2273
  };
2276
2274
  }
2275
+ function clearSuperTokensCoreCallCache(userContext) {
2276
+ const cacheContext = userContext;
2277
+ if (cacheContext._default?.coreCallCache) {
2278
+ cacheContext._default.coreCallCache = {};
2279
+ }
2280
+ }
2277
2281
  function handleGetUser() {
2278
2282
  return async (_req, _res, session) => {
2279
2283
  const user = await getUserById(session.getUserId());
package/dist/index.mjs CHANGED
@@ -2176,16 +2176,14 @@ function handleMigrate(deps) {
2176
2176
  if (!user) {
2177
2177
  const stUserImport = mapRowndUserToSuperTokens(rowndUser);
2178
2178
  try {
2179
- const importedUser = await importUser(
2180
- stUserImport,
2181
- deps.stConfig.supertokens
2182
- );
2183
- superTokensUserId = importedUser.id;
2184
- if (importedUser.loginMethods[0]?.recipeUserId) {
2185
- recipeUserId = SuperTokens3.convertToRecipeUserId(
2186
- importedUser.loginMethods[0].recipeUserId
2187
- );
2179
+ await importUser(stUserImport, deps.stConfig.supertokens);
2180
+ clearSuperTokensCoreCallCache(userContext);
2181
+ user = await SuperTokens3.getUser(rowndUserId, userContext);
2182
+ if (!user) {
2183
+ throw new Error("Imported user could not be resolved");
2188
2184
  }
2185
+ superTokensUserId = user.id;
2186
+ recipeUserId = user.loginMethods[0]?.recipeUserId;
2189
2187
  } catch (err) {
2190
2188
  user = await SuperTokens3.getUser(rowndUserId, userContext);
2191
2189
  if (!user) {
@@ -2251,6 +2249,12 @@ function handleMigrate(deps) {
2251
2249
  }
2252
2250
  };
2253
2251
  }
2252
+ function clearSuperTokensCoreCallCache(userContext) {
2253
+ const cacheContext = userContext;
2254
+ if (cacheContext._default?.coreCallCache) {
2255
+ cacheContext._default.coreCallCache = {};
2256
+ }
2257
+ }
2254
2258
  function handleGetUser() {
2255
2259
  return async (_req, _res, session) => {
2256
2260
  const user = await getUserById(session.getUserId());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supertokens-plugins/rownd-nodejs",
3
- "version": "0.3.0-beta.4",
3
+ "version": "0.3.0-beta.5",
4
4
  "description": "Rownd User Migration Plugin for SuperTokens",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",