mirror of
https://github.com/standardnotes/server
synced 2026-05-14 21:57:35 -04:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b0406dd8aa | |||
| 8d152ddfcb | |||
| 1a16d2e4f4 | |||
| 1ca8531305 | |||
| 6190e7d092 | |||
| a6542dd638 |
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.11.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.11.4...@standardnotes/analytics@2.11.5) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.11.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.11.3...@standardnotes/analytics@2.11.4) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
## [2.11.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.11.2...@standardnotes/analytics@2.11.3) (2022-11-18)
|
## [2.11.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.11.2...@standardnotes/analytics@2.11.3) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/analytics
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/analytics",
|
"name": "@standardnotes/analytics",
|
||||||
"version": "2.11.3",
|
"version": "2.11.5",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.38.8](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.38.7...@standardnotes/api-gateway@1.38.8) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
## [1.38.7](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.38.6...@standardnotes/api-gateway@1.38.7) (2022-11-18)
|
## [1.38.7](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.38.6...@standardnotes/api-gateway@1.38.7) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/api-gateway
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/api-gateway",
|
"name": "@standardnotes/api-gateway",
|
||||||
"version": "1.38.7",
|
"version": "1.38.8",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.60.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.60.2...@standardnotes/auth-server@1.60.3) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
## [1.60.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.60.1...@standardnotes/auth-server@1.60.2) (2022-11-18)
|
## [1.60.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.60.1...@standardnotes/auth-server@1.60.2) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/auth-server
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/auth-server",
|
"name": "@standardnotes/auth-server",
|
||||||
"version": "1.60.2",
|
"version": "1.60.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.2.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.2.0...@standardnotes/domain-core@1.2.1) (2022-11-21)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **domain-core:** remove revisions related models to revisions microservice ([a6542dd](https://github.com/standardnotes/server/commit/a6542dd63870a8ada5fd8143d8e2133a570d9329))
|
||||||
|
|
||||||
# [1.2.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.1.1...@standardnotes/domain-core@1.2.0) (2022-11-18)
|
# [1.2.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.1.1...@standardnotes/domain-core@1.2.0) (2022-11-18)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-core",
|
"name": "@standardnotes/domain-core",
|
||||||
"version": "1.2.0",
|
"version": "1.2.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,11 +16,4 @@ export * from './Core/ValueObjectProps'
|
|||||||
|
|
||||||
export * from './Mapping/MapperInterface'
|
export * from './Mapping/MapperInterface'
|
||||||
|
|
||||||
export * from './Revision/ContentType'
|
|
||||||
export * from './Revision/ContentTypeProps'
|
|
||||||
export * from './Revision/Revision'
|
|
||||||
export * from './Revision/RevisionMetadata'
|
|
||||||
export * from './Revision/RevisionMetadataProps'
|
|
||||||
export * from './Revision/RevisionProps'
|
|
||||||
|
|
||||||
export * from './UseCase/UseCaseInterface'
|
export * from './UseCase/UseCaseInterface'
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.9.30](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.29...@standardnotes/domain-events-infra@1.9.30) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
## [1.9.29](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.28...@standardnotes/domain-events-infra@1.9.29) (2022-11-18)
|
## [1.9.29](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.28...@standardnotes/domain-events-infra@1.9.29) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events-infra",
|
"name": "@standardnotes/domain-events-infra",
|
||||||
"version": "1.9.29",
|
"version": "1.9.30",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.90.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.89.0...@standardnotes/domain-events@2.90.0) (2022-11-21)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** add creating item dumps for revision service ([8d152dd](https://github.com/standardnotes/server/commit/8d152ddfcb3c88cbbf9df04e3ed6e2c02571d821))
|
||||||
|
|
||||||
# [2.89.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.88.0...@standardnotes/domain-events@2.89.0) (2022-11-18)
|
# [2.89.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.88.0...@standardnotes/domain-events@2.89.0) (2022-11-18)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events",
|
"name": "@standardnotes/domain-events",
|
||||||
"version": "2.89.0",
|
"version": "2.90.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { DomainEventInterface } from './DomainEventInterface'
|
||||||
|
import { ItemDumpedEventPayload } from './ItemDumpedEventPayload'
|
||||||
|
|
||||||
|
export interface ItemDumpedEvent extends DomainEventInterface {
|
||||||
|
type: 'ITEM_DUMPED'
|
||||||
|
payload: ItemDumpedEventPayload
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export interface ItemDumpedEventPayload {
|
||||||
|
fileDumpPath: string
|
||||||
|
}
|
||||||
@@ -46,6 +46,8 @@ export * from './Event/GoogleDriveBackupFailedEvent'
|
|||||||
export * from './Event/GoogleDriveBackupFailedEventPayload'
|
export * from './Event/GoogleDriveBackupFailedEventPayload'
|
||||||
export * from './Event/InvoiceGeneratedEvent'
|
export * from './Event/InvoiceGeneratedEvent'
|
||||||
export * from './Event/InvoiceGeneratedEventPayload'
|
export * from './Event/InvoiceGeneratedEventPayload'
|
||||||
|
export * from './Event/ItemDumpedEvent'
|
||||||
|
export * from './Event/ItemDumpedEventPayload'
|
||||||
export * from './Event/ItemRevisionCreationRequestedEvent'
|
export * from './Event/ItemRevisionCreationRequestedEvent'
|
||||||
export * from './Event/ItemRevisionCreationRequestedEventPayload'
|
export * from './Event/ItemRevisionCreationRequestedEventPayload'
|
||||||
export * from './Event/ItemsSyncedEvent'
|
export * from './Event/ItemsSyncedEvent'
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.6.25](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.24...@standardnotes/event-store@1.6.25) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
## [1.6.24](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.23...@standardnotes/event-store@1.6.24) (2022-11-18)
|
## [1.6.24](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.23...@standardnotes/event-store@1.6.24) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/event-store
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/event-store",
|
"name": "@standardnotes/event-store",
|
||||||
"version": "1.6.24",
|
"version": "1.6.25",
|
||||||
"description": "Event Store Service",
|
"description": "Event Store Service",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "dist/src/index.js",
|
"main": "dist/src/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.8.25](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.24...@standardnotes/files-server@1.8.25) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
## [1.8.24](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.23...@standardnotes/files-server@1.8.24) (2022-11-18)
|
## [1.8.24](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.23...@standardnotes/files-server@1.8.24) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/files-server
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/files-server",
|
"name": "@standardnotes/files-server",
|
||||||
"version": "1.8.24",
|
"version": "1.8.25",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,16 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.1.3](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.1.2...@standardnotes/revisions-server@1.1.3) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.1.2](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.1.1...@standardnotes/revisions-server@1.1.2) (2022-11-21)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **domain-core:** remove revisions related models to revisions microservice ([a6542dd](https://github.com/standardnotes/server/commit/a6542dd63870a8ada5fd8143d8e2133a570d9329))
|
||||||
|
|
||||||
## [1.1.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.1.0...@standardnotes/revisions-server@1.1.1) (2022-11-18)
|
## [1.1.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.1.0...@standardnotes/revisions-server@1.1.1) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/revisions-server
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/revisions-server",
|
"name": "@standardnotes/revisions-server",
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as winston from 'winston'
|
|||||||
import Redis from 'ioredis'
|
import Redis from 'ioredis'
|
||||||
import * as AWS from 'aws-sdk'
|
import * as AWS from 'aws-sdk'
|
||||||
import { Container } from 'inversify'
|
import { Container } from 'inversify'
|
||||||
|
import { Repository } from 'typeorm'
|
||||||
import {
|
import {
|
||||||
DomainEventHandlerInterface,
|
DomainEventHandlerInterface,
|
||||||
DomainEventMessageHandlerInterface,
|
DomainEventMessageHandlerInterface,
|
||||||
@@ -15,6 +16,7 @@ import {
|
|||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSNewRelicEventMessageHandler,
|
SQSNewRelicEventMessageHandler,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
|
import { MapperInterface } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
import { Env } from './Env'
|
import { Env } from './Env'
|
||||||
import TYPES from './Types'
|
import TYPES from './Types'
|
||||||
@@ -25,9 +27,8 @@ import { GetRevisionsMetada } from '../Domain/UseCase/GetRevisionsMetada/GetRevi
|
|||||||
import { RevisionRepositoryInterface } from '../Domain/Revision/RevisionRepositoryInterface'
|
import { RevisionRepositoryInterface } from '../Domain/Revision/RevisionRepositoryInterface'
|
||||||
import { MySQLRevisionRepository } from '../Infra/MySQL/MySQLRevisionRepository'
|
import { MySQLRevisionRepository } from '../Infra/MySQL/MySQLRevisionRepository'
|
||||||
import { RevisionMetadataPersistenceMapper } from '../Mapping/RevisionMetadataPersistenceMapper'
|
import { RevisionMetadataPersistenceMapper } from '../Mapping/RevisionMetadataPersistenceMapper'
|
||||||
import { MapperInterface, RevisionMetadata } from '@standardnotes/domain-core'
|
|
||||||
import { TypeORMRevision } from '../Infra/TypeORM/TypeORMRevision'
|
import { TypeORMRevision } from '../Infra/TypeORM/TypeORMRevision'
|
||||||
import { Repository } from 'typeorm'
|
import { RevisionMetadata } from '../Domain/Revision/RevisionMetadata'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const newrelicFormatter = require('@newrelic/winston-enricher')
|
const newrelicFormatter = require('@newrelic/winston-enricher')
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
import { ValueObject } from '../Core/ValueObject'
|
|
||||||
import { Result } from '../Core/Result'
|
|
||||||
import { ContentTypeProps } from './ContentTypeProps'
|
|
||||||
import { ContentType as ContentTypeValues } from '@standardnotes/common'
|
import { ContentType as ContentTypeValues } from '@standardnotes/common'
|
||||||
|
import { Result, ValueObject } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
|
import { ContentTypeProps } from './ContentTypeProps'
|
||||||
|
|
||||||
export class ContentType extends ValueObject<ContentTypeProps> {
|
export class ContentType extends ValueObject<ContentTypeProps> {
|
||||||
get value(): string | null {
|
get value(): string | null {
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
import { Entity } from '../Core/Entity'
|
import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
||||||
import { Result } from '../Core/Result'
|
|
||||||
import { UniqueEntityId } from '../Core/UniqueEntityId'
|
|
||||||
|
|
||||||
import { RevisionProps } from './RevisionProps'
|
import { RevisionProps } from './RevisionProps'
|
||||||
|
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
import { Entity } from '../Core/Entity'
|
import { Entity, Result, UniqueEntityId } from '@standardnotes/domain-core'
|
||||||
import { Result } from '../Core/Result'
|
|
||||||
import { UniqueEntityId } from '../Core/UniqueEntityId'
|
|
||||||
|
|
||||||
import { RevisionMetadataProps } from './RevisionMetadataProps'
|
import { RevisionMetadataProps } from './RevisionMetadataProps'
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { Timestamps } from '../Common/Timestamps'
|
import { Timestamps } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
import { ContentType } from './ContentType'
|
import { ContentType } from './ContentType'
|
||||||
|
|
||||||
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
import { Uuid } from '../Common/Uuid'
|
import { Uuid } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
import { ContentType } from './ContentType'
|
import { ContentType } from './ContentType'
|
||||||
|
|
||||||
export interface RevisionProps {
|
export interface RevisionProps {
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Uuid, RevisionMetadata } from '@standardnotes/domain-core'
|
import { Uuid } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
|
import { RevisionMetadata } from './RevisionMetadata'
|
||||||
|
|
||||||
export interface RevisionRepositoryInterface {
|
export interface RevisionRepositoryInterface {
|
||||||
findMetadataByItemId(itemUuid: Uuid): Promise<Array<RevisionMetadata>>
|
findMetadataByItemId(itemUuid: Uuid): Promise<Array<RevisionMetadata>>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { RevisionMetadata } from '@standardnotes/domain-core'
|
import { RevisionMetadata } from '../../Revision/RevisionMetadata'
|
||||||
|
|
||||||
import { RevisionRepositoryInterface } from '../../Revision/RevisionRepositoryInterface'
|
import { RevisionRepositoryInterface } from '../../Revision/RevisionRepositoryInterface'
|
||||||
import { GetRevisionsMetada } from './GetRevisionsMetada'
|
import { GetRevisionsMetada } from './GetRevisionsMetada'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Result, RevisionMetadata, UseCaseInterface, Uuid } from '@standardnotes/domain-core'
|
import { Result, UseCaseInterface, Uuid } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
|
import { RevisionMetadata } from '../../Revision/RevisionMetadata'
|
||||||
import { RevisionRepositoryInterface } from '../../Revision/RevisionRepositoryInterface'
|
import { RevisionRepositoryInterface } from '../../Revision/RevisionRepositoryInterface'
|
||||||
|
|
||||||
import { GetRevisionsMetadaDTO } from './GetRevisionsMetadaDTO'
|
import { GetRevisionsMetadaDTO } from './GetRevisionsMetadaDTO'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { MapperInterface, RevisionMetadata, Uuid } from '@standardnotes/domain-core'
|
import { MapperInterface, Uuid } from '@standardnotes/domain-core'
|
||||||
import { Repository } from 'typeorm'
|
import { Repository } from 'typeorm'
|
||||||
|
|
||||||
|
import { RevisionMetadata } from '../../Domain/Revision/RevisionMetadata'
|
||||||
import { RevisionRepositoryInterface } from '../../Domain/Revision/RevisionRepositoryInterface'
|
import { RevisionRepositoryInterface } from '../../Domain/Revision/RevisionRepositoryInterface'
|
||||||
import { TypeORMRevision } from '../TypeORM/TypeORMRevision'
|
import { TypeORMRevision } from '../TypeORM/TypeORMRevision'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { RevisionMetadata, MapperInterface, UniqueEntityId, ContentType, Timestamps } from '@standardnotes/domain-core'
|
import { MapperInterface, Timestamps, UniqueEntityId } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
|
import { ContentType } from '../Domain/Revision/ContentType'
|
||||||
|
import { RevisionMetadata } from '../Domain/Revision/RevisionMetadata'
|
||||||
import { TypeORMRevision } from '../Infra/TypeORM/TypeORMRevision'
|
import { TypeORMRevision } from '../Infra/TypeORM/TypeORMRevision'
|
||||||
|
|
||||||
export class RevisionMetadataPersistenceMapper implements MapperInterface<RevisionMetadata, TypeORMRevision> {
|
export class RevisionMetadataPersistenceMapper implements MapperInterface<RevisionMetadata, TypeORMRevision> {
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.13.26](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.13.25...@standardnotes/scheduler-server@1.13.26) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
## [1.13.25](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.13.24...@standardnotes/scheduler-server@1.13.25) (2022-11-18)
|
## [1.13.25](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.13.24...@standardnotes/scheduler-server@1.13.25) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/scheduler-server
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/scheduler-server",
|
"name": "@standardnotes/scheduler-server",
|
||||||
"version": "1.13.25",
|
"version": "1.13.26",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,22 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [1.15.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.14.0...@standardnotes/syncing-server@1.15.0) (2022-11-21)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** add creating item dumps for revision service ([8d152dd](https://github.com/standardnotes/syncing-server-js/commit/8d152ddfcb3c88cbbf9df04e3ed6e2c02571d821))
|
||||||
|
|
||||||
|
# [1.14.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.13.17...@standardnotes/syncing-server@1.14.0) (2022-11-21)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** add creating revisions in async way ([1ca8531](https://github.com/standardnotes/syncing-server-js/commit/1ca853130547ebfc26bdd9abce0dfb550e8217f6))
|
||||||
|
|
||||||
|
## [1.13.17](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.13.16...@standardnotes/syncing-server@1.13.17) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
## [1.13.16](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.13.15...@standardnotes/syncing-server@1.13.16) (2022-11-18)
|
## [1.13.16](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.13.15...@standardnotes/syncing-server@1.13.16) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/syncing-server
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ module.exports = {
|
|||||||
transform: {
|
transform: {
|
||||||
...tsjPreset.transform,
|
...tsjPreset.transform,
|
||||||
},
|
},
|
||||||
coveragePathIgnorePatterns: ['/Bootstrap/', 'HealthCheckController'],
|
coveragePathIgnorePatterns: ['/Bootstrap/', 'HealthCheckController', '/Infra/'],
|
||||||
setupFilesAfterEnv: ['./test-setup.ts'],
|
setupFilesAfterEnv: ['./test-setup.ts'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/syncing-server",
|
"name": "@standardnotes/syncing-server",
|
||||||
"version": "1.13.16",
|
"version": "1.15.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ import { RevisionMetadataMap } from '../Domain/Map/RevisionMetadataMap'
|
|||||||
import { MapperInterface } from '@standardnotes/domain-core'
|
import { MapperInterface } from '@standardnotes/domain-core'
|
||||||
import { RevisionMetadata } from '../Domain/Revision/RevisionMetadata'
|
import { RevisionMetadata } from '../Domain/Revision/RevisionMetadata'
|
||||||
import { SimpleRevisionProjection } from '../Projection/SimpleRevisionProjection'
|
import { SimpleRevisionProjection } from '../Projection/SimpleRevisionProjection'
|
||||||
|
import { ItemRevisionCreationRequestedEventHandler } from '../Domain/Handler/ItemRevisionCreationRequestedEventHandler'
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const newrelicFormatter = require('@newrelic/winston-enricher')
|
const newrelicFormatter = require('@newrelic/winston-enricher')
|
||||||
@@ -228,6 +229,9 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind<UserContentSizeRecalculationRequestedEventHandler>(TYPES.UserContentSizeRecalculationRequestedEventHandler)
|
.bind<UserContentSizeRecalculationRequestedEventHandler>(TYPES.UserContentSizeRecalculationRequestedEventHandler)
|
||||||
.to(UserContentSizeRecalculationRequestedEventHandler)
|
.to(UserContentSizeRecalculationRequestedEventHandler)
|
||||||
|
container
|
||||||
|
.bind<ItemRevisionCreationRequestedEventHandler>(TYPES.ItemRevisionCreationRequestedEventHandler)
|
||||||
|
.to(ItemRevisionCreationRequestedEventHandler)
|
||||||
|
|
||||||
// Map
|
// Map
|
||||||
container
|
container
|
||||||
@@ -274,6 +278,7 @@ export class ContainerConfigLoader {
|
|||||||
'USER_CONTENT_SIZE_RECALCULATION_REQUESTED',
|
'USER_CONTENT_SIZE_RECALCULATION_REQUESTED',
|
||||||
container.get(TYPES.UserContentSizeRecalculationRequestedEventHandler),
|
container.get(TYPES.UserContentSizeRecalculationRequestedEventHandler),
|
||||||
],
|
],
|
||||||
|
['ITEM_REVISION_CREATION_REQUESTED', container.get(TYPES.ItemRevisionCreationRequestedEventHandler)],
|
||||||
])
|
])
|
||||||
|
|
||||||
if (env.get('SQS_QUEUE_URL', true)) {
|
if (env.get('SQS_QUEUE_URL', true)) {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ const TYPES = {
|
|||||||
EmailBackupRequestedEventHandler: Symbol.for('EmailBackupRequestedEventHandler'),
|
EmailBackupRequestedEventHandler: Symbol.for('EmailBackupRequestedEventHandler'),
|
||||||
CloudBackupRequestedEventHandler: Symbol.for('CloudBackupRequestedEventHandler'),
|
CloudBackupRequestedEventHandler: Symbol.for('CloudBackupRequestedEventHandler'),
|
||||||
UserContentSizeRecalculationRequestedEventHandler: Symbol.for('UserContentSizeRecalculationRequestedEventHandler'),
|
UserContentSizeRecalculationRequestedEventHandler: Symbol.for('UserContentSizeRecalculationRequestedEventHandler'),
|
||||||
|
ItemRevisionCreationRequestedEventHandler: Symbol.for('ItemRevisionCreationRequestedEventHandler'),
|
||||||
// Map
|
// Map
|
||||||
RevisionMetadataMap: Symbol.for('RevisionMetadataMap'),
|
RevisionMetadataMap: Symbol.for('RevisionMetadataMap'),
|
||||||
// Services
|
// Services
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
EmailArchiveExtensionSyncedEvent,
|
EmailArchiveExtensionSyncedEvent,
|
||||||
EmailBackupAttachmentCreatedEvent,
|
EmailBackupAttachmentCreatedEvent,
|
||||||
GoogleDriveBackupFailedEvent,
|
GoogleDriveBackupFailedEvent,
|
||||||
|
ItemDumpedEvent,
|
||||||
|
ItemRevisionCreationRequestedEvent,
|
||||||
ItemsSyncedEvent,
|
ItemsSyncedEvent,
|
||||||
OneDriveBackupFailedEvent,
|
OneDriveBackupFailedEvent,
|
||||||
UserContentSizeRecalculationRequestedEvent,
|
UserContentSizeRecalculationRequestedEvent,
|
||||||
@@ -19,6 +21,40 @@ import { DomainEventFactoryInterface } from './DomainEventFactoryInterface'
|
|||||||
export class DomainEventFactory implements DomainEventFactoryInterface {
|
export class DomainEventFactory implements DomainEventFactoryInterface {
|
||||||
constructor(@inject(TYPES.Timer) private timer: TimerInterface) {}
|
constructor(@inject(TYPES.Timer) private timer: TimerInterface) {}
|
||||||
|
|
||||||
|
createItemDumpedEvent(fileDumpPath: string, userUuid: string): ItemDumpedEvent {
|
||||||
|
return {
|
||||||
|
type: 'ITEM_DUMPED',
|
||||||
|
createdAt: this.timer.getUTCDate(),
|
||||||
|
meta: {
|
||||||
|
correlation: {
|
||||||
|
userIdentifier: userUuid,
|
||||||
|
userIdentifierType: 'uuid',
|
||||||
|
},
|
||||||
|
origin: DomainEventService.SyncingServer,
|
||||||
|
},
|
||||||
|
payload: {
|
||||||
|
fileDumpPath,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
createItemRevisionCreationRequested(itemUuid: string, userUuid: string): ItemRevisionCreationRequestedEvent {
|
||||||
|
return {
|
||||||
|
type: 'ITEM_REVISION_CREATION_REQUESTED',
|
||||||
|
createdAt: this.timer.getUTCDate(),
|
||||||
|
meta: {
|
||||||
|
correlation: {
|
||||||
|
userIdentifier: userUuid,
|
||||||
|
userIdentifierType: 'uuid',
|
||||||
|
},
|
||||||
|
origin: DomainEventService.SyncingServer,
|
||||||
|
},
|
||||||
|
payload: {
|
||||||
|
itemUuid,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
createUserContentSizeRecalculationRequestedEvent(userUuid: string): UserContentSizeRecalculationRequestedEvent {
|
createUserContentSizeRecalculationRequestedEvent(userUuid: string): UserContentSizeRecalculationRequestedEvent {
|
||||||
return {
|
return {
|
||||||
type: 'USER_CONTENT_SIZE_RECALCULATION_REQUESTED',
|
type: 'USER_CONTENT_SIZE_RECALCULATION_REQUESTED',
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
EmailArchiveExtensionSyncedEvent,
|
EmailArchiveExtensionSyncedEvent,
|
||||||
EmailBackupAttachmentCreatedEvent,
|
EmailBackupAttachmentCreatedEvent,
|
||||||
GoogleDriveBackupFailedEvent,
|
GoogleDriveBackupFailedEvent,
|
||||||
|
ItemDumpedEvent,
|
||||||
|
ItemRevisionCreationRequestedEvent,
|
||||||
ItemsSyncedEvent,
|
ItemsSyncedEvent,
|
||||||
OneDriveBackupFailedEvent,
|
OneDriveBackupFailedEvent,
|
||||||
UserContentSizeRecalculationRequestedEvent,
|
UserContentSizeRecalculationRequestedEvent,
|
||||||
@@ -31,4 +33,6 @@ export interface DomainEventFactoryInterface {
|
|||||||
email: string
|
email: string
|
||||||
}): EmailBackupAttachmentCreatedEvent
|
}): EmailBackupAttachmentCreatedEvent
|
||||||
createDuplicateItemSyncedEvent(itemUuid: string, userUuid: string): DuplicateItemSyncedEvent
|
createDuplicateItemSyncedEvent(itemUuid: string, userUuid: string): DuplicateItemSyncedEvent
|
||||||
|
createItemRevisionCreationRequested(itemUuid: string, userUuid: string): ItemRevisionCreationRequestedEvent
|
||||||
|
createItemDumpedEvent(fileDumpPath: string, userUuid: string): ItemDumpedEvent
|
||||||
}
|
}
|
||||||
|
|||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
import 'reflect-metadata'
|
||||||
|
|
||||||
|
import {
|
||||||
|
DomainEventPublisherInterface,
|
||||||
|
DomainEventService,
|
||||||
|
ItemRevisionCreationRequestedEvent,
|
||||||
|
} from '@standardnotes/domain-events'
|
||||||
|
import { Item } from '../Item/Item'
|
||||||
|
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
||||||
|
import { ItemRevisionCreationRequestedEventHandler } from './ItemRevisionCreationRequestedEventHandler'
|
||||||
|
import { RevisionServiceInterface } from '../Revision/RevisionServiceInterface'
|
||||||
|
import { ItemBackupServiceInterface } from '../Item/ItemBackupServiceInterface'
|
||||||
|
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||||
|
|
||||||
|
describe('ItemRevisionCreationRequestedEventHandler', () => {
|
||||||
|
let itemRepository: ItemRepositoryInterface
|
||||||
|
let revisionService: RevisionServiceInterface
|
||||||
|
let event: ItemRevisionCreationRequestedEvent
|
||||||
|
let item: Item
|
||||||
|
let itemBackupService: ItemBackupServiceInterface
|
||||||
|
let domainEventFactory: DomainEventFactoryInterface
|
||||||
|
let domainEventPublisher: DomainEventPublisherInterface
|
||||||
|
|
||||||
|
const createHandler = () =>
|
||||||
|
new ItemRevisionCreationRequestedEventHandler(
|
||||||
|
itemRepository,
|
||||||
|
revisionService,
|
||||||
|
itemBackupService,
|
||||||
|
domainEventFactory,
|
||||||
|
domainEventPublisher,
|
||||||
|
)
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
item = {
|
||||||
|
uuid: '1-2-3',
|
||||||
|
content: 'test',
|
||||||
|
} as jest.Mocked<Item>
|
||||||
|
|
||||||
|
itemRepository = {} as jest.Mocked<ItemRepositoryInterface>
|
||||||
|
itemRepository.findByUuid = jest.fn().mockReturnValue(item)
|
||||||
|
|
||||||
|
revisionService = {} as jest.Mocked<RevisionServiceInterface>
|
||||||
|
revisionService.createRevision = jest.fn()
|
||||||
|
|
||||||
|
event = {} as jest.Mocked<ItemRevisionCreationRequestedEvent>
|
||||||
|
event.createdAt = new Date(1)
|
||||||
|
event.payload = {
|
||||||
|
itemUuid: '2-3-4',
|
||||||
|
}
|
||||||
|
event.meta = {
|
||||||
|
correlation: {
|
||||||
|
userIdentifier: '1-2-3',
|
||||||
|
userIdentifierType: 'uuid',
|
||||||
|
},
|
||||||
|
origin: DomainEventService.SyncingServer,
|
||||||
|
}
|
||||||
|
|
||||||
|
itemBackupService = {} as jest.Mocked<ItemBackupServiceInterface>
|
||||||
|
itemBackupService.dump = jest.fn().mockReturnValue('foo://bar')
|
||||||
|
|
||||||
|
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
||||||
|
domainEventFactory.createItemDumpedEvent = jest.fn()
|
||||||
|
|
||||||
|
domainEventPublisher = {} as jest.Mocked<DomainEventPublisherInterface>
|
||||||
|
domainEventPublisher.publish = jest.fn()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should create a revision for an item', async () => {
|
||||||
|
await createHandler().handle(event)
|
||||||
|
|
||||||
|
expect(revisionService.createRevision).toHaveBeenCalled()
|
||||||
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
|
expect(domainEventFactory.createItemDumpedEvent).toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not create a revision for an item that does not exist', async () => {
|
||||||
|
itemRepository.findByUuid = jest.fn().mockReturnValue(null)
|
||||||
|
|
||||||
|
await createHandler().handle(event)
|
||||||
|
|
||||||
|
expect(revisionService.createRevision).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should not create a revision for an item if the dump was not created', async () => {
|
||||||
|
itemBackupService.dump = jest.fn().mockReturnValue('')
|
||||||
|
|
||||||
|
await createHandler().handle(event)
|
||||||
|
|
||||||
|
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||||
|
expect(domainEventFactory.createItemDumpedEvent).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
})
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
import {
|
||||||
|
ItemRevisionCreationRequestedEvent,
|
||||||
|
DomainEventHandlerInterface,
|
||||||
|
DomainEventPublisherInterface,
|
||||||
|
} from '@standardnotes/domain-events'
|
||||||
|
import { inject, injectable } from 'inversify'
|
||||||
|
|
||||||
|
import TYPES from '../../Bootstrap/Types'
|
||||||
|
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||||
|
import { ItemBackupServiceInterface } from '../Item/ItemBackupServiceInterface'
|
||||||
|
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
||||||
|
import { RevisionServiceInterface } from '../Revision/RevisionServiceInterface'
|
||||||
|
|
||||||
|
@injectable()
|
||||||
|
export class ItemRevisionCreationRequestedEventHandler implements DomainEventHandlerInterface {
|
||||||
|
constructor(
|
||||||
|
@inject(TYPES.ItemRepository) private itemRepository: ItemRepositoryInterface,
|
||||||
|
@inject(TYPES.RevisionService) private revisionService: RevisionServiceInterface,
|
||||||
|
@inject(TYPES.ItemBackupService) private itemBackupService: ItemBackupServiceInterface,
|
||||||
|
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
||||||
|
@inject(TYPES.DomainEventPublisher) private domainEventPublisher: DomainEventPublisherInterface,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
async handle(event: ItemRevisionCreationRequestedEvent): Promise<void> {
|
||||||
|
const item = await this.itemRepository.findByUuid(event.payload.itemUuid)
|
||||||
|
if (item === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileDumpPath = await this.itemBackupService.dump(item)
|
||||||
|
if (fileDumpPath) {
|
||||||
|
await this.domainEventPublisher.publish(
|
||||||
|
this.domainEventFactory.createItemDumpedEvent(fileDumpPath, event.meta.correlation.userIdentifier),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.revisionService.createRevision(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,4 +3,5 @@ import { Item } from './Item'
|
|||||||
|
|
||||||
export interface ItemBackupServiceInterface {
|
export interface ItemBackupServiceInterface {
|
||||||
backup(items: Array<Item>, authParams: KeyParamsData): Promise<string>
|
backup(items: Array<Item>, authParams: KeyParamsData): Promise<string>
|
||||||
|
dump(item: Item): Promise<string>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { ItemHash } from './ItemHash'
|
|||||||
import { ItemRepositoryInterface } from './ItemRepositoryInterface'
|
import { ItemRepositoryInterface } from './ItemRepositoryInterface'
|
||||||
import { ItemService } from './ItemService'
|
import { ItemService } from './ItemService'
|
||||||
import { ApiVersion } from '../Api/ApiVersion'
|
import { ApiVersion } from '../Api/ApiVersion'
|
||||||
import { RevisionServiceInterface } from '../Revision/RevisionServiceInterface'
|
|
||||||
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
@@ -21,7 +20,6 @@ import { ItemProjection } from '../../Projection/ItemProjection'
|
|||||||
|
|
||||||
describe('ItemService', () => {
|
describe('ItemService', () => {
|
||||||
let itemRepository: ItemRepositoryInterface
|
let itemRepository: ItemRepositoryInterface
|
||||||
let revisionService: RevisionServiceInterface
|
|
||||||
let domainEventPublisher: DomainEventPublisherInterface
|
let domainEventPublisher: DomainEventPublisherInterface
|
||||||
let domainEventFactory: DomainEventFactoryInterface
|
let domainEventFactory: DomainEventFactoryInterface
|
||||||
const revisionFrequency = 300
|
const revisionFrequency = 300
|
||||||
@@ -47,7 +45,6 @@ describe('ItemService', () => {
|
|||||||
itemSaveValidator,
|
itemSaveValidator,
|
||||||
itemFactory,
|
itemFactory,
|
||||||
itemRepository,
|
itemRepository,
|
||||||
revisionService,
|
|
||||||
domainEventPublisher,
|
domainEventPublisher,
|
||||||
domainEventFactory,
|
domainEventFactory,
|
||||||
revisionFrequency,
|
revisionFrequency,
|
||||||
@@ -125,9 +122,6 @@ describe('ItemService', () => {
|
|||||||
itemRepository.countAll = jest.fn().mockReturnValue(2)
|
itemRepository.countAll = jest.fn().mockReturnValue(2)
|
||||||
itemRepository.save = jest.fn().mockImplementation((item: Item) => item)
|
itemRepository.save = jest.fn().mockImplementation((item: Item) => item)
|
||||||
|
|
||||||
revisionService = {} as jest.Mocked<RevisionServiceInterface>
|
|
||||||
revisionService.createRevision = jest.fn()
|
|
||||||
|
|
||||||
timer = {} as jest.Mocked<TimerInterface>
|
timer = {} as jest.Mocked<TimerInterface>
|
||||||
timer.getTimestampInMicroseconds = jest.fn().mockReturnValue(1616164633241568)
|
timer.getTimestampInMicroseconds = jest.fn().mockReturnValue(1616164633241568)
|
||||||
timer.getUTCDate = jest.fn().mockReturnValue(new Date())
|
timer.getUTCDate = jest.fn().mockReturnValue(new Date())
|
||||||
@@ -147,6 +141,7 @@ describe('ItemService', () => {
|
|||||||
|
|
||||||
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
||||||
domainEventFactory.createDuplicateItemSyncedEvent = jest.fn()
|
domainEventFactory.createDuplicateItemSyncedEvent = jest.fn()
|
||||||
|
domainEventFactory.createItemRevisionCreationRequested = jest.fn()
|
||||||
|
|
||||||
logger = {} as jest.Mocked<Logger>
|
logger = {} as jest.Mocked<Logger>
|
||||||
logger.error = jest.fn()
|
logger.error = jest.fn()
|
||||||
@@ -491,7 +486,8 @@ describe('ItemService', () => {
|
|||||||
syncToken: 'MjpOYU4=',
|
syncToken: 'MjpOYU4=',
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(revisionService.createRevision).toHaveBeenCalledTimes(1)
|
expect(domainEventFactory.createItemRevisionCreationRequested).toHaveBeenCalledTimes(1)
|
||||||
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not save new items in read only access mode', async () => {
|
it('should not save new items in read only access mode', async () => {
|
||||||
@@ -515,8 +511,6 @@ describe('ItemService', () => {
|
|||||||
savedItems: [],
|
savedItems: [],
|
||||||
syncToken: 'MjoxNjE2MTY0NjMzLjI0MTU2OQ==',
|
syncToken: 'MjoxNjE2MTY0NjMzLjI0MTU2OQ==',
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(revisionService.createRevision).toHaveBeenCalledTimes(0)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should save new items that are duplicates', async () => {
|
it('should save new items that are duplicates', async () => {
|
||||||
@@ -538,8 +532,8 @@ describe('ItemService', () => {
|
|||||||
syncToken: 'MjoxNjE2MTY0NjMzLjI0MTU3MQ==',
|
syncToken: 'MjoxNjE2MTY0NjMzLjI0MTU3MQ==',
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(revisionService.createRevision).toHaveBeenCalledTimes(1)
|
expect(domainEventFactory.createItemRevisionCreationRequested).toHaveBeenCalledTimes(1)
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(2)
|
||||||
expect(domainEventFactory.createDuplicateItemSyncedEvent).toHaveBeenCalledTimes(1)
|
expect(domainEventFactory.createDuplicateItemSyncedEvent).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -933,8 +927,9 @@ describe('ItemService', () => {
|
|||||||
],
|
],
|
||||||
syncToken: 'MjoxNjE2MTY0NjMzLjI0MTU2OQ==',
|
syncToken: 'MjoxNjE2MTY0NjMzLjI0MTU2OQ==',
|
||||||
})
|
})
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(2)
|
||||||
expect(domainEventFactory.createDuplicateItemSyncedEvent).toHaveBeenCalledTimes(1)
|
expect(domainEventFactory.createDuplicateItemSyncedEvent).toHaveBeenCalledTimes(1)
|
||||||
|
expect(domainEventFactory.createItemRevisionCreationRequested).toHaveBeenCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should skip saving conflicting items and mark them as sync conflicts when saving to database fails', async () => {
|
it('should skip saving conflicting items and mark them as sync conflicts when saving to database fails', async () => {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { Logger } from 'winston'
|
|||||||
|
|
||||||
import TYPES from '../../Bootstrap/Types'
|
import TYPES from '../../Bootstrap/Types'
|
||||||
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Event/DomainEventFactoryInterface'
|
||||||
import { RevisionServiceInterface } from '../Revision/RevisionServiceInterface'
|
|
||||||
import { GetItemsDTO } from './GetItemsDTO'
|
import { GetItemsDTO } from './GetItemsDTO'
|
||||||
import { GetItemsResult } from './GetItemsResult'
|
import { GetItemsResult } from './GetItemsResult'
|
||||||
import { Item } from './Item'
|
import { Item } from './Item'
|
||||||
@@ -33,7 +32,6 @@ export class ItemService implements ItemServiceInterface {
|
|||||||
@inject(TYPES.ItemSaveValidator) private itemSaveValidator: ItemSaveValidatorInterface,
|
@inject(TYPES.ItemSaveValidator) private itemSaveValidator: ItemSaveValidatorInterface,
|
||||||
@inject(TYPES.ItemFactory) private itemFactory: ItemFactoryInterface,
|
@inject(TYPES.ItemFactory) private itemFactory: ItemFactoryInterface,
|
||||||
@inject(TYPES.ItemRepository) private itemRepository: ItemRepositoryInterface,
|
@inject(TYPES.ItemRepository) private itemRepository: ItemRepositoryInterface,
|
||||||
@inject(TYPES.RevisionService) private revisionService: RevisionServiceInterface,
|
|
||||||
@inject(TYPES.DomainEventPublisher) private domainEventPublisher: DomainEventPublisherInterface,
|
@inject(TYPES.DomainEventPublisher) private domainEventPublisher: DomainEventPublisherInterface,
|
||||||
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
||||||
@inject(TYPES.REVISIONS_FREQUENCY) private revisionFrequency: number,
|
@inject(TYPES.REVISIONS_FREQUENCY) private revisionFrequency: number,
|
||||||
@@ -253,7 +251,9 @@ export class ItemService implements ItemServiceInterface {
|
|||||||
const savedItem = await this.itemRepository.save(dto.existingItem)
|
const savedItem = await this.itemRepository.save(dto.existingItem)
|
||||||
|
|
||||||
if (secondsFromLastUpdate >= this.revisionFrequency) {
|
if (secondsFromLastUpdate >= this.revisionFrequency) {
|
||||||
await this.revisionService.createRevision(savedItem)
|
await this.domainEventPublisher.publish(
|
||||||
|
this.domainEventFactory.createItemRevisionCreationRequested(savedItem.uuid, savedItem.userUuid),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasMarkedAsDuplicate) {
|
if (wasMarkedAsDuplicate) {
|
||||||
@@ -270,7 +270,9 @@ export class ItemService implements ItemServiceInterface {
|
|||||||
|
|
||||||
const savedItem = await this.itemRepository.save(newItem)
|
const savedItem = await this.itemRepository.save(newItem)
|
||||||
|
|
||||||
await this.revisionService.createRevision(savedItem)
|
await this.domainEventPublisher.publish(
|
||||||
|
this.domainEventFactory.createItemRevisionCreationRequested(savedItem.uuid, savedItem.userUuid),
|
||||||
|
)
|
||||||
|
|
||||||
if (savedItem.duplicateOf) {
|
if (savedItem.duplicateOf) {
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
import 'reflect-metadata'
|
|
||||||
|
|
||||||
import { KeyParamsData } from '@standardnotes/responses'
|
|
||||||
import { S3 } from 'aws-sdk'
|
|
||||||
import { Logger } from 'winston'
|
|
||||||
import { Item } from '../../Domain/Item/Item'
|
|
||||||
import { S3ItemBackupService } from './S3ItemBackupService'
|
|
||||||
import { ProjectorInterface } from '../../Projection/ProjectorInterface'
|
|
||||||
import { ItemProjection } from '../../Projection/ItemProjection'
|
|
||||||
|
|
||||||
describe('S3ItemBackupService', () => {
|
|
||||||
let s3Client: S3 | undefined
|
|
||||||
let itemProjector: ProjectorInterface<Item, ItemProjection>
|
|
||||||
let s3BackupBucketName = 'backup-bucket'
|
|
||||||
let logger: Logger
|
|
||||||
let item: Item
|
|
||||||
let keyParams: KeyParamsData
|
|
||||||
|
|
||||||
const createService = () => new S3ItemBackupService(s3BackupBucketName, itemProjector, logger, s3Client)
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
s3Client = {} as jest.Mocked<S3>
|
|
||||||
s3Client.upload = jest.fn().mockReturnValue({
|
|
||||||
promise: jest.fn().mockReturnValue(Promise.resolve({ Key: 'test' })),
|
|
||||||
})
|
|
||||||
|
|
||||||
logger = {} as jest.Mocked<Logger>
|
|
||||||
logger.warn = jest.fn()
|
|
||||||
|
|
||||||
item = {} as jest.Mocked<Item>
|
|
||||||
|
|
||||||
keyParams = {} as jest.Mocked<KeyParamsData>
|
|
||||||
|
|
||||||
itemProjector = {} as jest.Mocked<ProjectorInterface<Item, ItemProjection>>
|
|
||||||
itemProjector.projectFull = jest.fn().mockReturnValue({ foo: 'bar' })
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should upload items to S3 as a backup file', async () => {
|
|
||||||
await createService().backup([item], keyParams)
|
|
||||||
|
|
||||||
expect((<S3>s3Client).upload).toHaveBeenCalledWith({
|
|
||||||
Body: '{"items":[{"foo":"bar"}],"auth_params":{}}',
|
|
||||||
Bucket: 'backup-bucket',
|
|
||||||
Key: expect.any(String),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should not upload items to S3 if bucket name is not configured', async () => {
|
|
||||||
s3BackupBucketName = ''
|
|
||||||
await createService().backup([item], keyParams)
|
|
||||||
|
|
||||||
expect((<S3>s3Client).upload).not.toHaveBeenCalled()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should not upload items to S3 if S3 client is not configured', async () => {
|
|
||||||
s3Client = undefined
|
|
||||||
expect(await createService().backup([item], keyParams)).toEqual('')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -3,6 +3,7 @@ import { KeyParamsData } from '@standardnotes/responses'
|
|||||||
import { S3 } from 'aws-sdk'
|
import { S3 } from 'aws-sdk'
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import TYPES from '../../Bootstrap/Types'
|
import TYPES from '../../Bootstrap/Types'
|
||||||
import { Item } from '../../Domain/Item/Item'
|
import { Item } from '../../Domain/Item/Item'
|
||||||
import { ItemBackupServiceInterface } from '../../Domain/Item/ItemBackupServiceInterface'
|
import { ItemBackupServiceInterface } from '../../Domain/Item/ItemBackupServiceInterface'
|
||||||
@@ -18,6 +19,26 @@ export class S3ItemBackupService implements ItemBackupServiceInterface {
|
|||||||
@inject(TYPES.S3) private s3Client?: S3,
|
@inject(TYPES.S3) private s3Client?: S3,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
async dump(item: Item): Promise<string> {
|
||||||
|
if (!this.s3BackupBucketName || this.s3Client === undefined) {
|
||||||
|
this.logger.warn('S3 backup not configured')
|
||||||
|
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const uploadResult = await this.s3Client
|
||||||
|
.upload({
|
||||||
|
Bucket: this.s3BackupBucketName,
|
||||||
|
Key: uuid.v4(),
|
||||||
|
Body: JSON.stringify({
|
||||||
|
item: await this.itemProjector.projectFull(item),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.promise()
|
||||||
|
|
||||||
|
return uploadResult.Key
|
||||||
|
}
|
||||||
|
|
||||||
async backup(items: Item[], authParams: KeyParamsData): Promise<string> {
|
async backup(items: Item[], authParams: KeyParamsData): Promise<string> {
|
||||||
if (!this.s3BackupBucketName || this.s3Client === undefined) {
|
if (!this.s3BackupBucketName || this.s3Client === undefined) {
|
||||||
this.logger.warn('S3 backup not configured')
|
this.logger.warn('S3 backup not configured')
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.4.27](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.26...@standardnotes/websockets-server@1.4.27) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
## [1.4.26](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.25...@standardnotes/websockets-server@1.4.26) (2022-11-18)
|
## [1.4.26](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.25...@standardnotes/websockets-server@1.4.26) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/websockets-server
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/websockets-server",
|
"name": "@standardnotes/websockets-server",
|
||||||
"version": "1.4.26",
|
"version": "1.4.27",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.17.25](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.24...@standardnotes/workspace-server@1.17.25) (2022-11-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|
||||||
## [1.17.24](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.23...@standardnotes/workspace-server@1.17.24) (2022-11-18)
|
## [1.17.24](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.23...@standardnotes/workspace-server@1.17.24) (2022-11-18)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/workspace-server
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/workspace-server",
|
"name": "@standardnotes/workspace-server",
|
||||||
"version": "1.17.24",
|
"version": "1.17.25",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user