@plitzi/sdk-interactions 0.33.2 → 0.34.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/InteractionsHelper.d.ts +3 -3
  3. package/dist/InteractionsHelper.mjs +92 -86
  4. package/dist/InteractionsManager.mjs +1 -1
  5. package/dist/InteractionsSourcesProvider.d.ts +4 -1
  6. package/dist/InteractionsSourcesProvider.mjs +24 -19
  7. package/dist/hooks/useInteractions.d.ts +1 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.mjs +8 -5
  10. package/dist/sources/ActionsSource/ActionInteractions.d.ts +13 -0
  11. package/dist/sources/ActionsSource/ActionInteractions.mjs +409 -0
  12. package/dist/sources/ActionsSource/callbacks.d.ts +12 -0
  13. package/dist/sources/ActionsSource/callbacks.mjs +63 -0
  14. package/dist/sources/ActionsSource/index.d.ts +3 -0
  15. package/dist/sources/ActionsSource/index.mjs +2 -0
  16. package/dist/sources/AuthSource/AuthInteractions.mjs +17 -94
  17. package/dist/sources/AuthSource/callbacks.d.ts +32 -0
  18. package/dist/sources/AuthSource/callbacks.mjs +71 -0
  19. package/dist/sources/HostSource/HostInteractions.d.ts +16 -0
  20. package/dist/sources/HostSource/HostInteractions.mjs +20 -0
  21. package/dist/sources/HostSource/callbacks.d.ts +15 -0
  22. package/dist/sources/HostSource/callbacks.mjs +20 -0
  23. package/dist/sources/HostSource/index.d.ts +3 -0
  24. package/dist/sources/HostSource/index.mjs +3 -0
  25. package/dist/sources/NavigationSource/NavigationInteractions.mjs +27 -48
  26. package/dist/sources/NavigationSource/callbacks.d.ts +9 -0
  27. package/dist/sources/NavigationSource/callbacks.mjs +30 -0
  28. package/dist/sources/StateSource/StateInteractions.mjs +69 -64
  29. package/dist/sources/StateSource/callbacks.d.ts +3 -0
  30. package/dist/sources/StateSource/callbacks.mjs +151 -0
  31. package/dist/sources/index.d.ts +5 -1
  32. package/dist/sources/index.mjs +7 -4
  33. package/dist/utility/transformer.mjs +0 -0
  34. package/dist/utility/webHook.mjs +15 -11
  35. package/package.json +54 -9
