@uninspired/unproxied-client 0.0.13 → 0.0.15

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chris Kolb
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,15 +1,50 @@
1
1
  # @uninspired/unproxied-client
2
2
 
3
- To install dependencies:
3
+ Typed client for the Unproxied API. It is built on Hono's RPC client, so requests and responses are typed from the API router.
4
+
5
+ ## Install
4
6
 
5
7
  ```bash
6
- bun install
8
+ npm install @uninspired/unproxied-client
9
+ ```
10
+
11
+ The package ships ESM (`import`) and CommonJS (`require`) builds, with TypeScript declarations for both.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { makeUnproxiedClient } from "@uninspired/unproxied-client";
17
+
18
+ const client = makeUnproxiedClient("https://unproxied.example.com", process.env.UNPROXIED_API_KEY!);
19
+
20
+ const res = await client.api.v1.domains[":domainId"].$get({ param: { domainId: "123" } });
7
21
  ```
8
22
 
9
- To run:
23
+ ```js
24
+ const { makeUnproxiedClient } = require("@uninspired/unproxied-client");
25
+ ```
26
+
27
+ ## Development
10
28
 
11
29
  ```bash
12
- bun run src/index.ts
30
+ bun install
31
+ bun run build # dist/esm, dist/cjs and dist/types
32
+ bun run smoke # packs the package and loads it with require() and import()
33
+ ```
34
+
35
+ ## Publishing
36
+
37
+ Publishing is manual:
38
+
39
+ ```sh
40
+ cd packages/api-client
41
+ bun run build -- --bump # build + bump patch version in package.json
42
+ bun run smoke # verify require() and import() work in Node
43
+ npm publish --access public
44
+ git commit -am "chore(api-client): release v$(node -p "require('./package.json').version")"
45
+ git tag "api-client-v$(node -p "require('./package.json').version")"
13
46
  ```
14
47
 
15
- This project was created using `bun init` in bun v1.2.22. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
48
+ ## License
49
+
50
+ MIT
@@ -0,0 +1,4 @@
1
+ var{defineProperty:p,getOwnPropertyNames:s,getOwnPropertyDescriptor:u}=Object,d=Object.prototype.hasOwnProperty;function x(e){return this[e]}var y=(e)=>{var t=(n??=new WeakMap).get(e),r;if(t)return t;if(t=p({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var i of s(e))if(!d.call(t,i))p(t,i,{get:x.bind(e,i),enumerable:!(r=u(e,i))||r.enumerable})}return n.set(e,t),t},n;var R=(e)=>e;function l(e,t){this[e]=R.bind(null,t)}var m=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0,configurable:!0,set:l.bind(t,r)})};var a={};m(a,{makeUnproxiedClient:()=>C});module.exports=y(a);var o=require("hono/client"),C=(e,t,r)=>o.hc(e,{...r,headers:{...r?.headers,"X-API-Key":t}});
2
+
3
+ //# debugId=C77DFDBFFECED6AF64756E2164756E21
4
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": [
5
+ "import type { ApiRouter } from \"@unproxied/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type UnproxiedClient = ReturnType<typeof hc<ApiRouter>>;\n\nexport const makeUnproxiedClient = (\n baseUrl: string,\n apiKey: string,\n options?: ClientRequestOptions,\n): UnproxiedClient => {\n return hc<ApiRouter>(baseUrl, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-API-Key\": apiKey,\n },\n });\n};\n"
6
+ ],
7
+ "mappings": "imBAC8C,IAA9C,yBAIa,EAAsB,CACjC,EACA,EACA,IAEO,KAAc,EAAS,IACzB,EACH,QAAS,IACJ,GAAS,QACZ,YAAa,CACf,CACF,CAAC",
8
+ "debugId": "C77DFDBFFECED6AF64756E2164756E21",
9
+ "names": []
10
+ }
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import{hc as i}from"hono/client";var n=(t,r,e)=>{return i(t,{...e,headers:{...e?.headers,"X-API-Key":r}})};export{n as makeUnproxiedClient};
1
+ import{hc as i}from"hono/client";var n=(t,r,e)=>i(t,{...e,headers:{...e?.headers,"X-API-Key":r}});export{n as makeUnproxiedClient};
2
2
 
3
- //# debugId=E1429FE8877974F764756E2164756E21
3
+ //# debugId=EAD73852AA222F7664756E2164756E21
4
4
  //# sourceMappingURL=index.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
4
  "sourcesContent": [
5
- "import type { ApiRouter } from \"@unproxied/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type UnproxiedClient = ReturnType<typeof hc<ApiRouter>>;\n\nexport const makeUnproxiedClient = (\n baseUrl: string,\n apiKey: string,\n options?: ClientRequestOptions\n): UnproxiedClient => {\n return hc<ApiRouter>(baseUrl, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-API-Key\": apiKey,\n },\n });\n};\n"
5
+ "import type { ApiRouter } from \"@unproxied/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type UnproxiedClient = ReturnType<typeof hc<ApiRouter>>;\n\nexport const makeUnproxiedClient = (\n baseUrl: string,\n apiKey: string,\n options?: ClientRequestOptions,\n): UnproxiedClient => {\n return hc<ApiRouter>(baseUrl, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-API-Key\": apiKey,\n },\n });\n};\n"
6
6
  ],
7
- "mappings": "AACA,aAAS,oBAIF,IAAM,EAAsB,CACjC,EACA,EACA,IACoB,CACpB,OAAO,EAAc,EAAS,IACzB,EACH,QAAS,IACJ,GAAS,QACZ,YAAa,CACf,CACF,CAAC",
8
- "debugId": "E1429FE8877974F764756E2164756E21",
7
+ "mappings": "AACA,aAAS,oBAIF,IAAM,EAAsB,CACjC,EACA,EACA,IAEO,EAAc,EAAS,IACzB,EACH,QAAS,IACJ,GAAS,QACZ,YAAa,CACf,CACF,CAAC",
8
+ "debugId": "EAD73852AA222F7664756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -0,0 +1,146 @@
1
+ import * as hono_hono_base from 'hono/hono-base';
2
+ import * as hono_utils_http_status from 'hono/utils/http-status';
3
+ import * as hono_types from 'hono/types';
4
+ import { hc, ClientRequestOptions } from 'hono/client';
5
+
6
+ declare const apiRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_types.BlankSchema | hono_types.MergeSchemaPath<{
7
+ "/": {
8
+ $post: {
9
+ input: {
10
+ header: {
11
+ "X-App-Secret": string;
12
+ };
13
+ } & {
14
+ json: {
15
+ name: string;
16
+ };
17
+ };
18
+ output: "Unauthorized";
19
+ outputFormat: "text";
20
+ status: 401;
21
+ } | {
22
+ input: {
23
+ header: {
24
+ "X-App-Secret": string;
25
+ };
26
+ } & {
27
+ json: {
28
+ name: string;
29
+ };
30
+ };
31
+ output: {
32
+ apiKey: string;
33
+ };
34
+ outputFormat: "json";
35
+ status: 201;
36
+ };
37
+ };
38
+ } & {
39
+ "/": {
40
+ $delete: {
41
+ input: {};
42
+ output: "Deleted";
43
+ outputFormat: "text";
44
+ status: 200;
45
+ };
46
+ };
47
+ }, "/api/v1/api-keys"> | hono_types.MergeSchemaPath<{
48
+ "/": {
49
+ $post: {
50
+ input: {
51
+ json: {
52
+ serverName: string;
53
+ proxyUrl: string;
54
+ };
55
+ };
56
+ output: {
57
+ domainId: string;
58
+ };
59
+ outputFormat: "json";
60
+ status: 201;
61
+ };
62
+ };
63
+ } & {
64
+ "/:domainId": {
65
+ $get: {
66
+ input: {
67
+ param: {
68
+ domainId: string;
69
+ };
70
+ };
71
+ output: "Not found";
72
+ outputFormat: "text";
73
+ status: 404;
74
+ } | {
75
+ input: {
76
+ param: {
77
+ domainId: string;
78
+ };
79
+ };
80
+ output: {
81
+ id: string;
82
+ serverName: string;
83
+ proxyUrl: string;
84
+ verificationToken: string;
85
+ domainVerified: boolean;
86
+ tlsActive: boolean;
87
+ publicHostname: string;
88
+ };
89
+ outputFormat: "json";
90
+ status: hono_utils_http_status.ContentfulStatusCode;
91
+ };
92
+ };
93
+ } & {
94
+ "/:domainId": {
95
+ $put: {
96
+ input: {
97
+ param: {
98
+ domainId: string;
99
+ };
100
+ } & {
101
+ json: {
102
+ serverName: string;
103
+ proxyUrl: string;
104
+ };
105
+ };
106
+ output: "Updated";
107
+ outputFormat: "text";
108
+ status: 200;
109
+ };
110
+ };
111
+ } & {
112
+ "/:domainId": {
113
+ $delete: {
114
+ input: {
115
+ param: {
116
+ domainId: string;
117
+ };
118
+ };
119
+ output: "Deleted";
120
+ outputFormat: "text";
121
+ status: 200;
122
+ };
123
+ };
124
+ } & {
125
+ "/:domainId/validate": {
126
+ $post: {
127
+ input: {
128
+ param: {
129
+ domainId: string;
130
+ };
131
+ };
132
+ output: {
133
+ domainVerified: boolean;
134
+ };
135
+ outputFormat: "json";
136
+ status: 200;
137
+ };
138
+ };
139
+ }, "/api/v1/domains">, "/api/v1", "/api/v1">;
140
+ type ApiRouter = typeof apiRouter;
141
+
142
+ type UnproxiedClient = ReturnType<typeof hc<ApiRouter>>;
143
+ declare const makeUnproxiedClient: (baseUrl: string, apiKey: string, options?: ClientRequestOptions) => UnproxiedClient;
144
+
145
+ export { makeUnproxiedClient };
146
+ export type { UnproxiedClient };
@@ -6,6 +6,19 @@ import { hc, ClientRequestOptions } from 'hono/client';
6
6
  declare const apiRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_types.BlankSchema | hono_types.MergeSchemaPath<{
7
7
  "/": {
8
8
  $post: {
9
+ input: {
10
+ header: {
11
+ "X-App-Secret": string;
12
+ };
13
+ } & {
14
+ json: {
15
+ name: string;
16
+ };
17
+ };
18
+ output: "Unauthorized";
19
+ outputFormat: "text";
20
+ status: 401;
21
+ } | {
9
22
  input: {
10
23
  header: {
11
24
  "X-App-Secret": string;
@@ -23,17 +36,9 @@ declare const apiRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_types
23
36
  };
24
37
  };
25
38
  } & {
26
- "/:apiKeyId": {
39
+ "/": {
27
40
  $delete: {
28
- input: {
29
- header: {
30
- "X-App-Secret": string;
31
- };
32
- } & {
33
- param: {
34
- apiKeyId: string;
35
- };
36
- };
41
+ input: {};
37
42
  output: "Deleted";
38
43
  outputFormat: "text";
39
44
  status: 200;
@@ -124,12 +129,14 @@ declare const apiRouter: hono_hono_base.HonoBase<hono_types.BlankEnv, hono_types
124
129
  domainId: string;
125
130
  };
126
131
  };
127
- output: "Success";
128
- outputFormat: "text";
132
+ output: {
133
+ domainVerified: boolean;
134
+ };
135
+ outputFormat: "json";
129
136
  status: 200;
130
137
  };
131
138
  };
132
- }, "/api/v1/domains">, "/api/v1">;
139
+ }, "/api/v1/domains">, "/api/v1", "/api/v1">;
133
140
  type ApiRouter = typeof apiRouter;
134
141
 
135
142
  type UnproxiedClient = ReturnType<typeof hc<ApiRouter>>;
package/package.json CHANGED
@@ -1,35 +1,52 @@
1
1
  {
2
2
  "name": "@uninspired/unproxied-client",
3
- "main": "dist/cjs/index.js",
4
- "module": "dist/esm/index.js",
5
- "types": "dist/types/index.d.ts",
6
- "type": "module",
3
+ "version": "0.0.15",
7
4
  "private": false,
8
- "version": "0.0.13",
9
- "description": "Auth client for Uninspired Studio Products",
10
- "author": "Chris Kolb <chris@uninspired.studio>",
5
+ "description": "Typed client for the Unproxied API",
11
6
  "license": "MIT",
7
+ "author": "Chris Kolb <chris@uninspired.studio>",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/UninspiredStudio/unproxied.git",
11
+ "directory": "packages/api-client"
12
+ },
12
13
  "files": [
13
- "package.json",
14
- "dist"
14
+ "dist",
15
+ "LICENSE",
16
+ "README.md"
15
17
  ],
18
+ "type": "module",
19
+ "sideEffects": false,
20
+ "main": "./dist/cjs/index.cjs",
21
+ "module": "./dist/esm/index.js",
22
+ "types": "./dist/types/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "import": {
26
+ "types": "./dist/types/index.d.ts",
27
+ "default": "./dist/esm/index.js"
28
+ },
29
+ "require": {
30
+ "types": "./dist/types/index.d.cts",
31
+ "default": "./dist/cjs/index.cjs"
32
+ }
33
+ }
34
+ },
16
35
  "scripts": {
17
- "build": "bun run scripts/build.ts"
36
+ "build": "bun run scripts/build.ts",
37
+ "prepublishOnly": "bun run build",
38
+ "smoke": "bash scripts/smoke-test.sh"
39
+ },
40
+ "dependencies": {
41
+ "hono": "^4.11.4"
18
42
  },
19
43
  "devDependencies": {
20
- "@types/bun": "latest",
44
+ "@types/bun": "1.4.4",
21
45
  "@types/semver": "^7.7.1",
22
46
  "@unproxied/api": "workspace:*",
23
47
  "rollup": "^4.52.5",
24
48
  "rollup-plugin-dts": "^6.2.3",
25
- "rollup-plugin-typescript": "^1.0.1",
26
49
  "rollup-plugin-typescript-paths": "^1.5.0",
27
50
  "semver": "^7.7.3"
28
- },
29
- "peerDependencies": {
30
- "typescript": "^5"
31
- },
32
- "dependencies": {
33
- "hono": "4.9.12"
34
51
  }
35
52
  }
package/dist/cjs/index.js DELETED
@@ -1,4 +0,0 @@
1
- var{defineProperty:p,getOwnPropertyNames:s,getOwnPropertyDescriptor:u}=Object,d=Object.prototype.hasOwnProperty;var n=new WeakMap,x=(t)=>{var e=n.get(t),r;if(e)return e;if(e=p({},"__esModule",{value:!0}),t&&typeof t==="object"||typeof t==="function")s(t).map((i)=>!d.call(e,i)&&p(e,i,{get:()=>t[i],enumerable:!(r=u(t,i))||r.enumerable}));return n.set(t,e),e};var y=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0,configurable:!0,set:(i)=>e[r]=()=>i})};var l={};y(l,{makeUnproxiedClient:()=>R});module.exports=x(l);var o=require("hono/client"),R=(t,e,r)=>{return o.hc(t,{...r,headers:{...r?.headers,"X-API-Key":e}})};
2
-
3
- //# debugId=4150A254172300FC64756E2164756E21
4
- //# sourceMappingURL=index.js.map
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/index.ts"],
4
- "sourcesContent": [
5
- "import type { ApiRouter } from \"@unproxied/api\";\nimport { hc, type ClientRequestOptions } from \"hono/client\";\n\nexport type UnproxiedClient = ReturnType<typeof hc<ApiRouter>>;\n\nexport const makeUnproxiedClient = (\n baseUrl: string,\n apiKey: string,\n options?: ClientRequestOptions\n): UnproxiedClient => {\n return hc<ApiRouter>(baseUrl, {\n ...options,\n headers: {\n ...options?.headers,\n \"X-API-Key\": apiKey,\n },\n });\n};\n"
6
- ],
7
- "mappings": "ugBAC8C,IAA9C,yBAIa,EAAsB,CACjC,EACA,EACA,IACoB,CACpB,OAAO,KAAc,EAAS,IACzB,EACH,QAAS,IACJ,GAAS,QACZ,YAAa,CACf,CACF,CAAC",
8
- "debugId": "4150A254172300FC64756E2164756E21",
9
- "names": []
10
- }