Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

namirasoft-account

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namirasoft-account - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

.nsdkg-dir-deep

20

dist/index.d.ts

@@ -10,8 +10,6 @@ export * from "./NamirasoftAccountBaseHeader";

export * from "./NamirasoftAccountServerEmail";
export * from "./NamirasoftAccountServerMessage";
export * from "./NamirasoftAccountServerHealthz";
export * from "./NamirasoftAccountServerPassword";
export * from "./NamirasoftAccountServerPhone";
export * from "./NamirasoftAccountServerProduct";
export * from "./NamirasoftAccountServerSession";
export * from "./NamirasoftAccountServerStrike";
export * from "./NamirasoftAccountServerUser";

@@ -22,8 +20,10 @@ export * from "./NamirasoftAccountToken";

export * from "./TokenManager";
export * from "./row/Device";
export * from "./row/IPInfo";
export * from "./row/Message";
export * from "./row/Product";
export * from "./row/Session";
export * from "./row/Strike";
export * from "./row/User";
export * from "./row/DeviceRow";
export * from "./row/DeviceRow_Input";
export * from "./row/DeviceRow_Output";
export * from "./row/SessionRow";
export * from "./row/SessionRow_Input";
export * from "./row/SessionRow_Output";
export * from "./row/UserRow";
export * from "./row/UserRow_Input";
export * from "./row/UserRow_Output";

@@ -26,8 +26,6 @@ "use strict";

__exportStar(require("./NamirasoftAccountServerEmail"), exports);
__exportStar(require("./NamirasoftAccountServerMessage"), exports);
__exportStar(require("./NamirasoftAccountServerHealthz"), exports);
__exportStar(require("./NamirasoftAccountServerPassword"), exports);
__exportStar(require("./NamirasoftAccountServerPhone"), exports);
__exportStar(require("./NamirasoftAccountServerProduct"), exports);
__exportStar(require("./NamirasoftAccountServerSession"), exports);
__exportStar(require("./NamirasoftAccountServerStrike"), exports);
__exportStar(require("./NamirasoftAccountServerUser"), exports);

@@ -38,9 +36,11 @@ __exportStar(require("./NamirasoftAccountToken"), exports);

__exportStar(require("./TokenManager"), exports);
__exportStar(require("./row/Device"), exports);
__exportStar(require("./row/IPInfo"), exports);
__exportStar(require("./row/Message"), exports);
__exportStar(require("./row/Product"), exports);
__exportStar(require("./row/Session"), exports);
__exportStar(require("./row/Strike"), exports);
__exportStar(require("./row/User"), exports);
__exportStar(require("./row/DeviceRow"), exports);
__exportStar(require("./row/DeviceRow_Input"), exports);
__exportStar(require("./row/DeviceRow_Output"), exports);
__exportStar(require("./row/SessionRow"), exports);
__exportStar(require("./row/SessionRow_Input"), exports);
__exportStar(require("./row/SessionRow_Output"), exports);
__exportStar(require("./row/UserRow"), exports);
__exportStar(require("./row/UserRow_Input"), exports);
__exportStar(require("./row/UserRow_Output"), exports);
//# sourceMappingURL=index.js.map
import { NamirasoftAccountServerCountry } from "./NamirasoftAccountServerCountry";
import { NamirasoftAccountServerDevice } from "./NamirasoftAccountServerDevice";
import { NamirasoftAccountServerEmail } from "./NamirasoftAccountServerEmail";
import { NamirasoftAccountServerMessage } from "./NamirasoftAccountServerMessage";
import { NamirasoftAccountServerHealthz } from "./NamirasoftAccountServerHealthz";
import { NamirasoftAccountServerPassword } from "./NamirasoftAccountServerPassword";
import { NamirasoftAccountServerPhone } from "./NamirasoftAccountServerPhone";
import { NamirasoftAccountServerProduct } from "./NamirasoftAccountServerProduct";
import { NamirasoftAccountServerSession } from "./NamirasoftAccountServerSession";
import { NamirasoftAccountServerStrike } from "./NamirasoftAccountServerStrike";
import { NamirasoftAccountServerUser } from "./NamirasoftAccountServerUser";

@@ -14,13 +12,11 @@ import { TokenManager } from "./TokenManager";

manager: TokenManager;
healthz: NamirasoftAccountServerHealthz;
country: NamirasoftAccountServerCountry;
device: NamirasoftAccountServerDevice;
email: NamirasoftAccountServerEmail;
message: NamirasoftAccountServerMessage;
password: NamirasoftAccountServerPassword;
phone: NamirasoftAccountServerPhone;
product: NamirasoftAccountServerProduct;
session: NamirasoftAccountServerSession;
strike: NamirasoftAccountServerStrike;
user: NamirasoftAccountServerUser;
constructor(manager: TokenManager, onError: (erorr: Error) => void);
constructor(manager: TokenManager, onError: (error: Error) => void);
}

@@ -7,8 +7,6 @@ "use strict";

