@riotpiao/riotpiao-typescript-sdk (0.1.0)

Published 2026-09-27 09:49:13 +00:00 by rock

Installation

@riotpiao:registry=https://forgejo.riotpiao.com/api/packages/riotpiao-poimen/npm/
npm install @riotpiao/[email protected]
"@riotpiao/riotpiao-typescript-sdk": "0.1.0"

About this package

Riotpiao gateway client SDK for TypeScript

Riotpiao TypeScript SDK

TypeScript client library for Riotpiao gateway. Routes requests via X-Service + X-Resource headers.

Installation

npm install @riotpiao/riotpiao-typescript-sdk

Usage

import { RiotpiaoClient } from '@riotpiao/riotpiao-typescript-sdk';

const client = new RiotpiaoClient('https://api.riotpiao.com', 'your-jwt-token');

// SQS: send a message
const resp = await client.callJSON('sqs', 'send-message', 'POST', {
  queue: 'my-queue',
  body: 'hello',
});

// Memory: query
const result = await client.callJSON('memory', 'query', 'POST', {
  query: 'search term',
});

// IAM: list users (GET, no body)
const users = await client.callJSON('iam', 'list-users', 'GET');

// LLM streaming (SSE)
for await (const event of client.streamSSE('llm', 'chat', 'POST', {
  model: 'reasoning',
  stream: true,
  messages: [{ role: 'user', content: 'Hello' }],
})) {
  const data = JSON.parse(event);
  process.stdout.write(data.choices[0].delta.content ?? '');
}

How It Works

client.call("sqs", "send-message", "POST", body)
    │
    ▼
HTTP POST https://api.riotpiao.com
  X-Service: sqs
  X-Resource: send-message
  Authorization: Bearer <token>
  Content-Type: application/json
  Body: {"queue": "my-queue", "body": "hello"}
    │
    ▼
Gateway Dispatcher
  1. Lookup service "sqs" in registry
  2. Lookup resource "send-message" in service
  3. Match HTTP method POST against resource methods
  4. Check JWT capability "sqs:write"
  5. Proxy to upstream

Available Services

Service Resource Method Description
sqs send-message POST Send message to SQS queue
sqs receive-message POST Receive messages from queue
sqs list-queues GET List available queues
workflow execute POST Execute a Temporal workflow
workflow describe GET Describe workflow execution
workflow list GET List workflow executions
memory query POST Query memory service
memory ingest POST Ingest data into memory
memory skills GET List available skills
s3 list-objects GET List S3/MinIO objects
s3 get-object GET Get an object
s3 put-object PUT Upload an object
iam list-roles GET List IAM roles
iam list-users GET List IAM users
iam create-role POST Create an IAM role

Auth

JWT token must contain capability claims:

  • <service>:read for GET/HEAD/OPTIONS
  • <service>:write for POST/PUT/DELETE

Dependencies

Development Dependencies

ID Version
@types/node ^20.0.0
typescript ^5.0.0
Details
npm
2026-09-27 09:49:13 +00:00
55
latest
8.0 KiB
Assets (1)
Versions (1) View all
0.1.0 2026-09-27