Skip to content

Commit

Permalink
Merge branch 'main' into feature/enhance-references
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus-Kuhn authored Sep 24, 2024
2 parents 2b79db8 + e66bd24 commit 55ee0bb
Show file tree
Hide file tree
Showing 26 changed files with 64 additions and 665 deletions.
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"@js-soft/eslint-config-ts": "^1.6.9",
"@js-soft/license-check": "^1.0.9",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.5",
"@types/node": "^22.6.0",
"enhanced-publish": "^1.1.3",
"eslint": "^8.57.1",
"jest": "^29.7.0",
"jest-expect-message": "^1.1.3",
"madge": "^8.0.0",
"npm-check-updates": "^17.1.1",
"npm-check-updates": "^17.1.3",
"prettier": "^3.3.3",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"devDependencies": {
"@js-soft/web-logger": "^1.0.4",
"@types/lodash": "^4.17.7",
"@types/lodash": "^4.17.9",
"@types/lokijs": "^1.5.14",
"@types/luxon": "^3.4.2"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/app-runtime/src/AppStringProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ export class AppStringProcessor {
return UserfriendlyResult.fail(error);
}

const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerTokenByTruncatedReference({
reference: truncatedReference
});
const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerToken({ reference: truncatedReference });
if (tokenResult.isError) {
return UserfriendlyResult.fail(UserfriendlyApplicationError.fromError(tokenResult.error));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/consumption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@js-soft/docdb-access-mongo": "1.1.9",
"@js-soft/node-logger": "1.2.0",
"@nmshd/crypto": "2.0.6",
"@types/lodash": "^4.17.7"
"@types/lodash": "^4.17.9"
},
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"@js-soft/docdb-access-mongo": "1.1.9",
"@js-soft/node-logger": "1.2.0",
"@types/json-stringify-safe": "^5.0.3",
"@types/lodash": "^4.17.7",
"@types/lodash": "^4.17.9",
"@types/luxon": "^3.4.2",
"@types/qrcode": "^1.5.5",
"ts-json-schema-generator": "2.3.0"
Expand Down
1 change: 0 additions & 1 deletion packages/runtime/src/dataViews/transport/FileDVO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ export interface FileDVO extends DataViewObject {
mimetype: string;
isOwn: boolean;
title: string;
secretKey: string;
truncatedReference: string;
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
import { ApplicationError, Result } from "@js-soft/ts-utils";
import { Inject } from "typescript-ioc";
import { TokenDTO } from "../../../types";
import {
LoadPeerTokenAnonymousByIdAndKeyRequest,
LoadPeerTokenAnonymousByIdAndKeyUseCase,
LoadPeerTokenAnonymousByTruncatedReferenceRequest,
LoadPeerTokenAnonymousByTruncatedReferenceUseCase
} from "../../../useCases";
import { LoadPeerTokenAnonymousRequest, LoadPeerTokenAnonymousUseCase } from "../../../useCases";

export class AnonymousTokensFacade {
public constructor(
@Inject private readonly loadPeerTokenByTruncatedReferenceUseCase: LoadPeerTokenAnonymousByTruncatedReferenceUseCase,
@Inject private readonly loadPeerTokenByIdAndKeyUseCase: LoadPeerTokenAnonymousByIdAndKeyUseCase
) {}
public constructor(@Inject private readonly loadPeerTokenUseCase: LoadPeerTokenAnonymousUseCase) {}

public async loadPeerTokenByTruncatedReference(request: LoadPeerTokenAnonymousByTruncatedReferenceRequest): Promise<Result<TokenDTO, ApplicationError>> {
return await this.loadPeerTokenByTruncatedReferenceUseCase.execute(request);
}

public async loadPeerTokenByIdAndKey(request: LoadPeerTokenAnonymousByIdAndKeyRequest): Promise<Result<TokenDTO, ApplicationError>> {
return await this.loadPeerTokenByIdAndKeyUseCase.execute(request);
public async loadPeerToken(request: LoadPeerTokenAnonymousRequest): Promise<Result<TokenDTO, ApplicationError>> {
return await this.loadPeerTokenUseCase.execute(request);
}
}
1 change: 0 additions & 1 deletion packages/runtime/src/types/transport/FileDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export interface FileDTO {
mimetype: string;
isOwn: boolean;
title: string;
secretKey: string;
description?: string;
truncatedReference: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export interface RelationshipTemplateDTO {
content: RelationshipTemplateContentDerivation;
expiresAt?: string;
maxNumberOfAllocations?: number;
secretKey: string;
truncatedReference: string;
}
1 change: 0 additions & 1 deletion packages/runtime/src/types/transport/TokenDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface TokenDTO {
content: any;
createdAt: string;
expiresAt: string;
secretKey: string;
truncatedReference: string;
isEphemeral: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import { TokenDTO } from "../../../types";
import { SchemaRepository, SchemaValidator, TokenReferenceString, UseCase } from "../../common";
import { TokenMapper } from "../../transport/tokens/TokenMapper";

export interface LoadPeerTokenAnonymousByTruncatedReferenceRequest {
export interface LoadPeerTokenAnonymousRequest {
reference: TokenReferenceString;
}

class Validator extends SchemaValidator<LoadPeerTokenAnonymousByTruncatedReferenceRequest> {
class Validator extends SchemaValidator<LoadPeerTokenAnonymousRequest> {
public constructor(@Inject schemaRepository: SchemaRepository) {
super(schemaRepository.getSchema("LoadPeerTokenAnonymousByTruncatedReferenceRequest"));
super(schemaRepository.getSchema("LoadPeerTokenAnonymousRequest"));
}
}

export class LoadPeerTokenAnonymousByTruncatedReferenceUseCase extends UseCase<LoadPeerTokenAnonymousByTruncatedReferenceRequest, TokenDTO> {
export class LoadPeerTokenAnonymousUseCase extends UseCase<LoadPeerTokenAnonymousRequest, TokenDTO> {
public constructor(
@Inject private readonly anonymousTokenController: AnonymousTokenController,
@Inject validator: Validator
) {
super(validator);
}

protected async executeInternal(request: LoadPeerTokenAnonymousByTruncatedReferenceRequest): Promise<Result<TokenDTO>> {
protected async executeInternal(request: LoadPeerTokenAnonymousRequest): Promise<Result<TokenDTO>> {
const createdToken = await this.anonymousTokenController.loadPeerTokenByTruncated(request.reference);
return Result.ok(TokenMapper.toTokenDTO(createdToken, true));
}
Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions packages/runtime/src/useCases/anonymous/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from "./LoadPeerTokenAnonymousByIdAndKey";
export * from "./LoadPeerTokenAnonymousByTruncatedReference";
export * from "./LoadPeerTokenAnonymous";
Loading

0 comments on commit 55ee0bb

Please sign in to comment.