mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
refactor(bulk_action): add basic type safety for client
This commit is contained in:
@@ -5,3 +5,4 @@ export * from "./lib/hidden_subtree.js";
|
||||
export * from "./lib/rows.js";
|
||||
export * from "./lib/test-utils.js";
|
||||
export * from "./lib/mime_type.js";
|
||||
export * from "./lib/bulk_actions.js";
|
||||
|
||||
47
packages/commons/src/lib/bulk_actions.ts
Normal file
47
packages/commons/src/lib/bulk_actions.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
export type ActionHandlers = {
|
||||
addLabel: {
|
||||
labelName: string;
|
||||
labelValue?: string;
|
||||
},
|
||||
addRelation: {
|
||||
relationName: string;
|
||||
targetNoteId: string;
|
||||
},
|
||||
deleteNote: {},
|
||||
deleteRevisions: {},
|
||||
deleteLabel: {
|
||||
labelName: string;
|
||||
},
|
||||
deleteRelation: {
|
||||
relationName: string;
|
||||
},
|
||||
renameNote: {
|
||||
newTitle: string;
|
||||
},
|
||||
renameLabel: {
|
||||
oldLabelName: string;
|
||||
newLabelName: string;
|
||||
},
|
||||
renameRelation: {
|
||||
oldRelationName: string;
|
||||
newRelationName: string;
|
||||
},
|
||||
updateLabelValue: {
|
||||
labelName: string;
|
||||
labelValue: string;
|
||||
},
|
||||
updateRelationTarget: {
|
||||
relationName: string;
|
||||
targetNoteId: string;
|
||||
},
|
||||
moveNote: {
|
||||
targetParentNoteId: string;
|
||||
},
|
||||
executeScript: {
|
||||
script: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type BulkActionData<T extends keyof ActionHandlers> = ActionHandlers[T] & { name: T };
|
||||
|
||||
export type BulkAction = BulkActionData<keyof ActionHandlers>;
|
||||
Reference in New Issue
Block a user