Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cobuildlab/8base-utils

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cobuildlab/8base-utils - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

8

lib/utils.d.ts

@@ -40,1 +40,9 @@ /**

export declare const _validateReferences: (objs: any, errorPrefix: string) => void;
/**
* Parses the GraphQL error to JSON to get its message.
* If a GraphQL message is not found, it will return the error's message instead.
*
* @param {Error} error - The graphql error.
* @returns {string} The error with the parsed message.
*/
export declare function getMessageFromGraphQLError(error: Error): any;

33

lib/utils.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._validateReferences = exports._validateReference = exports._validateFiles = exports._validateFile = exports._validateNullOrUndefinedOrBlank = void 0;
exports.getMessageFromGraphQLError = exports._validateReferences = exports._validateReference = exports._validateFiles = exports._validateFile = exports._validateNullOrUndefinedOrBlank = void 0;
var validation_utils_1 = require("@cobuildlab/validation-utils");

@@ -73,1 +73,32 @@ var ValidationError_1 = require("./error/ValidationError");

};
/**
* Parses the GraphQL error to JSON to get its message.
* If a GraphQL message is not found, it will return the error's message instead.
*
* @param {Error} error - The graphql error.
* @returns {string} The error with the parsed message.
*/
function getMessageFromGraphQLError(error) {
var message = error.message;
var jsonStartIndex = message.indexOf(' {');
var jsonEndIndex = message.lastIndexOf('}') + 1;
var jsonBody = message.substring(jsonStartIndex, jsonEndIndex);
var jsonError;
try {
jsonError = JSON.parse(jsonBody);
}
catch (e) {
console.error('getMessageFromGraphQLError Error: ', e);
return message;
}
var jsonMessage = jsonError.message, raw = jsonError.raw;
if (jsonMessage) {
return jsonMessage;
}
if (raw && raw.message) {
return raw.message;
}
// Return original message.
return message;
}
exports.getMessageFromGraphQLError = getMessageFromGraphQLError;

2

package.json
{
"name": "@cobuildlab/8base-utils",
"version": "0.4.0",
"version": "0.4.1",
"description": "This is package to deal with common scenarios working with 8base platform",

@@ -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