@plitzi/sdk-dev-tools 0.39.15 → 0.39.16
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
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @plitzi/sdk-dev-tools
|
|
2
2
|
|
|
3
|
+
## 0.39.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0389dd0: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
8
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
9
|
+
- Updated dependencies [0389dd0]
|
|
10
|
+
- @plitzi/sdk-schema@0.39.16
|
|
11
|
+
- @plitzi/sdk-shared@0.39.16
|
|
12
|
+
|
|
3
13
|
## 0.39.15
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -2,6 +2,7 @@ import { FlowRun } from './flowRuns';
|
|
|
2
2
|
import { ElementReport } from './report';
|
|
3
3
|
import { DevStore } from '@plitzi/nexus';
|
|
4
4
|
import { SignedInTestAccount } from '@plitzi/sdk-shared';
|
|
5
|
+
import { RunningFlow } from '@plitzi/sdk-shared/devTools/running';
|
|
5
6
|
/** `window.__plitzi`: the page's state, data, elements and flows, in text, for whoever cannot read the panel. */
|
|
6
7
|
export type AgentInspector = {
|
|
7
8
|
help: () => string;
|
|
@@ -20,6 +21,15 @@ export type AgentInspector = {
|
|
|
20
21
|
setAttribute: (path: string, value: unknown) => string | false | Refused;
|
|
21
22
|
element: (id: string) => ElementReport | undefined;
|
|
22
23
|
flows: (limit?: number) => FlowRun[];
|
|
24
|
+
/**
|
|
25
|
+
* The flows on their way now — what fired each, on what, and for how long — so a reading of the state taken while
|
|
26
|
+
* one waits out a `delay` is told from one taken once every flow has ended.
|
|
27
|
+
*/
|
|
28
|
+
running: () => {
|
|
29
|
+
trigger: string;
|
|
30
|
+
on?: string;
|
|
31
|
+
ms: number;
|
|
32
|
+
}[];
|
|
23
33
|
/** Why each server element failed on the page server since the page loaded, by id — answered later or not. */
|
|
24
34
|
serverFailures: () => Record<string, unknown>;
|
|
25
35
|
watch: (on?: boolean) => string;
|
|
@@ -48,10 +58,13 @@ export type AgentInspectorOptions = {
|
|
|
48
58
|
stores: () => readonly DevStore[];
|
|
49
59
|
/** The flows that ran, newest last. */
|
|
50
60
|
runs: () => readonly FlowRun[];
|
|
61
|
+
/** The flows running now, the oldest first, and the page's clock they started on. */
|
|
62
|
+
runningFlows: () => readonly RunningFlow[];
|
|
63
|
+
now: () => number;
|
|
51
64
|
/** Whether each flow is said in the console as it ends. */
|
|
52
65
|
setWatching: (on: boolean) => void;
|
|
53
66
|
/** The sources an element sees, by its id — its scope's, a list row's included: what its bindings read. */
|
|
54
67
|
elementSources?: (id: string) => unknown;
|
|
55
68
|
document: Document;
|
|
56
69
|
};
|
|
57
|
-
export declare const createAgentInspector: ({ root, writeState, writeTestAccount, stores, runs, setWatching, elementSources, document }: AgentInspectorOptions) => AgentInspector;
|
|
70
|
+
export declare const createAgentInspector: ({ root, writeState, writeTestAccount, stores, runs, runningFlows, now, setWatching, elementSources, document }: AgentInspectorOptions) => AgentInspector;
|
|
@@ -4,7 +4,7 @@ import { isRecord as i } from "@plitzi/sdk-shared/helpers";
|
|
|
4
4
|
var a = (e, t) => {
|
|
5
5
|
let n = i(e.definition) ? e.definition : {}, r = i(n.bindings) ? n.bindings : {}, a = Object.values(r).flatMap((e) => Array.isArray(e) ? e : []).find((e) => i(e) && e.to === t && e.enabled !== !1);
|
|
6
6
|
return i(a) && typeof a.source == "string" ? a.source : void 0;
|
|
7
|
-
}, o = /* @__PURE__ */ new Set(["item", "index"]), s = "window.__plitzi — this page, in text (debug mode only):\n state(key?) runtime.state, or one key of it\n setState(key, value) writes runtime.state.<key>, as a setState step would\n sources(name?) every source's current value by name (apiContainer_site, list_products…), or one\n setAttribute(path, value)\n an element's attribute given a value (map.storms), as a page binding it would — refused, saying\n why, for one a binding gives (write its source)\n setSource(path, value)\n writes a source, or a path in it (apiContainer_site.items — or by its element, site.items),\n where its provider keeps it — what the page shows filled; until the provider answers again.\n A list row's item is refused: it comes from the list's items\n element(id) an element by its id, in a page or a component: type, attributes, what it reads and what each\n binding gave it (resolved), its own state, the component it places, copies, on screen, box\n flows(limit = 20) the last flows that ran: trigger, element, status, every step with its time and error\n serverFailures() why each server element failed on the page server since the page loaded, by id\n watch(on = true) one console line per flow as it ends\n signInAs(account, path?) the visitor signed in as a journey's test account ({ id, email?, roles?, permissions? }) —\n no session the server knows, moved to path in the same render; signInAs(null) signs it out\n navigate(path) the page moved to a path of the space as a link moves it, without loading it again", c = (e, t) => i(e) && i(t) && Object.keys(t).some((t) => !Object.hasOwn(e, t)), l = /^[A-Za-z0-9_-]+$/, u = (e) => Array.isArray(e) && e.every((e) => typeof e == "string" && l.test(e)), d = (e, t) => {
|
|
7
|
+
}, o = /* @__PURE__ */ new Set(["item", "index"]), s = "window.__plitzi — this page, in text (debug mode only):\n state(key?) runtime.state, or one key of it\n setState(key, value) writes runtime.state.<key>, as a setState step would\n sources(name?) every source's current value by name (apiContainer_site, list_products…), or one\n setAttribute(path, value)\n an element's attribute given a value (map.storms), as a page binding it would — refused, saying\n why, for one a binding gives (write its source)\n setSource(path, value)\n writes a source, or a path in it (apiContainer_site.items — or by its element, site.items),\n where its provider keeps it — what the page shows filled; until the provider answers again.\n A list row's item is refused: it comes from the list's items\n element(id) an element by its id, in a page or a component: type, attributes, what it reads and what each\n binding gave it (resolved), its own state, the component it places, copies, on screen, box\n flows(limit = 20) the last flows that ran: trigger, element, status, every step with its time and error\n running() the flows on their way now — a page-load flow waiting out a delay — and for how long\n serverFailures() why each server element failed on the page server since the page loaded, by id\n watch(on = true) one console line per flow as it ends\n signInAs(account, path?) the visitor signed in as a journey's test account ({ id, email?, roles?, permissions? }) —\n no session the server knows, moved to path in the same render; signInAs(null) signs it out\n navigate(path) the page moved to a path of the space as a link moves it, without loading it again", c = (e, t) => i(e) && i(t) && Object.keys(t).some((t) => !Object.hasOwn(e, t)), l = /^[A-Za-z0-9_-]+$/, u = (e) => Array.isArray(e) && e.every((e) => typeof e == "string" && l.test(e)), d = (e, t) => {
|
|
8
8
|
let n = r(e.getState(), "navigation").navigate;
|
|
9
9
|
return typeof n == "function" && (Reflect.apply(n, void 0, [t]), !0);
|
|
10
10
|
}, f = (e) => i(e) && typeof e.id == "string" && l.test(e.id) && (e.email === void 0 || typeof e.email == "string") && (e.roles === void 0 || u(e.roles)) && (e.permissions === void 0 || u(e.permissions)) ? {
|
|
@@ -12,7 +12,7 @@ var a = (e, t) => {
|
|
|
12
12
|
...typeof e.email == "string" ? { email: e.email } : {},
|
|
13
13
|
...u(e.roles) ? { roles: e.roles } : {},
|
|
14
14
|
permissions: u(e.permissions) ? e.permissions : []
|
|
15
|
-
} : void 0, p = ({ root: l, writeState: u, writeTestAccount: p, stores: m, runs: h,
|
|
15
|
+
} : void 0, p = ({ root: l, writeState: u, writeTestAccount: p, stores: m, runs: h, runningFlows: g, now: _, setWatching: v, elementSources: y, document: b }) => ({
|
|
16
16
|
help: () => s,
|
|
17
17
|
state: (e) => {
|
|
18
18
|
let t = r(l.getState(), "runtime", "state");
|
|
@@ -51,10 +51,15 @@ var a = (e, t) => {
|
|
|
51
51
|
let p = `schema.${u === void 0 ? "" : `components.${u}.`}flat.${o}.attributes.${s.join(".")}`;
|
|
52
52
|
return l.setState(p, n), o;
|
|
53
53
|
},
|
|
54
|
-
element: (t) => e(l.getState(), t,
|
|
54
|
+
element: (t) => e(l.getState(), t, b, y),
|
|
55
55
|
flows: (e = 20) => h().slice(-e),
|
|
56
|
+
running: () => g().map(({ trigger: e, on: t, since: n }) => ({
|
|
57
|
+
trigger: e,
|
|
58
|
+
...t === void 0 ? {} : { on: t },
|
|
59
|
+
ms: Math.max(0, Math.round(_() - n))
|
|
60
|
+
})),
|
|
56
61
|
serverFailures: () => r(l.getState(), "rsc", "failures"),
|
|
57
|
-
watch: (e = !0) => (
|
|
62
|
+
watch: (e = !0) => (v(e), e ? "Each flow is said in the console as it ends." : "Flows are no longer said in the console."),
|
|
58
63
|
signInAs: (e, t) => {
|
|
59
64
|
if (e == null) return p(void 0), "Signed out: the page shows a guest.";
|
|
60
65
|
let n = f(e);
|
|
@@ -4,36 +4,39 @@ import { useContext as r, useEffect as i } from "react";
|
|
|
4
4
|
import { StoreContext as a } from "@plitzi/nexus/react";
|
|
5
5
|
import { pConsole as o } from "@plitzi/sdk-shared/devTools";
|
|
6
6
|
import { getDevStoresSnapshot as s } from "@plitzi/nexus";
|
|
7
|
-
import {
|
|
7
|
+
import { flowsRunning as c } from "@plitzi/sdk-shared/devTools/running";
|
|
8
|
+
import { useCommonStoreSetter as l } from "@plitzi/sdk-shared/store";
|
|
8
9
|
// src/agentInspector/useAgentInspector.ts
|
|
9
|
-
var
|
|
10
|
-
let
|
|
10
|
+
var u = 100, d = (d, f) => {
|
|
11
|
+
let p = r(a), m = l();
|
|
11
12
|
i(() => {
|
|
12
|
-
let r =
|
|
13
|
-
if (!
|
|
14
|
-
let i = [], a = !1,
|
|
13
|
+
let r = f === void 0 ? window : f;
|
|
14
|
+
if (!d || !p || !r) return;
|
|
15
|
+
let i = [], a = !1, l = o.addListener((n) => {
|
|
15
16
|
let r = t(n);
|
|
16
|
-
r && (i.push(r), i.length >
|
|
17
|
-
}, { replay: !0 }),
|
|
18
|
-
root:
|
|
19
|
-
writeState: (e, t) =>
|
|
20
|
-
writeTestAccount: (e) =>
|
|
17
|
+
r && (i.push(r), i.length > u && i.shift(), a && console.info(e(r)));
|
|
18
|
+
}, { replay: !0 }), h = n({
|
|
19
|
+
root: p,
|
|
20
|
+
writeState: (e, t) => m(`runtime.state.${e}`, t),
|
|
21
|
+
writeTestAccount: (e) => m("runtime.testAccount", e),
|
|
21
22
|
stores: () => s().map((e) => e.store),
|
|
22
23
|
runs: () => i,
|
|
24
|
+
runningFlows: c,
|
|
25
|
+
now: () => o.getTime().valueOf(),
|
|
23
26
|
setWatching: (e) => {
|
|
24
27
|
a = e;
|
|
25
28
|
},
|
|
26
29
|
elementSources: (e) => o.providerData(`getElementDataSource-${e}`),
|
|
27
30
|
document: r.document
|
|
28
31
|
});
|
|
29
|
-
return r.__plitzi =
|
|
30
|
-
|
|
32
|
+
return r.__plitzi = h, () => {
|
|
33
|
+
l(), r.__plitzi === h && delete r.__plitzi;
|
|
31
34
|
};
|
|
32
35
|
}, [
|
|
33
|
-
|
|
34
|
-
f,
|
|
36
|
+
d,
|
|
35
37
|
p,
|
|
36
|
-
|
|
38
|
+
m,
|
|
39
|
+
f
|
|
37
40
|
]);
|
|
38
41
|
};
|
|
39
|
-
export {
|
|
42
|
+
export { d as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-dev-tools",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.16",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@plitzi/nexus": "^1.5.1",
|
|
49
49
|
"@plitzi/plitzi-ui": "^1.6.41",
|
|
50
|
-
"@plitzi/sdk-schema": "0.39.
|
|
51
|
-
"@plitzi/sdk-shared": "0.39.
|
|
50
|
+
"@plitzi/sdk-schema": "0.39.16",
|
|
51
|
+
"@plitzi/sdk-shared": "0.39.16",
|
|
52
52
|
"@uiw/react-json-view": "^2.0.0-alpha.44",
|
|
53
53
|
"clsx": "^2.1.1"
|
|
54
54
|
}
|