@panneau/actions 5.0.0-alpha.18 → 5.0.0-alpha.19

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 +1 @@
1
- {"version":3,"file":"ActionRunnerProvider.d.ts","sourceRoot":"","sources":["../src/ActionRunnerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+C,MAAM,OAAO,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAa,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASjF,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EAEd,mBAAmB,EAEnB,mBAAmB,EAEtB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,yBAAyB;IACtC,gFAAgF;IAChF,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC;IAC3E;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,KAAK,IAAI,CAAC;IACnD,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,oFAAoF;IACpF,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAmCD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAuB,EACvB,UAAyB,EACzB,aAAa,EACb,YAAmB,EACnB,OAAO,GACV,EAAE,yBAAyB,+BAgY3B"}
1
+ {"version":3,"file":"ActionRunnerProvider.d.ts","sourceRoot":"","sources":["../src/ActionRunnerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+C,MAAM,OAAO,CAAC;AAIpF,OAAO,KAAK,EAAE,YAAY,EAAa,cAAc,EAAE,MAAM,mBAAmB,CAAC;AASjF,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EAEd,mBAAmB,EAEnB,mBAAmB,EAEtB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,yBAAyB;IACtC,gFAAgF;IAChF,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC;IAC3E;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,KAAK,IAAI,CAAC;IACnD,gFAAgF;IAChF,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAChD,oFAAoF;IACpF,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAmCD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAuB,EACvB,UAAyB,EACzB,aAAa,EACb,YAAmB,EACnB,OAAO,GACV,EAAE,yBAAyB,+BAsZ3B"}
@@ -1,7 +1,7 @@
1
1
  import { messages } from "./messages.js";
2
2
  import { ParametersDialog } from "./ParametersDialog.js";
3
3
  import { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from "./request.js";
4
- import { describeResult, describeSubject } from "./describe.js";
4
+ import { describeResult, describeSubject, getItemTitle, isInUse } from "./describe.js";
5
5
  import { ResultsDialog } from "./ResultsDialog.js";
6
6
  import { ActionRunnerContext } from "./context.js";
7
7
  import { c } from "react/compiler-runtime";
@@ -33,7 +33,7 @@ function openDownload(download) {
33
33
  * that runs are followed from page to page. `useActionRunner(resource)` runs an action.
34
34
  */
35
35
  function ActionRunnerProvider(t0) {
36
- const $ = c(67);
36
+ const $ = c(71);
37
37
  const { adapter, children, onResult, onNavigate: t1, onDownload: t2, clientActions, pollInterval: t3, locales } = t0;
38
38
  const onNavigate = t1 === void 0 ? navigateTo : t1;
39
39
  const onDownload = t2 === void 0 ? openDownload : t2;
@@ -68,20 +68,34 @@ function ActionRunnerProvider(t0) {
68
68
  $[4] = t6;
69
69
  } else t6 = $[4];
70
70
  const subjectOf = t6;
71
+ let t7;
72
+ if ($[5] !== definition?.resources || $[6] !== intl) {
73
+ t7 = (resource_0, target_0) => {
74
+ if (target_0.item === void 0) return null;
75
+ const itemTitle = definition?.resources.find((candidate_0) => candidate_0.id === resource_0)?.itemTitle;
76
+ return getItemTitle(target_0.item, itemTitle, intl.locale);
77
+ };
78
+ $[5] = definition?.resources;
79
+ $[6] = intl;
80
+ $[7] = t7;
81
+ } else t7 = $[7];
82
+ const itemTitleOf = t7;
71
83
  const toastKey = _temp;
72
84
  let finish;
73
85
  let follow;
74
- if ($[5] !== adapter || $[6] !== definition?.resources || $[7] !== intl || $[8] !== onDownload || $[9] !== onNavigate || $[10] !== onResult || $[11] !== subjectOf || $[12] !== toasts) {
75
- finish = async (resource_1, target_1, result, t7) => {
76
- const { queued: t8 } = t7 === void 0 ? {} : t7;
77
- const queued = t8 === void 0 ? false : t8;
86
+ if ($[8] !== adapter || $[9] !== definition?.resources || $[10] !== intl || $[11] !== itemTitleOf || $[12] !== onDownload || $[13] !== onNavigate || $[14] !== onResult || $[15] !== subjectOf || $[16] !== toasts) {
87
+ finish = async (resource_2, target_2, result, t8) => {
88
+ const { queued: t9 } = t8 === void 0 ? {} : t8;
89
+ const queued = t9 === void 0 ? false : t9;
78
90
  await onResult?.(result, {
79
- resource: resource_1,
80
- target: target_1
91
+ resource: resource_2,
92
+ target: target_2
81
93
  });
82
94
  const counts = getResultCounts(result);
83
- const content = describeResult(result, getActionLabel(target_1.action, intl), intl, subjectOf(resource_1, target_1, counts.succeeded));
84
- const hasDetails = (result.results ?? []).length > 0;
95
+ const itemTitle_0 = itemTitleOf(resource_2, target_2);
96
+ const content = describeResult(result, getActionLabel(target_2.action, intl), intl, subjectOf(resource_2, target_2, counts.succeeded), itemTitle_0);
97
+ const entries = result.results ?? [];
98
+ const hasDetails = entries.length > 0 && !(entries.length === 1 && entries[0] !== void 0 && isInUse(entries[0]) && itemTitle_0 !== null);
85
99
  const download = result.download ?? null;
86
100
  if (download !== null) onDownload(download);
87
101
  const redirect = result.redirect ?? null;
@@ -95,25 +109,25 @@ function ActionRunnerProvider(t0) {
95
109
  ...content,
96
110
  ...undo !== null ? { action: {
97
111
  label: intl.formatMessage(messages.undo),
98
- onAction: () => void runUndo(resource_1, target_1, undo)
112
+ onAction: () => void runUndo(resource_2, target_2, undo)
99
113
  } } : hasDetails ? { action: {
100
114
  label: intl.formatMessage(messages.details),
101
115
  onAction: () => setDetails({
102
- label: getActionLabel(target_1.action, intl),
116
+ label: getActionLabel(target_2.action, intl),
103
117
  result
104
118
  })
105
119
  } } : download !== null ? { action: {
106
120
  label: intl.formatMessage(messages.download),
107
121
  onAction: () => onDownload(download)
108
122
  } } : {}
109
- }, { key: toastKey(resource_1, target_1) });
123
+ }, { key: toastKey(resource_2, target_2) });
110
124
  if (redirect !== null) onNavigate(redirect);
111
125
  };
112
- const runUndo = async (resource_2, target_2, undo_0) => {
113
- const label = getActionLabel(target_2.action, intl);
114
- const key = { key: toastKey(resource_2, target_2) };
126
+ const runUndo = async (resource_3, target_3, undo_0) => {
127
+ const label = getActionLabel(target_3.action, intl);
128
+ const key = { key: toastKey(resource_3, target_3) };
115
129
  const undoTarget = {
116
- action: definition?.resources.find((candidate_0) => candidate_0.id === resource_2)?.actions?.find((action) => action.id === undo_0.action) ?? {
130
+ action: definition?.resources.find((candidate_1) => candidate_1.id === resource_3)?.actions?.find((action) => action.id === undo_0.action) ?? {
117
131
  id: undo_0.action,
118
132
  kind: "server",
119
133
  scope: ["selection"]
@@ -122,19 +136,19 @@ function ActionRunnerProvider(t0) {
122
136
  selection: { ids: undo_0.items },
123
137
  count: undo_0.items.length
124
138
  };
125
- await adapter.runAction(resource_2, undo_0.action, {
139
+ await adapter.runAction(resource_3, undo_0.action, {
126
140
  selection: { ids: undo_0.items },
127
141
  values: undo_0.params ?? {}
128
142
  }).then(async (response) => {
129
143
  if (response.run !== void 0) {
130
- follow(resource_2, undoTarget, response.run);
144
+ follow(resource_3, undoTarget, response.run);
131
145
  return;
132
146
  }
133
147
  await onResult?.(response.result, {
134
- resource: resource_2,
148
+ resource: resource_3,
135
149
  target: undoTarget
136
150
  });
137
- const subject = subjectOf(resource_2, target_2, undo_0.items.length);
151
+ const subject = subjectOf(resource_3, target_3, undo_0.items.length);
138
152
  toasts.show({ title: subject !== null ? intl.formatMessage(messages.undoneFor, {
139
153
  action: label,
140
154
  subject
@@ -147,40 +161,41 @@ function ActionRunnerProvider(t0) {
147
161
  }, key);
148
162
  });
149
163
  };
150
- follow = (resource_3, target_3, run) => {
164
+ follow = (resource_4, target_4, run) => {
151
165
  setRuns((current) => [...current.filter((entry) => entry.run.id !== run.id), {
152
166
  run,
153
- resource: resource_3,
154
- target: target_3
167
+ resource: resource_4,
168
+ target: target_4
155
169
  }]);
156
170
  };
157
- $[5] = adapter;
158
- $[6] = definition?.resources;
159
- $[7] = intl;
160
- $[8] = onDownload;
161
- $[9] = onNavigate;
162
- $[10] = onResult;
163
- $[11] = subjectOf;
164
- $[12] = toasts;
165
- $[13] = finish;
166
- $[14] = follow;
171
+ $[8] = adapter;
172
+ $[9] = definition?.resources;
173
+ $[10] = intl;
174
+ $[11] = itemTitleOf;
175
+ $[12] = onDownload;
176
+ $[13] = onNavigate;
177
+ $[14] = onResult;
178
+ $[15] = subjectOf;
179
+ $[16] = toasts;
180
+ $[17] = finish;
181
+ $[18] = follow;
167
182
  } else {
168
- finish = $[13];
169
- follow = $[14];
183
+ finish = $[17];
184
+ follow = $[18];
170
185
  }
171
- let t7;
172
- if ($[15] !== finish || $[16] !== intl || $[17] !== subjectOf || $[18] !== toasts) {
173
- t7 = async (entry_0) => {
174
- const { run: run_0, resource: resource_4, target: target_4 } = entry_0;
186
+ let t8;
187
+ if ($[19] !== finish || $[20] !== intl || $[21] !== subjectOf || $[22] !== toasts) {
188
+ t8 = async (entry_0) => {
189
+ const { run: run_0, resource: resource_5, target: target_5 } = entry_0;
175
190
  if (notified.current.has(run_0.id)) return;
176
191
  notified.current.add(run_0.id);
177
192
  if (run_0.result !== void 0) {
178
- await finish(resource_4, target_4, run_0.result, { queued: true });
193
+ await finish(resource_5, target_5, run_0.result, { queued: true });
179
194
  return;
180
195
  }
181
- const action_0 = getActionLabel(target_4.action, intl);
182
- const subject_0 = subjectOf(resource_4, target_4);
183
- const key_0 = { key: toastKey(resource_4, target_4) };
196
+ const action_0 = getActionLabel(target_5.action, intl);
197
+ const subject_0 = subjectOf(resource_5, target_5);
198
+ const key_0 = { key: toastKey(resource_5, target_5) };
184
199
  if (run_0.status === "cancelled") toasts.show({ title: subject_0 !== null ? intl.formatMessage(messages.cancelledFor, {
185
200
  action: action_0,
186
201
  subject: subject_0
@@ -200,43 +215,43 @@ function ActionRunnerProvider(t0) {
200
215
  tone: "success"
201
216
  }, key_0);
202
217
  };
203
- $[15] = finish;
204
- $[16] = intl;
205
- $[17] = subjectOf;
206
- $[18] = toasts;
207
- $[19] = t7;
208
- } else t7 = $[19];
209
- const ended = t7;
210
- let t8;
211
- if ($[20] !== adapter || $[21] !== finish || $[22] !== follow) {
212
- t8 = async (resource_5, target_5, t9) => {
213
- const values = t9 === void 0 ? {} : t9;
214
- const response_0 = await adapter.runAction(resource_5, target_5.action.id, buildActionRequest(target_5, values));
218
+ $[19] = finish;
219
+ $[20] = intl;
220
+ $[21] = subjectOf;
221
+ $[22] = toasts;
222
+ $[23] = t8;
223
+ } else t8 = $[23];
224
+ const ended = t8;
225
+ let t9;
226
+ if ($[24] !== adapter || $[25] !== finish || $[26] !== follow) {
227
+ t9 = async (resource_6, target_6, t10) => {
228
+ const values = t10 === void 0 ? {} : t10;
229
+ const response_0 = await adapter.runAction(resource_6, target_6.action.id, buildActionRequest(target_6, values));
215
230
  if (response_0.run !== void 0) {
216
- follow(resource_5, target_5, response_0.run);
231
+ follow(resource_6, target_6, response_0.run);
217
232
  return {
218
233
  status: "queued",
219
234
  run: response_0.run
220
235
  };
221
236
  }
222
- await finish(resource_5, target_5, response_0.result);
237
+ await finish(resource_6, target_6, response_0.result);
223
238
  return {
224
239
  status: "done",
225
240
  result: response_0.result
226
241
  };
227
242
  };
228
- $[20] = adapter;
229
- $[21] = finish;
230
- $[22] = follow;
231
- $[23] = t8;
232
- } else t8 = $[23];
233
- const execute = t8;
234
- let t9;
235
- if ($[24] !== clientActions || $[25] !== execute || $[26] !== onNavigate || $[27] !== plugins) {
236
- t9 = (resource_6, target_6) => {
237
- const { action: action_1 } = target_6;
243
+ $[24] = adapter;
244
+ $[25] = finish;
245
+ $[26] = follow;
246
+ $[27] = t9;
247
+ } else t9 = $[27];
248
+ const execute = t9;
249
+ let t10;
250
+ if ($[28] !== clientActions || $[29] !== execute || $[30] !== onNavigate || $[31] !== plugins) {
251
+ t10 = (resource_7, target_7) => {
252
+ const { action: action_1 } = target_7;
238
253
  if (action_1.kind === "link") {
239
- const to = getLinkTarget(target_6);
254
+ const to = getLinkTarget(target_7);
240
255
  if (to === null) return Promise.reject(/* @__PURE__ */ new Error(`The action "${action_1.id}" has no URL or route.`));
241
256
  onNavigate(to);
242
257
  return Promise.resolve({
@@ -249,29 +264,29 @@ function ActionRunnerProvider(t0) {
249
264
  const Handler = (clientActions !== void 0 && Object.hasOwn(clientActions, name) ? clientActions[name] : void 0) ?? plugins.actions.get(name);
250
265
  if (Handler === void 0) return Promise.reject(/* @__PURE__ */ new Error(`No handler for the client action "${action_1.id}" (${name}).`));
251
266
  return new Promise((resolve) => setClient({
252
- resource: resource_6,
253
- target: target_6,
267
+ resource: resource_7,
268
+ target: target_7,
254
269
  resolve,
255
270
  Handler
256
271
  }));
257
272
  }
258
273
  if ((action_1.fields ?? []).length > 0) return new Promise((resolve_0) => setParameters({
259
- resource: resource_6,
260
- target: target_6,
274
+ resource: resource_7,
275
+ target: target_7,
261
276
  resolve: resolve_0
262
277
  }));
263
- return execute(resource_6, target_6);
278
+ return execute(resource_7, target_7);
264
279
  };
265
- $[24] = clientActions;
266
- $[25] = execute;
267
- $[26] = onNavigate;
268
- $[27] = plugins;
269
- $[28] = t9;
270
- } else t9 = $[28];
271
- const run_1 = t9;
272
- let t10;
273
- if ($[29] !== adapter || $[30] !== ended || $[31] !== runs) {
274
- t10 = async (id) => {
280
+ $[28] = clientActions;
281
+ $[29] = execute;
282
+ $[30] = onNavigate;
283
+ $[31] = plugins;
284
+ $[32] = t10;
285
+ } else t10 = $[32];
286
+ const run_1 = t10;
287
+ let t11;
288
+ if ($[33] !== adapter || $[34] !== ended || $[35] !== runs) {
289
+ t11 = async (id) => {
275
290
  if (adapter.cancelActionRun === void 0) throw new Error("The adapter cannot cancel runs.");
276
291
  await adapter.cancelActionRun(id);
277
292
  const updated = await adapter.getActionRun(id);
@@ -279,34 +294,34 @@ function ActionRunnerProvider(t0) {
279
294
  ...entry_1,
280
295
  run: updated
281
296
  } : entry_1));
282
- const entry_2 = runs.find((candidate_1) => candidate_1.run.id === id);
297
+ const entry_2 = runs.find((candidate_2) => candidate_2.run.id === id);
283
298
  if (entry_2 !== void 0 && isFinished(updated.status)) await ended({
284
299
  ...entry_2,
285
300
  run: updated
286
301
  });
287
302
  };
288
- $[29] = adapter;
289
- $[30] = ended;
290
- $[31] = runs;
291
- $[32] = t10;
292
- } else t10 = $[32];
293
- const cancelRun = t10;
294
- let t11;
295
- if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
296
- t11 = (id_0) => setRuns((current_1) => current_1.filter((entry_3) => entry_3.run.id !== id_0));
297
- $[33] = t11;
298
- } else t11 = $[33];
299
- const dismissRun = t11;
300
- let t12;
301
- if ($[34] !== ended) {
302
- t12 = (entry_4) => ended(entry_4);
303
+ $[33] = adapter;
303
304
  $[34] = ended;
304
- $[35] = t12;
305
- } else t12 = $[35];
306
- const onRunEnded = useEffectEvent(t12);
305
+ $[35] = runs;
306
+ $[36] = t11;
307
+ } else t11 = $[36];
308
+ const cancelRun = t11;
309
+ let t12;
310
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
311
+ t12 = (id_0) => setRuns((current_1) => current_1.filter((entry_3) => entry_3.run.id !== id_0));
312
+ $[37] = t12;
313
+ } else t12 = $[37];
314
+ const dismissRun = t12;
307
315
  let t13;
308
- if ($[36] !== adapter || $[37] !== onRunEnded || $[38] !== pollInterval || $[39] !== runs) {
309
- t13 = () => {
316
+ if ($[38] !== ended) {
317
+ t13 = (entry_4) => ended(entry_4);
318
+ $[38] = ended;
319
+ $[39] = t13;
320
+ } else t13 = $[39];
321
+ const onRunEnded = useEffectEvent(t13);
322
+ let t14;
323
+ if ($[40] !== adapter || $[41] !== onRunEnded || $[42] !== pollInterval || $[43] !== runs) {
324
+ t14 = () => {
310
325
  const active = runs.filter(_temp2);
311
326
  if (active.length === 0) return;
312
327
  let stopped = false;
@@ -315,10 +330,10 @@ function ActionRunnerProvider(t0) {
315
330
  try {
316
331
  const next = await adapter.getActionRun(entry_6.run.id);
317
332
  if (stopped) return;
318
- setRuns((current_3) => current_3.map((candidate_2) => candidate_2.run.id === next.id ? {
319
- ...candidate_2,
333
+ setRuns((current_3) => current_3.map((candidate_3) => candidate_3.run.id === next.id ? {
334
+ ...candidate_3,
320
335
  run: next
321
- } : candidate_2));
336
+ } : candidate_3));
322
337
  if (isFinished(next.status)) await onRunEnded({
323
338
  ...entry_6,
324
339
  run: next
@@ -333,39 +348,39 @@ function ActionRunnerProvider(t0) {
333
348
  clearTimeout(timer);
334
349
  };
335
350
  };
336
- $[36] = adapter;
337
- $[37] = onRunEnded;
338
- $[38] = pollInterval;
339
- $[39] = runs;
340
- $[40] = t13;
341
- } else t13 = $[40];
342
- let t14;
343
- if ($[41] !== adapter || $[42] !== pollInterval || $[43] !== runs) {
344
- t14 = [
345
- runs,
346
- adapter,
347
- pollInterval
348
- ];
349
- $[41] = adapter;
351
+ $[40] = adapter;
352
+ $[41] = onRunEnded;
350
353
  $[42] = pollInterval;
351
354
  $[43] = runs;
352
355
  $[44] = t14;
353
356
  } else t14 = $[44];
354
- useEffect(t13, t14);
355
357
  let t15;
356
- if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
357
- t15 = () => {
358
+ if ($[45] !== adapter || $[46] !== pollInterval || $[47] !== runs) {
359
+ t15 = [
360
+ runs,
361
+ adapter,
362
+ pollInterval
363
+ ];
364
+ $[45] = adapter;
365
+ $[46] = pollInterval;
366
+ $[47] = runs;
367
+ $[48] = t15;
368
+ } else t15 = $[48];
369
+ useEffect(t14, t15);
370
+ let t16;
371
+ if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
372
+ t16 = () => {
358
373
  watchers.current = watchers.current + 1;
359
374
  return () => {
360
375
  watchers.current = watchers.current - 1;
361
376
  };
362
377
  };
363
- $[45] = t15;
364
- } else t15 = $[45];
365
- const watchRuns = t15;
366
- let t16;
367
- if ($[46] !== adapter || $[47] !== cancelRun || $[48] !== run_1 || $[49] !== runs) {
368
- t16 = {
378
+ $[49] = t16;
379
+ } else t16 = $[49];
380
+ const watchRuns = t16;
381
+ let t17;
382
+ if ($[50] !== adapter || $[51] !== cancelRun || $[52] !== run_1 || $[53] !== runs) {
383
+ t17 = {
369
384
  adapter,
370
385
  run: run_1,
371
386
  runs,
@@ -373,17 +388,17 @@ function ActionRunnerProvider(t0) {
373
388
  dismissRun,
374
389
  watchRuns
375
390
  };
376
- $[46] = adapter;
377
- $[47] = cancelRun;
378
- $[48] = run_1;
379
- $[49] = runs;
380
- $[50] = t16;
381
- } else t16 = $[50];
382
- const value = t16;
391
+ $[50] = adapter;
392
+ $[51] = cancelRun;
393
+ $[52] = run_1;
394
+ $[53] = runs;
395
+ $[54] = t17;
396
+ } else t17 = $[54];
397
+ const value = t17;
383
398
  const ClientHandler = client?.Handler;
384
- let t17;
385
- if ($[51] !== execute || $[52] !== locales || $[53] !== parameters) {
386
- t17 = parameters !== null ? /* @__PURE__ */ jsx(ParametersDialog, {
399
+ let t18;
400
+ if ($[55] !== execute || $[56] !== locales || $[57] !== parameters) {
401
+ t18 = parameters !== null ? /* @__PURE__ */ jsx(ParametersDialog, {
387
402
  action: parameters.target.action,
388
403
  count: parameters.target.count,
389
404
  locales,
@@ -397,14 +412,14 @@ function ActionRunnerProvider(t0) {
397
412
  parameters.resolve(false);
398
413
  }
399
414
  }) : null;
400
- $[51] = execute;
401
- $[52] = locales;
402
- $[53] = parameters;
403
- $[54] = t17;
404
- } else t17 = $[54];
405
- let t18;
406
- if ($[55] !== ClientHandler || $[56] !== client || $[57] !== finish) {
407
- t18 = client !== null && ClientHandler !== void 0 ? /* @__PURE__ */ jsx(ClientHandler, {
415
+ $[55] = execute;
416
+ $[56] = locales;
417
+ $[57] = parameters;
418
+ $[58] = t18;
419
+ } else t18 = $[58];
420
+ let t19;
421
+ if ($[59] !== ClientHandler || $[60] !== client || $[61] !== finish) {
422
+ t19 = client !== null && ClientHandler !== void 0 ? /* @__PURE__ */ jsx(ClientHandler, {
408
423
  action: client.target.action,
409
424
  resource: client.resource,
410
425
  target: client.target,
@@ -427,40 +442,40 @@ function ActionRunnerProvider(t0) {
427
442
  client.resolve(false);
428
443
  }
429
444
  }) : null;
430
- $[55] = ClientHandler;
431
- $[56] = client;
432
- $[57] = finish;
433
- $[58] = t18;
434
- } else t18 = $[58];
435
- let t19;
436
- if ($[59] !== details) {
437
- t19 = details !== null ? /* @__PURE__ */ jsx(ResultsDialog, {
445
+ $[59] = ClientHandler;
446
+ $[60] = client;
447
+ $[61] = finish;
448
+ $[62] = t19;
449
+ } else t19 = $[62];
450
+ let t20;
451
+ if ($[63] !== details) {
452
+ t20 = details !== null ? /* @__PURE__ */ jsx(ResultsDialog, {
438
453
  label: details.label,
439
454
  result: details.result,
440
455
  onClose: () => setDetails(null)
441
456
  }) : null;
442
- $[59] = details;
443
- $[60] = t19;
444
- } else t19 = $[60];
445
- let t20;
446
- if ($[61] !== children || $[62] !== t17 || $[63] !== t18 || $[64] !== t19 || $[65] !== value) {
447
- t20 = /* @__PURE__ */ jsxs(ActionRunnerContext, {
457
+ $[63] = details;
458
+ $[64] = t20;
459
+ } else t20 = $[64];
460
+ let t21;
461
+ if ($[65] !== children || $[66] !== t18 || $[67] !== t19 || $[68] !== t20 || $[69] !== value) {
462
+ t21 = /* @__PURE__ */ jsxs(ActionRunnerContext, {
448
463
  value,
449
464
  children: [
450
465
  children,
451
- t17,
452
466
  t18,
453
- t19
467
+ t19,
468
+ t20
454
469
  ]
455
470
  });
456
- $[61] = children;
457
- $[62] = t17;
458
- $[63] = t18;
459
- $[64] = t19;
460
- $[65] = value;
461
- $[66] = t20;
462
- } else t20 = $[66];
463
- return t20;
471
+ $[65] = children;
472
+ $[66] = t18;
473
+ $[67] = t19;
474
+ $[68] = t20;
475
+ $[69] = value;
476
+ $[70] = t21;
477
+ } else t21 = $[70];
478
+ return t21;
464
479
  }
465
480
  function _temp3(current_2) {
466
481
  return [...current_2];
@@ -468,8 +483,8 @@ function _temp3(current_2) {
468
483
  function _temp2(entry_5) {
469
484
  return !isFinished(entry_5.run.status);
470
485
  }
471
- function _temp(resource_0, target_0) {
472
- return `panneau-action:${resource_0}:${target_0.action.id}:${target_0.item?.id ?? "selection"}`;
486
+ function _temp(resource_1, target_1) {
487
+ return `panneau-action:${resource_1}:${target_1.action.id}:${target_1.item?.id ?? "selection"}`;
473
488
  }
474
489
  //#endregion
475
490
  export { ActionRunnerProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"ActionRunnerProvider.js","names":["ReactNode","useEffect","useEffectEvent","useRef","useState","usePanneau","getActionLabel","ActionResult","ActionRun","RouteReference","usePanneauIntl","useToast","ParametersDialog","ResultsDialog","ActionRunnerContext","ActionRunnerContextValue","describeResult","describeSubject","messages","buildActionRequest","getLinkTarget","getResultCounts","isFinished","ActionAdapter","ActionDownload","ActionOutcome","ActionResultContext","ActionTarget","ClientActionHandler","FollowedRun","ActionRunnerProviderProps","adapter","children","onResult","result","context","onNavigate","to","onDownload","download","clientActions","Readonly","Record","pollInterval","locales","Pending","resource","target","resolve","outcome","ClientPending","Handler","navigateTo","window","location","assign","console","warn","route","openDownload","link","document","createElement","href","url","filename","undefined","rel","hidden","body","append","click","remove","ActionRunnerProvider","t0","$","_c","t1","t2","t3","intl","toasts","definition","plugins","parameters","setParameters","client","setClient","details","setDetails","t4","Symbol","for","runs","setRuns","t5","Set","notified","watchers","t6","resources","t7","count","find","candidate","id","subjectOf","toastKey","_temp","finish","follow","resource_1","target_1","queued","t8","counts","content","action","succeeded","hasDetails","results","length","redirect","saysMore","message","current","undo","show","label","formatMessage","onAction","runUndo","key","resource_2","target_2","undo_0","declared","candidate_0","actions","undoTarget","kind","scope","selection","ids","items","runAction","values","params","then","response","run","subject","title","undoneFor","undone","catch","error","undoFailed","Error","description","tone","resource_3","target_3","filter","entry","entry_0","run_0","resource_4","target_4","has","add","action_0","subject_0","key_0","status","cancelledFor","cancelled","failedFor","failed","doneFor","done","ended","resource_5","target_5","t9","response_0","execute","resource_6","target_6","action_1","Promise","reject","name","component","Object","hasOwn","get","fields","resolve_0","run_1","t10","cancelActionRun","updated","getActionRun","current_0","map","entry_1","entry_2","candidate_1","cancelRun","t11","id_0","current_1","entry_3","dismissRun","t12","entry_4","onRunEnded","t13","active","_temp2","stopped","timer","setTimeout","all","entry_6","next","current_3","candidate_2","_temp3","clearTimeout","t14","t15","watchRuns","t16","value","ClientHandler","t17","values_0","t18","result_0","t19","t20","current_2","entry_5","resource_0","target_0","item","_c"],"sources":["../src/ActionRunnerProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { usePanneau } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { ActionResult, ActionRun, RouteReference } from '@panneau/protocol';\nimport { usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { ParametersDialog } from './ParametersDialog';\nimport { ResultsDialog } from './ResultsDialog';\nimport { ActionRunnerContext, type ActionRunnerContextValue } from './context';\nimport { describeResult, describeSubject } from './describe';\nimport { messages } from './messages';\nimport { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from './request';\nimport type {\n ActionAdapter,\n ActionDownload,\n ActionOutcome,\n ActionResultContext,\n ActionTarget,\n ClientActionHandler,\n FollowedRun,\n} from './types';\n\nexport interface ActionRunnerProviderProps {\n /** Runs the actions: a `DataAdapter`, or any object with its action methods. */\n adapter: ActionAdapter;\n children?: ReactNode;\n /**\n * Called with every result: of an action that finished at once, and of a queued run when it\n * finishes. Refresh what it changed here. With `@panneau/data/query`:\n * `invalidateActionResult(client, resource, result, target.selection)`.\n */\n onResult?: (result: ActionResult, context: ActionResultContext) => unknown;\n /**\n * Goes to the `redirect` of a result, or to the URL or route of a `link` action. Defaults to\n * `window.location.assign()` for URLs; routes need it.\n */\n onNavigate?: (to: string | RouteReference) => void;\n /** Opens the `download` of a result. Defaults to a link to its URL, clicked. */\n onDownload?: (download: ActionDownload) => void;\n /** Handlers of `client` actions by their `component`, over those of the plugins. */\n clientActions?: Readonly<Record<string, ClientActionHandler>>;\n /** Milliseconds between two checks of a queued run. Defaults to 2000. */\n pollInterval?: number;\n /** Locales of localized parameters. Defaults to the definition's. */\n locales?: readonly string[];\n}\n\ninterface Pending {\n resource: string;\n target: ActionTarget;\n resolve: (outcome: ActionOutcome | false) => void;\n}\n\ninterface ClientPending extends Pending {\n Handler: ClientActionHandler;\n}\n\nfunction navigateTo(to: string | RouteReference) {\n if (typeof to === 'string') {\n window.location.assign(to);\n } else {\n console.warn(\n `[panneau] An action goes to the route \"${to.route}\": give ActionRunnerProvider an onNavigate.`,\n );\n }\n}\n\nfunction openDownload(download: ActionDownload) {\n const link = document.createElement('a');\n link.href = download.url;\n if (download.filename !== undefined) {\n link.download = download.filename;\n }\n link.rel = 'noopener';\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n}\n\n/**\n * Runs the actions that lists and forms hand over ([decision 0023]): it asks for their parameters\n * in a dialog, runs them through the adapter, shows their result (a toast, and the items that\n * didn't succeed), follows queued runs until they end, refreshes through `onResult`, follows\n * redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so\n * that runs are followed from page to page. `useActionRunner(resource)` runs an action.\n */\nexport function ActionRunnerProvider({\n adapter,\n children,\n onResult,\n onNavigate = navigateTo,\n onDownload = openDownload,\n clientActions,\n pollInterval = 2000,\n locales,\n}: ActionRunnerProviderProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const { definition, plugins } = usePanneau();\n const [parameters, setParameters] = useState<Pending | null>(null);\n const [client, setClient] = useState<ClientPending | null>(null);\n const [details, setDetails] = useState<{ label: string; result: ActionResult } | null>(null);\n const [runs, setRuns] = useState<readonly FollowedRun[]>([]);\n // Runs whose end was already shown, so that a late poll doesn't show it twice.\n const notified = useRef(new Set<string>());\n // How many lists of runs are on screen (the popover of the runs): their user sees a run end.\n const watchers = useRef(0);\n\n /** What the action applied to, by the item's title or the count of items. */\n const subjectOf = (resource: string, target: ActionTarget, count: number | null = null) =>\n describeSubject(\n target,\n definition?.resources.find((candidate) => candidate.id === resource),\n intl,\n count,\n );\n\n /** One toast per action and target: running it again replaces it. */\n const toastKey = (resource: string, target: ActionTarget) =>\n `panneau-action:${resource}:${target.action.id}:${target.item?.id ?? 'selection'}`;\n\n const finish = async (\n resource: string,\n target: ActionTarget,\n result: ActionResult,\n { queued = false }: { queued?: boolean } = {},\n ) => {\n await onResult?.(result, { resource, target });\n const counts = getResultCounts(result);\n const content = describeResult(\n result,\n getActionLabel(target.action, intl),\n intl,\n subjectOf(resource, target, counts.succeeded),\n );\n const hasDetails = (result.results ?? []).length > 0;\n const download = result.download ?? null;\n if (download !== null) {\n onDownload(download);\n }\n const redirect = result.redirect ?? null;\n // A queued run that ends in the open list of runs is seen there, unless its result says\n // more than its status: a message, items that didn't succeed, a download.\n const saysMore = (result.message ?? '') !== '' || hasDetails || download !== null;\n if (queued && watchers.current > 0 && !saysMore) {\n if (redirect !== null) {\n onNavigate(redirect);\n }\n return;\n }\n // \"Undo\" lives in the toast only (decision 0063): a queued run, which finished later, isn't\n // undone.\n const undo = !queued ? (result.undo ?? null) : null;\n toasts.show(\n {\n ...content,\n ...(undo !== null\n ? {\n action: {\n label: intl.formatMessage(messages.undo),\n onAction: () => void runUndo(resource, target, undo),\n },\n }\n : hasDetails\n ? {\n action: {\n label: intl.formatMessage(messages.details),\n onAction: () =>\n setDetails({\n label: getActionLabel(target.action, intl),\n result,\n }),\n },\n }\n : download !== null\n ? {\n action: {\n label: intl.formatMessage(messages.download),\n onAction: () => onDownload(download),\n },\n }\n : {}),\n },\n { key: toastKey(resource, target) },\n );\n if (redirect !== null) {\n onNavigate(redirect);\n }\n };\n\n /**\n * Runs the undo of a result: an action of the same resource, on the items it lists, as any\n * action. A short toast then says it was undone, in place of the first one.\n */\n const runUndo = async (\n resource: string,\n target: ActionTarget,\n undo: NonNullable<ActionResult['undo']>,\n ) => {\n const label = getActionLabel(target.action, intl);\n const key = { key: toastKey(resource, target) };\n const declared = definition?.resources\n .find((candidate) => candidate.id === resource)\n ?.actions?.find((action) => action.id === undo.action);\n const undoTarget: ActionTarget = {\n action: declared ?? { id: undo.action, kind: 'server', scope: ['selection'] },\n scope: 'selection',\n selection: { ids: undo.items },\n count: undo.items.length,\n };\n await adapter\n .runAction(resource, undo.action, {\n selection: { ids: undo.items },\n values: undo.params ?? {},\n })\n .then(async (response) => {\n if (response.run !== undefined) {\n follow(resource, undoTarget, response.run);\n return;\n }\n await onResult?.(response.result, { resource, target: undoTarget });\n const subject = subjectOf(resource, target, undo.items.length);\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.undoneFor, {\n action: label,\n subject,\n })\n : intl.formatMessage(messages.undone, { action: label }),\n },\n key,\n );\n })\n .catch((error: unknown) => {\n toasts.show(\n {\n title: intl.formatMessage(messages.undoFailed, { action: label }),\n ...(error instanceof Error && error.message !== ''\n ? { description: error.message }\n : {}),\n tone: 'danger',\n },\n key,\n );\n });\n };\n\n // No toast when a run starts: the runs button of the shell shows it, and its popover follows\n // it. The toast comes when the run ends.\n const follow = (resource: string, target: ActionTarget, run: ActionRun) => {\n setRuns((current) => [\n ...current.filter((entry) => entry.run.id !== run.id),\n { run, resource, target },\n ]);\n };\n\n const ended = async (entry: FollowedRun) => {\n const { run, resource, target } = entry;\n if (notified.current.has(run.id)) {\n return;\n }\n notified.current.add(run.id);\n if (run.result !== undefined) {\n await finish(resource, target, run.result, { queued: true });\n return;\n }\n const action = getActionLabel(target.action, intl);\n const subject = subjectOf(resource, target);\n const key = { key: toastKey(resource, target) };\n if (run.status === 'cancelled') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.cancelledFor, { action, subject })\n : intl.formatMessage(messages.cancelled, { action }),\n },\n key,\n );\n } else if (run.status === 'failed') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.failedFor, { action, subject })\n : intl.formatMessage(messages.failed, { action }),\n tone: 'danger',\n },\n key,\n );\n } else if (watchers.current === 0) {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.doneFor, { action, subject })\n : intl.formatMessage(messages.done, { action }),\n tone: 'success',\n },\n key,\n );\n }\n };\n\n const execute = async (\n resource: string,\n target: ActionTarget,\n values: Record<string, unknown> = {},\n ): Promise<ActionOutcome> => {\n const response = await adapter.runAction(\n resource,\n target.action.id,\n buildActionRequest(target, values),\n );\n if (response.run !== undefined) {\n follow(resource, target, response.run);\n return { status: 'queued', run: response.run };\n }\n await finish(resource, target, response.result);\n return { status: 'done', result: response.result };\n };\n\n const run = (resource: string, target: ActionTarget): Promise<ActionOutcome | false> => {\n const { action } = target;\n if (action.kind === 'link') {\n const to = getLinkTarget(target);\n if (to === null) {\n return Promise.reject(new Error(`The action \"${action.id}\" has no URL or route.`));\n }\n onNavigate(to);\n return Promise.resolve({ status: 'navigated', to });\n }\n if (action.kind === 'client') {\n const name = action.component ?? '';\n const Handler =\n (clientActions !== undefined && Object.hasOwn(clientActions, name)\n ? clientActions[name]\n : undefined) ?? (plugins.actions.get(name) as ClientActionHandler | undefined);\n if (Handler === undefined) {\n return Promise.reject(\n new Error(`No handler for the client action \"${action.id}\" (${name}).`),\n );\n }\n return new Promise((resolve) => setClient({ resource, target, resolve, Handler }));\n }\n if ((action.fields ?? []).length > 0) {\n return new Promise((resolve) => setParameters({ resource, target, resolve }));\n }\n return execute(resource, target);\n };\n\n const cancelRun = async (id: string) => {\n if (adapter.cancelActionRun === undefined) {\n throw new Error('The adapter cannot cancel runs.');\n }\n await adapter.cancelActionRun(id);\n const updated = await adapter.getActionRun(id);\n setRuns((current) =>\n current.map((entry) => (entry.run.id === id ? { ...entry, run: updated } : entry)),\n );\n const entry = runs.find((candidate) => candidate.run.id === id);\n if (entry !== undefined && isFinished(updated.status)) {\n await ended({ ...entry, run: updated });\n }\n };\n\n const dismissRun = (id: string) =>\n setRuns((current) => current.filter((entry) => entry.run.id !== id));\n\n const onRunEnded = useEffectEvent((entry: FollowedRun) => ended(entry));\n\n // Checks the unfinished runs, one interval after the last change of the runs.\n useEffect(() => {\n const active = runs.filter((entry) => !isFinished(entry.run.status));\n if (active.length === 0) {\n return undefined;\n }\n let stopped = false;\n const timer = setTimeout(() => {\n void Promise.all(\n active.map(async (entry) => {\n try {\n const next = await adapter.getActionRun(entry.run.id);\n if (stopped) {\n return;\n }\n setRuns((current) =>\n current.map((candidate) =>\n candidate.run.id === next.id\n ? { ...candidate, run: next }\n : candidate,\n ),\n );\n if (isFinished(next.status)) {\n await onRunEnded({ ...entry, run: next });\n }\n } catch {\n // Checked again at the next interval.\n if (!stopped) {\n setRuns((current) => [...current]);\n }\n }\n }),\n );\n }, pollInterval);\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [runs, adapter, pollInterval]);\n\n const watchRuns = () => {\n watchers.current += 1;\n return () => {\n watchers.current -= 1;\n };\n };\n\n const value: ActionRunnerContextValue = {\n adapter,\n run,\n runs,\n cancelRun,\n dismissRun,\n watchRuns,\n };\n\n const ClientHandler = client?.Handler;\n return (\n <ActionRunnerContext value={value}>\n {children}\n {parameters !== null ? (\n <ParametersDialog\n action={parameters.target.action}\n count={parameters.target.count}\n locales={locales}\n onSubmit={(values) => execute(parameters.resource, parameters.target, values)}\n onDone={(outcome) => {\n setParameters(null);\n parameters.resolve(outcome);\n }}\n onCancel={() => {\n setParameters(null);\n parameters.resolve(false);\n }}\n />\n ) : null}\n {client !== null && ClientHandler !== undefined ? (\n <ClientHandler\n action={client.target.action}\n resource={client.resource}\n target={client.target}\n onDone={(result) => {\n setClient(null);\n if (result === undefined) {\n client.resolve({ status: 'done', result: {} });\n return;\n }\n void finish(client.resource, client.target, result).then(() =>\n client.resolve({ status: 'done', result }),\n );\n }}\n onCancel={() => {\n setClient(null);\n client.resolve(false);\n }}\n />\n ) : null}\n {details !== null ? (\n <ResultsDialog\n label={details.label}\n result={details.result}\n onClose={() => setDetails(null)}\n />\n ) : null}\n </ActionRunnerContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0DA,SAASoD,WAAWf,IAA6B;CAC7C,IAAI,OAAOA,OAAO,UACdgB,OAAOC,SAASC,OAAOlB,EAAE;MAEzBmB,QAAQC,KACJ,0CAA0CpB,GAAGqB,MAAK,4CACtD;AAER;AAEA,SAASC,aAAapB,UAA0B;CAC5C,MAAMqB,OAAOC,SAASC,cAAc,GAAG;CACvCF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,MAAA,qBAAC,qBAAD;GAA4BP;GAA5B,UAAA;IACK3M;IACA6M;IAgBAE;IAqBAE;GAvCe;;EA8CEtK,EAAA,MAAA3C;EAAA2C,EAAA,MAAAkK;EAAAlK,EAAA,MAAAoK;EAAApK,EAAA,MAAAsK;EAAAtK,EAAA,MAAAgK;EAAAhK,EAAA,MAAAuK;CAAA,OAAAA,MAAAvK,EAAA;CAAA,OA9CtBuK;AA8CsB;AAvYvB,SAAAb,OAAAc,WAAA;CAAA,OA2T0C,CAAA,GAAItH,SAAO;AAAC;AA3TtD,SAAA+F,OAAAwB,SAAA;CAAA,OAiSuC,CAAC9N,WAAW8I,QAAKd,IAAIwB,MAAO;AAAC;AAjSpE,SAAAlE,MAAAyI,YAAAC,UAAA;CAAA,OAiCC,kBAAkBxM,WAAQ,GAAIC,SAAMsE,OAAOZ,GAAG,GAAI1D,SAAMwM,MAAS9I,MAAf;AAAgC"}
1
+ {"version":3,"file":"ActionRunnerProvider.js","names":["ReactNode","useEffect","useEffectEvent","useRef","useState","usePanneau","getActionLabel","ActionResult","ActionRun","RouteReference","usePanneauIntl","useToast","ParametersDialog","ResultsDialog","ActionRunnerContext","ActionRunnerContextValue","describeResult","describeSubject","getItemTitle","isInUse","messages","buildActionRequest","getLinkTarget","getResultCounts","isFinished","ActionAdapter","ActionDownload","ActionOutcome","ActionResultContext","ActionTarget","ClientActionHandler","FollowedRun","ActionRunnerProviderProps","adapter","children","onResult","result","context","onNavigate","to","onDownload","download","clientActions","Readonly","Record","pollInterval","locales","Pending","resource","target","resolve","outcome","ClientPending","Handler","navigateTo","window","location","assign","console","warn","route","openDownload","link","document","createElement","href","url","filename","undefined","rel","hidden","body","append","click","remove","ActionRunnerProvider","t0","$","_c","t1","t2","t3","intl","toasts","definition","plugins","parameters","setParameters","client","setClient","details","setDetails","t4","Symbol","for","runs","setRuns","t5","Set","notified","watchers","t6","resources","t7","count","find","candidate","id","subjectOf","resource_0","target_0","item","itemTitle","candidate_0","locale","itemTitleOf","toastKey","_temp","finish","follow","resource_2","target_2","t8","queued","t9","counts","itemTitle_0","content","action","succeeded","entries","results","hasDetails","length","redirect","saysMore","message","current","undo","show","label","formatMessage","onAction","runUndo","key","resource_3","target_3","undo_0","declared","candidate_1","actions","undoTarget","kind","scope","selection","ids","items","runAction","values","params","then","response","run","subject","title","undoneFor","undone","catch","error","undoFailed","Error","description","tone","resource_4","target_4","filter","entry","entry_0","run_0","resource_5","target_5","has","add","action_0","subject_0","key_0","status","cancelledFor","cancelled","failedFor","failed","doneFor","done","ended","resource_6","target_6","t10","response_0","execute","resource_7","target_7","action_1","Promise","reject","name","component","Object","hasOwn","get","fields","resolve_0","run_1","t11","cancelActionRun","updated","getActionRun","current_0","map","entry_1","entry_2","candidate_2","cancelRun","t12","id_0","current_1","entry_3","dismissRun","t13","entry_4","onRunEnded","t14","active","_temp2","stopped","timer","setTimeout","all","entry_6","next","current_3","candidate_3","_temp3","clearTimeout","t15","t16","watchRuns","t17","value","ClientHandler","t18","values_0","t19","result_0","t20","t21","current_2","entry_5","resource_1","target_1","_c"],"sources":["../src/ActionRunnerProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect, useEffectEvent, useRef, useState } from 'react';\n\nimport { usePanneau } from '@panneau/core';\nimport { getActionLabel } from '@panneau/intl';\nimport type { ActionResult, ActionRun, RouteReference } from '@panneau/protocol';\nimport { usePanneauIntl, useToast } from '@panneau/ui';\n\nimport { ParametersDialog } from './ParametersDialog';\nimport { ResultsDialog } from './ResultsDialog';\nimport { ActionRunnerContext, type ActionRunnerContextValue } from './context';\nimport { describeResult, describeSubject, getItemTitle, isInUse } from './describe';\nimport { messages } from './messages';\nimport { buildActionRequest, getLinkTarget, getResultCounts, isFinished } from './request';\nimport type {\n ActionAdapter,\n ActionDownload,\n ActionOutcome,\n ActionResultContext,\n ActionTarget,\n ClientActionHandler,\n FollowedRun,\n} from './types';\n\nexport interface ActionRunnerProviderProps {\n /** Runs the actions: a `DataAdapter`, or any object with its action methods. */\n adapter: ActionAdapter;\n children?: ReactNode;\n /**\n * Called with every result: of an action that finished at once, and of a queued run when it\n * finishes. Refresh what it changed here. With `@panneau/data/query`:\n * `invalidateActionResult(client, resource, result, target.selection)`.\n */\n onResult?: (result: ActionResult, context: ActionResultContext) => unknown;\n /**\n * Goes to the `redirect` of a result, or to the URL or route of a `link` action. Defaults to\n * `window.location.assign()` for URLs; routes need it.\n */\n onNavigate?: (to: string | RouteReference) => void;\n /** Opens the `download` of a result. Defaults to a link to its URL, clicked. */\n onDownload?: (download: ActionDownload) => void;\n /** Handlers of `client` actions by their `component`, over those of the plugins. */\n clientActions?: Readonly<Record<string, ClientActionHandler>>;\n /** Milliseconds between two checks of a queued run. Defaults to 2000. */\n pollInterval?: number;\n /** Locales of localized parameters. Defaults to the definition's. */\n locales?: readonly string[];\n}\n\ninterface Pending {\n resource: string;\n target: ActionTarget;\n resolve: (outcome: ActionOutcome | false) => void;\n}\n\ninterface ClientPending extends Pending {\n Handler: ClientActionHandler;\n}\n\nfunction navigateTo(to: string | RouteReference) {\n if (typeof to === 'string') {\n window.location.assign(to);\n } else {\n console.warn(\n `[panneau] An action goes to the route \"${to.route}\": give ActionRunnerProvider an onNavigate.`,\n );\n }\n}\n\nfunction openDownload(download: ActionDownload) {\n const link = document.createElement('a');\n link.href = download.url;\n if (download.filename !== undefined) {\n link.download = download.filename;\n }\n link.rel = 'noopener';\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n}\n\n/**\n * Runs the actions that lists and forms hand over ([decision 0023]): it asks for their parameters\n * in a dialog, runs them through the adapter, shows their result (a toast, and the items that\n * didn't succeed), follows queued runs until they end, refreshes through `onResult`, follows\n * redirects and opens downloads. Put it inside `PanneauRoot`, and above the router of an app, so\n * that runs are followed from page to page. `useActionRunner(resource)` runs an action.\n */\nexport function ActionRunnerProvider({\n adapter,\n children,\n onResult,\n onNavigate = navigateTo,\n onDownload = openDownload,\n clientActions,\n pollInterval = 2000,\n locales,\n}: ActionRunnerProviderProps) {\n const intl = usePanneauIntl();\n const toasts = useToast();\n const { definition, plugins } = usePanneau();\n const [parameters, setParameters] = useState<Pending | null>(null);\n const [client, setClient] = useState<ClientPending | null>(null);\n const [details, setDetails] = useState<{ label: string; result: ActionResult } | null>(null);\n const [runs, setRuns] = useState<readonly FollowedRun[]>([]);\n // Runs whose end was already shown, so that a late poll doesn't show it twice.\n const notified = useRef(new Set<string>());\n // How many lists of runs are on screen (the popover of the runs): their user sees a run end.\n const watchers = useRef(0);\n\n /** What the action applied to, by the item's title or the count of items. */\n const subjectOf = (resource: string, target: ActionTarget, count: number | null = null) =>\n describeSubject(\n target,\n definition?.resources.find((candidate) => candidate.id === resource),\n intl,\n count,\n );\n\n /** The title of the item of an `item` action, to name it. */\n const itemTitleOf = (resource: string, target: ActionTarget) => {\n if (target.item === undefined) {\n return null;\n }\n const itemTitle = definition?.resources.find(\n (candidate) => candidate.id === resource,\n )?.itemTitle;\n return getItemTitle(target.item, itemTitle, intl.locale);\n };\n\n /** One toast per action and target: running it again replaces it. */\n const toastKey = (resource: string, target: ActionTarget) =>\n `panneau-action:${resource}:${target.action.id}:${target.item?.id ?? 'selection'}`;\n\n const finish = async (\n resource: string,\n target: ActionTarget,\n result: ActionResult,\n { queued = false }: { queued?: boolean } = {},\n ) => {\n await onResult?.(result, { resource, target });\n const counts = getResultCounts(result);\n const itemTitle = itemTitleOf(resource, target);\n const content = describeResult(\n result,\n getActionLabel(target.action, intl),\n intl,\n subjectOf(resource, target, counts.succeeded),\n itemTitle,\n );\n const entries = result.results ?? [];\n // The toast already names an item that is in use: its details would only repeat it.\n const hasDetails =\n entries.length > 0 &&\n !(\n entries.length === 1 &&\n entries[0] !== undefined &&\n isInUse(entries[0]) &&\n itemTitle !== null\n );\n const download = result.download ?? null;\n if (download !== null) {\n onDownload(download);\n }\n const redirect = result.redirect ?? null;\n // A queued run that ends in the open list of runs is seen there, unless its result says\n // more than its status: a message, items that didn't succeed, a download.\n const saysMore = (result.message ?? '') !== '' || hasDetails || download !== null;\n if (queued && watchers.current > 0 && !saysMore) {\n if (redirect !== null) {\n onNavigate(redirect);\n }\n return;\n }\n // \"Undo\" lives in the toast only (decision 0063): a queued run, which finished later, isn't\n // undone.\n const undo = !queued ? (result.undo ?? null) : null;\n toasts.show(\n {\n ...content,\n ...(undo !== null\n ? {\n action: {\n label: intl.formatMessage(messages.undo),\n onAction: () => void runUndo(resource, target, undo),\n },\n }\n : hasDetails\n ? {\n action: {\n label: intl.formatMessage(messages.details),\n onAction: () =>\n setDetails({\n label: getActionLabel(target.action, intl),\n result,\n }),\n },\n }\n : download !== null\n ? {\n action: {\n label: intl.formatMessage(messages.download),\n onAction: () => onDownload(download),\n },\n }\n : {}),\n },\n { key: toastKey(resource, target) },\n );\n if (redirect !== null) {\n onNavigate(redirect);\n }\n };\n\n /**\n * Runs the undo of a result: an action of the same resource, on the items it lists, as any\n * action. A short toast then says it was undone, in place of the first one.\n */\n const runUndo = async (\n resource: string,\n target: ActionTarget,\n undo: NonNullable<ActionResult['undo']>,\n ) => {\n const label = getActionLabel(target.action, intl);\n const key = { key: toastKey(resource, target) };\n const declared = definition?.resources\n .find((candidate) => candidate.id === resource)\n ?.actions?.find((action) => action.id === undo.action);\n const undoTarget: ActionTarget = {\n action: declared ?? { id: undo.action, kind: 'server', scope: ['selection'] },\n scope: 'selection',\n selection: { ids: undo.items },\n count: undo.items.length,\n };\n await adapter\n .runAction(resource, undo.action, {\n selection: { ids: undo.items },\n values: undo.params ?? {},\n })\n .then(async (response) => {\n if (response.run !== undefined) {\n follow(resource, undoTarget, response.run);\n return;\n }\n await onResult?.(response.result, { resource, target: undoTarget });\n const subject = subjectOf(resource, target, undo.items.length);\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.undoneFor, {\n action: label,\n subject,\n })\n : intl.formatMessage(messages.undone, { action: label }),\n },\n key,\n );\n })\n .catch((error: unknown) => {\n toasts.show(\n {\n title: intl.formatMessage(messages.undoFailed, { action: label }),\n ...(error instanceof Error && error.message !== ''\n ? { description: error.message }\n : {}),\n tone: 'danger',\n },\n key,\n );\n });\n };\n\n // No toast when a run starts: the runs button of the shell shows it, and its popover follows\n // it. The toast comes when the run ends.\n const follow = (resource: string, target: ActionTarget, run: ActionRun) => {\n setRuns((current) => [\n ...current.filter((entry) => entry.run.id !== run.id),\n { run, resource, target },\n ]);\n };\n\n const ended = async (entry: FollowedRun) => {\n const { run, resource, target } = entry;\n if (notified.current.has(run.id)) {\n return;\n }\n notified.current.add(run.id);\n if (run.result !== undefined) {\n await finish(resource, target, run.result, { queued: true });\n return;\n }\n const action = getActionLabel(target.action, intl);\n const subject = subjectOf(resource, target);\n const key = { key: toastKey(resource, target) };\n if (run.status === 'cancelled') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.cancelledFor, { action, subject })\n : intl.formatMessage(messages.cancelled, { action }),\n },\n key,\n );\n } else if (run.status === 'failed') {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.failedFor, { action, subject })\n : intl.formatMessage(messages.failed, { action }),\n tone: 'danger',\n },\n key,\n );\n } else if (watchers.current === 0) {\n toasts.show(\n {\n title:\n subject !== null\n ? intl.formatMessage(messages.doneFor, { action, subject })\n : intl.formatMessage(messages.done, { action }),\n tone: 'success',\n },\n key,\n );\n }\n };\n\n const execute = async (\n resource: string,\n target: ActionTarget,\n values: Record<string, unknown> = {},\n ): Promise<ActionOutcome> => {\n const response = await adapter.runAction(\n resource,\n target.action.id,\n buildActionRequest(target, values),\n );\n if (response.run !== undefined) {\n follow(resource, target, response.run);\n return { status: 'queued', run: response.run };\n }\n await finish(resource, target, response.result);\n return { status: 'done', result: response.result };\n };\n\n const run = (resource: string, target: ActionTarget): Promise<ActionOutcome | false> => {\n const { action } = target;\n if (action.kind === 'link') {\n const to = getLinkTarget(target);\n if (to === null) {\n return Promise.reject(new Error(`The action \"${action.id}\" has no URL or route.`));\n }\n onNavigate(to);\n return Promise.resolve({ status: 'navigated', to });\n }\n if (action.kind === 'client') {\n const name = action.component ?? '';\n const Handler =\n (clientActions !== undefined && Object.hasOwn(clientActions, name)\n ? clientActions[name]\n : undefined) ?? (plugins.actions.get(name) as ClientActionHandler | undefined);\n if (Handler === undefined) {\n return Promise.reject(\n new Error(`No handler for the client action \"${action.id}\" (${name}).`),\n );\n }\n return new Promise((resolve) => setClient({ resource, target, resolve, Handler }));\n }\n if ((action.fields ?? []).length > 0) {\n return new Promise((resolve) => setParameters({ resource, target, resolve }));\n }\n return execute(resource, target);\n };\n\n const cancelRun = async (id: string) => {\n if (adapter.cancelActionRun === undefined) {\n throw new Error('The adapter cannot cancel runs.');\n }\n await adapter.cancelActionRun(id);\n const updated = await adapter.getActionRun(id);\n setRuns((current) =>\n current.map((entry) => (entry.run.id === id ? { ...entry, run: updated } : entry)),\n );\n const entry = runs.find((candidate) => candidate.run.id === id);\n if (entry !== undefined && isFinished(updated.status)) {\n await ended({ ...entry, run: updated });\n }\n };\n\n const dismissRun = (id: string) =>\n setRuns((current) => current.filter((entry) => entry.run.id !== id));\n\n const onRunEnded = useEffectEvent((entry: FollowedRun) => ended(entry));\n\n // Checks the unfinished runs, one interval after the last change of the runs.\n useEffect(() => {\n const active = runs.filter((entry) => !isFinished(entry.run.status));\n if (active.length === 0) {\n return undefined;\n }\n let stopped = false;\n const timer = setTimeout(() => {\n void Promise.all(\n active.map(async (entry) => {\n try {\n const next = await adapter.getActionRun(entry.run.id);\n if (stopped) {\n return;\n }\n setRuns((current) =>\n current.map((candidate) =>\n candidate.run.id === next.id\n ? { ...candidate, run: next }\n : candidate,\n ),\n );\n if (isFinished(next.status)) {\n await onRunEnded({ ...entry, run: next });\n }\n } catch {\n // Checked again at the next interval.\n if (!stopped) {\n setRuns((current) => [...current]);\n }\n }\n }),\n );\n }, pollInterval);\n return () => {\n stopped = true;\n clearTimeout(timer);\n };\n }, [runs, adapter, pollInterval]);\n\n const watchRuns = () => {\n watchers.current += 1;\n return () => {\n watchers.current -= 1;\n };\n };\n\n const value: ActionRunnerContextValue = {\n adapter,\n run,\n runs,\n cancelRun,\n dismissRun,\n watchRuns,\n };\n\n const ClientHandler = client?.Handler;\n return (\n <ActionRunnerContext value={value}>\n {children}\n {parameters !== null ? (\n <ParametersDialog\n action={parameters.target.action}\n count={parameters.target.count}\n locales={locales}\n onSubmit={(values) => execute(parameters.resource, parameters.target, values)}\n onDone={(outcome) => {\n setParameters(null);\n parameters.resolve(outcome);\n }}\n onCancel={() => {\n setParameters(null);\n parameters.resolve(false);\n }}\n />\n ) : null}\n {client !== null && ClientHandler !== undefined ? (\n <ClientHandler\n action={client.target.action}\n resource={client.resource}\n target={client.target}\n onDone={(result) => {\n setClient(null);\n if (result === undefined) {\n client.resolve({ status: 'done', result: {} });\n return;\n }\n void finish(client.resource, client.target, result).then(() =>\n client.resolve({ status: 'done', result }),\n );\n }}\n onCancel={() => {\n setClient(null);\n client.resolve(false);\n }}\n />\n ) : null}\n {details !== null ? (\n <ResultsDialog\n label={details.label}\n result={details.result}\n onClose={() => setDetails(null)}\n />\n ) : null}\n </ActionRunnerContext>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0DA,SAASsD,WAAWf,IAA6B;CAC7C,IAAI,OAAOA,OAAO,UACdgB,OAAOC,SAASC,OAAOlB,EAAE;MAEzBmB,QAAQC,KACJ,0CAA0CpB,GAAGqB,MAAK,4CACtD;AAER;AAEA,SAASC,aAAapB,UAA0B;CAC5C,MAAMqB,OAAOC,SAASC,cAAc,GAAG;CACvCF,KAAKG,OAAOxB,SAASyB;CACrB,IAAIzB,SAAS0B,aAAaC,KAAAA,GACtBN,KAAKrB,WAAWA,SAAS0B;CAE7BL,KAAKO,MAAM;CACXP,KAAKQ,SAAS;CACdP,SAASQ,KAAKC,OAAOV,IAAI;CACzBA,KAAKW,MAAM;CACXX,KAAKY,OAAO;AAChB;;;;;;;;AASA,SAAOC,qBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAA8B,MAAA,EAAA7C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AAhL,EAAA,QAAAa,SAAA;EACPmK,MAAAnK,YAAY,OACT,oBAAC,eAAD;GACW,OAAAA,QAAOkD;GACN,QAAAlD,QAAOtD;GACN,eAAMuD,WAAW,IAAI;EAAC,CAAA,IAJtC;EAMOd,EAAA,MAAAa;EAAAb,EAAA,MAAAgL;CAAA,OAAAA,MAAAhL,EAAA;CAAA,IAAAiL;CAAA,IAAAjL,EAAA,QAAA3C,YAAA2C,EAAA,QAAA4K,OAAA5K,EAAA,QAAA8K,OAAA9K,EAAA,QAAAgL,OAAAhL,EAAA,QAAA0K,OAAA;EA7CZO,MAAA,qBAAC,qBAAD;GAA4BP;GAA5B,UAAA;IACKrN;IACAuN;IAgBAE;IAqBAE;GAvCe;;EA8CEhL,EAAA,MAAA3C;EAAA2C,EAAA,MAAA4K;EAAA5K,EAAA,MAAA8K;EAAA9K,EAAA,MAAAgL;EAAAhL,EAAA,MAAA0K;EAAA1K,EAAA,MAAAiL;CAAA,OAAAA,MAAAjL,EAAA;CAAA,OA9CtBiL;AA8CsB;AA7ZvB,SAAAb,OAAAc,WAAA;CAAA,OAiV0C,CAAA,GAAItH,SAAO;AAAC;AAjVtD,SAAA+F,OAAAwB,SAAA;CAAA,OAuTuC,CAACxO,WAAWwJ,QAAKd,IAAIwB,MAAO;AAAC;AAvTpE,SAAArE,MAAA4I,YAAAC,UAAA;CAAA,OA4CC,kBAAkBlN,WAAQ,GAAIC,SAAM+E,OAAOrB,GAAG,GAAI1D,SAAM8D,MAASJ,MAAf;AAAgC"}
@@ -14,11 +14,17 @@ export declare function getItemTitle(item: Partial<Item> | undefined, itemTitle:
14
14
  * have.
15
15
  */
16
16
  export declare function describeSubject(target: ActionTarget, resource: Pick<Resource, 'label' | 'itemTitle'> | undefined, intl: IntlShape, count?: number | null): string | null;
17
+ /** Whether an item of a result was skipped because something else uses it (`in_use`). */
18
+ export declare function isInUse(entry: ActionItemResult): boolean;
17
19
  /**
18
20
  * The toast of a result: its message, or "done" with what it was done to (`subject`), the counts,
19
- * and a tone that says how it went.
21
+ * and a tone that says how it went. Items skipped as `in_use` are explained, by the title of the
22
+ * item (`itemTitle`) when it is the only one: when every item is, that is the title of the toast.
23
+ */
24
+ export declare function describeResult(result: ActionResult, actionLabel: string, intl: IntlShape, subject?: string | null, itemTitle?: string | null): Omit<ToastContent, 'action'>;
25
+ /**
26
+ * Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`,
27
+ * `in_use`).
20
28
  */
21
- export declare function describeResult(result: ActionResult, actionLabel: string, intl: IntlShape, subject?: string | null): Omit<ToastContent, 'action'>;
22
- /** Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`). */
23
29
  export declare function describeItemResult(entry: ActionItemResult, intl: IntlShape): string;
24
30
  //# sourceMappingURL=describe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,YAAY,CACxB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,EAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CAWf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC3B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,CAAC,GAAG,SAAS,EAC3D,IAAI,EAAE,SAAS,EACf,KAAK,GAAE,MAAM,GAAG,IAAW,GAC5B,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,EACnB,IAAI,EAAE,SAAS,EACf,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,SAAS,GAAE,MAAM,GAAG,IAAW,GAChC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAiC9B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAkBnF"}
package/dist/describe.js CHANGED
@@ -33,38 +33,62 @@ function describeSubject(target, resource, intl, count = null) {
33
33
  plural: resource.label.plural
34
34
  });
35
35
  }
36
+ /** Whether an item of a result was skipped because something else uses it (`in_use`). */
37
+ function isInUse(entry) {
38
+ return entry.status === "skipped" && entry.reason === "in_use";
39
+ }
40
+ /**
41
+ * What the toast says of the items skipped as `in_use`: the item by its title when it is the only
42
+ * one and `itemTitle` is known, or their count. `null` when there are none.
43
+ */
44
+ function describeInUse(count, intl, itemTitle) {
45
+ if (count === 0) return null;
46
+ return count === 1 && itemTitle !== null && itemTitle !== "" ? intl.formatMessage(messages.inUseItem, { title: itemTitle }) : intl.formatMessage(messages.inUseCount, { count });
47
+ }
36
48
  /**
37
49
  * The toast of a result: its message, or "done" with what it was done to (`subject`), the counts,
38
- * and a tone that says how it went.
50
+ * and a tone that says how it went. Items skipped as `in_use` are explained, by the title of the
51
+ * item (`itemTitle`) when it is the only one: when every item is, that is the title of the toast.
39
52
  */
40
- function describeResult(result, actionLabel, intl, subject = null) {
53
+ function describeResult(result, actionLabel, intl, subject = null, itemTitle = null) {
41
54
  const { succeeded, failed, skipped } = getResultCounts(result);
55
+ const inUse = Math.min(skipped, (result.results ?? []).filter(isInUse).length);
56
+ const inUseText = describeInUse(inUse, intl, itemTitle);
57
+ if (inUseText !== null && (succeeded ?? 0) === 0 && failed === 0 && skipped === inUse) return {
58
+ title: inUseText,
59
+ tone: "warning"
60
+ };
42
61
  const parts = [
43
62
  ...succeeded !== null && (failed > 0 || skipped > 0) ? [intl.formatMessage(messages.succeededCount, { count: succeeded })] : [],
44
63
  ...failed > 0 ? [intl.formatMessage(messages.failedCount, { count: failed })] : [],
45
- ...skipped > 0 ? [intl.formatMessage(messages.skippedCount, { count: skipped })] : []
64
+ ...skipped > inUse ? [intl.formatMessage(messages.skippedCount, { count: skipped - inUse })] : []
46
65
  ];
66
+ const description = [...parts.length > 0 ? [intl.formatList(parts, { type: "unit" })] : [], ...inUseText !== null ? [inUseText] : []].join(". ");
47
67
  const tone = failed > 0 ? succeeded === 0 ? "danger" : "warning" : skipped > 0 ? "warning" : "success";
48
68
  return {
49
69
  title: result.message !== void 0 && result.message !== "" ? result.message : subject !== null ? intl.formatMessage(messages.doneFor, {
50
70
  action: actionLabel,
51
71
  subject
52
72
  }) : intl.formatMessage(messages.done, { action: actionLabel }),
53
- ...parts.length > 0 ? { description: intl.formatList(parts, { type: "unit" }) } : {},
73
+ ...description !== "" ? { description } : {},
54
74
  tone
55
75
  };
56
76
  }
57
- /** Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`). */
77
+ /**
78
+ * Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`,
79
+ * `in_use`).
80
+ */
58
81
  function describeItemResult(entry, intl) {
59
82
  if (entry.message !== void 0 && entry.message !== "") return entry.message;
60
83
  switch (entry.reason) {
61
84
  case "forbidden": return intl.formatMessage(messages.reasonForbidden);
62
85
  case "not_found": return intl.formatMessage(messages.reasonNotFound);
63
86
  case "unchanged": return intl.formatMessage(messages.reasonUnchanged);
87
+ case "in_use": return intl.formatMessage(messages.reasonInUse);
64
88
  default: return intl.formatMessage(entry.status === "failed" ? messages.statusFailed : messages.statusSkipped);
65
89
  }
66
90
  }
67
91
  //#endregion
68
- export { describeItemResult, describeResult, describeSubject, getItemTitle };
92
+ export { describeItemResult, describeResult, describeSubject, getItemTitle, isInUse };
69
93
 
70
94
  //# sourceMappingURL=describe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"describe.js","names":["IntlShape","ActionItemResult","ActionResult","Item","Resource","ToastContent","messages","getResultCounts","ActionTarget","getItemTitle","item","Partial","itemTitle","locale","value","undefined","localized","Record","first","Object","values","describeSubject","target","resource","Pick","intl","count","scope","title","formatMessage","subjectItem","total","subjectCount","singular","label","plural","describeResult","result","actionLabel","subject","Omit","succeeded","failed","skipped","parts","succeededCount","failedCount","skippedCount","tone","message","doneFor","action","done","length","description","formatList","type","describeItemResult","entry","reason","reasonForbidden","reasonNotFound","reasonUnchanged","status","statusFailed","statusSkipped"],"sources":["../src/describe.ts"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport type { ActionItemResult, ActionResult, Item, Resource } from '@panneau/protocol';\nimport type { ToastContent } from '@panneau/ui';\n\nimport { messages } from './messages';\nimport { getResultCounts } from './request';\nimport type { ActionTarget } from './types';\n\n/**\n * The title of an item: the value of the resource's `itemTitle` field, in the locale when it is\n * localized. `null` without one.\n */\nexport function getItemTitle(\n item: Partial<Item> | undefined,\n itemTitle: string | undefined,\n locale: string,\n): string | null {\n const value = itemTitle !== undefined ? item?.[itemTitle] : undefined;\n if (typeof value === 'string') {\n return value;\n }\n if (value !== null && typeof value === 'object') {\n const localized = (value as Record<string, unknown>)[locale];\n const first = localized ?? Object.values(value)[0];\n return typeof first === 'string' ? first : null;\n }\n return null;\n}\n\n/**\n * What an action applied to, for its toast: the item by its title (\"“Spring contest”\"), or the\n * count of items with the resource's labels (\"3 entries\"). `null` when there is nothing to name:\n * an item without a title, a selection without a count, or a resource the definition doesn't\n * have.\n */\nexport function describeSubject(\n target: ActionTarget,\n resource: Pick<Resource, 'label' | 'itemTitle'> | undefined,\n intl: IntlShape,\n count: number | null = null,\n): string | null {\n if (target.scope === 'item' || target.item !== undefined) {\n const title = getItemTitle(\n target.item as Partial<Item> | undefined,\n resource?.itemTitle,\n intl.locale,\n );\n return title !== null && title !== ''\n ? intl.formatMessage(messages.subjectItem, { title })\n : null;\n }\n const total = count ?? target.count ?? null;\n if (resource === undefined || total === null) {\n return null;\n }\n return intl.formatMessage(messages.subjectCount, {\n count: total,\n singular: resource.label.singular,\n plural: resource.label.plural,\n });\n}\n\n/**\n * The toast of a result: its message, or \"done\" with what it was done to (`subject`), the counts,\n * and a tone that says how it went.\n */\nexport function describeResult(\n result: ActionResult,\n actionLabel: string,\n intl: IntlShape,\n subject: string | null = null,\n): Omit<ToastContent, 'action'> {\n const { succeeded, failed, skipped } = getResultCounts(result);\n const parts = [\n ...(succeeded !== null && (failed > 0 || skipped > 0)\n ? [intl.formatMessage(messages.succeededCount, { count: succeeded })]\n : []),\n ...(failed > 0 ? [intl.formatMessage(messages.failedCount, { count: failed })] : []),\n ...(skipped > 0 ? [intl.formatMessage(messages.skippedCount, { count: skipped })] : []),\n ];\n const tone: ToastContent['tone'] =\n failed > 0 ? (succeeded === 0 ? 'danger' : 'warning') : skipped > 0 ? 'warning' : 'success';\n return {\n title:\n result.message !== undefined && result.message !== ''\n ? result.message\n : subject !== null\n ? intl.formatMessage(messages.doneFor, { action: actionLabel, subject })\n : intl.formatMessage(messages.done, { action: actionLabel }),\n ...(parts.length > 0 ? { description: intl.formatList(parts, { type: 'unit' }) } : {}),\n tone,\n };\n}\n\n/** Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`). */\nexport function describeItemResult(entry: ActionItemResult, intl: IntlShape): string {\n if (entry.message !== undefined && entry.message !== '') {\n return entry.message;\n }\n switch (entry.reason) {\n case 'forbidden':\n return intl.formatMessage(messages.reasonForbidden);\n case 'not_found':\n return intl.formatMessage(messages.reasonNotFound);\n case 'unchanged':\n return intl.formatMessage(messages.reasonUnchanged);\n default:\n return intl.formatMessage(\n entry.status === 'failed' ? messages.statusFailed : messages.statusSkipped,\n );\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgBS,aACZC,MACAE,WACAC,QACa;CACb,MAAMC,QAAQF,cAAcG,KAAAA,IAAYL,OAAOE,aAAaG,KAAAA;CAC5D,IAAI,OAAOD,UAAU,UACjB,OAAOA;CAEX,IAAIA,UAAU,Q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,YAAY;CACtF,OAAO;EACHf,OACIS,OAAOY,YAAYlC,KAAAA,KAAasB,OAAOY,YAAY,KAC7CZ,OAAOY,UACPV,YAAY,OACVd,KAAKI,cAAcvB,SAAS4C,SAAS;GAAEC,QAAQb;GAAaC;EAAQ,CAAC,IACrEd,KAAKI,cAAcvB,SAAS8C,MAAM,EAAED,QAAQb,YAAY,CAAC;EACrE,GAAIM,MAAMS,SAAS,IAAI,EAAEC,aAAa7B,KAAK8B,WAAWX,OAAO,EAAEY,MAAM,OAAO,CAAC,EAAE,IAAI,CAAC;EACpFR;CACJ;AACJ;;AAGA,SAAgBS,mBAAmBC,OAAyBjC,MAAyB;CACjF,IAAIiC,MAAMT,YAAYlC,KAAAA,KAAa2C,MAAMT,YAAY,IACjD,OAAOS,MAAMT;CAEjB,QAAQS,MAAMC,QAAd;EACI,KAAK,aACD,OAAOlC,KAAKI,cAAcvB,SAASsD,eAAe;EACtD,KAAK,aACD,OAAOnC,KAAKI,cAAcvB,SAASuD,cAAc;EACrD,KAAK,aACD,OAAOpC,KAAKI,cAAcvB,SAASwD,eAAe;EACtD,SACI,OAAOrC,KAAKI,cACR6B,MAAMK,WAAW,WAAWzD,SAAS0D,eAAe1D,SAAS2D,aACjE;CACR;AACJ"}
1
+ {"version":3,"file":"describe.js","names":["IntlShape","ActionItemResult","ActionResult","Item","Resource","ToastContent","messages","getResultCounts","ActionTarget","getItemTitle","item","Partial","itemTitle","locale","value","undefined","localized","Record","first","Object","values","describeSubject","target","resource","Pick","intl","count","scope","title","formatMessage","subjectItem","total","subjectCount","singular","label","plural","isInUse","entry","status","reason","describeInUse","inUseItem","inUseCount","describeResult","result","actionLabel","subject","Omit","succeeded","failed","skipped","inUse","Math","min","results","filter","length","inUseText","tone","parts","succeededCount","failedCount","skippedCount","description","formatList","type","join","message","doneFor","action","done","describeItemResult","reasonForbidden","reasonNotFound","reasonUnchanged","reasonInUse","statusFailed","statusSkipped"],"sources":["../src/describe.ts"],"sourcesContent":["import type { IntlShape } from 'react-intl';\n\nimport type { ActionItemResult, ActionResult, Item, Resource } from '@panneau/protocol';\nimport type { ToastContent } from '@panneau/ui';\n\nimport { messages } from './messages';\nimport { getResultCounts } from './request';\nimport type { ActionTarget } from './types';\n\n/**\n * The title of an item: the value of the resource's `itemTitle` field, in the locale when it is\n * localized. `null` without one.\n */\nexport function getItemTitle(\n item: Partial<Item> | undefined,\n itemTitle: string | undefined,\n locale: string,\n): string | null {\n const value = itemTitle !== undefined ? item?.[itemTitle] : undefined;\n if (typeof value === 'string') {\n return value;\n }\n if (value !== null && typeof value === 'object') {\n const localized = (value as Record<string, unknown>)[locale];\n const first = localized ?? Object.values(value)[0];\n return typeof first === 'string' ? first : null;\n }\n return null;\n}\n\n/**\n * What an action applied to, for its toast: the item by its title (\"“Spring contest”\"), or the\n * count of items with the resource's labels (\"3 entries\"). `null` when there is nothing to name:\n * an item without a title, a selection without a count, or a resource the definition doesn't\n * have.\n */\nexport function describeSubject(\n target: ActionTarget,\n resource: Pick<Resource, 'label' | 'itemTitle'> | undefined,\n intl: IntlShape,\n count: number | null = null,\n): string | null {\n if (target.scope === 'item' || target.item !== undefined) {\n const title = getItemTitle(\n target.item as Partial<Item> | undefined,\n resource?.itemTitle,\n intl.locale,\n );\n return title !== null && title !== ''\n ? intl.formatMessage(messages.subjectItem, { title })\n : null;\n }\n const total = count ?? target.count ?? null;\n if (resource === undefined || total === null) {\n return null;\n }\n return intl.formatMessage(messages.subjectCount, {\n count: total,\n singular: resource.label.singular,\n plural: resource.label.plural,\n });\n}\n\n/** Whether an item of a result was skipped because something else uses it (`in_use`). */\nexport function isInUse(entry: ActionItemResult): boolean {\n return entry.status === 'skipped' && entry.reason === 'in_use';\n}\n\n/**\n * What the toast says of the items skipped as `in_use`: the item by its title when it is the only\n * one and `itemTitle` is known, or their count. `null` when there are none.\n */\nfunction describeInUse(count: number, intl: IntlShape, itemTitle: string | null): string | null {\n if (count === 0) {\n return null;\n }\n return count === 1 && itemTitle !== null && itemTitle !== ''\n ? intl.formatMessage(messages.inUseItem, { title: itemTitle })\n : intl.formatMessage(messages.inUseCount, { count });\n}\n\n/**\n * The toast of a result: its message, or \"done\" with what it was done to (`subject`), the counts,\n * and a tone that says how it went. Items skipped as `in_use` are explained, by the title of the\n * item (`itemTitle`) when it is the only one: when every item is, that is the title of the toast.\n */\nexport function describeResult(\n result: ActionResult,\n actionLabel: string,\n intl: IntlShape,\n subject: string | null = null,\n itemTitle: string | null = null,\n): Omit<ToastContent, 'action'> {\n const { succeeded, failed, skipped } = getResultCounts(result);\n const inUse = Math.min(skipped, (result.results ?? []).filter(isInUse).length);\n const inUseText = describeInUse(inUse, intl, itemTitle);\n if (inUseText !== null && (succeeded ?? 0) === 0 && failed === 0 && skipped === inUse) {\n // Nothing was done: the toast says why.\n return { title: inUseText, tone: 'warning' };\n }\n const parts = [\n ...(succeeded !== null && (failed > 0 || skipped > 0)\n ? [intl.formatMessage(messages.succeededCount, { count: succeeded })]\n : []),\n ...(failed > 0 ? [intl.formatMessage(messages.failedCount, { count: failed })] : []),\n ...(skipped > inUse\n ? [intl.formatMessage(messages.skippedCount, { count: skipped - inUse })]\n : []),\n ];\n const description = [\n ...(parts.length > 0 ? [intl.formatList(parts, { type: 'unit' })] : []),\n ...(inUseText !== null ? [inUseText] : []),\n ].join('. ');\n const tone: ToastContent['tone'] =\n failed > 0 ? (succeeded === 0 ? 'danger' : 'warning') : skipped > 0 ? 'warning' : 'success';\n return {\n title:\n result.message !== undefined && result.message !== ''\n ? result.message\n : subject !== null\n ? intl.formatMessage(messages.doneFor, { action: actionLabel, subject })\n : intl.formatMessage(messages.done, { action: actionLabel }),\n ...(description !== '' ? { description } : {}),\n tone,\n };\n}\n\n/**\n * Why an item didn't succeed: its message, or its reason (`forbidden`, `not_found`, `unchanged`,\n * `in_use`).\n */\nexport function describeItemResult(entry: ActionItemResult, intl: IntlShape): string {\n if (entry.message !== undefined && entry.message !== '') {\n return entry.message;\n }\n switch (entry.reason) {\n case 'forbidden':\n return intl.formatMessage(messages.reasonForbidden);\n case 'not_found':\n return intl.formatMessage(messages.reasonNotFound);\n case 'unchanged':\n return intl.formatMessage(messages.reasonUnchanged);\n case 'in_use':\n return intl.formatMessage(messages.reasonInUse);\n default:\n return intl.formatMessage(\n entry.status === 'failed' ? messages.statusFailed : messages.statusSkipped,\n );\n }\n}\n"],"mappings":";;;;;;;AAaA,SAAgBS,aACZC,MACAE,WACAC,QACa;CACb,MAAMC,QAAQF,cAAcG,KAAAA,IAAYL,OAAOE,aAAaG,KAAAA;CAC5D,IAAI,OAAOD,UAAU,UACjB,OAAOA;CAEX,IAAIA,UAAU,QAAQ,OAAOA,UAAU,UAAU;EAE7C,MAAMI,QADaJ,MAAkCD,WAC1BM,OAAOC,OAAON,KAAK,CAAC,CAAC;EAChD,OAAO,OAAOI,UAAU,WAAWA,QAAQ;CAC/C;CACA,OAAO;AACX;;;;;;;AAQA,SAAgBG,gBACZC,QACAC,UACAE,MACAC,QAAuB,MACV;CACb,IAAIJ,OAAOK,UAAU,UAAUL,OAAOZ,SAASK,KAAAA,GAAW;EACtD,MAAMa,QAAQnB,aACVa,OAAOZ,MACPa,UAAUX,WACVa,KAAKZ,MACT;EACA,OAAOe,UAAU,QAAQA,UAAU,KAC7BH,KAAKI,cAAcvB,SAASwB,aAAa,EAAEF,MAAM,CAAC,IAClD;CACV;CACA,MAAMG,QAAQL,SAASJ,OAAOI,SAAS;CACvC,IAAIH,aAAaR,KAAAA,KAAagB,UAAU,MACpC,OAAO;CAEX,OAAON,KAAKI,cAAcvB,SAAS0B,cAAc;EAC7CN,OAAOK;EACPE,UAAUV,SAASW,MAAMD;EACzBE,QAAQZ,SAASW,MAAMC;CAC3B,CAAC;AACL;;AAGA,SAAgBC,QAAQC,OAAkC;CACtD,OAAOA,MAAMC,WAAW,aAAaD,MAAME,WAAW;AAC1D;;;;;AAMA,SAASC,cAAcd,OAAeD,MAAiBb,WAAyC;CAC5F,IAAIc,UAAU,GACV,OAAO;CAEX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UAAU,IAAI,YAAY;CACtF,OAAO;EACHtB,OACIgB,OAAOuB,YAAYpD,KAAAA,KAAa6B,OAAOuB,YAAY,KAC7CvB,OAAOuB,UACPrB,YAAY,OACVrB,KAAKI,cAAcvB,SAAS8D,SAAS;GAAEC,QAAQxB;GAAaC;EAAQ,CAAC,IACrErB,KAAKI,cAAcvB,SAASgE,MAAM,EAAED,QAAQxB,YAAY,CAAC;EACrE,GAAIkB,gBAAgB,KAAK,EAAEA,YAAY,IAAI,CAAC;EAC5CL;CACJ;AACJ;;;;;AAMA,SAAgBa,mBAAmBlC,OAAyBZ,MAAyB;CACjF,IAAIY,MAAM8B,YAAYpD,KAAAA,KAAasB,MAAM8B,YAAY,IACjD,OAAO9B,MAAM8B;CAEjB,QAAQ9B,MAAME,QAAd;EACI,KAAK,aACD,OAAOd,KAAKI,cAAcvB,SAASkE,eAAe;EACtD,KAAK,aACD,OAAO/C,KAAKI,cAAcvB,SAASmE,cAAc;EACrD,KAAK,aACD,OAAOhD,KAAKI,cAAcvB,SAASoE,eAAe;EACtD,KAAK,UACD,OAAOjD,KAAKI,cAAcvB,SAASqE,WAAW;EAClD,SACI,OAAOlD,KAAKI,cACRQ,MAAMC,WAAW,WAAWhC,SAASsE,eAAetE,SAASuE,aACjE;CACR;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/actions",
3
- "version": "5.0.0-alpha.18",
3
+ "version": "5.0.0-alpha.19",
4
4
  "description": "Runs the actions of lists and forms: parameters in a dialog, the action through a data adapter, its result, and queued runs.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,15 +37,15 @@
37
37
  "react-intl": "^12.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@panneau/core": "5.0.0-alpha.18",
41
- "@panneau/data": "5.0.0-alpha.18",
42
- "@panneau/forms": "5.0.0-alpha.18",
43
- "@panneau/intl": "5.0.0-alpha.18",
44
- "@panneau/protocol": "5.0.0-alpha.18",
45
- "@panneau/ui": "5.0.0-alpha.18",
40
+ "@panneau/core": "5.0.0-alpha.19",
41
+ "@panneau/data": "5.0.0-alpha.19",
42
+ "@panneau/forms": "5.0.0-alpha.19",
43
+ "@panneau/intl": "5.0.0-alpha.19",
44
+ "@panneau/protocol": "5.0.0-alpha.19",
45
+ "@panneau/ui": "5.0.0-alpha.19",
46
46
  "lucide-react": "^1.57.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@panneau/lists": "5.0.0-alpha.18"
49
+ "@panneau/lists": "5.0.0-alpha.19"
50
50
  }
51
51
  }