@@ -425,6 +425,14 @@ export const untrashItemInputSchema = z
425425 message : "Provide exactly one of itemId or itemTitle." ,
426426 } ) ;
427427
428+ export const downloadItemAttachmentInputSchema = z . object ( {
429+ shareId : z . string ( ) . max ( 100 ) . describe ( "Share ID containing the item" ) ,
430+ itemId : z . string ( ) . max ( 100 ) . describe ( "Item ID containing the attachment" ) ,
431+ attachmentId : z . string ( ) . max ( 100 ) . describe ( "Attachment ID to download" ) ,
432+ outputPath : z . string ( ) . min ( 1 ) . max ( 4096 ) . describe ( "Output path for downloaded attachment" ) ,
433+ confirm : z . boolean ( ) . optional ( ) . describe ( "Must be true to execute the write operation" ) ,
434+ } ) ;
435+
428436export const deleteItemInputSchema = z . object ( {
429437 shareId : z . string ( ) . max ( 100 ) . describe ( "Share ID containing the item to delete" ) ,
430438 itemId : z . string ( ) . max ( 100 ) . describe ( "Item ID to delete" ) ,
@@ -441,6 +449,25 @@ export const shareItemInputSchema = z.object({
441449 confirm : z . boolean ( ) . optional ( ) . describe ( "Must be true to execute the write operation" ) ,
442450} ) ;
443451
452+ export const listItemMembersInputSchema = z . object ( {
453+ shareId : z . string ( ) . max ( 100 ) . describe ( "Share ID containing the item" ) ,
454+ itemId : z . string ( ) . max ( 100 ) . describe ( "Item ID" ) ,
455+ output : z . enum ( [ "json" , "human" ] ) . default ( "json" ) . describe ( "Output format" ) ,
456+ } ) ;
457+
458+ export const updateItemMemberInputSchema = z . object ( {
459+ shareId : z . string ( ) . max ( 100 ) . describe ( "Share ID containing the item" ) ,
460+ memberShareId : z . string ( ) . max ( 100 ) . describe ( "Member share ID" ) ,
461+ role : z . enum ( SHARE_ROLE_OPTIONS ) . describe ( "Role for the member" ) ,
462+ confirm : z . boolean ( ) . optional ( ) . describe ( "Must be true to execute the write operation" ) ,
463+ } ) ;
464+
465+ export const removeItemMemberInputSchema = z . object ( {
466+ shareId : z . string ( ) . max ( 100 ) . describe ( "Share ID containing the item" ) ,
467+ memberShareId : z . string ( ) . max ( 100 ) . describe ( "Member share ID" ) ,
468+ confirm : z . boolean ( ) . optional ( ) . describe ( "Must be true to execute the write operation" ) ,
469+ } ) ;
470+
444471export const createItemAliasInputSchema = z
445472 . object ( {
446473 shareId : z . string ( ) . max ( 100 ) . optional ( ) . describe ( "Share ID where alias item will be created" ) ,
@@ -474,8 +501,12 @@ export type MoveItemInput = z.infer<typeof moveItemInputSchema>;
474501export type UpdateItemInput = z . infer < typeof updateItemInputSchema > ;
475502export type TrashItemInput = z . infer < typeof trashItemInputSchema > ;
476503export type UntrashItemInput = z . infer < typeof untrashItemInputSchema > ;
504+ export type DownloadItemAttachmentInput = z . infer < typeof downloadItemAttachmentInputSchema > ;
477505export type DeleteItemInput = z . infer < typeof deleteItemInputSchema > ;
478506export type ShareItemInput = z . infer < typeof shareItemInputSchema > ;
507+ export type ListItemMembersInput = z . infer < typeof listItemMembersInputSchema > ;
508+ export type UpdateItemMemberInput = z . infer < typeof updateItemMemberInputSchema > ;
509+ export type RemoveItemMemberInput = z . infer < typeof removeItemMemberInputSchema > ;
479510export type CreateItemAliasInput = z . infer < typeof createItemAliasInputSchema > ;
480511
481512export async function listItemsHandler (
@@ -946,6 +977,28 @@ export async function untrashItemHandler(
946977 return asTextContent ( out || "OK" ) ;
947978}
948979
980+ export async function downloadItemAttachmentHandler (
981+ passCli : PassCliRunner ,
982+ { shareId, itemId, attachmentId, outputPath, confirm } : DownloadItemAttachmentInput ,
983+ ) {
984+ requireWriteGate ( confirm ) ;
985+ const { stdout, stderr } = await passCli ( [
986+ "item" ,
987+ "attachment" ,
988+ "download" ,
989+ "--share-id" ,
990+ shareId ,
991+ "--item-id" ,
992+ itemId ,
993+ "--attachment-id" ,
994+ attachmentId ,
995+ "--output" ,
996+ outputPath ,
997+ ] ) ;
998+ const out = joinStdoutStderr ( stdout , stderr ) ;
999+ return asTextContent ( out || "OK" ) ;
1000+ }
1001+
9491002export async function deleteItemHandler (
9501003 passCli : PassCliRunner ,
9511004 { shareId, itemId, confirm } : DeleteItemInput ,
@@ -975,6 +1028,62 @@ export async function shareItemHandler(
9751028 return asTextContent ( out || "OK" ) ;
9761029}
9771030
1031+ export async function listItemMembersHandler (
1032+ passCli : PassCliRunner ,
1033+ { shareId, itemId, output } : ListItemMembersInput ,
1034+ ) {
1035+ const { stdout } = await passCli ( [
1036+ "item" ,
1037+ "member" ,
1038+ "list" ,
1039+ "--share-id" ,
1040+ shareId ,
1041+ "--item-id" ,
1042+ itemId ,
1043+ "--output" ,
1044+ output ,
1045+ ] ) ;
1046+ return asTextContent ( asJsonTextOrRaw ( stdout ) ) ;
1047+ }
1048+
1049+ export async function updateItemMemberHandler (
1050+ passCli : PassCliRunner ,
1051+ { shareId, memberShareId, role, confirm } : UpdateItemMemberInput ,
1052+ ) {
1053+ requireWriteGate ( confirm ) ;
1054+ const { stdout, stderr } = await passCli ( [
1055+ "item" ,
1056+ "member" ,
1057+ "update" ,
1058+ "--share-id" ,
1059+ shareId ,
1060+ "--member-share-id" ,
1061+ memberShareId ,
1062+ "--role" ,
1063+ role ,
1064+ ] ) ;
1065+ const out = joinStdoutStderr ( stdout , stderr ) ;
1066+ return asTextContent ( out || "OK" ) ;
1067+ }
1068+
1069+ export async function removeItemMemberHandler (
1070+ passCli : PassCliRunner ,
1071+ { shareId, memberShareId, confirm } : RemoveItemMemberInput ,
1072+ ) {
1073+ requireWriteGate ( confirm ) ;
1074+ const { stdout, stderr } = await passCli ( [
1075+ "item" ,
1076+ "member" ,
1077+ "remove" ,
1078+ "--share-id" ,
1079+ shareId ,
1080+ "--member-share-id" ,
1081+ memberShareId ,
1082+ ] ) ;
1083+ const out = joinStdoutStderr ( stdout , stderr ) ;
1084+ return asTextContent ( out || "OK" ) ;
1085+ }
1086+
9781087export async function createItemAliasHandler (
9791088 passCli : PassCliRunner ,
9801089 { shareId, vaultName, prefix, output, confirm } : CreateItemAliasInput ,
0 commit comments