@xemahq/public-gateway-internal-api-client 0.1.0
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 +201 -0
- package/README.md +62 -0
- package/dist/custom-fetch.d.ts +23 -0
- package/dist/custom-fetch.js +131 -0
- package/dist/endpoints/routes/routes.d.ts +33 -0
- package/dist/endpoints/routes/routes.js +97 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -0
- package/dist/models/authScheme.d.ts +15 -0
- package/dist/models/authScheme.js +17 -0
- package/dist/models/errorDetailsDto.d.ts +12 -0
- package/dist/models/errorDetailsDto.js +2 -0
- package/dist/models/errorDetailsDtoDetails.d.ts +13 -0
- package/dist/models/errorDetailsDtoDetails.js +9 -0
- package/dist/models/errorPayloadDto.d.ts +13 -0
- package/dist/models/errorPayloadDto.js +2 -0
- package/dist/models/errorResponseDto.d.ts +11 -0
- package/dist/models/errorResponseDto.js +2 -0
- package/dist/models/extendRouteDto.d.ts +11 -0
- package/dist/models/extendRouteDto.js +9 -0
- package/dist/models/gatewayRouteDto.d.ts +44 -0
- package/dist/models/gatewayRouteDto.js +2 -0
- package/dist/models/gatewayRouteDtoDataArrayEnvelope.d.ts +11 -0
- package/dist/models/gatewayRouteDtoDataArrayEnvelope.js +2 -0
- package/dist/models/gatewayRouteDtoDataEnvelope.d.ts +11 -0
- package/dist/models/gatewayRouteDtoDataEnvelope.js +2 -0
- package/dist/models/index.d.ts +15 -0
- package/dist/models/index.js +32 -0
- package/dist/models/registerRouteDto.d.ts +29 -0
- package/dist/models/registerRouteDto.js +2 -0
- package/dist/models/routeAuthParamsDto.d.ts +17 -0
- package/dist/models/routeAuthParamsDto.js +9 -0
- package/dist/models/routeKind.d.ts +16 -0
- package/dist/models/routeKind.js +18 -0
- package/dist/models/routeLifecycle.d.ts +14 -0
- package/dist/models/routeLifecycle.js +16 -0
- package/dist/models/routeMatchDto.d.ts +15 -0
- package/dist/models/routeMatchDto.js +9 -0
- package/dist/models/routeRegistryControllerListParams.d.ts +13 -0
- package/dist/models/routeRegistryControllerListParams.js +9 -0
- package/package.json +38 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
172
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
173
|
+
claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Xema
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!-- Generated by @xemahq/api-client-generator. Do not edit by hand. -->
|
|
2
|
+
<p align="center">
|
|
3
|
+
<svg width="680" height="120" viewBox="0 0 680 120" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="@xemahq/public-gateway-internal-api-client">
|
|
4
|
+
<rect width="680" height="120" rx="14" fill="#0B1020"/>
|
|
5
|
+
<g transform="translate(28,34)">
|
|
6
|
+
<path d="M26 0 L52 15 L52 45 L26 60 L0 45 L0 15 Z" fill="#14B8A6" opacity="0.18"/>
|
|
7
|
+
<path d="M26 12 L41 21 L41 39 L26 48 L11 39 L11 21 Z" fill="#14B8A6"/>
|
|
8
|
+
</g>
|
|
9
|
+
<text x="92" y="52" font-family="ui-monospace,SFMono-Regular,Menlo,monospace" font-size="22" fill="#F8FAFC" font-weight="700">@xemahq/public-gateway-internal-api-client</text>
|
|
10
|
+
<text x="92" y="80" font-family="ui-sans-serif,system-ui,sans-serif" font-size="15" fill="#94A3B8">Typed, generated internal HTTP client for the Public Gateway API.</text>
|
|
11
|
+
<text x="652" y="105" text-anchor="end" font-family="ui-sans-serif,system-ui,sans-serif" font-size="12" fill="#475569">xema.dev</text>
|
|
12
|
+
</svg>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://xema.dev">Website</a> ·
|
|
17
|
+
<a href="https://www.npmjs.com/package/@xemahq/public-gateway-internal-api-client">npm</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img alt="npm" src="https://img.shields.io/npm/v/%40xemahq%2Fpublic-gateway-internal-api-client?color=2563eb&label=npm">
|
|
22
|
+
<img alt="license" src="https://img.shields.io/npm/l/%40xemahq%2Fpublic-gateway-internal-api-client?color=10b981">
|
|
23
|
+
<img alt="types" src="https://img.shields.io/npm/types/%40xemahq%2Fpublic-gateway-internal-api-client?color=3178c6">
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
# @xemahq/public-gateway-internal-api-client
|
|
27
|
+
|
|
28
|
+
> Typed, generated internal HTTP client for the Public Gateway API.
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
|
|
32
|
+
Auto-generated TypeScript client for the **Public Gateway API**. It exports typed
|
|
33
|
+
request functions and response models that mirror the service's OpenAPI surface,
|
|
34
|
+
so callers get end-to-end type safety without hand-writing HTTP calls. This
|
|
35
|
+
package is produced by `@xemahq/api-client-generator` and regenerated whenever
|
|
36
|
+
the service's API changes — do not edit it by hand.
|
|
37
|
+
|
|
38
|
+
## When to use it
|
|
39
|
+
|
|
40
|
+
- Use it from any TypeScript service or app that calls the Public Gateway API over HTTP.
|
|
41
|
+
- You get compile-time types for every endpoint and payload; regenerate to pick
|
|
42
|
+
up API changes rather than editing the client.
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pnpm add @xemahq/public-gateway-internal-api-client
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// Every endpoint function and response model is exported from the package root.
|
|
54
|
+
import * as client from '@xemahq/public-gateway-internal-api-client';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Call the typed endpoint functions; request and response shapes are fully typed
|
|
58
|
+
from the service's OpenAPI spec.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
Proprietary — © Xema. All rights reserved. — [xema.dev](https://xema.dev)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ClientConfig {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
/**
|
|
4
|
+
* Per-request base-URL resolver. When set, the peer URL is resolved from
|
|
5
|
+
* the service registry on EVERY request (boot-order-safe). Wired by
|
|
6
|
+
* `configureOrvalClientResolved` from `@xemahq/platform-common`.
|
|
7
|
+
*/
|
|
8
|
+
baseUrlResolver?: () => string | Promise<string>;
|
|
9
|
+
getAuthToken?: () => Promise<string>;
|
|
10
|
+
getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
11
|
+
onUnauthorized?: () => Promise<void>;
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare class ClientError extends Error {
|
|
15
|
+
readonly status: number;
|
|
16
|
+
readonly url: string;
|
|
17
|
+
readonly body: unknown;
|
|
18
|
+
constructor(status: number, url: string, body: unknown);
|
|
19
|
+
}
|
|
20
|
+
export declare function configureClient(config: ClientConfig): void;
|
|
21
|
+
export declare function getClientConfig(): ClientConfig;
|
|
22
|
+
export declare const customFetch: <T>(url: string, options: RequestInit) => Promise<T>;
|
|
23
|
+
export default customFetch;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customFetch = exports.ClientError = void 0;
|
|
4
|
+
exports.configureClient = configureClient;
|
|
5
|
+
exports.getClientConfig = getClientConfig;
|
|
6
|
+
class ClientError extends Error {
|
|
7
|
+
status;
|
|
8
|
+
url;
|
|
9
|
+
body;
|
|
10
|
+
constructor(status, url, body) {
|
|
11
|
+
super(`HTTP ${status} from ${url}`);
|
|
12
|
+
this.status = status;
|
|
13
|
+
this.url = url;
|
|
14
|
+
this.body = body;
|
|
15
|
+
this.name = 'ClientError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ClientError = ClientError;
|
|
19
|
+
let clientConfig = null;
|
|
20
|
+
function configureClient(config) {
|
|
21
|
+
clientConfig = config;
|
|
22
|
+
}
|
|
23
|
+
function getClientConfig() {
|
|
24
|
+
if (!clientConfig) {
|
|
25
|
+
throw new Error('Client not configured. Call configureClient({ baseUrl }) before using endpoint functions.');
|
|
26
|
+
}
|
|
27
|
+
return clientConfig;
|
|
28
|
+
}
|
|
29
|
+
const RETRYABLE_STATUSES = [429, 502, 503, 504];
|
|
30
|
+
async function buildHeaders(config, callerHeaders) {
|
|
31
|
+
const headers = new Headers(callerHeaders);
|
|
32
|
+
if (config.getHeaders) {
|
|
33
|
+
const globalHeaders = await Promise.resolve(config.getHeaders());
|
|
34
|
+
for (const [key, value] of Object.entries(globalHeaders)) {
|
|
35
|
+
if (!headers.has(key)) {
|
|
36
|
+
headers.set(key, value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (config.getAuthToken && !headers.has('Authorization')) {
|
|
41
|
+
const token = await config.getAuthToken();
|
|
42
|
+
headers.set('Authorization', `Bearer ${token}`);
|
|
43
|
+
}
|
|
44
|
+
return headers;
|
|
45
|
+
}
|
|
46
|
+
const customFetch = async (url, options) => {
|
|
47
|
+
const config = getClientConfig();
|
|
48
|
+
const base = config.baseUrlResolver
|
|
49
|
+
? await config.baseUrlResolver()
|
|
50
|
+
: config.baseUrl;
|
|
51
|
+
if (base === undefined) {
|
|
52
|
+
throw new Error('Client not configured: set baseUrl or baseUrlResolver via configureClient().');
|
|
53
|
+
}
|
|
54
|
+
const fullUrl = `${base}${url}`;
|
|
55
|
+
const maxRetries = config.maxRetries ?? 3;
|
|
56
|
+
const headers = await buildHeaders(config, options.headers);
|
|
57
|
+
const requestInit = { ...options, headers };
|
|
58
|
+
let delay = 1000;
|
|
59
|
+
let lastError;
|
|
60
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
61
|
+
try {
|
|
62
|
+
const response = await fetch(fullUrl, requestInit);
|
|
63
|
+
if (response.status === 401 && config.onUnauthorized && attempt === 0) {
|
|
64
|
+
await config.onUnauthorized();
|
|
65
|
+
const refreshedHeaders = await buildHeaders(config, options.headers);
|
|
66
|
+
const retryResponse = await fetch(fullUrl, { ...options, headers: refreshedHeaders });
|
|
67
|
+
const retryBody = await parseBody(retryResponse);
|
|
68
|
+
if (retryResponse.status >= 400) {
|
|
69
|
+
throw new ClientError(retryResponse.status, fullUrl, retryBody);
|
|
70
|
+
}
|
|
71
|
+
return retryBody;
|
|
72
|
+
}
|
|
73
|
+
if (!RETRYABLE_STATUSES.includes(response.status) || attempt >= maxRetries) {
|
|
74
|
+
const body = await parseBody(response);
|
|
75
|
+
if (response.status >= 400) {
|
|
76
|
+
throw new ClientError(response.status, fullUrl, body);
|
|
77
|
+
}
|
|
78
|
+
return body;
|
|
79
|
+
}
|
|
80
|
+
const retryAfter = parseRetryAfter(response.headers.get('Retry-After'));
|
|
81
|
+
const waitMs = retryAfter ?? addJitter(delay);
|
|
82
|
+
await sleep(waitMs);
|
|
83
|
+
delay = Math.min(delay * 2, 30_000);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error instanceof ClientError) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
90
|
+
if (attempt >= maxRetries) {
|
|
91
|
+
throw lastError;
|
|
92
|
+
}
|
|
93
|
+
const waitMs = addJitter(delay);
|
|
94
|
+
await sleep(waitMs);
|
|
95
|
+
delay = Math.min(delay * 2, 30_000);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
throw lastError ?? new Error(`All retries exhausted for ${fullUrl}`);
|
|
99
|
+
};
|
|
100
|
+
exports.customFetch = customFetch;
|
|
101
|
+
async function parseBody(response) {
|
|
102
|
+
const contentType = response.headers.get('content-type');
|
|
103
|
+
if (contentType?.includes('application/json')) {
|
|
104
|
+
return response.json();
|
|
105
|
+
}
|
|
106
|
+
if (response.status === 204) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return response.text();
|
|
110
|
+
}
|
|
111
|
+
function parseRetryAfter(value) {
|
|
112
|
+
if (!value) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
const seconds = Number(value);
|
|
116
|
+
if (!isNaN(seconds) && seconds >= 0) {
|
|
117
|
+
return seconds * 1000;
|
|
118
|
+
}
|
|
119
|
+
const date = new Date(value);
|
|
120
|
+
if (!isNaN(date.getTime())) {
|
|
121
|
+
return Math.max(0, date.getTime() - Date.now());
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
function addJitter(delay) {
|
|
126
|
+
return delay + (Math.random() * 2 - 1) * delay * 0.25;
|
|
127
|
+
}
|
|
128
|
+
function sleep(ms) {
|
|
129
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
130
|
+
}
|
|
131
|
+
exports.default = exports.customFetch;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { ExtendRouteDto, GatewayRouteDtoDataArrayEnvelope, GatewayRouteDtoDataEnvelope, RegisterRouteDto, RouteRegistryControllerListParams } from '../../models';
|
|
9
|
+
export declare const getRouteRegistryControllerRegisterUrl: () => string;
|
|
10
|
+
/**
|
|
11
|
+
* @summary Register or upsert a dynamic route with lifecycle-specific TTL semantics.
|
|
12
|
+
*/
|
|
13
|
+
export declare const routeRegistryControllerRegister: (registerRouteDto: RegisterRouteDto, options?: RequestInit) => Promise<GatewayRouteDtoDataEnvelope>;
|
|
14
|
+
export declare const getRouteRegistryControllerListUrl: (params?: RouteRegistryControllerListParams) => string;
|
|
15
|
+
/**
|
|
16
|
+
* @summary List dynamic + static routes, optionally filtered by ownerService. Returns the merged view used by the dispatcher.
|
|
17
|
+
*/
|
|
18
|
+
export declare const routeRegistryControllerList: (params?: RouteRegistryControllerListParams, options?: RequestInit) => Promise<GatewayRouteDtoDataArrayEnvelope>;
|
|
19
|
+
export declare const getRouteRegistryControllerHeartbeatUrl: (id: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* @summary Refresh the KernelState lease TTL on a heartbeated route. Rejected for non-heartbeated lifecycles.
|
|
22
|
+
*/
|
|
23
|
+
export declare const routeRegistryControllerHeartbeat: (id: string, options?: RequestInit) => Promise<GatewayRouteDtoDataEnvelope>;
|
|
24
|
+
export declare const getRouteRegistryControllerExtendUrl: (id: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* @summary Extend the expiry on a ttl-lifecycle route. Requires the new expiresAt to be later than the current one.
|
|
27
|
+
*/
|
|
28
|
+
export declare const routeRegistryControllerExtend: (id: string, extendRouteDto: ExtendRouteDto, options?: RequestInit) => Promise<GatewayRouteDtoDataEnvelope>;
|
|
29
|
+
export declare const getRouteRegistryControllerDeleteUrl: (id: string) => string;
|
|
30
|
+
/**
|
|
31
|
+
* @summary Unregister a route. Safe for all lifecycles; used on graceful shutdown, event-close, and manual revoke.
|
|
32
|
+
*/
|
|
33
|
+
export declare const routeRegistryControllerDelete: (id: string, options?: RequestInit) => Promise<unknown>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.routeRegistryControllerDelete = exports.getRouteRegistryControllerDeleteUrl = exports.routeRegistryControllerExtend = exports.getRouteRegistryControllerExtendUrl = exports.routeRegistryControllerHeartbeat = exports.getRouteRegistryControllerHeartbeatUrl = exports.routeRegistryControllerList = exports.getRouteRegistryControllerListUrl = exports.routeRegistryControllerRegister = exports.getRouteRegistryControllerRegisterUrl = void 0;
|
|
4
|
+
const custom_fetch_1 = require("../../custom-fetch");
|
|
5
|
+
const getRouteRegistryControllerRegisterUrl = () => {
|
|
6
|
+
return `/internal/routes`;
|
|
7
|
+
};
|
|
8
|
+
exports.getRouteRegistryControllerRegisterUrl = getRouteRegistryControllerRegisterUrl;
|
|
9
|
+
/**
|
|
10
|
+
* @summary Register or upsert a dynamic route with lifecycle-specific TTL semantics.
|
|
11
|
+
*/
|
|
12
|
+
const routeRegistryControllerRegister = async (registerRouteDto, options) => {
|
|
13
|
+
return (0, custom_fetch_1.customFetch)((0, exports.getRouteRegistryControllerRegisterUrl)(), {
|
|
14
|
+
...options,
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
17
|
+
body: JSON.stringify(registerRouteDto)
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
exports.routeRegistryControllerRegister = routeRegistryControllerRegister;
|
|
21
|
+
const getRouteRegistryControllerListUrl = (params) => {
|
|
22
|
+
const normalizedParams = new URLSearchParams();
|
|
23
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
24
|
+
if (value === undefined)
|
|
25
|
+
return;
|
|
26
|
+
if (value === null) {
|
|
27
|
+
normalizedParams.append(key, 'null');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
for (const item of value) {
|
|
32
|
+
if (item === undefined || item === null)
|
|
33
|
+
continue;
|
|
34
|
+
normalizedParams.append(key, item.toString());
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
normalizedParams.append(key, value.toString());
|
|
39
|
+
});
|
|
40
|
+
const stringifiedParams = normalizedParams.toString();
|
|
41
|
+
return stringifiedParams.length > 0 ? `/internal/routes?${stringifiedParams}` : `/internal/routes`;
|
|
42
|
+
};
|
|
43
|
+
exports.getRouteRegistryControllerListUrl = getRouteRegistryControllerListUrl;
|
|
44
|
+
/**
|
|
45
|
+
* @summary List dynamic + static routes, optionally filtered by ownerService. Returns the merged view used by the dispatcher.
|
|
46
|
+
*/
|
|
47
|
+
const routeRegistryControllerList = async (params, options) => {
|
|
48
|
+
return (0, custom_fetch_1.customFetch)((0, exports.getRouteRegistryControllerListUrl)(params), {
|
|
49
|
+
...options,
|
|
50
|
+
method: 'GET'
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
exports.routeRegistryControllerList = routeRegistryControllerList;
|
|
54
|
+
const getRouteRegistryControllerHeartbeatUrl = (id) => {
|
|
55
|
+
return `/internal/routes/${id}/heartbeat`;
|
|
56
|
+
};
|
|
57
|
+
exports.getRouteRegistryControllerHeartbeatUrl = getRouteRegistryControllerHeartbeatUrl;
|
|
58
|
+
/**
|
|
59
|
+
* @summary Refresh the KernelState lease TTL on a heartbeated route. Rejected for non-heartbeated lifecycles.
|
|
60
|
+
*/
|
|
61
|
+
const routeRegistryControllerHeartbeat = async (id, options) => {
|
|
62
|
+
return (0, custom_fetch_1.customFetch)((0, exports.getRouteRegistryControllerHeartbeatUrl)(id), {
|
|
63
|
+
...options,
|
|
64
|
+
method: 'POST'
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.routeRegistryControllerHeartbeat = routeRegistryControllerHeartbeat;
|
|
68
|
+
const getRouteRegistryControllerExtendUrl = (id) => {
|
|
69
|
+
return `/internal/routes/${id}/extend`;
|
|
70
|
+
};
|
|
71
|
+
exports.getRouteRegistryControllerExtendUrl = getRouteRegistryControllerExtendUrl;
|
|
72
|
+
/**
|
|
73
|
+
* @summary Extend the expiry on a ttl-lifecycle route. Requires the new expiresAt to be later than the current one.
|
|
74
|
+
*/
|
|
75
|
+
const routeRegistryControllerExtend = async (id, extendRouteDto, options) => {
|
|
76
|
+
return (0, custom_fetch_1.customFetch)((0, exports.getRouteRegistryControllerExtendUrl)(id), {
|
|
77
|
+
...options,
|
|
78
|
+
method: 'POST',
|
|
79
|
+
headers: { 'Content-Type': 'application/json', ...options?.headers },
|
|
80
|
+
body: JSON.stringify(extendRouteDto)
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
exports.routeRegistryControllerExtend = routeRegistryControllerExtend;
|
|
84
|
+
const getRouteRegistryControllerDeleteUrl = (id) => {
|
|
85
|
+
return `/internal/routes/${id}`;
|
|
86
|
+
};
|
|
87
|
+
exports.getRouteRegistryControllerDeleteUrl = getRouteRegistryControllerDeleteUrl;
|
|
88
|
+
/**
|
|
89
|
+
* @summary Unregister a route. Safe for all lifecycles; used on graceful shutdown, event-close, and manual revoke.
|
|
90
|
+
*/
|
|
91
|
+
const routeRegistryControllerDelete = async (id, options) => {
|
|
92
|
+
return (0, custom_fetch_1.customFetch)((0, exports.getRouteRegistryControllerDeleteUrl)(id), {
|
|
93
|
+
...options,
|
|
94
|
+
method: 'DELETE'
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.routeRegistryControllerDelete = routeRegistryControllerDelete;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.customFetch = exports.ClientError = exports.getClientConfig = exports.configureClient = void 0;
|
|
18
|
+
// Auto-generated by @xemahq/api-client-generator — do not edit manually.
|
|
19
|
+
var custom_fetch_1 = require("./custom-fetch");
|
|
20
|
+
Object.defineProperty(exports, "configureClient", { enumerable: true, get: function () { return custom_fetch_1.configureClient; } });
|
|
21
|
+
Object.defineProperty(exports, "getClientConfig", { enumerable: true, get: function () { return custom_fetch_1.getClientConfig; } });
|
|
22
|
+
Object.defineProperty(exports, "ClientError", { enumerable: true, get: function () { return custom_fetch_1.ClientError; } });
|
|
23
|
+
Object.defineProperty(exports, "customFetch", { enumerable: true, get: function () { return custom_fetch_1.customFetch; } });
|
|
24
|
+
__exportStar(require("./models"), exports);
|
|
25
|
+
__exportStar(require("./endpoints/routes/routes"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export type AuthScheme = typeof AuthScheme[keyof typeof AuthScheme];
|
|
9
|
+
export declare const AuthScheme: {
|
|
10
|
+
readonly mcp_bridge_jwt: "mcp_bridge_jwt";
|
|
11
|
+
readonly keycloak_jwt: "keycloak_jwt";
|
|
12
|
+
readonly public_signed_url: "public_signed_url";
|
|
13
|
+
readonly internal_token: "internal_token";
|
|
14
|
+
readonly none: "none";
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AuthScheme = void 0;
|
|
11
|
+
exports.AuthScheme = {
|
|
12
|
+
mcp_bridge_jwt: 'mcp_bridge_jwt',
|
|
13
|
+
keycloak_jwt: 'keycloak_jwt',
|
|
14
|
+
public_signed_url: 'public_signed_url',
|
|
15
|
+
internal_token: 'internal_token',
|
|
16
|
+
none: 'none',
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorDetailsDtoDetails } from './errorDetailsDtoDetails.js';
|
|
9
|
+
export interface ErrorDetailsDto {
|
|
10
|
+
/** @nullable */
|
|
11
|
+
details: ErrorDetailsDtoDetails;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @nullable
|
|
10
|
+
*/
|
|
11
|
+
export type ErrorDetailsDtoDetails = {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
} | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorDetailsDto } from './errorDetailsDto.js';
|
|
9
|
+
export interface ErrorPayloadDto {
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
details: ErrorDetailsDto | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorPayloadDto } from './errorPayloadDto.js';
|
|
9
|
+
export interface ErrorResponseDto {
|
|
10
|
+
error: ErrorPayloadDto;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtendRouteDto {
|
|
9
|
+
/** New ISO-8601 expiry. Must be after the current expiresAt. */
|
|
10
|
+
expiresAt: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { AuthScheme } from './authScheme.js';
|
|
9
|
+
import type { RouteAuthParamsDto } from './routeAuthParamsDto.js';
|
|
10
|
+
import type { RouteKind } from './routeKind.js';
|
|
11
|
+
import type { RouteLifecycle } from './routeLifecycle.js';
|
|
12
|
+
import type { RouteMatchDto } from './routeMatchDto.js';
|
|
13
|
+
export interface GatewayRouteDto {
|
|
14
|
+
/** Stable UUID owned by the registrant. Used for heartbeat/delete calls. */
|
|
15
|
+
id: string;
|
|
16
|
+
kind: RouteKind;
|
|
17
|
+
match: RouteMatchDto;
|
|
18
|
+
/** Upstream URL the gateway forwards to. */
|
|
19
|
+
upstream: string;
|
|
20
|
+
authScheme: AuthScheme;
|
|
21
|
+
/** Scheme-specific parameters (verifier key name, required claims, etc.). */
|
|
22
|
+
authParams?: RouteAuthParamsDto;
|
|
23
|
+
/** Whether the gateway should proxy WebSocket upgrades for this route. */
|
|
24
|
+
websocket: boolean;
|
|
25
|
+
/** Path prefix to strip before forwarding. Must start with /. */
|
|
26
|
+
stripPrefix?: string;
|
|
27
|
+
/** Per-request duration cap in ms (safety against runaway long-polling). */
|
|
28
|
+
maxDurationMs?: number;
|
|
29
|
+
/** Service name that owns this route (for audit and self-reconciliation). */
|
|
30
|
+
ownerService: string;
|
|
31
|
+
lifecycle: RouteLifecycle;
|
|
32
|
+
/** Required when lifecycle=heartbeated. Seconds until eviction if no heartbeat. */
|
|
33
|
+
heartbeatTtlSec?: number;
|
|
34
|
+
/** Required when lifecycle=ttl. ISO-8601 wall-clock expiry. */
|
|
35
|
+
expiresAt?: string;
|
|
36
|
+
/** When true, the route is atomically deleted on the first 2xx upstream response. */
|
|
37
|
+
singleUse?: boolean;
|
|
38
|
+
/** When set, counter is decremented on each 2xx response; route deleted when zero. */
|
|
39
|
+
maxUses?: number;
|
|
40
|
+
/** Registration timestamp in ISO-8601. */
|
|
41
|
+
createdAt: string;
|
|
42
|
+
/** Last heartbeat timestamp in ISO-8601 (heartbeated lifecycle only). */
|
|
43
|
+
lastHeartbeatAt?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { GatewayRouteDto } from './gatewayRouteDto.js';
|
|
9
|
+
export interface GatewayRouteDtoDataArrayEnvelope {
|
|
10
|
+
data: GatewayRouteDto[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { GatewayRouteDto } from './gatewayRouteDto.js';
|
|
9
|
+
export interface GatewayRouteDtoDataEnvelope {
|
|
10
|
+
data: GatewayRouteDto;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './authScheme';
|
|
2
|
+
export * from './errorDetailsDto';
|
|
3
|
+
export * from './errorDetailsDtoDetails';
|
|
4
|
+
export * from './errorPayloadDto';
|
|
5
|
+
export * from './errorResponseDto';
|
|
6
|
+
export * from './extendRouteDto';
|
|
7
|
+
export * from './gatewayRouteDto';
|
|
8
|
+
export * from './gatewayRouteDtoDataArrayEnvelope';
|
|
9
|
+
export * from './gatewayRouteDtoDataEnvelope';
|
|
10
|
+
export * from './registerRouteDto';
|
|
11
|
+
export * from './routeAuthParamsDto';
|
|
12
|
+
export * from './routeKind';
|
|
13
|
+
export * from './routeLifecycle';
|
|
14
|
+
export * from './routeMatchDto';
|
|
15
|
+
export * from './routeRegistryControllerListParams';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Auto-generated by tooling/codegen/regenerate-models-barrel.js — do not edit manually.
|
|
18
|
+
__exportStar(require("./authScheme"), exports);
|
|
19
|
+
__exportStar(require("./errorDetailsDto"), exports);
|
|
20
|
+
__exportStar(require("./errorDetailsDtoDetails"), exports);
|
|
21
|
+
__exportStar(require("./errorPayloadDto"), exports);
|
|
22
|
+
__exportStar(require("./errorResponseDto"), exports);
|
|
23
|
+
__exportStar(require("./extendRouteDto"), exports);
|
|
24
|
+
__exportStar(require("./gatewayRouteDto"), exports);
|
|
25
|
+
__exportStar(require("./gatewayRouteDtoDataArrayEnvelope"), exports);
|
|
26
|
+
__exportStar(require("./gatewayRouteDtoDataEnvelope"), exports);
|
|
27
|
+
__exportStar(require("./registerRouteDto"), exports);
|
|
28
|
+
__exportStar(require("./routeAuthParamsDto"), exports);
|
|
29
|
+
__exportStar(require("./routeKind"), exports);
|
|
30
|
+
__exportStar(require("./routeLifecycle"), exports);
|
|
31
|
+
__exportStar(require("./routeMatchDto"), exports);
|
|
32
|
+
__exportStar(require("./routeRegistryControllerListParams"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
import type { AuthScheme } from './authScheme.js';
|
|
9
|
+
import type { RouteAuthParamsDto } from './routeAuthParamsDto.js';
|
|
10
|
+
import type { RouteKind } from './routeKind.js';
|
|
11
|
+
import type { RouteLifecycle } from './routeLifecycle.js';
|
|
12
|
+
import type { RouteMatchDto } from './routeMatchDto.js';
|
|
13
|
+
export interface RegisterRouteDto {
|
|
14
|
+
id: string;
|
|
15
|
+
kind: RouteKind;
|
|
16
|
+
match: RouteMatchDto;
|
|
17
|
+
upstream: string;
|
|
18
|
+
authScheme: AuthScheme;
|
|
19
|
+
authParams?: RouteAuthParamsDto;
|
|
20
|
+
websocket: boolean;
|
|
21
|
+
stripPrefix?: string;
|
|
22
|
+
maxDurationMs?: number;
|
|
23
|
+
ownerService: string;
|
|
24
|
+
lifecycle: RouteLifecycle;
|
|
25
|
+
heartbeatTtlSec?: number;
|
|
26
|
+
expiresAt?: string;
|
|
27
|
+
singleUse?: boolean;
|
|
28
|
+
maxUses?: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export interface RouteAuthParamsDto {
|
|
9
|
+
/** mcp_bridge_jwt / public_signed_url: pin the token to a tenant. */
|
|
10
|
+
expectedOrgId?: string;
|
|
11
|
+
/** mcp_bridge_jwt: pin the token to a specific MCP server id (serviceKey scope). */
|
|
12
|
+
expectedMcpServerId?: string;
|
|
13
|
+
/** public_signed_url: require the query-param token to name this resource id (defence-in-depth). */
|
|
14
|
+
expectedResourceId?: string;
|
|
15
|
+
/** biome_api: biome id the gateway stamps as the upstream `X-Biome-Id` header. Required when `kind = biome_api`. */
|
|
16
|
+
biomeId?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export type RouteKind = typeof RouteKind[keyof typeof RouteKind];
|
|
9
|
+
export declare const RouteKind: {
|
|
10
|
+
readonly output_surface_http: "output_surface_http";
|
|
11
|
+
readonly signed_url: "signed_url";
|
|
12
|
+
readonly mcp_bridge: "mcp_bridge";
|
|
13
|
+
readonly llm_passthrough: "llm_passthrough";
|
|
14
|
+
readonly generic_proxy: "generic_proxy";
|
|
15
|
+
readonly biome_api: "biome_api";
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RouteKind = void 0;
|
|
11
|
+
exports.RouteKind = {
|
|
12
|
+
output_surface_http: 'output_surface_http',
|
|
13
|
+
signed_url: 'signed_url',
|
|
14
|
+
mcp_bridge: 'mcp_bridge',
|
|
15
|
+
llm_passthrough: 'llm_passthrough',
|
|
16
|
+
generic_proxy: 'generic_proxy',
|
|
17
|
+
biome_api: 'biome_api',
|
|
18
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export type RouteLifecycle = typeof RouteLifecycle[keyof typeof RouteLifecycle];
|
|
9
|
+
export declare const RouteLifecycle: {
|
|
10
|
+
readonly static: "static";
|
|
11
|
+
readonly heartbeated: "heartbeated";
|
|
12
|
+
readonly ttl: "ttl";
|
|
13
|
+
readonly event: "event";
|
|
14
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.RouteLifecycle = void 0;
|
|
11
|
+
exports.RouteLifecycle = {
|
|
12
|
+
static: 'static',
|
|
13
|
+
heartbeated: 'heartbeated',
|
|
14
|
+
ttl: 'ttl',
|
|
15
|
+
event: 'event',
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export interface RouteMatchDto {
|
|
9
|
+
/** Exact host match. Must be lowercase — hostnames are case-insensitive per RFC 1035 and the resolver assumes canonical input. */
|
|
10
|
+
host?: string;
|
|
11
|
+
/** Wildcard subdomain apex — request host must be "{label}.{subdomainOf}". Must be lowercase (RFC 1035; resolver assumes canonical input). */
|
|
12
|
+
subdomainOf?: string;
|
|
13
|
+
/** One or more path prefixes (each must start with /). Request path matches if it starts with ANY of the listed prefixes. When omitted, any path matches. */
|
|
14
|
+
pathPrefixes?: string[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v8.16.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Public Gateway API
|
|
5
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
6
|
+
* OpenAPI spec version: 0.1.0
|
|
7
|
+
*/
|
|
8
|
+
export type RouteRegistryControllerListParams = {
|
|
9
|
+
/**
|
|
10
|
+
* Filter by owning service name.
|
|
11
|
+
*/
|
|
12
|
+
ownerService?: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generated by orval v8.16.0 🍺
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
* Public Gateway API
|
|
6
|
+
* Generic streaming edge gateway — internal route registry, hot-reloadable static config, and multi-protocol dispatch.
|
|
7
|
+
* OpenAPI spec version: 0.1.0
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xemahq/public-gateway-internal-api-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"registry": "https://registry.npmjs.org/",
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "5.9.3"
|
|
15
|
+
},
|
|
16
|
+
"xema": {
|
|
17
|
+
"kind": "api-client",
|
|
18
|
+
"surface": "internal",
|
|
19
|
+
"service": "public-gateway-api",
|
|
20
|
+
"biome": "public-gateway",
|
|
21
|
+
"target": "server",
|
|
22
|
+
"generator": "@xemahq/api-client-generator@0.1.2",
|
|
23
|
+
"source": "openapi.internal.json"
|
|
24
|
+
},
|
|
25
|
+
"license": "LicenseRef-Xema-BSL-1.1",
|
|
26
|
+
"author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
|
|
27
|
+
"homepage": "https://xema.dev",
|
|
28
|
+
"bugs": "https://github.com/xema-dev/xema-community/issues",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/xema-dev/xema-community.git",
|
|
32
|
+
"directory": "packages/clients/public-gateway-internal-api"
|
|
33
|
+
},
|
|
34
|
+
"description": "Generated internal API client for the Xema public-gateway-api service.",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json"
|
|
37
|
+
}
|
|
38
|
+
}
|