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

grpc-shared

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grpc-shared - npm Package Compare versions

Comparing version 1.0.38 to 1.0.39

3

lib/shared/decorators/user.decorator.d.ts

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

import { OrganizationModel } from "@alpha.apps/pemo-proto/lib/organization/organization.pb";
import { UserModel } from "@alpha.apps/pemo-proto/lib/user/user.pb";

@@ -5,3 +6,3 @@ import { Metadata } from "@grpc/grpc-js";

export declare function getUserFromMetadata(metadata: Metadata): UserModel;
export declare function getOrganizationFromMetadata(metadata: Metadata): import("@grpc/grpc-js").MetadataValue;
export declare function getOrganizationFromMetadata(metadata: Metadata): OrganizationModel;
export declare function getIsBackOfficeFromMetadata(metadata: Metadata): any;

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

function getOrganizationFromMetadata(metadata) {
const [subdomain] = metadata.get(constants_1.SUBDOMAIN);
if (!subdomain) {
// no sub domain presented exception
const [isBackoffice] = metadata.get(constants_1.IS_BACKOFFICE);
if (isBackoffice) {
const [org] = metadata.get('organization');
if (!org) {
throw new grpc_exceptions_1.UnauthorizedException();
}
return JSON.parse(org);
}
return subdomain;
const [subdomain] = metadata.get('subdomain');
const [striginfiedUser] = metadata.get('user');
if (!striginfiedUser) {
throw new grpc_exceptions_1.UnauthenticatedException();
}
const user = JSON.parse(striginfiedUser);
const organization = user.organizations.filter((organization) => {
return organization.businessName === subdomain;
})[0];
if (!organization) {
throw new grpc_exceptions_1.UnauthorizedException();
}
return organization;
}

@@ -30,0 +46,0 @@ exports.getOrganizationFromMetadata = getOrganizationFromMetadata;

{
"name": "grpc-shared",
"version": "1.0.38",
"version": "1.0.39",
"description": "shared logic between services",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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