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

@cubejs-backend/shared

Package Overview
Dependencies
Maintainers
2
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cubejs-backend/shared - npm Package Compare versions

Comparing version 0.28.24 to 0.28.29

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.28.29](https://github.com/cube-js/cube.js/compare/v0.28.28...v0.28.29) (2021-08-31)
### Features
* Mixed rolling window and regular measure queries from rollup support ([#3326](https://github.com/cube-js/cube.js/issues/3326)) ([3147e33](https://github.com/cube-js/cube.js/commit/3147e339f14ede73e5b0d14d05b9dd1f8b79e7b8))
## [0.28.24](https://github.com/cube-js/cube.js/compare/v0.28.23...v0.28.24) (2021-08-19)

@@ -8,0 +19,0 @@

3

dist/src/time.d.ts

@@ -9,3 +9,6 @@ import { DateRange } from 'moment-range';

export declare const TO_PARTITION_RANGE = "__TO_PARTITION_RANGE";
export declare const BUILD_RANGE_START_LOCAL = "__BUILD_RANGE_START_LOCAL";
export declare const BUILD_RANGE_END_LOCAL = "__BUILD_RANGE_END_LOCAL";
export declare const inDbTimeZone: (timezone: string, timestampFormat: string, timestamp: string) => string;
export declare const utcToLocalTimeZone: (timezone: string, timestampFormat: string, timestamp: string) => string;
export declare const extractDate: (data: any) => string;

@@ -12,0 +15,0 @@ export declare const addSecondsToLocalTimestamp: (timestamp: string, timezone: string, seconds: number) => Date;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addSecondsToLocalTimestamp = exports.extractDate = exports.inDbTimeZone = exports.TO_PARTITION_RANGE = exports.FROM_PARTITION_RANGE = exports.timeSeries = exports.TIME_SERIES = void 0;
exports.addSecondsToLocalTimestamp = exports.extractDate = exports.utcToLocalTimeZone = exports.inDbTimeZone = exports.BUILD_RANGE_END_LOCAL = exports.BUILD_RANGE_START_LOCAL = exports.TO_PARTITION_RANGE = exports.FROM_PARTITION_RANGE = exports.timeSeries = exports.TIME_SERIES = void 0;
const moment_range_1 = require("moment-range");

@@ -37,2 +37,4 @@ const Moment = require('moment-timezone');

exports.TO_PARTITION_RANGE = '__TO_PARTITION_RANGE';
exports.BUILD_RANGE_START_LOCAL = '__BUILD_RANGE_START_LOCAL';
exports.BUILD_RANGE_END_LOCAL = '__BUILD_RANGE_END_LOCAL';
const inDbTimeZone = (timezone, timestampFormat, timestamp) => {

@@ -57,2 +59,22 @@ if (timestamp.length === 23) {

exports.inDbTimeZone = inDbTimeZone;
const utcToLocalTimeZone = (timezone, timestampFormat, timestamp) => {
if (timestamp.length === 23) {
const zone = moment.tz.zone(timezone);
if (!zone) {
throw new Error(`Unknown timezone: ${timezone}`);
}
const parsedTime = Date.parse(`${timestamp}Z`);
// TODO parsedTime might be incorrect offset for conversion
const offset = zone.utcOffset(parsedTime);
const inDbTimeZoneDate = new Date(parsedTime - offset * 60 * 1000);
if (timestampFormat === 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' || timestampFormat === 'YYYY-MM-DDTHH:mm:ss.SSSZ') {
return inDbTimeZoneDate.toJSON();
}
else if (timestampFormat === 'YYYY-MM-DDTHH:mm:ss.SSS') {
return inDbTimeZoneDate.toJSON().replace('Z', '');
}
}
return moment.tz(timestamp, 'UTC').tz(timezone).format(timestampFormat);
};
exports.utcToLocalTimeZone = utcToLocalTimeZone;
const extractDate = (data) => {

@@ -59,0 +81,0 @@ data = JSON.parse(JSON.stringify(data));

4

package.json
{
"name": "@cubejs-backend/shared",
"version": "0.28.24",
"version": "0.28.29",
"description": "Shared code for Cube.js backend packages",

@@ -68,3 +68,3 @@ "main": "dist/src/index.js",

},
"gitHead": "4fd57f9805fb1e89c19436eff24822607f98183b"
"gitHead": "d3fddfec0d18522fb9d001ccf623d0445c3d63fc"
}

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