Compare commits

...

2 Commits

Author SHA1 Message Date
standardci
3ad95afa84 chore(release): publish new version
- @standardnotes/analytics@2.9.5
 - @standardnotes/api-gateway@1.37.11
 - @standardnotes/auth-server@1.59.6
 - @standardnotes/domain-events-infra@1.9.22
 - @standardnotes/domain-events@2.86.0
 - @standardnotes/event-store@1.6.17
 - @standardnotes/files-server@1.8.17
 - @standardnotes/scheduler-server@1.13.18
 - @standardnotes/syncing-server@1.12.0
 - @standardnotes/websockets-server@1.4.19
 - @standardnotes/workspace-server@1.17.17
2022-11-11 12:45:17 +00:00
Karol Sójko
1a13861647 feat(syncing-server): add item content size recalculation 2022-11-11 13:43:22 +01:00
26 changed files with 117 additions and 12 deletions

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.9.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.9.4...@standardnotes/analytics@2.9.5) (2022-11-11)
**Note:** Version bump only for package @standardnotes/analytics
## [2.9.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.9.3...@standardnotes/analytics@2.9.4) (2022-11-11)
**Note:** Version bump only for package @standardnotes/analytics

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.9.4",
"version": "2.9.5",
"engines": {
"node": ">=14.0.0 <17.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.11](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.37.10...@standardnotes/api-gateway@1.37.11) (2022-11-11)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.37.10](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.37.9...@standardnotes/api-gateway@1.37.10) (2022-11-11)
**Note:** Version bump only for package @standardnotes/api-gateway

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.37.10",
"version": "1.37.11",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.59.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.59.5...@standardnotes/auth-server@1.59.6) (2022-11-11)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.59.5](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.59.4...@standardnotes/auth-server@1.59.5) (2022-11-11)
**Note:** Version bump only for package @standardnotes/auth-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.59.5",
"version": "1.59.6",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.9.22](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.21...@standardnotes/domain-events-infra@1.9.22) (2022-11-11)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.9.21](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.20...@standardnotes/domain-events-infra@1.9.21) (2022-11-11)
**Note:** Version bump only for package @standardnotes/domain-events-infra

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.9.21",
"version": "1.9.22",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.86.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.85.0...@standardnotes/domain-events@2.86.0) (2022-11-11)
### Features
* **syncing-server:** add item content size recalculation ([1a13861](https://github.com/standardnotes/server/commit/1a138616478a646d76404c425800937d2049a226))
# [2.85.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.84.1...@standardnotes/domain-events@2.85.0) (2022-11-11)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.85.0",
"version": "2.86.0",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -1,5 +1,5 @@
import { Uuid } from '@standardnotes/common'
export interface UserContentSizeRecalculationRequestedEventPayload {
userUuid?: Uuid
userUuid: Uuid
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.6.17](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.16...@standardnotes/event-store@1.6.17) (2022-11-11)
**Note:** Version bump only for package @standardnotes/event-store
## [1.6.16](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.15...@standardnotes/event-store@1.6.16) (2022-11-11)
**Note:** Version bump only for package @standardnotes/event-store

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/event-store",
"version": "1.6.16",
"version": "1.6.17",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.8.17](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.16...@standardnotes/files-server@1.8.17) (2022-11-11)
**Note:** Version bump only for package @standardnotes/files-server
## [1.8.16](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.15...@standardnotes/files-server@1.8.16) (2022-11-11)
**Note:** Version bump only for package @standardnotes/files-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.8.16",
"version": "1.8.17",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.13.18](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.13.17...@standardnotes/scheduler-server@1.13.18) (2022-11-11)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.13.17](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.13.16...@standardnotes/scheduler-server@1.13.17) (2022-11-11)
**Note:** Version bump only for package @standardnotes/scheduler-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.13.17",
"version": "1.13.18",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.12.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.11.10...@standardnotes/syncing-server@1.12.0) (2022-11-11)
### Features
* **syncing-server:** add item content size recalculation ([1a13861](https://github.com/standardnotes/syncing-server-js/commit/1a138616478a646d76404c425800937d2049a226))
## [1.11.10](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.11.9...@standardnotes/syncing-server@1.11.10) (2022-11-11)
**Note:** Version bump only for package @standardnotes/syncing-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.11.10",
"version": "1.12.0",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -79,6 +79,7 @@ import { AppDataSource } from './DataSource'
import { RevisionRepositoryInterface } from '../Domain/Revision/RevisionRepositoryInterface'
import { ItemRepositoryInterface } from '../Domain/Item/ItemRepositoryInterface'
import { Repository } from 'typeorm'
import { UserContentSizeRecalculationRequestedEventHandler } from '../Domain/Handler/UserContentSizeRecalculationRequestedEventHandler'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
@@ -220,6 +221,9 @@ export class ContainerConfigLoader {
container
.bind<CloudBackupRequestedEventHandler>(TYPES.CloudBackupRequestedEventHandler)
.to(CloudBackupRequestedEventHandler)
container
.bind<UserContentSizeRecalculationRequestedEventHandler>(TYPES.UserContentSizeRecalculationRequestedEventHandler)
.to(UserContentSizeRecalculationRequestedEventHandler)
// Services
container.bind<ContentDecoder>(TYPES.ContentDecoder).to(ContentDecoder)

View File

@@ -48,6 +48,7 @@ const TYPES = {
EmailArchiveExtensionSyncedEventHandler: Symbol.for('EmailArchiveExtensionSyncedEventHandler'),
EmailBackupRequestedEventHandler: Symbol.for('EmailBackupRequestedEventHandler'),
CloudBackupRequestedEventHandler: Symbol.for('CloudBackupRequestedEventHandler'),
UserContentSizeRecalculationRequestedEventHandler: Symbol.for('UserContentSizeRecalculationRequestedEventHandler'),
// Services
ContentDecoder: Symbol.for('ContentDecoder'),
DomainEventPublisher: Symbol.for('DomainEventPublisher'),

View File

@@ -0,0 +1,52 @@
/* istanbul ignore file */
import { DomainEventHandlerInterface, UserContentSizeRecalculationRequestedEvent } from '@standardnotes/domain-events'
import { inject, injectable } from 'inversify'
import { Stream } from 'stream'
import TYPES from '../../Bootstrap/Types'
import { ItemProjection } from '../../Projection/ItemProjection'
import { ProjectorInterface } from '../../Projection/ProjectorInterface'
import { Item } from '../Item/Item'
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
@injectable()
export class UserContentSizeRecalculationRequestedEventHandler implements DomainEventHandlerInterface {
constructor(
@inject(TYPES.ItemRepository) private itemRepository: ItemRepositoryInterface,
@inject(TYPES.ItemProjector) private itemProjector: ProjectorInterface<Item, ItemProjection>,
) {}
async handle(event: UserContentSizeRecalculationRequestedEvent): Promise<void> {
const stream = await this.itemRepository.streamAll({
deleted: false,
userUuid: event.payload.userUuid,
sortBy: 'updated_at_timestamp',
sortOrder: 'ASC',
})
await new Promise((resolve, reject) => {
stream
.pipe(
new Stream.Transform({
objectMode: true,
transform: async (item, _encoding, callback) => {
const modelItem = await this.itemRepository.findByUuid(item.item_uuid)
if (modelItem !== null) {
modelItem.contentSize = Buffer.byteLength(JSON.stringify(this.itemProjector.projectFull(modelItem)))
await this.itemRepository.save(modelItem)
callback()
return
}
callback()
return
},
}),
)
.on('finish', resolve)
.on('error', reject)
})
}
}

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.19](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.18...@standardnotes/websockets-server@1.4.19) (2022-11-11)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.4.18](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.17...@standardnotes/websockets-server@1.4.18) (2022-11-11)
**Note:** Version bump only for package @standardnotes/websockets-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/websockets-server",
"version": "1.4.18",
"version": "1.4.19",
"engines": {
"node": ">=16.0.0 <17.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.17.17](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.16...@standardnotes/workspace-server@1.17.17) (2022-11-11)
**Note:** Version bump only for package @standardnotes/workspace-server
## [1.17.16](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.15...@standardnotes/workspace-server@1.17.16) (2022-11-11)
**Note:** Version bump only for package @standardnotes/workspace-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/workspace-server",
"version": "1.17.16",
"version": "1.17.17",
"engines": {
"node": ">=16.0.0 <17.0.0"
},