Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

adapty

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adapty - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+23
-23
dist/commands/auth/login.js

@@ -6,2 +6,3 @@ import { Command } from '@oclif/core';

import { readConfig, writeConfig } from '../../lib/config.js';
import { ApiError } from '../../lib/errors.js';
function sleep(ms) {

@@ -39,3 +40,3 @@ return new Promise((resolve) => {

this.log('Waiting for authorization...');
let interval = device.interval * 1000;
let interval = Math.max((device.interval || 5) * 1000, 5000);
const deadline = Date.now() + device.expires_in * 1000;

@@ -60,2 +61,23 @@ let consecutiveErrors = 0;

catch (error) {
if (error instanceof ApiError) {
switch (error.errorCode) {
case 'authorization_pending': {
continue;
}
case 'slow_down': {
interval += 5000;
continue;
}
case 'access_denied': {
this.error('Authorization denied.', { exit: 1 });
break;
}
case 'expired_token': {
this.error('Code expired. Run `adapty auth login` again.', { exit: 1 });
break;
}
default:
// unexpected API error — fall through to network error handling
}
}
consecutiveErrors++;

@@ -71,24 +93,2 @@ if (consecutiveErrors >= 10) {

consecutiveErrors = 0;
if ('error' in result) {
switch (result.error) {
case 'access_denied': {
this.error('Authorization denied.', { exit: 1 });
break;
}
case 'authorization_pending': {
continue;
}
case 'slow_down': {
interval += 5000;
continue;
}
case 'expired_token': {
this.error('Code expired. Run `adapty auth login` again.', { exit: 1 });
break; // unreachable but satisfies linter
}
default: {
this.error(`Unexpected error: ${result.error}`, { exit: 1 });
}
}
}
if ('access_token' in result) {

@@ -95,0 +95,0 @@ await writeConfig({

@@ -215,122 +215,2 @@ {

},
"auth:login": {
"aliases": [],
"args": {},
"description": "Authenticate with Adapty via browser",
"examples": [
"<%= config.bin %> auth login"
],
"flags": {},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:login",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": false,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"login.js"
]
},
"auth:logout": {
"aliases": [],
"args": {},
"description": "Remove stored authentication token",
"examples": [
"<%= config.bin %> auth logout"
],
"flags": {
"json": {
"description": "Format output as json.",
"helpGroup": "GLOBAL",
"name": "json",
"allowNo": false,
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:logout",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": true,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"logout.js"
]
},
"auth:status": {
"aliases": [],
"args": {},
"description": "Show current authentication state (local only)",
"examples": [
"<%= config.bin %> auth status"
],
"flags": {
"json": {
"description": "Format output as json.",
"helpGroup": "GLOBAL",
"name": "json",
"allowNo": false,
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:status",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": true,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"status.js"
]
},
"auth:whoami": {
"aliases": [],
"args": {},
"description": "Show current user info from server (verifies token)",
"examples": [
"<%= config.bin %> auth whoami"
],
"flags": {
"json": {
"description": "Format output as json.",
"helpGroup": "GLOBAL",
"name": "json",
"allowNo": false,
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:whoami",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": true,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"whoami.js"
]
},
"apps:create": {

@@ -549,2 +429,122 @@ "aliases": [],

},
"auth:login": {
"aliases": [],
"args": {},
"description": "Authenticate with Adapty via browser",
"examples": [
"<%= config.bin %> auth login"
],
"flags": {},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:login",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": false,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"login.js"
]
},
"auth:logout": {
"aliases": [],
"args": {},
"description": "Remove stored authentication token",
"examples": [
"<%= config.bin %> auth logout"
],
"flags": {
"json": {
"description": "Format output as json.",
"helpGroup": "GLOBAL",
"name": "json",
"allowNo": false,
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:logout",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": true,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"logout.js"
]
},
"auth:status": {
"aliases": [],
"args": {},
"description": "Show current authentication state (local only)",
"examples": [
"<%= config.bin %> auth status"
],
"flags": {
"json": {
"description": "Format output as json.",
"helpGroup": "GLOBAL",
"name": "json",
"allowNo": false,
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:status",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": true,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"status.js"
]
},
"auth:whoami": {
"aliases": [],
"args": {},
"description": "Show current user info from server (verifies token)",
"examples": [
"<%= config.bin %> auth whoami"
],
"flags": {
"json": {
"description": "Format output as json.",
"helpGroup": "GLOBAL",
"name": "json",
"allowNo": false,
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hiddenAliases": [],
"id": "auth:whoami",
"pluginAlias": "adapty",
"pluginName": "adapty",
"pluginType": "core",
"strict": true,
"enableJsonFlag": true,
"isESM": true,
"relativePath": [
"dist",
"commands",
"auth",
"whoami.js"
]
},
"paywalls:create": {

@@ -770,8 +770,8 @@ "aliases": [],

},
"placements:create": {
"products:create": {
"aliases": [],
"args": {},
"description": "Create a placement with a paywall",
"description": "Create a product with vendor products per platform",
"examples": [
"<%= config.bin %> placements create --app UUID --name \"Default\" --developer-id default --paywall-id UUID"
"<%= config.bin %> products create --app UUID --name \"Monthly\" --access-level-id UUID --period monthly --ios-product-id com.example.monthly"
],

@@ -794,5 +794,5 @@ "flags": {

},
"developer-id": {
"description": "Developer ID for the placement",
"name": "developer-id",
"access-level-id": {
"description": "Access level ID (UUID)",
"name": "access-level-id",
"required": true,

@@ -803,4 +803,25 @@ "hasDynamicHelp": false,

},
"android-base-plan-id": {
"description": "Android base plan ID",
"name": "android-base-plan-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"android-product-id": {
"description": "Android product ID",
"name": "android-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"ios-product-id": {
"description": "iOS product ID",
"name": "ios-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"name": {
"description": "Placement name",
"description": "Product name",
"name": "name",

@@ -812,5 +833,5 @@ "required": true,

},
"paywall-id": {
"description": "Paywall ID (UUID)",
"name": "paywall-id",
"period": {
"description": "Subscription period (weekly, monthly, 2_months, 3_months, 6_months, yearly, lifetime)",
"name": "period",
"required": true,

@@ -824,3 +845,3 @@ "hasDynamicHelp": false,

"hiddenAliases": [],
"id": "placements:create",
"id": "products:create",
"pluginAlias": "adapty",

@@ -835,18 +856,18 @@ "pluginName": "adapty",

"commands",
"placements",
"products",
"create.js"
]
},
"placements:get": {
"products:get": {
"aliases": [],
"args": {
"placement_id": {
"description": "Placement ID (UUID)",
"name": "placement_id",
"product_id": {
"description": "Product ID (UUID)",
"name": "product_id",
"required": true
}
},
"description": "Get placement details",
"description": "Get product details",
"examples": [
"<%= config.bin %> placements get --app UUID 550e8400-e29b-41d4-a716-446655440000"
"<%= config.bin %> products get --app UUID 550e8400-e29b-41d4-a716-446655440000"
],

@@ -872,3 +893,3 @@ "flags": {

"hiddenAliases": [],
"id": "placements:get",
"id": "products:get",
"pluginAlias": "adapty",

@@ -883,12 +904,12 @@ "pluginName": "adapty",

"commands",
"placements",
"products",
"get.js"
]
},
"placements:list": {
"products:list": {
"aliases": [],
"args": {},
"description": "List placements for an app",
"description": "List products for an app",
"examples": [
"<%= config.bin %> placements list --app 550e8400-..."
"<%= config.bin %> products list --app 550e8400-..."
],

@@ -930,3 +951,3 @@ "flags": {

"hiddenAliases": [],
"id": "placements:list",
"id": "products:list",
"pluginAlias": "adapty",

@@ -941,18 +962,18 @@ "pluginName": "adapty",

"commands",
"placements",
"products",
"list.js"
]
},
"placements:update": {
"products:update": {
"aliases": [],
"args": {
"placement_id": {
"description": "Placement ID (UUID)",
"name": "placement_id",
"product_id": {
"description": "Product ID (UUID)",
"name": "product_id",
"required": true
}
},
"description": "Update a placement",
"description": "Update a product",
"examples": [
"<%= config.bin %> placements update --app UUID 550e8400-... --name \"Default\" --developer-id default --paywall-id UUID"
"<%= config.bin %> products update --app UUID 550e8400-... --name \"Monthly\" --access-level-id UUID --period monthly --ios-product-id com.example.monthly"
],

@@ -975,5 +996,5 @@ "flags": {

},
"developer-id": {
"description": "Developer ID for the placement",
"name": "developer-id",
"access-level-id": {
"description": "Access level ID (UUID)",
"name": "access-level-id",
"required": true,

@@ -984,4 +1005,25 @@ "hasDynamicHelp": false,

},
"android-base-plan-id": {
"description": "Android base plan ID",
"name": "android-base-plan-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"android-product-id": {
"description": "Android product ID",
"name": "android-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"ios-product-id": {
"description": "iOS product ID",
"name": "ios-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"name": {
"description": "Placement name",
"description": "Product name",
"name": "name",

@@ -993,5 +1035,5 @@ "required": true,

},
"paywall-id": {
"description": "Paywall ID (UUID)",
"name": "paywall-id",
"period": {
"description": "Subscription period (weekly, monthly, 2_months, 3_months, 6_months, yearly, lifetime)",
"name": "period",
"required": true,

@@ -1005,3 +1047,3 @@ "hasDynamicHelp": false,

"hiddenAliases": [],
"id": "placements:update",
"id": "products:update",
"pluginAlias": "adapty",

@@ -1016,12 +1058,12 @@ "pluginName": "adapty",

"commands",
"placements",
"products",
"update.js"
]
},
"products:create": {
"placements:create": {
"aliases": [],
"args": {},
"description": "Create a product with vendor products per platform",
"description": "Create a placement with a paywall",
"examples": [
"<%= config.bin %> products create --app UUID --name \"Monthly\" --access-level-id UUID --period monthly --ios-product-id com.example.monthly"
"<%= config.bin %> placements create --app UUID --name \"Default\" --developer-id default --paywall-id UUID"
],

@@ -1044,5 +1086,5 @@ "flags": {

},
"access-level-id": {
"description": "Access level ID (UUID)",
"name": "access-level-id",
"developer-id": {
"description": "Developer ID for the placement",
"name": "developer-id",
"required": true,

@@ -1053,25 +1095,4 @@ "hasDynamicHelp": false,

},
"android-base-plan-id": {
"description": "Android base plan ID",
"name": "android-base-plan-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"android-product-id": {
"description": "Android product ID",
"name": "android-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"ios-product-id": {
"description": "iOS product ID",
"name": "ios-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"name": {
"description": "Product name",
"description": "Placement name",
"name": "name",

@@ -1083,5 +1104,5 @@ "required": true,

},
"period": {
"description": "Subscription period (weekly, monthly, 2_months, 3_months, 6_months, yearly, lifetime)",
"name": "period",
"paywall-id": {
"description": "Paywall ID (UUID)",
"name": "paywall-id",
"required": true,

@@ -1095,3 +1116,3 @@ "hasDynamicHelp": false,

"hiddenAliases": [],
"id": "products:create",
"id": "placements:create",
"pluginAlias": "adapty",

@@ -1106,18 +1127,18 @@ "pluginName": "adapty",

"commands",
"products",
"placements",
"create.js"
]
},
"products:get": {
"placements:get": {
"aliases": [],
"args": {
"product_id": {
"description": "Product ID (UUID)",
"name": "product_id",
"placement_id": {
"description": "Placement ID (UUID)",
"name": "placement_id",
"required": true
}
},
"description": "Get product details",
"description": "Get placement details",
"examples": [
"<%= config.bin %> products get --app UUID 550e8400-e29b-41d4-a716-446655440000"
"<%= config.bin %> placements get --app UUID 550e8400-e29b-41d4-a716-446655440000"
],

@@ -1143,3 +1164,3 @@ "flags": {

"hiddenAliases": [],
"id": "products:get",
"id": "placements:get",
"pluginAlias": "adapty",

@@ -1154,12 +1175,12 @@ "pluginName": "adapty",

"commands",
"products",
"placements",
"get.js"
]
},
"products:list": {
"placements:list": {
"aliases": [],
"args": {},
"description": "List products for an app",
"description": "List placements for an app",
"examples": [
"<%= config.bin %> products list --app 550e8400-..."
"<%= config.bin %> placements list --app 550e8400-..."
],

@@ -1201,3 +1222,3 @@ "flags": {

"hiddenAliases": [],
"id": "products:list",
"id": "placements:list",
"pluginAlias": "adapty",

@@ -1212,18 +1233,18 @@ "pluginName": "adapty",

"commands",
"products",
"placements",
"list.js"
]
},
"products:update": {
"placements:update": {
"aliases": [],
"args": {
"product_id": {
"description": "Product ID (UUID)",
"name": "product_id",
"placement_id": {
"description": "Placement ID (UUID)",
"name": "placement_id",
"required": true
}
},
"description": "Update a product",
"description": "Update a placement",
"examples": [
"<%= config.bin %> products update --app UUID 550e8400-... --name \"Monthly\" --access-level-id UUID --period monthly --ios-product-id com.example.monthly"
"<%= config.bin %> placements update --app UUID 550e8400-... --name \"Default\" --developer-id default --paywall-id UUID"
],

@@ -1246,5 +1267,5 @@ "flags": {

},
"access-level-id": {
"description": "Access level ID (UUID)",
"name": "access-level-id",
"developer-id": {
"description": "Developer ID for the placement",
"name": "developer-id",
"required": true,

@@ -1255,25 +1276,4 @@ "hasDynamicHelp": false,

},
"android-base-plan-id": {
"description": "Android base plan ID",
"name": "android-base-plan-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"android-product-id": {
"description": "Android product ID",
"name": "android-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"ios-product-id": {
"description": "iOS product ID",
"name": "ios-product-id",
"hasDynamicHelp": false,
"multiple": false,
"type": "option"
},
"name": {
"description": "Product name",
"description": "Placement name",
"name": "name",

@@ -1285,5 +1285,5 @@ "required": true,

},
"period": {
"description": "Subscription period (weekly, monthly, 2_months, 3_months, 6_months, yearly, lifetime)",
"name": "period",
"paywall-id": {
"description": "Paywall ID (UUID)",
"name": "paywall-id",
"required": true,

@@ -1297,3 +1297,3 @@ "hasDynamicHelp": false,

"hiddenAliases": [],
"id": "products:update",
"id": "placements:update",
"pluginAlias": "adapty",

@@ -1308,3 +1308,3 @@ "pluginName": "adapty",

"commands",
"products",
"placements",
"update.js"

@@ -1314,3 +1314,3 @@ ]

},
"version": "0.1.1"
"version": "0.1.2"
}
{
"name": "adapty",
"description": "Adapty command line interface",
"version": "0.1.1",
"version": "0.1.2",
"author": "Adapty team <support@adapty.io>",

@@ -6,0 +6,0 @@ "bin": {