const NamirasoftAccountServerEmail_1 = require("./NamirasoftAccountServerEmail");
const NamirasoftAccountServerMessage_1 = require("./NamirasoftAccountServerMessage");
const NamirasoftAccountServerHealthz_1 = require("./NamirasoftAccountServerHealthz");
const NamirasoftAccountServerPassword_1 = require("./NamirasoftAccountServerPassword");
const NamirasoftAccountServerPhone_1 = require("./NamirasoftAccountServerPhone");
const NamirasoftAccountServerProduct_1 = require("./NamirasoftAccountServerProduct");
const NamirasoftAccountServerSession_1 = require("./NamirasoftAccountServerSession");
const NamirasoftAccountServerStrike_1 = require("./NamirasoftAccountServerStrike");
const NamirasoftAccountServerUser_1 = require("./NamirasoftAccountServerUser");

@@ -18,11 +16,9 @@ class NamirasoftAccountServer {

this.manager = manager;
this.healthz = new NamirasoftAccountServerHealthz_1.NamirasoftAccountServerHealthz(manager, onError);
this.country = new NamirasoftAccountServerCountry_1.NamirasoftAccountServerCountry(manager, onError);
this.device = new NamirasoftAccountServerDevice_1.NamirasoftAccountServerDevice(manager, onError);
this.email = new NamirasoftAccountServerEmail_1.NamirasoftAccountServerEmail(manager, onError);
this.message = new NamirasoftAccountServerMessage_1.NamirasoftAccountServerMessage(manager, onError);
this.password = new NamirasoftAccountServerPassword_1.NamirasoftAccountServerPassword(manager, onError);
this.phone = new NamirasoftAccountServerPhone_1.NamirasoftAccountServerPhone(manager, onError);
this.product = new NamirasoftAccountServerProduct_1.NamirasoftAccountServerProduct(manager, onError);
this.session = new NamirasoftAccountServerSession_1.NamirasoftAccountServerSession(manager, onError);
this.strike = new NamirasoftAccountServerStrike_1.NamirasoftAccountServerStrike(manager, onError);
this.user = new NamirasoftAccountServerUser_1.NamirasoftAccountServerUser(manager, onError);

@@ -29,0 +25,0 @@ }

@@ -0,5 +1,5 @@

import { NamirasoftServerBase } from "./NamirasoftServerBase";
import { TokenManager } from "./TokenManager";
import { NamirasoftServerBase } from "./NamirasoftServerBase";
export declare class NamirasoftAccountServerBase extends NamirasoftServerBase {
constructor(manager: TokenManager, onError: (erorr: Error) => void);
constructor(manager: TokenManager, onError: (error: Error) => void);
}

@@ -7,3 +7,3 @@ "use strict";

constructor(manager, onError) {
super('https://account.namirasoft.com/api/v1', manager, onError);
super(`https://account.namirasoft.com/api/v1`, manager, onError);
}

@@ -10,0 +10,0 @@ }

import { Country } from "namirasoft-core";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
export declare class NamirasoftAccountServerCountry extends NamirasoftAccountServerBase {
getAll(): Promise<Country[]>;
GetAll(): Promise<Country[]>;
}

@@ -15,5 +15,6 @@ "use strict";

class NamirasoftAccountServerCountry extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
getAll() {
GetAll() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/country/all");
let path = `/country/all`;
let { data } = yield this._get(path, {});
return data;

@@ -20,0 +21,0 @@ });

@@ -1,7 +0,7 @@

import { Device } from "./row/Device";
import { DeviceRow } from "./row/DeviceRow";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
export declare class NamirasoftAccountServerDevice extends NamirasoftAccountServerBase {
getAll(): Promise<Device[]>;
get(device_id: number): Promise<Device>;
delete(device_id: number): Promise<void>;
GetAll(): Promise<DeviceRow[]>;
Get(id: string): Promise<DeviceRow>;
Delete(id: string): Promise<void>;
}

@@ -15,17 +15,21 @@ "use strict";

class NamirasoftAccountServerDevice extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
getAll() {
GetAll() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/device/all");
let path = `/device/all`;
let { data } = yield this._get(path, {});
return data;
});
}
get(device_id) {
Get(id) {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/device/" + device_id);
let path = `/device/${id}`;
let { data } = yield this._get(path, {});
return data;
});
}
delete(device_id) {
Delete(id) {
return __awaiter(this, void 0, void 0, function* () {
yield this._delete("/device/" + device_id);
let path = `/device/${id}`;
let { data } = yield this._delete(path, {});
return data;
});

@@ -32,0 +36,0 @@ }

import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
export declare class NamirasoftAccountServerEmail extends NamirasoftAccountServerBase {
request(): Promise<{
Request(): Promise<{
next_time: number;
error: (string | null);
}>;
verify(code: string): Promise<{
next_time: number;
}>;
Verify(body: {
code: string;
}): Promise<void>;
}

@@ -15,11 +15,13 @@ "use strict";

class NamirasoftAccountServerEmail extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
request() {
Request() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._post("/email/request");
let path = `/email/request`;
let { data } = yield this._post(path, {});
return data;
});
}
verify(code) {
Verify(body) {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._post("/email/verify", {}, { code });
let path = `/email/verify`;
let { data } = yield this._post(path, {}, body);
return data;

@@ -26,0 +28,0 @@ });

