Skip to content

Commit

Permalink
Add FreeTextRequestItem (#47)
Browse files Browse the repository at this point in the history
* feat: add FreeTextRequestItem

* refactor: wording

* chore: bump version

* chore: update license
  • Loading branch information
Milena-Czierlinski authored Feb 19, 2025
1 parent 5e8b4e1 commit 12a9a81
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 j&s-soft GmbH
Copyright 2025 j&s-soft AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
4 changes: 2 additions & 2 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
@@ -1,9 +1,9 @@
{
"name": "@nmshd/connector-tui",
"version": "2.2.2",
"version": "2.3.0",
"repository": "github:nmshd/connector-tui",
"license": "MIT",
"author": "j&s-soft GmbH",
"author": "j&s-soft AG",
"type": "module",
"main": "dist/index.js",
"types": "src/index.d.ts",
Expand Down
23 changes: 23 additions & 0 deletions src/mixins/AddSendRequestByMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
AuthenticationRequestItemJSON,
ConsentRequestItemJSON,
CreateAttributeRequestItemJSON,
FreeTextRequestItemJSON,
ProposeAttributeRequestItemJSON,
ReadAttributeRequestItemJSON,
RegisterAttributeListenerRequestItemJSON,
Expand Down Expand Up @@ -78,6 +79,10 @@ export function AddSendRequestByMessage<TBase extends ConnectorTUIBaseConstructo
title: "AuthenticationRequestItem",
value: this.createAuthenticationRequestItem.bind(this),
},
{
title: "FreeTextRequestItem",
value: this.createFreeTextRequestItem.bind(this),
},
{
title: "No more items please",
value: "no-more",
Expand Down Expand Up @@ -629,5 +634,23 @@ export function AddSendRequestByMessage<TBase extends ConnectorTUIBaseConstructo

return requestItem
}

private async createFreeTextRequestItem() {
const result = await prompts([
{
message: "Enter a free text",
type: "text",
name: "freeText",
},
])

const requestItem: FreeTextRequestItemJSON = {
"@type": "FreeTextRequestItem",
mustBeAccepted: true,
freeText: result.freeText,
}

return requestItem
}
}
}

0 comments on commit 12a9a81

Please sign in to comment.