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

@balena/odata-to-abstract-sql

Package Overview
Dependencies
Maintainers
3
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/odata-to-abstract-sql - npm Package Compare versions

Comparing version 5.4.3-date-compares-with-date-trunc-1fbea7c4974d959b0f58791126aeba80b161904e to 5.4.3-date-compares-with-date-trunc-b35607dfa9bc795458ab50d5bcfcc96f21cd7308

4

CHANGELOG.md

@@ -7,5 +7,5 @@ # Change Log

## 5.4.3 - 2021-07-28
## 5.4.3 - 2021-08-17
* Add SBVR Date TIme Type to DateTrunc Wrapper [fisehara]
* Add SBVR Date TIme Type to DateTrunc Wrapper JS Date format has only milliseconds precision, postgresql stores TIMESTAMPS with microseconds precission. Comparisions may fail, when giving millisecond JS dates but comparing on microseconds. [fisehara]

@@ -12,0 +12,0 @@ ## 5.4.2 - 2021-06-30

@@ -825,12 +825,12 @@ "use strict";

else {
let fieldDefinition;
const mapping = this.ResourceMapping(prop.resource);
if (mapping[prop.name]) {
const fieldDefinition = _.find(prop.resource.fields, {
fieldDefinition = _.find(prop.resource.fields, {
fieldName: mapping[prop.name][1],
});
if ((fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.dataType) === 'Date Time' ||
(fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.dataType) === 'Date') {
if ((fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.dataType) === 'Date Time') {
return [
'DateTrunc',
['Text', 'milliseconds'],
['EmbeddedText', 'milliseconds'],
this.ReferencedField(prop.resource, prop.name),

@@ -837,0 +837,0 @@ ];

{
"name": "@balena/odata-to-abstract-sql",
"version": "5.4.3-date-compares-with-date-trunc-1fbea7c4974d959b0f58791126aeba80b161904e",
"version": "5.4.3-date-compares-with-date-trunc-b35607dfa9bc795458ab50d5bcfcc96f21cd7308",
"description": "A consumer of the OData parser, written in OMeta",

@@ -53,7 +53,7 @@ "main": "out/odata-to-abstract-sql.js",

"bail": true,
"_": "test/resource_parsing.coffee"
"_": "test/*.coffee"
},
"versionist": {
"publishedAt": "2021-07-28T12:31:10.760Z"
"publishedAt": "2021-08-17T18:35:20.295Z"
}
}

@@ -1083,20 +1083,26 @@ import * as _ from 'lodash';

} else {
// Used as ReferencedProperty a DateValue has to be handled with a date_trunc
// TODO: How to get the underlying db engine on this.layer
// Natively created timestamps in postgres have a microseconds precision
// js has only milliseconds precision, thus retrieved timestamps may fail on eq, ne, gt, lt comparisons
// furthermore retrieved timestamps should be truncated on database and not on the db abstraction layer
// thus SBVR Date Time fields have to be truncated to millisecond precision
// getting schema dataType from field mapping
let fieldDefinition;
const mapping = this.ResourceMapping(prop.resource);
if (mapping[prop.name]) {
const fieldDefinition = _.find(prop.resource.fields, {
fieldDefinition = _.find(prop.resource.fields, {
fieldName: mapping[prop.name][1],
});
if (
fieldDefinition?.dataType === 'Date Time' ||
fieldDefinition?.dataType === 'Date'
) {
// when date time field from schema => hardcoded DateTrunc
// following abstractsql to sql compiler have to check engine to translate to proper eninge based sql query
if (fieldDefinition?.dataType === 'Date Time') {
return [
'DateTrunc',
['Text', 'milliseconds'],
['EmbeddedText', 'milliseconds'],
this.ReferencedField(prop.resource, prop.name),
];
// return referencedField;
}
}
return this.ReferencedField(prop.resource, prop.name);

@@ -1103,0 +1109,0 @@ }

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