@xyo-network/archivist-express 5.3.20 → 5.3.24

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/archivist-express",
3
- "version": "5.3.20",
3
+ "version": "5.3.24",
4
4
  "description": "Primary SDK for using XYO Protocol 2.0",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -30,26 +30,34 @@
30
30
  "types": "dist/node/index.d.ts",
31
31
  "files": [
32
32
  "dist",
33
- "src",
34
33
  "!**/*.bench.*",
35
34
  "!**/*.spec.*",
36
- "!**/*.test.*"
35
+ "!**/*.test.*",
36
+ "README.md"
37
37
  ],
38
38
  "dependencies": {
39
- "@xyo-network/archivist-model": "~5.3.20",
40
- "@xyo-network/payload-builder": "~5.3.20",
41
- "@xyo-network/payload-model": "~5.3.20"
39
+ "@xyo-network/archivist-model": "~5.3.24",
40
+ "@xyo-network/payload-builder": "~5.3.24",
41
+ "@xyo-network/payload-model": "~5.3.24"
42
42
  },
43
43
  "devDependencies": {
44
+ "@opentelemetry/api": "^1.9.1",
44
45
  "@types/express": "^5.0.6",
45
- "@xylabs/express": "^5.0.90",
46
- "@xylabs/sdk-js": "^5.0.90",
47
- "@xylabs/ts-scripts-common": "~7.5.6",
48
- "@xylabs/ts-scripts-yarn3": "~7.5.6",
49
- "@xylabs/tsconfig": "~7.5.6",
46
+ "@types/node": "^25.5.0",
47
+ "@xylabs/express": "^5.0.93",
48
+ "@xylabs/sdk-js": "^5.0.93",
49
+ "@xylabs/ts-scripts-common": "~7.6.16",
50
+ "@xylabs/ts-scripts-pnpm": "~7.6.16",
51
+ "@xylabs/tsconfig": "~7.6.16",
52
+ "acorn": "^8.16.0",
53
+ "axios": "^1.14.0",
54
+ "esbuild": "^0.28.0",
50
55
  "express": "^5.2.1",
51
56
  "typescript": "~5.9.3",
52
- "zod": "^4.3.6"
57
+ "zod": "^4.3.6",
58
+ "@xyo-network/payload-builder": "~5.3.24",
59
+ "@xyo-network/archivist-model": "~5.3.24",
60
+ "@xyo-network/payload-model": "~5.3.24"
53
61
  },
54
62
  "peerDependencies": {
55
63
  "@xylabs/express": "^5",
@@ -60,4 +68,4 @@
60
68
  "publishConfig": {
61
69
  "access": "public"
62
70
  }
63
- }
71
+ }
@@ -1,65 +0,0 @@
1
- import { setRawResponseFormat } from '@xylabs/express'
2
- import {
3
- asHash, isDefined, isHash,
4
- } from '@xylabs/sdk-js'
5
- import type {
6
- ArchivistInstance,
7
- ArchivistNextOptions, NextOptions,
8
- } from '@xyo-network/archivist-model'
9
- import { PayloadBuilder } from '@xyo-network/payload-builder'
10
- import type { Payload } from '@xyo-network/payload-model'
11
- import { isAnyPayload, isSequence } from '@xyo-network/payload-model'
12
- import type { Request, Router } from 'express'
13
- import express from 'express'
14
-
15
- type ArchivistMiddlewareOptions = {
16
- archivist: ArchivistInstance
17
- }
18
-
19
- export const archivistRestMiddleware = (options: ArchivistMiddlewareOptions): Router => {
20
- const { archivist } = options
21
- const router = express.Router({ mergeParams: true })
22
-
23
- router.post('/insert', async (req, res) => {
24
- setRawResponseFormat(res)
25
- const body = Array.isArray(req.body) ? req.body : [req.body]
26
- const payloads = (await PayloadBuilder.hashPairs<Payload>(body)).map(p => p[0])
27
- const result = await archivist.insert(payloads)
28
- res.status(200).json(result)
29
- })
30
-
31
- router.get('/next', async (req: Request<Partial<NextOptions>>, res) => {
32
- setRawResponseFormat(res)
33
- const cursor = isSequence(req.query.cursor) ? req.query.cursor : undefined
34
- const limit = isDefined(req.query.limit) ? Number(req.query.limit) : undefined
35
- const open = isDefined(req.query.open) ? Boolean(req.query.open) : undefined
36
- const order = req.query.order === 'asc' ? 'asc' : 'desc'
37
- const options: ArchivistNextOptions = {
38
- limit, open, order, cursor,
39
- }
40
- const result = await archivist.next(options)
41
- res.status(200).json(result)
42
- })
43
- router.post('/next', async (req: Request<{}, {}, ArchivistNextOptions | undefined>, res) => {
44
- setRawResponseFormat(res)
45
- const options = req.body
46
- const result = await (isDefined(options) ? archivist.next(options) : archivist.next())
47
- res.status(200).json(result)
48
- })
49
-
50
- router.get('/get/:hash', async (req, res) => {
51
- setRawResponseFormat(res)
52
- const { hash: rawHash } = req.params
53
- const hash = asHash(rawHash)
54
- if (isHash(hash)) {
55
- const [payload] = await archivist.get([hash])
56
- if (isAnyPayload(payload)) {
57
- res.json(payload)
58
- return
59
- }
60
- }
61
- res.status(400).send()
62
- })
63
-
64
- return router
65
- }
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './archivistRestMiddleware.ts'