import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
export declare class NamirasoftAccountServerPassword extends NamirasoftAccountServerBase {
forget(email: string): Promise<{
Forget(body: {
email: string;
}): Promise<{
next_time: number;
error: (string | null);
}>;
new(user_id: number, hash: string, pass_new: string, pass_rep: string): Promise<{
next_time: number;
}>;
reset(pass_cur: string, pass_new: string, pass_rep: string): Promise<void>;
New(body: {
user_id: string;
hash: string;
pass_new: string;
pass_rep: string;
}): Promise<void>;
Reset(body: {
pass_cur: string;
pass_new: string;
pass_rep: string;
}): Promise<void>;
}

@@ -13,28 +13,23 @@ "use strict";

exports.NamirasoftAccountServerPassword = void 0;
const namirasoft_core_1 = require("namirasoft-core");
const NamirasoftAccountServerBase_1 = require("./NamirasoftAccountServerBase");
class NamirasoftAccountServerPassword extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
forget(email) {
Forget(body) {
return __awaiter(this, void 0, void 0, function* () {
email = namirasoft_core_1.StringOperation.repair(email);
let { data } = yield this._post("/password/forget", {}, {
email,
});
let path = `/password/forget`;
let { data } = yield this._post(path, {}, body);
return data;
});
}
new(user_id, hash, pass_new, pass_rep) {
New(body) {
return __awaiter(this, void 0, void 0, function* () {
hash = namirasoft_core_1.StringOperation.repair(hash);
let { data } = yield this._post("/password/new", {}, {
user_id, hash, pass_new, pass_rep
});
let path = `/password/new`;
let { data } = yield this._post(path, {}, body);
return data;
});
}
reset(pass_cur, pass_new, pass_rep) {
Reset(body) {
return __awaiter(this, void 0, void 0, function* () {
yield this._post("/password/reset", {}, {
pass_cur, pass_new, pass_rep
});
let path = `/password/reset`;
let { data } = yield this._post(path, {}, body);
return data;
});

@@ -41,0 +36,0 @@ }

import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
export declare class NamirasoftAccountServerPhone extends NamirasoftAccountServerBase {
request(): Promise<{
Request(): Promise<{
next_time: number;
error: (string | null);
}>;
verify(code: string): Promise<{
next_time: number;
}>;
Verify(body: {
code: string;
}): Promise<void>;
}

@@ -15,11 +15,13 @@ "use strict";

class NamirasoftAccountServerPhone extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
request() {
Request() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._post("/phone/request");
let path = `/phone/request`;
let { data } = yield this._post(path, {});
return data;
});
}
verify(code) {
Verify(body) {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._post("/phone/verify", {}, { code });
let path = `/phone/verify`;
let { data } = yield this._post(path, {}, body);
return data;

@@ -26,0 +28,0 @@ });

@@ -0,8 +1,17 @@

import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { NamirasoftAccountToken } from "./NamirasoftAccountToken";
import { Session } from "./row/Session";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { SessionRow } from "./row/SessionRow";
export declare class NamirasoftAccountServerSession extends NamirasoftAccountServerBase {
delete(session_id: string): Promise<void>;
get(): Promise<NamirasoftAccountToken>;
getAll(): Promise<Session[]>;
Current(): Promise<NamirasoftAccountToken>;
GetAll(): Promise<SessionRow[]>;
Get(id: string): Promise<SessionRow>;
Delete(id: string): Promise<void>;
Login(body: {
email: string;
password: string;
device_name: string;
device_os: string;
advertising_id: string;
}): Promise<NamirasoftAccountToken>;
Logout(): Promise<void>;
}

@@ -15,21 +15,46 @@ "use strict";

class NamirasoftAccountServerSession extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
delete(session_id) {
Current() {
return __awaiter(this, void 0, void 0, function* () {
yield this._delete("/session/" + session_id);
if (this.manager.getSessionData(s => s.id, "") === session_id)
this.manager.del();
let path = `/session/current`;
let { data } = yield this._get(path, {});
return data;
});
}
get() {
GetAll() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/session");
let path = `/session/all`;
let { data } = yield this._get(path, {});
return data;
});
}
getAll() {
Get(id) {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/session/all");
let path = `/session/${id}`;
let { data } = yield this._get(path, {});
return data;
});
}
Delete(id) {
return __awaiter(this, void 0, void 0, function* () {
let path = `/session/${id}`;
let { data } = yield this._delete(path, {});
return data;
});
}
Login(body) {
return __awaiter(this, void 0, void 0, function* () {
let path = `/session/login`;
let { data } = yield this._post(path, {}, body);
this.manager.set(data, false);
return data;
});
}
Logout() {
return __awaiter(this, void 0, void 0, function* () {
let path = `/session/logout`;
let { data } = yield this._post(path, {});
this.manager.del();
return data;
});
}
}

@@ -36,0 +61,0 @@ exports.NamirasoftAccountServerSession = NamirasoftAccountServerSession;

@@ -0,16 +1,34 @@

