@supertokens-plugins/rownd-nodejs 0.3.0-beta.8 → 0.5.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 CHANGED
@@ -15,7 +15,7 @@ npm install @supertokens-plugins/rownd-nodejs
15
15
  Initialize the plugin in your SuperTokens backend configuration.
16
16
 
17
17
  > [!IMPORTANT]
18
- > This plugin requires the `Session` and `UserMetadata` recipes to be initialized in your SuperTokens configuration.
18
+ > This plugin always requires the `Session` and `UserMetadata` recipes. Enable `Passwordless` for email/phone, `ThirdParty` for Google/Apple/guest/anonymous users, `EmailVerification` for verified email profile updates, and `AccountLinking` when migrated Rownd users may have multiple supported login methods.
19
19
 
20
20
  ```typescript
21
21
  import SuperTokens from "supertokens-node";
@@ -128,17 +128,18 @@ const magicLink = await createMagicLinkWithConfirmationBypass({
128
128
 
129
129
  Pass exactly one of `email` or `phoneNumber`. The helper returns the rewritten magic link with `bypassDeviceConfirmation=true`.
130
130
 
131
- Before skipping the cross-device confirmation prompt, the frontend should validate the callback against the plugin:
131
+ Before skipping the cross-device confirmation prompt, the frontend should validate the callback against the plugin. Routes are mounted under your SuperTokens `apiBasePath`, which defaults to `/auth`.
132
132
 
133
- - **POST** `/plugin/passwordless-cross-device-confirmation/validate`
133
+ - **POST** `{apiBasePath}/plugin/passwordless-cross-device-confirmation/validate`
134
+ - **Default**: `POST /auth/plugin/passwordless-cross-device-confirmation/validate`
134
135
  - **Body**: `{ "clientDomain": "browser", "redirectToPath": "/profile", "appVariantId": "optional_variant" }`
135
136
  - **Success response**: `{ "status": "OK", "bypass": true }`
136
137
 
137
138
  If validation fails, the frontend should show the normal cross-device confirmation prompt.
138
139
 
139
- ## API Endpoint
140
+ ## API Endpoints
140
141
 
141
- The plugin exposes a single endpoint:
142
+ Routes are mounted under your SuperTokens `apiBasePath`, which defaults to `/auth`. The migration endpoint is the main Rownd-to-SuperTokens session handoff endpoint; the plugin also exposes Rownd-compatible app config, guest, user, metadata, field, and sign-out endpoints under `{apiBasePath}/plugin/rownd/...`.
142
143
 
143
144
  > [!IMPORTANT]
144
145
  > The plugin always migrates users and sessions into the `public` tenant.
@@ -146,7 +147,8 @@ The plugin exposes a single endpoint:
146
147
 
147
148
  ### Migrate
148
149
 
149
- - **POST** `/plugin/rownd/migrate`
150
+ - **POST** `{apiBasePath}/plugin/rownd/migrate`
151
+ - **Default**: `POST /auth/plugin/rownd/migrate`
150
152
  - **Headers**: `Authorization: Bearer <Rownd_JWT>`. Header-token clients should also send `rid: session`, `fdi-version: 1.18`, and `st-auth-mode: header`.
151
153
  - **Description**: Validates the Rownd JWT, ensures the user is migrated to SuperTokens in the `public` tenant, syncs Rownd user data to SuperTokens UserMetadata, and then creates a new SuperTokens session for that user. Header-token clients must receive `st-access-token`, `st-refresh-token`, and `front-token` response headers.
152
154
 
@@ -164,13 +166,11 @@ The plugin emits exactly one telemetry event per `/migrate` call result.
164
166
 
165
167
  Each event includes endpoint outcome data only (not step-by-step events), including:
166
168
 
167
- - `operation`: `migrate`
168
169
  - `outcome`: `success` or `error`
169
170
  - `durationMs`
170
171
  - `tenantId` (when available)
171
172
  - `rowndUserId` (when available)
172
173
  - `superTokensUserId` (when available)
173
- - `migrationState`: `already-migrated` or `imported-during-request` (when available)
174
174
  - for errors: `error.message` and `error.name`
175
175
 
176
176
  > [!NOTE]
@@ -228,20 +228,21 @@ RowndMigrationPlugin.init({
228
228
 
229
229
  The package includes a bulk migration script for importing Rownd users into SuperTokens.
230
230
 
231
- The script now runs directly from a YAML config file that lives beside the script:
232
-
233
- - config file: `packages/rownd-nodejs/scripts/config.yaml`
234
- - script: `packages/rownd-nodejs/scripts/bulkMigrate.ts`
231
+ The script runs from a YAML config file generated from the included template.
235
232
 
236
233
  ### Usage
237
234
 
238
- 1. Edit `scripts/config.yaml` with your Rownd and SuperTokens credentials.
239
- 2. Run the script from `packages/rownd-nodejs`.
235
+ 1. Generate a local config file.
236
+ 2. Edit the config with your Rownd and SuperTokens credentials.
237
+ 3. Run the migration.
240
238
 
241
239
  ```bash
