@panneau/actions 4.1.1 → 5.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/dist/ActionRunner.css +84 -0
- package/dist/ActionRunner.module.js +34 -0
- package/dist/ActionRunner.module.js.map +1 -0
- package/dist/ActionRunnerProvider.d.ts +36 -0
- package/dist/ActionRunnerProvider.d.ts.map +1 -0
- package/dist/ActionRunnerProvider.js +388 -0
- package/dist/ActionRunnerProvider.js.map +1 -0
- package/dist/ActionRuns.d.ts +12 -0
- package/dist/ActionRuns.d.ts.map +1 -0
- package/dist/ActionRuns.js +129 -0
- package/dist/ActionRuns.js.map +1 -0
- package/dist/ParametersDialog.d.ts +19 -0
- package/dist/ParametersDialog.d.ts.map +1 -0
- package/dist/ParametersDialog.js +139 -0
- package/dist/ParametersDialog.js.map +1 -0
- package/dist/ResultsDialog.d.ts +10 -0
- package/dist/ResultsDialog.d.ts.map +1 -0
- package/dist/ResultsDialog.js +130 -0
- package/dist/ResultsDialog.js.map +1 -0
- package/dist/context.d.ts +10 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/context.js.map +1 -0
- package/dist/describe.d.ts +8 -0
- package/dist/describe.d.ts.map +1 -0
- package/dist/describe.js +32 -0
- package/dist/describe.js.map +1 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -74
- package/dist/messages.d.ts +2 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +1 -0
- package/dist/preview.d.ts +21 -0
- package/dist/preview.d.ts.map +1 -0
- package/dist/preview.js +30 -0
- package/dist/preview.js.map +1 -0
- package/dist/request.d.ts +15 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +50 -0
- package/dist/request.js.map +1 -0
- package/dist/types.d.ts +62 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useActionRunner.d.ts +31 -0
- package/dist/useActionRunner.d.ts.map +1 -0
- package/dist/useActionRunner.js +48 -0
- package/dist/useActionRunner.js.map +1 -0
- package/package.json +29 -50
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe.js","names":["IntlShape","ActionItemResult","ActionResult","ToastContent","messages","getResultCounts","describeResult","result","actionLabel","intl","Omit","succeeded","failed","skipped","parts","formatMessage","succeededCount","count","failedCount","skippedCount","tone","title","message","undefined","done","action","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 } from '@panneau/protocol';\nimport type { ToastContent } from '@panneau/ui';\n\nimport { messages } from './messages';\nimport { getResultCounts } from './request';\n\n/** The toast of a result: its message, or \"done\", the counts, and a tone that says how it went. */\nexport function describeResult(\n result: ActionResult,\n actionLabel: string,\n intl: IntlShape,\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 : 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":";;;;AASA,SAAgBM,eACZC,QACAC,aACAC,MAC4B;CAC5B,MAAM,EAAEE,WAAWC,QAAQC,YAAYR,gBAAgBE,MAAM;CAC7D,MAAMO,QAAQ;EACV,GAAIH,cAAc,SAASC,SAAS,KAAKC,UAAU,KAC7C,CAACJ,KAAKM,cAAcX,SAASY,gBAAgB,EAAEC,OAAON,UAAU,CAAC,CAAC,IAClE,CAAA;EACN,GAAIC,SAAS,IAAI,CAACH,KAAKM,cAAcX,SAASc,aAAa,EAAED,OAAOL,OAAO,CAAC,CAAC,IAAI,CAAA;EACjF,GAAIC,UAAU,IAAI,CAACJ,KAAKM,cAAcX,SAASe,cAAc,EAAEF,OAAOJ,QAAQ,CAAC,CAAC,IAAI,CAAA;CAAG;CAE3F,MAAMO,OACFR,SAAS,IAAKD,cAAc,IAAI,WAAW,YAAaE,UAAU,IAAI,YAAY;CACtF,OAAO;EACHQ,OACId,OAAOe,YAAYC,KAAAA,KAAahB,OAAOe,YAAY,KAC7Cf,OAAOe,UACPb,KAAKM,cAAcX,SAASoB,MAAM,EAAEC,QAAQjB,YAAY,CAAC;EACnE,GAAIM,MAAMY,SAAS,IAAI,EAAEC,aAAalB,KAAKmB,WAAWd,OAAO,EAAEe,MAAM,OAAO,CAAC,EAAE,IAAI,CAAC;EACpFT;CACJ;AACJ;;AAGA,SAAgBU,mBAAmBC,OAAyBtB,MAAyB;CACjF,IAAIsB,MAAMT,YAAYC,KAAAA,KAAaQ,MAAMT,YAAY,IACjD,OAAOS,MAAMT;CAEjB,QAAQS,MAAMC,QAAd;EACI,KAAK,aACD,OAAOvB,KAAKM,cAAcX,SAAS6B,eAAe;EACtD,KAAK,aACD,OAAOxB,KAAKM,cAAcX,SAAS8B,cAAc;EACrD,KAAK,aACD,OAAOzB,KAAKM,cAAcX,SAAS+B,eAAe;EACtD,SACI,OAAO1B,KAAKM,cACRgB,MAAMK,WAAW,WAAWhC,SAASiC,eAAejC,SAASkC,aACjE;CACR;AACJ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export { ActionRunnerProvider, type ActionRunnerProviderProps } from './ActionRunnerProvider.js';
|
|
2
|
+
export { ActionRuns, type ActionRunsProps } from './ActionRuns.js';
|
|
3
|
+
export { ParametersDialog, type ParametersDialogProps } from './ParametersDialog.js';
|
|
4
|
+
export { ResultsDialog, type ResultsDialogProps } from './ResultsDialog.js';
|
|
5
|
+
export { describeItemResult, describeResult } from './describe.js';
|
|
6
|
+
export { type ActionPreview, canPreviewAction, previewAction } from './preview.js';
|
|
7
|
+
export { buildActionRequest, getLinkTarget, getResultCounts } from './request.js';
|
|
8
|
+
export type { ActionAdapter, ActionDownload, ActionOutcome, ActionResultContext, ActionTarget, ClientActionHandler, ClientActionProps, FollowedRun, } from './types.js';
|
|
9
|
+
export { useActionPreview, useActionRunner, useActionRuns } from './useActionRunner.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC/E,YAAY,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,74 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
import { jsx } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
var components = /*#__PURE__*/Object.freeze({
|
|
13
|
-
__proto__: null,
|
|
14
|
-
Delete: actionDelete,
|
|
15
|
-
Duplicate: actionDuplicate,
|
|
16
|
-
Edit: actionEdit,
|
|
17
|
-
Import: actionImport,
|
|
18
|
-
Restore: actionRestore,
|
|
19
|
-
Show: actionShow,
|
|
20
|
-
Upload: actionUpload
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
function ActionsProviders(t0) {
|
|
24
|
-
const $ = c(10);
|
|
25
|
-
let props;
|
|
26
|
-
let t1;
|
|
27
|
-
let t2;
|
|
28
|
-
if ($[0] !== t0) {
|
|
29
|
-
({
|
|
30
|
-
components: t1,
|
|
31
|
-
children: t2,
|
|
32
|
-
...props
|
|
33
|
-
} = t0);
|
|
34
|
-
$[0] = t0;
|
|
35
|
-
$[1] = props;
|
|
36
|
-
$[2] = t1;
|
|
37
|
-
$[3] = t2;
|
|
38
|
-
} else {
|
|
39
|
-
props = $[1];
|
|
40
|
-
t1 = $[2];
|
|
41
|
-
t2 = $[3];
|
|
42
|
-
}
|
|
43
|
-
const injectedComponents = t1 === undefined ? null : t1;
|
|
44
|
-
const children = t2 === undefined ? null : t2;
|
|
45
|
-
let t3;
|
|
46
|
-
if ($[4] !== injectedComponents) {
|
|
47
|
-
t3 = {
|
|
48
|
-
...components,
|
|
49
|
-
...injectedComponents
|
|
50
|
-
};
|
|
51
|
-
$[4] = injectedComponents;
|
|
52
|
-
$[5] = t3;
|
|
53
|
-
} else {
|
|
54
|
-
t3 = $[5];
|
|
55
|
-
}
|
|
56
|
-
let t4;
|
|
57
|
-
if ($[6] !== children || $[7] !== props || $[8] !== t3) {
|
|
58
|
-
t4 = /*#__PURE__*/jsx(ComponentsProvider, {
|
|
59
|
-
namespace: ACTIONS_NAMESPACE,
|
|
60
|
-
components: t3,
|
|
61
|
-
...props,
|
|
62
|
-
children: children
|
|
63
|
-
});
|
|
64
|
-
$[6] = children;
|
|
65
|
-
$[7] = props;
|
|
66
|
-
$[8] = t3;
|
|
67
|
-
$[9] = t4;
|
|
68
|
-
} else {
|
|
69
|
-
t4 = $[9];
|
|
70
|
-
}
|
|
71
|
-
return t4;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { ActionsProviders as default };
|
|
1
|
+
import { ParametersDialog } from "./ParametersDialog.js";
|
|
2
|
+
import { buildActionRequest, getLinkTarget, getResultCounts } from "./request.js";
|
|
3
|
+
import { describeItemResult, describeResult } from "./describe.js";
|
|
4
|
+
import { ResultsDialog } from "./ResultsDialog.js";
|
|
5
|
+
import { ActionRunnerProvider } from "./ActionRunnerProvider.js";
|
|
6
|
+
import { ActionRuns } from "./ActionRuns.js";
|
|
7
|
+
import { canPreviewAction, previewAction } from "./preview.js";
|
|
8
|
+
import { useActionPreview, useActionRunner, useActionRuns } from "./useActionRunner.js";
|
|
9
|
+
export { ActionRunnerProvider, ActionRuns, ParametersDialog, ResultsDialog, buildActionRequest, canPreviewAction, describeItemResult, describeResult, getLinkTarget, getResultCounts, previewAction, useActionPreview, useActionRunner, useActionRuns };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { actionsMessages as messages } from "@panneau/intl";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ActionAdapter, ActionTarget } from './types.js';
|
|
2
|
+
/** What a dry run of an action told: how many items it would apply to, and skip. */
|
|
3
|
+
export interface ActionPreview {
|
|
4
|
+
succeeded: number;
|
|
5
|
+
skipped: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Whether the backend can say what an action would do before it runs: a `server` action with
|
|
9
|
+
* `dryRun`, on every item matching a query. Selected ids need no dry run, since the list knows
|
|
10
|
+
* their abilities.
|
|
11
|
+
*/
|
|
12
|
+
export declare function canPreviewAction(target: ActionTarget): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Asks the backend what an action would do on a query selection, without running it (a dry run,
|
|
15
|
+
* `"dryRun": true` in the request), and resolves with the counts of its summary, or with `null`
|
|
16
|
+
* for an action that can't be previewed (`canPreviewAction()`).
|
|
17
|
+
*/
|
|
18
|
+
export declare function previewAction(adapter: Pick<ActionAdapter, 'runAction'>, resource: string, target: ActionTarget, options?: {
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}): Promise<ActionPreview | null>;
|
|
21
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE3D,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQ9D;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAC/B,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,EACzC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACvC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAc/B"}
|
package/dist/preview.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/preview.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether the backend can say what an action would do before it runs: a `server` action with
|
|
4
|
+
* `dryRun`, on every item matching a query. Selected ids need no dry run, since the list knows
|
|
5
|
+
* their abilities.
|
|
6
|
+
*/
|
|
7
|
+
function canPreviewAction(target) {
|
|
8
|
+
const { action, selection } = target;
|
|
9
|
+
return action.dryRun === true && action.kind === "server" && selection !== void 0 && "query" in selection;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Asks the backend what an action would do on a query selection, without running it (a dry run,
|
|
13
|
+
* `"dryRun": true` in the request), and resolves with the counts of its summary, or with `null`
|
|
14
|
+
* for an action that can't be previewed (`canPreviewAction()`).
|
|
15
|
+
*/
|
|
16
|
+
async function previewAction(adapter, resource, target, options = {}) {
|
|
17
|
+
if (!canPreviewAction(target)) return null;
|
|
18
|
+
const summary = (await adapter.runAction(resource, target.action.id, {
|
|
19
|
+
selection: target.selection,
|
|
20
|
+
dryRun: true
|
|
21
|
+
}, options)).result?.summary;
|
|
22
|
+
return summary !== void 0 ? {
|
|
23
|
+
succeeded: summary.succeeded,
|
|
24
|
+
skipped: summary.skipped
|
|
25
|
+
} : null;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { canPreviewAction, previewAction };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","names":["ActionAdapter","ActionTarget","ActionPreview","succeeded","skipped","canPreviewAction","target","action","selection","dryRun","kind","undefined","previewAction","adapter","Pick","resource","options","signal","AbortSignal","Promise","response","runAction","id","summary","result"],"sources":["../src/preview.ts"],"sourcesContent":["import type { ActionAdapter, ActionTarget } from './types';\n\n/** What a dry run of an action told: how many items it would apply to, and skip. */\nexport interface ActionPreview {\n succeeded: number;\n skipped: number;\n}\n\n/**\n * Whether the backend can say what an action would do before it runs: a `server` action with\n * `dryRun`, on every item matching a query. Selected ids need no dry run, since the list knows\n * their abilities.\n */\nexport function canPreviewAction(target: ActionTarget): boolean {\n const { action, selection } = target;\n return (\n action.dryRun === true &&\n action.kind === 'server' &&\n selection !== undefined &&\n 'query' in selection\n );\n}\n\n/**\n * Asks the backend what an action would do on a query selection, without running it (a dry run,\n * `\"dryRun\": true` in the request), and resolves with the counts of its summary, or with `null`\n * for an action that can't be previewed (`canPreviewAction()`).\n */\nexport async function previewAction(\n adapter: Pick<ActionAdapter, 'runAction'>,\n resource: string,\n target: ActionTarget,\n options: { signal?: AbortSignal } = {},\n): Promise<ActionPreview | null> {\n if (!canPreviewAction(target)) {\n return null;\n }\n const response = await adapter.runAction(\n resource,\n target.action.id,\n { selection: target.selection, dryRun: true },\n options,\n );\n const summary = response.result?.summary;\n return summary !== undefined\n ? { succeeded: summary.succeeded, skipped: summary.skipped }\n : null;\n}\n"],"mappings":";;;;;;AAaA,SAAgBK,iBAAiBC,QAA+B;CAC5D,MAAM,EAAEC,QAAQC,cAAcF;CAC9B,OACIC,OAAOE,WAAW,QAClBF,OAAOG,SAAS,YAChBF,cAAcG,KAAAA,KACd,WAAWH;AAEnB;;;;;;AAOA,eAAsBI,cAClBC,SACAE,UACAT,QACAU,UAAoC,CAAC,GACR;CAC7B,IAAI,CAACX,iBAAiBC,MAAM,GACxB,OAAO;CAQX,MAAMiB,WAAUH,MANOP,QAAQQ,UAC3BN,UACAT,OAAOC,OAAOe,IACd;EAAEd,WAAWF,OAAOE;EAAWC,QAAQ;CAAK,GAC5CO,OACJ,EAAA,CACyBQ,QAAQD;CACjC,OAAOA,YAAYZ,KAAAA,IACb;EAAER,WAAWoB,QAAQpB;EAAWC,SAASmB,QAAQnB;CAAQ,IACzD;AACV"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ActionRequest, ActionResult, RouteReference } from '@panneau/protocol';
|
|
2
|
+
import type { ActionTarget } from './types.js';
|
|
3
|
+
/** The request of an action: its selection (none for the resource), and its parameter values. */
|
|
4
|
+
export declare function buildActionRequest(target: ActionTarget, values?: Record<string, unknown>): ActionRequest;
|
|
5
|
+
/** Where a `link` action goes: its `url` with `{id}` replaced, or its `route` with the item's id. */
|
|
6
|
+
export declare function getLinkTarget(target: ActionTarget): string | RouteReference | null;
|
|
7
|
+
/** Whether a run has finished, successfully or not. */
|
|
8
|
+
export declare function isFinished(status: string): boolean;
|
|
9
|
+
/** The counts of a result, from its summary or, without one, from its per-item results. */
|
|
10
|
+
export declare function getResultCounts(result: ActionResult): {
|
|
11
|
+
succeeded: number | null;
|
|
12
|
+
failed: number;
|
|
13
|
+
skipped: number;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,iGAAiG;AACjG,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,aAAa,CAQf;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,CAclF;AAID,uDAAuD;AACvD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,2FAA2F;AAC3F,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG;IACnD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB,CAUA"}
|
package/dist/request.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//#region src/request.ts
|
|
2
|
+
/** The request of an action: its selection (none for the resource), and its parameter values. */
|
|
3
|
+
function buildActionRequest(target, values = {}) {
|
|
4
|
+
if (target.scope === "item" && target.item !== void 0) return {
|
|
5
|
+
selection: { ids: [target.item.id] },
|
|
6
|
+
values
|
|
7
|
+
};
|
|
8
|
+
if (target.scope === "selection" && target.selection !== void 0) return {
|
|
9
|
+
selection: target.selection,
|
|
10
|
+
values
|
|
11
|
+
};
|
|
12
|
+
return { values };
|
|
13
|
+
}
|
|
14
|
+
/** Where a `link` action goes: its `url` with `{id}` replaced, or its `route` with the item's id. */
|
|
15
|
+
function getLinkTarget(target) {
|
|
16
|
+
const { action, item } = target;
|
|
17
|
+
if (action.url !== void 0) {
|
|
18
|
+
if (action.url.includes("{id}") && item === void 0) return null;
|
|
19
|
+
return item !== void 0 ? action.url.replaceAll("{id}", encodeURIComponent(item.id)) : action.url;
|
|
20
|
+
}
|
|
21
|
+
if (action.route !== void 0) return {
|
|
22
|
+
route: action.route,
|
|
23
|
+
params: item !== void 0 ? { id: item.id } : {}
|
|
24
|
+
};
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
var FINISHED = /* @__PURE__ */ new Set([
|
|
28
|
+
"succeeded",
|
|
29
|
+
"partial",
|
|
30
|
+
"failed",
|
|
31
|
+
"cancelled"
|
|
32
|
+
]);
|
|
33
|
+
/** Whether a run has finished, successfully or not. */
|
|
34
|
+
function isFinished(status) {
|
|
35
|
+
return FINISHED.has(status);
|
|
36
|
+
}
|
|
37
|
+
/** The counts of a result, from its summary or, without one, from its per-item results. */
|
|
38
|
+
function getResultCounts(result) {
|
|
39
|
+
if (result.summary !== void 0) return result.summary;
|
|
40
|
+
const results = result.results ?? [];
|
|
41
|
+
return {
|
|
42
|
+
succeeded: null,
|
|
43
|
+
failed: results.filter((entry) => entry.status === "failed").length,
|
|
44
|
+
skipped: results.filter((entry) => entry.status === "skipped").length
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { buildActionRequest, getLinkTarget, getResultCounts, isFinished };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","names":["ActionRequest","ActionResult","RouteReference","ActionTarget","buildActionRequest","target","values","Record","scope","item","undefined","selection","ids","id","getLinkTarget","action","url","includes","replaceAll","encodeURIComponent","route","params","FINISHED","Set","isFinished","status","has","getResultCounts","result","succeeded","failed","skipped","summary","results","filter","entry","length"],"sources":["../src/request.ts"],"sourcesContent":["import type { ActionRequest, ActionResult, RouteReference } from '@panneau/protocol';\n\nimport type { ActionTarget } from './types';\n\n/** The request of an action: its selection (none for the resource), and its parameter values. */\nexport function buildActionRequest(\n target: ActionTarget,\n values: Record<string, unknown> = {},\n): ActionRequest {\n if (target.scope === 'item' && target.item !== undefined) {\n return { selection: { ids: [target.item.id] }, values };\n }\n if (target.scope === 'selection' && target.selection !== undefined) {\n return { selection: target.selection, values };\n }\n return { values };\n}\n\n/** Where a `link` action goes: its `url` with `{id}` replaced, or its `route` with the item's id. */\nexport function getLinkTarget(target: ActionTarget): string | RouteReference | null {\n const { action, item } = target;\n if (action.url !== undefined) {\n if (action.url.includes('{id}') && item === undefined) {\n return null;\n }\n return item !== undefined\n ? action.url.replaceAll('{id}', encodeURIComponent(item.id))\n : action.url;\n }\n if (action.route !== undefined) {\n return { route: action.route, params: item !== undefined ? { id: item.id } : {} };\n }\n return null;\n}\n\nconst FINISHED = new Set(['succeeded', 'partial', 'failed', 'cancelled']);\n\n/** Whether a run has finished, successfully or not. */\nexport function isFinished(status: string): boolean {\n return FINISHED.has(status);\n}\n\n/** The counts of a result, from its summary or, without one, from its per-item results. */\nexport function getResultCounts(result: ActionResult): {\n succeeded: number | null;\n failed: number;\n skipped: number;\n} {\n if (result.summary !== undefined) {\n return result.summary;\n }\n const results = result.results ?? [];\n return {\n succeeded: null,\n failed: results.filter((entry) => entry.status === 'failed').length,\n skipped: results.filter((entry) => entry.status === 'skipped').length,\n };\n}\n"],"mappings":";;AAKA,SAAgBI,mBACZC,QACAC,SAAkC,CAAC,GACtB;CACb,IAAID,OAAOG,UAAU,UAAUH,OAAOI,SAASC,KAAAA,GAC3C,OAAO;EAAEC,WAAW,EAAEC,KAAK,CAACP,OAAOI,KAAKI,EAAE,EAAE;EAAGP;CAAO;CAE1D,IAAID,OAAOG,UAAU,eAAeH,OAAOM,cAAcD,KAAAA,GACrD,OAAO;EAAEC,WAAWN,OAAOM;EAAWL;CAAO;CAEjD,OAAO,EAAEA,OAAO;AACpB;;AAGA,SAAgBQ,cAAcT,QAAsD;CAChF,MAAM,EAAEU,QAAQN,SAASJ;CACzB,IAAIU,OAAOC,QAAQN,KAAAA,GAAW;EAC1B,IAAIK,OAAOC,IAAIC,SAAS,MAAM,KAAKR,SAASC,KAAAA,GACxC,OAAO;EAEX,OAAOD,SAASC,KAAAA,IACVK,OAAOC,IAAIE,WAAW,QAAQC,mBAAmBV,KAAKI,EAAE,CAAC,IACzDE,OAAOC;CACjB;CACA,IAAID,OAAOK,UAAUV,KAAAA,GACjB,OAAO;EAAEU,OAAOL,OAAOK;EAAOC,QAAQZ,SAASC,KAAAA,IAAY,EAAEG,IAAIJ,KAAKI,GAAG,IAAI,CAAC;CAAE;CAEpF,OAAO;AACX;AAEA,IAAMS,2BAAW,IAAIC,IAAI;CAAC;CAAa;CAAW;CAAU;AAAW,CAAC;;AAGxE,SAAgBC,WAAWC,QAAyB;CAChD,OAAOH,SAASI,IAAID,MAAM;AAC9B;;AAGA,SAAgBE,gBAAgBC,QAI9B;CACE,IAAIA,OAAOI,YAAYtB,KAAAA,GACnB,OAAOkB,OAAOI;CAElB,MAAMC,UAAUL,OAAOK,WAAW,CAAA;CAClC,OAAO;EACHJ,WAAW;EACXC,QAAQG,QAAQC,QAAQC,UAAUA,MAAMV,WAAW,QAAQ,CAAC,CAACW;EAC7DL,SAASE,QAAQC,QAAQC,UAAUA,MAAMV,WAAW,SAAS,CAAC,CAACW;CACnE;AACJ"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { DataAdapter } from '@panneau/data';
|
|
3
|
+
import type { Action, ActionResult, ActionRun, ActionScope, RouteReference, Selection } from '@panneau/protocol';
|
|
4
|
+
/**
|
|
5
|
+
* What the runner needs from a backend: the action methods of a `DataAdapter`. A product with its
|
|
6
|
+
* own API implements these, and nothing else. Without `cancelActionRun()`, runs can't be cancelled.
|
|
7
|
+
*/
|
|
8
|
+
export type ActionAdapter = Pick<DataAdapter, 'runAction' | 'getActionRun'> & Partial<Pick<DataAdapter, 'cancelActionRun'>>;
|
|
9
|
+
/**
|
|
10
|
+
* An action to run, and what it applies to. A list's `ListActionEvent` is one, and so is
|
|
11
|
+
* `{ action, scope: 'item', item }` for the item of a form.
|
|
12
|
+
*/
|
|
13
|
+
export interface ActionTarget {
|
|
14
|
+
action: Action;
|
|
15
|
+
scope: ActionScope;
|
|
16
|
+
/** The item of an `item` action. */
|
|
17
|
+
item?: {
|
|
18
|
+
id: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
/** The selection of a `selection` action: ids, or every item matching a query. */
|
|
22
|
+
selection?: Selection;
|
|
23
|
+
/** How many items the action applies to. */
|
|
24
|
+
count?: number;
|
|
25
|
+
}
|
|
26
|
+
/** What running an action gave. A run that the user cancelled gives `false` instead. */
|
|
27
|
+
export type ActionOutcome = {
|
|
28
|
+
status: 'done';
|
|
29
|
+
result: ActionResult;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'queued';
|
|
32
|
+
run: ActionRun;
|
|
33
|
+
} | {
|
|
34
|
+
status: 'navigated';
|
|
35
|
+
to: string | RouteReference;
|
|
36
|
+
};
|
|
37
|
+
/** The download of an action result. */
|
|
38
|
+
export type ActionDownload = NonNullable<ActionResult['download']>;
|
|
39
|
+
/** Where a result was given: the resource and the action's target. */
|
|
40
|
+
export interface ActionResultContext {
|
|
41
|
+
resource: string;
|
|
42
|
+
target: ActionTarget;
|
|
43
|
+
}
|
|
44
|
+
/** A queued run that the runner follows, until it is dismissed. */
|
|
45
|
+
export interface FollowedRun {
|
|
46
|
+
run: ActionRun;
|
|
47
|
+
resource: string;
|
|
48
|
+
target: ActionTarget;
|
|
49
|
+
}
|
|
50
|
+
/** Props of the handler of a `client` action, which a plugin registers by the action's `component`. */
|
|
51
|
+
export interface ClientActionProps {
|
|
52
|
+
action: Action;
|
|
53
|
+
resource: string;
|
|
54
|
+
target: ActionTarget;
|
|
55
|
+
/** Ends the action. With a result, the runner shows it as it shows the result of a server action. */
|
|
56
|
+
onDone: (result?: ActionResult) => void;
|
|
57
|
+
/** Ends the action without running it: a list keeps its selection. */
|
|
58
|
+
onCancel: () => void;
|
|
59
|
+
}
|
|
60
|
+
/** A handler of `client` actions. */
|
|
61
|
+
export type ClientActionHandler = ComponentType<ClientActionProps>;
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACR,MAAM,EACN,YAAY,EACZ,SAAS,EACT,WAAW,EACX,cAAc,EACd,SAAS,EACZ,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,cAAc,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC9C,kFAAkF;IAClF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wFAAwF;AACxF,MAAM,MAAM,aAAa,GACnB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACxC;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GACpC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAC;AAE3D,wCAAwC;AACxC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;AAEnE,sEAAsE;AACtE,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACxB;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IACxB,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACxB;AAED,uGAAuG;AACvG,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;IACrB,qGAAqG;IACrG,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,qCAAqC;AACrC,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ActionPreview } from './preview.js';
|
|
2
|
+
import type { ActionOutcome, ActionTarget, FollowedRun } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Runs the actions of a resource through the closest `ActionRunnerProvider`. The function takes a
|
|
5
|
+
* list's `ListActionEvent`, so it is the `onAction` of a list:
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const runAction = useActionRunner('pages');
|
|
9
|
+
* <ListView list={list} items={items} actions={actions} onAction={runAction} />
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* It resolves once the action has run, has been queued or has navigated, with `false` when the
|
|
13
|
+
* user cancelled its parameters (a list then keeps its selection), and rejects when it failed.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useActionRunner(resource: string): (target: ActionTarget) => Promise<ActionOutcome | false>;
|
|
16
|
+
/**
|
|
17
|
+
* Asks the backend how many items of a query selection an action would skip, before the list
|
|
18
|
+
* confirms it (a dry run, for actions with `dryRun`). It is the `previewAction` of a list:
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <ListView onAction={useActionRunner('pages')} previewAction={useActionPreview('pages')} … />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useActionPreview(resource: string): (target: ActionTarget) => Promise<ActionPreview | null>;
|
|
25
|
+
/** The queued runs of the closest `ActionRunnerProvider`, to cancel or dismiss them. */
|
|
26
|
+
export declare function useActionRuns(): {
|
|
27
|
+
runs: readonly FollowedRun[];
|
|
28
|
+
cancel: (id: string) => Promise<void>;
|
|
29
|
+
dismiss: (id: string) => void;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=useActionRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActionRunner.d.ts","sourceRoot":"","sources":["../src/useActionRunner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,WAAW,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,MAAM,GACjB,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC,CAM1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC5B,QAAQ,EAAE,MAAM,GACjB,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAMzD;AAED,wFAAwF;AACxF,wBAAgB,aAAa,IAAI;IAC7B,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IAC7B,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAMA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ActionRunnerContext } from "./context.js";
|
|
2
|
+
import { previewAction } from "./preview.js";
|
|
3
|
+
import { use } from "react";
|
|
4
|
+
//#region src/useActionRunner.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runs the actions of a resource through the closest `ActionRunnerProvider`. The function takes a
|
|
7
|
+
* list's `ListActionEvent`, so it is the `onAction` of a list:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const runAction = useActionRunner('pages');
|
|
11
|
+
* <ListView list={list} items={items} actions={actions} onAction={runAction} />
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* It resolves once the action has run, has been queued or has navigated, with `false` when the
|
|
15
|
+
* user cancelled its parameters (a list then keeps its selection), and rejects when it failed.
|
|
16
|
+
*/
|
|
17
|
+
function useActionRunner(resource) {
|
|
18
|
+
const context = use(ActionRunnerContext);
|
|
19
|
+
if (context === null) throw new Error("useActionRunner() must be used inside <ActionRunnerProvider>.");
|
|
20
|
+
return (target) => context.run(resource, target);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Asks the backend how many items of a query selection an action would skip, before the list
|
|
24
|
+
* confirms it (a dry run, for actions with `dryRun`). It is the `previewAction` of a list:
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <ListView onAction={useActionRunner('pages')} previewAction={useActionPreview('pages')} … />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function useActionPreview(resource) {
|
|
31
|
+
const context = use(ActionRunnerContext);
|
|
32
|
+
if (context === null) throw new Error("useActionPreview() must be used inside <ActionRunnerProvider>.");
|
|
33
|
+
return (target) => previewAction(context.adapter, resource, target);
|
|
34
|
+
}
|
|
35
|
+
/** The queued runs of the closest `ActionRunnerProvider`, to cancel or dismiss them. */
|
|
36
|
+
function useActionRuns() {
|
|
37
|
+
const context = use(ActionRunnerContext);
|
|
38
|
+
if (context === null) throw new Error("useActionRuns() must be used inside <ActionRunnerProvider>.");
|
|
39
|
+
return {
|
|
40
|
+
runs: context.runs,
|
|
41
|
+
cancel: context.cancelRun,
|
|
42
|
+
dismiss: context.dismissRun
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { useActionPreview, useActionRunner, useActionRuns };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=useActionRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActionRunner.js","names":["use","ActionRunnerContext","ActionPreview","previewAction","ActionOutcome","ActionTarget","FollowedRun","useActionRunner","resource","target","Promise","context","Error","run","useActionPreview","adapter","useActionRuns","runs","cancel","id","dismiss","cancelRun","dismissRun"],"sources":["../src/useActionRunner.ts"],"sourcesContent":["import { use } from 'react';\n\nimport { ActionRunnerContext } from './context';\nimport { type ActionPreview, previewAction } from './preview';\nimport type { ActionOutcome, ActionTarget, FollowedRun } from './types';\n\n/**\n * Runs the actions of a resource through the closest `ActionRunnerProvider`. The function takes a\n * list's `ListActionEvent`, so it is the `onAction` of a list:\n *\n * ```tsx\n * const runAction = useActionRunner('pages');\n * <ListView list={list} items={items} actions={actions} onAction={runAction} />\n * ```\n *\n * It resolves once the action has run, has been queued or has navigated, with `false` when the\n * user cancelled its parameters (a list then keeps its selection), and rejects when it failed.\n */\nexport function useActionRunner(\n resource: string,\n): (target: ActionTarget) => Promise<ActionOutcome | false> {\n const context = use(ActionRunnerContext);\n if (context === null) {\n throw new Error('useActionRunner() must be used inside <ActionRunnerProvider>.');\n }\n return (target) => context.run(resource, target);\n}\n\n/**\n * Asks the backend how many items of a query selection an action would skip, before the list\n * confirms it (a dry run, for actions with `dryRun`). It is the `previewAction` of a list:\n *\n * ```tsx\n * <ListView onAction={useActionRunner('pages')} previewAction={useActionPreview('pages')} … />\n * ```\n */\nexport function useActionPreview(\n resource: string,\n): (target: ActionTarget) => Promise<ActionPreview | null> {\n const context = use(ActionRunnerContext);\n if (context === null) {\n throw new Error('useActionPreview() must be used inside <ActionRunnerProvider>.');\n }\n return (target) => previewAction(context.adapter, resource, target);\n}\n\n/** The queued runs of the closest `ActionRunnerProvider`, to cancel or dismiss them. */\nexport function useActionRuns(): {\n runs: readonly FollowedRun[];\n cancel: (id: string) => Promise<void>;\n dismiss: (id: string) => void;\n} {\n const context = use(ActionRunnerContext);\n if (context === null) {\n throw new Error('useActionRuns() must be used inside <ActionRunnerProvider>.');\n }\n return { runs: context.runs, cancel: context.cancelRun, dismiss: context.dismissRun };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAAgBO,gBACZC,UACwD;CACxD,MAAMG,UAAUX,IAAIC,mBAAmB;CACvC,IAAIU,YAAY,MACZ,MAAM,IAAIC,MAAM,+DAA+D;CAEnF,QAAQH,WAAWE,QAAQE,IAAIL,UAAUC,MAAM;AACnD;;;;;;;;;AAUA,SAAgBK,iBACZN,UACuD;CACvD,MAAMG,UAAUX,IAAIC,mBAAmB;CACvC,IAAIU,YAAY,MACZ,MAAM,IAAIC,MAAM,gEAAgE;CAEpF,QAAQH,WAAWN,cAAcQ,QAAQI,SAASP,UAAUC,MAAM;AACtE;;AAGA,SAAgBO,gBAId;CACE,MAAML,UAAUX,IAAIC,mBAAmB;CACvC,IAAIU,YAAY,MACZ,MAAM,IAAIC,MAAM,6DAA6D;CAEjF,OAAO;EAAEK,MAAMN,QAAQM;EAAMC,QAAQP,QAAQU;EAAWD,SAAST,QAAQW;CAAW;AACxF"}
|
package/package.json
CHANGED
|
@@ -1,72 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/actions",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
],
|
|
8
|
-
"homepage": "https://github.com/folkloreinc/panneau-js",
|
|
3
|
+
"version": "5.0.0-alpha.10",
|
|
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
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
9
7
|
"repository": {
|
|
10
8
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/folkloreinc/panneau-js.git"
|
|
12
|
-
|
|
13
|
-
"license": "ISC",
|
|
14
|
-
"author": {
|
|
15
|
-
"name": "Folklore",
|
|
16
|
-
"email": "info@folklore.email"
|
|
9
|
+
"url": "git+https://github.com/folkloreinc/panneau-js.git",
|
|
10
|
+
"directory": "packages/actions"
|
|
17
11
|
},
|
|
18
|
-
"contributors": [
|
|
19
|
-
{
|
|
20
|
-
"name": "David Mongeau-Petitpas",
|
|
21
|
-
"email": "dmp@folklore.email"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "Nicolas Roy-Bourdages",
|
|
25
|
-
"email": "nrb@folklore.email"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
12
|
"sideEffects": [
|
|
29
|
-
"
|
|
13
|
+
"*.css"
|
|
30
14
|
],
|
|
31
|
-
"type": "module",
|
|
32
15
|
"exports": {
|
|
33
16
|
".": {
|
|
17
|
+
"@panneau/source": "./src/index.ts",
|
|
34
18
|
"types": "./dist/index.d.ts",
|
|
35
19
|
"default": "./dist/index.js"
|
|
36
|
-
}
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
37
22
|
},
|
|
38
|
-
"module": "dist/index.js",
|
|
39
|
-
"types": "dist/index.d.ts",
|
|
40
23
|
"files": [
|
|
41
|
-
"dist"
|
|
42
|
-
"assets"
|
|
24
|
+
"dist"
|
|
43
25
|
],
|
|
44
26
|
"scripts": {
|
|
45
|
-
"build": "../../scripts/
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
},
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"@babel/runtime": "^7.28.6",
|
|
51
|
-
"@panneau/action-delete": "^4.1.1",
|
|
52
|
-
"@panneau/action-duplicate": "^4.1.1",
|
|
53
|
-
"@panneau/action-edit": "^4.1.1",
|
|
54
|
-
"@panneau/action-import": "^4.1.1",
|
|
55
|
-
"@panneau/action-restore": "^4.1.1",
|
|
56
|
-
"@panneau/action-show": "^4.1.1",
|
|
57
|
-
"@panneau/action-upload": "^4.1.1",
|
|
58
|
-
"@panneau/core": "^4.1.1"
|
|
27
|
+
"build": "vite build && node ../../scripts/declarations.js",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"api": "node ../../scripts/declarations.js && node ../../scripts/api-report.js"
|
|
59
30
|
},
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"react-dom": "^19.0.0"
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
63
33
|
},
|
|
64
34
|
"peerDependencies": {
|
|
65
35
|
"react": "^19.2.0",
|
|
66
|
-
"react-
|
|
36
|
+
"react-aria-components": "^1.22.0",
|
|
37
|
+
"react-intl": "^12.0.0"
|
|
67
38
|
},
|
|
68
|
-
"
|
|
69
|
-
"
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@panneau/core": "5.0.0-alpha.10",
|
|
41
|
+
"@panneau/data": "5.0.0-alpha.10",
|
|
42
|
+
"@panneau/forms": "5.0.0-alpha.10",
|
|
43
|
+
"@panneau/intl": "5.0.0-alpha.10",
|
|
44
|
+
"@panneau/protocol": "5.0.0-alpha.10",
|
|
45
|
+
"@panneau/ui": "5.0.0-alpha.10",
|
|
46
|
+
"lucide-react": "^1.57.0"
|
|
70
47
|
},
|
|
71
|
-
"
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@panneau/lists": "5.0.0-alpha.10"
|
|
50
|
+
}
|
|
72
51
|
}
|