You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

corede-core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

corede-core - npm Package Compare versions

Comparing version

to
6.0.26-alpha

export { upperDirectiveTransformer } from "./directives/upper-case.directive";
export * from "./error";
export * from "./exception";
export { formatErrorFunction } from "./formatter/error.formatter";

@@ -3,0 +5,0 @@ export { graphqlErrorLogger } from "./logger/apolloError.logger";

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -6,2 +20,4 @@ exports.LoggingPlugin = exports.graphqlErrorLogger = exports.formatErrorFunction = exports.upperDirectiveTransformer = void 0;

Object.defineProperty(exports, "upperDirectiveTransformer", { enumerable: true, get: function () { return upper_case_directive_1.upperDirectiveTransformer; } });
__exportStar(require("./error"), exports);
__exportStar(require("./exception"), exports);
var error_formatter_1 = require("./formatter/error.formatter");

@@ -8,0 +24,0 @@ Object.defineProperty(exports, "formatErrorFunction", { enumerable: true, get: function () { return error_formatter_1.formatErrorFunction; } });

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

const common_1 = require("@nestjs/common");
const infoErrorCode = [
"GRAPHQL_PARSE_FAILED",
"GRAPHQL_VALIDATION_FAILED",
"BAD_USER_INPUT",
"UNAUTHENTICATED",
"FORBIDDEN",
"PERSISTED_QUERY_NOT_FOUND",
"PERSISTED_QUERY_NOT_SUPPORTED",
];
const error_1 = require("../error");
function graphqlErrorLogger(error) {
let errorString = `${error.message}: ${JSON.stringify(error)}`;
if (error.extensions?.code &&
infoErrorCode.includes(error.extensions.code)) {
typeof error.extensions?.code === "string" &&
(0, error_1.isUserError)(error.extensions?.code)) {
common_1.Logger.log(errorString, "ErrorLogger");

@@ -20,0 +13,0 @@ }

{
"name": "corede-core",
"version": "6.0.25alpha",
"version": "6.0.26alpha",
"description": "Core functionalities",

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

@@ -7,2 +7,12 @@ ////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////
// error
////////////////////////////////////////////////////////////////
export * from "./error";
////////////////////////////////////////////////////////////////
// exception
////////////////////////////////////////////////////////////////
export * from "./exception";
////////////////////////////////////////////////////////////////
// formatters

@@ -9,0 +19,0 @@ ////////////////////////////////////////////////////////////////

import { Logger } from "@nestjs/common";
import { GraphQLFormattedError } from "graphql";
import { isUserError } from "../error";
const infoErrorCode: string[] = [
"GRAPHQL_PARSE_FAILED",
"GRAPHQL_VALIDATION_FAILED",
"BAD_USER_INPUT",
"UNAUTHENTICATED",
"FORBIDDEN",
"PERSISTED_QUERY_NOT_FOUND",
"PERSISTED_QUERY_NOT_SUPPORTED",
];
export function graphqlErrorLogger(error: GraphQLFormattedError): void {

@@ -18,3 +9,4 @@ let errorString = `${error.message}: ${JSON.stringify(error)}`;

error.extensions?.code &&
infoErrorCode.includes(error.extensions.code as string)
typeof error.extensions?.code === "string" &&
isUserError(error.extensions?.code)
) {

@@ -21,0 +13,0 @@ Logger.log(errorString, "ErrorLogger");

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