@meowinc/meow-sdk 0.2.1 → 0.4.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/dist/account/app/get-app-list.d.ts +1 -1
- package/dist/account/app/index.d.ts +1 -1
- package/dist/account/auth/2FA/get-my-two-factor.d.ts +10 -0
- package/dist/account/auth/2FA/get-my-two-factor.js +11 -0
- package/dist/account/auth/2FA/get-two-factor-by-login-password.d.ts +8 -0
- package/dist/account/auth/2FA/get-two-factor-by-login-password.js +11 -0
- package/dist/account/auth/2FA/index.d.ts +7 -0
- package/dist/account/auth/2FA/index.js +1 -0
- package/dist/account/auth/email/add-email.d.ts +6 -0
- package/dist/account/auth/email/add-email.js +14 -0
- package/dist/account/auth/email/submit-add-email.d.ts +3 -0
- package/dist/account/auth/email/submit-add-email.js +15 -0
- package/dist/account/auth/index.d.ts +6 -3
- package/dist/account/auth/index.js +19 -11
- package/dist/account/auth/log-in/index.d.ts +8 -0
- package/dist/account/auth/log-in/index.js +1 -0
- package/dist/account/auth/log-in/log-in.d.ts +8 -0
- package/dist/account/auth/log-in/log-in.js +11 -0
- package/dist/account/auth/log-in/set-two-factor-session.d.ts +6 -0
- package/dist/account/auth/log-in/set-two-factor-session.js +11 -0
- package/dist/account/auth/log-in/submit-two-factor-session.d.ts +8 -0
- package/dist/account/auth/log-in/submit-two-factor-session.js +11 -0
- package/dist/account/user/get-user-by-login.d.ts +1 -1
- package/dist/account/user/index.d.ts +1 -1
- package/dist/auth-provider.d.ts +8 -0
- package/dist/auth-provider.js +12 -0
- package/dist/http-client.d.ts +1 -1
- package/dist/http-client.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utils/index.d.ts +32 -0
- package/dist/utils/index.js +93 -0
- package/package.json +2 -2
|
@@ -3,6 +3,6 @@ export declare class AppRequests {
|
|
|
3
3
|
private readonly authProvider;
|
|
4
4
|
constructor(authProvider: AuthorizationProvider);
|
|
5
5
|
create(displayId: string, name: string, type: "web" | "mobile"): Promise<import("../../types").MeowResult<void>>;
|
|
6
|
-
getAppList(): Promise<import("
|
|
6
|
+
getAppList(): Promise<import("@meowinc/result").Result<import("./get-app-list").Response, string>>;
|
|
7
7
|
getByDisplayId(displayId: string): Promise<import("../../types").MeowResult<import("./get-by-display-id").Response>>;
|
|
8
8
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthorizationProvider } from "../../..";
|
|
2
|
+
import { MeowResult } from "../../../types";
|
|
3
|
+
export type Response = {
|
|
4
|
+
id: number;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
} & {
|
|
7
|
+
type: "email";
|
|
8
|
+
mailbox: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function request(auth: AuthorizationProvider): Promise<MeowResult<Response>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(auth) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withMethodGet()
|
|
7
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/2fa/my`)
|
|
8
|
+
.withAuthorization(auth)
|
|
9
|
+
.send()
|
|
10
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetTwoFactorResponse } from ".";
|
|
2
|
+
import { MeowResult } from "../../../types";
|
|
3
|
+
export interface Payload {
|
|
4
|
+
login: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export type Response = GetTwoFactorResponse;
|
|
8
|
+
export declare function request(payload: Payload): Promise<MeowResult<Response>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(payload) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withMethodPost()
|
|
7
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/2fa/my/login-password`)
|
|
8
|
+
.withJsonBody(payload)
|
|
9
|
+
.send()
|
|
10
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AuthorizationProvider } from "../../..";
|
|
2
|
+
import { MeowResult } from "../../../types";
|
|
3
|
+
export interface Response {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function request(mailbox: string, authorizationProvider: AuthorizationProvider): Promise<MeowResult<Response>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(mailbox, authorizationProvider) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/2fa/email`)
|
|
7
|
+
.withAuthorization(authorizationProvider)
|
|
8
|
+
.withMethodPost()
|
|
9
|
+
.withJsonBody({
|
|
10
|
+
mailbox,
|
|
11
|
+
})
|
|
12
|
+
.send()
|
|
13
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(sessionId, code, authorizationProvider) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/2fa/email/submit`)
|
|
7
|
+
.withMethodPost()
|
|
8
|
+
.withAuthorization(authorizationProvider)
|
|
9
|
+
.withJsonBody({
|
|
10
|
+
sessionId,
|
|
11
|
+
code,
|
|
12
|
+
})
|
|
13
|
+
.send()
|
|
14
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
15
|
+
}
|
|
@@ -3,9 +3,12 @@ import { AuthorizationProvider } from "../../auth-provider";
|
|
|
3
3
|
export declare class AuthRequests {
|
|
4
4
|
private readonly authProvider;
|
|
5
5
|
constructor(authProvider: AuthorizationProvider);
|
|
6
|
-
baseLogIn(login: string, password: string): Promise<import("../../types").MeowResult<import("./log-in").
|
|
7
|
-
twoFactorLogIn(code: string, requestId: string): Promise<import("../../types").MeowResult<import("./log-in").Response>>;
|
|
6
|
+
baseLogIn(login: string, password: string): Promise<import("../../types").MeowResult<import("./log-in").LogInResponse>>;
|
|
8
7
|
signIn(login: string, password: string, verificationType: VerificationType): Promise<import("../../types").MeowResult<void>>;
|
|
9
|
-
addTwoFactorEmail(email: string): Promise<import("../../types").MeowResult<import("./add-email").Response>>;
|
|
8
|
+
addTwoFactorEmail(email: string): Promise<import("../../types").MeowResult<import("./email/add-email").Response>>;
|
|
10
9
|
submitTwoFactorEmail(sessionId: string, code: string): Promise<import("../../types").MeowResult<void>>;
|
|
10
|
+
setTwoFactorSession(sessionId: string, twoFactorId: number): Promise<import("../../types").MeowResult<void>>;
|
|
11
|
+
submitTwoFactorSession(code: string, sessionId: string): Promise<import("../../types").MeowResult<import("./log-in").LogInResponse>>;
|
|
12
|
+
getMyTwoFactor(): Promise<import("../../types").MeowResult<import("./2FA/get-my-two-factor").Response>>;
|
|
13
|
+
getTwoFactorByLoginPassword(login: string, password: string): Promise<import("../../types").MeowResult<import("./2FA").GetTwoFactorResponse>>;
|
|
11
14
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { request as signIn } from "./sign-in";
|
|
2
|
-
import { request as logIn } from "./log-in";
|
|
3
|
-
import { request as addEmail } from "./add-email";
|
|
4
|
-
import { request as submitAddEmail } from "./submit-add-email";
|
|
2
|
+
import { request as logIn } from "./log-in/log-in";
|
|
3
|
+
import { request as addEmail } from "./email/add-email";
|
|
4
|
+
import { request as submitAddEmail } from "./email/submit-add-email";
|
|
5
|
+
import { request as setTwoFactorSession } from "./log-in/set-two-factor-session";
|
|
6
|
+
import { request as submitTwoFactorSession } from "./log-in/submit-two-factor-session";
|
|
7
|
+
import { request as getMyTwoFactor } from "./2FA/get-my-two-factor";
|
|
8
|
+
import { request as getTwoFactorByLoginPassword } from "./2FA/get-two-factor-by-login-password";
|
|
5
9
|
export class AuthRequests {
|
|
6
10
|
authProvider;
|
|
7
11
|
constructor(authProvider) {
|
|
@@ -11,14 +15,6 @@ export class AuthRequests {
|
|
|
11
15
|
return await logIn({
|
|
12
16
|
login,
|
|
13
17
|
password,
|
|
14
|
-
type: "base",
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
async twoFactorLogIn(code, requestId) {
|
|
18
|
-
return await logIn({
|
|
19
|
-
code,
|
|
20
|
-
requestId,
|
|
21
|
-
type: "twoFactor",
|
|
22
18
|
});
|
|
23
19
|
}
|
|
24
20
|
async signIn(login, password, verificationType) {
|
|
@@ -34,4 +30,16 @@ export class AuthRequests {
|
|
|
34
30
|
async submitTwoFactorEmail(sessionId, code) {
|
|
35
31
|
return await submitAddEmail(sessionId, code, this.authProvider);
|
|
36
32
|
}
|
|
33
|
+
async setTwoFactorSession(sessionId, twoFactorId) {
|
|
34
|
+
return await setTwoFactorSession({ sessionId, twoFactorId });
|
|
35
|
+
}
|
|
36
|
+
async submitTwoFactorSession(code, sessionId) {
|
|
37
|
+
return await submitTwoFactorSession({ code, sessionId });
|
|
38
|
+
}
|
|
39
|
+
async getMyTwoFactor() {
|
|
40
|
+
return await getMyTwoFactor(this.authProvider);
|
|
41
|
+
}
|
|
42
|
+
async getTwoFactorByLoginPassword(login, password) {
|
|
43
|
+
return await getTwoFactorByLoginPassword({ login, password });
|
|
44
|
+
}
|
|
37
45
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LogInResponse } from ".";
|
|
2
|
+
import { MeowResult } from "../../../types";
|
|
3
|
+
export interface Payload {
|
|
4
|
+
login: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
export type Response = LogInResponse;
|
|
8
|
+
export declare function request(payload: Payload): Promise<MeowResult<Response>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(payload) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withMethodPost()
|
|
7
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/log-in`)
|
|
8
|
+
.withJsonBody(payload)
|
|
9
|
+
.send()
|
|
10
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(payload) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withMethodPost()
|
|
7
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/2fa/session/set-up`)
|
|
8
|
+
.withJsonBody(payload)
|
|
9
|
+
.send()
|
|
10
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LogInResponse } from ".";
|
|
2
|
+
import { MeowResult } from "../../../types";
|
|
3
|
+
export interface Payload {
|
|
4
|
+
code: string;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
}
|
|
7
|
+
export type Response = LogInResponse;
|
|
8
|
+
export declare function request(payload: Payload): Promise<MeowResult<Response>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ACCOUNT_API } from "../..";
|
|
2
|
+
import { ErrorToMessage } from "../../../error";
|
|
3
|
+
import { HttpClient } from "../../../http-client";
|
|
4
|
+
export async function request(payload) {
|
|
5
|
+
return await new HttpClient()
|
|
6
|
+
.withMethodPost()
|
|
7
|
+
.withUrl(`${ACCOUNT_API}/v1/auth/2fa/session/submit`)
|
|
8
|
+
.withJsonBody(payload)
|
|
9
|
+
.send()
|
|
10
|
+
.then((r) => r.mapError(ErrorToMessage));
|
|
11
|
+
}
|
|
@@ -7,5 +7,5 @@ export interface Response {
|
|
|
7
7
|
status: string;
|
|
8
8
|
registrationDate: Date;
|
|
9
9
|
}
|
|
10
|
-
export declare function request(login: string): Promise<import("
|
|
10
|
+
export declare function request(login: string): Promise<import("@meowinc/result").Result<Response, string>>;
|
|
11
11
|
export {};
|
|
@@ -2,5 +2,5 @@ import { AuthorizationProvider } from "../../auth-provider";
|
|
|
2
2
|
export declare class UserRequests {
|
|
3
3
|
private readonly authProvider;
|
|
4
4
|
constructor(authProvider: AuthorizationProvider);
|
|
5
|
-
getUserByLogin(login: string): Promise<import("
|
|
5
|
+
getUserByLogin(login: string): Promise<import("@meowinc/result").Result<import("./get-user-by-login").Response, string>>;
|
|
6
6
|
}
|
package/dist/auth-provider.d.ts
CHANGED
|
@@ -35,4 +35,12 @@ export declare class InPlaceAuthorizationProvider implements AuthorizationProvid
|
|
|
35
35
|
updateTokens(accessToken?: string, refreshToken?: string): void;
|
|
36
36
|
onUpdate(callback: AuthorizationUpdateHandler): void;
|
|
37
37
|
}
|
|
38
|
+
export declare class EmptyAuthorizationProvider implements AuthorizationProvider {
|
|
39
|
+
getAccessToken(): UndefinedString;
|
|
40
|
+
setAccessToken(): void;
|
|
41
|
+
getRefreshToken(): UndefinedString;
|
|
42
|
+
setRefreshToken(): void;
|
|
43
|
+
updateTokens(): void;
|
|
44
|
+
onUpdate(): void;
|
|
45
|
+
}
|
|
38
46
|
export {};
|
package/dist/auth-provider.js
CHANGED
|
@@ -83,3 +83,15 @@ export class InPlaceAuthorizationProvider {
|
|
|
83
83
|
this.updateCallbacks.push(callback);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
export class EmptyAuthorizationProvider {
|
|
87
|
+
getAccessToken() {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
setAccessToken() { }
|
|
91
|
+
getRefreshToken() {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
setRefreshToken() { }
|
|
95
|
+
updateTokens() { }
|
|
96
|
+
onUpdate() { }
|
|
97
|
+
}
|
package/dist/http-client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuthorizationProvider } from "./auth-provider";
|
|
2
|
-
import { Result } from "ts-result-meow";
|
|
3
2
|
import { HttpError, type AppError } from "./error";
|
|
3
|
+
import { Result } from "@meowinc/result";
|
|
4
4
|
export declare class HttpClient {
|
|
5
5
|
private url;
|
|
6
6
|
private headers;
|
package/dist/http-client.js
CHANGED
package/dist/types.d.ts
CHANGED
package/dist/types.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MeowResult, UndefinedString } from "../types";
|
|
2
|
+
import { Response as LogInResponse } from "./../account/auth/log-in/log-in";
|
|
3
|
+
export declare class AuthorizationSession {
|
|
4
|
+
private login;
|
|
5
|
+
private password;
|
|
6
|
+
constructor(login: string, password: string);
|
|
7
|
+
startAuth(): Promise<BaseAuthorizationResult>;
|
|
8
|
+
}
|
|
9
|
+
export declare class BaseAuthorizationResult {
|
|
10
|
+
private content?;
|
|
11
|
+
private error?;
|
|
12
|
+
constructor(result: MeowResult<LogInResponse>);
|
|
13
|
+
hasError(): boolean;
|
|
14
|
+
getError(): UndefinedString;
|
|
15
|
+
isRequireTwoFactor(): boolean;
|
|
16
|
+
startTwoFactor(twoFactorId: number): Promise<TwoFactorAuthorizationResult>;
|
|
17
|
+
private _startTwoFactor;
|
|
18
|
+
}
|
|
19
|
+
export declare class TwoFactorAuthorizationResult {
|
|
20
|
+
private sessionId?;
|
|
21
|
+
private error?;
|
|
22
|
+
constructor(result: MeowResult<string>);
|
|
23
|
+
hasError(): boolean;
|
|
24
|
+
passCode(code: string): Promise<MeowResult<{
|
|
25
|
+
accessToken: string;
|
|
26
|
+
refreshToken: string;
|
|
27
|
+
}>>;
|
|
28
|
+
}
|
|
29
|
+
export declare class MeowUtils {
|
|
30
|
+
static createAuthorizationSession(login: string, password: string): AuthorizationSession;
|
|
31
|
+
static checkRequiredPermissions(expected: string[], permissions: string[]): boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { MeowSdkClient } from "..";
|
|
2
|
+
import { EmptyAuthorizationProvider } from "../auth-provider";
|
|
3
|
+
import { MeowResult } from "../types";
|
|
4
|
+
export class AuthorizationSession {
|
|
5
|
+
login;
|
|
6
|
+
password;
|
|
7
|
+
constructor(login, password) {
|
|
8
|
+
this.login = login;
|
|
9
|
+
this.password = password;
|
|
10
|
+
}
|
|
11
|
+
async startAuth() {
|
|
12
|
+
const client = MeowSdkClient.fromAuthorizationProvider(new EmptyAuthorizationProvider());
|
|
13
|
+
const result = await client.account.auth.baseLogIn(this.login, this.password);
|
|
14
|
+
return new BaseAuthorizationResult(result);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class BaseAuthorizationResult {
|
|
18
|
+
content;
|
|
19
|
+
error;
|
|
20
|
+
constructor(result) {
|
|
21
|
+
if (result.hasError()) {
|
|
22
|
+
this.error = result.getError();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.content = result.unwrap();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
hasError() {
|
|
29
|
+
return this.error !== undefined;
|
|
30
|
+
}
|
|
31
|
+
getError() {
|
|
32
|
+
return this.error;
|
|
33
|
+
}
|
|
34
|
+
isRequireTwoFactor() {
|
|
35
|
+
return this.content ? this.content.type === "requireTwoFactor" : false;
|
|
36
|
+
}
|
|
37
|
+
async startTwoFactor(twoFactorId) {
|
|
38
|
+
return new TwoFactorAuthorizationResult(await this._startTwoFactor(twoFactorId));
|
|
39
|
+
}
|
|
40
|
+
async _startTwoFactor(twoFactorId) {
|
|
41
|
+
if (!this.content) {
|
|
42
|
+
return MeowResult.withError("Content not provided. Handle error!");
|
|
43
|
+
}
|
|
44
|
+
if (this.content.type !== "requireTwoFactor") {
|
|
45
|
+
return MeowResult.withError("Two factor auth not required");
|
|
46
|
+
}
|
|
47
|
+
const client = MeowSdkClient.fromAuthorizationProvider(new EmptyAuthorizationProvider());
|
|
48
|
+
const result = await client.account.auth.setTwoFactorSession(this.content.sessionId, twoFactorId);
|
|
49
|
+
if (result.hasError()) {
|
|
50
|
+
return MeowResult.withError(result.getError());
|
|
51
|
+
}
|
|
52
|
+
return MeowResult.withOk(this.content.sessionId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export class TwoFactorAuthorizationResult {
|
|
56
|
+
sessionId;
|
|
57
|
+
error;
|
|
58
|
+
constructor(result) {
|
|
59
|
+
if (result.hasError()) {
|
|
60
|
+
this.error = result.getError();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.sessionId = result.unwrap();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
hasError() {
|
|
67
|
+
return this.error !== undefined;
|
|
68
|
+
}
|
|
69
|
+
async passCode(code) {
|
|
70
|
+
if (!this.sessionId) {
|
|
71
|
+
return MeowResult.withError("Session Id not provided. Handle error!");
|
|
72
|
+
}
|
|
73
|
+
const client = MeowSdkClient.fromAuthorizationProvider(new EmptyAuthorizationProvider());
|
|
74
|
+
const result = await client.account.auth.submitTwoFactorSession(code, this.sessionId);
|
|
75
|
+
if (result.hasError()) {
|
|
76
|
+
return MeowResult.withError(result.getError());
|
|
77
|
+
}
|
|
78
|
+
const content = result.unwrap();
|
|
79
|
+
// imposible
|
|
80
|
+
if (content.type === "requireTwoFactor") {
|
|
81
|
+
return MeowResult.withError("Returned 'requireTwoFactor' response");
|
|
82
|
+
}
|
|
83
|
+
return MeowResult.withOk(content);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export class MeowUtils {
|
|
87
|
+
static createAuthorizationSession(login, password) {
|
|
88
|
+
return new AuthorizationSession(login, password);
|
|
89
|
+
}
|
|
90
|
+
static checkRequiredPermissions(expected, permissions) {
|
|
91
|
+
return permissions.every((permission) => expected.includes(permission));
|
|
92
|
+
}
|
|
93
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meowinc/meow-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Meow SDK",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sdk"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"prettier": "prettier ./src --write"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
26
|
+
"@meowinc/result": ">=0.0.13",
|
|
27
27
|
"jwt-decode": ">=4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|