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

@standardnotes/analytics

Package Overview
Dependencies
Maintainers
5
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@standardnotes/analytics - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

11

CHANGELOG.md

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

# [1.4.0](https://github.com/standardnotes/snjs/compare/@standardnotes/analytics@1.3.1...@standardnotes/analytics@1.4.0) (2022-06-01)
### Features
* add calculating total counts of activites in analytics ([6ed659a](https://github.com/standardnotes/snjs/commit/6ed659a7c4411ce2555e4af96dc5473c3d03fd41))
## [1.3.1](https://github.com/standardnotes/snjs/compare/@standardnotes/analytics@1.3.0...@standardnotes/analytics@1.3.1) (2022-05-26)

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

2

dist/Domain/Service/AnalyticsStoreInterface.d.ts

@@ -22,2 +22,4 @@ import { AnalyticsActivity } from './AnalyticsActivity';

calculateActivityRetentionForLastWeek(activity: AnalyticsActivity): Promise<number>;
calculateActivityTotalCountForYesterday(activity: AnalyticsActivity): Promise<number>;
calculateActivityTotalCountForLastWeek(activity: AnalyticsActivity): Promise<number>;
}

@@ -7,2 +7,4 @@ import * as IORedis from 'ioredis';

constructor(redisClient: IORedis.Redis);
calculateActivityTotalCountForYesterday(activity: AnalyticsActivity): Promise<number>;
calculateActivityTotalCountForLastWeek(activity: AnalyticsActivity): Promise<number>;
calculateActivityRetentionForYesterday(activity: AnalyticsActivity): Promise<number>;

@@ -9,0 +11,0 @@ calculateActivityRetentionForLastWeek(activity: AnalyticsActivity): Promise<number>;

@@ -17,2 +17,12 @@ "use strict";

}
calculateActivityTotalCountForYesterday(activity) {
return __awaiter(this, void 0, void 0, function* () {
return this.redisClient.bitcount(`bitmap:action:${activity}:timespan:${this.getDailyKey(this.getYesterdayDate())}`);
});
}
calculateActivityTotalCountForLastWeek(activity) {
return __awaiter(this, void 0, void 0, function* () {
return this.redisClient.bitcount(`bitmap:action:${activity}:timespan:${this.getWeeklyKey(this.getLastWeekDate())}`);
});
}
calculateActivityRetentionForYesterday(activity) {

@@ -19,0 +29,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -30,2 +30,18 @@ "use strict";

});
it('should calculate total count of activities yesterday', () => __awaiter(void 0, void 0, void 0, function* () {
redisClient.bitcount = jest.fn().mockReturnValue(70);
jest.useFakeTimers('modern');
jest.setSystemTime(1653395155000);
expect(yield createStore().calculateActivityTotalCountForYesterday(Domain_1.AnalyticsActivity.EditingItems)).toEqual(70);
jest.useRealTimers();
expect(redisClient.bitcount).toHaveBeenCalledWith('bitmap:action:editing-items:timespan:2022-5-23');
}));
it('should calculate total count of activities last week', () => __awaiter(void 0, void 0, void 0, function* () {
redisClient.bitcount = jest.fn().mockReturnValue(70);
jest.useFakeTimers('modern');
jest.setSystemTime(1653395155000);
expect(yield createStore().calculateActivityTotalCountForLastWeek(Domain_1.AnalyticsActivity.EditingItems)).toEqual(70);
jest.useRealTimers();
expect(redisClient.bitcount).toHaveBeenCalledWith('bitmap:action:editing-items:timespan:2022-week-20');
}));
it('should calculate activity retention for yesterday', () => __awaiter(void 0, void 0, void 0, function* () {

@@ -32,0 +48,0 @@ redisClient.bitcount = jest.fn().mockReturnValueOnce(7).mockReturnValueOnce(10);

4

package.json
{
"name": "@standardnotes/analytics",
"version": "1.3.1",
"version": "1.4.0",
"engines": {

@@ -39,3 +39,3 @@ "node": ">=14.0.0 <17.0.0"

},
"gitHead": "ed2d05b2470a9afe46f73e1ef2b5d4a6fa665e02"
"gitHead": "01714e358364a393a144275187d4c0f4eda4f40d"
}
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