Compare commits

..

19 Commits

Author SHA1 Message Date
standardci
2707e87554 chore(release): publish new version
- @standardnotes/analytics@2.23.5
 - @standardnotes/api-gateway@1.62.2
 - @standardnotes/auth-server@1.115.2
 - @standardnotes/event-store@1.9.4
 - @standardnotes/files-server@1.16.2
 - @standardnotes/home-server@1.7.2
 - @standardnotes/revisions-server@1.20.2
 - @standardnotes/scheduler-server@1.19.4
 - @standardnotes/syncing-server@1.41.2
 - @standardnotes/time@1.14.6
2023-06-01 05:29:48 +00:00
Karol Sójko
4b40c59e7e fix(time): bump version 2023-06-01 07:13:49 +02:00
standardci
f2e8579f95 chore(release): publish new version
- @standardnotes/analytics@2.23.4
 - @standardnotes/api-gateway@1.62.1
 - @standardnotes/auth-server@1.115.1
 - @standardnotes/domain-events-infra@1.12.3
 - @standardnotes/domain-events@2.111.3
 - @standardnotes/event-store@1.9.3
 - @standardnotes/files-server@1.16.1
 - @standardnotes/home-server@1.7.1
 - @standardnotes/revisions-server@1.20.1
 - @standardnotes/scheduler-server@1.19.3
 - @standardnotes/security@1.7.10
 - @standardnotes/syncing-server@1.41.1
 - @standardnotes/websockets-server@1.8.4
2023-05-31 13:30:36 +00:00
Karol Sójko
57118c85e3 chore(security): bump version 2023-05-31 15:16:37 +02:00
standardci
8ddc7b0a58 chore(release): publish new version
- @standardnotes/analytics@2.23.3
 - @standardnotes/api-gateway@1.62.0
 - @standardnotes/auth-server@1.115.0
 - @standardnotes/domain-core@1.17.0
 - @standardnotes/files-server@1.16.0
 - @standardnotes/home-server@1.7.0
 - @standardnotes/revisions-server@1.20.0
 - @standardnotes/scheduler-server@1.19.2
 - @standardnotes/settings@1.21.7
 - @standardnotes/syncing-server@1.41.0
 - @standardnotes/websockets-server@1.8.3
