busa-sdk 0.17.2 → 0.18.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/dist/airapp-gate.d.ts +74 -114
- package/dist/airapp-gate.js +231 -229
- package/dist/airapp-node.d.ts +97 -52
- package/dist/airapp-node.js +422 -444
- package/dist/airapp.d.ts +102 -147
- package/dist/airapp.js +432 -423
- package/dist/client-CbUceGzy.d.ts +20523 -0
- package/dist/index.d.ts +2807 -2739
- package/dist/index.js +4803 -4029
- package/dist/oauth-Dg2Z41RP.js +173 -0
- package/dist/oauth-FfuT0EGC.d.ts +69 -0
- package/dist/oauth-node-DGiWkh_l.d.ts +64 -0
- package/dist/oauth-node.d.ts +2 -64
- package/dist/oauth-node.js +188 -3
- package/dist/oauth.d.ts +2 -67
- package/dist/oauth.js +2 -2
- package/dist/url-B8GMXalA.js +10 -0
- package/package.json +1 -1
- package/dist/chunk-5NYQX65A.js +0 -6
- package/dist/chunk-C23JVY2Y.js +0 -211
- package/dist/chunk-WSHJMHUS.js +0 -215
- package/dist/client-DIlpYL9z.d.ts +0 -17818
package/dist/airapp-node.d.ts
CHANGED
|
@@ -1,66 +1,111 @@
|
|
|
1
|
-
import { BusabaseAirAppCredentialStoreOptions } from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { t as BusabaseAirAppCredentialStoreOptions } from "./oauth-node-DGiWkh_l.js";
|
|
2
|
+
//#region src/airapp-node.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The env var Busabase injects into every AirApp process it spawns. Nobody else
|
|
5
|
+
* sets it, which is what makes its **absence** the positive fact "standalone".
|
|
6
|
+
*/
|
|
7
|
+
declare const BUSABASE_AIRAPP_RUNTIME_ENV = "BUSABASE_AIRAPP_RUNTIME";
|
|
8
|
+
/**
|
|
9
|
+
* Every runtime Busabase hosts an AirApp in, as known to *this* SDK version.
|
|
10
|
+
*
|
|
11
|
+
* **Informational. Not what decides whether an app is hosted.** That separation
|
|
12
|
+
* is the whole point of this constant existing here rather than being pasted
|
|
13
|
+
* into each app, and getting it backwards is a bug we have already shipped once:
|
|
14
|
+
* every generated AirApp used to carry its own hardcoded copy of this list and
|
|
15
|
+
* answer `hosted` from membership in it. When the `local-node` engine was
|
|
16
|
+
* renamed to `local`, all of them started answering "standalone" *inside a
|
|
17
|
+
* hosted preview* — showing their own connection gate, calling `/api/v1` with no
|
|
18
|
+
* credential, and leaving the operator with nothing to act on.
|
|
19
|
+
*
|
|
20
|
+
* Moving the list into the SDK does not by itself fix that. An app pins an SDK
|
|
21
|
+
* version, so a list that gates behaviour would simply rot on a slower clock:
|
|
22
|
+
* add an engine, and every app on an older SDK is wrong again until it upgrades.
|
|
23
|
+
*
|
|
24
|
+
* So the list names runtimes; {@link isBusabaseAirAppHosted} decides hosting,
|
|
25
|
+
* from presence alone, and needs no upgrade to stay correct.
|
|
26
|
+
*/
|
|
27
|
+
declare const BUSABASE_AIRAPP_RUNTIMES: readonly ["nodepod", "local", "srt", "sandock", "embed"];
|
|
28
|
+
type BusabaseAirAppRuntime = (typeof BUSABASE_AIRAPP_RUNTIMES)[number];
|
|
29
|
+
/** Read the injected runtime, normalised. `""` means nobody hosted this process. */
|
|
30
|
+
declare const readBusabaseAirAppRuntime: (env?: Record<string, string | undefined>) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether Busabase is hosting this process.
|
|
33
|
+
*
|
|
34
|
+
* Presence, never membership — see {@link BUSABASE_AIRAPP_RUNTIMES}. An engine
|
|
35
|
+
* this SDK has never heard of still means "Busabase spawned me", because only
|
|
36
|
+
* Busabase sets the variable at all.
|
|
37
|
+
*/
|
|
38
|
+
declare const isBusabaseAirAppHosted: (runtime?: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Narrow a runtime string to one this SDK knows, or `null`.
|
|
41
|
+
*
|
|
42
|
+
* For code that wants to *branch* on a specific engine — an app that renders
|
|
43
|
+
* differently under a public embed, say. Deliberately returns `null` rather than
|
|
44
|
+
* throwing on an unknown value: a newer Busabase naming an engine this SDK
|
|
45
|
+
* predates is normal, not an error, and the caller should fall back to generic
|
|
46
|
+
* behaviour rather than break.
|
|
47
|
+
*/
|
|
48
|
+
declare const asKnownBusabaseAirAppRuntime: (runtime: string) => BusabaseAirAppRuntime | null;
|
|
4
49
|
declare const BUSABASE_AIRAPP_GATEWAY_REASONS: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
50
|
+
readonly authRequired: "AUTH_REQUIRED";
|
|
51
|
+
readonly authUnavailable: "AUTH_UNAVAILABLE";
|
|
52
|
+
readonly connectionRequired: "CONNECTION_REQUIRED";
|
|
53
|
+
readonly oauthCallbackInvalid: "OAUTH_CALLBACK_INVALID";
|
|
54
|
+
readonly spaceNotAllowed: "SPACE_NOT_ALLOWED";
|
|
55
|
+
readonly spaceSelectionRequired: "SPACE_SELECTION_REQUIRED";
|
|
11
56
|
};
|
|
12
57
|
type GatewayReason = (typeof BUSABASE_AIRAPP_GATEWAY_REASONS)[keyof typeof BUSABASE_AIRAPP_GATEWAY_REASONS];
|
|
13
58
|
interface AuthSpace {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
slug?: string | null;
|
|
62
|
+
plan?: string | null;
|
|
18
63
|
}
|
|
19
64
|
interface GatewayTarget {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
65
|
+
baseUrl: string;
|
|
66
|
+
accessToken: string;
|
|
67
|
+
selectedSpace?: AuthSpace;
|
|
68
|
+
source: "airapp-oauth-local" | "environment" | "open-server";
|
|
24
69
|
}
|
|
25
70
|
interface BusabaseAirAppLocalGatewayOptions {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
71
|
+
appId: string;
|
|
72
|
+
cloudBaseUrl?: string;
|
|
73
|
+
clientId?: string;
|
|
74
|
+
environment?: Record<string, string | undefined>;
|
|
75
|
+
fetch?: typeof fetch;
|
|
76
|
+
now?: () => number;
|
|
77
|
+
oauthPendingTtlMs?: number;
|
|
78
|
+
requestTimeoutMs?: number;
|
|
79
|
+
credentialStore?: BusabaseAirAppCredentialStoreOptions;
|
|
80
|
+
successPath?: string;
|
|
81
|
+
errorPath?: string;
|
|
37
82
|
}
|
|
38
83
|
interface BusabaseAirAppAuthStatus {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
84
|
+
connected: boolean;
|
|
85
|
+
cloudBaseUrl: string;
|
|
86
|
+
baseUrl?: string;
|
|
87
|
+
source?: GatewayTarget["source"];
|
|
88
|
+
readiness: "needs_connection" | "needs_auth" | "needs_space" | "ready" | "retry";
|
|
89
|
+
action: "connect" | "reconnect" | "select_space" | "continue" | "retry";
|
|
90
|
+
requiresSpace?: boolean;
|
|
91
|
+
selectedSpace?: AuthSpace | null;
|
|
92
|
+
space?: AuthSpace | null;
|
|
93
|
+
spaces?: AuthSpace[];
|
|
94
|
+
reason?: GatewayReason;
|
|
95
|
+
message?: string;
|
|
51
96
|
}
|
|
52
97
|
declare class BusabaseAirAppLocalGateway {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
98
|
+
#private;
|
|
99
|
+
constructor(options: BusabaseAirAppLocalGatewayOptions);
|
|
100
|
+
get cloudBaseUrl(): string;
|
|
101
|
+
status(): Promise<BusabaseAirAppAuthStatus>;
|
|
102
|
+
statusResponse: () => Promise<Response>;
|
|
103
|
+
start: (request: Request) => Promise<Response>;
|
|
104
|
+
callback: (request: Request) => Promise<Response>;
|
|
105
|
+
selectSpace: (request: Request) => Promise<Response>;
|
|
106
|
+
logout: (request: Request) => Promise<Response>;
|
|
107
|
+
proxy: (request: Request) => Promise<Response>;
|
|
63
108
|
}
|
|
64
109
|
declare const createBusabaseAirAppLocalGateway: (options: BusabaseAirAppLocalGatewayOptions) => BusabaseAirAppLocalGateway;
|
|
65
|
-
|
|
66
|
-
export { BUSABASE_AIRAPP_GATEWAY_REASONS,
|
|
110
|
+
//#endregion
|
|
111
|
+
export { BUSABASE_AIRAPP_GATEWAY_REASONS, BUSABASE_AIRAPP_RUNTIMES, BUSABASE_AIRAPP_RUNTIME_ENV, BusabaseAirAppAuthStatus, BusabaseAirAppLocalGateway, BusabaseAirAppLocalGatewayOptions, BusabaseAirAppRuntime, asKnownBusabaseAirAppRuntime, createBusabaseAirAppLocalGateway, isBusabaseAirAppHosted, readBusabaseAirAppRuntime };
|