@@ -0,0 +1,409 @@
1
+ import e from "../../InteractionsContext.mjs";
2
+ import { actionsCallbacks as t } from "./callbacks.mjs";
3
+ import { use as n, useCallback as r, useMemo as i } from "react";
4
+ import { pConsole as a } from "@plitzi/sdk-shared/devTools/utils/PlitziConsole";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import { recordActionProgress as c, recordActionRun as l, registerActionCanceller as u, releaseActionCanceller as d, updateActionRun as f, useCommonStore as p } from "@plitzi/sdk-shared/store";
7
+ import { authFailureFromResponse as m, reportAuthFailure as h } from "@plitzi/sdk-shared/auth";
8
+ import { toBuilderParams as g, toInteractionCallbacks as _ } from "@plitzi/sdk-shared/authoring/builder";
9
+ //#region src/sources/ActionsSource/ActionInteractions.tsx
10
+ var v = async (e, t) => {
11
+ let n = e.getReader(), r = new TextDecoder(), i = "";
12
+ for (;;) {
13
+ let { done: e, value: a } = await n.read();
14
+ if (e) return;
15
+ i += r.decode(a, { stream: !0 });
16
+ let o = i.split("\n\n");
17
+ i = o.pop() ?? "";
18
+ for (let e of o) {
19
+ let n = /event: (\w+)/.exec(e)?.[1];
20
+ if (!n) continue;
21
+ let r = e.split("\n").filter((e) => e.startsWith("data:")).map((e) => e.slice(5).trimStart()).join("\n");
22
+ try {
23
+ t({
24
+ event: n,
25
+ data: r ? JSON.parse(r) : {}
26
+ });
27
+ } catch {}
28
+ }
29
+ }
30
+ }, y = (e) => {
31
+ if (!e) return {};
32
+ if (typeof e == "object") return e;
33
+ try {
34
+ let t = JSON.parse(e);
35
+ return typeof t == "object" && t ? t : {};
36
+ } catch {
37
+ return {};
38
+ }
39
+ }, b = {
40
+ status: "failed",
41
+ reason: "failed",
42
+ runId: "",
43
+ output: {}
44
+ }, x = (e, t) => e.signal.aborted ? {
45
+ status: "aborted",
46
+ error: "Cancelled"
47
+ } : {
48
+ status: "failed",
49
+ error: t instanceof Error ? t.message : String(t)
50
+ }, S = (e, t, n) => {
51
+ if (e !== 401) return;
52
+ let r = m(e, t);
53
+ r && h({
54
+ reason: r,
55
+ url: n
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) => {
61
+ let { actionId: n, mode: r = "await", idempotencyKey: i } = e;
62
+ if (!w) return a.warning("actions", /* @__PURE__ */ s("span", { children: [
63
+ "Server action ",
64
+ /* @__PURE__ */ o("b", { children: n }),
65
+ " was skipped: this page is served without a Plitzi server"
66
+ ] }), {
67
+ actionId: n,
68
+ status: "skipped"
69
+ }), {
70
+ status: "skipped",
71
+ runId: "",
72
+ output: {}
73
+ };
74
+ if (!n) return {
75
+ status: "skipped",
76
+ runId: "",
77
+ output: {}
78
+ };
79
+ let p = y(e.input), m = JSON.stringify({
80
+ actionId: n,
81
+ input: p,
82
+ ...i ? { idempotencyKey: i } : {}
83
+ }), h = l({
84
+ actionId: n,
85
+ mode: r,
86
+ input: p
87
+ }), g = new AbortController(), _ = "";
88
+ u(h, () => {
89
+ g.abort(), f(h, {
90
+ status: "aborted",
91
+ endedAt: Date.now(),
92
+ cancellable: !1
93
+ }), _ && fetch(`${w}/run/${_}`, {
94
+ method: "DELETE",
95
+ credentials: "same-origin"
96
+ }).catch(() => void 0);
97
+ });
98
+ let C = (e) => {
99
+ d(h), f(h, {
100
+ endedAt: Date.now(),
101
+ cancellable: !1,
102
+ ...e
103
+ });
104
+ };
105
+ if (r === "detached") return a.info("actions", /* @__PURE__ */ s("span", { children: [
106
+ "Server action ",
107
+ /* @__PURE__ */ o("b", { children: n }),
108
+ " sent"
109
+ ] }), {
110
+ actionId: n,
111
+ mode: r,
112
+ status: "accepted"
113
+ }), fetch(w, {
114
+ method: "POST",
115
+ headers: { "Content-Type": "application/json" },
116
+ credentials: "same-origin",
117
+ keepalive: !0,
118
+ signal: g.signal,
119
+ body: m
120
+ }).then(async (e) => {
121
+ let i = await e.json().catch(() => ({}));
122
+ if (!e.ok) {
123
+ S(e.status, i, w), C({
124
+ status: "failed",
125
+ ...i.runId ? { runId: i.runId } : {},
126
+ ...i.reason ? { reason: i.reason } : {},
127
+ ...i.error ? { error: i.error } : {}
128
+ }), D(t?.hostElementId, "onFlowError", {
129
+ actionId: n,
130
+ runId: i.runId ?? "",
131
+ error: i.error ?? "",
132
+ reason: i.reason ?? "failed"
133
+ });
134
+ return;
135
+ }
136
+ C({
137
+ status: i.status === "completed" ? "completed" : "accepted",
138
+ ...i.runId ? { runId: i.runId } : {},
139
+ ...i.output ? { output: i.output } : {},
140
+ ...i.trace ? { trace: i.trace } : {}
141
+ }), a.success("actions", /* @__PURE__ */ s("span", { children: [
142
+ "Server action ",
143
+ /* @__PURE__ */ o("b", { children: n }),
144
+ " finished"
145
+ ] }), {
146
+ actionId: n,
147
+ mode: r,
148
+ runId: i.runId,
149
+ status: i.status,
150
+ output: i.output
151
+ }), D(t?.hostElementId, "onFlowEnd", {
152
+ actionId: n,
153
+ runId: i.runId ?? "",
154
+ status: i.status ?? "completed",
155
+ output: i.output ?? {}
156
+ });
157
+ }).catch((e) => {
158
+ C(x(g, e)), a.warning("actions", /* @__PURE__ */ s("span", { children: [
159
+ "Server action ",
160
+ /* @__PURE__ */ o("b", { children: n }),
161
+ " could not be sent"
162
+ ] }), {
163
+ actionId: n,
164
+ mode: r,
165
+ error: e instanceof Error ? e.message : String(e)
166
+ }), D(t?.hostElementId, "onFlowError", {
167
+ actionId: n,
168
+ runId: "",
169
+ error: "",
170
+ reason: "failed"
171
+ });
172
+ }), {
173
+ accepted: !0,
174
+ status: "accepted",
175
+ runId: "",
176
+ output: {}
177
+ };
178
+ if (r === "stream") {
179
+ a.info("actions", /* @__PURE__ */ s("span", { children: [
180
+ "Server action ",
181
+ /* @__PURE__ */ o("b", { children: n }),
182
+ " streaming"
183
+ ] }), {
184
+ actionId: n,
185
+ mode: r,
186
+ status: "streaming"
187
+ });
188
+ let e;
189
+ try {
190
+ e = await fetch(w, {
191
+ method: "POST",
192
+ headers: {
193
+ "Content-Type": "application/json",
194
+ Accept: "text/event-stream"
195
+ },
196
+ credentials: "same-origin",
197
+ signal: g.signal,
198
+ body: m
199
+ });
200
+ } catch (e) {
201
+ return C(x(g, e)), a.warning("actions", /* @__PURE__ */ s("span", { children: [
202
+ "Server action ",
203
+ /* @__PURE__ */ o("b", { children: n }),
204
+ " could not be reached"
205
+ ] }), {
206
+ actionId: n,
207
+ mode: r,
208
+ error: e instanceof Error ? e.message : String(e)
209
+ }), D(t?.hostElementId, "onFlowError", {
210
+ actionId: n,
211
+ runId: "",
212
+ error: "",
213
+ reason: "failed"
214
+ }), b;
215
+ }
216
+ if (!e.ok || !e.body) {
217
+ let r = await e.json().catch(() => ({}));
218
+ return S(e.status, r, w), C({
219
+ status: "failed",
220
+ ...r.runId ? { runId: r.runId } : {},
221
+ ...r.reason ? { reason: r.reason } : {},
222
+ ...r.error ? { error: r.error } : {}
223
+ }), D(t?.hostElementId, "onFlowError", {
224
+ actionId: n,
225
+ runId: r.runId ?? "",
226
+ error: r.error ?? "",
227
+ reason: r.reason ?? "failed"
228
+ }), {
229
+ status: "failed",
230
+ reason: r.reason ?? "failed",
231
+ runId: "",
232
+ output: {}
233
+ };
234
+ }
235
+ let i = e.headers.get("X-Plitzi-Run-Id") ?? "";
236
+ return _ = i, f(h, {
237
+ status: "streaming",
238
+ ...i ? { runId: i } : {}
239
+ }), v(e.body, (e) => {
240
+ if (e.event === "data") {
241
+ c(h, e.data.chunk ?? e.data), D(t?.hostElementId, "onFlowProgress", {
242
+ actionId: n,
243
+ runId: i,
244
+ ...e.data
245
+ });
246
+ return;
247
+ }
248
+ if (e.event === "error") {
249
+ C({
250
+ status: "failed",
251
+ ...typeof e.data.reason == "string" ? { reason: e.data.reason } : {},
252
+ ...typeof e.data.error == "string" ? { error: e.data.error } : {}
253
+ }), D(t?.hostElementId, "onFlowError", {
254
+ actionId: n,
255
+ runId: i,
256
+ ...e.data
257
+ });
258
+ return;
259
+ }
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
+ }));
268
+ }).catch((e) => {
269
+ if (g.signal.aborted) return;
270
+ let c = e instanceof Error ? e.message : String(e);
271
+ C({
272
+ status: "failed",
273
+ error: c
274
+ }), a.warning("actions", /* @__PURE__ */ s("span", { children: [
275
+ "Server action ",
276
+ /* @__PURE__ */ o("b", { children: n }),
277
+ " stopped mid-stream"
278
+ ] }), {
279
+ actionId: n,
280
+ mode: r,
281
+ runId: i,
282
+ error: c
283
+ }), D(t?.hostElementId, "onFlowError", {
284
+ actionId: n,
285
+ runId: i,
286
+ error: c,
287
+ reason: "failed"
288
+ });
289
+ }), {
290
+ accepted: !0,
291
+ status: "streaming",
292
+ runId: i,
293
+ output: {}
294
+ };
295
+ }
296
+ let T;
297
+ try {
298
+ T = await fetch(w, {
299
+ method: "POST",
300
+ headers: { "Content-Type": "application/json" },
301
+ credentials: "same-origin",
302
+ signal: g.signal,
303
+ body: m
304
+ });
305
+ } catch (e) {
306
+ return C(x(g, e)), a.warning("interactions", /* @__PURE__ */ s("span", { children: [
307
+ "Server action ",
308
+ /* @__PURE__ */ o("b", { children: n }),
309
+ " could not be reached"
310
+ ] }), {
311
+ actionId: n,
312
+ error: e instanceof Error ? e.message : String(e)
313
+ }), D(t?.hostElementId, "onFlowError", {
314
+ actionId: n,
315
+ runId: "",
316
+ error: "",
317
+ reason: "failed"
318
+ }), b;
319
+ }
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 } : {}
326
+ }), {
327
+ status: E.status ?? "completed",
328
+ runId: E.runId ?? "",
329
+ output: E.output ?? {}
330
+ }) : (S(T.status, E, w), C({
331
+ status: "failed",
332
+ ...E.runId ? { runId: E.runId } : {},
333
+ ...E.reason ? { reason: E.reason } : {},
334
+ ...E.error ? { error: E.error } : {}
335
+ }), a.warning("actions", /* @__PURE__ */ s("span", { children: [
336
+ "Server action ",
337
+ /* @__PURE__ */ o("b", { children: n }),
338
+ " was refused"
339
+ ] }), {
340
+ actionId: n,
341
+ mode: r,
342
+ runId: E.runId,
343
+ reason: E.reason,
344
+ error: E.error,
345
+ status: String(T.status)
346
+ }), {
347
+ status: "failed",
348
+ reason: E.reason ?? "failed",
349
+ runId: E.runId ?? "",
350
+ output: {}
351
+ });
352
+ }, [w, D]), k = r(async (e) => {
353
+ if (!w || !e.runId) return { cancelled: !1 };
354
+ try {
355
+ let t = (await fetch(`${w}/run/${e.runId}`, {
356
+ method: "DELETE",
357
+ credentials: "same-origin"
358
+ })).status === 204;
359
+ return a.info("actions", /* @__PURE__ */ s("span", { children: [
360
+ "Server action run ",
361
+ /* @__PURE__ */ o("b", { children: e.runId }),
362
+ " ",
363
+ t ? "cancelled" : "was not cancelled"
364
+ ] }), {
365
+ actionId: "",
366
+ mode: "cancel",
367
+ runId: e.runId,
368
+ status: t ? "aborted" : "failed"
369
+ }), { cancelled: t };
370
+ } catch {
371
+ return { cancelled: !1 };
372
+ }
373
+ }, [w]), A = i(() => (T ?? []).map((e) => ({
374
+ label: `${e.name} (${e.identifier})`,
375
+ value: e.identifier
376
+ })), [T]);
377
+ return h({
378
+ id: "actions",
379
+ callbacks: i(() => _(t, {
380
+ cancelServerAction: k,
381
+ runServerAction: O
382
+ }, { runServerAction: { params: (e) => {
383
+ let n = g(t.runServerAction.params), r = (T ?? []).find((t) => t.identifier === e.actionId), i = Object.entries(r?.input ?? {});
384
+ return {
385
+ ...n,
386
+ actionId: {
387
+ ...n.actionId,
388
+ type: () => A.length > 0 ? "select" : "text",
389
+ canBind: !0,
390
+ label: E === !1 ? "Action — this space has no server to run it" : "Action",
391
+ options: A
392
+ },
393
+ input: {
394
+ ...n.input,
395
+ canBind: !0,
396
+ label: i.length > 0 ? `Input — ${i.map(([e, t]) => `${e}${t.required ? "*" : ""}: ${t.type}`).join(", ")}` : "Input"
397
+ }
398
+ };
399
+ } } }), [
400
+ O,
401
+ k,
402
+ A,
403
+ T,
404
+ E
405
+ ])
406
+ }), m;
407
+ };
408
+ //#endregion
409
+ export { C as default };
@@ -0,0 +1,12 @@
1
+ import { BuiltinGlobalCallback } from '@plitzi/sdk-shared/authoring/builder';
2
+ /**
3
+ * Running a server action from a flow, and cancelling one.
4
+ *
5
+ * The editor enriches both: it knows which actions the space publishes, so `actionId` becomes a picker and `input`
6
+ * announces the contract the chosen action declares. Neither fact is about the action-running callback itself,
7
+ * which is all this declares.
8
+ *
9
+ * `mode` is the param a flow is usually got wrong on: only `await` puts the result in the flow scope, so a step
10
+ * that reads `{{ <step>.output.* }}` after a detached run reads nothing at all.
11
+ */
12
+ export declare const actionsCallbacks: Record<string, BuiltinGlobalCallback>;
@@ -0,0 +1,63 @@
1
+ //#region src/sources/ActionsSource/callbacks.ts
2
+ var e = {
3
+ runServerAction: {
4
+ source: "actions",
5
+ title: "Run Server Action",
6
+ strictParams: !0,
7
+ params: {
8
+ actionId: {
9
+ type: "text",
10
+ description: "Identifier of the server action to run, as the space publishes it.",
11
+ default: "",
12
+ required: !0,
13
+ label: "Action"
14
+ },
15
+ input: {
16
+ type: "text",
17
+ description: "The values passed to the action, as a JSON object. The server drops every key the action did not declare. Authoring in code, pass a real object rather than a line of JSON text — an interpolated value containing a quote or a newline makes the text unparseable, and unparseable input posts nothing.",
18
+ default: "{}",
19
+ builderType: "codemirror-json",
20
+ label: "Input"
21
+ },
22
+ mode: {
23
+ type: "select",
24
+ description: "await waits and puts the result in the flow scope; detached carries on immediately and leaves nothing to read; stream reports progress as it goes.",
25
+ default: "await",
26
+ options: [
27
+ "await",
28
+ "detached",
29
+ "stream"
30
+ ],
31
+ optionLabels: {
32
+ await: "Wait for the result",
33
+ detached: "Send and continue",
34
+ stream: "Stream progress"
35
+ }
36
+ },
37
+ idempotencyKey: {
38
+ type: "text",
39
+ description: "Makes a repeat of the same intent answer with the first run instead of running again.",
40
+ default: "",
41
+ when: (e) => e.mode !== "detached"
42
+ }
43
+ },
44
+ preview: {
45
+ runId: "",
46
+ status: "",
47
+ output: {}
48
+ }
49
+ },
50
+ cancelServerAction: {
51
+ source: "actions",
52
+ title: "Cancel Server Action",
53
+ strictParams: !0,
54
+ params: { runId: {
55
+ type: "text",
56
+ description: "The run to cancel — normally `{{ <step>.output.runId }}` from the step that started it.",
57
+ default: ""
58
+ } },
59
+ preview: { cancelled: "" }
60
+ }
61
+ };
62
+ //#endregion
63
+ export { e as actionsCallbacks };
@@ -0,0 +1,3 @@
1
+ import { default as ActionInteractions } from './ActionInteractions';
2
+ export * from './ActionInteractions';
3
+ export { ActionInteractions };
@@ -0,0 +1,2 @@
1
+ import e from "./ActionInteractions.mjs";
2
+ export { e as ActionInteractions };
@@ -1,101 +1,24 @@
1
1
  import e from "../../InteractionsContext.mjs";
