Compare commits

..

6 Commits

Author SHA1 Message Date
standardci
832a48ac76 chore(release): publish new version
- @standardnotes/analytics@2.19.10
 - @standardnotes/api-gateway@1.46.5
 - @standardnotes/auth-server@1.84.0
 - @standardnotes/domain-events-infra@1.9.65
 - @standardnotes/domain-events@2.106.0
 - @standardnotes/event-store@1.6.64
 - @standardnotes/files-server@1.9.10
 - @standardnotes/revisions-server@1.10.18
 - @standardnotes/scheduler-server@1.16.14
 - @standardnotes/syncing-server@1.29.5
 - @standardnotes/websockets-server@1.5.10
 - @standardnotes/workspace-server@1.19.13
2023-01-19 22:31:28 +00:00
Mo
2db0c125fe feat: offline roles (#419) 2023-01-19 16:29:36 -06:00
standardci
20d9624bc6 chore(release): publish new version
- @standardnotes/auth-server@1.83.1
2023-01-19 19:40:49 +00:00
moughxyz
f20ee68f50 Revert "feat: include roles in offline features request (#418)"
This reverts commit 2e7fdd93dd.
2023-01-19 13:38:46 -06:00
standardci
cbf45ce3eb chore(release): publish new version
- @standardnotes/auth-server@1.83.0
2023-01-19 19:18:16 +00:00
Mo
2e7fdd93dd feat: include roles in offline features request (#418) 2023-01-19 13:16:16 -06:00
33 changed files with 118 additions and 42 deletions

11
.pnp.cjs generated
View File

@@ -2758,7 +2758,7 @@ const RAW_RUNTIME_STATE =
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/domain-events-infra", "workspace:packages/domain-events-infra"],\
["@standardnotes/features", "npm:1.58.0"],\
["@standardnotes/features", "npm:1.58.1"],\
["@standardnotes/predicates", "workspace:packages/predicates"],\
["@standardnotes/responses", "npm:1.11.1"],\
["@standardnotes/security", "workspace:packages/security"],\
@@ -2862,7 +2862,7 @@ const RAW_RUNTIME_STATE =
"packageLocation": "./packages/domain-events/",\
"packageDependencies": [\
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
["@standardnotes/features", "npm:1.58.0"],\
["@standardnotes/features", "npm:1.58.1"],\
["@standardnotes/predicates", "workspace:packages/predicates"],\
["@standardnotes/security", "workspace:packages/security"],\
["@types/jest", "npm:29.1.1"],\
@@ -2968,12 +2968,13 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "HARD"\
}],\
["npm:1.58.0", {\
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.58.0-5a58b65873-028c13956a.zip/node_modules/@standardnotes/features/",\
["npm:1.58.1", {\
"packageLocation": "./.yarn/cache/@standardnotes-features-npm-1.58.1-a51ef65e8a-558e4506d8.zip/node_modules/@standardnotes/features/",\
"packageDependencies": [\
["@standardnotes/features", "npm:1.58.0"],\
["@standardnotes/features", "npm:1.58.1"],\
["@standardnotes/auth", "npm:3.19.4"],\
["@standardnotes/common", "workspace:packages/common"],\
["@standardnotes/domain-core", "workspace:packages/domain-core"],\
["@standardnotes/security", "workspace:packages/security"],\
["reflect-metadata", "npm:0.1.13"]\
],\

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.19.9",
"version": "2.19.10",
"engines": {
"node": ">=18.0.0 <19.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.46.5](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.46.4...@standardnotes/api-gateway@1.46.5) (2023-01-19)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.46.4](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.46.3...@standardnotes/api-gateway@1.46.4) (2023-01-19)
**Note:** Version bump only for package @standardnotes/api-gateway

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.46.4",
"version": "1.46.5",
"engines": {
"node": ">=18.0.0 <19.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.84.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.83.1...@standardnotes/auth-server@1.84.0) (2023-01-19)
### Features
* offline roles ([#419](https://github.com/standardnotes/server/issues/419)) ([2db0c12](https://github.com/standardnotes/server/commit/2db0c125fe5872c5898103c2388881ab416b5a99))
## [1.83.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.83.0...@standardnotes/auth-server@1.83.1) (2023-01-19)
### Reverts
* Revert "feat: include roles in offline features request (#418)" ([f20ee68](https://github.com/standardnotes/server/commit/f20ee68f504449b6ff37748c4d7f83c08bb4039d)), closes [#418](https://github.com/standardnotes/server/issues/418)
# [1.83.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.82.6...@standardnotes/auth-server@1.83.0) (2023-01-19)
### Features
* include roles in offline features request ([#418](https://github.com/standardnotes/server/issues/418)) ([2e7fdd9](https://github.com/standardnotes/server/commit/2e7fdd93dd3b07e0a9f2e72521251af1d15660d4))
## [1.82.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.82.5...@standardnotes/auth-server@1.82.6) (2023-01-19)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.82.6",
"version": "1.84.0",
"engines": {
"node": ">=18.0.0 <19.0.0"
},
@@ -42,7 +42,7 @@
"@standardnotes/domain-core": "workspace:^",
"@standardnotes/domain-events": "workspace:*",
"@standardnotes/domain-events-infra": "workspace:*",
"@standardnotes/features": "^1.58.0",
"@standardnotes/features": "^1.58.1",
"@standardnotes/predicates": "workspace:*",
"@standardnotes/responses": "^1.6.39",
"@standardnotes/security": "workspace:*",

View File

@@ -181,9 +181,9 @@ describe('FeatureService', () => {
describe('offline subscribers', () => {
it('should return user features with `expires_at` field', async () => {
const features = await createService().getFeaturesForOfflineUser('test@test.com')
const featuresResponse = await createService().getFeaturesForOfflineUser('test@test.com')
expect(features).toEqual(
expect(featuresResponse.features).toEqual(
expect.arrayContaining([
expect.objectContaining({
identifier: 'org.standardnotes.theme-autobiography',
@@ -196,7 +196,7 @@ describe('FeatureService', () => {
it('should not return user features if a subscription could not be found', async () => {
offlineUserSubscriptionRepository.findByEmail = jest.fn().mockReturnValue([])
expect(await createService().getFeaturesForOfflineUser('test@test.com')).toEqual([])
expect(await createService().getFeaturesForOfflineUser('test@test.com')).toEqual({ features: [], roles: [] })
})
})

View File

@@ -21,7 +21,7 @@ export class FeatureService implements FeatureServiceInterface {
@inject(TYPES.Timer) private timer: TimerInterface,
) {}
async getFeaturesForOfflineUser(email: string): Promise<FeatureDescription[]> {
async getFeaturesForOfflineUser(email: string): Promise<{ features: FeatureDescription[]; roles: Role[] }> {
const userSubscriptions = await this.offlineUserSubscriptionRepository.findByEmail(
email,
this.timer.getTimestampInMicroseconds(),
@@ -34,7 +34,11 @@ export class FeatureService implements FeatureServiceInterface {
}
}
return this.getFeaturesForSubscriptions(userSubscriptions, [...userRolesMap.values()])
const roles = [...userRolesMap.values()]
return {
features: await this.getFeaturesForSubscriptions(userSubscriptions, roles),
roles,
}
}
async getFeaturesForUser(user: User): Promise<Array<FeatureDescription>> {

View File

@@ -1,8 +1,9 @@
import { FeatureDescription } from '@standardnotes/features'
import { Role } from '../Role/Role'
import { User } from '../User/User'
export interface FeatureServiceInterface {
getFeaturesForUser(user: User): Promise<Array<FeatureDescription>>
getFeaturesForOfflineUser(email: string): Promise<FeatureDescription[]>
getFeaturesForOfflineUser(email: string): Promise<{ features: FeatureDescription[]; roles: Role[] }>
}

View File

@@ -1,5 +1,7 @@
import 'reflect-metadata'
import { FeatureDescription } from '@standardnotes/features'
import { RoleName } from '@standardnotes/domain-core'
import { GetUserFeatures } from './GetUserFeatures'
import { UserRepositoryInterface } from '../../User/UserRepositoryInterface'
import { User } from '../../User/User'
@@ -21,7 +23,9 @@ describe('GetUserFeatures', () => {
feature1 = { name: 'foobar' } as jest.Mocked<FeatureDescription>
featureService = {} as jest.Mocked<FeatureServiceInterface>
featureService.getFeaturesForUser = jest.fn().mockReturnValue([feature1])
featureService.getFeaturesForOfflineUser = jest.fn().mockReturnValue([feature1])
featureService.getFeaturesForOfflineUser = jest
.fn()
.mockReturnValue({ features: [feature1], roles: [RoleName.NAMES.ProUser] })
})
it('should fail if a user is not found', async () => {
@@ -50,11 +54,8 @@ describe('GetUserFeatures', () => {
it('should return offline user features', async () => {
expect(await createUseCase().execute({ email: 'test@test.com', offline: true })).toEqual({
success: true,
features: [
{
name: 'foobar',
},
],
features: [{ name: 'foobar' }],
offlineRoles: [RoleName.NAMES.ProUser],
})
})
})

View File

@@ -15,11 +15,12 @@ export class GetUserFeatures implements UseCaseInterface {
async execute(dto: GetUserFeaturesDto): Promise<GetUserFeaturesResponse> {
if (dto.offline) {
const userFeatures = await this.featureService.getFeaturesForOfflineUser(dto.email)
const { features, roles } = await this.featureService.getFeaturesForOfflineUser(dto.email)
return {
success: true,
features: userFeatures,
features,
offlineRoles: roles,
}
}

View File

@@ -1,9 +1,12 @@
import { FeatureDescription } from '@standardnotes/features'
import { Role } from './../../Role/Role'
export type GetUserFeaturesResponse =
| {
success: true
features: FeatureDescription[]
offlineRoles?: Role[]
userUuid?: string
}
| {

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.9.64",
"version": "1.9.65",
"engines": {
"node": ">=18.0.0 <19.0.0"
},

View File

@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.106.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.105.5...@standardnotes/domain-events@2.106.0) (2023-01-19)
### Features
* offline roles ([#419](https://github.com/standardnotes/server/issues/419)) ([2db0c12](https://github.com/standardnotes/server/commit/2db0c125fe5872c5898103c2388881ab416b5a99))
## [2.105.5](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.105.4...@standardnotes/domain-events@2.105.5) (2023-01-19)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.105.5",
"version": "2.106.0",
"engines": {
"node": ">=18.0.0 <19.0.0"
},
@@ -23,7 +23,7 @@
"test": "jest spec --coverage --passWithNoTests"
},
"dependencies": {
"@standardnotes/features": "^1.58.0",
"@standardnotes/features": "^1.58.1",
"@standardnotes/predicates": "workspace:*",
"@standardnotes/security": "workspace:*"
},

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.9.9",
"version": "1.9.10",
"engines": {
"node": ">=18.0.0 <19.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.10.18](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.10.17...@standardnotes/revisions-server@1.10.18) (2023-01-19)
**Note:** Version bump only for package @standardnotes/revisions-server
## [1.10.17](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.10.16...@standardnotes/revisions-server@1.10.17) (2023-01-19)
**Note:** Version bump only for package @standardnotes/revisions-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.10.17",
"version": "1.10.18",
"engines": {
"node": ">=18.0.0 <19.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.16.14](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.16.13...@standardnotes/scheduler-server@1.16.14) (2023-01-19)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.16.13](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.16.12...@standardnotes/scheduler-server@1.16.13) (2023-01-19)
**Note:** Version bump only for package @standardnotes/scheduler-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.16.13",
"version": "1.16.14",
"engines": {
"node": ">=18.0.0 <19.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.29.5](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.29.4...@standardnotes/syncing-server@1.29.5) (2023-01-19)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.29.4](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.29.3...@standardnotes/syncing-server@1.29.4) (2023-01-19)
**Note:** Version bump only for package @standardnotes/syncing-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.29.4",
"version": "1.29.5",
"engines": {
"node": ">=18.0.0 <19.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.5.10](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.5.9...@standardnotes/websockets-server@1.5.10) (2023-01-19)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.5.9](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.5.8...@standardnotes/websockets-server@1.5.9) (2023-01-19)
**Note:** Version bump only for package @standardnotes/websockets-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/websockets-server",
"version": "1.5.9",
"version": "1.5.10",
"engines": {
"node": ">=18.0.0 <19.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.19.13](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.19.12...@standardnotes/workspace-server@1.19.13) (2023-01-19)
**Note:** Version bump only for package @standardnotes/workspace-server
## [1.19.12](https://github.com/standardnotes/server/compare/@standardnotes/workspace-server@1.19.11...@standardnotes/workspace-server@1.19.12) (2023-01-19)
**Note:** Version bump only for package @standardnotes/workspace-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/workspace-server",
"version": "1.19.12",
"version": "1.19.13",
"engines": {
"node": ">=18.0.0 <19.0.0"
},

View File

@@ -1987,7 +1987,7 @@ __metadata:
"@standardnotes/domain-core": "workspace:^"
"@standardnotes/domain-events": "workspace:*"
"@standardnotes/domain-events-infra": "workspace:*"
"@standardnotes/features": "npm:^1.58.0"
"@standardnotes/features": "npm:^1.58.1"
"@standardnotes/predicates": "workspace:*"
"@standardnotes/responses": "npm:^1.6.39"
"@standardnotes/security": "workspace:*"
@@ -2045,7 +2045,7 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/common@npm:^1.19.1, @standardnotes/common@npm:^1.23.1, @standardnotes/common@npm:^1.39.0, @standardnotes/common@npm:^1.43.0, @standardnotes/common@npm:^1.45.0, @standardnotes/common@workspace:*, @standardnotes/common@workspace:^, @standardnotes/common@workspace:packages/common":
"@standardnotes/common@npm:^1.19.1, @standardnotes/common@npm:^1.23.1, @standardnotes/common@npm:^1.39.0, @standardnotes/common@npm:^1.43.0, @standardnotes/common@npm:^1.46.3, @standardnotes/common@workspace:*, @standardnotes/common@workspace:^, @standardnotes/common@workspace:packages/common":
version: 0.0.0-use.local
resolution: "@standardnotes/common@workspace:packages/common"
dependencies:
@@ -2073,7 +2073,7 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/domain-core@workspace:^, @standardnotes/domain-core@workspace:packages/domain-core":
"@standardnotes/domain-core@npm:^1.11.1, @standardnotes/domain-core@workspace:^, @standardnotes/domain-core@workspace:packages/domain-core":
version: 0.0.0-use.local
resolution: "@standardnotes/domain-core@workspace:packages/domain-core"
dependencies:
@@ -2116,7 +2116,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@standardnotes/domain-events@workspace:packages/domain-events"
dependencies:
"@standardnotes/features": "npm:^1.58.0"
"@standardnotes/features": "npm:^1.58.1"
"@standardnotes/predicates": "workspace:*"
"@standardnotes/security": "workspace:*"
"@types/jest": "npm:^29.1.1"
@@ -2195,15 +2195,16 @@ __metadata:
languageName: node
linkType: hard
"@standardnotes/features@npm:^1.58.0":
version: 1.58.0
resolution: "@standardnotes/features@npm:1.58.0"
"@standardnotes/features@npm:^1.58.1":
version: 1.58.1
resolution: "@standardnotes/features@npm:1.58.1"
dependencies:
"@standardnotes/auth": "npm:^3.19.4"
"@standardnotes/common": "npm:^1.45.0"
"@standardnotes/common": "npm:^1.46.3"
"@standardnotes/domain-core": "npm:^1.11.1"
"@standardnotes/security": "npm:^1.7.0"
reflect-metadata: "npm:^0.1.13"
checksum: 028c13956ab8d848b9deec1d3ca2db55edb35b25fd5ab8e7c8f4dd5983396a68a709c239ffab9dd5091ad63906a799eb09ceea8fdcbff845fc5302cf2c30f2c2
checksum: 558e4506d873c5bede4966d32274b5bd6365b2f11fa7885ffa64ad5db18d9465e741253c07af1173b130b15129763a9fbeaebe4efdf96037d900ea57ad3e6e44
languageName: node
linkType: hard