@plitzi/sdk-shared 0.35.8 → 0.35.10

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.
@@ -1,9 +1,9 @@
1
1
  import e, { DEFAULT_RENDER_SETTINGS as t, useRenderOverride as n } from "./renderSettings.mjs";
2
2
  import r from "./actionRuns/actionRunsStore.mjs";
3
- import { cancelActionRun as i, clearActionRuns as a, recordActionProgress as o, recordActionRun as s, registerActionCanceller as c, releaseActionCanceller as l, updateActionRun as u } from "./actionRuns/actionRunsRecorder.mjs";
4
- import d from "./actionRuns/useActionRuns.mjs";
5
- import { createStoreHook as f } from "@plitzi/nexus/react";
3
+ import { cancelActionRun as i, clearActionRuns as a, recordActionProgress as o, recordActionRun as s, recordRenderActionRuns as c, registerActionCanceller as l, releaseActionCanceller as u, updateActionRun as d } from "./actionRuns/actionRunsRecorder.mjs";
4
+ import f from "./actionRuns/useActionRuns.mjs";
5
+ import { createStoreHook as p } from "@plitzi/nexus/react";
6
6
  //#region src/store/index.ts
7
- var { useStore: p, useStoreSync: m, useStoreGetter: h, useStoreSetter: g } = f(), { useStore: _, useStoreSync: v, useStoreGetter: y, useStoreSetter: b } = f(), { useStore: x, useStoreSync: S, useStoreGetter: C, useStoreSetter: w } = f();
7
+ var { useStore: m, useStoreSync: h, useStoreGetter: g, useStoreSetter: _ } = p(), { useStore: v, useStoreSync: y, useStoreGetter: b, useStoreSetter: x } = p(), { useStore: S, useStoreSync: C, useStoreGetter: w, useStoreSetter: T } = p();
8
8
  //#endregion
9
- export { t as DEFAULT_RENDER_SETTINGS, r as actionRunsStore, i as cancelActionRun, a as clearActionRuns, o as recordActionProgress, s as recordActionRun, c as registerActionCanceller, l as releaseActionCanceller, u as updateActionRun, d as useActionRuns, x as useBuilderStore, C as useBuilderStoreGetter, w as useBuilderStoreSetter, S as useBuilderStoreSync, p as useCommonStore, h as useCommonStoreGetter, g as useCommonStoreSetter, m as useCommonStoreSync, n as useRenderOverride, e as useRenderSettings, _ as useSdkStore, y as useSdkStoreGetter, b as useSdkStoreSetter, v as useSdkStoreSync };
9
+ export { t as DEFAULT_RENDER_SETTINGS, r as actionRunsStore, i as cancelActionRun, a as clearActionRuns, o as recordActionProgress, s as recordActionRun, c as recordRenderActionRuns, l as registerActionCanceller, u as releaseActionCanceller, d as updateActionRun, f as useActionRuns, S as useBuilderStore, w as useBuilderStoreGetter, T as useBuilderStoreSetter, C as useBuilderStoreSync, m as useCommonStore, g as useCommonStoreGetter, _ as useCommonStoreSetter, h as useCommonStoreSync, n as useRenderOverride, e as useRenderSettings, v as useSdkStore, b as useSdkStoreGetter, x as useSdkStoreSetter, y as useSdkStoreSync };
@@ -1,4 +1,5 @@
1
1
  import { Environment } from './CommonTypes';
2
+ import { InteractionNodeStatus } from './InteractionTypes';
2
3
  import { ElementInteraction } from './SchemaTypes';
3
4
  import { SmtpSettings } from '../actions/smtp';
4
5
  /**
@@ -314,6 +315,45 @@ export type ActionRunRecord = {
314
315
  /** Present when the run ended badly. Already redacted of credential values. */
315
316
  error?: string;
316
317
  };
318
+ /**
319
+ * One step of a server action run, as a debugger may show it to anybody allowed to debug the page.
320
+ *
321
+ * What ran, in what order, how it ended and how long it took — never what the step was given or what it returned.
322
+ * Those can hold another visitor's data or a flow's internals (an endpoint, a query), so they stay in the full trace,
323
+ * which only authoring requests and development servers receive.
324
+ */
325
+ export type ActionRunStep = {
326
+ id: string;
327
+ title: string;
328
+ /** The task it ran, e.g. `kv.increment`. */
329
+ action: string;
330
+ status: InteractionNodeStatus;
331
+ /** `undo` for `flow.onFailure` and the steps after it: they ran because the flow before them failed. */
332
+ phase: 'flow' | 'undo';
333
+ startTime: number;
334
+ endTime: number;
335
+ /** Why it failed, redacted of every credential value the run resolved. */
336
+ error?: string;
337
+ };
338
+ /**
339
+ * A run a page RENDER started, reported to a page whose debugging is authorized.
340
+ *
341
+ * Nobody in the browser sent it — the server ran it while building the page, or while answering a refresh — so this is
342
+ * the only way it reaches a debugger. The same outline a call reports, and nothing more.
343
+ */
344
+ export type ActionRunSummary = {
345
+ actionId: string;
346
+ runId: string;
347
+ trigger: 'render';
348
+ status: ActionRunStatus;
349
+ /** The server element it fed. */
350
+ elementId?: string;
351
+ startedAt: number;
352
+ endedAt: number;
353
+ steps: ActionRunStep[];
354
+ /** Why a run ended before its steps could say — a deadline, a refusal. Never a provider's own message. */
355
+ error?: string;
356
+ };
317
357
  /**
318
358
  * One message a flow asked to send.
319
359
  *
@@ -158,10 +158,11 @@ export type Schema = {
158
158
  /**
159
159
  * Lets the published site open the dev tools — elements, state, interactions — for anybody who visits it.
160
160
  *
161
- * The space's own answer, read by a page server that left the decision open: a server that sets `debugMode`
162
- * decides for every space it renders, and an explicit `false` there cannot be turned around from here.
161
+ * The same `debugMode` the SDK and the page server take, answered by the space: read by a page server that left the
162
+ * decision open. A server that sets its own `debugMode` decides for every space it renders, and an explicit
163
+ * `false` there cannot be turned around from here. Never `devMode`, which makes a deployment a development server.
163
164
  */