import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { NamirasoftAccountToken } from "./NamirasoftAccountToken";
import { User } from "./row/User";
import { IPInfo } from "./row/IPInfo";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { UserRow } from "./row/UserRow";
export declare class NamirasoftAccountServerUser extends NamirasoftAccountServerBase {
register(name: string, family: string, country: string, email: string, password: string, phone: string, birthday: string, refer: string, device_name: string, device_os: string, advertising_id: string): Promise<NamirasoftAccountToken>;
login(email: string, password: string, device_name: string, device_os: string, advertising_id: string): Promise<NamirasoftAccountToken>;
google(client_id: string, token: string, device_name: string, device_os: string, advertising_id: string, refer: string): Promise<NamirasoftAccountToken>;
logout(): Promise<void>;
get(): Promise<User>;
getInfo(): Promise<IPInfo>;
getReferral(): Promise<User[]>;
put(name: string, family: string, email: string, phone: string, birthday: string): Promise<User>;
delete(): Promise<User>;
cancel(): Promise<User>;
Current(): Promise<UserRow>;
Register(body: {
name: string;
family: string;
country: string;
email: string;
phone: (string | null);
birthday: (Date | null);
password: string;
device_name: string;
device_os: string;
advertising_id: string;
}): Promise<NamirasoftAccountToken>;
Google(body: {
client_id: number;
token: string;
device_name: string;
device_os: string;
advertising_id: string;
}): Promise<NamirasoftAccountToken>;
Cancel(): Promise<UserRow>;
Put(body: {
name: (string | null);
family: (string | null);
email: (string | null);
phone: (string | null);
birthday: (string | null);
}): Promise<UserRow>;
Delete(): Promise<UserRow>;
}

@@ -14,42 +14,14 @@ "use strict";

