@slimcloud/gust-server 0.1.1 → 0.1.2
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/README.md +51 -12
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -1,36 +1,63 @@
|
|
|
1
1
|
# @slimcloud/gust-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@slimcloud/gust-server)
|
|
4
|
+
[](https://www.npmjs.com/package/@slimcloud/gust-server)
|
|
5
|
+
[](https://www.npmjs.com/package/@slimcloud/gust-server)
|
|
4
6
|
|
|
5
|
-
**
|
|
7
|
+
Privileged **full Gust SDK** for Node / BFF use only. It exposes the same `GustClient` façade as [`@slimcloud/gust-client`](https://www.npmjs.com/package/@slimcloud/gust-client); the difference is the transport — Event-RPC to the private `gust-api` after `apiKey` → `sessionToken` resolution.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
> **Do not import this package from browser bundles.** Privileged functions live in the `/server` entry point; the root entry is browser-safe and only re-exports the client façade.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
8
12
|
|
|
13
|
+
```bash
|
|
14
|
+
npm install @slimcloud/gust-server
|
|
15
|
+
# or: pnpm add @slimcloud/gust-server
|
|
9
16
|
```
|
|
17
|
+
|
|
18
|
+
TypeScript declarations are bundled; no separate `@types` package is required.
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- **Node.js** `>=22 <23` (the privileged entry uses `better-sqlite3` and `node:fs`).
|
|
23
|
+
- CommonJS build with `.d.ts` declarations.
|
|
24
|
+
- A Gust backend URL and an API key or Orchestrator key — all held server-side.
|
|
25
|
+
|
|
26
|
+
## Topology
|
|
27
|
+
|
|
28
|
+
```text
|
|
10
29
|
Browser ──tRPC WS / Event-RPC echo──► Tenant (Armada)
|
|
11
30
|
──@slimcloud/gust-server──► gust-api Event-RPC (private)
|
|
12
31
|
```
|
|
13
32
|
|
|
14
|
-
- Browser never dials `gust-api
|
|
15
|
-
-
|
|
16
|
-
- `gust-api` stays Event-RPC; the customer edge is tRPC (with Event-RPC echo for streams)
|
|
33
|
+
- Browser never dials `gust-api`.
|
|
34
|
+
- The tenant authenticates the user, then forwards via this package (or a sessionToken bridge).
|
|
35
|
+
- `gust-api` stays Event-RPC; the customer edge is tRPC (with Event-RPC echo for streams).
|
|
17
36
|
|
|
18
37
|
## Usage
|
|
19
38
|
|
|
39
|
+
The browser-safe root entry gives you the same client surface:
|
|
40
|
+
|
|
20
41
|
```ts
|
|
21
|
-
import {
|
|
42
|
+
import { GustClient } from "@slimcloud/gust-server";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Privileged resolution helpers are imported from the explicit `/server` entry:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { connectWithApiKey, resolveUser } from "@slimcloud/gust-server/server";
|
|
22
49
|
|
|
23
|
-
// Privileged resolve + connect
|
|
24
50
|
const client = await connectWithApiKey({
|
|
25
51
|
url: process.env.GUST_BACKEND_URL!,
|
|
26
|
-
apiKey: process.env.GUST_API_KEY!,
|
|
52
|
+
apiKey: process.env.GUST_API_KEY!, // server-side only
|
|
27
53
|
user: { externalId, email, name },
|
|
28
54
|
});
|
|
29
55
|
|
|
30
|
-
// Same methods as browser SDK
|
|
31
56
|
const scopes = await client.scopes.listForUser();
|
|
32
57
|
```
|
|
33
58
|
|
|
59
|
+
### Orchestrator-key connection
|
|
60
|
+
|
|
34
61
|
For a tenant-bound Orchestrator key, connect without a tenant API key. Gust resolves the tenant and scoped Orchestrator identity from the key:
|
|
35
62
|
|
|
36
63
|
```ts
|
|
@@ -42,12 +69,15 @@ const client = await connectWithOrchestratorKey({
|
|
|
42
69
|
});
|
|
43
70
|
```
|
|
44
71
|
|
|
45
|
-
New Orchestrator keys are bound to the tenant active when Armada creates or mints them. Older keys without a tenant binding
|
|
72
|
+
New Orchestrator keys are bound to the tenant active when Armada creates or mints them. Older keys without a tenant binding still require the tenant API key during resolution.
|
|
73
|
+
|
|
74
|
+
### Other server exports
|
|
46
75
|
|
|
76
|
+
`resolveUser`, `connect`, `SqliteKVStore`, `createStore`, and their option types are all available from `@slimcloud/gust-server/server`.
|
|
47
77
|
|
|
48
78
|
## Must-proxy Event-RPC surface (Armada / Fierce)
|
|
49
79
|
|
|
50
|
-
|
|
80
|
+
A catch-all forward covers the long tail. Hottest paths used by Armada:
|
|
51
81
|
|
|
52
82
|
| Domain | Examples |
|
|
53
83
|
|--------|----------|
|
|
@@ -61,3 +91,12 @@ Catch-all forward covers the long tail. Hottest paths used by Armada:
|
|
|
61
91
|
| Workflow / secrets / MCP / orgs / usage | corresponding `*:request` pairs |
|
|
62
92
|
|
|
63
93
|
Echo strategy: **catch-all first** (`gust.request` / `gust.send` / `gust.events`), plus optional named tRPC sugar for list/hot paths.
|
|
94
|
+
|
|
95
|
+
## Links
|
|
96
|
+
|
|
97
|
+
- npm: <https://www.npmjs.com/package/@slimcloud/gust-server>
|
|
98
|
+
- Source: <https://dev.azure.com/SlimCloud/SlimCloud/_git/gust-platform>
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slimcloud/gust-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Privileged full Gust SDK for Node/BFF (resolveUser, apiKey connect, same façade as @slimcloud/gust-client).",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,10 +20,15 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
|
|
25
|
+
"dev": "tsc --watch --preserveWatchOutput",
|
|
26
|
+
"prepare": "node -e \"process.exit(0)\""
|
|
27
|
+
},
|
|
23
28
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"@slimcloud/gust-
|
|
26
|
-
"
|
|
29
|
+
"@slimcloud/gust-client": "workspace:*",
|
|
30
|
+
"@slimcloud/gust-types": "workspace:*",
|
|
31
|
+
"better-sqlite3": "^12.6.2"
|
|
27
32
|
},
|
|
28
33
|
"devDependencies": {
|
|
29
34
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -37,9 +42,5 @@
|
|
|
37
42
|
"publishConfig": {
|
|
38
43
|
"registry": "https://registry.npmjs.org/",
|
|
39
44
|
"access": "public"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
|
|
43
|
-
"dev": "tsc --watch --preserveWatchOutput"
|
|
44
45
|
}
|
|
45
|
-
}
|
|
46
|
+
}
|