@le-space/browser 0.1.22

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.
Files changed (4) hide show
  1. package/README.md +49 -0
  2. package/index.d.ts +16 -0
  3. package/index.js +50 -0
  4. package/package.json +18 -0
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @le-space/browser
2
+
3
+ This package is the planned browser/PWA-facing layer for reusable Aleph
4
+ deployment primitives.
5
+
6
+ It is intended to sit between:
7
+
8
+ - `@le-space/core`
9
+ - `@le-space/rootfs`
10
+ - browser applications such as deployment PWAs
11
+
12
+ The package should stay UI-neutral. It should provide browser-safe helpers, but
13
+ it should not own app-specific Svelte state, prepaid product logic, or wallet
14
+ UX.
15
+
16
+ ## Planned v1 Scope
17
+
18
+ The first real extraction wave should cover:
19
+
20
+ - `http.ts`
21
+ - `fetchWithTimeout`
22
+ - `aleph-api.ts`
23
+ - balance fetch
24
+ - CRN fetch
25
+ - instance listing
26
+ - Aleph message broadcast helpers
27
+ - deployment polling and result inspection
28
+ - runtime detail inspection
29
+ - `rootfs.ts`
30
+ - RootFS manifest load
31
+ - RootFS existence check
32
+ - RootFS reference resolution
33
+ - `pricing.ts`
34
+ - instance pricing fetch and parse helpers
35
+
36
+ ## Not In Scope Initially
37
+
38
+ These should remain local to apps until the browser package has a stable base:
39
+
40
+ - wallet-provider integrations
41
+ - prepaid vault flows
42
+ - UI-only formatting helpers
43
+ - Svelte state orchestration
44
+
45
+ ## Source Of Truth
46
+
47
+ The detailed extraction roadmap lives in:
48
+
49
+ - `docs/docusaurus/docs/architecture/browser-extraction-plan.md`
package/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ type BrowserExtractionPhase = 'planned' | 'scaffolded';
2
+ interface BrowserPackagePlan {
3
+ phase: BrowserExtractionPhase;
4
+ modules: string[];
5
+ }
6
+ declare const BROWSER_PACKAGE_PLAN: BrowserPackagePlan;
7
+
8
+ declare function fetchWithTimeout(input: RequestInfo | URL, init?: RequestInit, timeoutMs?: number): Promise<Response>;
9
+
10
+ declare const BROWSER_ALEPH_API_MODULE = "planned";
11
+
12
+ declare const BROWSER_ROOTFS_MODULE = "planned";
13
+
14
+ declare const BROWSER_PRICING_MODULE = "planned";
15
+
16
+ export { BROWSER_ALEPH_API_MODULE, BROWSER_PACKAGE_PLAN, BROWSER_PRICING_MODULE, BROWSER_ROOTFS_MODULE, type BrowserExtractionPhase, type BrowserPackagePlan, fetchWithTimeout };
package/index.js ADDED
@@ -0,0 +1,50 @@
1
+ // src/types.ts
2
+ var BROWSER_PACKAGE_PLAN = {
3
+ phase: "scaffolded",
4
+ modules: ["http", "aleph-api", "rootfs", "pricing"]
5
+ };
6
+
7
+ // src/http.ts
8
+ async function fetchWithTimeout(input, init = {}, timeoutMs = 15e3) {
9
+ const controller = new AbortController();
10
+ const timeout = globalThis.setTimeout(() => controller.abort(), timeoutMs);
11
+ try {
12
+ if (typeof input === "string" || input instanceof URL) {
13
+ const url = new URL(String(input), globalThis.location?.href);
14
+ url.searchParams.set("_ts", String(Date.now()));
15
+ return await fetch(url, {
16
+ ...init,
17
+ cache: init.cache ?? "no-store",
18
+ signal: init.signal ?? controller.signal
19
+ });
20
+ }
21
+ return await fetch(input, {
22
+ ...init,
23
+ cache: init.cache ?? "no-store",
24
+ signal: init.signal ?? controller.signal
25
+ });
26
+ } catch (error) {
27
+ if (error instanceof DOMException && error.name === "AbortError") {
28
+ throw new Error(`Request timed out after ${timeoutMs / 1e3}s.`);
29
+ }
30
+ throw error;
31
+ } finally {
32
+ globalThis.clearTimeout(timeout);
33
+ }
34
+ }
35
+
36
+ // src/aleph-api.ts
37
+ var BROWSER_ALEPH_API_MODULE = "planned";
38
+
39
+ // src/rootfs.ts
40
+ var BROWSER_ROOTFS_MODULE = "planned";
41
+
42
+ // src/pricing.ts
43
+ var BROWSER_PRICING_MODULE = "planned";
44
+ export {
45
+ BROWSER_ALEPH_API_MODULE,
46
+ BROWSER_PACKAGE_PLAN,
47
+ BROWSER_PRICING_MODULE,
48
+ BROWSER_ROOTFS_MODULE,
49
+ fetchWithTimeout
50
+ };
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@le-space/browser",
3
+ "version": "0.1.22",
4
+ "description": "Shared browser-safe Aleph deployment and polling helpers.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./index.d.ts",
12
+ "import": "./index.js"
13
+ }
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ }
18
+ }