2
- import { use as t, useCallback as n, useMemo as r } from "react";
3
- import { AuthContext as i } from "@plitzi/sdk-auth";
2
+ import { authCallbacks as t } from "./callbacks.mjs";
3
+ import { use as n, useCallback as r, useMemo as i } from "react";
4
+ import { toInteractionCallbacks as a } from "@plitzi/sdk-shared/authoring/builder";
5
+ import { AuthContext as o } from "@plitzi/sdk-auth";
4
6
  //#region src/sources/AuthSource/AuthInteractions.tsx
5
- var a = ({ children: a, authProvider: o = "basic" }) => {
6
- let { login: s, refresh: c, logout: l } = t(i), { useInteractions: u } = t(e), d = n((e) => s(e), [s]), f = n((e) => c(e), [c]), p = n(() => l(), [l]);
7
- return u({
7
+ var s = ({ children: s, authProvider: c = "basic" }) => {
8
+ let { login: l, refresh: u, logout: d } = n(o), { useInteractions: f } = n(e), p = r((e) => l(e), [l]), m = r((e) => u(e), [u]), h = r(() => d(), [d]);
9
+ return f({
8
10
  id: "auth",
9
- callbacks: r(() => o === "" ? {} : {
10
- login: {
11
- action: "authLogin",
12
- title: "Auth Login",
13
- type: "globalCallback",
14
- callback: d,
15
- params: {
16
- mode: {
17
- label: "Mode",
18
- canBind: !1,
19
- type: "select",
20
- defaultValue: "normal",
21
- options: [{
22
- label: "Token",
23
- value: "token"
24
- }, {
25
- label: "User and Password",
26
- value: "normal"
27
- }]
28
- },
29
- username: {
30
- type: "text",
31
- defaultValue: "",
32
- when: (e) => e.mode === "normal"
33
- },
34
- password: {
35
- type: "text",
36
- defaultValue: "",
37
- when: (e) => e.mode === "normal"
38
- },
39
- token: {
40
- type: "text",
41
- defaultValue: "",
42
- when: (e) => e.mode === "token"
43
- }
44
- },
45
- preview: {
46
- errors: {
47
- username: "",
48
- password: "",
49
- token: ""
50
- },
51
- success: "",
52
- access_token: "",
53
- expires_at: "",
54
- details: {
55
- id: "",
56
- username: "",
57
- email: "",
58
- verified: "",
59
- permissions: ""
60
- }
61
- }
62
- },
63
- refreshDetails: {
64
- action: "authRefreshDetails",
65
- title: "Auth Refresh Details",
66
- type: "globalCallback",
67
- callback: f,
68
- params: {},
69
- preview: {
70
- errors: "",
71
- success: "",
72
- access_token: "",
73
- expires_at: "",
74
- details: {
75
- id: "",
76
- username: "",
77
- email: "",
78
- roles: "",
79
- permissions: "",
80
- verified: ""
81
- }
82
- }
83
- },
84
- logout: {
85
- action: "authLogout",
86
- title: "Auth Logout",
87
- type: "globalCallback",
88
- callback: p,
89
- preview: {},
90
- params: {}
91
- }
92
- }, [
93
- d,
11
+ callbacks: i(() => c === "" ? {} : a(t, {
12
+ login: p,
13
+ refreshDetails: m,
14
+ logout: h
15
+ }), [
94
16
  p,
95
- f,
96
- o
17
+ h,
18
+ m,
19
+ c
97
20
  ])
98
- }), a;
21
+ }), s;
99
22
  };
100
23
  //#endregion
101
- export { a as default };
24
+ export { s as default };
@@ -0,0 +1,32 @@
1
+ import { BuiltinGlobalCallback } from '@plitzi/sdk-shared/authoring/builder';
2
+ /**
3
+ * The auth source's three actions.
4
+ *
5
+ * The KEY of each entry is the name a document names it by — `auth.login`, not `auth.authLogin`. That is not a
6
+ * cosmetic choice: `InteractionsManager` registers a callback under the key it is handed and `InteractionsHelper`
7
+ * resolves a step as `callbacksAvailables[<source>][<action>]`, so a catalog key that differs from the
8
+ * registration key is a step that resolves to nothing. These three used to be declared as `authLogin`,
9
+ * `authLogout` and `authRefreshDetails` while the source registered them as `login`, `logout` and
10
+ * `refreshDetails`, and every flow written from the catalog silently did nothing. {@link toInteractionCallbacks}
11
+ * is what makes the two the same string now.
12
+ *
13
+ * The names carry no provider in them on purpose. A space names `auth.login` whether the session is verified by
14
+ * Plitzi or by a self-hosted server's own accounts — the three calls are the auth context's, and every provider
15
+ * implements them.
16
+ *
17
+ * `login` takes four params, and the catalog that used to mirror this said it took none — an agent authoring a
18
+ * sign-in flow was told the credentials had nowhere to go. One declaration is what stops that from being possible.
19
+ *
20
+ * The previews matter as much as the params: they are the shape of what lands in the flow scope, so a step written
21
+ * after a login can read `{{ login.accessToken }}` because this says the key exists. That makes a preview which does
22
+ * not match what the callback RETURNS worse than no preview at all — and these did not: they promised
23
+ * `access_token`, `success` and a `details` object, while `AuthContext.login` has always answered with a
24
+ * {@link TokenResult}. Every sign-in flow written from this catalog therefore guarded on a key that is never there,
25
+ * and the shape of that failure is a login which succeeds — cookies and all — while the page insists the
26
+ * credentials were wrong and never goes anywhere.
27
+ *
28
+ * There is no user on a `TokenResult`, deliberately: who the session belongs to is loaded separately and arrives on
29
+ * the `auth` source, not out of this step. A flow that wants to greet somebody by name reads what they typed, or
30
+ * reads `auth.user` on a later render.
31
+ */
32
+ export declare const authCallbacks: Record<string, BuiltinGlobalCallback>;