@plitzi/sdk-shared 0.35.7 → 0.35.9
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/CHANGELOG.md +37 -0
- package/dist/server/rsc/refreshRsc.mjs +22 -21
- package/dist/store/actionRuns/actionRunsRecorder.d.ts +10 -1
- package/dist/store/actionRuns/actionRunsRecorder.mjs +19 -4
- package/dist/store/actionRuns/index.d.ts +1 -1
- package/dist/store/actionRuns/index.mjs +3 -3
- package/dist/store/index.d.ts +34 -34
- package/dist/store/index.mjs +5 -5
- package/dist/types/ActionTypes.d.ts +40 -0
- package/dist/types/SchemaTypes.d.ts +7 -0
- package/dist/types/ServerTypes.d.ts +9 -2
- package/dist/types/StoreTypes.d.ts +16 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @plitzi/sdk-shared
|
|
2
2
|
|
|
3
|
+
## 0.35.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Debug a server action's whole flow from the dev-tools, not just its answer.
|
|
8
|
+
|
|
9
|
+
A run now reports an OUTLINE of what it did: every step in order, with its task, how it ended, how long it took, and
|
|
10
|
+
the redacted error of the one that broke the flow — the compensation steps `flow.onFailure` ran included. It carries
|
|
11
|
+
nothing a step was given or returned, so it goes to any page whose debugging the deployment authorized (`devMode`, or
|
|
12
|
+
a space that switched dev tools on for its published site) and to no other. The full trace, with each step's results,
|
|
13
|
+
still reaches only an authoring request or a development server.
|
|
14
|
+
|
|
15
|
+
Runs the SERVER started while rendering a page — the ones feeding `runtime: 'server'` elements — reach the dev-tools
|
|
16
|
+
too, seeded into the page and added to by every `/_rsc` refresh, under the same authorization: a page nobody
|
|
17
|
+
authorized is not told they happened. A response carrying them is never cached. A run that died on its deadline now
|
|
18
|
+
reports the step it was on rather than nothing at all.
|
|
19
|
+
|
|
20
|
+
The Actions tab was rebuilt around it: filters and search over the log, a run list that names the step that broke,
|
|
21
|
+
and a detail panel with the flow's timeline, its compensation shown apart, and what the run carried in and out.
|
|
22
|
+
|
|
23
|
+
## 0.35.8
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- A space can switch the dev tools on for its own published site.
|
|
28
|
+
|
|
29
|
+
- **`settings.devTools`** in the space schema, set from the builder's Settings panel ("Dev tools on the published SSR
|
|
30
|
+
site (*.plitzi.app)"). It applies to sites served with SSR — usually a space's `*.plitzi.app` address, or a custom
|
|
31
|
+
domain pointed at it. A page server that left `debugMode` unset now authorizes debugging for a space that asked for it, as it
|
|
32
|
+
already did in `devMode`. A server that sets `debugMode` still decides for every space, and `false` cannot be
|
|
33
|
+
turned around by a space. Preview renders stay undebuggable either way.
|
|
34
|
+
- The space is read from the schema the server loaded, never from the request, and the visitor's cookie can still
|
|
35
|
+
only hide the panel.
|
|
36
|
+
- **The HTML cache keys whether a visitor hid the dev tools.** A cached page on a published environment used to be
|
|
37
|
+
keyed on the theme alone, so on a page authorizing dev tools the first visitor's choice — panel or no panel — was
|
|
38
|
+
served to everybody after them.
|
|
39
|
+
|
|
3
40
|
## 0.35.7
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import { authFailureFromResponse as e, reportAuthFailure as t } from "../../auth/failureChannel.mjs";
|
|
2
2
|
import { hasServerElements as n } from "../../schema/serverElements.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { recordRenderActionRuns as r } from "../../store/actionRuns/actionRunsRecorder.mjs";
|
|
4
|
+
import { getPaths as i, matchRoutePath as a } from "../../navigation/routes.mjs";
|
|
4
5
|
//#region src/server/rsc/refreshRsc.ts
|
|
5
|
-
var
|
|
6
|
+
var o = (e, t, n) => {
|
|
6
7
|
if (!e) return;
|
|
7
|
-
let
|
|
8
|
-
return i(r
|
|
9
|
-
},
|
|
10
|
-
let { enabled:
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
14
|
-
let n = new URLSearchParams({ location:
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
if (!
|
|
18
|
-
let n = e(
|
|
8
|
+
let r = e.pages.reduce((t, n) => (n in e.flat && (t[n] = e.flat[n]), t), {});
|
|
9
|
+
return a(i(r, e.pageFolders, n), t.split("?")[0], n).pageId;
|
|
10
|
+
}, s = (e) => `rsc.data.${e}`, c = () => typeof window > "u" ? "" : `${window.location.pathname}${window.location.search}`, l = async (i, a, l, u) => {
|
|
11
|
+
let { enabled: d, endpoint: f } = i.get("rsc") ?? {};
|
|
12
|
+
if (!d || !f || typeof window > "u") return;
|
|
13
|
+
let p = u ?? c(), m = i.get("schema"), h = i.get("runtime.sources.auth"), g = u ? o(m, u, !!h?.details) : i.get("navigation.currentPageId");
|
|
14
|
+
if (m && n(m, g)) try {
|
|
15
|
+
let n = new URLSearchParams({ location: p });
|
|
16
|
+
a?.length && n.set("ids", a.join(",")), Object.entries(l ?? {}).forEach(([e, t]) => n.set(e, t));
|
|
17
|
+
let o = await fetch(`${f}?${n.toString()}`, { headers: { Accept: "application/json" } });
|
|
18
|
+
if (!o.ok) {
|
|
19
|
+
let n = e(o.status, await o.json().catch(() => void 0));
|
|
19
20
|
n && t({
|
|
20
21
|
reason: n,
|
|
21
|
-
url:
|
|
22
|
-
}),
|
|
22
|
+
url: f
|
|
23
|
+
}), i.set("rsc.stale", !0);
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
let { serverData:
|
|
26
|
-
r.batch(() => {
|
|
27
|
-
|
|
26
|
+
let { serverData: c, actionRuns: u } = await o.json();
|
|
27
|
+
u?.length && r(u), i.batch(() => {
|
|
28
|
+
a?.length ? Object.entries(c ?? {}).forEach(([e, t]) => i.set(s(e), t)) : i.set("rsc.data", c ?? {}), i.set("rsc.loaded", !0), i.set("rsc.stale", !1), i.set("rsc.location", p);
|
|
28
29
|
});
|
|
29
30
|
} catch {
|
|
30
|
-
|
|
31
|
+
i.set("rsc.stale", !0);
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
//#endregion
|
|
34
|
-
export {
|
|
35
|
+
export { c as currentRscLocation, l as default, l as refreshRsc, s as rscDataPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionRunEntry } from '../../types';
|
|
1
|
+
import { ActionRunEntry, ActionRunSummary } from '../../types';
|
|
2
2
|
/** Registered by whatever started the run, for as long as stopping it means anything. */
|
|
3
3
|
export declare const registerActionCanceller: (id: string, cancel: () => void) => void;
|
|
4
4
|
export declare const releaseActionCanceller: (id: string) => void;
|
|
@@ -18,6 +18,15 @@ export declare const cancelActionRun: (id: string) => void;
|
|
|
18
18
|
* A record that only appeared on success would be missing exactly the runs somebody is looking for.
|
|
19
19
|
*/
|
|
20
20
|
export declare const recordActionRun: (entry: Omit<ActionRunEntry, "id" | "startedAt" | "status" | "progress">) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Records the runs the SERVER did while building this page, or while answering a refresh of part of it.
|
|
23
|
+
*
|
|
24
|
+
* Nobody here started them, so without this they are the one kind of run a page cannot see at all — an empty
|
|
25
|
+
* section and no way to learn why. Deduped by the server's own run id, because a section refreshing itself
|
|
26
|
+
* re-reports a run that was joined or reused rather than started again: the same run twice would leave a person
|
|
27
|
+
* comparing two entries that are one.
|
|
28
|
+
*/
|
|
29
|
+
export declare const recordRenderActionRuns: (summaries: ActionRunSummary[]) => void;
|
|
21
30
|
/** How it ended, or what it reported on the way. Unknown ids are ignored: a swept-out run is not an error. */
|
|
22
31
|
export declare const updateActionRun: (id: string, patch: Partial<Omit<ActionRunEntry, "id">>) => void;
|
|
23
32
|
/**
|
|
@@ -17,23 +17,38 @@ var t = 0, n = (t) => e.setState("runs", t), r = /* @__PURE__ */ new Map(), i =
|
|
|
17
17
|
progress: [],
|
|
18
18
|
cancellable: !0
|
|
19
19
|
}, ...e.getState().runs].slice(0, 100)), i;
|
|
20
|
-
}, c = (
|
|
20
|
+
}, c = (e) => ({
|
|
21
|
+
id: `render-${e.runId}`,
|
|
22
|
+
actionId: e.actionId,
|
|
23
|
+
mode: "render",
|
|
24
|
+
runId: e.runId,
|
|
25
|
+
status: e.status,
|
|
26
|
+
steps: e.steps,
|
|
27
|
+
progress: [],
|
|
28
|
+
startedAt: e.startedAt,
|
|
29
|
+
endedAt: e.endedAt,
|
|
30
|
+
...e.error === void 0 ? {} : { error: e.error },
|
|
31
|
+
...e.elementId === void 0 ? {} : { elementId: e.elementId }
|
|
32
|
+
}), l = (t) => {
|
|
33
|
+
let { runs: r } = e.getState(), i = new Set(r.map((e) => e.runId)), a = t.filter((e) => !i.has(e.runId)).map(c);
|
|
34
|
+
a.length !== 0 && n([...a.reverse(), ...r].slice(0, 100));
|
|
35
|
+
}, u = (t, r) => {
|
|
21
36
|
let { runs: i } = e.getState();
|
|
22
37
|
i.some((e) => e.id === t) && n(i.map((e) => e.id === t ? {
|
|
23
38
|
...e,
|
|
24
39
|
...r
|
|
25
40
|
} : e));
|
|
26
|
-
},
|
|
41
|
+
}, d = (t, r) => {
|
|
27
42
|
let { runs: i } = e.getState();
|
|
28
43
|
n(i.map((e) => e.id === t ? {
|
|
29
44
|
...e,
|
|
30
45
|
progress: [...e.progress, r].slice(-500)
|
|
31
46
|
} : e));
|
|
32
|
-
},
|
|
47
|
+
}, f = () => {
|
|
33
48
|
let t = new Set(e.getState().runs.filter((e) => e.cancellable).map((e) => e.id));
|
|
34
49
|
[...r.keys()].forEach((e) => {
|
|
35
50
|
t.has(e) || r.delete(e);
|
|
36
51
|
}), n([]);
|
|
37
52
|
};
|
|
38
53
|
//#endregion
|
|
39
|
-
export { o as cancelActionRun,
|
|
54
|
+
export { o as cancelActionRun, f as clearActionRuns, d as recordActionProgress, s as recordActionRun, l as recordRenderActionRuns, i as registerActionCanceller, a as releaseActionCanceller, u as updateActionRun };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as actionRunsStore } from './actionRunsStore';
|
|
2
2
|
import { default as useActionRuns } from './useActionRuns';
|
|
3
3
|
export { MAX_RUNS, createActionRunsState } from './actionRunsStore';
|
|
4
|
-
export { cancelActionRun, clearActionRuns, recordActionProgress, recordActionRun, registerActionCanceller, releaseActionCanceller, updateActionRun } from './actionRunsRecorder';
|
|
4
|
+
export { cancelActionRun, clearActionRuns, recordActionProgress, recordActionRun, recordRenderActionRuns, registerActionCanceller, releaseActionCanceller, updateActionRun } from './actionRunsRecorder';
|
|
5
5
|
export type { UseActionRunsReturn } from './useActionRuns';
|
|
6
6
|
export { actionRunsStore, useActionRuns };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import e, { MAX_RUNS as t, createActionRunsState as n } from "./actionRunsStore.mjs";
|
|
2
|
-
import { cancelActionRun as r, clearActionRuns as i, recordActionProgress as a, recordActionRun as o,
|
|
3
|
-
import
|
|
4
|
-
export { t as MAX_RUNS, e as actionRunsStore, r as cancelActionRun, i as clearActionRuns, n as createActionRunsState, a as recordActionProgress, o as recordActionRun, s as
|
|
2
|
+
import { cancelActionRun as r, clearActionRuns as i, recordActionProgress as a, recordActionRun as o, recordRenderActionRuns as s, registerActionCanceller as c, releaseActionCanceller as l, updateActionRun as u } from "./actionRunsRecorder.mjs";
|
|
3
|
+
import d from "./useActionRuns.mjs";
|
|
4
|
+
export { t as MAX_RUNS, e as actionRunsStore, r as cancelActionRun, i as clearActionRuns, n as createActionRunsState, a as recordActionProgress, o as recordActionRun, s as recordRenderActionRuns, c as registerActionCanceller, l as releaseActionCanceller, u as updateActionRun, d as useActionRuns };
|