@verikit/vue 0.24.1 → 0.24.3
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 +10 -0
- package/dist/client/use-verikit-client.d.ts +16 -15
- package/dist/client/use-verikit-client.d.ts.map +1 -1
- package/dist/client/use-verikit-client.js +34 -18
- package/dist/form/use-verikit-schema-tree-form.d.ts +3 -1
- package/dist/form/use-verikit-schema-tree-form.d.ts.map +1 -1
- package/dist/form/use-verikit-schema-tree-form.js +8 -1
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.d.ts.map +1 -1
- package/dist/query/index.js +1 -1
- package/dist/query/use-resource-form.d.ts +3 -3
- package/dist/query/use-resource-form.d.ts.map +1 -1
- package/dist/query/use-resource-mutations.d.ts +4 -4
- package/dist/query/use-resource-mutations.d.ts.map +1 -1
- package/dist/query/use-resource-mutations.js +5 -4
- package/dist/query/use-resource-queries.d.ts +13 -7
- package/dist/query/use-resource-queries.d.ts.map +1 -1
- package/dist/query/use-resource-queries.js +16 -3
- package/dist/query/use-resource-schema-tree-form.d.ts +3 -3
- package/dist/query/use-resource-schema-tree-form.d.ts.map +1 -1
- package/dist/query/use-resource-table.d.ts +9 -3
- package/dist/query/use-resource-table.d.ts.map +1 -1
- package/dist/query/use-resource-table.js +4 -2
- package/dist/resource/declared-action-button.d.ts +14 -0
- package/dist/resource/declared-action-button.d.ts.map +1 -0
- package/dist/resource/declared-action-button.js +24 -0
- package/dist/resource/index.d.ts +4 -0
- package/dist/resource/index.d.ts.map +1 -1
- package/dist/resource/index.js +2 -0
- package/dist/resource/resource-action-dialog.d.ts +103 -0
- package/dist/resource/resource-action-dialog.d.ts.map +1 -0
- package/dist/resource/resource-action-dialog.js +207 -0
- package/dist/resource/resource-detail.d.ts +98 -0
- package/dist/resource/resource-detail.d.ts.map +1 -0
- package/dist/resource/resource-detail.js +258 -0
- package/dist/resource/resource-form.d.ts +1 -1
- package/dist/resource/resource-form.d.ts.map +1 -1
- package/dist/resource/resource-table.d.ts +13 -0
- package/dist/resource/resource-table.d.ts.map +1 -1
- package/dist/resource/resource-table.js +108 -35
- package/package.json +6 -6
|
@@ -5,7 +5,7 @@ import type { VerikitFieldRegistry } from "../fields/types.js";
|
|
|
5
5
|
import { type UseResourceSchemaTreeFormOptions } from "../query/use-resource-schema-tree-form.js";
|
|
6
6
|
import type { VerikitSchemaTreeSource } from "../form/use-verikit-schema-tree-form.js";
|
|
7
7
|
/** Props for {@link ResourceForm}. */
|
|
8
|
-
export interface ResourceFormProps<TRecord = Record<string, unknown>> extends UseResourceSchemaTreeFormOptions<TRecord> {
|
|
8
|
+
export interface ResourceFormProps<TRecord extends object = Record<string, unknown>> extends UseResourceSchemaTreeFormOptions<TRecord> {
|
|
9
9
|
/** The resource (or its schema) whose tree drives the form and submission. */
|
|
10
10
|
resource: VerikitSchemaTreeSource;
|
|
11
11
|
/** Optional renderer overrides keyed by field type. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-form.d.ts","sourceRoot":"","sources":["../../src/resource/resource-form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAGzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAEvF,sCAAsC;AACtC,MAAM,WAAW,iBAAiB,CAChC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"resource-form.d.ts","sourceRoot":"","sources":["../../src/resource/resource-form.ts"],"names":[],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AO,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;;;;cAIjD,QAAQ,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;;;;;;;;cAKnD,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;cA9B5B,QAAQ,CAAC,uBAAuB,CAAC;;;;cAG7B,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;cAEhC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;;;;cAItC,QAAQ,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;;;;cAI1C,QAAQ,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;;;;cAIxC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;;;;cAIxC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAC;;;;cAIjD,QAAQ,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;;;;;;;;cAKnD,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;;;gCA7CpB,gBAAgB,QAAQ,UAAU,KAAK,UAAU;;;4EAoG7E,CAAC"}
|
|
@@ -10,6 +10,10 @@ export interface ResourceTableProps<TRecord extends RowData = Record<string, unk
|
|
|
10
10
|
* Edit/Delete row actions.
|
|
11
11
|
*/
|
|
12
12
|
actions?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Renders the actions declared on the resource via `defineResource({ actions })`: record-scoped ones per row, collection-scoped ones in the toolbar. Labels, confirmations, and input forms come from each declaration; actions with neither a confirmation nor a form run on click. The table asks the server which of them the actor can't run on each page: those it may not run are hidden, and those that can't run right now are disabled, with the reason as a tooltip. An action denied when run (403, or 404 for a record action, which the server returns so as not to reveal whether the record exists) is hidden for the rest of this component's lifetime. Defaults to `actions`.
|
|
15
|
+
*/
|
|
16
|
+
resourceActions?: boolean;
|
|
13
17
|
/** Renders per-row actions (e.g. custom edit/delete buttons). */
|
|
14
18
|
renderActions?: (record: TRecord) => VNodeChild;
|
|
15
19
|
/** Renders custom actions for the current row selection. */
|
|
@@ -36,6 +40,10 @@ export declare const ResourceTable: import("vue").DefineComponent<import("vue").
|
|
|
36
40
|
type: BooleanConstructor;
|
|
37
41
|
default: boolean;
|
|
38
42
|
};
|
|
43
|
+
resourceActions: {
|
|
44
|
+
type: PropType<boolean | undefined>;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
39
47
|
renderActions: {
|
|
40
48
|
type: PropType<ResourceTableProps["renderActions"]>;
|
|
41
49
|
default: undefined;
|
|
@@ -67,6 +75,10 @@ export declare const ResourceTable: import("vue").DefineComponent<import("vue").
|
|
|
67
75
|
type: BooleanConstructor;
|
|
68
76
|
default: boolean;
|
|
69
77
|
};
|
|
78
|
+
resourceActions: {
|
|
79
|
+
type: PropType<boolean | undefined>;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
70
82
|
renderActions: {
|
|
71
83
|
type: PropType<ResourceTableProps["renderActions"]>;
|
|
72
84
|
default: undefined;
|
|
@@ -88,6 +100,7 @@ export declare const ResourceTable: import("vue").DefineComponent<import("vue").
|
|
|
88
100
|
actions: boolean;
|
|
89
101
|
pageSize: number | undefined;
|
|
90
102
|
renderActions: ((record: Record<string, unknown>) => VNodeChild) | undefined;
|
|
103
|
+
resourceActions: boolean | undefined;
|
|
91
104
|
renderBulkActions: ((records: Record<string, unknown>[], clearSelection: () => void) => VNodeChild) | undefined;
|
|
92
105
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
93
106
|
//# sourceMappingURL=resource-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-table.d.ts","sourceRoot":"","sources":["../../src/resource/resource-table.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAY9E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAq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I7B,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;cAzB5B,QAAQ,CAAC,sBAAsB,CAAC;;;;cAIhC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;cAK3B,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC;;;;cAI5B,QAAQ,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;;;;cAI7C,QAAQ,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;;;;cAI1C,QAAQ,CAAC,UAAU,CAAC;;;;cAI7B,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;yDAhEX,UAAU;;6EAI7B,MAAM,IAAI,KACvB,UAAU;4EA+7Bf,CAAC"}
|
|
@@ -5,37 +5,19 @@ import { Checkbox } from "#components/checkbox";
|
|
|
5
5
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "#components/dialog";
|
|
6
6
|
import { Input } from "#components/input";
|
|
7
7
|
import { cn } from "#lib/utils";
|
|
8
|
+
import { actionNeedsDialog, resourceActionSchemas, unavailableAction, } from "@verikit/ui-core/actions/resource-actions";
|
|
9
|
+
import { formatFieldValue } from "@verikit/ui-core/layout/format-value";
|
|
8
10
|
import { recordId } from "@verikit/ui-core/query/optimistic";
|
|
9
11
|
import { useDeleteResource } from "../query/use-resource-mutations.js";
|
|
10
12
|
import { useResourceTable, } from "../query/use-resource-table.js";
|
|
13
|
+
import { isActionDenied, isPermissionDenied, ResourceActionDialog, useRunResourceAction, } from "./resource-action-dialog.js";
|
|
14
|
+
import { declaredActionButton } from "./declared-action-button.js";
|
|
11
15
|
import { ResourceForm } from "./resource-form.js";
|
|
12
16
|
import { filterableFields, ResourceTableFilterPanel, } from "./resource-table-filters.js";
|
|
13
|
-
/**
|
|
14
|
-
* True for an error whose `status` is 403 (permission denied). Duck-typed on
|
|
15
|
-
* `status`, not `instanceof VerikitClientError`.
|
|
16
|
-
*/
|
|
17
|
-
function isPermissionDenied(error) {
|
|
18
|
-
return (typeof error === "object" &&
|
|
19
|
-
error !== null &&
|
|
20
|
-
"status" in error &&
|
|
21
|
-
error.status === 403);
|
|
22
|
-
}
|
|
23
17
|
// `header` is always the field's required string label.
|
|
24
18
|
function headerText(header) {
|
|
25
19
|
return header.column.columnDef.header;
|
|
26
20
|
}
|
|
27
|
-
function cellText(value) {
|
|
28
|
-
if (value === null || value === undefined) {
|
|
29
|
-
return "";
|
|
30
|
-
}
|
|
31
|
-
if (value instanceof Date) {
|
|
32
|
-
return value.toLocaleString();
|
|
33
|
-
}
|
|
34
|
-
if (typeof value === "boolean") {
|
|
35
|
-
return value ? "Yes" : "No";
|
|
36
|
-
}
|
|
37
|
-
return String(value);
|
|
38
|
-
}
|
|
39
21
|
function sortIcon(direction) {
|
|
40
22
|
if (direction === "asc") {
|
|
41
23
|
return h(ArrowUpIcon, { class: "size-3.5" });
|
|
@@ -61,6 +43,10 @@ export const ResourceTable = defineComponent({
|
|
|
61
43
|
default: undefined,
|
|
62
44
|
},
|
|
63
45
|
actions: { type: Boolean, default: false },
|
|
46
|
+
resourceActions: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: undefined,
|
|
49
|
+
},
|
|
64
50
|
renderActions: {
|
|
65
51
|
type: Function,
|
|
66
52
|
default: undefined,
|
|
@@ -79,7 +65,17 @@ export const ResourceTable = defineComponent({
|
|
|
79
65
|
},
|
|
80
66
|
},
|
|
81
67
|
setup(props) {
|
|
82
|
-
const
|
|
68
|
+
const showResourceActions = props.resourceActions ?? props.actions;
|
|
69
|
+
const recordActions = showResourceActions
|
|
70
|
+
? resourceActionSchemas(props.resource, "record")
|
|
71
|
+
: [];
|
|
72
|
+
const collectionActions = showResourceActions
|
|
73
|
+
? resourceActionSchemas(props.resource, "collection")
|
|
74
|
+
: [];
|
|
75
|
+
const { table, isLoading, error, fields, filters, setFilters, actions: actionAvailability, } = useResourceTable(props.resource, {
|
|
76
|
+
pageSize: props.pageSize,
|
|
77
|
+
includeActions: recordActions.length > 0 || collectionActions.length > 0,
|
|
78
|
+
});
|
|
83
79
|
const createOpen = ref(false);
|
|
84
80
|
const createDenied = ref(false);
|
|
85
81
|
const editRecord = ref(null);
|
|
@@ -89,6 +85,61 @@ export const ResourceTable = defineComponent({
|
|
|
89
85
|
const bulkDeleteOpen = ref(false);
|
|
90
86
|
const bulkDeleteError = ref(null);
|
|
91
87
|
const bulkDeleting = ref(false);
|
|
88
|
+
const activeAction = ref(null);
|
|
89
|
+
const deniedCollectionActions = ref({});
|
|
90
|
+
const actionError = ref(null);
|
|
91
|
+
function denyAction(action, id) {
|
|
92
|
+
if (id === undefined) {
|
|
93
|
+
deniedCollectionActions.value = {
|
|
94
|
+
...deniedCollectionActions.value,
|
|
95
|
+
[action.name]: true,
|
|
96
|
+
};
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
deniedRows.value = {
|
|
100
|
+
...deniedRows.value,
|
|
101
|
+
[id]: {
|
|
102
|
+
...deniedRows.value[id],
|
|
103
|
+
actions: { ...deniedRows.value[id]?.actions, [action.name]: true },
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const directAction = useRunResourceAction(props.resource.name, {
|
|
108
|
+
onSuccess: () => {
|
|
109
|
+
actionError.value = null;
|
|
110
|
+
},
|
|
111
|
+
onError: (mutationError, variables) => {
|
|
112
|
+
if (isActionDenied(mutationError, variables.recordId)) {
|
|
113
|
+
denyAction(variables.action, variables.recordId);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
actionError.value = mutationError.message;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
function startAction(action, id) {
|
|
121
|
+
actionError.value = null;
|
|
122
|
+
if (actionNeedsDialog(action)) {
|
|
123
|
+
activeAction.value = { action, recordId: id };
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
directAction.mutate({ action, recordId: id });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function tableActionButton(action, variant, id) {
|
|
130
|
+
return declaredActionButton({
|
|
131
|
+
action,
|
|
132
|
+
unavailable: unavailableAction(actionAvailability.value, action.name, id),
|
|
133
|
+
variant,
|
|
134
|
+
disabled: directAction.isPending.value,
|
|
135
|
+
onClick: () => startAction(action, id),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function declaredRowActions(record) {
|
|
139
|
+
const id = recordId(record);
|
|
140
|
+
const denied = deniedRows.value[id]?.actions;
|
|
141
|
+
return recordActions.map((action) => denied?.[action.name] ? null : tableActionButton(action, "ghost", id));
|
|
142
|
+
}
|
|
92
143
|
const deleteMutation = useDeleteResource(props.resource.name, {
|
|
93
144
|
onError: (mutationError, id) => {
|
|
94
145
|
if (isPermissionDenied(mutationError)) {
|
|
@@ -175,6 +226,7 @@ export const ResourceTable = defineComponent({
|
|
|
175
226
|
}
|
|
176
227
|
function rowActions(record) {
|
|
177
228
|
return h("div", { class: "flex items-center justify-end gap-1" }, [
|
|
229
|
+
declaredRowActions(record),
|
|
178
230
|
props.actions ? builtInRowActions(record) : null,
|
|
179
231
|
props.renderActions ? props.renderActions(record) : null,
|
|
180
232
|
]);
|
|
@@ -187,7 +239,9 @@ export const ResourceTable = defineComponent({
|
|
|
187
239
|
const deleteId = deleteRecord.value
|
|
188
240
|
? recordId(deleteRecord.value)
|
|
189
241
|
: undefined;
|
|
190
|
-
const hasActionsColumn = props.actions ||
|
|
242
|
+
const hasActionsColumn = props.actions ||
|
|
243
|
+
Boolean(props.renderActions) ||
|
|
244
|
+
recordActions.length > 0;
|
|
191
245
|
const hasSelectionColumn = props.actions || Boolean(props.renderBulkActions);
|
|
192
246
|
const hasFilterableFields = filterableFields(fields).length > 0;
|
|
193
247
|
const activeFilterCount = Object.keys(filters.value).length;
|
|
@@ -235,16 +289,24 @@ export const ResourceTable = defineComponent({
|
|
|
235
289
|
}, { default: () => "Clear filters" })
|
|
236
290
|
: null,
|
|
237
291
|
]),
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
292
|
+
h("div", { class: "flex items-center gap-2" }, [
|
|
293
|
+
...collectionActions.map((action) => deniedCollectionActions.value[action.name]
|
|
294
|
+
? null
|
|
295
|
+
: tableActionButton(action, "outline")),
|
|
296
|
+
props.actions && !createDenied.value
|
|
297
|
+
? h(Button, {
|
|
298
|
+
type: "button",
|
|
299
|
+
size: "sm",
|
|
300
|
+
onClick: () => {
|
|
301
|
+
createOpen.value = true;
|
|
302
|
+
},
|
|
303
|
+
}, { default: () => [h(PlusIcon), "New"] })
|
|
304
|
+
: null,
|
|
305
|
+
]),
|
|
247
306
|
]),
|
|
307
|
+
actionError.value
|
|
308
|
+
? h("p", { role: "alert", class: "pb-3 text-sm text-destructive" }, actionError.value)
|
|
309
|
+
: null,
|
|
248
310
|
filtersOpen.value && hasFilterableFields
|
|
249
311
|
? h("div", { class: "pb-3" }, [
|
|
250
312
|
h(ResourceTableFilterPanel, {
|
|
@@ -342,7 +404,7 @@ export const ResourceTable = defineComponent({
|
|
|
342
404
|
: null,
|
|
343
405
|
...row
|
|
344
406
|
.getAllCells()
|
|
345
|
-
.map((cell) => h("td", { key: cell.id, class: "px-3 py-2" },
|
|
407
|
+
.map((cell) => h("td", { key: cell.id, class: "px-3 py-2" }, formatFieldValue(cell.getValue()))),
|
|
346
408
|
hasActionsColumn
|
|
347
409
|
? h("td", { class: "px-3 py-2 text-right" }, [
|
|
348
410
|
rowActions(row.original),
|
|
@@ -375,7 +437,7 @@ export const ResourceTable = defineComponent({
|
|
|
375
437
|
class: "flex items-center justify-between gap-2 py-1 text-sm",
|
|
376
438
|
}, [
|
|
377
439
|
h("span", { class: "text-muted-foreground" }, headerText({ column: cell.column })),
|
|
378
|
-
h("span", { class: "text-right" },
|
|
440
|
+
h("span", { class: "text-right" }, formatFieldValue(cell.getValue())),
|
|
379
441
|
])),
|
|
380
442
|
hasActionsColumn
|
|
381
443
|
? h("div", { class: "flex justify-end gap-2 pt-2" }, [
|
|
@@ -407,6 +469,17 @@ export const ResourceTable = defineComponent({
|
|
|
407
469
|
}, { default: () => h(ChevronRightIcon) }),
|
|
408
470
|
]),
|
|
409
471
|
]),
|
|
472
|
+
recordActions.length > 0 || collectionActions.length > 0
|
|
473
|
+
? h(ResourceActionDialog, {
|
|
474
|
+
resourceName: props.resource.name,
|
|
475
|
+
action: activeAction.value?.action ?? null,
|
|
476
|
+
recordId: activeAction.value?.recordId,
|
|
477
|
+
onClose: () => {
|
|
478
|
+
activeAction.value = null;
|
|
479
|
+
},
|
|
480
|
+
onDenied: (action) => denyAction(action, activeAction.value?.recordId),
|
|
481
|
+
})
|
|
482
|
+
: null,
|
|
410
483
|
props.actions
|
|
411
484
|
? h(Dialog, {
|
|
412
485
|
open: createOpen.value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verikit/vue",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.3",
|
|
4
4
|
"description": "Vue UI bindings for Verikit resource workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"lucide-vue-next": "^1.0.0",
|
|
62
62
|
"reka-ui": "^2.10.3",
|
|
63
63
|
"tailwind-merge": "^3.6.0",
|
|
64
|
-
"@verikit/
|
|
65
|
-
"@verikit/
|
|
66
|
-
"@verikit/theme": "0.24.
|
|
67
|
-
"@verikit/
|
|
68
|
-
"@verikit/
|
|
64
|
+
"@verikit/core": "0.24.3",
|
|
65
|
+
"@verikit/runtime": "0.24.3",
|
|
66
|
+
"@verikit/theme": "0.24.3",
|
|
67
|
+
"@verikit/ui-core": "0.24.3",
|
|
68
|
+
"@verikit/client": "0.24.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/jsdom": "^28.0.3",
|