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

@datastax/astra-db-ts

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datastax/astra-db-ts - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

26

dist/client/httpClient.js

@@ -26,3 +26,2 @@ "use strict";

const utils_1 = require("../collections/utils");
const bson_1 = require("bson");
const REQUESTED_WITH = version_1.LIB_NAME + '/' + version_1.LIB_VERSION;

@@ -53,19 +52,2 @@ const DEFAULT_AUTH_HEADER = 'X-Cassandra-Token';

});
// InternalAxiosRequestConfig because of https://github.com/axios/axios/issues/5494#issuecomment-1402663237
const requestInterceptor = (config) => {
const { method, url } = config;
if (logger_1.logger.isLevelEnabled('http')) {
logger_1.logger.http(`--- request ${method?.toUpperCase()} ${url} ${serializeCommand(config.data, true)}`);
}
config.data = serializeCommand(config.data);
return config;
};
const responseInterceptor = (response) => {
if (logger_1.logger.isLevelEnabled('http')) {
logger_1.logger.http(`--- response ${response.status} ${response.config.method?.toUpperCase()} ${response.config.url} ${JSON.stringify(response.data, null, 2)}`);
}
return response;
};
axiosAgent.interceptors.request.use(requestInterceptor);
axiosAgent.interceptors.response.use(responseInterceptor);
class HTTPClient {

@@ -161,3 +143,3 @@ constructor(options) {

status: response.data.status,
data: deserialize(response.data.data),
data: response.data.data,
errors: response.data.errors

@@ -223,8 +205,2 @@ };

exports.handleIfErrorResponse = handleIfErrorResponse;
function serializeCommand(data, pretty) {
return bson_1.EJSON.stringify(data, (key, value) => handleValues(key, value), pretty ? ' ' : '');
}
function deserialize(data) {
return data != null ? bson_1.EJSON.deserialize(data) : data;
}
function handleValues(key, value) {

@@ -231,0 +207,0 @@ if (value != null && typeof value === 'bigint') {

2

dist/src/client/httpClient.js

@@ -159,3 +159,3 @@ "use strict";

status: response.data.status,
data: deserialize(response.data.data),
data: response.data.data,
errors: response.data.errors

@@ -162,0 +162,0 @@ };

export declare const LIB_NAME = "@datastax/astra-db-ts";
export declare const LIB_VERSION = "0.0.22";
export declare const LIB_VERSION = "0.0.23";

@@ -5,3 +5,3 @@ "use strict";

exports.LIB_NAME = "@datastax/astra-db-ts";
exports.LIB_VERSION = "0.0.22";
exports.LIB_VERSION = "0.0.23";
//# sourceMappingURL=version.js.map
{
"name": "@datastax/astra-db-ts",
"version": "0.0.22",
"version": "0.0.23",
"description": "Astra DB TS Client",

@@ -92,8 +92,4 @@ "contributors": [

"axios": "^1.4.0",
"bson": "^6.2.0",
"winston": "^3.7.2"
},
"browser": {
"crypto": false
},
"engines": {

@@ -100,0 +96,0 @@ "node": ">=14.0.0"

@@ -21,3 +21,2 @@ // Copyright DataStax, Inc.

import { getStargateAccessToken } from '../collections/utils';
import { EJSON } from 'bson';

@@ -71,22 +70,3 @@ const REQUESTED_WITH = LIB_NAME + '/' + LIB_VERSION;

// InternalAxiosRequestConfig because of https://github.com/axios/axios/issues/5494#issuecomment-1402663237
const requestInterceptor = (config: InternalAxiosRequestConfig) => {
const { method, url } = config;
if (logger.isLevelEnabled('http')) {
logger.http(`--- request ${method?.toUpperCase()} ${url} ${serializeCommand(config.data, true)}`);
}
config.data = serializeCommand(config.data);
return config;
};
const responseInterceptor = (response: AxiosResponse) => {
if (logger.isLevelEnabled('http')) {
logger.http(`--- response ${response.status} ${response.config.method?.toUpperCase()} ${response.config.url} ${JSON.stringify(response.data, null, 2)}`);
}
return response;
};
axiosAgent.interceptors.request.use(requestInterceptor);
axiosAgent.interceptors.response.use(responseInterceptor);
export class HTTPClient {

@@ -189,3 +169,3 @@ baseUrl: string;

status: response.data.status,
data: deserialize(response.data.data),
data: response.data.data,
errors: response.data.errors

@@ -253,10 +233,2 @@ };

function serializeCommand(data: Record<string, any>, pretty?: boolean): string {
return EJSON.stringify(data, (key: any, value: any) => handleValues(key, value), pretty ? ' ' : '');
}
function deserialize(data: Record<string, any>): Record<string, any> {
return data != null ? EJSON.deserialize(data) : data;
}
function handleValues(key: any, value: any): any {

@@ -263,0 +235,0 @@ if (value != null && typeof value === 'bigint') {

export const LIB_NAME = "@datastax/astra-db-ts";
export const LIB_VERSION = "0.0.22";
export const LIB_VERSION = "0.0.23";

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