@loomwork/ui-hydration 0.0.0-stage → 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 +202 -0
- package/NOTICE +8 -0
- package/README.md +398 -2
- package/dist/cache.d.ts +71 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +157 -0
- package/dist/cache.js.map +1 -0
- package/dist/chatSource.d.ts +105 -0
- package/dist/chatSource.d.ts.map +1 -0
- package/dist/chatSource.js +259 -0
- package/dist/chatSource.js.map +1 -0
- package/dist/client.d.ts +17 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +36 -0
- package/dist/client.js.map +1 -0
- package/dist/contentRefs.d.ts +78 -0
- package/dist/contentRefs.d.ts.map +1 -0
- package/dist/contentRefs.js +129 -0
- package/dist/contentRefs.js.map +1 -0
- package/dist/controller.d.ts +228 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/controller.js +454 -0
- package/dist/controller.js.map +1 -0
- package/dist/dataProvider.d.ts +53 -0
- package/dist/dataProvider.d.ts.map +1 -0
- package/dist/dataProvider.js +77 -0
- package/dist/dataProvider.js.map +1 -0
- package/dist/esm/cache.js +151 -0
- package/dist/esm/cache.js.map +1 -0
- package/dist/esm/chatSource.js +254 -0
- package/dist/esm/chatSource.js.map +1 -0
- package/dist/esm/client.js +15 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/contentRefs.js +119 -0
- package/dist/esm/contentRefs.js.map +1 -0
- package/dist/esm/controller.js +449 -0
- package/dist/esm/controller.js.map +1 -0
- package/dist/esm/dataProvider.js +72 -0
- package/dist/esm/dataProvider.js.map +1 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/invoker.js +2 -0
- package/dist/esm/invoker.js.map +1 -0
- package/dist/esm/invokers.js +310 -0
- package/dist/esm/invokers.js.map +1 -0
- package/dist/esm/loomEffectProvider.js +96 -0
- package/dist/esm/loomEffectProvider.js.map +1 -0
- package/dist/esm/params.js +207 -0
- package/dist/esm/params.js.map +1 -0
- package/dist/esm/path.js +24 -0
- package/dist/esm/path.js.map +1 -0
- package/dist/esm/plan.js +190 -0
- package/dist/esm/plan.js.map +1 -0
- package/dist/esm/projection.js +230 -0
- package/dist/esm/projection.js.map +1 -0
- package/dist/esm/provider.js +416 -0
- package/dist/esm/provider.js.map +1 -0
- package/dist/esm/repair.js +53 -0
- package/dist/esm/repair.js.map +1 -0
- package/dist/esm/reshape.js +156 -0
- package/dist/esm/reshape.js.map +1 -0
- package/dist/esm/restricted.js +54 -0
- package/dist/esm/restricted.js.map +1 -0
- package/dist/esm/scheduler.js +247 -0
- package/dist/esm/scheduler.js.map +1 -0
- package/dist/esm/select.js +18 -0
- package/dist/esm/select.js.map +1 -0
- package/dist/esm/shape.js +34 -0
- package/dist/esm/shape.js.map +1 -0
- package/dist/esm/split/client.js +309 -0
- package/dist/esm/split/client.js.map +1 -0
- package/dist/esm/split/index.js +3 -0
- package/dist/esm/split/index.js.map +1 -0
- package/dist/esm/split/server.js +488 -0
- package/dist/esm/split/server.js.map +1 -0
- package/dist/esm/split/shared.js +13 -0
- package/dist/esm/split/shared.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/index.js.map +1 -0
- package/dist/invoker.d.ts +10 -0
- package/dist/invoker.d.ts.map +1 -0
- package/dist/invoker.js +3 -0
- package/dist/invoker.js.map +1 -0
- package/dist/invokers.d.ts +36 -0
- package/dist/invokers.d.ts.map +1 -0
- package/dist/invokers.js +315 -0
- package/dist/invokers.js.map +1 -0
- package/dist/loomEffectProvider.d.ts +67 -0
- package/dist/loomEffectProvider.d.ts.map +1 -0
- package/dist/loomEffectProvider.js +101 -0
- package/dist/loomEffectProvider.js.map +1 -0
- package/dist/params.d.ts +103 -0
- package/dist/params.d.ts.map +1 -0
- package/dist/params.js +221 -0
- package/dist/params.js.map +1 -0
- package/dist/path.d.ts +12 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +28 -0
- package/dist/path.js.map +1 -0
- package/dist/plan.d.ts +56 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +199 -0
- package/dist/plan.js.map +1 -0
- package/dist/projection.d.ts +122 -0
- package/dist/projection.d.ts.map +1 -0
- package/dist/projection.js +238 -0
- package/dist/projection.js.map +1 -0
- package/dist/provider.d.ts +152 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +421 -0
- package/dist/provider.js.map +1 -0
- package/dist/repair.d.ts +18 -0
- package/dist/repair.d.ts.map +1 -0
- package/dist/repair.js +57 -0
- package/dist/repair.js.map +1 -0
- package/dist/reshape.d.ts +32 -0
- package/dist/reshape.d.ts.map +1 -0
- package/dist/reshape.js +164 -0
- package/dist/reshape.js.map +1 -0
- package/dist/restricted.d.ts +21 -0
- package/dist/restricted.d.ts.map +1 -0
- package/dist/restricted.js +61 -0
- package/dist/restricted.js.map +1 -0
- package/dist/scheduler.d.ts +82 -0
- package/dist/scheduler.d.ts.map +1 -0
- package/dist/scheduler.js +254 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/select.d.ts +34 -0
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +21 -0
- package/dist/select.js.map +1 -0
- package/dist/shape.d.ts +3 -0
- package/dist/shape.d.ts.map +1 -0
- package/dist/shape.js +37 -0
- package/dist/shape.js.map +1 -0
- package/dist/split/client.d.ts +132 -0
- package/dist/split/client.d.ts.map +1 -0
- package/dist/split/client.js +313 -0
- package/dist/split/client.js.map +1 -0
- package/dist/split/index.d.ts +5 -0
- package/dist/split/index.d.ts.map +1 -0
- package/dist/split/index.js +14 -0
- package/dist/split/index.js.map +1 -0
- package/dist/split/server.d.ts +160 -0
- package/dist/split/server.d.ts.map +1 -0
- package/dist/split/server.js +496 -0
- package/dist/split/server.js.map +1 -0
- package/dist/split/shared.d.ts +6 -0
- package/dist/split/shared.d.ts.map +1 -0
- package/dist/split/shared.js +19 -0
- package/dist/split/shared.js.map +1 -0
- package/package.json +77 -3
- package/src/cache.ts +211 -0
- package/src/chatSource.ts +374 -0
- package/src/client.ts +46 -0
- package/src/contentRefs.ts +195 -0
- package/src/controller.ts +708 -0
- package/src/dataProvider.ts +141 -0
- package/src/index.ts +86 -0
- package/src/invoker.ts +14 -0
- package/src/invokers.ts +348 -0
- package/src/loomEffectProvider.ts +136 -0
- package/src/params.ts +314 -0
- package/src/path.ts +26 -0
- package/src/plan.ts +197 -0
- package/src/projection.ts +297 -0
- package/src/provider.ts +657 -0
- package/src/repair.ts +70 -0
- package/src/reshape.ts +193 -0
- package/src/restricted.ts +69 -0
- package/src/scheduler.ts +284 -0
- package/src/select.ts +59 -0
- package/src/shape.ts +39 -0
- package/src/split/client.ts +449 -0
- package/src/split/index.ts +18 -0
- package/src/split/server.ts +746 -0
- package/src/split/shared.ts +18 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAMjD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,iBAAiB,GACjB,oBAAoB,GACpB,WAAW,GACX,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC5B;IACE,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,OAAO,CAAC;IACjB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEN,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,CAc1E"}
|
package/dist/select.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonPathSelect = jsonPathSelect;
|
|
4
|
+
const plan_1 = require("./plan");
|
|
5
|
+
function jsonPathSelect(value, path) {
|
|
6
|
+
if (path === "" || path === "$")
|
|
7
|
+
return { ok: true, value };
|
|
8
|
+
const out = (0, plan_1.resolvePath)(value, path);
|
|
9
|
+
if (out === undefined)
|
|
10
|
+
return {
|
|
11
|
+
ok: false,
|
|
12
|
+
failureKind: "selects-nothing",
|
|
13
|
+
finding: {
|
|
14
|
+
code: "reshape-failed",
|
|
15
|
+
severity: "error",
|
|
16
|
+
message: `JSONPath "${path}" selects nothing from the tool output`,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
return { ok: true, value: out };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../src/select.ts"],"names":[],"mappings":";;AA4CA,wCAcC;AAzDD,iCAAqC;AA2CrC,SAAgB,cAAc,CAAC,KAAc,EAAE,IAAY;IACzD,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAA,kBAAW,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACrC,IAAI,GAAG,KAAK,SAAS;QACnB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,WAAW,EAAE,iBAAiB;YAC9B,OAAO,EAAE;gBACP,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,aAAa,IAAI,wCAAwC;aACnE;SACF,CAAC;IACJ,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AAClC,CAAC"}
|
package/dist/shape.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../src/shape.ts"],"names":[],"mappings":"AAmCA,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAExD"}
|
package/dist/shape.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.outputShapeHashOf = outputShapeHashOf;
|
|
4
|
+
const core_1 = require("@loomwork/core");
|
|
5
|
+
const MAX_SHAPE_DEPTH = 1024;
|
|
6
|
+
function shapeAt(value, depth) {
|
|
7
|
+
if (value === null)
|
|
8
|
+
return "null";
|
|
9
|
+
const t = typeof value;
|
|
10
|
+
if (t === "string" || t === "number" || t === "boolean")
|
|
11
|
+
return t;
|
|
12
|
+
if (depth >= MAX_SHAPE_DEPTH) {
|
|
13
|
+
throw new Error(`shapeOf: depth limit exceeded (${MAX_SHAPE_DEPTH})`);
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
const shapes = new Map();
|
|
17
|
+
for (const v of value) {
|
|
18
|
+
const s = shapeAt(v, depth + 1);
|
|
19
|
+
shapes.set(JSON.stringify(s), s);
|
|
20
|
+
}
|
|
21
|
+
return [...shapes.entries()].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([, s]) => s);
|
|
22
|
+
}
|
|
23
|
+
if (t === "object") {
|
|
24
|
+
const out = {};
|
|
25
|
+
for (const [k, v] of Object.entries(value)) {
|
|
26
|
+
if (v !== undefined)
|
|
27
|
+
out[k] = shapeAt(v, depth + 1);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
return t;
|
|
32
|
+
}
|
|
33
|
+
/** The output-shape fingerprint. The planner pins `ProviderSpec.outputShapeHash` with THIS function. */
|
|
34
|
+
function outputShapeHashOf(value) {
|
|
35
|
+
return (0, core_1.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,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;IACD,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnB,MAAM,GAAG,GAA6B,EAAE,CAAC;QACzC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YACtE,IAAI,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,wGAAwG;AACxG,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,OAAO,IAAA,qBAAc,EAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { Audience, Finding, Priority } from "@loomwork/ui-core";
|
|
2
|
+
import { type LoadParams } from "../params";
|
|
3
|
+
import { type HydrationStore } from "../projection";
|
|
4
|
+
import { type HandleLoadResult, type TimerFn } from "../scheduler";
|
|
5
|
+
export interface HandleRef {
|
|
6
|
+
readonly handle: string;
|
|
7
|
+
readonly priority: Priority;
|
|
8
|
+
/** Argument names a load may override (the sorted union of the provider's `overridable`). */
|
|
9
|
+
readonly params: readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* Opaque: changes when the provider behind the handle changes. Never the provider, nor an
|
|
12
|
+
* unkeyed function of it — `InventoryOptions.revisionOf` derives it on the server.
|
|
13
|
+
*/
|
|
14
|
+
readonly revision: string;
|
|
15
|
+
/** Set when the handle cannot load (no provider): published as an error, never requested. */
|
|
16
|
+
readonly finding?: Finding;
|
|
17
|
+
}
|
|
18
|
+
export interface HandleInventory {
|
|
19
|
+
readonly experienceId: string;
|
|
20
|
+
readonly versionHash: string;
|
|
21
|
+
readonly handles: readonly HandleRef[];
|
|
22
|
+
}
|
|
23
|
+
export interface HandleLoadRequest {
|
|
24
|
+
readonly experienceId: string;
|
|
25
|
+
readonly versionHash: string;
|
|
26
|
+
readonly handle: string;
|
|
27
|
+
/** Only the params this handle declares (the controller filters by `HandleRef.params`). */
|
|
28
|
+
readonly params: LoadParams;
|
|
29
|
+
}
|
|
30
|
+
/** The app's transport. Each method answers or rejects; a rejection errors the handles it carried. */
|
|
31
|
+
export interface HandleLoader {
|
|
32
|
+
load(request: HandleLoadRequest, signal: AbortSignal): Promise<HandleLoadResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Several requests in ONE round trip, answered in request order — the server's `serveHandles`,
|
|
35
|
+
* so they share a pass and handles sharing an upstream step share the call. Required: that
|
|
36
|
+
* sharing is not optional. `signal` aborts once every request in the group has been abandoned.
|
|
37
|
+
*/
|
|
38
|
+
loadMany(requests: readonly HandleLoadRequest[], signal: AbortSignal): Promise<readonly HandleLoadResult[]>;
|
|
39
|
+
}
|
|
40
|
+
export interface SplitControllerOptions {
|
|
41
|
+
readonly loader: HandleLoader;
|
|
42
|
+
readonly store: HydrationStore;
|
|
43
|
+
/**
|
|
44
|
+
* The audience this controller draws for. When given it must agree with the store's
|
|
45
|
+
* `scope.audience` both ways, or the constructor throws `HydrationAudienceMismatchError` (as
|
|
46
|
+
* `HydrationController` always does). Omitted = the viewer audience: a broadcast store then throws.
|
|
47
|
+
*/
|
|
48
|
+
readonly audience?: Audience;
|
|
49
|
+
readonly setTimer?: TimerFn;
|
|
50
|
+
readonly batchWindowMs?: number;
|
|
51
|
+
/** Params every load starts from (e.g. `DEFAULT_TIME_RANGE`); `setParams` layers over them. */
|
|
52
|
+
readonly defaultParams?: LoadParams;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Client-side hydration across a trust boundary. Same scheduling as `HydrationController` (P0 now,
|
|
56
|
+
* P1 batched, P2 on `markVisible`, once per question, supersede, dispose) over a `HandleInventory`,
|
|
57
|
+
* loading through the injected `HandleLoader` — a group the scheduler starts together as ONE
|
|
58
|
+
* `loadMany` — and publishing to a `HydrationStore`. A question is the handle's opaque revision
|
|
59
|
+
* plus its params (defaults < global < handle-scoped, filtered to the names the inventory lists
|
|
60
|
+
* for it). No cache, no clock and no drift handling here: all three are the server's.
|
|
61
|
+
*/
|
|
62
|
+
export declare class SplitHydrationController {
|
|
63
|
+
private readonly opts;
|
|
64
|
+
private readonly sched;
|
|
65
|
+
private current;
|
|
66
|
+
private globalParams;
|
|
67
|
+
private readonly scopedParams;
|
|
68
|
+
/**
|
|
69
|
+
* Throws `TypeError` for a loader missing `load` or `loadMany`, `RangeError` for
|
|
70
|
+
* unrepresentable `defaultParams`.
|
|
71
|
+
*/
|
|
72
|
+
constructor(opts: SplitControllerOptions);
|
|
73
|
+
/**
|
|
74
|
+
* Publish a value for a handle that no loader serves (a live transcript this page folds), through
|
|
75
|
+
* the inventory's gate: only a handle the server LISTED is accepted (a restricted or unknown one is
|
|
76
|
+
* absent from it, so it is refused), and the value must pass the contract of `kind`, which the caller
|
|
77
|
+
* names (this side holds no catalogue). Refused = a finding and nothing written. NOTE: the inventory
|
|
78
|
+
* does not say what KIND a listed handle feeds, so this cannot verify that `kind` is the handle's
|
|
79
|
+
* widget: that is the page author's code naming its own handle, the viewer gate (listed or not) is
|
|
80
|
+
* the part that is enforced here.
|
|
81
|
+
*/
|
|
82
|
+
publishValue(handle: string, value: unknown, options: {
|
|
83
|
+
readonly state?: "ready" | "pending";
|
|
84
|
+
readonly kind: string;
|
|
85
|
+
}): {
|
|
86
|
+
ok: true;
|
|
87
|
+
} | {
|
|
88
|
+
ok: false;
|
|
89
|
+
finding: Finding;
|
|
90
|
+
};
|
|
91
|
+
/** Bind an inventory; a second `load` IS a recompose. */
|
|
92
|
+
load(inventory: HandleInventory): {
|
|
93
|
+
findings: Finding[];
|
|
94
|
+
};
|
|
95
|
+
/** A new inventory replaces the current one: drop unlisted handles, keep the rest, load new ones. */
|
|
96
|
+
recompose(next: HandleInventory): {
|
|
97
|
+
findings: Finding[];
|
|
98
|
+
};
|
|
99
|
+
/** The surface reports a lazy (P2) widget entered the viewport. */
|
|
100
|
+
markVisible(handle: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Replace the global params (no `scope.handle`) or one handle's scoped params, then re-ask
|
|
103
|
+
* every bound handle whose question changed — only those, so a handle that ended on `error`
|
|
104
|
+
* with an unchanged question is NOT retried here (`invalidate` retries it). `{}` clears.
|
|
105
|
+
* Refused, with nothing changed, for params `checkParams` refuses or a reserved handle.
|
|
106
|
+
*/
|
|
107
|
+
setParams(params: LoadParams, scope?: {
|
|
108
|
+
readonly handle?: string;
|
|
109
|
+
}): {
|
|
110
|
+
findings: Finding[];
|
|
111
|
+
};
|
|
112
|
+
/** Ask again (one handle or all): supersedes in-flight loads; a lazy handle stays lazy. */
|
|
113
|
+
invalidate(handle?: string): {
|
|
114
|
+
findings: Finding[];
|
|
115
|
+
};
|
|
116
|
+
inFlight(): string[];
|
|
117
|
+
/** Terminal: every in-flight load is aborted and reported, and nothing schedules again. */
|
|
118
|
+
dispose(): void;
|
|
119
|
+
private bind;
|
|
120
|
+
/** Pure: the jobs `inventory` asks for right now, and the handles that cannot load (with why). */
|
|
121
|
+
private jobs;
|
|
122
|
+
/**
|
|
123
|
+
* The scheduler starts a group's jobs in one synchronous turn; each joins the group's queue and
|
|
124
|
+
* the first schedules the flush, so the whole group leaves as one request.
|
|
125
|
+
*/
|
|
126
|
+
private enqueue;
|
|
127
|
+
private flush;
|
|
128
|
+
private loadOne;
|
|
129
|
+
/** One `loadMany` for the group; its signal aborts once every member has been abandoned. */
|
|
130
|
+
private loadGroup;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/split/client.ts"],"names":[],"mappings":"AAA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AAE,MAAM,GAAG,IAAI;IAIjC;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,GAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG;QAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;KAAE;IAqBhG,2FAA2F;IAC3F,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;KAAE;IAQpD,QAAQ,IAAI,MAAM,EAAE;IAIpB,2FAA2F;IAC3F,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,IAAI;IAYZ,kGAAkG;IAClG,OAAO,CAAC,IAAI;IAmCZ;;;OAGG;IACH,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,KAAK;YAmBC,OAAO;IAQrB,4FAA4F;YAC9E,SAAS;CAsBxB"}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SplitHydrationController = void 0;
|
|
4
|
+
const browser_1 = require("@loomwork/ui-core/browser");
|
|
5
|
+
const params_1 = require("../params");
|
|
6
|
+
const projection_1 = require("../projection");
|
|
7
|
+
const scheduler_1 = require("../scheduler");
|
|
8
|
+
const shared_1 = require("./shared");
|
|
9
|
+
const isFinding = (f) => f !== null &&
|
|
10
|
+
typeof f === "object" &&
|
|
11
|
+
typeof f.code === "string" &&
|
|
12
|
+
typeof f.message === "string" &&
|
|
13
|
+
(f.severity === "error" || f.severity === "warn");
|
|
14
|
+
const malformedResult = (handle) => (0, shared_1.refuse)("load-malformed", `the loader answered "${handle}" with something that is not a load result`);
|
|
15
|
+
const failedResult = (handle, e) => (0, shared_1.refuse)("load-failed", `loading "${handle}" failed: ${(0, shared_1.errorMessage)(e)}`);
|
|
16
|
+
/** A loader's answer crossed a boundary: believe only what has the shape of a load result. */
|
|
17
|
+
function asLoadResult(x, handle) {
|
|
18
|
+
if (x === null || typeof x !== "object")
|
|
19
|
+
return malformedResult(handle);
|
|
20
|
+
const r = x;
|
|
21
|
+
const finding = isFinding(r.finding) ? r.finding : undefined;
|
|
22
|
+
if (r.state === "ready")
|
|
23
|
+
return finding === undefined
|
|
24
|
+
? { state: "ready", value: r.value }
|
|
25
|
+
: { state: "ready", value: r.value, finding };
|
|
26
|
+
// `empty` (loom ADR 0100) carries its finding and never a value: a value beside it is dropped.
|
|
27
|
+
if ((r.state === "stale" || r.state === "error" || r.state === "empty") && finding !== undefined)
|
|
28
|
+
return { state: r.state, finding };
|
|
29
|
+
return malformedResult(handle);
|
|
30
|
+
}
|
|
31
|
+
const PRIORITIES = new Set(["P0", "P1", "P2"]);
|
|
32
|
+
/** The inventory crossed a boundary too: believe only what has the shape of one. */
|
|
33
|
+
function isInventory(x) {
|
|
34
|
+
if (x === null || typeof x !== "object")
|
|
35
|
+
return false;
|
|
36
|
+
const inv = x;
|
|
37
|
+
return (typeof inv.experienceId === "string" &&
|
|
38
|
+
typeof inv.versionHash === "string" &&
|
|
39
|
+
Array.isArray(inv.handles) &&
|
|
40
|
+
inv.handles.every((r) => {
|
|
41
|
+
if (r === null || typeof r !== "object")
|
|
42
|
+
return false;
|
|
43
|
+
const ref = r;
|
|
44
|
+
return (typeof ref.handle === "string" &&
|
|
45
|
+
PRIORITIES.has(ref.priority) &&
|
|
46
|
+
typeof ref.revision === "string" &&
|
|
47
|
+
Array.isArray(ref.params) &&
|
|
48
|
+
ref.params.every((p) => typeof p === "string") &&
|
|
49
|
+
(ref.finding === undefined || isFinding(ref.finding)));
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Client-side hydration across a trust boundary. Same scheduling as `HydrationController` (P0 now,
|
|
54
|
+
* P1 batched, P2 on `markVisible`, once per question, supersede, dispose) over a `HandleInventory`,
|
|
55
|
+
* loading through the injected `HandleLoader` — a group the scheduler starts together as ONE
|
|
56
|
+
* `loadMany` — and publishing to a `HydrationStore`. A question is the handle's opaque revision
|
|
57
|
+
* plus its params (defaults < global < handle-scoped, filtered to the names the inventory lists
|
|
58
|
+
* for it). No cache, no clock and no drift handling here: all three are the server's.
|
|
59
|
+
*/
|
|
60
|
+
class SplitHydrationController {
|
|
61
|
+
opts;
|
|
62
|
+
sched;
|
|
63
|
+
current;
|
|
64
|
+
globalParams = {};
|
|
65
|
+
scopedParams = new Map();
|
|
66
|
+
/**
|
|
67
|
+
* Throws `TypeError` for a loader missing `load` or `loadMany`, `RangeError` for
|
|
68
|
+
* unrepresentable `defaultParams`.
|
|
69
|
+
*/
|
|
70
|
+
constructor(opts) {
|
|
71
|
+
this.opts = opts;
|
|
72
|
+
const broadcast = (0, browser_1.isBroadcast)(opts.audience);
|
|
73
|
+
if (broadcast !== (0, browser_1.isBroadcast)(opts.store.scope.audience))
|
|
74
|
+
throw new projection_1.HydrationAudienceMismatchError(broadcast);
|
|
75
|
+
const loader = opts.loader;
|
|
76
|
+
if (typeof loader?.load !== "function" || typeof loader.loadMany !== "function")
|
|
77
|
+
throw new TypeError("SplitHydrationController: the loader must implement load and loadMany");
|
|
78
|
+
if (opts.defaultParams !== undefined) {
|
|
79
|
+
const bad = (0, params_1.checkParams)(opts.defaultParams);
|
|
80
|
+
if (bad)
|
|
81
|
+
throw new RangeError(bad.message);
|
|
82
|
+
}
|
|
83
|
+
this.sched = new scheduler_1.HandleScheduler(opts.store, {
|
|
84
|
+
newGroup: () => ({ queue: [] }),
|
|
85
|
+
run: (job, signal, group) => this.enqueue(job, signal, group),
|
|
86
|
+
}, opts.setTimer ?? scheduler_1.defaultTimer, opts.batchWindowMs ?? 50);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Publish a value for a handle that no loader serves (a live transcript this page folds), through
|
|
90
|
+
* the inventory's gate: only a handle the server LISTED is accepted (a restricted or unknown one is
|
|
91
|
+
* absent from it, so it is refused), and the value must pass the contract of `kind`, which the caller
|
|
92
|
+
* names (this side holds no catalogue). Refused = a finding and nothing written. NOTE: the inventory
|
|
93
|
+
* does not say what KIND a listed handle feeds, so this cannot verify that `kind` is the handle's
|
|
94
|
+
* widget: that is the page author's code naming its own handle, the viewer gate (listed or not) is
|
|
95
|
+
* the part that is enforced here.
|
|
96
|
+
*/
|
|
97
|
+
publishValue(handle, value, options) {
|
|
98
|
+
const listed = !this.sched.isDisposed &&
|
|
99
|
+
!(0, projection_1.isReservedHandle)(handle) &&
|
|
100
|
+
this.current?.handles.some((r) => r.handle === handle && r.finding === undefined) === true;
|
|
101
|
+
if (!listed)
|
|
102
|
+
return {
|
|
103
|
+
ok: false,
|
|
104
|
+
finding: {
|
|
105
|
+
code: "publish-unbound",
|
|
106
|
+
severity: "error",
|
|
107
|
+
message: "the handle is not in the current inventory; the value was refused",
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
if (!(0, browser_1.hasKindContract)(options.kind))
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
finding: {
|
|
114
|
+
code: "publish-uncontracted",
|
|
115
|
+
severity: "error",
|
|
116
|
+
message: "the named kind has no value contract; refused",
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
const check = (0, browser_1.checkKindValue)(options.kind, value);
|
|
120
|
+
if (!check.ok)
|
|
121
|
+
return { ok: false, finding: check.finding };
|
|
122
|
+
this.opts.store.setValue(handle, value, { state: options.state ?? "ready" });
|
|
123
|
+
return { ok: true };
|
|
124
|
+
}
|
|
125
|
+
/** Bind an inventory; a second `load` IS a recompose. */
|
|
126
|
+
load(inventory) {
|
|
127
|
+
if (this.sched.isDisposed)
|
|
128
|
+
return { findings: [(0, scheduler_1.disposedFinding)("load")] };
|
|
129
|
+
if (!isInventory(inventory))
|
|
130
|
+
return { findings: [invalidInventory()] };
|
|
131
|
+
if (this.current !== undefined)
|
|
132
|
+
return this.recompose(inventory);
|
|
133
|
+
return this.bind(inventory);
|
|
134
|
+
}
|
|
135
|
+
/** A new inventory replaces the current one: drop unlisted handles, keep the rest, load new ones. */
|
|
136
|
+
recompose(next) {
|
|
137
|
+
if (this.sched.isDisposed)
|
|
138
|
+
return { findings: [(0, scheduler_1.disposedFinding)("recompose")] };
|
|
139
|
+
// Before anything is dropped: an inventory we refuse must leave the current one as it was.
|
|
140
|
+
if (!isInventory(next))
|
|
141
|
+
return { findings: [invalidInventory()] };
|
|
142
|
+
this.sched.retain(new Set(next.handles.map((r) => r.handle)));
|
|
143
|
+
return this.bind(next);
|
|
144
|
+
}
|
|
145
|
+
/** The surface reports a lazy (P2) widget entered the viewport. */
|
|
146
|
+
markVisible(handle) {
|
|
147
|
+
this.sched.markVisible(handle);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Replace the global params (no `scope.handle`) or one handle's scoped params, then re-ask
|
|
151
|
+
* every bound handle whose question changed — only those, so a handle that ended on `error`
|
|
152
|
+
* with an unchanged question is NOT retried here (`invalidate` retries it). `{}` clears.
|
|
153
|
+
* Refused, with nothing changed, for params `checkParams` refuses or a reserved handle.
|
|
154
|
+
*/
|
|
155
|
+
setParams(params, scope = {}) {
|
|
156
|
+
if (this.sched.isDisposed)
|
|
157
|
+
return { findings: [(0, scheduler_1.disposedFinding)("setParams")] };
|
|
158
|
+
const bad = (0, params_1.checkParams)(params);
|
|
159
|
+
if (bad)
|
|
160
|
+
return { findings: [bad] };
|
|
161
|
+
if (scope.handle !== undefined && (0, projection_1.isReservedHandle)(scope.handle))
|
|
162
|
+
return { findings: [(0, shared_1.reservedFinding)(scope.handle)] };
|
|
163
|
+
const before = this.current === undefined
|
|
164
|
+
? new Map()
|
|
165
|
+
: new Map(this.jobs(this.current).jobs.map((j) => [j.handle, j.fingerprint]));
|
|
166
|
+
// A copy (own enumerable keys only): a caller mutating its object later changes nothing.
|
|
167
|
+
const copy = Object.fromEntries(Object.entries(params));
|
|
168
|
+
if (scope.handle === undefined)
|
|
169
|
+
this.globalParams = copy;
|
|
170
|
+
else
|
|
171
|
+
this.scopedParams.set(scope.handle, copy);
|
|
172
|
+
if (this.current !== undefined)
|
|
173
|
+
this.sched.schedule(this.jobs(this.current).jobs.filter((j) => before.get(j.handle) !== j.fingerprint));
|
|
174
|
+
return { findings: [] };
|
|
175
|
+
}
|
|
176
|
+
/** Ask again (one handle or all): supersedes in-flight loads; a lazy handle stays lazy. */
|
|
177
|
+
invalidate(handle) {
|
|
178
|
+
if (this.sched.isDisposed)
|
|
179
|
+
return { findings: [(0, scheduler_1.disposedFinding)("invalidate")] };
|
|
180
|
+
if (this.current === undefined)
|
|
181
|
+
return { findings: [] };
|
|
182
|
+
const { jobs } = this.jobs(this.current);
|
|
183
|
+
this.sched.reload(handle === undefined ? jobs : jobs.filter((j) => j.handle === handle));
|
|
184
|
+
return { findings: [] };
|
|
185
|
+
}
|
|
186
|
+
inFlight() {
|
|
187
|
+
return this.sched.inFlight();
|
|
188
|
+
}
|
|
189
|
+
/** Terminal: every in-flight load is aborted and reported, and nothing schedules again. */
|
|
190
|
+
dispose() {
|
|
191
|
+
this.sched.dispose();
|
|
192
|
+
this.current = undefined;
|
|
193
|
+
this.globalParams = {};
|
|
194
|
+
this.scopedParams.clear();
|
|
195
|
+
}
|
|
196
|
+
bind(inventory) {
|
|
197
|
+
this.current = inventory;
|
|
198
|
+
const listed = new Set(inventory.handles.map((r) => r.handle));
|
|
199
|
+
for (const handle of [...this.scopedParams.keys()])
|
|
200
|
+
if (!listed.has(handle))
|
|
201
|
+
this.scopedParams.delete(handle);
|
|
202
|
+
const { jobs, findings, missing } = this.jobs(inventory);
|
|
203
|
+
for (const m of missing)
|
|
204
|
+
this.opts.store.setStatus(m.handle, { state: "error", finding: m.finding });
|
|
205
|
+
this.sched.schedule(jobs);
|
|
206
|
+
return { findings };
|
|
207
|
+
}
|
|
208
|
+
/** Pure: the jobs `inventory` asks for right now, and the handles that cannot load (with why). */
|
|
209
|
+
jobs(inventory) {
|
|
210
|
+
const jobs = [];
|
|
211
|
+
const findings = [];
|
|
212
|
+
const missing = [];
|
|
213
|
+
for (const ref of inventory.handles) {
|
|
214
|
+
// The inventory crossed a boundary: a reserved handle is refused here too.
|
|
215
|
+
if ((0, projection_1.isReservedHandle)(ref.handle)) {
|
|
216
|
+
findings.push((0, shared_1.reservedFinding)(ref.handle));
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (ref.finding !== undefined) {
|
|
220
|
+
findings.push(ref.finding);
|
|
221
|
+
missing.push({ handle: ref.handle, finding: ref.finding });
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const params = (0, params_1.pickParams)({ ...this.opts.defaultParams, ...this.globalParams, ...this.scopedParams.get(ref.handle) }, ref.params);
|
|
225
|
+
jobs.push({
|
|
226
|
+
handle: ref.handle,
|
|
227
|
+
priority: ref.priority,
|
|
228
|
+
params,
|
|
229
|
+
experienceId: inventory.experienceId,
|
|
230
|
+
versionHash: inventory.versionHash,
|
|
231
|
+
fingerprint: `${ref.revision}${scheduler_1.KEY_SEP}${(0, params_1.paramsKey)(params)}`,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return { jobs, findings, missing };
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The scheduler starts a group's jobs in one synchronous turn; each joins the group's queue and
|
|
238
|
+
* the first schedules the flush, so the whole group leaves as one request.
|
|
239
|
+
*/
|
|
240
|
+
enqueue(job, signal, group) {
|
|
241
|
+
return new Promise((resolve) => {
|
|
242
|
+
group.queue.push({ job, signal, resolve });
|
|
243
|
+
if (group.queue.length === 1)
|
|
244
|
+
queueMicrotask(() => this.flush(group));
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
flush(group) {
|
|
248
|
+
const queued = group.queue;
|
|
249
|
+
group.queue = [];
|
|
250
|
+
// Abandoned before it left (superseded, dropped, disposed): its result would be dropped anyway.
|
|
251
|
+
const live = [];
|
|
252
|
+
for (const q of queued) {
|
|
253
|
+
if (q.signal.aborted)
|
|
254
|
+
q.resolve((0, shared_1.refuse)("aborted", `the load of "${q.job.handle}" was abandoned`));
|
|
255
|
+
else
|
|
256
|
+
live.push(q);
|
|
257
|
+
}
|
|
258
|
+
if (live.length > 1) {
|
|
259
|
+
this.loadGroup(live).then((results) => {
|
|
260
|
+
live.forEach((q, i) => q.resolve(results[i] ?? malformedResult(q.job.handle)));
|
|
261
|
+
});
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
for (const q of live)
|
|
265
|
+
this.loadOne(q).then(q.resolve);
|
|
266
|
+
}
|
|
267
|
+
async loadOne(q) {
|
|
268
|
+
try {
|
|
269
|
+
return asLoadResult(await this.opts.loader.load(request(q.job), q.signal), q.job.handle);
|
|
270
|
+
}
|
|
271
|
+
catch (e) {
|
|
272
|
+
return failedResult(q.job.handle, e);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/** One `loadMany` for the group; its signal aborts once every member has been abandoned. */
|
|
276
|
+
async loadGroup(live) {
|
|
277
|
+
const ac = new AbortController();
|
|
278
|
+
let remaining = live.length;
|
|
279
|
+
const onAbort = () => {
|
|
280
|
+
remaining -= 1;
|
|
281
|
+
if (remaining === 0)
|
|
282
|
+
ac.abort();
|
|
283
|
+
};
|
|
284
|
+
for (const q of live)
|
|
285
|
+
q.signal.addEventListener("abort", onAbort, { once: true });
|
|
286
|
+
try {
|
|
287
|
+
const answer = await this.opts.loader.loadMany(live.map((q) => request(q.job)), ac.signal);
|
|
288
|
+
if (!Array.isArray(answer) || answer.length !== live.length)
|
|
289
|
+
return live.map((q) => malformedResult(q.job.handle));
|
|
290
|
+
return live.map((q, i) => asLoadResult(answer[i], q.job.handle));
|
|
291
|
+
}
|
|
292
|
+
catch (e) {
|
|
293
|
+
return live.map((q) => failedResult(q.job.handle, e));
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
for (const q of live)
|
|
297
|
+
q.signal.removeEventListener("abort", onAbort);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.SplitHydrationController = SplitHydrationController;
|
|
302
|
+
const invalidInventory = () => ({
|
|
303
|
+
code: "invalid-inventory",
|
|
304
|
+
severity: "error",
|
|
305
|
+
message: "not a handle inventory: expected an experienceId, a versionHash and well-formed handle refs",
|
|
306
|
+
});
|
|
307
|
+
const request = (job) => ({
|
|
308
|
+
experienceId: job.experienceId,
|
|
309
|
+
versionHash: job.versionHash,
|
|
310
|
+
handle: job.handle,
|
|
311
|
+
params: job.params,
|
|
312
|
+
});
|
|
313
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/split/client.ts"],"names":[],"mappings":";;;AACA,uDAAyF;AACzF,sCAAgF;AAChF,8CAIuB;AACvB,4CAQsB;AACtB,qCAAiE;AAoGjE,MAAM,SAAS,GAAG,CAAC,CAAU,EAAgB,EAAE,CAC7C,CAAC,KAAK,IAAI;IACV,OAAO,CAAC,KAAK,QAAQ;IACrB,OAAQ,CAAa,CAAC,IAAI,KAAK,QAAQ;IACvC,OAAQ,CAAa,CAAC,OAAO,KAAK,QAAQ;IAC1C,CAAE,CAAa,CAAC,QAAQ,KAAK,OAAO,IAAK,CAAa,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;AAE9E,MAAM,eAAe,GAAG,CAAC,MAAc,EAAoB,EAAE,CAC3D,IAAA,eAAM,EACJ,gBAAgB,EAChB,wBAAwB,MAAM,4CAA4C,CAC3E,CAAC;AAEJ,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,CAAU,EAAoB,EAAE,CACpE,IAAA,eAAM,EAAC,aAAa,EAAE,YAAY,MAAM,aAAa,IAAA,qBAAY,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAE1E,8FAA8F;AAC9F,SAAS,YAAY,CAAC,CAAU,EAAE,MAAc;IAC9C,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,eAAe,CAAC,MAAM,CAA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,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC;gBAAS,CAAC;YACT,KAAK,MAAM,CAAC,IAAI,IAAI;gBAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF;AA7PD,4DA6PC;AAED,MAAM,gBAAgB,GAAG,GAAY,EAAE,CAAC,CAAC;IACvC,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,OAAO;IACjB,OAAO,EACL,6FAA6F;CAChG,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,CAAC,GAAW,EAAqB,EAAE,CAAC,CAAC;IACnD,YAAY,EAAE,GAAG,CAAC,YAAY;IAC9B,WAAW,EAAE,GAAG,CAAC,WAAW;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM;IAClB,MAAM,EAAE,GAAG,CAAC,MAAM;CACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DEFAULT_MAX_BATCH, DEFAULT_MAX_CONCURRENT_CALLS, createServeSurface, handleInventory, publicFinding, serveHandle, serveHandles, } from "./server";
|
|
2
|
+
export type { InventoryOptions, RevisionFn, ServeOptions, ServeSurface } from "./server";
|
|
3
|
+
export { SplitHydrationController } from "./client";
|
|
4
|
+
export type { HandleInventory, HandleLoadRequest, HandleLoader, HandleRef, SplitControllerOptions, } from "./client";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/split/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,sBAAsB,GACvB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SplitHydrationController = exports.serveHandles = exports.serveHandle = exports.publicFinding = exports.handleInventory = exports.createServeSurface = exports.DEFAULT_MAX_CONCURRENT_CALLS = exports.DEFAULT_MAX_BATCH = void 0;
|
|
4
|
+
var server_1 = require("./server");
|
|
5
|
+
Object.defineProperty(exports, "DEFAULT_MAX_BATCH", { enumerable: true, get: function () { return server_1.DEFAULT_MAX_BATCH; } });
|
|
6
|
+
Object.defineProperty(exports, "DEFAULT_MAX_CONCURRENT_CALLS", { enumerable: true, get: function () { return server_1.DEFAULT_MAX_CONCURRENT_CALLS; } });
|
|
7
|
+
Object.defineProperty(exports, "createServeSurface", { enumerable: true, get: function () { return server_1.createServeSurface; } });
|
|
8
|
+
Object.defineProperty(exports, "handleInventory", { enumerable: true, get: function () { return server_1.handleInventory; } });
|
|
9
|
+
Object.defineProperty(exports, "publicFinding", { enumerable: true, get: function () { return server_1.publicFinding; } });
|
|
10
|
+
Object.defineProperty(exports, "serveHandle", { enumerable: true, get: function () { return server_1.serveHandle; } });
|
|
11
|
+
Object.defineProperty(exports, "serveHandles", { enumerable: true, get: function () { return server_1.serveHandles; } });
|
|
12
|
+
var client_1 = require("./client");
|
|
13
|
+
Object.defineProperty(exports, "SplitHydrationController", { enumerable: true, get: function () { return client_1.SplitHydrationController; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/split/index.ts"],"names":[],"mappings":";;;AAAA,mCAQkB;AAPhB,2GAAA,iBAAiB,OAAA;AACjB,sHAAA,4BAA4B,OAAA;AAC5B,4GAAA,kBAAkB,OAAA;AAClB,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,sGAAA,YAAY,OAAA;AAGd,mCAAoD;AAA3C,kHAAA,wBAAwB,OAAA"}
|