2023-05-31 13:15:12 +00:00
Karol Sójko
bc63d0aeea feat(home-server): add custom home server logs (#619)
* feat(home-server): add custom home server logs

* fix(home-server): asyn state of logs function
2023-05-31 15:01:55 +02:00
standardci
9def26e809 chore(release): publish new version
- @standardnotes/analytics@2.23.2
 - @standardnotes/auth-server@1.114.6
 - @standardnotes/common@1.48.2
 - @standardnotes/home-server@1.6.7
 - @standardnotes/revisions-server@1.19.6
 - @standardnotes/syncing-server@1.40.6
 - @standardnotes/websockets-server@1.8.2
2023-05-31 11:30:02 +00:00
Karol Sójko
74ac709bb5 fix(common): bump version 2023-05-31 13:14:31 +02:00
standardci
1f749fad49 chore(release): publish new version
- @standardnotes/api-gateway@1.61.5
 - @standardnotes/auth-server@1.114.5
 - @standardnotes/files-server@1.15.4
 - @standardnotes/home-server@1.6.6
 - @standardnotes/revisions-server@1.19.5
 - @standardnotes/syncing-server@1.40.5
2023-05-31 11:12:46 +00:00
Karol Sójko
13c85d4331 Revert "Revert "feat: make home server components publishable (#617)""
This reverts commit 1a8daef79d.
2023-05-31 12:59:20 +02:00
standardci
77d2099cdb chore(release): publish new version
- @standardnotes/api-gateway@1.61.4
 - @standardnotes/auth-server@1.114.4
 - @standardnotes/event-store@1.9.2
 - @standardnotes/home-server@1.6.5
 - @standardnotes/revisions-server@1.19.4
 - @standardnotes/syncing-server@1.40.4
2023-05-31 08:55:39 +00:00
Karol Sójko
56a312f217 fix(home-server): make the package publishable 2023-05-31 10:41:49 +02:00
standardci
aa2b3dac49 chore(release): publish new version
- @standardnotes/api-gateway@1.61.3
 - @standardnotes/auth-server@1.114.3
 - @standardnotes/files-server@1.15.3
 - @standardnotes/home-server@1.6.4
 - @standardnotes/revisions-server@1.19.3
 - @standardnotes/syncing-server@1.40.3
2023-05-30 16:05:01 +00:00
Karol Sójko
1a8daef79d Revert "feat: make home server components publishable (#617)"
This reverts commit 55fd873b37.
2023-05-30 17:47:23 +02:00
standardci
a83d133f93 chore(release): publish new version
- @standardnotes/analytics@2.23.1
 - @standardnotes/api-gateway@1.61.2
 - @standardnotes/auth-server@1.114.2
 - @standardnotes/domain-core@1.16.2
 - @standardnotes/domain-events-infra@1.12.2
 - @standardnotes/domain-events@2.111.2
 - @standardnotes/event-store@1.9.1
 - @standardnotes/files-server@1.15.2
 - @standardnotes/home-server@1.6.3
 - @standardnotes/revisions-server@1.19.2
 - @standardnotes/scheduler-server@1.19.1
 - @standardnotes/settings@1.21.6
 - @standardnotes/syncing-server@1.40.2
 - @standardnotes/websockets-server@1.8.1
2023-05-30 12:27:45 +00:00
Karol Sójko
b0d01dffd9 fix: bump version manually to publish packages 2023-05-30 14:10:51 +02:00
Karol Sójko
b74e7ce86d fix: add @lerna-lite/publish 2023-05-30 13:54:28 +02:00
standardci
671f7a7074 chore(release): publish new version
- @standardnotes/api-gateway@1.61.0
 - @standardnotes/auth-server@1.114.0
 - @standardnotes/files-server@1.15.0
 - @standardnotes/home-server@1.6.2
 - @standardnotes/revisions-server@1.19.0
 - @standardnotes/syncing-server@1.40.0
2023-05-30 11:51:38 +00:00
Karol Sójko
55fd873b37 feat: make home server components publishable (#617) 2023-05-30 13:37:49 +02:00
104 changed files with 2189 additions and 198 deletions

769
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -24,6 +24,7 @@
"@commitlint/config-conventional": "^17.0.2",
"@lerna-lite/cli": "^2.3.0",
"@lerna-lite/list": "^2.3.0",
"@lerna-lite/publish": "^2.4.0",
"@lerna-lite/run": "^2.3.0",
"@lerna-lite/version": "^2.3.0",
"@types/jest": "^29.5.1",

View File

@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.23.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.23.4...@standardnotes/analytics@2.23.5) (2023-06-01)
**Note:** Version bump only for package @standardnotes/analytics
## [2.23.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.23.3...@standardnotes/analytics@2.23.4) (2023-05-31)
**Note:** Version bump only for package @standardnotes/analytics
## [2.23.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.23.2...@standardnotes/analytics@2.23.3) (2023-05-31)
**Note:** Version bump only for package @standardnotes/analytics
## [2.23.2](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.23.1...@standardnotes/analytics@2.23.2) (2023-05-31)
**Note:** Version bump only for package @standardnotes/analytics
## [2.23.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.23.0...@standardnotes/analytics@2.23.1) (2023-05-30)
**Note:** Version bump only for package @standardnotes/analytics
# [2.23.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.22.5...@standardnotes/analytics@2.23.0) (2023-05-30)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.23.0",
"version": "2.23.5",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,50 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.62.2](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.62.1...@standardnotes/api-gateway@1.62.2) (2023-06-01)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.62.1](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.62.0...@standardnotes/api-gateway@1.62.1) (2023-05-31)
**Note:** Version bump only for package @standardnotes/api-gateway
# [1.62.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.61.5...@standardnotes/api-gateway@1.62.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/api-gateway/issues/619)) ([bc63d0a](https://github.com/standardnotes/api-gateway/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.61.5](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.61.4...@standardnotes/api-gateway@1.61.5) (2023-05-31)
### Reverts
* Revert "Revert "feat: make home server components publishable (#617)"" ([13c85d4](https://github.com/standardnotes/api-gateway/commit/13c85d43318caa0fb53726f13ea581ba4a5f816b)), closes [#617](https://github.com/standardnotes/api-gateway/issues/617)
## [1.61.4](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.61.3...@standardnotes/api-gateway@1.61.4) (2023-05-31)
### Bug Fixes
* **home-server:** make the package publishable ([56a312f](https://github.com/standardnotes/api-gateway/commit/56a312f21730b32b766c358a5ceb0865722bac46))
## [1.61.3](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.61.2...@standardnotes/api-gateway@1.61.3) (2023-05-30)
### Reverts
* Revert "feat: make home server components publishable (#617)" ([1a8daef](https://github.com/standardnotes/api-gateway/commit/1a8daef79d55a8cdee1632b294b897176af64b26)), closes [#617](https://github.com/standardnotes/api-gateway/issues/617)
## [1.61.2](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.61.0...@standardnotes/api-gateway@1.61.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/api-gateway/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.61.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.60.0...@standardnotes/api-gateway@1.61.0) (2023-05-30)
### Features
* make home server components publishable ([#617](https://github.com/standardnotes/api-gateway/issues/617)) ([55fd873](https://github.com/standardnotes/api-gateway/commit/55fd873b375e204dc9b0477b2cc6ed4582e5b603))
# [1.60.0](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.59.0...@standardnotes/api-gateway@1.60.0) (2023-05-30)
### Features

View File

@@ -1,10 +1,9 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.60.0",
"version": "1.62.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
"private": true,
"description": "API Gateway For Standard Notes Services",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@@ -13,8 +12,11 @@
"dist/src/**/*.d.ts"
],
"repository": "git@github.com:standardnotes/api-gateway.git",
"author": "Karol Sójko <karolsojko@standardnotes.com>",
"author": "Karol Sójko <karol@standardnotes.com>",
"license": "AGPL-3.0-or-later",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rm -fr dist",
"build": "tsc --build",
@@ -52,6 +54,7 @@
"@types/jest": "^29.5.1",
"@types/jsonwebtoken": "^9.0.1",
"@types/newrelic": "^9.13.0",
"@types/node": "^20.2.5",
"@types/prettyjson": "^0.0.30",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",

View File

@@ -21,12 +21,13 @@ import { EndpointResolverInterface } from '../Service/Resolver/EndpointResolverI
import { EndpointResolver } from '../Service/Resolver/EndpointResolver'
import { RequiredCrossServiceTokenMiddleware } from '../Controller/RequiredCrossServiceTokenMiddleware'
import { OptionalCrossServiceTokenMiddleware } from '../Controller/OptionalCrossServiceTokenMiddleware'
import { Transform } from 'stream'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
export class ContainerConfigLoader {
async load(serviceContainer?: ServiceContainerInterface): Promise<Container> {
async load(configuration?: { serviceContainer?: ServiceContainerInterface; logger?: Transform }): Promise<Container> {
const env: Env = new Env()
env.load()
@@ -40,13 +41,17 @@ export class ContainerConfigLoader {
winstonFormatters.push(newrelicWinstonFormatter())
}
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'api-gateway' },
})
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
if (configuration?.logger) {
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(configuration.logger as winston.Logger)
} else {
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'api-gateway' },
})
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
}
if (!isConfiguredForHomeServer) {
const redisUrl = env.get('REDIS_URL')
@@ -91,12 +96,14 @@ export class ContainerConfigLoader {
// Services
if (isConfiguredForHomeServer) {
if (!serviceContainer) {
if (!configuration?.serviceContainer) {
throw new Error('Service container is required when configured for home server')
}
container
.bind<ServiceProxyInterface>(TYPES.ServiceProxy)
.toConstantValue(new DirectCallServiceProxy(serviceContainer, container.get(TYPES.FILES_SERVER_URL)))
.toConstantValue(
new DirectCallServiceProxy(configuration.serviceContainer, container.get(TYPES.FILES_SERVER_URL)),
)
} else {
container.bind<ServiceProxyInterface>(TYPES.ServiceProxy).to(HttpServiceProxy)
}

View File

@@ -1,12 +1,19 @@
import { ServiceContainerInterface, ServiceIdentifier, ServiceInterface } from '@standardnotes/domain-core'
import { ContainerConfigLoader } from './Container'
import { Transform } from 'stream'
export class Service implements ServiceInterface {
private logger: Transform | undefined
constructor(private serviceContainer: ServiceContainerInterface) {
this.serviceContainer.register(this.getId(), this)
}
setLogger(logger: Transform): void {
this.logger = logger
}
async handleRequest(_request: never, _response: never, _endpointOrMethodIdentifier: string): Promise<unknown> {
throw new Error('Requests are handled via inversify-express at ApiGateway level')
}
@@ -14,7 +21,10 @@ export class Service implements ServiceInterface {
async getContainer(): Promise<unknown> {
const config = new ContainerConfigLoader()
return config.load(this.serviceContainer)
return config.load({
serviceContainer: this.serviceContainer,
logger: this.logger,
})
}
getId(): ServiceIdentifier {

View File

@@ -1,2 +1 @@
export * from './Service'
export * from './Types'

View File

@@ -3,6 +3,54 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.115.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.115.1...@standardnotes/auth-server@1.115.2) (2023-06-01)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.115.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.115.0...@standardnotes/auth-server@1.115.1) (2023-05-31)
**Note:** Version bump only for package @standardnotes/auth-server
# [1.115.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.114.6...@standardnotes/auth-server@1.115.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/server/issues/619)) ([bc63d0a](https://github.com/standardnotes/server/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.114.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.114.5...@standardnotes/auth-server@1.114.6) (2023-05-31)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.114.5](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.114.4...@standardnotes/auth-server@1.114.5) (2023-05-31)
### Reverts
* Revert "Revert "feat: make home server components publishable (#617)"" ([13c85d4](https://github.com/standardnotes/server/commit/13c85d43318caa0fb53726f13ea581ba4a5f816b)), closes [#617](https://github.com/standardnotes/server/issues/617)
## [1.114.4](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.114.3...@standardnotes/auth-server@1.114.4) (2023-05-31)
### Bug Fixes
* **home-server:** make the package publishable ([56a312f](https://github.com/standardnotes/server/commit/56a312f21730b32b766c358a5ceb0865722bac46))
## [1.114.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.114.2...@standardnotes/auth-server@1.114.3) (2023-05-30)
### Reverts
* Revert "feat: make home server components publishable (#617)" ([1a8daef](https://github.com/standardnotes/server/commit/1a8daef79d55a8cdee1632b294b897176af64b26)), closes [#617](https://github.com/standardnotes/server/issues/617)
## [1.114.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.114.0...@standardnotes/auth-server@1.114.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/server/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.114.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.113.0...@standardnotes/auth-server@1.114.0) (2023-05-30)
### Features
* make home server components publishable ([#617](https://github.com/standardnotes/server/issues/617)) ([55fd873](https://github.com/standardnotes/server/commit/55fd873b375e204dc9b0477b2cc6ed4582e5b603))
# [1.113.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.112.0...@standardnotes/auth-server@1.113.0) (2023-05-30)
### Features

View File

@@ -1,15 +1,17 @@
{
"name": "@standardnotes/auth-server",
"version": "1.113.0",
"version": "1.115.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
"private": true,
"description": "Auth Server",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
"author": "Karol Sójko <karolsojko@standardnotes.com>",
"author": "Karol Sójko <karol@standardnotes.com>",
"license": "AGPL-3.0-or-later",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rm -fr dist",
"setup:env": "cp .env.sample .env",
@@ -80,6 +82,7 @@
"@types/ioredis": "^5.0.0",
"@types/jest": "^29.5.1",
"@types/newrelic": "^9.13.0",
"@types/node": "^20.2.5",
"@types/otplib": "^10.0.0",
"@types/prettyjson": "^0.0.30",
"@types/ua-parser-js": "^0.7.36",

View File

@@ -250,6 +250,7 @@ import { HomeServerUsersController } from '../Infra/InversifyExpressUtils/HomeSe
import { HomeServerValetTokenController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerValetTokenController'
import { HomeServerWebSocketsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerWebSocketsController'
import { HomeServerSessionsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerSessionsController'
import { Transform } from 'stream'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
@@ -258,6 +259,7 @@ export class ContainerConfigLoader {
async load(configuration?: {
controllerConatiner?: ControllerContainerInterface
directCallDomainEventPublisher?: DirectCallDomainEventPublisher
logger?: Transform
}): Promise<Container> {
const directCallDomainEventPublisher =
configuration?.directCallDomainEventPublisher ?? new DirectCallDomainEventPublisher()
@@ -290,13 +292,17 @@ export class ContainerConfigLoader {
winstonFormatters.push(newrelicWinstonFormatter())
}
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'auth' },
})
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(logger)
if (configuration?.logger) {
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(configuration.logger as winston.Logger)
} else {
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'auth' },
})
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(logger)
}
container.bind<TimerInterface>(TYPES.Auth_Timer).toConstantValue(new Timer())

View File

@@ -7,8 +7,11 @@ import {
import { ContainerConfigLoader } from './Container'
import { DirectCallDomainEventPublisher } from '@standardnotes/domain-events-infra'
import { Transform } from 'stream'
export class Service implements ServiceInterface {
private logger: Transform | undefined
constructor(
private serviceContainer: ServiceContainerInterface,
private controllerContainer: ControllerContainerInterface,
@@ -17,6 +20,10 @@ export class Service implements ServiceInterface {
this.serviceContainer.register(this.getId(), this)
}
setLogger(logger: Transform): void {
this.logger = logger
}
async handleRequest(request: never, response: never, endpointOrMethodIdentifier: string): Promise<unknown> {
const method = this.controllerContainer.get(endpointOrMethodIdentifier)
@@ -33,6 +40,7 @@ export class Service implements ServiceInterface {
return config.load({
controllerConatiner: this.controllerContainer,
directCallDomainEventPublisher: this.directCallDomainEventPublisher,
logger: this.logger,
})
}

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.48.2](https://github.com/standardnotes/server/compare/@standardnotes/common@1.48.0...@standardnotes/common@1.48.2) (2023-05-31)
### Bug Fixes
* **common:** bump version ([74ac709](https://github.com/standardnotes/server/commit/74ac709bb5e78aa5a01db34592873a42674ce138))
# [1.48.0](https://github.com/standardnotes/server/compare/@standardnotes/common@1.47.1...@standardnotes/common@1.48.0) (2023-05-30)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/common",
"version": "1.48.0",
"version": "1.48.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.17.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.16.2...@standardnotes/domain-core@1.17.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/server/issues/619)) ([bc63d0a](https://github.com/standardnotes/server/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.16.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.16.0...@standardnotes/domain-core@1.16.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/server/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.16.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-core@1.15.0...@standardnotes/domain-core@1.16.0) (2023-05-29)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-core",
"version": "1.16.0",
"version": "1.17.0",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
@@ -27,6 +27,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.1",
"@types/node": "^20.2.5",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",

View File

@@ -1,7 +1,9 @@
import { ServiceIdentifier } from './ServiceIdentifier'
import { Transform } from 'stream'
export interface ServiceInterface {
getContainer(): Promise<unknown>
setLogger(logger: Transform): void
getId(): ServiceIdentifier
handleRequest(request: never, response: never, endpointOrMethodIdentifier: string): Promise<unknown>
}

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.12.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.12.2...@standardnotes/domain-events-infra@1.12.3) (2023-05-31)
**Note:** Version bump only for package @standardnotes/domain-events-infra
## [1.12.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.12.0...@standardnotes/domain-events-infra@1.12.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/server/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.12.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.11.2...@standardnotes/domain-events-infra@1.12.0) (2023-05-17)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.12.0",
"version": "1.12.3",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.111.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.111.2...@standardnotes/domain-events@2.111.3) (2023-05-31)
**Note:** Version bump only for package @standardnotes/domain-events
## [2.111.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.111.0...@standardnotes/domain-events@2.111.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/server/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [2.111.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.110.2...@standardnotes/domain-events@2.111.0) (2023-05-17)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.111.0",
"version": "2.111.3",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.9.4](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.9.3...@standardnotes/event-store@1.9.4) (2023-06-01)
**Note:** Version bump only for package @standardnotes/event-store
## [1.9.3](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.9.2...@standardnotes/event-store@1.9.3) (2023-05-31)
**Note:** Version bump only for package @standardnotes/event-store
## [1.9.2](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.9.1...@standardnotes/event-store@1.9.2) (2023-05-31)
### Bug Fixes
* **home-server:** make the package publishable ([56a312f](https://github.com/standardnotes/server/commit/56a312f21730b32b766c358a5ceb0865722bac46))
## [1.9.1](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.9.0...@standardnotes/event-store@1.9.1) (2023-05-30)
**Note:** Version bump only for package @standardnotes/event-store
# [1.9.0](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.8.3...@standardnotes/event-store@1.9.0) (2023-05-30)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/event-store",
"version": "1.9.0",
"version": "1.9.4",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",
@@ -16,7 +16,7 @@
"test": "jest --coverage --config=./jest.config.js --maxWorkers=50%",
"worker": "yarn node dist/bin/worker.js"
},
"author": "Karol Sójko <karolsojko@standardnotes.com>",
"author": "Karol Sójko <karol@standardnotes.com>",
"license": "AGPL-3.0-or-later",
"devDependencies": {
"@types/ioredis": "^5.0.0",

View File

@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.16.2](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.16.1...@standardnotes/files-server@1.16.2) (2023-06-01)
**Note:** Version bump only for package @standardnotes/files-server
## [1.16.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.16.0...@standardnotes/files-server@1.16.1) (2023-05-31)
**Note:** Version bump only for package @standardnotes/files-server
# [1.16.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.15.4...@standardnotes/files-server@1.16.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/files/issues/619)) ([bc63d0a](https://github.com/standardnotes/files/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.15.4](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.15.3...@standardnotes/files-server@1.15.4) (2023-05-31)
### Reverts
* Revert "Revert "feat: make home server components publishable (#617)"" ([13c85d4](https://github.com/standardnotes/files/commit/13c85d43318caa0fb53726f13ea581ba4a5f816b)), closes [#617](https://github.com/standardnotes/files/issues/617)
## [1.15.3](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.15.2...@standardnotes/files-server@1.15.3) (2023-05-30)
### Reverts
* Revert "feat: make home server components publishable (#617)" ([1a8daef](https://github.com/standardnotes/files/commit/1a8daef79d55a8cdee1632b294b897176af64b26)), closes [#617](https://github.com/standardnotes/files/issues/617)
## [1.15.2](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.15.0...@standardnotes/files-server@1.15.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/files/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.15.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.14.0...@standardnotes/files-server@1.15.0) (2023-05-30)
### Features
* make home server components publishable ([#617](https://github.com/standardnotes/files/issues/617)) ([55fd873](https://github.com/standardnotes/files/commit/55fd873b375e204dc9b0477b2cc6ed4582e5b603))
# [1.14.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.13.0...@standardnotes/files-server@1.14.0) (2023-05-30)
### Features

View File

@@ -1,10 +1,9 @@
{
"name": "@standardnotes/files-server",
"version": "1.14.0",
"version": "1.16.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
"private": true,
"description": "Standard Notes Files Server",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
@@ -13,6 +12,9 @@
"Karol Sójko <karol@standardnotes.com>"
],
"license": "AGPL-3.0-or-later",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rm -fr dist",
"setup:env": "cp .env.sample .env",
@@ -62,6 +64,7 @@
"@types/jest": "^29.5.1",
"@types/jsonwebtoken": "^9.0.1",
"@types/newrelic": "^9.13.0",
"@types/node": "^20.2.5",
"@types/prettyjson": "^0.0.30",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^5.59.2",

View File

@@ -47,9 +47,13 @@ import { MarkFilesToBeRemoved } from '../Domain/UseCase/MarkFilesToBeRemoved/Mar
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
import { SharedSubscriptionInvitationCanceledEventHandler } from '../Domain/Handler/SharedSubscriptionInvitationCanceledEventHandler'
import { InMemoryUploadRepository } from '../Infra/InMemory/InMemoryUploadRepository'
import { Transform } from 'stream'
export class ContainerConfigLoader {
async load(configuration?: { directCallDomainEventPublisher?: DirectCallDomainEventPublisher }): Promise<Container> {
async load(configuration?: {
directCallDomainEventPublisher?: DirectCallDomainEventPublisher
logger?: Transform
}): Promise<Container> {
const directCallDomainEventPublisher =
configuration?.directCallDomainEventPublisher ?? new DirectCallDomainEventPublisher()
@@ -60,8 +64,11 @@ export class ContainerConfigLoader {
const isConfiguredForHomeServer = env.get('CACHE_TYPE') === 'memory'
const logger = this.createLogger({ env })
container.bind<winston.Logger>(TYPES.Files_Logger).toConstantValue(logger)
if (configuration?.logger) {
container.bind<winston.Logger>(TYPES.Files_Logger).toConstantValue(configuration.logger as winston.Logger)
} else {
container.bind<winston.Logger>(TYPES.Files_Logger).toConstantValue(this.createLogger({ env }))
}
container.bind<TimerInterface>(TYPES.Files_Timer).toConstantValue(new Timer())

View File

@@ -2,8 +2,11 @@ import { ServiceContainerInterface, ServiceIdentifier, ServiceInterface } from '
import { DirectCallDomainEventPublisher } from '@standardnotes/domain-events-infra'
import { ContainerConfigLoader } from './Container'
import { Transform } from 'stream'
export class Service implements ServiceInterface {
private logger: Transform | undefined
constructor(
private serviceContainer: ServiceContainerInterface,
private directCallDomainEventPublisher: DirectCallDomainEventPublisher,
@@ -11,6 +14,10 @@ export class Service implements ServiceInterface {
this.serviceContainer.register(this.getId(), this)
}
setLogger(logger: Transform): void {
this.logger = logger
}
async handleRequest(_request: never, _response: never, _endpointOrMethodIdentifier: string): Promise<unknown> {
throw new Error('Requests are handled via inversify-express at ApiGateway level')
}
@@ -20,6 +27,7 @@ export class Service implements ServiceInterface {
return config.load({
directCallDomainEventPublisher: this.directCallDomainEventPublisher,
logger: this.logger,
})
}

View File

@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.7.2](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.7.1...@standardnotes/home-server@1.7.2) (2023-06-01)
**Note:** Version bump only for package @standardnotes/home-server
## [1.7.1](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.7.0...@standardnotes/home-server@1.7.1) (2023-05-31)
**Note:** Version bump only for package @standardnotes/home-server
# [1.7.0](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.7...@standardnotes/home-server@1.7.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/server/issues/619)) ([bc63d0a](https://github.com/standardnotes/server/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.6.7](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.6...@standardnotes/home-server@1.6.7) (2023-05-31)
**Note:** Version bump only for package @standardnotes/home-server
## [1.6.6](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.5...@standardnotes/home-server@1.6.6) (2023-05-31)
**Note:** Version bump only for package @standardnotes/home-server
## [1.6.5](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.4...@standardnotes/home-server@1.6.5) (2023-05-31)
### Bug Fixes
* **home-server:** make the package publishable ([56a312f](https://github.com/standardnotes/server/commit/56a312f21730b32b766c358a5ceb0865722bac46))
## [1.6.4](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.3...@standardnotes/home-server@1.6.4) (2023-05-30)
**Note:** Version bump only for package @standardnotes/home-server
## [1.6.3](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.2...@standardnotes/home-server@1.6.3) (2023-05-30)
**Note:** Version bump only for package @standardnotes/home-server
## [1.6.2](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.1...@standardnotes/home-server@1.6.2) (2023-05-30)
**Note:** Version bump only for package @standardnotes/home-server
## [1.6.1](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.6.0...@standardnotes/home-server@1.6.1) (2023-05-30)
**Note:** Version bump only for package @standardnotes/home-server

View File

@@ -1,108 +1,8 @@
import 'reflect-metadata'
import { HomeServer } from '../src/Server/HomeServer'
import { ControllerContainer, ServiceContainer } from '@standardnotes/domain-core'
import { Service as ApiGatewayService, TYPES as ApiGatewayTYPES } from '@standardnotes/api-gateway'
import { Service as FilesService } from '@standardnotes/files-server'
import { DirectCallDomainEventPublisher } from '@standardnotes/domain-events-infra'
import { Service as AuthService } from '@standardnotes/auth-server'
import { Service as SyncingService } from '@standardnotes/syncing-server'
import { Service as RevisionsService } from '@standardnotes/revisions-server'
import { Container } from 'inversify'
import { InversifyExpressServer } from 'inversify-express-utils'
import helmet from 'helmet'
import * as cors from 'cors'
import { text, json, Request, Response, NextFunction } from 'express'
import * as winston from 'winston'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const robots = require('express-robots-txt')
const homeServer = new HomeServer()
import { Env } from '../src/Bootstrap/Env'
const startServer = async (): Promise<void> => {
const controllerContainer = new ControllerContainer()
const serviceContainer = new ServiceContainer()
const directCallDomainEventPublisher = new DirectCallDomainEventPublisher()
const apiGatewayService = new ApiGatewayService(serviceContainer)
const authService = new AuthService(serviceContainer, controllerContainer, directCallDomainEventPublisher)
const syncingService = new SyncingService(serviceContainer, controllerContainer, directCallDomainEventPublisher)
const revisionsService = new RevisionsService(serviceContainer, controllerContainer, directCallDomainEventPublisher)
const filesService = new FilesService(serviceContainer, directCallDomainEventPublisher)
const container = Container.merge(
(await apiGatewayService.getContainer()) as Container,
(await authService.getContainer()) as Container,
(await syncingService.getContainer()) as Container,
(await revisionsService.getContainer()) as Container,
(await filesService.getContainer()) as Container,
)
const env: Env = new Env()
env.load()
const server = new InversifyExpressServer(container)
server.setConfig((app) => {
/* eslint-disable */
app.use(helmet({
contentSecurityPolicy: {
directives: {
defaultSrc: ["https: 'self'"],
baseUri: ["'self'"],
childSrc: ["*", "blob:"],
connectSrc: ["*"],
fontSrc: ["*", "'self'"],
formAction: ["'self'"],
frameAncestors: ["*", "*.standardnotes.org", "*.standardnotes.com"],
frameSrc: ["*", "blob:"],
imgSrc: ["'self'", "*", "data:"],
manifestSrc: ["'self'"],
mediaSrc: ["'self'"],
objectSrc: ["'self'"],
scriptSrc: ["'self'"],
styleSrc: ["'self'"]
}
}
}))
/* eslint-enable */
app.use(json({ limit: '50mb' }))
app.use(
text({
type: ['text/plain', 'application/x-www-form-urlencoded', 'application/x-www-form-urlencoded; charset=utf-8'],
}),
)
app.use(cors())
app.use(
robots({
UserAgent: '*',
Disallow: '/',
}),
)
})
const logger: winston.Logger = container.get(ApiGatewayTYPES.Logger)
server.setErrorConfig((app) => {
app.use((error: Record<string, unknown>, _request: Request, response: Response, _next: NextFunction) => {
logger.error(error.stack)
response.status(500).send({
error: {
message:
"Unfortunately, we couldn't handle your request. Please try again or contact our support if the error persists.",
},
})
})
})
const serverInstance = server.build()
serverInstance.listen(env.get('PORT', true) ? +env.get('PORT', true) : 3000)
logger.info(`Server started on port ${process.env.PORT}`)
}
Promise.resolve(startServer()).catch((error) => {
Promise.resolve(homeServer.start()).catch((error) => {
// eslint-disable-next-line no-console
console.log(`Could not start server: ${error.message}`)
})

View File

@@ -1,15 +1,17 @@
{
"name": "@standardnotes/home-server",
"version": "1.6.1",
"version": "1.7.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
"private": true,
"description": "Standard Notes Home Server",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
"repository": "git@github.com:standardnotes/server.git",
"author": "Karol Sójko <karolsojko@standardnotes.com>",
"author": "Karol Sójko <karol@standardnotes.com>",
"publishConfig": {
"access": "public"
},
"license": "AGPL-3.0-or-later",
"scripts": {
"clean": "rm -fr dist",

View File

@@ -0,0 +1,164 @@
import 'reflect-metadata'
import { ControllerContainer, ServiceContainer } from '@standardnotes/domain-core'
import { Service as ApiGatewayService } from '@standardnotes/api-gateway'
import { Service as FilesService } from '@standardnotes/files-server'
import { DirectCallDomainEventPublisher } from '@standardnotes/domain-events-infra'
import { Service as AuthService } from '@standardnotes/auth-server'
import { Service as SyncingService } from '@standardnotes/syncing-server'
import { Service as RevisionsService } from '@standardnotes/revisions-server'
import { Container } from 'inversify'
import { InversifyExpressServer } from 'inversify-express-utils'
import helmet from 'helmet'
import * as cors from 'cors'
import * as http from 'http'
import { text, json, Request, Response, NextFunction } from 'express'
import * as winston from 'winston'
import { PassThrough } from 'stream'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const robots = require('express-robots-txt')
import { Env } from '../Bootstrap/Env'
import { HomeServerInterface } from './HomeServerInterface'
export class HomeServer implements HomeServerInterface {
private serverInstance: http.Server | undefined
async start(): Promise<void> {
const controllerContainer = new ControllerContainer()
const serviceContainer = new ServiceContainer()
const directCallDomainEventPublisher = new DirectCallDomainEventPublisher()
const env: Env = new Env()
env.load()
this.configureLoggers(env)
const apiGatewayService = new ApiGatewayService(serviceContainer)
apiGatewayService.setLogger(winston.loggers.get('api-gateway'))
const authService = new AuthService(serviceContainer, controllerContainer, directCallDomainEventPublisher)
authService.setLogger(winston.loggers.get('auth-server'))
const syncingService = new SyncingService(serviceContainer, controllerContainer, directCallDomainEventPublisher)
syncingService.setLogger(winston.loggers.get('syncing-server'))
const revisionsService = new RevisionsService(serviceContainer, controllerContainer, directCallDomainEventPublisher)
revisionsService.setLogger(winston.loggers.get('revisions-server'))
const filesService = new FilesService(serviceContainer, directCallDomainEventPublisher)
filesService.setLogger(winston.loggers.get('files-server'))
const container = Container.merge(
(await apiGatewayService.getContainer()) as Container,
(await authService.getContainer()) as Container,
(await syncingService.getContainer()) as Container,
(await revisionsService.getContainer()) as Container,
(await filesService.getContainer()) as Container,
)
const server = new InversifyExpressServer(container)
server.setConfig((app) => {
/* eslint-disable */
app.use(helmet({
contentSecurityPolicy: {
directives: {
defaultSrc: ["https: 'self'"],
baseUri: ["'self'"],
childSrc: ["*", "blob:"],
connectSrc: ["*"],
fontSrc: ["*", "'self'"],
formAction: ["'self'"],
frameAncestors: ["*", "*.standardnotes.org", "*.standardnotes.com"],
frameSrc: ["*", "blob:"],
imgSrc: ["'self'", "*", "data:"],
manifestSrc: ["'self'"],
mediaSrc: ["'self'"],
objectSrc: ["'self'"],
scriptSrc: ["'self'"],
styleSrc: ["'self'"]
}
}
}))
/* eslint-enable */
app.use(json({ limit: '50mb' }))
app.use(
text({
type: ['text/plain', 'application/x-www-form-urlencoded', 'application/x-www-form-urlencoded; charset=utf-8'],
}),
)
app.use(cors())
app.use(
robots({
UserAgent: '*',
Disallow: '/',
}),
)
})
const logger: winston.Logger = winston.loggers.get('home-server')
server.setErrorConfig((app) => {
app.use((error: Record<string, unknown>, _request: Request, response: Response, _next: NextFunction) => {
logger.error(error.stack)
response.status(500).send({
error: {
message:
"Unfortunately, we couldn't handle your request. Please try again or contact our support if the error persists.",
},
})
})
})
this.serverInstance = server.build().listen(env.get('PORT', true) ? +env.get('PORT', true) : 3000)
logger.info(`Server started on port ${process.env.PORT}`)
}
async stop(): Promise<void> {
if (this.serverInstance) {
this.serverInstance.close()
}
}
async restart(): Promise<void> {
await this.stop()
await this.start()
}
async isRunning(): Promise<boolean> {
if (!this.serverInstance) {
return false
}
return this.serverInstance.address() !== null
}
logs(): NodeJS.ReadableStream {
const passThroughStream = new PassThrough()
for (const logger of winston.loggers.loggers.values()) {
logger.stream({ start: -1 }).pipe(passThroughStream, { end: false })
}
return passThroughStream
}
private configureLoggers(env: Env): void {
const winstonFormatters = [winston.format.splat(), winston.format.json()]
for (const loggerName of [
'auth-server',
'syncing-server',
'revisions-server',
'files-server',
'api-gateway',
'home-server',
]) {
winston.loggers.add(loggerName, {
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: loggerName },
})
}
}
}

View File

@@ -0,0 +1,7 @@
export interface HomeServerInterface {
start(): Promise<void>
stop(): Promise<void>
restart(): Promise<void>
isRunning(): Promise<boolean>
logs(): NodeJS.ReadableStream
}

View File

@@ -0,0 +1,2 @@
export * from './HomeServer'
export * from './HomeServerInterface'

View File

@@ -0,0 +1 @@
export * from './Server'

View File

@@ -3,6 +3,54 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.20.2](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.20.1...@standardnotes/revisions-server@1.20.2) (2023-06-01)
**Note:** Version bump only for package @standardnotes/revisions-server
## [1.20.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.20.0...@standardnotes/revisions-server@1.20.1) (2023-05-31)
**Note:** Version bump only for package @standardnotes/revisions-server
# [1.20.0](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.19.6...@standardnotes/revisions-server@1.20.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/server/issues/619)) ([bc63d0a](https://github.com/standardnotes/server/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.19.6](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.19.5...@standardnotes/revisions-server@1.19.6) (2023-05-31)
**Note:** Version bump only for package @standardnotes/revisions-server
## [1.19.5](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.19.4...@standardnotes/revisions-server@1.19.5) (2023-05-31)
### Reverts
* Revert "Revert "feat: make home server components publishable (#617)"" ([13c85d4](https://github.com/standardnotes/server/commit/13c85d43318caa0fb53726f13ea581ba4a5f816b)), closes [#617](https://github.com/standardnotes/server/issues/617)
## [1.19.4](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.19.3...@standardnotes/revisions-server@1.19.4) (2023-05-31)
### Bug Fixes
* **home-server:** make the package publishable ([56a312f](https://github.com/standardnotes/server/commit/56a312f21730b32b766c358a5ceb0865722bac46))
## [1.19.3](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.19.2...@standardnotes/revisions-server@1.19.3) (2023-05-30)
### Reverts
* Revert "feat: make home server components publishable (#617)" ([1a8daef](https://github.com/standardnotes/server/commit/1a8daef79d55a8cdee1632b294b897176af64b26)), closes [#617](https://github.com/standardnotes/server/issues/617)
## [1.19.2](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.19.0...@standardnotes/revisions-server@1.19.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/server/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.19.0](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.18.0...@standardnotes/revisions-server@1.19.0) (2023-05-30)
### Features
* make home server components publishable ([#617](https://github.com/standardnotes/server/issues/617)) ([55fd873](https://github.com/standardnotes/server/commit/55fd873b375e204dc9b0477b2cc6ed4582e5b603))
# [1.18.0](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.17.0...@standardnotes/revisions-server@1.18.0) (2023-05-30)
### Features

View File

@@ -1,16 +1,18 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.18.0",
"version": "1.20.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
"private": true,
"description": "Revisions Server",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
"repository": "git@github.com:standardnotes/server.git",
"author": "Karol Sójko <karolsojko@standardnotes.com>",
"author": "Karol Sójko <karol@standardnotes.com>",
"license": "AGPL-3.0-or-later",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rm -fr dist",
"setup:env": "cp .env.sample .env",
@@ -52,6 +54,7 @@
"@types/express": "^4.17.14",
"@types/jest": "^29.5.1",
"@types/newrelic": "^9.13.0",
"@types/node": "^20.2.5",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"eslint": "^8.39.0",

View File

@@ -46,6 +46,7 @@ import { FSDumpRepository } from '../Infra/FS/FSDumpRepository'
import { S3DumpRepository } from '../Infra/S3/S3ItemDumpRepository'
import { RevisionItemStringMapper } from '../Mapping/RevisionItemStringMapper'
import { HomeServerRevisionsController } from '../Infra/InversifyExpress/HomeServer/HomeServerRevisionsController'
import { Transform } from 'stream'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
@@ -54,6 +55,7 @@ export class ContainerConfigLoader {
async load(configuration?: {
controllerConatiner?: ControllerContainerInterface
directCallDomainEventPublisher?: DirectCallDomainEventPublisher
logger?: Transform
}): Promise<Container> {
const directCallDomainEventPublisher =
configuration?.directCallDomainEventPublisher ?? new DirectCallDomainEventPublisher()
@@ -71,24 +73,28 @@ export class ContainerConfigLoader {
container.bind<Env>(TYPES.Revisions_Env).toConstantValue(env)
container.bind<winston.Logger>(TYPES.Revisions_Logger).toDynamicValue((context: interfaces.Context) => {
const env: Env = context.container.get(TYPES.Revisions_Env)
if (configuration?.logger) {
container.bind<winston.Logger>(TYPES.Revisions_Logger).toConstantValue(configuration.logger as winston.Logger)
} else {
container.bind<winston.Logger>(TYPES.Revisions_Logger).toDynamicValue((context: interfaces.Context) => {
const env: Env = context.container.get(TYPES.Revisions_Env)
const newrelicWinstonFormatter = newrelicFormatter(winston)
const winstonFormatters = [winston.format.splat(), winston.format.json()]
if (env.get('NEW_RELIC_ENABLED', true) === 'true') {
winstonFormatters.push(newrelicWinstonFormatter())
}
const newrelicWinstonFormatter = newrelicFormatter(winston)
const winstonFormatters = [winston.format.splat(), winston.format.json()]
if (env.get('NEW_RELIC_ENABLED', true) === 'true') {
winstonFormatters.push(newrelicWinstonFormatter())
}
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'revisions' },
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'revisions' },
})
return logger
})
return logger
})
}
container.bind(TYPES.Revisions_NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
container.bind(TYPES.Revisions_VERSION).toConstantValue(env.get('VERSION'))

View File

@@ -7,8 +7,11 @@ import {
import { ContainerConfigLoader } from './Container'
import { DirectCallDomainEventPublisher } from '@standardnotes/domain-events-infra'
import { Transform } from 'stream'
export class Service implements ServiceInterface {
private logger: Transform | undefined
constructor(
private serviceContainer: ServiceContainerInterface,
private controllerContainer: ControllerContainerInterface,
@@ -17,6 +20,10 @@ export class Service implements ServiceInterface {
this.serviceContainer.register(this.getId(), this)
}
setLogger(logger: Transform): void {
this.logger = logger
}
async handleRequest(request: never, response: never, endpointOrMethodIdentifier: string): Promise<unknown> {
const method = this.controllerContainer.get(endpointOrMethodIdentifier)
@@ -33,6 +40,7 @@ export class Service implements ServiceInterface {
return config.load({
controllerConatiner: this.controllerContainer,
directCallDomainEventPublisher: this.directCallDomainEventPublisher,
logger: this.logger,
})
}

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.19.4](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.19.3...@standardnotes/scheduler-server@1.19.4) (2023-06-01)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.19.3](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.19.2...@standardnotes/scheduler-server@1.19.3) (2023-05-31)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.19.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.19.1...@standardnotes/scheduler-server@1.19.2) (2023-05-31)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.19.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.19.0...@standardnotes/scheduler-server@1.19.1) (2023-05-30)
**Note:** Version bump only for package @standardnotes/scheduler-server
# [1.19.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.18.5...@standardnotes/scheduler-server@1.19.0) (2023-05-30)
### Features

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.19.0",
"version": "1.19.4",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.7.10](https://github.com/standardnotes/server/compare/@standardnotes/security@1.7.8...@standardnotes/security@1.7.10) (2023-05-31)
**Note:** Version bump only for package @standardnotes/security
## [1.7.8](https://github.com/standardnotes/server/compare/@standardnotes/security@1.7.7...@standardnotes/security@1.7.8) (2023-05-09)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/security",
"version": "1.7.8",
"version": "1.7.10",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.21.7](https://github.com/standardnotes/server/compare/@standardnotes/settings@1.21.6...@standardnotes/settings@1.21.7) (2023-05-31)
**Note:** Version bump only for package @standardnotes/settings
## [1.21.6](https://github.com/standardnotes/server/compare/@standardnotes/settings@1.21.5...@standardnotes/settings@1.21.6) (2023-05-30)
**Note:** Version bump only for package @standardnotes/settings
## [1.21.5](https://github.com/standardnotes/server/compare/@standardnotes/settings@1.21.4...@standardnotes/settings@1.21.5) (2023-05-29)
**Note:** Version bump only for package @standardnotes/settings

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/settings",
"version": "1.21.5",
"version": "1.21.7",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,54 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.41.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.41.1...@standardnotes/syncing-server@1.41.2) (2023-06-01)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.41.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.41.0...@standardnotes/syncing-server@1.41.1) (2023-05-31)
**Note:** Version bump only for package @standardnotes/syncing-server
# [1.41.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.40.6...@standardnotes/syncing-server@1.41.0) (2023-05-31)
### Features
* **home-server:** add custom home server logs ([#619](https://github.com/standardnotes/syncing-server-js/issues/619)) ([bc63d0a](https://github.com/standardnotes/syncing-server-js/commit/bc63d0aeea86abbb4a144b2682b7070d7bdfe878))
## [1.40.6](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.40.5...@standardnotes/syncing-server@1.40.6) (2023-05-31)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.40.5](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.40.4...@standardnotes/syncing-server@1.40.5) (2023-05-31)
### Reverts
* Revert "Revert "feat: make home server components publishable (#617)"" ([13c85d4](https://github.com/standardnotes/syncing-server-js/commit/13c85d43318caa0fb53726f13ea581ba4a5f816b)), closes [#617](https://github.com/standardnotes/syncing-server-js/issues/617)
## [1.40.4](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.40.3...@standardnotes/syncing-server@1.40.4) (2023-05-31)
### Bug Fixes
* **home-server:** make the package publishable ([56a312f](https://github.com/standardnotes/syncing-server-js/commit/56a312f21730b32b766c358a5ceb0865722bac46))
## [1.40.3](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.40.2...@standardnotes/syncing-server@1.40.3) (2023-05-30)
### Reverts
* Revert "feat: make home server components publishable (#617)" ([1a8daef](https://github.com/standardnotes/syncing-server-js/commit/1a8daef79d55a8cdee1632b294b897176af64b26)), closes [#617](https://github.com/standardnotes/syncing-server-js/issues/617)
## [1.40.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.40.0...@standardnotes/syncing-server@1.40.2) (2023-05-30)
### Bug Fixes
* bump version manually to publish packages ([b0d01df](https://github.com/standardnotes/syncing-server-js/commit/b0d01dffd91557c67eac2940d9270bca208c1128))
# [1.40.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.39.0...@standardnotes/syncing-server@1.40.0) (2023-05-30)
### Features
* make home server components publishable ([#617](https://github.com/standardnotes/syncing-server-js/issues/617)) ([55fd873](https://github.com/standardnotes/syncing-server-js/commit/55fd873b375e204dc9b0477b2cc6ed4582e5b603))
# [1.39.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.38.0...@standardnotes/syncing-server@1.39.0) (2023-05-30)
### Features

View File

@@ -1,16 +1,18 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.39.0",
"version": "1.41.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
"private": true,
"description": "Syncing Server",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
"repository": "git@github.com:standardnotes/syncing-server-js.git",
"author": "Karol Sójko <karolsojko@standardnotes.com>",
"author": "Karol Sójko <karol@standardnotes.com>",
"license": "AGPL-3.0-or-later",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rm -fr dist",
"setup:env": "cp .env.sample .env",
@@ -64,6 +66,7 @@
"@types/jest": "^29.5.1",
"@types/jsonwebtoken": "^9.0.1",
"@types/newrelic": "^9.13.0",
"@types/node": "^20.2.5",
"@types/prettyjson": "^0.0.30",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^8.3.0",

View File

@@ -72,6 +72,7 @@ import { AuthHttpService } from '../Infra/HTTP/AuthHttpService'
import { S3ItemBackupService } from '../Infra/S3/S3ItemBackupService'
import { ControllerContainer, ControllerContainerInterface } from '@standardnotes/domain-core'
import { HomeServerItemsController } from '../Infra/InversifyExpressUtils/HomeServer/HomeServerItemsController'
import { Transform } from 'stream'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
@@ -83,6 +84,7 @@ export class ContainerConfigLoader {
async load(configuration?: {
controllerConatiner?: ControllerContainerInterface
directCallDomainEventPublisher?: DirectCallDomainEventPublisher
logger?: Transform
}): Promise<Container> {
const directCallDomainEventPublisher =
configuration?.directCallDomainEventPublisher ?? new DirectCallDomainEventPublisher()
@@ -100,24 +102,28 @@ export class ContainerConfigLoader {
container.bind<Env>(TYPES.Sync_Env).toConstantValue(env)
container.bind<winston.Logger>(TYPES.Sync_Logger).toDynamicValue((context: interfaces.Context) => {
const env: Env = context.container.get(TYPES.Sync_Env)
if (configuration?.logger) {
container.bind<winston.Logger>(TYPES.Sync_Logger).toConstantValue(configuration.logger as winston.Logger)
} else {
container.bind<winston.Logger>(TYPES.Sync_Logger).toDynamicValue((context: interfaces.Context) => {
const env: Env = context.container.get(TYPES.Sync_Env)
const newrelicWinstonFormatter = newrelicFormatter(winston)
const winstonFormatters = [winston.format.splat(), winston.format.json()]
if (env.get('NEW_RELIC_ENABLED', true) === 'true') {
winstonFormatters.push(newrelicWinstonFormatter())
}
const newrelicWinstonFormatter = newrelicFormatter(winston)
const winstonFormatters = [winston.format.splat(), winston.format.json()]
if (env.get('NEW_RELIC_ENABLED', true) === 'true') {
winstonFormatters.push(newrelicWinstonFormatter())
}
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'syncing-server' },
const logger = winston.createLogger({
level: env.get('LOG_LEVEL') || 'info',
format: winston.format.combine(...winstonFormatters),
transports: [new winston.transports.Console({ level: env.get('LOG_LEVEL') || 'info' })],
defaultMeta: { service: 'syncing-server' },
})
return logger
})
return logger
})
}
if (isConfiguredForHomeServer) {
container

View File

@@ -7,8 +7,11 @@ import {
import { ContainerConfigLoader } from './Container'
import { DirectCallDomainEventPublisher } from '@standardnotes/domain-events-infra'
import { Transform } from 'stream'
export class Service implements ServiceInterface {
private logger: Transform | undefined
constructor(
private serviceContainer: ServiceContainerInterface,
private controllerContainer: ControllerContainerInterface,
@@ -17,6 +20,10 @@ export class Service implements ServiceInterface {
this.serviceContainer.register(this.getId(), this)
}
setLogger(logger: Transform): void {
this.logger = logger
}
async handleRequest(request: never, response: never, endpointOrMethodIdentifier: string): Promise<unknown> {
const method = this.controllerContainer.get(endpointOrMethodIdentifier)
@@ -33,6 +40,7 @@ export class Service implements ServiceInterface {
return config.load({
controllerConatiner: this.controllerContainer,
directCallDomainEventPublisher: this.directCallDomainEventPublisher,
logger: this.logger,
})
}

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.14.6](https://github.com/standardnotes/server/compare/@standardnotes/time@1.14.4...@standardnotes/time@1.14.6) (2023-06-01)
### Bug Fixes
* **time:** bump version ([4b40c59](https://github.com/standardnotes/server/commit/4b40c59e7e5935fbf5d5c94ad7dee1cbe3c183cb))
## [1.14.4](https://github.com/standardnotes/server/compare/@standardnotes/time@1.14.3...@standardnotes/time@1.14.4) (2023-05-09)
### Bug Fixes

Some files were not shown because too many files have changed in this diff Show More