mirror of
https://github.com/standardnotes/server
synced 2026-03-16 18:01:13 -04:00
Compare commits
14 Commits
@standardn
...
@standardn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45dfefbc7a | ||
|
|
20d92149a8 | ||
|
|
9c01fffca5 | ||
|
|
61c1cfff4b | ||
|
|
7e74261f62 | ||
|
|
32601f34f1 | ||
|
|
aef69a1a96 | ||
|
|
130f90bdb6 | ||
|
|
851c7de87f | ||
|
|
118156c62d | ||
|
|
cdad3143c9 | ||
|
|
00fe32136e | ||
|
|
52f56eeb68 | ||
|
|
b595264e31 |
1
.pnp.cjs
generated
1
.pnp.cjs
generated
@@ -3324,6 +3324,7 @@ const RAW_RUNTIME_STATE =
|
|||||||
["@sentry/node", "npm:7.19.0"],\
|
["@sentry/node", "npm:7.19.0"],\
|
||||||
["@standardnotes/api", "npm:1.19.0"],\
|
["@standardnotes/api", "npm:1.19.0"],\
|
||||||
["@standardnotes/common", "workspace:packages/common"],\
|
["@standardnotes/common", "workspace:packages/common"],\
|
||||||
|
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
|
||||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||||
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
|
||||||
["@standardnotes/models", "npm:1.28.0"],\
|
["@standardnotes/models", "npm:1.28.0"],\
|
||||||
|
|||||||
@@ -3,6 +3,26 @@
|
|||||||
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.12.19](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.18...@standardnotes/analytics@2.12.19) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.12.18](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.17...@standardnotes/analytics@2.12.18) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.12.17](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.16...@standardnotes/analytics@2.12.17) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.12.16](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.15...@standardnotes/analytics@2.12.16) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
|
## [2.12.15](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.14...@standardnotes/analytics@2.12.15) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|
||||||
## [2.12.14](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.13...@standardnotes/analytics@2.12.14) (2022-12-09)
|
## [2.12.14](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.12.13...@standardnotes/analytics@2.12.14) (2022-12-09)
|
||||||
|
|
||||||
**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.12.14",
|
"version": "2.12.19",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,26 @@
|
|||||||
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.39.23](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.22...@standardnotes/api-gateway@1.39.23) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.39.22](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.21...@standardnotes/api-gateway@1.39.22) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.39.21](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.20...@standardnotes/api-gateway@1.39.21) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.39.20](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.19...@standardnotes/api-gateway@1.39.20) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
|
## [1.39.19](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.18...@standardnotes/api-gateway@1.39.19) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|
||||||
## [1.39.18](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.17...@standardnotes/api-gateway@1.39.18) (2022-12-09)
|
## [1.39.18](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.39.17...@standardnotes/api-gateway@1.39.18) (2022-12-09)
|
||||||
|
|
||||||
**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.39.18",
|
"version": "1.39.23",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,32 @@
|
|||||||
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.66.5](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.66.4...@standardnotes/auth-server@1.66.5) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.66.4](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.66.3...@standardnotes/auth-server@1.66.4) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.66.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.66.2...@standardnotes/auth-server@1.66.3) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.66.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.66.1...@standardnotes/auth-server@1.66.2) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
## [1.66.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.66.0...@standardnotes/auth-server@1.66.1) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|
||||||
|
# [1.66.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.65.0...@standardnotes/auth-server@1.66.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **email:** replace offline subscription token created event in favour of email requested ([b595264](https://github.com/standardnotes/server/commit/b595264e313ac5ae5404f6a4a05b90b8c11f7f02))
|
||||||
|
|
||||||
# [1.65.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.64.7...@standardnotes/auth-server@1.65.0) (2022-12-09)
|
# [1.65.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.64.7...@standardnotes/auth-server@1.65.0) (2022-12-09)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/auth-server",
|
"name": "@standardnotes/auth-server",
|
||||||
"version": "1.65.0",
|
"version": "1.66.5",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { html } from './shared-subscription-invitation-created.html'
|
||||||
|
|
||||||
|
export function getSubject(): string {
|
||||||
|
return 'You have been invited to a Standard Notes subscription'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBody(inviterIdentifier: string, inviteUuid: string): string {
|
||||||
|
return html(inviterIdentifier, inviteUuid)
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export const html = (inviterIdentifier: string, inviteUuid: string) => `<p>Hello,</p>
|
||||||
|
<p>You've been invited to join a Standard Notes premium subscription at no cost. ${inviterIdentifier} has invited you to share the benefits of their subscription plan.</p>
|
||||||
|
<p>
|
||||||
|
<a href='https://app.standardnotes.com/?accept-subscription-invite=${inviteUuid}'>Accept Invite</a>
|
||||||
|
</p>`
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { DomainEventPublisherInterface, SharedSubscriptionInvitationCreatedEvent } from '@standardnotes/domain-events'
|
import {
|
||||||
|
DomainEventPublisherInterface,
|
||||||
|
SharedSubscriptionInvitationCreatedEvent,
|
||||||
|
EmailRequestedEvent,
|
||||||
|
} from '@standardnotes/domain-events'
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
import { TimerInterface } from '@standardnotes/time'
|
||||||
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
|
||||||
import { SharedSubscriptionInvitationRepositoryInterface } from '../../SharedSubscription/SharedSubscriptionInvitationRepositoryInterface'
|
import { SharedSubscriptionInvitationRepositoryInterface } from '../../SharedSubscription/SharedSubscriptionInvitationRepositoryInterface'
|
||||||
@@ -51,6 +55,7 @@ describe('InviteToSharedSubscription', () => {
|
|||||||
domainEventFactory.createSharedSubscriptionInvitationCreatedEvent = jest
|
domainEventFactory.createSharedSubscriptionInvitationCreatedEvent = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockReturnValue({} as jest.Mocked<SharedSubscriptionInvitationCreatedEvent>)
|
.mockReturnValue({} as jest.Mocked<SharedSubscriptionInvitationCreatedEvent>)
|
||||||
|
domainEventFactory.createEmailRequestedEvent = jest.fn().mockReturnValue({} as jest.Mocked<EmailRequestedEvent>)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not create an inivitation for sharing the subscription if inviter has no subscription', async () => {
|
it('should not create an inivitation for sharing the subscription if inviter has no subscription', async () => {
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { RoleName } from '@standardnotes/common'
|
import { RoleName } from '@standardnotes/common'
|
||||||
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
import { TimerInterface } from '@standardnotes/time'
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
|
|
||||||
import TYPES from '../../../Bootstrap/Types'
|
import TYPES from '../../../Bootstrap/Types'
|
||||||
|
import { getBody, getSubject } from '../../Email/SharedSubscriptionInvitationCreated'
|
||||||
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
|
||||||
import { InvitationStatus } from '../../SharedSubscription/InvitationStatus'
|
import { InvitationStatus } from '../../SharedSubscription/InvitationStatus'
|
||||||
import { InviteeIdentifierType } from '../../SharedSubscription/InviteeIdentifierType'
|
import { InviteeIdentifierType } from '../../SharedSubscription/InviteeIdentifierType'
|
||||||
@@ -89,6 +91,16 @@ export class InviteToSharedSubscription implements UseCaseInterface {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await this.domainEventPublisher.publish(
|
||||||
|
this.domainEventFactory.createEmailRequestedEvent({
|
||||||
|
userEmail: dto.inviteeIdentifier,
|
||||||
|
level: EmailLevel.LEVELS.System,
|
||||||
|
body: getBody(dto.inviterEmail, savedInvitation.uuid),
|
||||||
|
messageIdentifier: 'SHARED_SUBSCRIPTION_INVITATION',
|
||||||
|
subject: getSubject(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
sharedSubscriptionInvitationUuid: savedInvitation.uuid,
|
sharedSubscriptionInvitationUuid: savedInvitation.uuid,
|
||||||
|
|||||||
@@ -3,6 +3,26 @@
|
|||||||
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.53](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.52...@standardnotes/domain-events-infra@1.9.53) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
|
## [1.9.52](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.51...@standardnotes/domain-events-infra@1.9.52) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
|
## [1.9.51](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.50...@standardnotes/domain-events-infra@1.9.51) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
|
## [1.9.50](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.49...@standardnotes/domain-events-infra@1.9.50) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
|
## [1.9.49](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.48...@standardnotes/domain-events-infra@1.9.49) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/domain-events-infra
|
||||||
|
|
||||||
## [1.9.48](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.47...@standardnotes/domain-events-infra@1.9.48) (2022-12-09)
|
## [1.9.48](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.9.47...@standardnotes/domain-events-infra@1.9.48) (2022-12-09)
|
||||||
|
|
||||||
**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.48",
|
"version": "1.9.53",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,36 @@
|
|||||||
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.103.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.103.0...@standardnotes/domain-events@2.103.1) (2022-12-09)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **domain-events:** add additional styles option for sending email ([20d9214](https://github.com/standardnotes/server/commit/20d92149a8c559edf6aa25932b3dbcbc00b2e878))
|
||||||
|
|
||||||
|
# [2.103.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.102.0...@standardnotes/domain-events@2.103.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **workspace:** replace workspace invite created event with email requested ([61c1cff](https://github.com/standardnotes/server/commit/61c1cfff4bcee09e1f933cb3e085412b6f07cc42))
|
||||||
|
|
||||||
|
# [2.102.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.101.0...@standardnotes/domain-events@2.102.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** replace email backup attachment created with email requested ([32601f3](https://github.com/standardnotes/server/commit/32601f34f181b29b7c62cd2926111a0887d97fbf))
|
||||||
|
|
||||||
|
# [2.101.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.100.0...@standardnotes/domain-events@2.101.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** replace one drive backup failed event with email requested ([130f90b](https://github.com/standardnotes/server/commit/130f90bdb6cc88e073b9380e8aed5eebe8c49c1e))
|
||||||
|
|
||||||
|
# [2.100.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.99.0...@standardnotes/domain-events@2.100.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** remove google drive backup failed event in favour of email requested ([00fe321](https://github.com/standardnotes/server/commit/00fe32136e7add627e58e8ea223f7f484f1d3718))
|
||||||
|
|
||||||
# [2.99.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.98.4...@standardnotes/domain-events@2.99.0) (2022-12-09)
|
# [2.99.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.98.4...@standardnotes/domain-events@2.99.0) (2022-12-09)
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events",
|
"name": "@standardnotes/domain-events",
|
||||||
"version": "2.99.0",
|
"version": "2.103.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import { DomainEventInterface } from './DomainEventInterface'
|
|
||||||
|
|
||||||
import { DropboxBackupFailedEventPayload } from './DropboxBackupFailedEventPayload'
|
|
||||||
|
|
||||||
export interface DropboxBackupFailedEvent extends DomainEventInterface {
|
|
||||||
type: 'DROPBOX_BACKUP_FAILED'
|
|
||||||
payload: DropboxBackupFailedEventPayload
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export interface DropboxBackupFailedEventPayload {
|
|
||||||
muteCloudEmailsSettingUuid: string
|
|
||||||
extensionSettingUuid?: string
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { DomainEventInterface } from './DomainEventInterface'
|
|
||||||
import { EmailBackupAttachmentCreatedEventPayload } from './EmailBackupAttachmentCreatedEventPayload'
|
|
||||||
|
|
||||||
export interface EmailBackupAttachmentCreatedEvent extends DomainEventInterface {
|
|
||||||
type: 'EMAIL_BACKUP_ATTACHMENT_CREATED'
|
|
||||||
payload: EmailBackupAttachmentCreatedEventPayload
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export interface EmailBackupAttachmentCreatedEventPayload {
|
|
||||||
backupFileName: string
|
|
||||||
backupFileIndex: number
|
|
||||||
backupFilesTotal: number
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
@@ -4,6 +4,8 @@ export interface EmailRequestedEventPayload {
|
|||||||
level: string
|
level: string
|
||||||
subject: string
|
subject: string
|
||||||
body: string
|
body: string
|
||||||
|
sender?: string
|
||||||
|
additionalStyles?: string
|
||||||
attachments?: Array<{
|
attachments?: Array<{
|
||||||
filePath: string
|
filePath: string
|
||||||
fileName: string
|
fileName: string
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import { DomainEventInterface } from './DomainEventInterface'
|
|
||||||
|
|
||||||
import { GoogleDriveBackupFailedEventPayload } from './GoogleDriveBackupFailedEventPayload'
|
|
||||||
|
|
||||||
export interface GoogleDriveBackupFailedEvent extends DomainEventInterface {
|
|
||||||
type: 'GOOGLE_DRIVE_BACKUP_FAILED'
|
|
||||||
payload: GoogleDriveBackupFailedEventPayload
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export interface GoogleDriveBackupFailedEventPayload {
|
|
||||||
muteCloudEmailsSettingUuid: string
|
|
||||||
extensionSettingUuid?: string
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import { DomainEventInterface } from './DomainEventInterface'
|
|
||||||
|
|
||||||
import { OneDriveBackupFailedEventPayload } from './OneDriveBackupFailedEventPayload'
|
|
||||||
|
|
||||||
export interface OneDriveBackupFailedEvent extends DomainEventInterface {
|
|
||||||
type: 'ONE_DRIVE_BACKUP_FAILED'
|
|
||||||
payload: OneDriveBackupFailedEventPayload
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export interface OneDriveBackupFailedEventPayload {
|
|
||||||
muteCloudEmailsSettingUuid: string
|
|
||||||
extensionSettingUuid?: string
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import { DomainEventInterface } from './DomainEventInterface'
|
|
||||||
import { WorkspaceInviteCreatedEventPayload } from './WorkspaceInviteCreatedEventPayload'
|
|
||||||
|
|
||||||
export interface WorkspaceInviteCreatedEvent extends DomainEventInterface {
|
|
||||||
type: 'WORKSPACE_INVITE_CREATED'
|
|
||||||
payload: WorkspaceInviteCreatedEventPayload
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export interface WorkspaceInviteCreatedEventPayload {
|
|
||||||
inviterUuid: string
|
|
||||||
inviteeEmail: string
|
|
||||||
inviteUuid: string
|
|
||||||
workspaceUuid: string
|
|
||||||
}
|
|
||||||
@@ -10,14 +10,10 @@ export * from './Event/DiscountWithdrawRequestedEvent'
|
|||||||
export * from './Event/DiscountWithdrawRequestedEventPayload'
|
export * from './Event/DiscountWithdrawRequestedEventPayload'
|
||||||
export * from './Event/DomainEventInterface'
|
export * from './Event/DomainEventInterface'
|
||||||
export * from './Event/DomainEventService'
|
export * from './Event/DomainEventService'
|
||||||
export * from './Event/DropboxBackupFailedEvent'
|
|
||||||
export * from './Event/DropboxBackupFailedEventPayload'
|
|
||||||
export * from './Event/DuplicateItemSyncedEvent'
|
export * from './Event/DuplicateItemSyncedEvent'
|
||||||
export * from './Event/DuplicateItemSyncedEventPayload'
|
export * from './Event/DuplicateItemSyncedEventPayload'
|
||||||
export * from './Event/EmailArchiveExtensionSyncedEvent'
|
export * from './Event/EmailArchiveExtensionSyncedEvent'
|
||||||
export * from './Event/EmailArchiveExtensionSyncedEventPayload'
|
export * from './Event/EmailArchiveExtensionSyncedEventPayload'
|
||||||
export * from './Event/EmailBackupAttachmentCreatedEvent'
|
|
||||||
export * from './Event/EmailBackupAttachmentCreatedEventPayload'
|
|
||||||
export * from './Event/EmailBackupRequestedEvent'
|
export * from './Event/EmailBackupRequestedEvent'
|
||||||
export * from './Event/EmailBackupRequestedEventPayload'
|
export * from './Event/EmailBackupRequestedEventPayload'
|
||||||
export * from './Event/EmailRequestedEvent'
|
export * from './Event/EmailRequestedEvent'
|
||||||
@@ -34,8 +30,6 @@ export * from './Event/FileRemovedEvent'
|
|||||||
export * from './Event/FileRemovedEventPayload'
|
export * from './Event/FileRemovedEventPayload'
|
||||||
export * from './Event/FileUploadedEvent'
|
export * from './Event/FileUploadedEvent'
|
||||||
export * from './Event/FileUploadedEventPayload'
|
export * from './Event/FileUploadedEventPayload'
|
||||||
export * from './Event/GoogleDriveBackupFailedEvent'
|
|
||||||
export * from './Event/GoogleDriveBackupFailedEventPayload'
|
|
||||||
export * from './Event/ItemDumpedEvent'
|
export * from './Event/ItemDumpedEvent'
|
||||||
export * from './Event/ItemDumpedEventPayload'
|
export * from './Event/ItemDumpedEventPayload'
|
||||||
export * from './Event/ItemRevisionCreationRequestedEvent'
|
export * from './Event/ItemRevisionCreationRequestedEvent'
|
||||||
@@ -50,8 +44,6 @@ export * from './Event/ListedAccountRequestedEvent'
|
|||||||
export * from './Event/ListedAccountRequestedEventPayload'
|
export * from './Event/ListedAccountRequestedEventPayload'
|
||||||
export * from './Event/MuteEmailsSettingChangedEvent'
|
export * from './Event/MuteEmailsSettingChangedEvent'
|
||||||
export * from './Event/MuteEmailsSettingChangedEventPayload'
|
export * from './Event/MuteEmailsSettingChangedEventPayload'
|
||||||
export * from './Event/OneDriveBackupFailedEvent'
|
|
||||||
export * from './Event/OneDriveBackupFailedEventPayload'
|
|
||||||
export * from './Event/PaymentFailedEvent'
|
export * from './Event/PaymentFailedEvent'
|
||||||
export * from './Event/PaymentFailedEventPayload'
|
export * from './Event/PaymentFailedEventPayload'
|
||||||
export * from './Event/PaymentSuccessEvent'
|
export * from './Event/PaymentSuccessEvent'
|
||||||
@@ -102,8 +94,6 @@ export * from './Event/WebSocketMessageRequestedEvent'
|
|||||||
export * from './Event/WebSocketMessageRequestedEventPayload'
|
export * from './Event/WebSocketMessageRequestedEventPayload'
|
||||||
export * from './Event/WorkspaceInviteAcceptedEvent'
|
export * from './Event/WorkspaceInviteAcceptedEvent'
|
||||||
export * from './Event/WorkspaceInviteAcceptedEventPayload'
|
export * from './Event/WorkspaceInviteAcceptedEventPayload'
|
||||||
export * from './Event/WorkspaceInviteCreatedEvent'
|
|
||||||
export * from './Event/WorkspaceInviteCreatedEventPayload'
|
|
||||||
|
|
||||||
export * from './Handler/DomainEventHandlerInterface'
|
export * from './Handler/DomainEventHandlerInterface'
|
||||||
export * from './Handler/DomainEventMessageHandlerInterface'
|
export * from './Handler/DomainEventMessageHandlerInterface'
|
||||||
|
|||||||
@@ -3,6 +3,26 @@
|
|||||||
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.50](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.49...@standardnotes/event-store@1.6.50) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.6.49](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.48...@standardnotes/event-store@1.6.49) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.6.48](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.47...@standardnotes/event-store@1.6.48) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.6.47](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.46...@standardnotes/event-store@1.6.47) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
|
## [1.6.46](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.45...@standardnotes/event-store@1.6.46) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|
||||||
## [1.6.45](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.44...@standardnotes/event-store@1.6.45) (2022-12-09)
|
## [1.6.45](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.6.44...@standardnotes/event-store@1.6.45) (2022-12-09)
|
||||||
|
|
||||||
**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.45",
|
"version": "1.6.50",
|
||||||
"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,26 @@
|
|||||||
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.49](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.48...@standardnotes/files-server@1.8.49) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.8.48](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.47...@standardnotes/files-server@1.8.48) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.8.47](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.46...@standardnotes/files-server@1.8.47) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.8.46](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.45...@standardnotes/files-server@1.8.46) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
|
## [1.8.45](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.44...@standardnotes/files-server@1.8.45) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|
||||||
## [1.8.44](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.43...@standardnotes/files-server@1.8.44) (2022-12-09)
|
## [1.8.44](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.8.43...@standardnotes/files-server@1.8.44) (2022-12-09)
|
||||||
|
|
||||||
**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.44",
|
"version": "1.8.49",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,26 @@
|
|||||||
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.22](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.21...@standardnotes/revisions-server@1.9.22) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.9.21](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.20...@standardnotes/revisions-server@1.9.21) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.9.20](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.19...@standardnotes/revisions-server@1.9.20) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.9.19](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.18...@standardnotes/revisions-server@1.9.19) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
|
## [1.9.18](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.17...@standardnotes/revisions-server@1.9.18) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|
||||||
## [1.9.17](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.16...@standardnotes/revisions-server@1.9.17) (2022-12-09)
|
## [1.9.17](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.9.16...@standardnotes/revisions-server@1.9.17) (2022-12-09)
|
||||||
|
|
||||||
**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.9.17",
|
"version": "1.9.22",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,28 @@
|
|||||||
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.3](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.15.2...@standardnotes/scheduler-server@1.15.3) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
|
## [1.15.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.15.1...@standardnotes/scheduler-server@1.15.2) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
|
## [1.15.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.15.0...@standardnotes/scheduler-server@1.15.1) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
|
# [1.15.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.14.10...@standardnotes/scheduler-server@1.15.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** replace one drive backup failed event with email requested ([130f90b](https://github.com/standardnotes/server/commit/130f90bdb6cc88e073b9380e8aed5eebe8c49c1e))
|
||||||
|
|
||||||
|
## [1.14.10](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.14.9...@standardnotes/scheduler-server@1.14.10) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|
||||||
## [1.14.9](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.14.8...@standardnotes/scheduler-server@1.14.9) (2022-12-09)
|
## [1.14.9](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.14.8...@standardnotes/scheduler-server@1.14.9) (2022-12-09)
|
||||||
|
|
||||||
**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.14.9",
|
"version": "1.15.3",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
DiscountApplyRequestedEvent,
|
DiscountApplyRequestedEvent,
|
||||||
DiscountWithdrawRequestedEvent,
|
DiscountWithdrawRequestedEvent,
|
||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
EmailMessageRequestedEvent,
|
EmailRequestedEvent,
|
||||||
ExitDiscountWithdrawRequestedEvent,
|
ExitDiscountWithdrawRequestedEvent,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { PredicateName } from '@standardnotes/predicates'
|
import { PredicateName } from '@standardnotes/predicates'
|
||||||
@@ -45,9 +45,7 @@ describe('JobDoneInterpreter', () => {
|
|||||||
predicateRepository.findByJobUuid = jest.fn().mockReturnValue([])
|
predicateRepository.findByJobUuid = jest.fn().mockReturnValue([])
|
||||||
|
|
||||||
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
||||||
domainEventFactory.createEmailRequestedEvent = jest
|
domainEventFactory.createEmailRequestedEvent = jest.fn().mockReturnValue({} as jest.Mocked<EmailRequestedEvent>)
|
||||||
.fn()
|
|
||||||
.mockReturnValue({} as jest.Mocked<EmailMessageRequestedEvent>)
|
|
||||||
domainEventFactory.createDiscountApplyRequestedEvent = jest
|
domainEventFactory.createDiscountApplyRequestedEvent = jest
|
||||||
.fn()
|
.fn()
|
||||||
.mockReturnValue({} as jest.Mocked<DiscountApplyRequestedEvent>)
|
.mockReturnValue({} as jest.Mocked<DiscountApplyRequestedEvent>)
|
||||||
|
|||||||
@@ -3,6 +3,38 @@
|
|||||||
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.24.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.24.1...@standardnotes/syncing-server@1.24.2) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
|
## [1.24.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.24.0...@standardnotes/syncing-server@1.24.1) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|
||||||
|
# [1.24.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.23.0...@standardnotes/syncing-server@1.24.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** replace email backup attachment created with email requested ([32601f3](https://github.com/standardnotes/syncing-server-js/commit/32601f34f181b29b7c62cd2926111a0887d97fbf))
|
||||||
|
|
||||||
|
# [1.23.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.22.0...@standardnotes/syncing-server@1.23.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** replace one drive backup failed event with email requested ([130f90b](https://github.com/standardnotes/syncing-server-js/commit/130f90bdb6cc88e073b9380e8aed5eebe8c49c1e))
|
||||||
|
|
||||||
|
# [1.22.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.21.0...@standardnotes/syncing-server@1.22.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-serfver:** remove dropbox backup failed event in favour of email requested ([118156c](https://github.com/standardnotes/syncing-server-js/commit/118156c62de70eca8fd89414f6e409abd0363e62))
|
||||||
|
|
||||||
|
# [1.21.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.20.17...@standardnotes/syncing-server@1.21.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **syncing-server:** remove google drive backup failed event in favour of email requested ([00fe321](https://github.com/standardnotes/syncing-server-js/commit/00fe32136e7add627e58e8ea223f7f484f1d3718))
|
||||||
|
|
||||||
## [1.20.17](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.20.16...@standardnotes/syncing-server@1.20.17) (2022-12-09)
|
## [1.20.17](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.20.16...@standardnotes/syncing-server@1.20.17) (2022-12-09)
|
||||||
|
|
||||||
**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', '/Infra/'],
|
coveragePathIgnorePatterns: ['/Bootstrap/', 'HealthCheckController', '/Infra/', '/Domain/Email/'],
|
||||||
setupFilesAfterEnv: ['./test-setup.ts'],
|
setupFilesAfterEnv: ['./test-setup.ts'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/syncing-server",
|
"name": "@standardnotes/syncing-server",
|
||||||
"version": "1.20.17",
|
"version": "1.24.2",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { html } from './dropbox-backup-failed.html'
|
||||||
|
|
||||||
|
export function getSubject(): string {
|
||||||
|
return 'Failed Daily Backup to Dropbox'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBody(): string {
|
||||||
|
return html
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { html } from './email-backup-attachment-created.html'
|
||||||
|
|
||||||
|
export function getSubject(fileIndex: number, numberOfFiles: number, date: string): string {
|
||||||
|
let subject = `Data Backup for ${date}`
|
||||||
|
if (numberOfFiles > 1) {
|
||||||
|
subject = `Data Backup for ${date} - Part ${fileIndex} Of ${numberOfFiles}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return subject
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBody(email: string): string {
|
||||||
|
return html(email)
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { html } from './google-drive-backup-failed.html'
|
||||||
|
|
||||||
|
export function getSubject(): string {
|
||||||
|
return 'Failed Daily Backup to Google Drive Sync'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBody(): string {
|
||||||
|
return html
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { html } from './one-drive-backup-failed.html'
|
||||||
|
|
||||||
|
export function getSubject(): string {
|
||||||
|
return 'Failed Daily Backup to OneDrive Sync'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBody(): string {
|
||||||
|
return html
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
export const html = `<p>Hello,</p>
|
||||||
|
<p>We recently tried backing up your data to <strong>Dropbox</strong>, but an issue prevented us from doing so.</p>
|
||||||
|
<p>
|
||||||
|
The usual cause is an expired or revoked token from your sync provider. Please follow
|
||||||
|
<a href='https://standardnotes.com/help/27/how-do-i-enable-dropbox-google-drive-or-onedrive-backups'>these
|
||||||
|
instructions</a>
|
||||||
|
to use CloudLink on the web or desktop Standard Notes application to uninstall then reinstall this sync provider.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We apologize for any inconvenience this may cause.
|
||||||
|
If you have any questions, please feel free to reply directly to this email.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Thanks,
|
||||||
|
<br>SN</br>
|
||||||
|
</p>
|
||||||
|
<a href='https://app.standardnotes.com/?settings=backups'>Mute these emails</a>`
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
export const html = (email: string) => `
|
||||||
|
<p>
|
||||||
|
Your encrypted data backup is attached for ${email}. You can import this file using
|
||||||
|
the Standard Notes web or desktop app, or by using the offline decryption script available at
|
||||||
|
<a style="text-decoration:none !important; text-decoration:none;">standardnotes.org/offline</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Please note:</strong>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
We will never send anything other than a <code>txt</code> file
|
||||||
|
as part of your daily backups. To protect yourself against phishing attacks, never open
|
||||||
|
any other kind of file, and always open the <code>txt</code> file with a text editor to
|
||||||
|
verify its contents before decrypting.
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
We will never include clickable links in this email. Instead, manually verify
|
||||||
|
and copy/paste the offline link above in your browser.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
|
<i>
|
||||||
|
Want to disable daily backups? Uninstall 'Daily Email Backups' from your Extensions
|
||||||
|
menu in Standard Notes to immediately disable backups.
|
||||||
|
Otherwise, reply to this email with "Stop". Note that it may
|
||||||
|
take up to 72 hours or more to perform manual removal via the "Stop" method.
|
||||||
|
</i>
|
||||||
|
</p>
|
||||||
|
`
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export const html = `<p>Hello,</p>
|
||||||
|
<p>We recently tried backing up your data to <strong>Google Drive Sync</strong>, but an issue prevented us from
|
||||||
|
doing
|
||||||
|
so.</p>
|
||||||
|
<p>
|
||||||
|
The usual cause is an expired or revoked token from your sync provider. Please follow
|
||||||
|
<a href='https://standardnotes.com/help/27/how-do-i-enable-dropbox-google-drive-or-onedrive-backups'>these
|
||||||
|
instructions</a>
|
||||||
|
to use CloudLink on the web or desktop Standard Notes application to uninstall then reinstall this sync provider.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We apologize for any inconvenience this may cause.
|
||||||
|
If you have any questions, please feel free to reply directly to this email.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Thanks,
|
||||||
|
<br>SN</br>
|
||||||
|
</p>
|
||||||
|
<a href='https://app.standardnotes.com/?settings=backups'>Mute these emails</a>`
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
export const html = `<p>Hello,</p>
|
||||||
|
<p>We recently tried backing up your data to <strong>OneDrive Sync</strong>, but an issue prevented us from doing
|
||||||
|
so.</p>
|
||||||
|
<p>
|
||||||
|
The usual cause is an expired or revoked token from your sync provider. Please follow
|
||||||
|
<a href='https://standardnotes.com/help/27/how-do-i-enable-dropbox-google-drive-or-onedrive-backups'>these
|
||||||
|
instructions</a>
|
||||||
|
to use CloudLink on the web or desktop Standard Notes application to uninstall then reinstall this sync provider.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
We apologize for any inconvenience this may cause.
|
||||||
|
If you have any questions, please feel free to reply directly to this email.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Thanks,
|
||||||
|
<br>SN</br>
|
||||||
|
</p>
|
||||||
|
<a href='https://app.standardnotes.com/?settings=backups'>Mute these emails</a>`
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
import {
|
import {
|
||||||
DomainEventService,
|
DomainEventService,
|
||||||
DropboxBackupFailedEvent,
|
|
||||||
DuplicateItemSyncedEvent,
|
DuplicateItemSyncedEvent,
|
||||||
EmailArchiveExtensionSyncedEvent,
|
EmailArchiveExtensionSyncedEvent,
|
||||||
EmailBackupAttachmentCreatedEvent,
|
EmailRequestedEvent,
|
||||||
GoogleDriveBackupFailedEvent,
|
|
||||||
ItemDumpedEvent,
|
ItemDumpedEvent,
|
||||||
ItemRevisionCreationRequestedEvent,
|
ItemRevisionCreationRequestedEvent,
|
||||||
ItemsSyncedEvent,
|
ItemsSyncedEvent,
|
||||||
OneDriveBackupFailedEvent,
|
|
||||||
RevisionsCopyRequestedEvent,
|
RevisionsCopyRequestedEvent,
|
||||||
RevisionsOwnershipUpdateRequestedEvent,
|
RevisionsOwnershipUpdateRequestedEvent,
|
||||||
UserContentSizeRecalculationRequestedEvent,
|
UserContentSizeRecalculationRequestedEvent,
|
||||||
@@ -131,57 +128,31 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createDropboxBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): DropboxBackupFailedEvent {
|
createEmailRequestedEvent(dto: {
|
||||||
|
userEmail: string
|
||||||
|
messageIdentifier: string
|
||||||
|
level: string
|
||||||
|
body: string
|
||||||
|
subject: string
|
||||||
|
sender?: string
|
||||||
|
attachments?: Array<{
|
||||||
|
filePath: string
|
||||||
|
fileName: string
|
||||||
|
attachmentFileName: string
|
||||||
|
attachmentContentType: string
|
||||||
|
}>
|
||||||
|
}): EmailRequestedEvent {
|
||||||
return {
|
return {
|
||||||
type: 'DROPBOX_BACKUP_FAILED',
|
type: 'EMAIL_REQUESTED',
|
||||||
createdAt: this.timer.getUTCDate(),
|
createdAt: this.timer.getUTCDate(),
|
||||||
meta: {
|
meta: {
|
||||||
correlation: {
|
correlation: {
|
||||||
userIdentifier: email,
|
userIdentifier: dto.userEmail,
|
||||||
userIdentifierType: 'email',
|
userIdentifierType: 'email',
|
||||||
},
|
},
|
||||||
origin: DomainEventService.SyncingServer,
|
origin: DomainEventService.SyncingServer,
|
||||||
},
|
},
|
||||||
payload: {
|
payload: dto,
|
||||||
muteCloudEmailsSettingUuid,
|
|
||||||
email,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
createGoogleDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): GoogleDriveBackupFailedEvent {
|
|
||||||
return {
|
|
||||||
type: 'GOOGLE_DRIVE_BACKUP_FAILED',
|
|
||||||
createdAt: this.timer.getUTCDate(),
|
|
||||||
meta: {
|
|
||||||
correlation: {
|
|
||||||
userIdentifier: email,
|
|
||||||
userIdentifierType: 'email',
|
|
||||||
},
|
|
||||||
origin: DomainEventService.SyncingServer,
|
|
||||||
},
|
|
||||||
payload: {
|
|
||||||
muteCloudEmailsSettingUuid,
|
|
||||||
email,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
createOneDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): OneDriveBackupFailedEvent {
|
|
||||||
return {
|
|
||||||
type: 'ONE_DRIVE_BACKUP_FAILED',
|
|
||||||
createdAt: this.timer.getUTCDate(),
|
|
||||||
meta: {
|
|
||||||
correlation: {
|
|
||||||
userIdentifier: email,
|
|
||||||
userIdentifierType: 'email',
|
|
||||||
},
|
|
||||||
origin: DomainEventService.SyncingServer,
|
|
||||||
},
|
|
||||||
payload: {
|
|
||||||
muteCloudEmailsSettingUuid,
|
|
||||||
email,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,24 +196,4 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createEmailBackupAttachmentCreatedEvent(dto: {
|
|
||||||
backupFileName: string
|
|
||||||
backupFileIndex: number
|
|
||||||
backupFilesTotal: number
|
|
||||||
email: string
|
|
||||||
}): EmailBackupAttachmentCreatedEvent {
|
|
||||||
return {
|
|
||||||
type: 'EMAIL_BACKUP_ATTACHMENT_CREATED',
|
|
||||||
createdAt: this.timer.getUTCDate(),
|
|
||||||
meta: {
|
|
||||||
correlation: {
|
|
||||||
userIdentifier: dto.email,
|
|
||||||
userIdentifierType: 'email',
|
|
||||||
},
|
|
||||||
origin: DomainEventService.SyncingServer,
|
|
||||||
},
|
|
||||||
payload: dto,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
DropboxBackupFailedEvent,
|
|
||||||
DuplicateItemSyncedEvent,
|
DuplicateItemSyncedEvent,
|
||||||
EmailArchiveExtensionSyncedEvent,
|
EmailArchiveExtensionSyncedEvent,
|
||||||
EmailBackupAttachmentCreatedEvent,
|
EmailRequestedEvent,
|
||||||
GoogleDriveBackupFailedEvent,
|
|
||||||
ItemDumpedEvent,
|
ItemDumpedEvent,
|
||||||
ItemRevisionCreationRequestedEvent,
|
ItemRevisionCreationRequestedEvent,
|
||||||
ItemsSyncedEvent,
|
ItemsSyncedEvent,
|
||||||
OneDriveBackupFailedEvent,
|
|
||||||
RevisionsCopyRequestedEvent,
|
RevisionsCopyRequestedEvent,
|
||||||
RevisionsOwnershipUpdateRequestedEvent,
|
RevisionsOwnershipUpdateRequestedEvent,
|
||||||
UserContentSizeRecalculationRequestedEvent,
|
UserContentSizeRecalculationRequestedEvent,
|
||||||
@@ -15,9 +12,20 @@ import {
|
|||||||
|
|
||||||
export interface DomainEventFactoryInterface {
|
export interface DomainEventFactoryInterface {
|
||||||
createUserContentSizeRecalculationRequestedEvent(userUuid: string): UserContentSizeRecalculationRequestedEvent
|
createUserContentSizeRecalculationRequestedEvent(userUuid: string): UserContentSizeRecalculationRequestedEvent
|
||||||
createDropboxBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): DropboxBackupFailedEvent
|
createEmailRequestedEvent(dto: {
|
||||||
createGoogleDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): GoogleDriveBackupFailedEvent
|
userEmail: string
|
||||||
createOneDriveBackupFailedEvent(muteCloudEmailsSettingUuid: string, email: string): OneDriveBackupFailedEvent
|
messageIdentifier: string
|
||||||
|
level: string
|
||||||
|
body: string
|
||||||
|
subject: string
|
||||||
|
sender?: string
|
||||||
|
attachments?: Array<{
|
||||||
|
filePath: string
|
||||||
|
fileName: string
|
||||||
|
attachmentFileName: string
|
||||||
|
attachmentContentType: string
|
||||||
|
}>
|
||||||
|
}): EmailRequestedEvent
|
||||||
createItemsSyncedEvent(dto: {
|
createItemsSyncedEvent(dto: {
|
||||||
userUuid: string
|
userUuid: string
|
||||||
extensionUrl: string
|
extensionUrl: string
|
||||||
@@ -28,12 +36,6 @@ export interface DomainEventFactoryInterface {
|
|||||||
source: 'account-deletion' | 'realtime-extensions-sync'
|
source: 'account-deletion' | 'realtime-extensions-sync'
|
||||||
}): ItemsSyncedEvent
|
}): ItemsSyncedEvent
|
||||||
createEmailArchiveExtensionSyncedEvent(userUuid: string, extensionId: string): EmailArchiveExtensionSyncedEvent
|
createEmailArchiveExtensionSyncedEvent(userUuid: string, extensionId: string): EmailArchiveExtensionSyncedEvent
|
||||||
createEmailBackupAttachmentCreatedEvent(dto: {
|
|
||||||
backupFileName: string
|
|
||||||
backupFileIndex: number
|
|
||||||
backupFilesTotal: number
|
|
||||||
email: string
|
|
||||||
}): EmailBackupAttachmentCreatedEvent
|
|
||||||
createDuplicateItemSyncedEvent(itemUuid: string, userUuid: string): DuplicateItemSyncedEvent
|
createDuplicateItemSyncedEvent(itemUuid: string, userUuid: string): DuplicateItemSyncedEvent
|
||||||
createItemRevisionCreationRequested(itemUuid: string, userUuid: string): ItemRevisionCreationRequestedEvent
|
createItemRevisionCreationRequested(itemUuid: string, userUuid: string): ItemRevisionCreationRequestedEvent
|
||||||
createItemDumpedEvent(fileDumpPath: string, userUuid: string): ItemDumpedEvent
|
createItemDumpedEvent(fileDumpPath: string, userUuid: string): ItemDumpedEvent
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ describe('ExtensionsHttpService', () => {
|
|||||||
domainEventPublisher.publish = jest.fn()
|
domainEventPublisher.publish = jest.fn()
|
||||||
|
|
||||||
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
||||||
domainEventFactory.createDropboxBackupFailedEvent = jest.fn()
|
domainEventFactory.createEmailRequestedEvent = jest.fn()
|
||||||
domainEventFactory.createGoogleDriveBackupFailedEvent = jest.fn()
|
|
||||||
domainEventFactory.createOneDriveBackupFailedEvent = jest.fn()
|
|
||||||
|
|
||||||
contentDecoder = {} as jest.Mocked<ContentDecoderInterface>
|
contentDecoder = {} as jest.Mocked<ContentDecoderInterface>
|
||||||
contentDecoder.decode = jest.fn().mockReturnValue({ name: 'Dropbox' })
|
contentDecoder.decode = jest.fn().mockReturnValue({ name: 'Dropbox' })
|
||||||
@@ -65,7 +63,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
forceMute: false,
|
forceMute: false,
|
||||||
backupFilename: 'test',
|
backupFilename: 'test',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
cloudProvider: 'DROPBOX',
|
cloudProvider: 'DROPBOX',
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -73,7 +70,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
data: {
|
data: {
|
||||||
auth_params: authParams,
|
auth_params: authParams,
|
||||||
backup_filename: 'test',
|
backup_filename: 'test',
|
||||||
settings_id: '3-4-5',
|
|
||||||
silent: false,
|
silent: false,
|
||||||
user_uuid: '1-2-3',
|
user_uuid: '1-2-3',
|
||||||
},
|
},
|
||||||
@@ -99,12 +95,11 @@ describe('ExtensionsHttpService', () => {
|
|||||||
forceMute: false,
|
forceMute: false,
|
||||||
backupFilename: 'test',
|
backupFilename: 'test',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
cloudProvider: 'DROPBOX',
|
cloudProvider: 'DROPBOX',
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createDropboxBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should send items to extensions server', async () => {
|
it('should send items to extensions server', async () => {
|
||||||
@@ -116,7 +111,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: '',
|
backupFilename: '',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(httpClient.request).toHaveBeenCalledWith({
|
expect(httpClient.request).toHaveBeenCalledWith({
|
||||||
@@ -124,7 +118,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
auth_params: authParams,
|
auth_params: authParams,
|
||||||
backup_filename: '',
|
backup_filename: '',
|
||||||
items: [item],
|
items: [item],
|
||||||
settings_id: '3-4-5',
|
|
||||||
silent: false,
|
silent: false,
|
||||||
user_uuid: '1-2-3',
|
user_uuid: '1-2-3',
|
||||||
},
|
},
|
||||||
@@ -145,14 +138,12 @@ describe('ExtensionsHttpService', () => {
|
|||||||
forceMute: false,
|
forceMute: false,
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(httpClient.request).toHaveBeenCalledWith({
|
expect(httpClient.request).toHaveBeenCalledWith({
|
||||||
data: {
|
data: {
|
||||||
auth_params: authParams,
|
auth_params: authParams,
|
||||||
backup_filename: 'backup-file',
|
backup_filename: 'backup-file',
|
||||||
settings_id: '3-4-5',
|
|
||||||
silent: false,
|
silent: false,
|
||||||
user_uuid: '1-2-3',
|
user_uuid: '1-2-3',
|
||||||
},
|
},
|
||||||
@@ -180,11 +171,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createDropboxBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a failed Dropbox backup event if request was sent and extensions server responded not ok', async () => {
|
it('should publish a failed Dropbox backup event if request was sent and extensions server responded not ok', async () => {
|
||||||
@@ -200,11 +190,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createDropboxBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a failed Google Drive backup event if request was not sent successfully', async () => {
|
it('should publish a failed Google Drive backup event if request was not sent successfully', async () => {
|
||||||
@@ -222,11 +211,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createGoogleDriveBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a failed One Drive backup event if request was not sent successfully', async () => {
|
it('should publish a failed One Drive backup event if request was not sent successfully', async () => {
|
||||||
@@ -244,11 +232,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createOneDriveBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not publish a failed backup event if emailes are force muted', async () => {
|
it('should not publish a failed backup event if emailes are force muted', async () => {
|
||||||
@@ -266,7 +253,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||||
@@ -289,7 +275,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e
|
error = e
|
||||||
@@ -316,7 +301,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e
|
error = e
|
||||||
@@ -340,11 +324,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createDropboxBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a failed Google Drive backup event judging by extension url if request was not sent successfully', async () => {
|
it('should publish a failed Google Drive backup event judging by extension url if request was not sent successfully', async () => {
|
||||||
@@ -362,11 +345,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createGoogleDriveBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should publish a failed One Drive backup event judging by extension url if request was not sent successfully', async () => {
|
it('should publish a failed One Drive backup event judging by extension url if request was not sent successfully', async () => {
|
||||||
@@ -384,11 +366,10 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
expect(domainEventPublisher.publish).toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createOneDriveBackupFailedEvent).toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw an error if cannot deduce extension by judging from the url', async () => {
|
it('should throw an error if cannot deduce extension by judging from the url', async () => {
|
||||||
@@ -408,7 +389,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e
|
error = e
|
||||||
@@ -434,7 +414,6 @@ describe('ExtensionsHttpService', () => {
|
|||||||
items: [item],
|
items: [item],
|
||||||
backupFilename: 'backup-file',
|
backupFilename: 'backup-file',
|
||||||
authParams,
|
authParams,
|
||||||
muteEmailsSettingUuid: '3-4-5',
|
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e
|
error = e
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { KeyParamsData } from '@standardnotes/responses'
|
import { KeyParamsData } from '@standardnotes/responses'
|
||||||
import { DomainEventInterface, DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventInterface, DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
import { AxiosInstance } from 'axios'
|
import { AxiosInstance } from 'axios'
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
@@ -10,6 +11,9 @@ import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
|||||||
import { ExtensionName } from './ExtensionName'
|
import { ExtensionName } from './ExtensionName'
|
||||||
import { ExtensionsHttpServiceInterface } from './ExtensionsHttpServiceInterface'
|
import { ExtensionsHttpServiceInterface } from './ExtensionsHttpServiceInterface'
|
||||||
import { SendItemsToExtensionsServerDTO } from './SendItemsToExtensionsServerDTO'
|
import { SendItemsToExtensionsServerDTO } from './SendItemsToExtensionsServerDTO'
|
||||||
|
import { getBody as googleDriveBody, getSubject as googleDriveSubject } from '../Email/GoogleDriveBackupFailed'
|
||||||
|
import { getBody as dropboxBody, getSubject as dropboxSubject } from '../Email/DropboxBackupFailed'
|
||||||
|
import { getBody as oneDriveBody, getSubject as oneDriveSubject } from '../Email/OneDriveBackupFailed'
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
||||||
@@ -29,7 +33,6 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
authParams: KeyParamsData
|
authParams: KeyParamsData
|
||||||
forceMute: boolean
|
forceMute: boolean
|
||||||
userUuid: string
|
userUuid: string
|
||||||
muteEmailsSettingUuid: string
|
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
let sent = false
|
let sent = false
|
||||||
try {
|
try {
|
||||||
@@ -38,7 +41,6 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
auth_params: dto.authParams,
|
auth_params: dto.authParams,
|
||||||
silent: dto.forceMute,
|
silent: dto.forceMute,
|
||||||
user_uuid: dto.userUuid,
|
user_uuid: dto.userUuid,
|
||||||
settings_id: dto.muteEmailsSettingUuid,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.httpClient.request({
|
const response = await this.httpClient.request({
|
||||||
@@ -58,13 +60,9 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
this.logger.error(`[${dto.userUuid}] Failed to send a request to extensions server: ${(error as Error).message}`)
|
this.logger.error(`[${dto.userUuid}] Failed to send a request to extensions server: ${(error as Error).message}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sent && !dto.forceMute && dto.muteEmailsSettingUuid !== undefined) {
|
if (!sent && !dto.forceMute) {
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
this.createCloudBackupFailedEventBasedOnProvider(
|
this.createCloudBackupFailedEventBasedOnProvider(dto.cloudProvider, dto.authParams.identifier as string),
|
||||||
dto.cloudProvider,
|
|
||||||
dto.authParams.identifier as string,
|
|
||||||
dto.muteEmailsSettingUuid,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +75,6 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
auth_params: dto.authParams,
|
auth_params: dto.authParams,
|
||||||
silent: dto.forceMute,
|
silent: dto.forceMute,
|
||||||
user_uuid: dto.userUuid,
|
user_uuid: dto.userUuid,
|
||||||
settings_id: dto.muteEmailsSettingUuid,
|
|
||||||
}
|
}
|
||||||
if (dto.items !== undefined) {
|
if (dto.items !== undefined) {
|
||||||
payload.items = dto.items
|
payload.items = dto.items
|
||||||
@@ -100,14 +97,9 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
this.logger.error(`[${dto.userUuid}] Failed to send a request to extensions server: ${(error as Error).message}`)
|
this.logger.error(`[${dto.userUuid}] Failed to send a request to extensions server: ${(error as Error).message}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sent && !dto.forceMute && dto.muteEmailsSettingUuid !== undefined) {
|
if (!sent && !dto.forceMute) {
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
await this.getBackupFailedEvent(
|
await this.getBackupFailedEvent(dto.extensionId, dto.userUuid, dto.authParams.identifier as string),
|
||||||
dto.muteEmailsSettingUuid,
|
|
||||||
dto.extensionId,
|
|
||||||
dto.userUuid,
|
|
||||||
dto.authParams.identifier as string,
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,20 +107,36 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
private createCloudBackupFailedEventBasedOnProvider(
|
private createCloudBackupFailedEventBasedOnProvider(
|
||||||
cloudProvider: 'DROPBOX' | 'GOOGLE_DRIVE' | 'ONE_DRIVE',
|
cloudProvider: 'DROPBOX' | 'GOOGLE_DRIVE' | 'ONE_DRIVE',
|
||||||
email: string,
|
email: string,
|
||||||
muteCloudEmailsSettingUuid: string,
|
|
||||||
): DomainEventInterface {
|
): DomainEventInterface {
|
||||||
switch (cloudProvider) {
|
switch (cloudProvider) {
|
||||||
case 'DROPBOX':
|
case 'DROPBOX':
|
||||||
return this.domainEventFactory.createDropboxBackupFailedEvent(muteCloudEmailsSettingUuid, email)
|
return this.domainEventFactory.createEmailRequestedEvent({
|
||||||
|
userEmail: email,
|
||||||
|
level: EmailLevel.LEVELS.FailedCloudBackup,
|
||||||
|
body: dropboxBody(),
|
||||||
|
messageIdentifier: 'FAILED_DROPBOX_BACKUP',
|
||||||
|
subject: dropboxSubject(),
|
||||||
|
})
|
||||||
case 'GOOGLE_DRIVE':
|
case 'GOOGLE_DRIVE':
|
||||||
return this.domainEventFactory.createGoogleDriveBackupFailedEvent(muteCloudEmailsSettingUuid, email)
|
return this.domainEventFactory.createEmailRequestedEvent({
|
||||||
|
userEmail: email,
|
||||||
|
level: EmailLevel.LEVELS.FailedCloudBackup,
|
||||||
|
body: googleDriveBody(),
|
||||||
|
messageIdentifier: 'FAILED_GOOGLE_DRIVE_BACKUP',
|
||||||
|
subject: googleDriveSubject(),
|
||||||
|
})
|
||||||
case 'ONE_DRIVE':
|
case 'ONE_DRIVE':
|
||||||
return this.domainEventFactory.createOneDriveBackupFailedEvent(muteCloudEmailsSettingUuid, email)
|
return this.domainEventFactory.createEmailRequestedEvent({
|
||||||
|
userEmail: email,
|
||||||
|
level: EmailLevel.LEVELS.FailedCloudBackup,
|
||||||
|
body: oneDriveBody(),
|
||||||
|
messageIdentifier: 'FAILED_ONE_DRIVE_BACKUP',
|
||||||
|
subject: oneDriveSubject(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getBackupFailedEvent(
|
private async getBackupFailedEvent(
|
||||||
muteCloudEmailsSettingUuid: string,
|
|
||||||
extensionId: string,
|
extensionId: string,
|
||||||
userUuid: string,
|
userUuid: string,
|
||||||
email: string,
|
email: string,
|
||||||
@@ -141,11 +149,11 @@ export class ExtensionsHttpService implements ExtensionsHttpServiceInterface {
|
|||||||
const content = this.contentDecoder.decode(extension.content)
|
const content = this.contentDecoder.decode(extension.content)
|
||||||
switch (this.getExtensionName(content)) {
|
switch (this.getExtensionName(content)) {
|
||||||
case ExtensionName.Dropbox:
|
case ExtensionName.Dropbox:
|
||||||
return this.createCloudBackupFailedEventBasedOnProvider('DROPBOX', muteCloudEmailsSettingUuid, email)
|
return this.createCloudBackupFailedEventBasedOnProvider('DROPBOX', email)
|
||||||
case ExtensionName.GoogleDrive:
|
case ExtensionName.GoogleDrive:
|
||||||
return this.createCloudBackupFailedEventBasedOnProvider('GOOGLE_DRIVE', muteCloudEmailsSettingUuid, email)
|
return this.createCloudBackupFailedEventBasedOnProvider('GOOGLE_DRIVE', email)
|
||||||
case ExtensionName.OneDrive:
|
case ExtensionName.OneDrive:
|
||||||
return this.createCloudBackupFailedEventBasedOnProvider('ONE_DRIVE', muteCloudEmailsSettingUuid, email)
|
return this.createCloudBackupFailedEventBasedOnProvider('ONE_DRIVE', email)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { KeyParamsData } from '@standardnotes/responses'
|
import { KeyParamsData } from '@standardnotes/responses'
|
||||||
|
|
||||||
import { Item } from '../Item/Item'
|
import { Item } from '../Item/Item'
|
||||||
|
|
||||||
export type SendItemsToExtensionsServerDTO = {
|
export type SendItemsToExtensionsServerDTO = {
|
||||||
@@ -8,6 +9,5 @@ export type SendItemsToExtensionsServerDTO = {
|
|||||||
authParams: KeyParamsData
|
authParams: KeyParamsData
|
||||||
forceMute: boolean
|
forceMute: boolean
|
||||||
userUuid: string
|
userUuid: string
|
||||||
muteEmailsSettingUuid?: string
|
|
||||||
items?: Array<Item>
|
items?: Array<Item>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import {
|
import {
|
||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
EmailArchiveExtensionSyncedEvent,
|
EmailArchiveExtensionSyncedEvent,
|
||||||
EmailBackupAttachmentCreatedEvent,
|
EmailRequestedEvent,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { AuthHttpServiceInterface } from '../Auth/AuthHttpServiceInterface'
|
import { AuthHttpServiceInterface } from '../Auth/AuthHttpServiceInterface'
|
||||||
@@ -35,6 +35,7 @@ describe('EmailArchiveExtensionSyncedEventHandler', () => {
|
|||||||
domainEventFactory,
|
domainEventFactory,
|
||||||
emailAttachmentMaxByteSize,
|
emailAttachmentMaxByteSize,
|
||||||
itemTransferCalculator,
|
itemTransferCalculator,
|
||||||
|
's3-backup-bucket-name',
|
||||||
logger,
|
logger,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,9 +63,7 @@ describe('EmailArchiveExtensionSyncedEventHandler', () => {
|
|||||||
domainEventPublisher.publish = jest.fn()
|
domainEventPublisher.publish = jest.fn()
|
||||||
|
|
||||||
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
||||||
domainEventFactory.createEmailBackupAttachmentCreatedEvent = jest
|
domainEventFactory.createEmailRequestedEvent = jest.fn().mockReturnValue({} as jest.Mocked<EmailRequestedEvent>)
|
||||||
.fn()
|
|
||||||
.mockReturnValue({} as jest.Mocked<EmailBackupAttachmentCreatedEvent>)
|
|
||||||
|
|
||||||
itemTransferCalculator = {} as jest.Mocked<ItemTransferCalculatorInterface>
|
itemTransferCalculator = {} as jest.Mocked<ItemTransferCalculatorInterface>
|
||||||
itemTransferCalculator.computeItemUuidBundlesToFetch = jest.fn().mockReturnValue([['1-2-3']])
|
itemTransferCalculator.computeItemUuidBundlesToFetch = jest.fn().mockReturnValue([['1-2-3']])
|
||||||
@@ -78,12 +77,7 @@ describe('EmailArchiveExtensionSyncedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).toHaveBeenCalledWith({
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
backupFileIndex: 1,
|
|
||||||
backupFileName: 'backup-file-name',
|
|
||||||
backupFilesTotal: 1,
|
|
||||||
email: 'test@test.com',
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should inform that multipart backup attachment for email was created', async () => {
|
it('should inform that multipart backup attachment for email was created', async () => {
|
||||||
@@ -96,18 +90,7 @@ describe('EmailArchiveExtensionSyncedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(2)
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(2)
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).toHaveBeenNthCalledWith(1, {
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalledTimes(2)
|
||||||
backupFileIndex: 1,
|
|
||||||
backupFileName: 'backup-file-name-1',
|
|
||||||
backupFilesTotal: 2,
|
|
||||||
email: 'test@test.com',
|
|
||||||
})
|
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).toHaveBeenNthCalledWith(2, {
|
|
||||||
backupFileIndex: 2,
|
|
||||||
backupFileName: 'backup-file-name-2',
|
|
||||||
backupFilesTotal: 2,
|
|
||||||
email: 'test@test.com',
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not inform that backup attachment for email was created if user key params cannot be obtained', async () => {
|
it('should not inform that backup attachment for email was created if user key params cannot be obtained', async () => {
|
||||||
@@ -118,7 +101,7 @@ describe('EmailArchiveExtensionSyncedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).not.toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not inform that backup attachment for email was created if backup file name is empty', async () => {
|
it('should not inform that backup attachment for email was created if backup file name is empty', async () => {
|
||||||
@@ -127,6 +110,6 @@ describe('EmailArchiveExtensionSyncedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).not.toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
EmailArchiveExtensionSyncedEvent,
|
EmailArchiveExtensionSyncedEvent,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
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'
|
||||||
@@ -13,6 +14,7 @@ import { ItemBackupServiceInterface } from '../Item/ItemBackupServiceInterface'
|
|||||||
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
||||||
import { ItemQuery } from '../Item/ItemQuery'
|
import { ItemQuery } from '../Item/ItemQuery'
|
||||||
import { ItemTransferCalculatorInterface } from '../Item/ItemTransferCalculatorInterface'
|
import { ItemTransferCalculatorInterface } from '../Item/ItemTransferCalculatorInterface'
|
||||||
|
import { getBody, getSubject } from '../Email/EmailBackupAttachmentCreated'
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class EmailArchiveExtensionSyncedEventHandler implements DomainEventHandlerInterface {
|
export class EmailArchiveExtensionSyncedEventHandler implements DomainEventHandlerInterface {
|
||||||
@@ -24,6 +26,7 @@ export class EmailArchiveExtensionSyncedEventHandler implements DomainEventHandl
|
|||||||
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
||||||
@inject(TYPES.EMAIL_ATTACHMENT_MAX_BYTE_SIZE) private emailAttachmentMaxByteSize: number,
|
@inject(TYPES.EMAIL_ATTACHMENT_MAX_BYTE_SIZE) private emailAttachmentMaxByteSize: number,
|
||||||
@inject(TYPES.ItemTransferCalculator) private itemTransferCalculator: ItemTransferCalculatorInterface,
|
@inject(TYPES.ItemTransferCalculator) private itemTransferCalculator: ItemTransferCalculatorInterface,
|
||||||
|
@inject(TYPES.S3_BACKUP_BUCKET_NAME) private s3BackupBucketName: string,
|
||||||
@inject(TYPES.Logger) private logger: Logger,
|
@inject(TYPES.Logger) private logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@@ -64,14 +67,24 @@ export class EmailArchiveExtensionSyncedEventHandler implements DomainEventHandl
|
|||||||
this.logger.debug(`Data backed up into: ${backupFileName}`)
|
this.logger.debug(`Data backed up into: ${backupFileName}`)
|
||||||
|
|
||||||
if (backupFileName.length !== 0) {
|
if (backupFileName.length !== 0) {
|
||||||
this.logger.debug('Publishing EMAIL_BACKUP_ATTACHMENT_CREATED event')
|
const dateOnly = new Date().toISOString().substring(0, 10)
|
||||||
|
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
this.domainEventFactory.createEmailBackupAttachmentCreatedEvent({
|
this.domainEventFactory.createEmailRequestedEvent({
|
||||||
backupFileName,
|
body: getBody(authParams.identifier as string),
|
||||||
backupFileIndex: bundleIndex++,
|
level: EmailLevel.LEVELS.System,
|
||||||
backupFilesTotal: itemUuidBundles.length,
|
messageIdentifier: 'DATA_BACKUP',
|
||||||
email: authParams.identifier as string,
|
subject: getSubject(bundleIndex++, itemUuidBundles.length, dateOnly),
|
||||||
|
userEmail: authParams.identifier as string,
|
||||||
|
sender: 'backups@standardnotes.org',
|
||||||
|
attachments: [
|
||||||
|
{
|
||||||
|
fileName: backupFileName,
|
||||||
|
filePath: this.s3BackupBucketName,
|
||||||
|
attachmentFileName: `SN-Data-${dateOnly}.txt`,
|
||||||
|
attachmentContentType: 'application/json',
|
||||||
|
},
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'reflect-metadata'
|
|||||||
import {
|
import {
|
||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
EmailBackupRequestedEvent,
|
EmailBackupRequestedEvent,
|
||||||
EmailBackupAttachmentCreatedEvent,
|
EmailRequestedEvent,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { AuthHttpServiceInterface } from '../Auth/AuthHttpServiceInterface'
|
import { AuthHttpServiceInterface } from '../Auth/AuthHttpServiceInterface'
|
||||||
@@ -35,6 +35,7 @@ describe('EmailBackupRequestedEventHandler', () => {
|
|||||||
domainEventFactory,
|
domainEventFactory,
|
||||||
emailAttachmentMaxByteSize,
|
emailAttachmentMaxByteSize,
|
||||||
itemTransferCalculator,
|
itemTransferCalculator,
|
||||||
|
's3-backup-bucket-name',
|
||||||
logger,
|
logger,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,9 +63,7 @@ describe('EmailBackupRequestedEventHandler', () => {
|
|||||||
domainEventPublisher.publish = jest.fn()
|
domainEventPublisher.publish = jest.fn()
|
||||||
|
|
||||||
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
domainEventFactory = {} as jest.Mocked<DomainEventFactoryInterface>
|
||||||
domainEventFactory.createEmailBackupAttachmentCreatedEvent = jest
|
domainEventFactory.createEmailRequestedEvent = jest.fn().mockReturnValue({} as jest.Mocked<EmailRequestedEvent>)
|
||||||
.fn()
|
|
||||||
.mockReturnValue({} as jest.Mocked<EmailBackupAttachmentCreatedEvent>)
|
|
||||||
|
|
||||||
itemTransferCalculator = {} as jest.Mocked<ItemTransferCalculatorInterface>
|
itemTransferCalculator = {} as jest.Mocked<ItemTransferCalculatorInterface>
|
||||||
itemTransferCalculator.computeItemUuidBundlesToFetch = jest.fn().mockReturnValue([['1-2-3']])
|
itemTransferCalculator.computeItemUuidBundlesToFetch = jest.fn().mockReturnValue([['1-2-3']])
|
||||||
@@ -79,12 +78,7 @@ describe('EmailBackupRequestedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(1)
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).toHaveBeenCalledWith({
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalled()
|
||||||
backupFileIndex: 1,
|
|
||||||
backupFileName: 'backup-file-name',
|
|
||||||
backupFilesTotal: 1,
|
|
||||||
email: 'test@test.com',
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should inform that multipart backup attachment for email was created', async () => {
|
it('should inform that multipart backup attachment for email was created', async () => {
|
||||||
@@ -97,18 +91,7 @@ describe('EmailBackupRequestedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(2)
|
expect(domainEventPublisher.publish).toHaveBeenCalledTimes(2)
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).toHaveBeenNthCalledWith(1, {
|
expect(domainEventFactory.createEmailRequestedEvent).toHaveBeenCalledTimes(2)
|
||||||
backupFileIndex: 1,
|
|
||||||
backupFileName: 'backup-file-name-1',
|
|
||||||
backupFilesTotal: 2,
|
|
||||||
email: 'test@test.com',
|
|
||||||
})
|
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).toHaveBeenNthCalledWith(2, {
|
|
||||||
backupFileIndex: 2,
|
|
||||||
backupFileName: 'backup-file-name-2',
|
|
||||||
backupFilesTotal: 2,
|
|
||||||
email: 'test@test.com',
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not inform that backup attachment for email was created if user key params cannot be obtained', async () => {
|
it('should not inform that backup attachment for email was created if user key params cannot be obtained', async () => {
|
||||||
@@ -119,7 +102,7 @@ describe('EmailBackupRequestedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).not.toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not inform that backup attachment for email was created if backup file name is empty', async () => {
|
it('should not inform that backup attachment for email was created if backup file name is empty', async () => {
|
||||||
@@ -128,6 +111,6 @@ describe('EmailBackupRequestedEventHandler', () => {
|
|||||||
await createHandler().handle(event)
|
await createHandler().handle(event)
|
||||||
|
|
||||||
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
expect(domainEventPublisher.publish).not.toHaveBeenCalled()
|
||||||
expect(domainEventFactory.createEmailBackupAttachmentCreatedEvent).not.toHaveBeenCalled()
|
expect(domainEventFactory.createEmailRequestedEvent).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
EmailBackupRequestedEvent,
|
EmailBackupRequestedEvent,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
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'
|
||||||
@@ -13,6 +14,7 @@ import { ItemBackupServiceInterface } from '../Item/ItemBackupServiceInterface'
|
|||||||
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
import { ItemRepositoryInterface } from '../Item/ItemRepositoryInterface'
|
||||||
import { ItemTransferCalculatorInterface } from '../Item/ItemTransferCalculatorInterface'
|
import { ItemTransferCalculatorInterface } from '../Item/ItemTransferCalculatorInterface'
|
||||||
import { ItemQuery } from '../Item/ItemQuery'
|
import { ItemQuery } from '../Item/ItemQuery'
|
||||||
|
import { getBody, getSubject } from '../Email/EmailBackupAttachmentCreated'
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class EmailBackupRequestedEventHandler implements DomainEventHandlerInterface {
|
export class EmailBackupRequestedEventHandler implements DomainEventHandlerInterface {
|
||||||
@@ -24,6 +26,7 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
|||||||
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
@inject(TYPES.DomainEventFactory) private domainEventFactory: DomainEventFactoryInterface,
|
||||||
@inject(TYPES.EMAIL_ATTACHMENT_MAX_BYTE_SIZE) private emailAttachmentMaxByteSize: number,
|
@inject(TYPES.EMAIL_ATTACHMENT_MAX_BYTE_SIZE) private emailAttachmentMaxByteSize: number,
|
||||||
@inject(TYPES.ItemTransferCalculator) private itemTransferCalculator: ItemTransferCalculatorInterface,
|
@inject(TYPES.ItemTransferCalculator) private itemTransferCalculator: ItemTransferCalculatorInterface,
|
||||||
|
@inject(TYPES.S3_BACKUP_BUCKET_NAME) private s3BackupBucketName: string,
|
||||||
@inject(TYPES.Logger) private logger: Logger,
|
@inject(TYPES.Logger) private logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@@ -68,15 +71,24 @@ export class EmailBackupRequestedEventHandler implements DomainEventHandlerInter
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const dateOnly = new Date().toISOString().substring(0, 10)
|
||||||
this.logger.debug('Publishing EMAIL_BACKUP_ATTACHMENT_CREATED event')
|
|
||||||
|
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
this.domainEventFactory.createEmailBackupAttachmentCreatedEvent({
|
this.domainEventFactory.createEmailRequestedEvent({
|
||||||
backupFileName,
|
body: getBody(authParams.identifier as string),
|
||||||
backupFileIndex: bundleIndex++,
|
level: EmailLevel.LEVELS.System,
|
||||||
backupFilesTotal: itemUuidBundles.length,
|
messageIdentifier: 'DATA_BACKUP',
|
||||||
email: authParams.identifier as string,
|
subject: getSubject(bundleIndex++, itemUuidBundles.length, dateOnly),
|
||||||
|
userEmail: authParams.identifier as string,
|
||||||
|
sender: 'backups@standardnotes.org',
|
||||||
|
attachments: [
|
||||||
|
{
|
||||||
|
fileName: backupFileName,
|
||||||
|
filePath: this.s3BackupBucketName,
|
||||||
|
attachmentFileName: `SN-Data-${dateOnly}.txt`,
|
||||||
|
attachmentContentType: 'application/json',
|
||||||
|
},
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,26 @@
|
|||||||
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.50](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.49...@standardnotes/websockets-server@1.4.50) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.4.49](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.48...@standardnotes/websockets-server@1.4.49) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.4.48](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.47...@standardnotes/websockets-server@1.4.48) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.4.47](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.46...@standardnotes/websockets-server@1.4.47) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
|
## [1.4.46](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.45...@standardnotes/websockets-server@1.4.46) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|
||||||
## [1.4.45](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.44...@standardnotes/websockets-server@1.4.45) (2022-12-09)
|
## [1.4.45](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.4.44...@standardnotes/websockets-server@1.4.45) (2022-12-09)
|
||||||
|
|
||||||
**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.45",
|
"version": "1.4.50",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,28 @@
|
|||||||
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.18.1](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.18.0...@standardnotes/workspace-server@1.18.1) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|
||||||
|
# [1.18.0](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.47...@standardnotes/workspace-server@1.18.0) (2022-12-09)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **workspace:** replace workspace invite created event with email requested ([61c1cff](https://github.com/standardnotes/server/commit/61c1cfff4bcee09e1f933cb3e085412b6f07cc42))
|
||||||
|
|
||||||
|
## [1.17.47](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.46...@standardnotes/workspace-server@1.17.47) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|
||||||
|
## [1.17.46](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.45...@standardnotes/workspace-server@1.17.46) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|
||||||
|
## [1.17.45](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.44...@standardnotes/workspace-server@1.17.45) (2022-12-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|
||||||
## [1.17.44](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.43...@standardnotes/workspace-server@1.17.44) (2022-12-09)
|
## [1.17.44](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.17.43...@standardnotes/workspace-server@1.17.44) (2022-12-09)
|
||||||
|
|
||||||
**Note:** Version bump only for package @standardnotes/workspace-server
|
**Note:** Version bump only for package @standardnotes/workspace-server
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ module.exports = {
|
|||||||
transform: {
|
transform: {
|
||||||
...tsjPreset.transform,
|
...tsjPreset.transform,
|
||||||
},
|
},
|
||||||
coveragePathIgnorePatterns: ['/Bootstrap/', '/InversifyExpressUtils/'],
|
coveragePathIgnorePatterns: ['/Bootstrap/', '/InversifyExpressUtils/', '/Domain/Email/', '/Domain/Event'],
|
||||||
setupFilesAfterEnv: ['./test-setup.ts'],
|
setupFilesAfterEnv: ['./test-setup.ts'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/workspace-server",
|
"name": "@standardnotes/workspace-server",
|
||||||
"version": "1.17.44",
|
"version": "1.18.1",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <19.0.0"
|
"node": ">=18.0.0 <19.0.0"
|
||||||
},
|
},
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
"@sentry/node": "^7.19.0",
|
"@sentry/node": "^7.19.0",
|
||||||
"@standardnotes/api": "^1.19.0",
|
"@standardnotes/api": "^1.19.0",
|
||||||
"@standardnotes/common": "workspace:*",
|
"@standardnotes/common": "workspace:*",
|
||||||
|
"@standardnotes/domain-core": "workspace:^",
|
||||||
"@standardnotes/domain-events": "workspace:^",
|
"@standardnotes/domain-events": "workspace:^",
|
||||||
"@standardnotes/domain-events-infra": "workspace:^",
|
"@standardnotes/domain-events-infra": "workspace:^",
|
||||||
"@standardnotes/models": "^1.26.0",
|
"@standardnotes/models": "^1.26.0",
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { html } from './workspace-invite-created.html'
|
||||||
|
|
||||||
|
export function getSubject(): string {
|
||||||
|
return 'You have been invited to a Standard Notes workspace'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBody(inviteUuid: string): string {
|
||||||
|
return html(inviteUuid)
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export const html = (inviteUuid: string) => `<p>Hello,</p>
|
||||||
|
<p>We are happy to inform that you have been invited to a shared workspace in Standard Notes.</p>
|
||||||
|
<p>
|
||||||
|
Please
|
||||||
|
<a href='https://app.standardnotes.com/?accept_workspace_invite=${inviteUuid}'>accept the invitation</a>
|
||||||
|
to see the shared content.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Thanks,
|
||||||
|
<br>SN</br>
|
||||||
|
</p>`
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
import 'reflect-metadata'
|
|
||||||
|
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
|
||||||
|
|
||||||
import { DomainEventFactory } from './DomainEventFactory'
|
|
||||||
|
|
||||||
describe('DomainEventFactory', () => {
|
|
||||||
let timer: TimerInterface
|
|
||||||
|
|
||||||
const createFactory = () => new DomainEventFactory(timer)
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
timer = {} as jest.Mocked<TimerInterface>
|
|
||||||
timer.getTimestampInMicroseconds = jest.fn().mockReturnValue(1)
|
|
||||||
timer.getUTCDate = jest.fn().mockReturnValue(new Date(1))
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should create a WEB_SOCKET_MESSAGE_REQUESTED event', () => {
|
|
||||||
expect(
|
|
||||||
createFactory().createWebSocketMessageRequestedEvent({
|
|
||||||
userUuid: '1-2-3',
|
|
||||||
message: 'foobar',
|
|
||||||
}),
|
|
||||||
).toEqual({
|
|
||||||
createdAt: expect.any(Date),
|
|
||||||
meta: {
|
|
||||||
correlation: {
|
|
||||||
userIdentifier: '1-2-3',
|
|
||||||
userIdentifierType: 'uuid',
|
|
||||||
},
|
|
||||||
origin: 'workspace',
|
|
||||||
},
|
|
||||||
payload: {
|
|
||||||
userUuid: '1-2-3',
|
|
||||||
message: 'foobar',
|
|
||||||
},
|
|
||||||
type: 'WEB_SOCKET_MESSAGE_REQUESTED',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should create a WORKSPACE_INVITE_ACCEPTED event', () => {
|
|
||||||
expect(
|
|
||||||
createFactory().createWorkspaceInviteAcceptedEvent({
|
|
||||||
inviterUuid: '1-2-3',
|
|
||||||
inviteeUuid: '2-3-4',
|
|
||||||
workspaceUuid: 'w-1-2-3',
|
|
||||||
}),
|
|
||||||
).toEqual({
|
|
||||||
createdAt: expect.any(Date),
|
|
||||||
meta: {
|
|
||||||
correlation: {
|
|
||||||
userIdentifier: '2-3-4',
|
|
||||||
userIdentifierType: 'uuid',
|
|
||||||
},
|
|
||||||
origin: 'workspace',
|
|
||||||
},
|
|
||||||
payload: {
|
|
||||||
inviterUuid: '1-2-3',
|
|
||||||
inviteeUuid: '2-3-4',
|
|
||||||
workspaceUuid: 'w-1-2-3',
|
|
||||||
},
|
|
||||||
type: 'WORKSPACE_INVITE_ACCEPTED',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should create a WORKSPACE_INVITE_CREATED event', () => {
|
|
||||||
expect(
|
|
||||||
createFactory().createWorkspaceInviteCreatedEvent({
|
|
||||||
inviterUuid: '1-2-3',
|
|
||||||
inviteeEmail: 'test@test.te',
|
|
||||||
inviteUuid: 'i-1-2-3',
|
|
||||||
workspaceUuid: 'w-1-2-3',
|
|
||||||
}),
|
|
||||||
).toEqual({
|
|
||||||
createdAt: expect.any(Date),
|
|
||||||
meta: {
|
|
||||||
correlation: {
|
|
||||||
userIdentifier: '1-2-3',
|
|
||||||
userIdentifierType: 'uuid',
|
|
||||||
},
|
|
||||||
origin: 'workspace',
|
|
||||||
},
|
|
||||||
payload: {
|
|
||||||
inviterUuid: '1-2-3',
|
|
||||||
inviteeEmail: 'test@test.te',
|
|
||||||
inviteUuid: 'i-1-2-3',
|
|
||||||
workspaceUuid: 'w-1-2-3',
|
|
||||||
},
|
|
||||||
type: 'WORKSPACE_INVITE_CREATED',
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
DomainEventService,
|
DomainEventService,
|
||||||
|
EmailRequestedEvent,
|
||||||
WebSocketMessageRequestedEvent,
|
WebSocketMessageRequestedEvent,
|
||||||
WorkspaceInviteAcceptedEvent,
|
WorkspaceInviteAcceptedEvent,
|
||||||
WorkspaceInviteCreatedEvent,
|
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
import { TimerInterface } from '@standardnotes/time'
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
@@ -49,21 +49,22 @@ export class DomainEventFactory implements DomainEventFactoryInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createWorkspaceInviteCreatedEvent(dto: {
|
createEmailRequestedEvent(dto: {
|
||||||
inviterUuid: string
|
userEmail: string
|
||||||
inviteeEmail: string
|
messageIdentifier: string
|
||||||
inviteUuid: string
|
level: string
|
||||||
workspaceUuid: string
|
body: string
|
||||||
}): WorkspaceInviteCreatedEvent {
|
subject: string
|
||||||
|
}): EmailRequestedEvent {
|
||||||
return {
|
return {
|
||||||
type: 'WORKSPACE_INVITE_CREATED',
|
type: 'EMAIL_REQUESTED',
|
||||||
createdAt: this.timer.getUTCDate(),
|
createdAt: this.timer.getUTCDate(),
|
||||||
meta: {
|
meta: {
|
||||||
correlation: {
|
correlation: {
|
||||||
userIdentifier: dto.inviterUuid,
|
userIdentifier: dto.userEmail,
|
||||||
userIdentifierType: 'uuid',
|
userIdentifierType: 'email',
|
||||||
},
|
},
|
||||||
origin: DomainEventService.Workspace,
|
origin: DomainEventService.Auth,
|
||||||
},
|
},
|
||||||
payload: dto,
|
payload: dto,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
import { JSONString } from '@standardnotes/common'
|
import { JSONString } from '@standardnotes/common'
|
||||||
import {
|
import {
|
||||||
|
EmailRequestedEvent,
|
||||||
WebSocketMessageRequestedEvent,
|
WebSocketMessageRequestedEvent,
|
||||||
WorkspaceInviteAcceptedEvent,
|
WorkspaceInviteAcceptedEvent,
|
||||||
WorkspaceInviteCreatedEvent,
|
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
|
|
||||||
export interface DomainEventFactoryInterface {
|
export interface DomainEventFactoryInterface {
|
||||||
createWorkspaceInviteCreatedEvent(dto: {
|
createEmailRequestedEvent(dto: {
|
||||||
inviterUuid: string
|
userEmail: string
|
||||||
inviteeEmail: string
|
messageIdentifier: string
|
||||||
inviteUuid: string
|
level: string
|
||||||
workspaceUuid: string
|
body: string
|
||||||
}): WorkspaceInviteCreatedEvent
|
subject: string
|
||||||
|
}): EmailRequestedEvent
|
||||||
createWorkspaceInviteAcceptedEvent(dto: {
|
createWorkspaceInviteAcceptedEvent(dto: {
|
||||||
inviterUuid: string
|
inviterUuid: string
|
||||||
inviteeUuid: string
|
inviteeUuid: string
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
import { TimerInterface } from '@standardnotes/time'
|
||||||
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
import { inject, injectable } from 'inversify'
|
import { inject, injectable } from 'inversify'
|
||||||
|
|
||||||
import TYPES from '../../../Bootstrap/Types'
|
import TYPES from '../../../Bootstrap/Types'
|
||||||
|
import { getBody, getSubject } from '../../Email/WorkspaceInviteCreated'
|
||||||
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../../Event/DomainEventFactoryInterface'
|
||||||
import { WorkspaceInvite } from '../../Invite/WorkspaceInvite'
|
import { WorkspaceInvite } from '../../Invite/WorkspaceInvite'
|
||||||
import { WorkspaceInviteRepositoryInterface } from '../../Invite/WorkspaceInviteRepositoryInterface'
|
import { WorkspaceInviteRepositoryInterface } from '../../Invite/WorkspaceInviteRepositoryInterface'
|
||||||
@@ -36,11 +38,12 @@ export class InviteToWorkspace implements UseCaseInterface {
|
|||||||
invite = await this.workspaceInviteRepository.save(invite)
|
invite = await this.workspaceInviteRepository.save(invite)
|
||||||
|
|
||||||
await this.domainEventPublisher.publish(
|
await this.domainEventPublisher.publish(
|
||||||
this.domainEventFactory.createWorkspaceInviteCreatedEvent({
|
this.domainEventFactory.createEmailRequestedEvent({
|
||||||
inviterUuid: dto.inviterUuid,
|
body: getBody(invite.uuid),
|
||||||
inviteeEmail: dto.inviteeEmail,
|
subject: getSubject(),
|
||||||
workspaceUuid: dto.workspaceUuid,
|
level: EmailLevel.LEVELS.System,
|
||||||
inviteUuid: invite.uuid,
|
messageIdentifier: 'WORKSPACE_INVITE_CREATED',
|
||||||
|
userEmail: dto.inviteeEmail,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2535,6 +2535,7 @@ __metadata:
|
|||||||
"@sentry/node": "npm:^7.19.0"
|
"@sentry/node": "npm:^7.19.0"
|
||||||
"@standardnotes/api": "npm:^1.19.0"
|
"@standardnotes/api": "npm:^1.19.0"
|
||||||
"@standardnotes/common": "workspace:*"
|
"@standardnotes/common": "workspace:*"
|
||||||
|
"@standardnotes/domain-core": "workspace:^"
|
||||||
"@standardnotes/domain-events": "workspace:^"
|
"@standardnotes/domain-events": "workspace:^"
|
||||||
"@standardnotes/domain-events-infra": "workspace:^"
|
"@standardnotes/domain-events-infra": "workspace:^"
|
||||||
"@standardnotes/models": "npm:^1.26.0"
|
"@standardnotes/models": "npm:^1.26.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user