const NamirasoftAccountServerBase_1 = require("./NamirasoftAccountServerBase");
const namirasoft_core_1 = require("namirasoft-core");
class NamirasoftAccountServerUser extends NamirasoftAccountServerBase_1.NamirasoftAccountServerBase {
register(name, family, country, email, password, phone, birthday, refer, device_name, device_os, advertising_id) {
Current() {
return __awaiter(this, void 0, void 0, function* () {
name = namirasoft_core_1.StringOperation.repair(name);
family = namirasoft_core_1.StringOperation.repair(family);
email = namirasoft_core_1.StringOperation.repair(email);
phone = namirasoft_core_1.StringOperation.repair(phone);
refer = namirasoft_core_1.StringOperation.repair(refer);
device_name = namirasoft_core_1.StringOperation.repair(device_name);
device_os = namirasoft_core_1.StringOperation.repair(device_os);
advertising_id = namirasoft_core_1.StringOperation.repair(advertising_id);
let { data } = yield this._post("/user/register/", {}, {
name,
family,
country,
email,
password,
phone,
birthday,
refer,
device_name, device_os, advertising_id,
});
this.manager.set(data, false);
let path = `/user/current`;
let { data } = yield this._get(path, {});
return data;
});
}
login(email, password, device_name, device_os, advertising_id) {
Register(body) {
return __awaiter(this, void 0, void 0, function* () {
email = namirasoft_core_1.StringOperation.repair(email);
device_name = namirasoft_core_1.StringOperation.repair(device_name);
device_os = namirasoft_core_1.StringOperation.repair(device_os);
advertising_id = namirasoft_core_1.StringOperation.repair(advertising_id);
let { data } = yield this._post("/user/login", {}, {
email,
password,
device_name,
device_os,
advertising_id
});
let path = `/user/register`;
let { data } = yield this._post(path, {}, body);
this.manager.set(data, false);

@@ -59,16 +31,6 @@ return data;

}
google(client_id, token, device_name, device_os, advertising_id, refer) {
Google(body) {
return __awaiter(this, void 0, void 0, function* () {
device_name = namirasoft_core_1.StringOperation.repair(device_name);
device_os = namirasoft_core_1.StringOperation.repair(device_os);
advertising_id = namirasoft_core_1.StringOperation.repair(advertising_id);
refer = namirasoft_core_1.StringOperation.repair(refer);
let { data } = yield this._post("/user/google", {}, {
client_id,
token,
device_name,
device_os,
advertising_id,
refer
});
let path = `/user/google`;
let { data } = yield this._post(path, {}, body);
this.manager.set(data, false);

@@ -78,42 +40,6 @@ return data;

}
logout() {
Cancel() {
return __awaiter(this, void 0, void 0, function* () {
try {
yield this._post("/user/logout");
}
catch (_a) { }
this.manager.del();
});
}
get() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/user");
return data;
});
}
getInfo() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/user/info");
return data;
});
}
getReferral() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._get("/user/referral");
return data;
});
}
put(name, family, email, phone, birthday) {
return __awaiter(this, void 0, void 0, function* () {
name = namirasoft_core_1.StringOperation.repair(name);
family = namirasoft_core_1.StringOperation.repair(family);
email = namirasoft_core_1.StringOperation.repair(email);
phone = namirasoft_core_1.StringOperation.repair(phone);
let { data } = yield this._put("/user", {}, {
name,
family,
email,
phone,
birthday,
});
let path = `/user/cancel`;
let { data } = yield this._post(path, {});
this.manager.setUser(data);

@@ -123,5 +49,6 @@ return data;

}
delete() {
Put(body) {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._delete("/user");
let path = `/user/`;
let { data } = yield this._put(path, {}, body);
this.manager.setUser(data);

@@ -131,5 +58,6 @@ return data;

}
cancel() {
Delete() {
return __awaiter(this, void 0, void 0, function* () {
let { data } = yield this._post("/user/cancel");
let path = `/user/`;
let { data } = yield this._delete(path, {});
this.manager.setUser(data);

@@ -136,0 +64,0 @@ return data;

@@ -1,9 +0,9 @@

import { User } from "./row/User";
import { Device } from "./row/Device";
import { Session } from "./row/Session";
import { UserRow } from "./row/UserRow";
import { DeviceRow } from "./row/DeviceRow";
import { SessionRow } from "./row/SessionRow";
export type NamirasoftAccountToken = {
user: User | null;
device: Device | null;
session: Session | null;
user: UserRow | null;
device: DeviceRow | null;
session: SessionRow | null;
value: string;
};
import { IStorage } from "namirasoft-core";
import { NamirasoftAccountToken } from "./NamirasoftAccountToken";
import { Session } from "./row/Session";
import { Device } from "./row/Device";
import { User } from "./row/User";
import { SessionRow } from "./row/SessionRow";
import { DeviceRow } from "./row/DeviceRow";
import { UserRow } from "./row/UserRow";
export declare class TokenManager {

@@ -17,7 +17,7 @@ storage: IStorage;

setValue(value: string, isTheSameUser: boolean): void;
setUser(user: User | null): void;
setUser(user: UserRow | null): void;
getValue(): string | undefined;
getUserData<D = any>(getter: (user: User) => D, onNull: D): D;
getDeviceData<D = any>(getter: (user: Device) => D, onNull: D): D;
getSessionData<D = any>(getter: (user: Session) => D, onNull: D): D;
getUserData<D = any>(getter: (user: UserRow) => D, onNull: D): D;
getDeviceData<D = any>(getter: (user: DeviceRow) => D, onNull: D): D;
getSessionData<D = any>(getter: (user: SessionRow) => D, onNull: D): D;
}
{
"name": "namirasoft-account",
"description": "Namira Software Corporation Account NPM Package",
"version": "1.2.2",
"icon": "logo.png",
"version": "1.2.3",
"main": "./dist/index.js",

@@ -11,5 +12,5 @@ "types": "./dist/index.d.ts",

"dependencies": {
"namirasoft-core": "^1.2.4",
"namirasoft-core": "^1.2.5",
"namirasoft-site": "^1.2.1"
}
}

@@ -0,1 +1,21 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
export * from "./NamirasoftAccountBaseHeader";

@@ -10,8 +30,6 @@ export * from "./NamirasoftAccountHeader";

export * from "./NamirasoftAccountServerEmail";
export * from "./NamirasoftAccountServerMessage";
export * from "./NamirasoftAccountServerHealthz";
export * from "./NamirasoftAccountServerPassword";
export * from "./NamirasoftAccountServerPhone";
export * from "./NamirasoftAccountServerProduct";
export * from "./NamirasoftAccountServerSession";
export * from "./NamirasoftAccountServerStrike";
export * from "./NamirasoftAccountServerUser";

@@ -22,8 +40,10 @@ export * from "./NamirasoftAccountToken";

export * from "./TokenManager";
export * from "./row/Device";
export * from "./row/IPInfo";
export * from "./row/Message";
export * from "./row/Product";
export * from "./row/Session";
export * from "./row/Strike";
export * from "./row/User";
export * from "./row/DeviceRow";
export * from "./row/DeviceRow_Input";
export * from "./row/DeviceRow_Output";
export * from "./row/SessionRow";
export * from "./row/SessionRow_Input";
export * from "./row/SessionRow_Output";
export * from "./row/UserRow";
export * from "./row/UserRow_Input";
export * from "./row/UserRow_Output";

@@ -0,40 +1,54 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftAccountServerCountry } from "./NamirasoftAccountServerCountry";
import { NamirasoftAccountServerDevice } from "./NamirasoftAccountServerDevice";
import { NamirasoftAccountServerEmail } from "./NamirasoftAccountServerEmail";
import { NamirasoftAccountServerMessage } from "./NamirasoftAccountServerMessage";
import { NamirasoftAccountServerHealthz } from "./NamirasoftAccountServerHealthz";
import { NamirasoftAccountServerPassword } from "./NamirasoftAccountServerPassword";
import { NamirasoftAccountServerPhone } from "./NamirasoftAccountServerPhone";
import { NamirasoftAccountServerProduct } from "./NamirasoftAccountServerProduct";
import { NamirasoftAccountServerSession } from "./NamirasoftAccountServerSession";
import { NamirasoftAccountServerStrike } from "./NamirasoftAccountServerStrike";
import { NamirasoftAccountServerUser } from "./NamirasoftAccountServerUser";
import { TokenManager } from "./TokenManager";
export class NamirasoftAccountServer
export class NamirasoftAccountServer
{
manager: TokenManager;
healthz: NamirasoftAccountServerHealthz;
country: NamirasoftAccountServerCountry;
device: NamirasoftAccountServerDevice;
email: NamirasoftAccountServerEmail;
message: NamirasoftAccountServerMessage;
password: NamirasoftAccountServerPassword;
phone: NamirasoftAccountServerPhone;
product: NamirasoftAccountServerProduct;
session: NamirasoftAccountServerSession;
strike: NamirasoftAccountServerStrike;
user: NamirasoftAccountServerUser;
constructor(manager: TokenManager, onError: (erorr: Error) => void)
constructor(manager: TokenManager, onError: (error: Error) => void)
{
this.manager = manager;
this.healthz = new NamirasoftAccountServerHealthz(manager, onError);
this.country = new NamirasoftAccountServerCountry(manager, onError);
this.device = new NamirasoftAccountServerDevice(manager, onError);
this.email = new NamirasoftAccountServerEmail(manager, onError);
this.message = new NamirasoftAccountServerMessage(manager, onError);
this.password = new NamirasoftAccountServerPassword(manager, onError);
this.phone = new NamirasoftAccountServerPhone(manager, onError);
this.product = new NamirasoftAccountServerProduct(manager, onError);
this.session = new NamirasoftAccountServerSession(manager, onError);
this.strike = new NamirasoftAccountServerStrike(manager, onError);
this.user = new NamirasoftAccountServerUser(manager, onError);
}
};

@@ -0,10 +1,30 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftServerBase } from "./NamirasoftServerBase";
import { TokenManager } from "./TokenManager";
import { NamirasoftServerBase } from "./NamirasoftServerBase";
export class NamirasoftAccountServerBase extends NamirasoftServerBase
{
constructor(manager: TokenManager, onError: (erorr: Error) => void)
constructor(manager: TokenManager, onError: (error: Error) => void)
{
super('https://account.namirasoft.com/api/v1', manager, onError);
super(`https://account.namirasoft.com/api/v1`, manager, onError);
}
};

@@ -0,1 +1,21 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { Country } from "namirasoft-core";

@@ -6,7 +26,8 @@ import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";

{
async getAll(): Promise<Country[]>
async GetAll(): Promise<Country[]>
{
let { data } = await this._get("/country/all");
let path = `/country/all`;
let { data } = await this._get<Country[]>(path, {});
return data;
}
};

@@ -1,2 +0,22 @@

import { Device } from "./row/Device";
/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { DeviceRow } from "./row/DeviceRow";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";

@@ -6,16 +26,20 @@

{
async getAll(): Promise<Device[]>
async GetAll(): Promise<DeviceRow[]>
{
let { data } = await this._get<Device[]>("/device/all");
let path = `/device/all`;
let { data } = await this._get<DeviceRow[]>(path, {});
return data;
}
async get(device_id: number): Promise<Device>
async Get(id: string): Promise<DeviceRow>
{
let { data } = await this._get<Device>("/device/" + device_id);
let path = `/device/${id}`;
let { data } = await this._get<DeviceRow>(path, {});
return data;
}
async delete(device_id: number): Promise<void>
async Delete(id: string): Promise<void>
{
await this._delete("/device/" + device_id);
let path = `/device/${id}`;
let { data } = await this._delete<void>(path, {});
return data;
}
};

@@ -0,1 +1,21 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";

@@ -5,12 +25,14 @@

{
async request(): Promise<{ next_time: number }>
async Request(): Promise<{ next_time: number, error: (string | null) }>
{
let { data } = await this._post<{ next_time: number }>("/email/request");
let path = `/email/request`;
let { data } = await this._post<{ next_time: number, error: (string | null) }>(path, {});
return data;
}
async verify(code: string): Promise<{ next_time: number }>
async Verify(body: { code: string }): Promise<void>
{
let { data } = await this._post<{ next_time: number }>("/email/verify", {}, { code });
let path = `/email/verify`;
let { data } = await this._post<void>(path, {}, body);
return data;
}
};

@@ -1,2 +0,21 @@

import { StringOperation } from "namirasoft-core";
/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";

@@ -6,24 +25,20 @@

{
async forget(email: string): Promise<{ next_time: number }>
async Forget(body: { email: string }): Promise<{ next_time: number, error: (string | null) }>
{
email = StringOperation.repair(email);
let { data } = await this._post<{ next_time: number }>("/password/forget", {}, {
email,
});
let path = `/password/forget`;
let { data } = await this._post<{ next_time: number, error: (string | null) }>(path, {}, body);
return data;
}
async new(user_id: number, hash: string, pass_new: string, pass_rep: string): Promise<{ next_time: number }>
async New(body: { user_id: string, hash: string, pass_new: string, pass_rep: string }): Promise<void>
{
hash = StringOperation.repair(hash);
let { data } = await this._post<{ next_time: number }>("/password/new", {}, {
user_id, hash, pass_new, pass_rep
});
let path = `/password/new`;
let { data } = await this._post<void>(path, {}, body);
return data;
}
async reset(pass_cur: string, pass_new: string, pass_rep: string): Promise<void>
async Reset(body: { pass_cur: string, pass_new: string, pass_rep: string }): Promise<void>
{
await this._post("/password/reset", {}, {
pass_cur, pass_new, pass_rep
});
let path = `/password/reset`;
let { data } = await this._post<void>(path, {}, body);
return data;
}
};

@@ -0,1 +1,21 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";

@@ -5,12 +25,14 @@

{
async request(): Promise<{ next_time: number }>
async Request(): Promise<{ next_time: number, error: (string | null) }>
{
let { data } = await this._post<{ next_time: number }>("/phone/request");
let path = `/phone/request`;
let { data } = await this._post<{ next_time: number, error: (string | null) }>(path, {});
return data;
}
async verify(code: string): Promise<{ next_time: number }>
async Verify(body: { code: string }): Promise<void>
{
let { data } = await this._post<{ next_time: number }>("/phone/verify", {}, { code });
let path = `/phone/verify`;
let { data } = await this._post<void>(path, {}, body);
return data;
}
};

@@ -0,23 +1,65 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { NamirasoftAccountToken } from "./NamirasoftAccountToken";
import { Session } from "./row/Session";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { SessionRow } from "./row/SessionRow";
export class NamirasoftAccountServerSession extends NamirasoftAccountServerBase
{
async delete(session_id: string): Promise<void>
async Current(): Promise<NamirasoftAccountToken>
{
await this._delete("/session/" + session_id);
if (this.manager.getSessionData(s => s.id, "") === session_id)
this.manager.del();
let path = `/session/current`;
let { data } = await this._get<NamirasoftAccountToken>(path, {});
return data;
}
async get(): Promise<NamirasoftAccountToken>
async GetAll(): Promise<SessionRow[]>
{
let { data } = await this._get("/session");
let path = `/session/all`;
let { data } = await this._get<SessionRow[]>(path, {});
return data;
}
async getAll(): Promise<Session[]>
async Get(id: string): Promise<SessionRow>
{
let { data } = await this._get<Session[]>("/session/all");
let path = `/session/${id}`;
let { data } = await this._get<SessionRow>(path, {});
return data;
}
async Delete(id: string): Promise<void>
{
let path = `/session/${id}`;
let { data } = await this._delete<void>(path, {});
return data;
}
async Login(body: { email: string, password: string, device_name: string, device_os: string, advertising_id: string }): Promise<NamirasoftAccountToken>
{
let path = `/session/login`;
let { data } = await this._post<NamirasoftAccountToken>(path, {}, body);
this.manager.set(data, false);
return data;
}
async Logout(): Promise<void>
{
let path = `/session/logout`;
let { data } = await this._post<void>(path, {});
this.manager.del();
return data;
}
};

@@ -0,116 +1,65 @@

/****************************************************************/
/* */
/* This is an Auto-Generated File */
/* Made By */
/* Namirasoft SDK Generator NPM Package */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Please do not make any change to this file */
/* If any changed is reqired, nsdkg command must be used */
/* */
/****************************************************************/
/****************************************************************/
/* */
/* Namira Software Corporation */
/* https://namirasoft.com */
/* */
/****************************************************************/
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { NamirasoftAccountToken } from "./NamirasoftAccountToken";
import { User } from "./row/User";
import { IPInfo } from "./row/IPInfo";
import { NamirasoftAccountServerBase } from "./NamirasoftAccountServerBase";
import { StringOperation } from "namirasoft-core";
import { UserRow } from "./row/UserRow";
export class NamirasoftAccountServerUser extends NamirasoftAccountServerBase
{
async register(name: string, family: string, country: string, email: string, password: string, phone: string, birthday: string, refer: string, device_name: string, device_os: string, advertising_id: string): Promise<NamirasoftAccountToken>
async Current(): Promise<UserRow>
{
name = StringOperation.repair(name);
family = StringOperation.repair(family);
email = StringOperation.repair(email);
phone = StringOperation.repair(phone);
refer = StringOperation.repair(refer);
device_name = StringOperation.repair(device_name);
device_os = StringOperation.repair(device_os);
advertising_id = StringOperation.repair(advertising_id);
let { data } = await this._post<NamirasoftAccountToken>("/user/register/", {}, {
name,
family,
country,
email,
password,
phone,
birthday,
refer,
device_name, device_os, advertising_id,
});
this.manager.set(data, false);
let path = `/user/current`;
let { data } = await this._get<UserRow>(path, {});
return data;
}
async login(email: string, password: string, device_name: string, device_os: string, advertising_id: string): Promise<NamirasoftAccountToken>
async Register(body: { name: string, family: string, country: string, email: string, phone: (string | null), birthday: (Date | null), password: string, device_name: string, device_os: string, advertising_id: string }): Promise<NamirasoftAccountToken>
{
email = StringOperation.repair(email);
device_name = StringOperation.repair(device_name);
device_os = StringOperation.repair(device_os);
advertising_id = StringOperation.repair(advertising_id);
let { data } = await this._post<NamirasoftAccountToken>("/user/login", {}, {
email,
password,
device_name,
device_os,
advertising_id
});
let path = `/user/register`;
let { data } = await this._post<NamirasoftAccountToken>(path, {}, body);
this.manager.set(data, false);
return data;
}
async google(client_id: string, token: string, device_name: string, device_os: string, advertising_id: string, refer: string): Promise<NamirasoftAccountToken>
async Google(body: { client_id: number, token: string, device_name: string, device_os: string, advertising_id: string }): Promise<NamirasoftAccountToken>
{
device_name = StringOperation.repair(device_name);
device_os = StringOperation.repair(device_os);
advertising_id = StringOperation.repair(advertising_id);
refer = StringOperation.repair(refer);
let { data } = await this._post("/user/google", {}, {
client_id,
token,
device_name,
device_os,
advertising_id,
refer
});
let path = `/user/google`;
let { data } = await this._post<NamirasoftAccountToken>(path, {}, body);
this.manager.set(data, false);
return data;
}
async logout(): Promise<void>
async Cancel(): Promise<UserRow>
{
try
{
await this._post("/user/logout");
}
catch
{ }
this.manager.del();
}
async get(): Promise<User>
{
let { data } = await this._get<User>("/user");
return data;
}
async getInfo(): Promise<IPInfo>
{
let { data } = await this._get("/user/info");
return data;
}
async getReferral(): Promise<User[]>
{
let { data } = await this._get<User[]>("/user/referral");
return data;
}
async put(name: string, family: string, email: string, phone: string, birthday: string): Promise<User>
{
name = StringOperation.repair(name);
family = StringOperation.repair(family);
email = StringOperation.repair(email);
phone = StringOperation.repair(phone);
let { data } = await this._put("/user", {}, {
name,
family,
email,
phone,
birthday,
});
let path = `/user/cancel`;
let { data } = await this._post<UserRow>(path, {});
this.manager.setUser(data);
return data;
}
async delete(): Promise<User>
async Put(body: { name: (string | null), family: (string | null), email: (string | null), phone: (string | null), birthday: (string | null) }): Promise<UserRow>
{
let { data } = await this._delete("/user");
let path = `/user/`;
let { data } = await this._put<UserRow>(path, {}, body);
this.manager.setUser(data);
return data;
}
async cancel(): Promise<User>
async Delete(): Promise<UserRow>
{
let { data } = await this._post("/user/cancel");
let path = `/user/`;
let { data } = await this._delete<UserRow>(path, {});
this.manager.setUser(data);

@@ -117,0 +66,0 @@ return data;

@@ -1,11 +0,11 @@

import { User } from "./row/User";
import { Device } from "./row/Device";
import { Session } from "./row/Session";
import { UserRow } from "./row/UserRow";
import { DeviceRow } from "./row/DeviceRow";
import { SessionRow } from "./row/SessionRow";
export type NamirasoftAccountToken =
{
user: User | null;
device: Device | null;
session: Session | null;
user: UserRow | null;
device: DeviceRow | null;
session: SessionRow | null;
value: string;
}

@@ -5,3 +5,3 @@ import { NSBaseServer } from "namirasoft-site";

import { TokenManager } from "./TokenManager";
import { User } from "./row/User";
import { UserRow } from "./row/UserRow";

@@ -25,3 +25,3 @@ export abstract class NamirasoftServerBase extends NSBaseServer

let user_value = atob(response.headers[header_user]);
manager.setUser(JSON.parse(user_value) as User);
manager.setUser(JSON.parse(user_value) as UserRow);
}

@@ -28,0 +28,0 @@ }

import { IStorage } from "namirasoft-core";
import { NamirasoftAccountHeader } from "./NamirasoftAccountHeader";
import { NamirasoftAccountToken } from "./NamirasoftAccountToken";
import { Session } from "./row/Session";
import { Device } from "./row/Device";
import { User } from "./row/User";
import { SessionRow } from "./row/SessionRow";
import { DeviceRow } from "./row/DeviceRow";
import { UserRow } from "./row/UserRow";

@@ -58,3 +58,3 @@ export class TokenManager

}
setUser(user: User | null)
setUser(user: UserRow | null)
{

@@ -72,3 +72,3 @@ let token: NamirasoftAccountToken | null = this.get();

}
getUserData<D = any>(getter: (user: User) => D, onNull: D): D
getUserData<D = any>(getter: (user: UserRow) => D, onNull: D): D
{

@@ -78,6 +78,6 @@ let token = this.get();

if (token.user)
return getter(token.user as User);
return getter(token.user as UserRow);
return onNull;
}
getDeviceData<D = any>(getter: (user: Device) => D, onNull: D): D
getDeviceData<D = any>(getter: (user: DeviceRow) => D, onNull: D): D
{

@@ -90,3 +90,3 @@ let token = this.get();

}
getSessionData<D = any>(getter: (user: Session) => D, onNull: D): D
getSessionData<D = any>(getter: (user: SessionRow) => D, onNull: D): D
{

@@ -93,0 +93,0 @@ let token = this.get();

@@ -5,10 +5,6 @@ {

"module": "CommonJS",
"outDir": "./dist",
"rootDir": "./src",
"outDir": "./dist",
"lib": [
"es6",
"dom"
],
"allowJs": false,
"checkJs": false,
"allowJs": true,
"checkJs": true,
"strict": true,

@@ -29,4 +25,5 @@ "esModuleInterop": true,

"noFallthroughCasesInSwitch": true,
"isolatedModules": false,
"isolatedModules": true,
"removeComments": true,
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc