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

@google-cloud/datastore

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/datastore - npm Package Compare versions

Comparing version 8.7.0 to 9.0.0

23

build/src/query.d.ts

@@ -26,2 +26,3 @@ /*!

import { RunQueryStreamOptions } from '../src/request';
import { google } from '../protos/protos';
export type Operator = '=' | '<' | '>' | '<=' | '>=' | 'HAS_ANCESTOR' | '!=' | 'IN' | 'NOT_IN';

@@ -409,2 +410,5 @@ export interface OrderOptions {

}
export interface ExplainOptions {
analyze?: boolean;
}
export interface RunQueryOptions {

@@ -414,2 +418,3 @@ consistency?: 'strong' | 'eventual';

gaxOptions?: CallOptions;
explainOptions?: ExplainOptions;
wrapNumbers?: boolean | IntegerTypeCastOptions;

@@ -425,2 +430,20 @@ }

moreResults?: 'MORE_RESULTS_TYPE_UNSPECIFIED' | 'NOT_FINISHED' | 'MORE_RESULTS_AFTER_LIMIT' | 'MORE_RESULTS_AFTER_CURSOR' | 'NO_MORE_RESULTS';
explainMetrics?: ExplainMetrics;
}
export interface ExplainMetrics {
planSummary?: PlanSummary;
executionStats?: ExecutionStats;
}
export interface ExecutionStats {
resultsReturned?: number;
executionDuration?: google.protobuf.IDuration;
readOperations?: number;
debugStats?: {
[key: string]: any;
};
}
export interface PlanSummary {
indexesUsed: {
[key: string]: any;
}[];
}

10

build/src/request.d.ts

@@ -24,3 +24,3 @@ /*!

import { entity, Entity, EntityProto, Entities } from './entity';
import { Query, QueryProto, RunQueryOptions, RunQueryResponse, RunQueryCallback } from './query';
import { ExplainOptions, Query, QueryProto, RunQueryInfo, RunQueryOptions, RunQueryResponse, RunQueryCallback } from './query';
import { Datastore } from '.';

@@ -335,4 +335,4 @@ import ITimestamp = google.protobuf.ITimestamp;

runAggregationQuery(query: AggregateQuery, options?: RunQueryOptions): Promise<RunQueryResponse>;
runAggregationQuery(query: AggregateQuery, options: RunQueryOptions, callback: RequestCallback): void;
runAggregationQuery(query: AggregateQuery, callback: RequestCallback): void;
runAggregationQuery(query: AggregateQuery, options: RunQueryOptions, callback: RunAggregationQueryCallback): void;
runAggregationQuery(query: AggregateQuery, callback: RunAggregationQueryCallback): void;
/**

@@ -563,2 +563,5 @@ * Datastore allows you to query entities by kind, filter them by property

}
export interface RunAggregationQueryCallback {
(a?: Error | null, b?: any, c?: RunQueryInfo): void;
}
export interface RequestConfig {

@@ -573,2 +576,3 @@ client: string;

databaseId?: string;
explainOptions?: ExplainOptions;
projectId?: string;

@@ -575,0 +579,0 @@ partitionId?: google.datastore.v1.IPartitionId | null;

@@ -34,2 +34,70 @@ "use strict";

const query_1 = require("./query");
const google_gax_1 = require("google-gax");
const gax = require("google-gax");
const root = gax.protobuf.loadSync('google/protobuf/struct.proto');
const Struct = root.lookupType('Struct');
// This function decodes Struct proto values
function decodeStruct(structValue) {
return google_gax_1.serializer.toProto3JSON(Struct.fromObject(structValue));
}
// This function gets a RunQueryInfo object that contains explain metrics that
// were returned from the server.
function getInfoFromStats(resp) {
// Decode struct values stored in planSummary and executionStats
const explainMetrics = {};
if (resp &&
resp.explainMetrics &&
resp.explainMetrics.planSummary &&
resp.explainMetrics.planSummary.indexesUsed) {
Object.assign(explainMetrics, {
planSummary: {
indexesUsed: resp.explainMetrics.planSummary.indexesUsed.map((index) => decodeStruct(index)),
},
});
}
if (resp && resp.explainMetrics && resp.explainMetrics.executionStats) {
const executionStats = {};
{
const resultsReturned = resp.explainMetrics.executionStats.resultsReturned;
if (resultsReturned) {
Object.assign(executionStats, {
resultsReturned: typeof resultsReturned === 'string'
? parseInt(resultsReturned)
: resultsReturned,
});
}
}
{
const executionDuration = resp.explainMetrics.executionStats.executionDuration;
if (executionDuration) {
Object.assign(executionStats, {
executionDuration: typeof executionDuration === 'string'
? parseInt(executionDuration)
: executionDuration,
});
}
}
{
const readOperations = resp.explainMetrics.executionStats.readOperations;
if (readOperations) {
Object.assign(executionStats, {
readOperations: typeof readOperations === 'string'
? parseInt(readOperations)
: readOperations,
});
}
}
{
const debugStats = resp.explainMetrics.executionStats.debugStats;
if (debugStats) {
Object.assign(executionStats, { debugStats: decodeStruct(debugStats) });
}
}
Object.assign(explainMetrics, { executionStats });
}
if (explainMetrics.planSummary || explainMetrics.executionStats) {
return { explainMetrics };
}
return {};
}
/**

@@ -244,2 +312,3 @@ * A map of read consistency values to proto codes.

}, (err, res) => {
const info = getInfoFromStats(res);
if (res && res.batch) {

@@ -253,6 +322,6 @@ const results = res.batch.aggregationResults;

]))));
callback(err, finalResults);
callback(err, finalResults, info);
}
else {
callback(err, res);
callback(err, [], info);
}

@@ -335,5 +404,11 @@ });

}
const info = {
if (!resp.batch) {
// If there are no results then send any stats back and end the stream.
stream.emit('info', getInfoFromStats(resp));
stream.push(null);
return;
}
const info = Object.assign(getInfoFromStats(resp), {
moreResults: resp.batch.moreResults,
};
});
if (resp.batch.endCursor) {

@@ -400,2 +475,5 @@ info.endCursor = resp.batch.endCursor.toString('base64');

const sharedQueryOpts = this.getRequestOptions(options);
if (options.explainOptions) {
sharedQueryOpts.explainOptions = options.explainOptions;
}
if (query.namespace) {

@@ -478,5 +556,10 @@ sharedQueryOpts.partitionId = {

}
reqOpts.readOptions = {
transaction: this.id,
};
if (reqOpts.readOptions) {
Object.assign(reqOpts.readOptions, { transaction: this.id });
}
else {
reqOpts.readOptions = {
transaction: this.id,
};
}
}

@@ -483,0 +566,0 @@ datastore.auth.getProjectId((err, projectId) => {

@@ -7,2 +7,19 @@ # Changelog

## [9.0.0](https://github.com/googleapis/nodejs-datastore/compare/v8.7.0...v9.0.0) (2024-05-09)
### ⚠ BREAKING CHANGES
* An existing method `UpdateVehicleLocation` is removed from service `VehicleService` ([#1248](https://github.com/googleapis/nodejs-datastore/issues/1248))
### Features
* Query profiling feature ([#1221](https://github.com/googleapis/nodejs-datastore/issues/1221)) ([414dec4](https://github.com/googleapis/nodejs-datastore/commit/414dec4e1548f551be06df914d6b56362bdc1790))
### Bug Fixes
* An existing method `UpdateVehicleLocation` is removed from service `VehicleService` ([#1248](https://github.com/googleapis/nodejs-datastore/issues/1248)) ([ba79118](https://github.com/googleapis/nodejs-datastore/commit/ba79118ac00ccc3bb0380ee5693c3b687a7ae9c7))
* Read time should be used for transaction reads ([#1171](https://github.com/googleapis/nodejs-datastore/issues/1171)) ([73a0a39](https://github.com/googleapis/nodejs-datastore/commit/73a0a39b4c0423a5b4802076cdce80fce7c9adda))
## [8.7.0](https://github.com/googleapis/nodejs-datastore/compare/v8.6.0...v8.7.0) (2024-04-02)

@@ -9,0 +26,0 @@

{
"name": "@google-cloud/datastore",
"version": "8.7.0",
"version": "9.0.0",
"description": "Cloud Datastore Client Library for Node.js",

@@ -5,0 +5,0 @@ "keywords": [

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

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

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