242
- npm run bulk-import
240
+ npx rownd-nodejs init-config --output ./rownd-bulk-migrate.yaml
241
+ npx rownd-nodejs bulk-migrate --config ./rownd-bulk-migrate.yaml
243
242
  ```
244
243
 
244
+ For repo-local development, use `npm run cli -- bulk-migrate --config ./rownd-bulk-migrate.yaml` from `packages/rownd-nodejs`.
245
+
245
246
  The script:
246
247
 
247
248
  - fetches users from Rownd page by page
@@ -252,5 +253,5 @@ The script:
252
253
 
253
254
  ### Config File
254
255
 
255
- All runtime config is read from `scripts/config.yaml`.
256
+ All runtime config is read from the YAML file passed with `--config`.
256
257
  There is no environment variable parsing.
package/dist/index.js CHANGED
@@ -639,11 +639,12 @@ function createLoggerConfig() {
639
639
  }
640
640
  var config = createLoggerConfig();
641
641
  var logger = common_default(config);
642
- if (logger.formatters) {
643
- logger.formatters.o = function(value) {
642
+ var formatters = logger.formatters;
643
+ if (formatters) {
644
+ formatters.o = function(value) {
644
645
  return import_util.default.inspect(value, { colors: this.useColors, compact: true }).split("\n").map((line) => line.trim()).join(" ");
645
646
  };
646
- logger.formatters.O = function(value) {
647
+ formatters.O = function(value) {
647
648
  return import_util.default.inspect(value, { colors: this.useColors, compact: false });
648
649
  };
649
650
  }
package/dist/index.mjs CHANGED
@@ -616,11 +616,12 @@ function createLoggerConfig() {
616
616
  }
617
617
  var config = createLoggerConfig();
618
618
  var logger = common_default(config);
619
- if (logger.formatters) {
620
- logger.formatters.o = function(value) {
619
+ var formatters = logger.formatters;
620
+ if (formatters) {
621
+ formatters.o = function(value) {
621
622
  return util.inspect(value, { colors: this.useColors, compact: true }).split("\n").map((line) => line.trim()).join(" ");
622
623
  };
623
- logger.formatters.O = function(value) {
624
+ formatters.O = function(value) {
624
625
  return util.inspect(value, { colors: this.useColors, compact: false });
625
626
  };
626
627
  }
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "@supertokens-plugins/rownd-nodejs",
3
- "version": "0.3.0-beta.8",
3
+ "version": "0.5.0",
4
4
  "description": "Rownd User Migration Plugin for SuperTokens",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
8
16
  "bin": {
9
17
  "rownd-nodejs": "./dist/cli.js"
10
18
  },
@@ -15,6 +23,8 @@
15
23
  "build": "rm -rf dist && tsup",
16
24
  "cli": "npm run build && node dist/cli.js",
17
25
  "lint": "eslint ./src --ext .ts",
26
+ "prepack": "npm run build",
27
+ "typecheck": "tsc --noEmit",
18
28
  "test": "TEST_MODE=testing vitest run --pool=forks"
19
29
  },
20
30
  "keywords": [