New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vc-shell/core

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vc-shell/core - npm Package Compare versions

Comparing version 1.0.31 to 1.0.33

dist/types/factories.d.ts

2

dist/types/index.d.ts

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

import { IUseUserFactoryParams, IUseNotificationsFactoryParams, IUseSettingsFactoryParams } from "./factories";
export interface AuthData {

@@ -18,2 +19,3 @@ accessToken?: string;

}
export type { IUseUserFactoryParams, IUseNotificationsFactoryParams, IUseSettingsFactoryParams, };
//# sourceMappingURL=index.d.ts.map

8

package.json
{
"name": "@vc-shell/core",
"version": "1.0.31",
"version": "1.0.33",
"scripts": {

@@ -14,7 +14,7 @@ "build": "vite build"

"devDependencies": {
"@vc-shell/config-generator": "^1.0.31",
"@vc-shell/config-generator": "^1.0.33",
"typescript": "^4.6.2"
},
"dependencies": {
"@vc-shell/api-client": "^1.0.31",
"@vc-shell/api-client": "^1.0.33",
"client-oauth2": "^4.3.3",

@@ -28,3 +28,3 @@ "vue-i18n": "^9.1.7",

},
"gitHead": "ca7d35216d49aa6bdf1f416f5d8480920d1bc824"
"gitHead": "fc1ea41bd6bfcbb0e95aef160710abd03b28ef75"
}
import {
PushNotification,
PushNotificationClient,
} from "@vc-shell/api-client";
import useUser from "../useUser";
import { computed, ComputedRef, readonly, ref } from "vue";
import { computed, ComputedRef, inject, readonly, ref } from "vue";
import useLogger from "../useLogger";
import _ from "lodash-es";
import { IUseNotificationsFactoryParams } from "../../types";
const notificationsClient = new PushNotificationClient();
interface INotifications {

@@ -27,2 +25,5 @@ readonly notifications: ComputedRef<Readonly<PushNotification[]>>;

export default (): INotifications => {
const useNotificationsFactory = inject<IUseNotificationsFactoryParams>(
"useNotificationsFactory"
);
const { getAccessToken } = useUser();

@@ -36,17 +37,6 @@ const logger = useLogger();

try {
notificationsClient.setAuthToken(token);
const result = await fetch("/api/platform/pushnotifications", {
method: "POST",
headers: {
"Content-Type": "application/json-patch+json",
Accept: "application/json",
authorization: `Bearer ${token}`,
},
body: JSON.stringify({ take }),
});
useNotificationsFactory.setAuthToken(token);
result.text().then((response) => {
notifications.value =
<PushNotification[]>JSON.parse(response).notifyEvents ?? [];
});
notifications.value =
await useNotificationsFactory.getPushNotifications(token, take);
} catch (e) {

@@ -93,5 +83,5 @@ logger.error(e);

if (token) {
notificationsClient.setAuthToken(token);
useNotificationsFactory.setAuthToken(token);
try {
await notificationsClient.markAllAsRead();
await useNotificationsFactory.markAllAsRead();
notifications.value = notifications.value.map((x) => {

@@ -98,0 +88,0 @@ if (x.isNew) {

import useUser from "../useUser";
import useLogger from "../useLogger";
import { computed, Ref, ref } from "vue";
import { SettingClient } from "@vc-shell/api-client";
import { computed, inject, Ref, ref } from "vue";
import { IUseSettingsFactoryParams } from "../../types/factories";

@@ -13,2 +13,3 @@ interface IUseSettings {

export default (): IUseSettings => {
const useSettingsFactory = inject<IUseSettingsFactoryParams>("useSettingsFactory");
const { getAccessToken } = useUser();

@@ -18,5 +19,3 @@ const logger = useLogger();

async function getApiClient() {
const client = new SettingClient();
client.setAuthToken(await getAccessToken());
return client;
return useSettingsFactory.getApiClient(await getAccessToken());
}

@@ -23,0 +22,0 @@

@@ -1,12 +0,14 @@

import { computed, Ref, ref, ComputedRef } from "vue";
import { computed, Ref, ref, ComputedRef, inject } from "vue";
import ClientOAuth2 from "client-oauth2";
import {
UserDetail,
SecurityClient,
ResetPasswordConfirmRequest,
SecurityResult,
ValidatePasswordResetTokenRequest,
IdentityResult,
} from "@vc-shell/api-client";
import { AuthData, RequestPasswordResult, SignInResult } from "../../types";
import {
AuthData,
IUseUserFactoryParams,
RequestPasswordResult,
SignInResult,
} from "../../types";
//The Platform Manager uses the same key to store authorization data in the

@@ -24,3 +26,2 @@ //local storage, so we can exchange authorization data between the Platform Manager

});
const securityClient = new SecurityClient();

@@ -51,2 +52,3 @@ interface IUseUser {

export default (): IUseUser => {
const useUserFactory = inject<IUseUserFactoryParams>("useUserFactory");
async function validateToken(

@@ -59,5 +61,3 @@ userId: string,

loading.value = true;
result = await securityClient.validatePasswordResetToken(userId, {
token,
} as ValidatePasswordResetTokenRequest);
result = await useUserFactory.validateToken(userId, token);
} catch (e) {

@@ -72,3 +72,3 @@ //TODO: log error

async function validatePassword(password: string): Promise<IdentityResult> {
return securityClient.validatePassword(password);
return useUserFactory.validatePassword(password);
}

@@ -81,6 +81,3 @@

): Promise<SecurityResult> {
return securityClient.resetPasswordByToken(userId, {
newPassword: password,
token,
} as ResetPasswordConfirmRequest);
return useUserFactory.resetPasswordByToken(userId, password, token);
}

@@ -134,6 +131,6 @@

if (token) {
securityClient.setAuthToken(token);
useUserFactory.setAuthToken(token);
try {
loading.value = true;
user.value = await securityClient.getCurrentUser();
user.value = await useUserFactory.getCurrentUser();
console.log("[userUsers]: an user details has been loaded", user.value);

@@ -208,3 +205,3 @@ } catch (e) {

loading.value = true;
await securityClient.requestPasswordReset(loginOrEmail);
await useUserFactory.requestPasswordReset(loginOrEmail);
return { succeeded: true };

@@ -230,22 +227,7 @@ } catch (e) {

loading.value = true;
const res = await fetch(
"/api/platform/security/currentuser/changepassword",
{
method: "POST",
headers: {
"Content-Type": "application/json-patch+json",
Accept: "text/plain",
authorization: `Bearer ${token}`,
},
body: JSON.stringify({
oldPassword,
newPassword,
}),
}
result = await useUserFactory.changeUserPassword(
oldPassword,
newPassword,
token
);
if (res.status !== 500) {
result = await res.text().then((response) => {
return JSON.parse(response);
});
}
} catch (e) {

@@ -252,0 +234,0 @@ return { succeeded: false, errors: [e.message] } as SecurityResult;

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

import {
IUseUserFactoryParams,
IUseNotificationsFactoryParams,
IUseSettingsFactoryParams,
} from "./factories";
export interface AuthData {

@@ -21,1 +27,7 @@ accessToken?: string;

}
export type {
IUseUserFactoryParams,
IUseNotificationsFactoryParams,
IUseSettingsFactoryParams,
};

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 too big to display

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