@ossy/tokens 1.6.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/get.action.js +12 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/tokens",
3
3
  "description": "Token domain — aggregate and events for the Ossy token model",
4
- "version": "1.6.0",
4
+ "version": "1.8.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "main": "./src/index.js",
@@ -25,5 +25,5 @@
25
25
  "/src",
26
26
  "README.md"
27
27
  ],
28
- "gitHead": "9a8a1bb0466d35001425d241d77c2c9ab31e11d3"
28
+ "gitHead": "c6697078268867d88553ca0bac08faad5cea1546"
29
29
  }
@@ -0,0 +1,12 @@
1
+ import { Aggregate } from '@ossy/event-store'
2
+ import { Token } from '@ossy/tokens'
3
+
4
+ export const id = 'tokens/get'
5
+ export const access = 'authenticated'
6
+
7
+ export async function run({ payload, req }) {
8
+ const tokenId = payload?.tokenId ?? req?.params?.tokenId
9
+ if (!tokenId) throw Object.assign(new Error('tokenId is required'), { status: 400 })
10
+
11
+ return Aggregate.Of(Token, tokenId).then(Aggregate.View(Token.Redacted))
12
+ }