164
- devTools?: boolean;
165
+ debugMode?: boolean;
165
166
  };
166
167
  rsc?: SchemaRsc;
167
168
  pages: Element['id'][];
@@ -1,4 +1,4 @@
1
- import { ActionEmailConfig, ActionEntry, ActionLimits, ActionRejectReason, ActionRejectRecord, ActionRunRecord, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
1
+ import { ActionEmailConfig, ActionEntry, ActionLimits, ActionRejectReason, ActionRunSummary, ActionRejectRecord, ActionRunRecord, ActionRunStatus, ActionTaskDescriptor, ActionTriggerType } from './ActionTypes';
2
2
  import { Environment } from './CommonTypes';
3
3
  import { ConnectorEntry } from './ConnectorTypes';
4
4
  import { Schema } from './SchemaTypes';
@@ -855,6 +855,11 @@ export type SSRContext = {
855
855
  /** What {@link SSRAdapters.meter} answered for this request, so the render reads the decision instead of
856
856
  * asking for it a second time. */
857
857
  meter?: SSRMeterDecision;
858
+ /**
859
+ * The runs this request's server elements started, as the action resolver ran them. Read once the render or the
860
+ * refresh is done, and handed on only to a page whose debugging is authorized.
861
+ */
862
+ actionRuns?: ActionRunSummary[];
858
863
  };
859
864
  export type SSRServer = {
860
865
  listen: (port: number, host?: string) => void;
@@ -1,4 +1,4 @@
1
- import { ActionField } from './ActionTypes';
1
+ import { ActionField, ActionRunStep } from './ActionTypes';
2
2
  import { SubscriptionCollaborator, SubscriptionCollaboratorPointer } from './BuilderTypes';
3
3
  import { Environment, RenderMode } from './CommonTypes';
4
4
  import { Source } from './DataSourceTypes';
@@ -256,15 +256,16 @@ export type TracingTree = Record<string, TracingTreeNode>;
256
256
  * One server action this page started, as the dev-tools show it back.
257
257
  *
258
258
  * Recorded by the `runServerAction` step itself, so it covers what no network tab makes legible: which action was
259
- * named, in which mode, what the server answered, and — when the deployment is a dev one, which is the only time
260
- * the server sends it — the STEPS the flow ran on the other side. A `detached` run has no answer to await and a
261
- * `stream` returns before its frames arrive, so both are invisible without a record of their own.
259
+ * named, in which mode, what the server answered, and — when debugging this page is authorized — the STEPS the flow
260
+ * ran on the other side. A `detached` run has no answer to await and a `stream` returns before its frames arrive, so
261
+ * both are invisible without a record of their own; a `render` run is invisible by nature, since the server did it
262
+ * while building the page and no step here ever called it.
262
263
  */
263
264
  export type ActionRunEntry = {
264
265
  /** Local to this page: assigned when the run is SENT, which is before any server run id exists. */
265
266
  id: string;
266
267
  actionId: string;
267
- mode: 'await' | 'detached' | 'stream';
268
+ mode: 'await' | 'detached' | 'stream' | 'render';
268
269
  /** The server's own id, once it answers. Absent for a run that never reached one. */
269
270
  runId?: string;
270
271
  status: 'running' | 'completed' | 'failed' | 'accepted' | 'streaming' | 'skipped' | 'aborted';
@@ -276,7 +277,16 @@ export type ActionRunEntry = {
276
277
  output?: Record<string, unknown>;
277
278
  /** Chunks a streaming run emitted, in order. */
278
279
  progress: unknown[];
279
- /** The server-side steps, when the deployment sent them: authoring requests and dev servers only. */
280
+ /**
281
+ * What the flow DID, step by step — its order, each step's outcome, and the one that broke it.
282
+ *
283
+ * Sent to any page whose debugging is authorized, because it says nothing a step was given or returned: those
284
+ * are in the trace below.
285
+ */
286
+ steps?: ActionRunStep[];
287
+ /** The server element a `render` run fed. A page has several, and each is a different flow. */
288
+ elementId?: string;
289
+ /** The steps WITH what each one read and answered. Authoring requests and dev servers only. */
280
290
  trace?: Record<string, unknown>[];
281
291
  /**
282
292
  * Whether this run can still be stopped from the panel.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-shared",
3
- "version": "0.35.8",
3
+ "version": "0.35.10",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",