@boxrouter/sdk 0.0.0-stage → 0.0.1-alpha.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 +202 -0
- package/NOTICE +16 -0
- package/README.md +35 -2
- package/dist/client/client.gen.d.ts +2 -0
- package/dist/client/client.gen.js +216 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.js +6 -0
- package/dist/client/types.gen.d.ts +120 -0
- package/dist/client/types.gen.js +2 -0
- package/dist/client/utils.gen.d.ts +37 -0
- package/dist/client/utils.gen.js +228 -0
- package/dist/client.gen.d.ts +12 -0
- package/dist/client.gen.js +3 -0
- package/dist/core/auth.gen.d.ts +25 -0
- package/dist/core/auth.gen.js +14 -0
- package/dist/core/bodySerializer.gen.d.ts +25 -0
- package/dist/core/bodySerializer.gen.js +57 -0
- package/dist/core/params.gen.d.ts +43 -0
- package/dist/core/params.gen.js +109 -0
- package/dist/core/pathSerializer.gen.d.ts +33 -0
- package/dist/core/pathSerializer.gen.js +106 -0
- package/dist/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/core/queryKeySerializer.gen.js +92 -0
- package/dist/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/core/serverSentEvents.gen.js +132 -0
- package/dist/core/types.gen.d.ts +83 -0
- package/dist/core/types.gen.js +2 -0
- package/dist/core/utils.gen.d.ts +19 -0
- package/dist/core/utils.gen.js +87 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/sdk.gen.d.ts +25 -0
- package/dist/sdk.gen.js +16 -0
- package/dist/types.gen.d.ts +190 -0
- package/dist/types.gen.js +2 -0
- package/package.json +25 -4
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
export type ClientOptions = {
|
|
2
|
+
baseUrl: `${string}://${string}` | (string & {});
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* The provider routes this workspace can use now, one entry per connected account or managed
|
|
6
|
+
* supply, in the shape `match` reports for an eligible route (its declared gates, resources,
|
|
7
|
+
* attested facts and lifetime). It lists no route the workspace cannot use, and its
|
|
8
|
+
* capabilities come from the same adapter declarations `match` reads.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export type ProviderPage = {
|
|
12
|
+
data: Array<EligibleRoute>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* One candidate that fits, with the contract it would grant.
|
|
16
|
+
*/
|
|
17
|
+
export type EligibleRoute = {
|
|
18
|
+
provider: string;
|
|
19
|
+
class: string | null;
|
|
20
|
+
account_id: string | null;
|
|
21
|
+
supply: string;
|
|
22
|
+
adapter_version: string;
|
|
23
|
+
gates: {
|
|
24
|
+
[key: string]: GrantedGate;
|
|
25
|
+
};
|
|
26
|
+
resources: {
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
attested: {
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
lifetime: Lifetime;
|
|
33
|
+
ranking?: EligibleRouteRanking;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* One gate as granted to this sandbox.
|
|
37
|
+
*/
|
|
38
|
+
export type GrantedGate = {
|
|
39
|
+
/**
|
|
40
|
+
* Index into the declaration of route.adapter_version. Only meaningful with that version.
|
|
41
|
+
*/
|
|
42
|
+
variant: number;
|
|
43
|
+
/**
|
|
44
|
+
* The weakest basis among the granted values; for a gate granted with no named knob, the variant's own.
|
|
45
|
+
*/
|
|
46
|
+
basis: 'implemented' | 'proven';
|
|
47
|
+
/**
|
|
48
|
+
* One entry per knob the request named: the granted values for a pick-one knob, the
|
|
49
|
+
* string "any" where the request said so, the boolean for a yes/no knob, the declared
|
|
50
|
+
* number for a number knob. This is what the code may rely on.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
granted: {
|
|
54
|
+
[key: string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The variant's other answers, including declared limits, for information. Calls that depend on them are refused.
|
|
58
|
+
*/
|
|
59
|
+
also: {
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
};
|
|
62
|
+
settings: {
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Set when the account has since lost the gate; that gate's calls then answer gate_unavailable.
|
|
67
|
+
*/
|
|
68
|
+
unavailable: string | null;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* How long the provider lets the sandbox live. It counts from the provider's create, as
|
|
72
|
+
* with the provider's own SDK (BoxRouter's clock starts when it sends the create), and the
|
|
73
|
+
* provider's own timer ends the sandbox (enforcer provider). Whether paused or stopped
|
|
74
|
+
* time counts depends on the provider.
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export type Lifetime = {
|
|
78
|
+
seconds: number;
|
|
79
|
+
/**
|
|
80
|
+
* As of observed_at. Equal to seconds while creating, and frozen while the sandbox is not running.
|
|
81
|
+
*/
|
|
82
|
+
remaining_seconds: number;
|
|
83
|
+
/**
|
|
84
|
+
* Set only while running. The end never comes before it; how soon after is not
|
|
85
|
+
* promised. The provider's own deadline when ends_at_source is provider. Null while
|
|
86
|
+
* creating, paused, stopped or ended.
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
ends_at: string | null;
|
|
90
|
+
/**
|
|
91
|
+
* Whose time ends_at is. provider: the provider's own reported deadline (E2B endAt,
|
|
92
|
+
* Daytona autoDestroyAt, Blaxel createdAt plus the lifetime). recorded: BoxRouter's
|
|
93
|
+
* own, the create request's time plus the lifetime. Null when ends_at is null. Cloud
|
|
94
|
+
* sends it on every lifetime; it is not required only because recorded responses
|
|
95
|
+
* from before it existed lack it.
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
ends_at_source?: 'provider' | 'recorded' | null;
|
|
99
|
+
/**
|
|
100
|
+
* While paused or stopped: when the sandbox is destroyed if it is not resumed, 30
|
|
101
|
+
* days after it last ran, sooner where the provider keeps it for less. A provider
|
|
102
|
+
* whose own timer keeps counting paused time (Daytona, Blaxel) ends the sandbox when
|
|
103
|
+
* its lifetime runs out even while paused, so kept_until is that moment when it
|
|
104
|
+
* falls inside the 30 days; extending the lifetime moves it. Providers that stop the
|
|
105
|
+
* clock while paused (E2B, Modal, Vercel) keep the full 30 days.
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
kept_until: string | null;
|
|
109
|
+
at_end: 'destroy' | 'pause';
|
|
110
|
+
/**
|
|
111
|
+
* Who acts when the time runs out. The hosted API never returns none.
|
|
112
|
+
*/
|
|
113
|
+
enforcer: 'provider' | 'router' | 'none';
|
|
114
|
+
/**
|
|
115
|
+
* The route's longest single run, from one start to the next pause or end, as
|
|
116
|
+
* narrowed for this account. A declared number: an integer, "unlimited", "unknown"
|
|
117
|
+
* or a floor.
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
max_seconds: number | 'unlimited' | 'unknown' | {
|
|
121
|
+
at_least: number;
|
|
122
|
+
};
|
|
123
|
+
extendable: boolean;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Why this route sits where it does in the order creation would try, with the price estimate
|
|
127
|
+
* the order may rest on. It explains the ordering of this dry run; creation re-ranks with the
|
|
128
|
+
* signals of that moment. Absent on responses from a Cloud that predates it.
|
|
129
|
+
*
|
|
130
|
+
*/
|
|
131
|
+
export type EligibleRouteRanking = {
|
|
132
|
+
/**
|
|
133
|
+
* Place in the order creation would try, 1 first.
|
|
134
|
+
*/
|
|
135
|
+
position: number;
|
|
136
|
+
/**
|
|
137
|
+
* Why the route ranks here. explicit_order is your own provider order; after_named_providers is a provider behind the ones you named; provider_key_order is
|
|
138
|
+
* a later key of a provider already placed; price_unknown is a managed route with no quote,
|
|
139
|
+
* tried after routes that have one. New values may appear.
|
|
140
|
+
*
|
|
141
|
+
*/
|
|
142
|
+
reason: 'lowest_price' | 'weighted_price' | 'fastest_ready' | 'fastest_run' | 'predicted_completion' | 'predicted_ready_time' | 'explicit_order' | 'after_named_providers' | 'provider_key_order' | 'only_eligible_route' | 'health_deprioritized' | 'latency_preference_missed' | 'price_unknown' | 'no_signals';
|
|
143
|
+
/**
|
|
144
|
+
* The reason in one sentence.
|
|
145
|
+
*/
|
|
146
|
+
explanation: string;
|
|
147
|
+
/**
|
|
148
|
+
* What this route would cost per hour at the size it would grant.
|
|
149
|
+
*/
|
|
150
|
+
estimate: {
|
|
151
|
+
/**
|
|
152
|
+
* Null when the size is unknown or the price version has no quote for it.
|
|
153
|
+
*/
|
|
154
|
+
usd_per_hour: string | null;
|
|
155
|
+
kind: 'list_estimate' | 'unknown';
|
|
156
|
+
/**
|
|
157
|
+
* The size priced and whose price it is, or why there is no estimate.
|
|
158
|
+
*/
|
|
159
|
+
basis: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export type ListProvidersData = {
|
|
163
|
+
body?: never;
|
|
164
|
+
path?: never;
|
|
165
|
+
query?: never;
|
|
166
|
+
url: '/providers';
|
|
167
|
+
};
|
|
168
|
+
export type ListProvidersErrors = {
|
|
169
|
+
/**
|
|
170
|
+
* Structured error. Unowned and unknown resource IDs both return 404. Admission overload returns 503 with code overloaded, outcome not_started and Retry-After. It reserves no operation and dispatches no provider work. Shared workspace/provider admission budgets return 429 with code rate_limited, outcome not_started and Retry-After. An incomplete request body can return 408 request_timeout before dispatch. Durable-state failures return 503 database_unavailable with outcome unknown; do not infer that execution did not occur. A read (GET or HEAD) that meets the same failure changed nothing: its message says the state is temporarily unavailable, and it is safe to repeat. A provider that cannot be reached when a create is prepared returns 502 provider_error with outcome not_started; nothing was created, and the create can be retried with the same Idempotency-Key or sent to another provider with `providers`.
|
|
171
|
+
* Native errors are sanitized; upstream credentials, request bodies and
|
|
172
|
+
* another workspace's metadata are never included. Server-Timing is present only when the response reached Dispatcher or held-response preparation; an earlier response, including pre-Dispatcher admission overload, may omit it.
|
|
173
|
+
*
|
|
174
|
+
*/
|
|
175
|
+
401: unknown;
|
|
176
|
+
/**
|
|
177
|
+
* Structured error. Unowned and unknown resource IDs both return 404. Admission overload returns 503 with code overloaded, outcome not_started and Retry-After. It reserves no operation and dispatches no provider work. Shared workspace/provider admission budgets return 429 with code rate_limited, outcome not_started and Retry-After. An incomplete request body can return 408 request_timeout before dispatch. Durable-state failures return 503 database_unavailable with outcome unknown; do not infer that execution did not occur. A read (GET or HEAD) that meets the same failure changed nothing: its message says the state is temporarily unavailable, and it is safe to repeat. A provider that cannot be reached when a create is prepared returns 502 provider_error with outcome not_started; nothing was created, and the create can be retried with the same Idempotency-Key or sent to another provider with `providers`.
|
|
178
|
+
* Native errors are sanitized; upstream credentials, request bodies and
|
|
179
|
+
* another workspace's metadata are never included. Server-Timing is present only when the response reached Dispatcher or held-response preparation; an earlier response, including pre-Dispatcher admission overload, may omit it.
|
|
180
|
+
*
|
|
181
|
+
*/
|
|
182
|
+
default: unknown;
|
|
183
|
+
};
|
|
184
|
+
export type ListProvidersResponses = {
|
|
185
|
+
/**
|
|
186
|
+
* Routes available to this workspace.
|
|
187
|
+
*/
|
|
188
|
+
200: ProviderPage;
|
|
189
|
+
};
|
|
190
|
+
export type ListProvidersResponse = ListProvidersResponses[keyof ListProvidersResponses];
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxrouter/sdk",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-alpha.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Early read-only BoxRouter provider discovery client",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.18.0"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"NOTICE",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"tag": "alpha"
|
|
26
|
+
}
|
|
27
|
+
}
|