apps 0.0.1-beta.116 → 0.0.1-beta.118

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.
@@ -2,17 +2,26 @@ import { Effect, Option, Stream } from "effect";
2
2
  import { HttpServerRequest, HttpServerResponse } from "effect/http";
3
3
  import { UiFailed, UiForbidden, type AppUiAsset, type AppUiRange, type AppUiStoredFile, type UiAccountNotice } from "../contracts/ui.js";
4
4
  /**
5
- * Render an authorized version with a host-owned version watcher. Account problems that stop
6
- * the app replace its document with a page that links to their fix; others add a dismissible card.
5
+ * The version's public file a page path names, or a 404 for a missing file. `None` means the path
6
+ * is the page itself. Hosts answer files before the page's account and usage work, which a file
7
+ * needs none of.
8
+ */
9
+ export declare const appFile: <E, R>(options: {
10
+ readonly origin: string;
11
+ readonly asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>;
12
+ }) => Effect.Effect<Option.None<HttpServerResponse.HttpServerResponse> | Option.Some<HttpServerResponse.HttpServerResponse>, UiFailed | UiForbidden | E, HttpServerRequest.HttpServerRequest | R>;
13
+ /**
14
+ * Render an authorized version with a host-owned version watcher, for a path `appFile` left to
15
+ * the page. Account problems that stop the app replace its document with a page that links to
16
+ * their fix; others add a dismissible card.
7
17
  */
8
18
  export declare const appDocument: <E, R>(options: {
9
19
  readonly version: string;
10
20
  /** The account IDs the page runs with, by requirement. */
11
21
  readonly accountIds?: Readonly<Record<string, readonly string[]>> | undefined;
12
- readonly origin: string;
13
22
  readonly accounts?: UiAccountNotice | undefined;
14
23
  readonly asset: (path: string) => Effect.Effect<AppUiAsset | undefined, E, R>;
15
- }) => Effect.Effect<HttpServerResponse.HttpServerResponse, UiFailed | UiForbidden | E, HttpServerRequest.HttpServerRequest | R>;
24
+ }) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R>;
16
25
  /**
17
26
  * A version's public file, read from the host's store. The version lists it, so bytes that
18
27
  * are gone are a storage fault, never a missing page.
@@ -1,3 +1,2 @@
1
1
  /** Host-only rendering utilities; the host supplies authorized retained assets. */
2
- export { appDocument, appAsset, assetPath, storedAppFile } from "./implementation/ui-serving.js";
3
- export { appWatchScript } from "./implementation/ui-watch.js";
2
+ export { appDocument, appAsset, appFile, assetPath, storedAppFile, } from "./implementation/ui-serving.js";
@@ -1,2 +0,0 @@
1
- /** Dependency-free browser source served by each host after app authorization. */
2
- export declare const appWatchScript = "\"use strict\";(()=>{var c=()=>{let s=document.getElementById(\"executor-context\")?.textContent;if(!s)return;let n=JSON.parse(s);if(typeof n!=\"object\"||n===null||!(\"version\"in n))return;let r=n.version;if(typeof r!=\"string\"||r.length===0)return;let t=new EventSource(\"/_executor/version\"),d=!1,o=()=>{d||(d=!0,t.close(),location.reload())};t.addEventListener(\"version\",i=>{let e=JSON.parse(i.data);typeof e==\"object\"&&e!==null&&\"version\"in e&&(e.version===null||typeof e.version==\"string\")&&e.version!==r&&o()}),t.addEventListener(\"revoked\",o),window.addEventListener(\"executor:deployment-changed\",o),window.addEventListener(\"pagehide\",()=>t.close(),{once:!0}),window.addEventListener(\"pageshow\",i=>{i.persisted&&o()})};c();})();";