@zauru-sdk/services 2.17.0 → 2.19.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/common.d.ts +8 -0
- package/dist/esm/common.js +27 -2
- package/dist/sessions/sessions.d.ts +1 -2
- package/package.json +3 -3
package/dist/common.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { Session } from "@remix-run/node";
|
|
2
2
|
import { AxiosRequestHeaders } from "axios";
|
|
3
3
|
import { EmployeeGraphQL, OauthProfile, ProfileResponse, AgencyGraphQL, VariableGraphQL, AxiosUtilsResponse } from "@zauru-sdk/types";
|
|
4
|
+
/**
|
|
5
|
+
* nativeLogin
|
|
6
|
+
* @param session
|
|
7
|
+
* @param codeValue
|
|
8
|
+
* @param cookie
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare const nativeLogin: (session: Session, codeValue: string) => Promise<AxiosUtilsResponse<OauthProfile>>;
|
|
4
12
|
/**
|
|
5
13
|
* loginWebApp
|
|
6
14
|
* @param session
|
package/dist/esm/common.js
CHANGED
|
@@ -6,6 +6,30 @@ import { getAgencyInfo, getEmployeeInfo, getOauthUserInfo, getProfileInformation
|
|
|
6
6
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
7
7
|
import { getVariables } from "./zauru/zauru-variables.js";
|
|
8
8
|
import { config } from "@zauru-sdk/config";
|
|
9
|
+
/**
|
|
10
|
+
* nativeLogin
|
|
11
|
+
* @param session
|
|
12
|
+
* @param codeValue
|
|
13
|
+
* @param cookie
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export const nativeLogin = async (session, codeValue) => {
|
|
17
|
+
return handlePossibleAxiosErrors(async () => {
|
|
18
|
+
const userInfoResponse = await getOauthUserInfo(codeValue ?? "");
|
|
19
|
+
if (userInfoResponse.error || !userInfoResponse.data) {
|
|
20
|
+
throw new Error(userInfoResponse.userMsg ??
|
|
21
|
+
"Error al obtener la información del usuario en Oauth.");
|
|
22
|
+
}
|
|
23
|
+
const userInfo = userInfoResponse.data;
|
|
24
|
+
session.set("username", userInfo?.username);
|
|
25
|
+
session.set("token", userInfo?.api_key);
|
|
26
|
+
session.set("code", codeValue);
|
|
27
|
+
session.set("name", userInfo?.name);
|
|
28
|
+
session.set("email", userInfo?.email);
|
|
29
|
+
session.set("employee_id", userInfo?.employee_id);
|
|
30
|
+
return userInfo;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
9
33
|
/**
|
|
10
34
|
* loginWebApp
|
|
11
35
|
* @param session
|
|
@@ -16,8 +40,9 @@ import { config } from "@zauru-sdk/config";
|
|
|
16
40
|
export const loginWebApp = async (session, codeValue, cookie) => {
|
|
17
41
|
return handlePossibleAxiosErrors(async () => {
|
|
18
42
|
const userInfoResponse = await getOauthUserInfo(codeValue ?? "");
|
|
19
|
-
if (userInfoResponse.error) {
|
|
20
|
-
throw new Error(userInfoResponse.userMsg
|
|
43
|
+
if (userInfoResponse.error || !userInfoResponse.data) {
|
|
44
|
+
throw new Error(userInfoResponse.userMsg ??
|
|
45
|
+
"Error al obtener la información del usuario en Oauth.");
|
|
21
46
|
}
|
|
22
47
|
const userInfo = userInfoResponse.data;
|
|
23
48
|
session.set("username", userInfo?.username);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const getSession: (cookieHeader?: string | null, options?: import("cookie").CookieParseOptions) => Promise<Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>>, commitSession: (session: Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>, options?: import("cookie").CookieSerializeOptions) => Promise<string>, destroySession: (session: Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>, options?: import("cookie").CookieSerializeOptions) => Promise<string>;
|
|
1
|
+
declare const getSession: (cookieHeader?: string | null, options?: import("cookie").CookieParseOptions) => Promise<import("@remix-run/node").Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>>, commitSession: (session: import("@remix-run/node").Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>, options?: import("cookie").CookieSerializeOptions) => Promise<string>, destroySession: (session: import("@remix-run/node").Session<import("@remix-run/node").SessionData, import("@remix-run/node").SessionData>, options?: import("cookie").CookieSerializeOptions) => Promise<string>;
|
|
3
2
|
declare const getRefreshSession: (request: Request) => Promise<string | null>;
|
|
4
3
|
export { getSession, commitSession, destroySession, getRefreshSession };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "Servicios de consulta a Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"@remix-run/node": "^2.8.1",
|
|
27
27
|
"@upstash/redis": "^1.34.5",
|
|
28
28
|
"@zauru-sdk/common": "^2.16.1",
|
|
29
|
-
"@zauru-sdk/config": "^2.0
|
|
29
|
+
"@zauru-sdk/config": "^2.19.0",
|
|
30
30
|
"@zauru-sdk/graphql": "^2.14.2",
|
|
31
31
|
"@zauru-sdk/types": "^2.16.0",
|
|
32
32
|
"axios": "^1.6.7",
|
|
33
33
|
"chalk": "5.3.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "aced1df501d94713d42c59ea25f3c0c26f97c8c3"
|
|
36
36
|
}
|