@plitzi/sdk-interactions 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @plitzi/sdk-interactions
2
2
 
3
+ ## 0.35.10
4
+
5
+ ### Patch Changes
6
+
7
+ - **Breaking:** the space setting that lets a published site open the dev tools is now `settings.debugMode`, and
8
+ `settings.devTools` is gone.
9
+
10
+ It was always the same decision the SDK and the page server call `debugMode` — whether the dev-tools panel is
11
+ authorized — and having a third name for it invited confusing it with `devMode`, which is a different thing: it turns a
12
+ deployment into a development server (the unminified bundles, request timings, and the full action trace with every
13
+ step's results). A space can authorize debugging for its own site; it can never make its server a development one.
14
+
15
+ A space that stored `settings.devTools` needs it moved to `settings.debugMode`; nothing reads the old key.
16
+
17
+ - Updated dependencies
18
+ - @plitzi/sdk-auth@0.35.10
19
+ - @plitzi/sdk-dev-tools@0.35.10
20
+ - @plitzi/sdk-event-bridge@0.35.10
21
+ - @plitzi/sdk-navigation@0.35.10
22
+ - @plitzi/sdk-schema@0.35.10
23
+ - @plitzi/sdk-shared@0.35.10
24
+
25
+ ## 0.35.9
26
+
27
+ ### Patch Changes
28
+
29
+ - Debug a server action's whole flow from the dev-tools, not just its answer.
30
+
31
+ 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
32
+ the redacted error of the one that broke the flow — the compensation steps `flow.onFailure` ran included. It carries
33
+ nothing a step was given or returned, so it goes to any page whose debugging the deployment authorized (`devMode`, or
34
+ a space that switched dev tools on for its published site) and to no other. The full trace, with each step's results,
35
+ still reaches only an authoring request or a development server.
36
+
37
+ Runs the SERVER started while rendering a page — the ones feeding `runtime: 'server'` elements — reach the dev-tools
38
+ too, seeded into the page and added to by every `/_rsc` refresh, under the same authorization: a page nobody
39
+ authorized is not told they happened. A response carrying them is never cached. A run that died on its deadline now
40
+ reports the step it was on rather than nothing at all.
41
+
42
+ The Actions tab was rebuilt around it: filters and search over the log, a run list that names the step that broke,
43
+ and a detail panel with the flow's timeline, its compensation shown apart, and what the run carried in and out.
44
+
45
+ - Updated dependencies
46
+ - @plitzi/sdk-auth@0.35.9
47
+ - @plitzi/sdk-dev-tools@0.35.9
48
+ - @plitzi/sdk-event-bridge@0.35.9
49
+ - @plitzi/sdk-navigation@0.35.9
50
+ - @plitzi/sdk-schema@0.35.9
51
+ - @plitzi/sdk-shared@0.35.9
52
+
3
53
  ## 0.35.8
4
54
 
5
55
  ### Patch Changes
@@ -7,7 +7,7 @@ import { recordActionProgress as c, recordActionRun as l, registerActionCancelle
7
7
  import { authFailureFromResponse as m, reportAuthFailure as h } from "@plitzi/sdk-shared/auth";
8
8
  import { toBuilderParams as g, toInteractionCallbacks as _ } from "@plitzi/sdk-shared/authoring/builder";
9
9
  //#region src/sources/ActionsSource/ActionInteractions.tsx
10
- var v = async (e, t) => {
10
+ var v = (e) => Array.isArray(e) ? e : void 0, y = async (e, t) => {
11
11
  let n = e.getReader(), r = new TextDecoder(), i = "";
12
12
  for (;;) {
13
13
  let { done: e, value: a } = await n.read();
@@ -27,7 +27,7 @@ var v = async (e, t) => {
27
27
  } catch {}
28
28
  }
29
29
  }
30
- }, y = (e) => {
30
+ }, b = (e) => {
31
31
  if (!e) return {};
32
32
  if (typeof e == "object") return e;
33
33
  try {
@@ -36,30 +36,30 @@ var v = async (e, t) => {
36
36
  } catch {
37
37
  return {};
38
38
  }
39
- }, b = {
39
+ }, x = {
40
40
  status: "failed",
41
41
  reason: "failed",
42
42
  runId: "",
43
43
  output: {}
44
- }, x = (e, t) => e.signal.aborted ? {
44
+ }, S = (e, t) => e.signal.aborted ? {
45
45
  status: "aborted",
46
46
  error: "Cancelled"
47
47
  } : {
48
48
  status: "failed",
49
49
  error: t instanceof Error ? t.message : String(t)
50
- }, S = (e, t, n) => {
50
+ }, C = (e, t, n) => {
51
51
  if (e !== 401) return;
52
52
  let r = m(e, t);
53
53
  r && h({
54
54
  reason: r,
55
55
  url: n
56
56
  });
57
- }, C = ({ children: m }) => {
58
- let { useInteractions: h, interactionsManager: C } = n(e), [w] = p("actions.endpoint"), [[T, E]] = p(["actions.catalog", "actions.available"]), D = r((e, t, n) => {
59
- e && C.interactionTrigger(e, t, n);
60
- }, [C]), O = r(async (e, t) => {
57
+ }, w = ({ children: m }) => {
58
+ let { useInteractions: h, interactionsManager: w } = n(e), [T] = p("actions.endpoint"), [[E, D]] = p(["actions.catalog", "actions.available"]), O = r((e, t, n) => {
59
+ e && w.interactionTrigger(e, t, n);
60
+ }, [w]), k = r(async (e, t) => {
61
61
  let { actionId: n, mode: r = "await", idempotencyKey: i } = e;
62
- if (!w) return a.warning("actions", /* @__PURE__ */ s("span", { children: [
62
+ if (!T) return a.warning("actions", /* @__PURE__ */ s("span", { children: [
63
63
  "Server action ",
64
64
  /* @__PURE__ */ o("b", { children: n }),
65
65
  " was skipped: this page is served without a Plitzi server"
@@ -76,7 +76,7 @@ var v = async (e, t) => {
76
76
  runId: "",
77
77
  output: {}
78
78
  };
79
- let p = y(e.input), m = JSON.stringify({
79
+ let p = b(e.input), m = JSON.stringify({
80
80
  actionId: n,
81
81
  input: p,
82
82
  ...i ? { idempotencyKey: i } : {}
@@ -90,12 +90,12 @@ var v = async (e, t) => {
90
90
  status: "aborted",
91
91
  endedAt: Date.now(),
92
92
  cancellable: !1
93
- }), _ && fetch(`${w}/run/${_}`, {
93
+ }), _ && fetch(`${T}/run/${_}`, {
94
94
  method: "DELETE",
95
95
  credentials: "same-origin"
96
96
  }).catch(() => void 0);
97
97
  });
98
- let C = (e) => {
98
+ let w = (e) => {
99
99
  d(h), f(h, {
100
100
  endedAt: Date.now(),
101
101
  cancellable: !1,
@@ -110,7 +110,7 @@ var v = async (e, t) => {
110
110
  actionId: n,
111
111
  mode: r,
112
112
  status: "accepted"
113
- }), fetch(w, {
113
+ }), fetch(T, {
114
114
  method: "POST",
115
115
  headers: { "Content-Type": "application/json" },
116
116
  credentials: "same-origin",
@@ -120,12 +120,13 @@ var v = async (e, t) => {
120
120
  }).then(async (e) => {
121
121
  let i = await e.json().catch(() => ({}));
122
122
  if (!e.ok) {
123
- S(e.status, i, w), C({
123
+ C(e.status, i, T), w({
124
124
  status: "failed",
125
125
  ...i.runId ? { runId: i.runId } : {},
126
126
  ...i.reason ? { reason: i.reason } : {},
127
- ...i.error ? { error: i.error } : {}
128
- }), D(t?.hostElementId, "onFlowError", {
127
+ ...i.error ? { error: i.error } : {},
128
+ ...i.steps ? { steps: i.steps } : {}
129
+ }), O(t?.hostElementId, "onFlowError", {
129
130
  actionId: n,
130
131
  runId: i.runId ?? "",
131
132
  error: i.error ?? "",
@@ -133,10 +134,11 @@ var v = async (e, t) => {
133
134
  });
134
135
  return;
135
136
  }
136
- C({
137
+ w({
137
138
  status: i.status === "completed" ? "completed" : "accepted",
138
139
  ...i.runId ? { runId: i.runId } : {},
139
140
  ...i.output ? { output: i.output } : {},
141
+ ...i.steps ? { steps: i.steps } : {},
140
142
  ...i.trace ? { trace: i.trace } : {}
141
143
  }), a.success("actions", /* @__PURE__ */ s("span", { children: [
142
144
  "Server action ",
@@ -148,14 +150,14 @@ var v = async (e, t) => {
148
150
  runId: i.runId,
149
151
  status: i.status,
150
152
  output: i.output
151
- }), D(t?.hostElementId, "onFlowEnd", {
153
+ }), O(t?.hostElementId, "onFlowEnd", {
152
154
  actionId: n,
153
155
  runId: i.runId ?? "",
154
156
  status: i.status ?? "completed",
155
157
  output: i.output ?? {}
156
158
  });
157
159
  }).catch((e) => {
158
- C(x(g, e)), a.warning("actions", /* @__PURE__ */ s("span", { children: [
160
+ w(S(g, e)), a.warning("actions", /* @__PURE__ */ s("span", { children: [
159
161
  "Server action ",
160
162
  /* @__PURE__ */ o("b", { children: n }),
161
163
  " could not be sent"
@@ -163,7 +165,7 @@ var v = async (e, t) => {
163
165
  actionId: n,
164
166
  mode: r,
165
167
  error: e instanceof Error ? e.message : String(e)
166
- }), D(t?.hostElementId, "onFlowError", {
168
+ }), O(t?.hostElementId, "onFlowError", {
167
169
  actionId: n,
168
170
  runId: "",
169
171
  error: "",
@@ -187,7 +189,7 @@ var v = async (e, t) => {
187
189
  });
188
190
  let e;
189
191
  try {
190
- e = await fetch(w, {
192
+ e = await fetch(T, {
191
193
  method: "POST",
192
194
  headers: {
193
195
  "Content-Type": "application/json",
@@ -198,7 +200,7 @@ var v = async (e, t) => {
198
200
  body: m
199
201
  });
200
202
  } catch (e) {
201
- return C(x(g, e)), a.warning("actions", /* @__PURE__ */ s("span", { children: [
203
+ return w(S(g, e)), a.warning("actions", /* @__PURE__ */ s("span", { children: [
202
204
  "Server action ",
203
205
  /* @__PURE__ */ o("b", { children: n }),
204
206
  " could not be reached"
@@ -206,21 +208,22 @@ var v = async (e, t) => {
206
208
  actionId: n,
207
209
  mode: r,
208
210
  error: e instanceof Error ? e.message : String(e)
209
- }), D(t?.hostElementId, "onFlowError", {
211
+ }), O(t?.hostElementId, "onFlowError", {
210
212
  actionId: n,
211
213
  runId: "",
212
214
  error: "",
213
215
  reason: "failed"
214
- }), b;
216
+ }), x;
215
217
  }
216
218
  if (!e.ok || !e.body) {
217
219
  let r = await e.json().catch(() => ({}));
218
- return S(e.status, r, w), C({
220
+ return C(e.status, r, T), w({
219
221
  status: "failed",
220
222
  ...r.runId ? { runId: r.runId } : {},
221
223
  ...r.reason ? { reason: r.reason } : {},
222
- ...r.error ? { error: r.error } : {}
223
- }), D(t?.hostElementId, "onFlowError", {
224
+ ...r.error ? { error: r.error } : {},
225
+ ...r.steps ? { steps: r.steps } : {}
226
+ }), O(t?.hostElementId, "onFlowError", {
224
227
  actionId: n,
225
228
  runId: r.runId ?? "",
226
229
  error: r.error ?? "",
@@ -236,9 +239,9 @@ var v = async (e, t) => {
236
239
  return _ = i, f(h, {
237
240
  status: "streaming",
238
241
  ...i ? { runId: i } : {}
239
- }), v(e.body, (e) => {
242
+ }), y(e.body, (e) => {
240
243
  if (e.event === "data") {
241
- c(h, e.data.chunk ?? e.data), D(t?.hostElementId, "onFlowProgress", {
244
+ c(h, e.data.chunk ?? e.data), O(t?.hostElementId, "onFlowProgress", {
242
245
  actionId: n,
243
246
  runId: i,
244
247
  ...e.data
@@ -246,29 +249,35 @@ var v = async (e, t) => {
246
249
  return;
247
250
  }
248
251
  if (e.event === "error") {
249
- C({
252
+ let r = v(e.data.steps);
253
+ w({
250
254
  status: "failed",
251
255
  ...typeof e.data.reason == "string" ? { reason: e.data.reason } : {},
252
- ...typeof e.data.error == "string" ? { error: e.data.error } : {}
253
- }), D(t?.hostElementId, "onFlowError", {
256
+ ...typeof e.data.error == "string" ? { error: e.data.error } : {},
257
+ ...r ? { steps: r } : {}
258
+ }), O(t?.hostElementId, "onFlowError", {
254
259
  actionId: n,
255
260
  runId: i,
256
261
  ...e.data
257
262
  });
258
263
  return;
259
264
  }
260
- e.event === "done" && (C({
261
- status: e.data.status === "completed" ? "completed" : "failed",
262
- ...e.data.output ? { output: e.data.output } : {}
263
- }), D(t?.hostElementId, "onFlowEnd", {
264
- actionId: n,
265
- runId: i,
266
- ...e.data
267
- }));
265
+ if (e.event === "done") {
266
+ let r = v(e.data.steps);
267
+ w({
268
+ status: e.data.status === "completed" ? "completed" : "failed",
269
+ ...e.data.output ? { output: e.data.output } : {},
270
+ ...r ? { steps: r } : {}
271
+ }), O(t?.hostElementId, "onFlowEnd", {
272
+ actionId: n,
273
+ runId: i,
274
+ ...e.data
275
+ });
276
+ }
268
277
  }).catch((e) => {
269
278
  if (g.signal.aborted) return;
270
279
  let c = e instanceof Error ? e.message : String(e);
271
- C({
280
+ w({
272
281
  status: "failed",
273
282
  error: c
274
283
  }), a.warning("actions", /* @__PURE__ */ s("span", { children: [
@@ -280,7 +289,7 @@ var v = async (e, t) => {
280
289
  mode: r,
281
290
  runId: i,
282
291
  error: c
283
- }), D(t?.hostElementId, "onFlowError", {
292
+ }), O(t?.hostElementId, "onFlowError", {
284
293
  actionId: n,
285
294
  runId: i,
286
295
  error: c,
@@ -293,9 +302,9 @@ var v = async (e, t) => {
293
302
  output: {}
294
303
  };
295
304
  }
296
- let T;
305
+ let E;
297
306
  try {
298
- T = await fetch(w, {
307
+ E = await fetch(T, {
299
308
  method: "POST",
300
309
  headers: { "Content-Type": "application/json" },
301
310
  credentials: "same-origin",
@@ -303,35 +312,37 @@ var v = async (e, t) => {
303
312
  body: m
304
313
  });
305
314
  } catch (e) {
306
- return C(x(g, e)), a.warning("interactions", /* @__PURE__ */ s("span", { children: [
315
+ return w(S(g, e)), a.warning("interactions", /* @__PURE__ */ s("span", { children: [
307
316
  "Server action ",
308
317
  /* @__PURE__ */ o("b", { children: n }),
309
318
  " could not be reached"
310
319
  ] }), {
311
320
  actionId: n,
312
321
  error: e instanceof Error ? e.message : String(e)
313
- }), D(t?.hostElementId, "onFlowError", {
322
+ }), O(t?.hostElementId, "onFlowError", {
314
323
  actionId: n,
315
324
  runId: "",
316
325
  error: "",
317
326
  reason: "failed"
318
- }), b;
327
+ }), x;
319
328
  }
320
- let E = await T.json().catch(() => ({}));
321
- return T.ok ? (C({
322
- status: E.status === "completed" ? "completed" : "failed",
323
- ...E.runId ? { runId: E.runId } : {},
324
- ...E.output ? { output: E.output } : {},
325
- ...E.trace ? { trace: E.trace } : {}
329
+ let D = await E.json().catch(() => ({}));
330
+ return E.ok ? (w({
331
+ status: D.status === "completed" ? "completed" : "failed",
332
+ ...D.runId ? { runId: D.runId } : {},
333
+ ...D.output ? { output: D.output } : {},
334
+ ...D.steps ? { steps: D.steps } : {},
335
+ ...D.trace ? { trace: D.trace } : {}
326
336
  }), {
327
- status: E.status ?? "completed",
328
- runId: E.runId ?? "",
329
- output: E.output ?? {}
330
- }) : (S(T.status, E, w), C({
337
+ status: D.status ?? "completed",
338
+ runId: D.runId ?? "",
339
+ output: D.output ?? {}
340
+ }) : (C(E.status, D, T), w({
331
341
  status: "failed",
332
- ...E.runId ? { runId: E.runId } : {},
333
- ...E.reason ? { reason: E.reason } : {},
334
- ...E.error ? { error: E.error } : {}
342
+ ...D.runId ? { runId: D.runId } : {},
343
+ ...D.reason ? { reason: D.reason } : {},
344
+ ...D.error ? { error: D.error } : {},
345
+ ...D.steps ? { steps: D.steps } : {}
335
346
  }), a.warning("actions", /* @__PURE__ */ s("span", { children: [
336
347
  "Server action ",
337
348
  /* @__PURE__ */ o("b", { children: n }),
@@ -339,20 +350,20 @@ var v = async (e, t) => {
339
350
  ] }), {
340
351
  actionId: n,
341
352
  mode: r,
342
- runId: E.runId,
343
- reason: E.reason,
344
- error: E.error,
345
- status: String(T.status)
353
+ runId: D.runId,
354
+ reason: D.reason,
355
+ error: D.error,
356
+ status: String(E.status)
346
357
  }), {
347
358
  status: "failed",
348
- reason: E.reason ?? "failed",
349
- runId: E.runId ?? "",
359
+ reason: D.reason ?? "failed",
360
+ runId: D.runId ?? "",
350
361
  output: {}
351
362
  });
352
- }, [w, D]), k = r(async (e) => {
353
- if (!w || !e.runId) return { cancelled: !1 };
363
+ }, [T, O]), A = r(async (e) => {
364
+ if (!T || !e.runId) return { cancelled: !1 };
354
365
  try {
355
- let t = (await fetch(`${w}/run/${e.runId}`, {
366
+ let t = (await fetch(`${T}/run/${e.runId}`, {
356
367
  method: "DELETE",
357
368
  credentials: "same-origin"
358
369
  })).status === 204;
@@ -370,25 +381,25 @@ var v = async (e, t) => {
370
381
  } catch {
371
382
  return { cancelled: !1 };
372
383
  }
373
- }, [w]), A = i(() => (T ?? []).map((e) => ({
384
+ }, [T]), j = i(() => (E ?? []).map((e) => ({
374
385
  label: `${e.name} (${e.identifier})`,
375
386
  value: e.identifier
376
- })), [T]);
387
+ })), [E]);
377
388
  return h({
378
389
  id: "actions",
379
390
  callbacks: i(() => _(t, {
380
- cancelServerAction: k,
381
- runServerAction: O
391
+ cancelServerAction: A,
392
+ runServerAction: k
382
393
  }, { runServerAction: { params: (e) => {
383
- let n = g(t.runServerAction.params), r = (T ?? []).find((t) => t.identifier === e.actionId), i = Object.entries(r?.input ?? {});
394
+ let n = g(t.runServerAction.params), r = (E ?? []).find((t) => t.identifier === e.actionId), i = Object.entries(r?.input ?? {});
384
395
  return {
385
396
  ...n,
386
397
  actionId: {
387
398
  ...n.actionId,
388
- type: () => A.length > 0 ? "select" : "text",
399
+ type: () => j.length > 0 ? "select" : "text",
389
400
  canBind: !0,
390
- label: E === !1 ? "Action — this space has no server to run it" : "Action",
391
- options: A
401
+ label: D === !1 ? "Action — this space has no server to run it" : "Action",
402
+ options: j
392
403
  },
393
404
  input: {
394
405
  ...n.input,
@@ -397,13 +408,13 @@ var v = async (e, t) => {
397
408
  }
398
409
  };
399
410
  } } }), [
400
- O,
401
411
  k,
402
412
  A,
403
- T,
404
- E
413
+ j,
414
+ E,
415
+ D
405
416
  ])
406
417
  }), m;
407
418
  };
408
419
  //#endregion
409
- export { C as default };
420
+ export { w as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-interactions",
3
- "version": "0.35.8",
3
+ "version": "0.35.10",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist"
@@ -166,11 +166,11 @@
166
166
  },
167
167
  "dependencies": {
168
168
  "@plitzi/plitzi-ui": "^1.6.21",
169
- "@plitzi/sdk-auth": "0.35.8",
170
- "@plitzi/sdk-dev-tools": "0.35.8",
171
- "@plitzi/sdk-event-bridge": "0.35.8",
172
- "@plitzi/sdk-navigation": "0.35.8",
173
- "@plitzi/sdk-schema": "0.35.8",
174
- "@plitzi/sdk-shared": "0.35.8"
169
+ "@plitzi/sdk-auth": "0.35.10",
170
+ "@plitzi/sdk-dev-tools": "0.35.10",
171
+ "@plitzi/sdk-event-bridge": "0.35.10",
172
+ "@plitzi/sdk-navigation": "0.35.10",
173
+ "@plitzi/sdk-schema": "0.35.10",
174
+ "@plitzi/sdk-shared": "0.35.10"
175
175
  }
176
176
  }