@praesidias/api-gateway 0.0.0-stage → 0.1.1

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,70 @@
1
1
  {
2
2
  "name": "@praesidias/api-gateway",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "A gateway in front of the outside APIs an agent calls: every request is checked with Praesidias, and the agent never holds the API's credentials.",
5
+ "license": "Apache-2.0",
6
+ "author": "Praesidias",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/sowainat/praesidias-kit.git",
10
+ "directory": "packages/api-gateway"
11
+ },
12
+ "homepage": "https://github.com/sowainat/praesidias-kit/tree/main/packages/api-gateway#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/sowainat/praesidias-kit/issues"
15
+ },
16
+ "keywords": [
17
+ "praesidias",
18
+ "api-gateway",
19
+ "reverse-proxy",
20
+ "ai-agents",
21
+ "governance",
22
+ "credentials"
23
+ ],
24
+ "type": "module",
25
+ "main": "./dist/index.cjs",
26
+ "types": "./dist/index.d.ts",
27
+ "bin": {
28
+ "praesidias-api-gateway": "./dist/cli.js"
29
+ },
30
+ "files": [
31
+ "LICENSE",
32
+ "README.md",
33
+ "dist",
34
+ "praesidias.gateway.example.json"
35
+ ],
36
+ "engines": {
37
+ "node": ">=18.17"
38
+ },
39
+ "dependencies": {
40
+ "@praesidias/sdk": "0.1.1"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^22.10.0",
44
+ "tsup": "^8.3.5",
45
+ "tsx": "^4.23.15",
46
+ "typescript": "^5.7.2",
47
+ "vitest": "^3.2.4"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "module": "./dist/index.js",
53
+ "exports": {
54
+ ".": {
55
+ "import": {
56
+ "types": "./dist/index.d.ts",
57
+ "default": "./dist/index.js"
58
+ },
59
+ "require": {
60
+ "types": "./dist/index.d.cts",
61
+ "default": "./dist/index.cjs"
62
+ }
63
+ }
64
+ },
65
+ "scripts": {
66
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean --target node18 && tsup src/cli.ts --format esm --target node18",
67
+ "typecheck": "tsc --noEmit",
68
+ "test": "vitest run"
69
+ }
6
70
  }
@@ -0,0 +1,35 @@
1
+ {
2
+ "system": "payments",
3
+ "listen": { "host": "127.0.0.1", "port": 8787 },
4
+ "upstreams": {
5
+ "bank": {
6
+ "baseUrl": "https://api.bank.example",
7
+ "credential": {
8
+ "from": "env",
9
+ "name": "BANK_API_KEY",
10
+ "header": "authorization",
11
+ "scheme": "Bearer"
12
+ },
13
+ "routes": [
14
+ {
15
+ "method": "POST",
16
+ "path": "/v1/transfers",
17
+ "action": "TRANSFER_UNDER_10K",
18
+ "resource": { "type": "payment", "idFrom": "body.payment_id" },
19
+ "context": ["body.amount", "body.currency"],
20
+ "when": [
21
+ { "if": { "arg": "body.amount", "gt": 250000 }, "action": "TRANSFER_OVER_250K" },
22
+ { "if": { "arg": "body.amount", "gte": 10000 }, "action": "TRANSFER_10K_TO_250K" }
23
+ ]
24
+ },
25
+ {
26
+ "method": "POST",
27
+ "path": "/v1/orders/:orderId/refund",
28
+ "action": "REFUND_ORDER",
29
+ "resource": { "type": "order", "idFrom": "params.orderId" }
30
+ },
31
+ { "method": "GET", "path": "/v1/accounts/:id/balance", "ungoverned": true }
32
+ ]
33
+ }
34
+ }
35
+ }