@corsair-dev/googledrive 0.1.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EAKvB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,MAAM,aAAa,CAAC;AAWrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACX,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,YAAY,CAAC;AASpB,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CACpD,OAAO,iBAAiB,EACxB,wBAAwB,CACxB,CAAC;AAEF,KAAK,mBAAmB,CAAC,CAAC,SAAS,MAAM,0BAA0B,IAClE,eAAe,CACd,kBAAkB,EAClB,yBAAyB,CAAC,CAAC,CAAC,EAC5B,0BAA0B,CAAC,CAAC,CAAC,CAC7B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG;IAClC,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC1C,mBAAmB,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;IAChE,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAChD,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;I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AM,yBAAyB,GACpC,qBAAqB,CAAC,wBAAwB,CAAC,CAAC;AAEjD,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,wBAAwB,IACvE,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE1B,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,wBAAwB,EACnE,eAAe,GAAE,wBAAwB,GACxC,CAAsC,GACrC,yBAAyB,CAAC,CAAC,CAAC,CA0G9B;AAMD,YAAY,EACX,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,kBAAkB,CAAC;AAM1B,YAAY,EACX,yBAAyB,EACzB,0BAA0B,GAC1B,MAAM,mBAAmB,CAAC;AAE3B,mBAAmB,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{request as Ee}from"corsair/http";var B=class extends Error{constructor(r,s){super(r);this.code=s;this.name="GoogleDriveAPIError"}},Te="https://www.googleapis.com/drive/v3";async function Ge(i,o,r){let s=await fetch("https://oauth2.googleapis.com/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:i,client_secret:o,refresh_token:r,grant_type:"refresh_token"})});if(!s.ok){let u=await s.text();throw new B(`Failed to refresh access token: ${u}`,s.status)}return await s.json()}async function x({accessToken:i,expiresAt:o,clientId:r,clientSecret:s,refreshToken:n,forceRefresh:u=!1}){let g=Math.floor(Date.now()/1e3);if(!u&&i&&o&&Number(o)>g+300)return{accessToken:i,expiresAt:Number(o),refreshed:!1};let v=await Ge(r,s,n);return{accessToken:v.access_token,expiresAt:g+v.expires_in,refreshed:!0}}async function C(i,o,r={}){let{method:s="GET",body:n,query:u}=r;return await Ee({BASE:Te,VERSION:"1.0.0",WITH_CREDENTIALS:!1,CREDENTIALS:"omit",TOKEN:o,HEADERS:{"Content-Type":"application/json"}},{method:s,url:i,body:s==="POST"||s==="PUT"||s==="PATCH"?n:void 0,mediaType:"application/json",query:s==="GET"?u:void 0})}function Fe(i){return i instanceof Error&&"status"in i&&i.status===401}async function l(i,o,r={}){try{return await C(i,o.key,r)}catch(s){if(Fe(s)&&o._refreshAuth){let n=await o._refreshAuth();return await C(i,n,r)}throw s}}import{logEventFromContext as D}from"corsair/core";var _=async(i,o)=>{let r=await l("/files",i,{method:"GET",query:o});if(r.files&&i.db.files)try{for(let s of r.files)if(s.id){let n=s.mimeType==="application/vnd.google-apps.folder";n&&i.db.folders?await i.db.folders.upsertByEntityId(s.id,{...s,id:s.id,createdAt:new Date}):n||await i.db.files.upsertByEntityId(s.id,{...s,id:s.id,createdAt:new Date})}}catch(s){console.warn("Failed to save files to database:",s)}return await D(i,"googledrive.files.list",{...o},"completed"),r},W=async(i,o)=>{let r=await l(`/files/${o.fileId}`,i,{method:"GET",query:o});if(r.id){let s=r.mimeType==="application/vnd.google-apps.folder";try{s&&i.db.folders?await i.db.folders.upsertByEntityId(r.id,{...r,id:r.id,createdAt:new Date}):!s&&i.db.files&&await i.db.files.upsertByEntityId(r.id,{...r,id:r.id,createdAt:new Date})}catch(n){console.warn("Failed to save file to database:",n)}}return await D(i,"googledrive.files.get",{...o},"completed"),r},j=async(i,o)=>{let r=await l("/files",i,{method:"POST",body:{...o},query:{uploadType:"multipart"}});return r.id&&await i.endpoints.files.get({fileId:r.id}),await D(i,"googledrive.files.createFromText",{...o},"completed"),r},z=async(i,o)=>{let r=await l("/files",i,{method:"POST",body:{...o},query:{uploadType:"multipart"}});return r.id&&await i.endpoints.files.get({fileId:r.id}),await D(i,"googledrive.files.upload",{...o},"completed"),r},V=async(i,o)=>{let r=await l(`/files/${o.fileId}`,i,{method:"PATCH",body:{name:o.name,description:o.description,starred:o.starred,trashed:o.trashed,parents:o.parents,properties:o.properties,appProperties:o.appProperties},query:{addParents:o.addParents,removeParents:o.removeParents,supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives}});return r.id&&await i.endpoints.files.get({fileId:r.id}),await D(i,"googledrive.files.update",{...o},"completed"),r},$=async(i,o)=>{if(await l(`/files/${o.fileId}`,i,{method:"DELETE",query:{supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives}}),i.db.files)try{await i.db.files.deleteByEntityId(o.fileId)}catch(r){console.warn("Failed to delete file from database:",r)}await D(i,"googledrive.files.delete",{...o},"completed")},K=async(i,o)=>{let r=await l(`/files/${o.fileId}/copy`,i,{method:"POST",body:{name:o.name,parents:o.parents},query:{supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives}});return r.id&&await i.endpoints.files.get({fileId:r.id}),await D(i,"googledrive.files.copy",{...o},"completed"),r},H=async(i,o)=>{let r=await l(`/files/${o.fileId}`,i,{method:"PATCH",body:{},query:o});return r.id&&await i.endpoints.files.get({fileId:r.id}),await D(i,"googledrive.files.move",{...o},"completed"),r},J=async(i,o)=>{let r=await l(`/files/${o.fileId}`,i,{method:"GET",query:{alt:"media",acknowledgeAbuse:o.acknowledgeAbuse}});return await D(i,"googledrive.files.download",{...o},"completed"),r},Y=async(i,o)=>{let r=await l(`/files/${o.fileId}/permissions`,i,{method:"POST",body:{type:o.type,role:o.role,emailAddress:o.emailAddress,domain:o.domain,allowFileDiscovery:o.allowFileDiscovery,expirationTime:o.expirationTime,sendNotificationEmail:o.sendNotificationEmail,emailMessage:o.emailMessage},query:{supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives,moveToNewOwnersRoot:o.moveToNewOwnersRoot,transferOwnership:o.transferOwnership}});return await D(i,"googledrive.files.share",{...o},"completed"),r};import{logEventFromContext as I}from"corsair/core";var Q=async(i,o)=>{let r=await l("/files",i,{method:"POST",body:{name:o.name,mimeType:"application/vnd.google-apps.folder",parents:o.parents,description:o.description}});if(r.id&&i.db.folders)try{await i.db.folders.upsertByEntityId(r.id,{...r,id:r.id,createdAt:new Date})}catch(s){console.warn("Failed to save folder to database:",s)}return await I(i,"googledrive.folders.create",{...o},"completed"),r},X=async(i,o)=>{let r=await l(`/files/${o.folderId}`,i,{method:"GET",query:{supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives,includePermissionsForView:o.includePermissionsForView}});if(r.id&&i.db.folders)try{await i.db.folders.upsertByEntityId(r.id,{...r,id:r.id,createdAt:new Date})}catch(s){console.warn("Failed to save folder to database:",s)}return await I(i,"googledrive.folders.get",{...o},"completed"),r},Z=async(i,o)=>{let r=`mimeType='application/vnd.google-apps.folder'${o.q?` and ${o.q}`:""}`,s=await l("/files",i,{method:"GET",query:{q:r,pageSize:o.pageSize,pageToken:o.pageToken,spaces:o.spaces,corpora:o.corpora,driveId:o.driveId,includeItemsFromAllDrives:o.includeItemsFromAllDrives,includePermissionsForView:o.includePermissionsForView,orderBy:o.orderBy,supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives,teamDriveId:o.teamDriveId}});if(s.files&&i.db.folders)try{for(let n of s.files)n.id&&await i.db.folders.upsertByEntityId(n.id,{...n,id:n.id,createdAt:new Date})}catch(n){console.warn("Failed to save folders to database:",n)}return await I(i,"googledrive.folders.list",{...o},"completed"),s},ee=async(i,o)=>{if(await l(`/files/${o.folderId}`,i,{method:"DELETE",query:{supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives}}),i.db.folders)try{await i.db.folders.deleteByEntityId(o.folderId)}catch(r){console.warn("Failed to delete folder from database:",r)}await I(i,"googledrive.folders.delete",{...o},"completed")},oe=async(i,o)=>{let r=await l(`/files/${o.folderId}/permissions`,i,{method:"POST",body:{type:o.type,role:o.role,emailAddress:o.emailAddress,domain:o.domain,allowFileDiscovery:o.allowFileDiscovery,expirationTime:o.expirationTime,sendNotificationEmail:o.sendNotificationEmail,emailMessage:o.emailMessage},query:{supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives,moveToNewOwnersRoot:o.moveToNewOwnersRoot,transferOwnership:o.transferOwnership}});return await I(i,"googledrive.folders.share",{...o},"completed"),r};import{logEventFromContext as Ce}from"corsair/core";var ie=async(i,o)=>{let r=await l("/files",i,{method:"GET",query:{q:o.q,pageSize:o.pageSize,pageToken:o.pageToken,spaces:o.spaces,corpora:o.corpora,driveId:o.driveId,includeItemsFromAllDrives:o.includeItemsFromAllDrives,includePermissionsForView:o.includePermissionsForView,orderBy:o.orderBy,supportsAllDrives:o.supportsAllDrives,supportsTeamDrives:o.supportsTeamDrives,teamDriveId:o.teamDriveId}});if(r.files)try{for(let s of r.files)if(s.id){let n=s.mimeType==="application/vnd.google-apps.folder";n&&i.db.folders?await i.db.folders.upsertByEntityId(s.id,{...s,id:s.id,createdAt:new Date}):!n&&i.db.files&&await i.db.files.upsertByEntityId(s.id,{...s,id:s.id,createdAt:new Date})}}catch(s){console.warn("Failed to save search results to database:",s)}return await Ce(i,"googledrive.search.filesAndFolders",{...o},"completed"),r};import{logEventFromContext as A}from"corsair/core";var te=async(i,o)=>{let r=o.requestId||`req_${Date.now()}`,s=await l("/drives",i,{method:"POST",body:{name:o.name,themeId:o.themeId,colorRgb:o.colorRgb,restrictions:o.restrictions},query:{requestId:r}});if(s.id&&i.db.sharedDrives)try{await i.db.sharedDrives.upsertByEntityId(s.id,{...s,id:s.id,createdAt:new Date})}catch(n){console.warn("Failed to save shared drive to database:",n)}return await A(i,"googledrive.sharedDrives.create",{...o},"completed"),s},re=async(i,o)=>{let r=await l(`/drives/${o.driveId}`,i,{method:"GET",query:{useDomainAdminAccess:o.useDomainAdminAccess}});if(r.id&&i.db.sharedDrives)try{await i.db.sharedDrives.upsertByEntityId(r.id,{...r,id:r.id,createdAt:new Date})}catch(s){console.warn("Failed to save shared drive to database:",s)}return await A(i,"googledrive.sharedDrives.get",{...o},"completed"),r},se=async(i,o)=>{let r=await l("/drives",i,{method:"GET",query:{pageSize:o.pageSize,pageToken:o.pageToken,q:o.q,useDomainAdminAccess:o.useDomainAdminAccess}});if(r.drives&&i.db.sharedDrives)try{for(let s of r.drives)s.id&&await i.db.sharedDrives.upsertByEntityId(s.id,{...s,id:s.id,createdAt:new Date})}catch(s){console.warn("Failed to save shared drives to database:",s)}return await A(i,"googledrive.sharedDrives.list",{...o},"completed"),r},ne=async(i,o)=>{let r=await l(`/drives/${o.driveId}`,i,{method:"PATCH",body:{name:o.name,themeId:o.themeId,colorRgb:o.colorRgb,restrictions:o.restrictions},query:{useDomainAdminAccess:o.useDomainAdminAccess}});if(r.id&&i.db.sharedDrives)try{await i.db.sharedDrives.upsertByEntityId(r.id,{...r,id:r.id,createdAt:new Date})}catch(s){console.warn("Failed to save shared drive to database:",s)}return await A(i,"googledrive.sharedDrives.update",{...o},"completed"),r},ae=async(i,o)=>{if(await l(`/drives/${o.driveId}`,i,{method:"DELETE"}),i.db.sharedDrives)try{await i.db.sharedDrives.deleteByEntityId(o.driveId)}catch(r){console.warn("Failed to delete shared drive from database:",r)}await A(i,"googledrive.sharedDrives.delete",{...o},"completed")};import{z as e}from"zod";var Pe=e.object({q:e.string().optional(),pageSize:e.number().optional(),pageToken:e.string().optional(),spaces:e.string().optional(),corpora:e.string().optional(),driveId:e.string().optional(),includeItemsFromAllDrives:e.boolean().optional(),includePermissionsForView:e.string().optional(),orderBy:e.string().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),teamDriveId:e.string().optional()}),Oe=e.object({fileId:e.string(),acknowledgeAbuse:e.boolean().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),includePermissionsForView:e.string().optional()}),Le=e.object({name:e.string(),content:e.string(),mimeType:e.string().optional(),parents:e.array(e.string()).optional(),description:e.string().optional()}),Re=e.object({name:e.string(),mimeType:e.string().optional(),parents:e.array(e.string()).optional(),description:e.string().optional()}),Be=e.object({fileId:e.string(),name:e.string().optional(),description:e.string().optional(),starred:e.boolean().optional(),trashed:e.boolean().optional(),parents:e.array(e.string()).optional(),addParents:e.string().optional(),removeParents:e.string().optional(),properties:e.record(e.string()).optional(),appProperties:e.record(e.string()).optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional()}),xe=e.object({fileId:e.string(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional()}),Me=e.object({fileId:e.string(),name:e.string().optional(),parents:e.array(e.string()).optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional()}),qe=e.object({fileId:e.string(),addParents:e.string().optional(),removeParents:e.string().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional()}),Ue=e.object({fileId:e.string(),acknowledgeAbuse:e.boolean().optional()}),Ne=e.object({fileId:e.string(),type:e.enum(["user","group","domain","anyone"]).optional(),role:e.enum(["owner","organizer","fileOrganizer","writer","commenter","reader"]).optional(),emailAddress:e.string().optional(),domain:e.string().optional(),allowFileDiscovery:e.boolean().optional(),expirationTime:e.string().optional(),sendNotificationEmail:e.boolean().optional(),emailMessage:e.string().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),moveToNewOwnersRoot:e.boolean().optional(),transferOwnership:e.boolean().optional()}),_e=e.object({name:e.string(),parents:e.array(e.string()).optional(),description:e.string().optional()}),We=e.object({folderId:e.string(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),includePermissionsForView:e.string().optional()}),je=e.object({q:e.string().optional(),pageSize:e.number().optional(),pageToken:e.string().optional(),spaces:e.string().optional(),corpora:e.string().optional(),driveId:e.string().optional(),includeItemsFromAllDrives:e.boolean().optional(),includePermissionsForView:e.string().optional(),orderBy:e.string().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),teamDriveId:e.string().optional()}),ze=e.object({folderId:e.string(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional()}),Ve=e.object({folderId:e.string(),type:e.enum(["user","group","domain","anyone"]).optional(),role:e.enum(["owner","organizer","fileOrganizer","writer","commenter","reader"]).optional(),emailAddress:e.string().optional(),domain:e.string().optional(),allowFileDiscovery:e.boolean().optional(),expirationTime:e.string().optional(),sendNotificationEmail:e.boolean().optional(),emailMessage:e.string().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),moveToNewOwnersRoot:e.boolean().optional(),transferOwnership:e.boolean().optional()}),$e=e.object({name:e.string(),requestId:e.string().optional(),themeId:e.string().optional(),colorRgb:e.string().optional(),restrictions:e.object({adminManagedRestrictions:e.boolean().optional(),copyRequiresWriterPermission:e.boolean().optional(),domainUsersOnly:e.boolean().optional(),driveMembersOnly:e.boolean().optional()}).optional()}),Ke=e.object({driveId:e.string(),useDomainAdminAccess:e.boolean().optional()}),He=e.object({pageSize:e.number().optional(),pageToken:e.string().optional(),q:e.string().optional(),useDomainAdminAccess:e.boolean().optional()}),Je=e.object({driveId:e.string(),name:e.string().optional(),themeId:e.string().optional(),colorRgb:e.string().optional(),restrictions:e.object({adminManagedRestrictions:e.boolean().optional(),copyRequiresWriterPermission:e.boolean().optional(),domainUsersOnly:e.boolean().optional(),driveMembersOnly:e.boolean().optional()}).optional(),useDomainAdminAccess:e.boolean().optional()}),Ye=e.object({driveId:e.string()}),Qe=e.object({q:e.string(),pageSize:e.number().optional(),pageToken:e.string().optional(),spaces:e.string().optional(),corpora:e.string().optional(),driveId:e.string().optional(),includeItemsFromAllDrives:e.boolean().optional(),includePermissionsForView:e.string().optional(),orderBy:e.string().optional(),supportsAllDrives:e.boolean().optional(),supportsTeamDrives:e.boolean().optional(),teamDriveId:e.string().optional()}),p={filesList:Pe,filesGet:Oe,filesCreateFromText:Le,filesUpload:Re,filesUpdate:Be,filesDelete:xe,filesCopy:Me,filesMove:qe,filesDownload:Ue,filesShare:Ne,foldersCreate:_e,foldersGet:We,foldersList:je,foldersDelete:ze,foldersShare:Ve,sharedDrivesCreate:$e,sharedDrivesGet:Ke,sharedDrivesList:He,sharedDrivesUpdate:Je,sharedDrivesDelete:Ye,searchFilesAndFolders:Qe},y=e.object({id:e.string().optional(),name:e.string().optional(),mimeType:e.string().optional(),description:e.string().optional(),starred:e.boolean().optional(),trashed:e.boolean().optional(),explicitlyTrashed:e.boolean().optional(),parents:e.array(e.string()).optional(),properties:e.record(e.string()).optional(),appProperties:e.record(e.string()).optional(),spaces:e.array(e.string()).optional(),version:e.string().optional(),webViewLink:e.string().optional(),webContentLink:e.string().optional(),iconLink:e.string().optional(),hasThumbnail:e.boolean().optional(),thumbnailLink:e.string().optional(),thumbnailVersion:e.string().optional(),viewedByMe:e.boolean().optional(),viewedByMeTime:e.string().optional(),createdTime:e.string().optional(),modifiedTime:e.string().optional(),modifiedByMeTime:e.string().optional(),modifiedByMe:e.boolean().optional(),shared:e.boolean().optional(),ownedByMe:e.boolean().optional(),permissionIds:e.array(e.string()).optional(),hasAugmentedPermissions:e.boolean().optional(),folderColorRgb:e.string().optional(),originalFilename:e.string().optional(),fullFileExtension:e.string().optional(),fileExtension:e.string().optional(),md5Checksum:e.string().optional(),size:e.string().optional(),quotaBytesUsed:e.string().optional(),headRevisionId:e.string().optional(),isAppAuthorized:e.boolean().optional(),resourceKey:e.string().optional(),sha1Checksum:e.string().optional(),sha256Checksum:e.string().optional()}),M=e.object({kind:e.string().optional(),nextPageToken:e.string().optional(),incompleteSearch:e.boolean().optional(),files:e.array(y).optional()}),le=e.object({id:e.string().optional(),type:e.enum(["user","group","domain","anyone"]).optional(),emailAddress:e.string().optional(),domain:e.string().optional(),role:e.enum(["owner","organizer","fileOrganizer","writer","commenter","reader"]).optional(),allowFileDiscovery:e.boolean().optional(),displayName:e.string().optional(),photoLink:e.string().optional(),expirationTime:e.string().optional(),deleted:e.boolean().optional(),view:e.enum(["user","domain"]).optional(),pendingOwner:e.boolean().optional()}),R=e.object({kind:e.string().optional(),id:e.string().optional(),name:e.string().optional(),themeId:e.string().optional(),colorRgb:e.string().optional(),createdTime:e.string().optional(),hidden:e.boolean().optional()}),Xe=e.object({kind:e.string().optional(),nextPageToken:e.string().optional(),drives:e.array(R).optional()}),c={filesList:M,filesGet:y,filesCreateFromText:y,filesUpload:y,filesUpdate:y,filesDelete:e.void(),filesCopy:y,filesMove:y,filesDownload:e.any(),filesShare:le,foldersCreate:y,foldersGet:y,foldersList:M,foldersDelete:e.void(),foldersShare:le,sharedDrivesCreate:R,sharedDrivesGet:R,sharedDrivesList:Xe,sharedDrivesUpdate:R,sharedDrivesDelete:e.void(),searchFilesAndFolders:M};var h={list:_,get:W,createFromText:j,upload:z,update:V,delete:$,copy:K,move:H,download:J,share:Y},T={create:Q,get:X,list:Z,delete:ee,share:oe},G={create:te,get:re,list:se,update:ne,delete:ae},de={filesAndFolders:ie};import{z as t}from"zod";var pe=t.object({canAddChildren:t.boolean().optional(),canChangeCopyRequiresWriterPermission:t.boolean().optional(),canChangeViewersCanCopyContent:t.boolean().optional(),canComment:t.boolean().optional(),canCopy:t.boolean().optional(),canDelete:t.boolean().optional(),canDeleteChildren:t.boolean().optional(),canDownload:t.boolean().optional(),canEdit:t.boolean().optional(),canListChildren:t.boolean().optional(),canModifyContent:t.boolean().optional(),canModifyContentRestriction:t.boolean().optional(),canMoveChildrenOutOfDrive:t.boolean().optional(),canMoveChildrenOutOfTeamDrive:t.boolean().optional(),canMoveChildrenWithinDrive:t.boolean().optional(),canMoveItemIntoTeamDrive:t.boolean().optional(),canMoveItemOutOfDrive:t.boolean().optional(),canMoveItemWithinDrive:t.boolean().optional(),canReadRevisions:t.boolean().optional(),canReadTeamDrive:t.boolean().optional(),canRemoveChildren:t.boolean().optional(),canRename:t.boolean().optional(),canShare:t.boolean().optional(),canTrash:t.boolean().optional(),canTrashChildren:t.boolean().optional(),canUntrash:t.boolean().optional()}),ce=t.object({id:t.string(),name:t.string().optional(),mimeType:t.string().optional(),description:t.string().optional(),starred:t.boolean().optional(),trashed:t.boolean().optional(),explicitlyTrashed:t.boolean().optional(),parents:t.array(t.string()).optional(),properties:t.record(t.string()).optional(),appProperties:t.record(t.string()).optional(),spaces:t.array(t.string()).optional(),version:t.string().optional(),webViewLink:t.string().optional(),webContentLink:t.string().optional(),iconLink:t.string().optional(),hasThumbnail:t.boolean().optional(),thumbnailLink:t.string().optional(),thumbnailVersion:t.string().optional(),viewedByMe:t.boolean().optional(),viewedByMeTime:t.string().optional(),createdTime:t.string().optional(),modifiedTime:t.string().optional(),modifiedByMeTime:t.string().optional(),modifiedByMe:t.boolean().optional(),shared:t.boolean().optional(),ownedByMe:t.boolean().optional(),capabilities:pe.optional(),viewersCanCopyContent:t.boolean().optional(),copyRequiresWriterPermission:t.boolean().optional(),writersCanShare:t.boolean().optional(),permissionIds:t.array(t.string()).optional(),hasAugmentedPermissions:t.boolean().optional(),folderColorRgb:t.string().optional(),originalFilename:t.string().optional(),fullFileExtension:t.string().optional(),fileExtension:t.string().optional(),md5Checksum:t.string().optional(),size:t.string().optional(),quotaBytesUsed:t.string().optional(),headRevisionId:t.string().optional(),isAppAuthorized:t.boolean().optional(),resourceKey:t.string().optional(),sha1Checksum:t.string().optional(),sha256Checksum:t.string().optional(),filePath:t.string().optional(),createdAt:t.coerce.date().optional()}),ge=t.object({id:t.string(),name:t.string().optional(),mimeType:t.string().optional(),description:t.string().optional(),starred:t.boolean().optional(),trashed:t.boolean().optional(),explicitlyTrashed:t.boolean().optional(),parents:t.array(t.string()).optional(),properties:t.record(t.string()).optional(),appProperties:t.record(t.string()).optional(),spaces:t.array(t.string()).optional(),version:t.string().optional(),webViewLink:t.string().optional(),webContentLink:t.string().optional(),iconLink:t.string().optional(),hasThumbnail:t.boolean().optional(),thumbnailLink:t.string().optional(),thumbnailVersion:t.string().optional(),viewedByMe:t.boolean().optional(),viewedByMeTime:t.string().optional(),createdTime:t.string().optional(),modifiedTime:t.string().optional(),modifiedByMeTime:t.string().optional(),modifiedByMe:t.boolean().optional(),shared:t.boolean().optional(),ownedByMe:t.boolean().optional(),capabilities:pe.optional(),viewersCanCopyContent:t.boolean().optional(),copyRequiresWriterPermission:t.boolean().optional(),writersCanShare:t.boolean().optional(),permissionIds:t.array(t.string()).optional(),hasAugmentedPermissions:t.boolean().optional(),folderColorRgb:t.string().optional(),filePath:t.string().optional(),createdAt:t.coerce.date().optional()}),fe=t.object({id:t.string(),name:t.string().optional(),themeId:t.string().optional(),colorRgb:t.string().optional(),createdTime:t.string().optional(),hidden:t.boolean().optional(),createdAt:t.coerce.date().optional()});var ue={version:"1.0.0",entities:{files:ce,folders:ge,sharedDrives:fe}};import{logEventFromContext as he}from"corsair/core";import{z as a}from"zod";var Ze=a.object({data:a.string().optional(),attributes:a.record(a.string()).optional(),messageId:a.string().optional(),publishTime:a.string().optional()}),me=a.object({message:Ze.optional(),subscription:a.string().optional(),event:a.unknown().optional()}),xo=a.object({kind:a.string().optional(),id:a.string().optional(),resourceId:a.string().optional(),resourceUri:a.string().optional(),resourceState:a.string().optional(),changed:a.string().optional(),expiration:a.string().optional()}),q=a.enum(["created","updated","deleted","trashed","untrashed"]),ve=a.object({type:a.enum(["fileChanged","folderChanged"]),fileId:a.string().optional(),folderId:a.string().optional(),changeType:q,file:a.custom().optional(),folder:a.custom().optional(),filePath:a.string().optional(),change:a.custom().optional(),binaryData:a.string().nullable().optional(),allFiles:a.array(a.object({file:a.custom(),filePath:a.string(),change:a.custom(),changeType:q,binaryData:a.string().nullable().optional()})),allFolders:a.array(a.object({folder:a.custom(),filePath:a.string(),change:a.custom(),changeType:q}))});function F(i){let o=Buffer.from(i,"base64").toString("utf-8");return JSON.parse(o)}function U(i){return o=>{let r=o.body;if(!r.message?.data)return!1;try{let s=F(r.message.data);return!!s.resourceId&&!!s.resourceUri&&s.resourceUri.includes("/drive/")}catch{return!1}}}var eo=/[?&]pageToken=([^&]+)/,oo="application/vnd.google-apps.folder",io=6e4,to=["id","name","mimeType","parents","trashed","createdTime","modifiedTime","size","webViewLink","webContentLink","starred","shared","ownedByMe","description","fileExtension","originalFilename"].join(",");function ro(i){return i.match(eo)?.[1]}async function De(i,o){try{return await C(`/files/${o}`,i,{method:"GET",query:{supportsAllDrives:!0,fields:to}})}catch(r){return console.warn(`Failed to fetch file ${o}:`,r),null}}async function so(i,o){try{let r=`https://www.googleapis.com/drive/v3/files/${o}?alt=media&supportsAllDrives=true`,s=await fetch(r,{method:"GET",headers:{Authorization:`Bearer ${i}`}});if(!s.ok)return null;let n=await s.arrayBuffer();return Buffer.from(n).toString("base64")}catch(r){return console.warn(`Failed to fetch binary data for file ${o}:`,r),null}}async function no(i,o){return await C("/changes",i,{method:"GET",query:{pageToken:o,pageSize:100,includeRemoved:!0,supportsAllDrives:!0}})}async function ao(i,o,r=20){let s=[o.name??""],n=o.parents,u=0;for(;n?.length&&u<r;){let g=n[0];if(!g)break;let f=await De(i,g);if(!f?.name||!f.parents?.length)break;s.unshift(f.name),n=f.parents,u++}return"/"+s.join("/")}function lo(i,o,r){return i.removed?"deleted":o.trashed?"trashed":"updated"}function po(i,o=io){if(i.length===0)return i;let r=Date.now();return i.filter(s=>{if(!s.time)return!0;let n=new Date(s.time).getTime();return r-n<=o})}var ye={match:U("driveChanged"),handler:async(i,o)=>{let r=o.payload;if(!r.message?.data)return{success:!1,error:"No message data in notification"};let s=F(r.message.data);if(!s.resourceId||!s.resourceUri)return{success:!1,error:"Invalid push notification format"};let n=i.key,u=ro(s.resourceUri);if(!u)return{success:!1,error:"Could not parse pageToken from resource URI"};try{let f=(await no(n,u)).changes??[];f=po(f);let v="";if(f.length===0)return{success:!0,corsairEntityId:"",data:{type:"fileChanged",fileId:s.resourceId??"",changeType:"updated",allFiles:[],allFolders:[]}};let k=[],S=[];for(let m of f){if(!m.fileId)continue;let d=await De(n,m.fileId);if(!d)continue;let we=d.mimeType===oo,P=m.removed?"":await ao(n,d),O=lo(m,d,k.length===0&&S.length===0);if(we){if(i.db?.folders&&d.id)try{if(O==="deleted")await i.db.folders.deleteByEntityId(d.id);else{let E=await i.db.folders.upsertByEntityId(d.id,{...d,id:d.id,filePath:P});!v&&E?.id&&(v=E.id)}}catch(E){console.warn(`Failed to save folder ${d.id} to database:`,E)}S.push({folder:d,filePath:P,change:m,changeType:O})}else{let E=await so(n,m.fileId);if(i.db?.files&&d.id)try{if(O==="deleted")await i.db.files.deleteByEntityId(d.id);else{let L=await i.db.files.upsertByEntityId(d.id,{...d,id:d.id,filePath:P});!v&&L?.id&&(v=L.id)}}catch(L){console.warn(`Failed to save file ${d.id} to database:`,L)}k.push({file:d,filePath:P,change:m,changeType:O,binaryData:E})}}let w=S[0],b=k[0];if(w&&!b){let m={type:"folderChanged",folderId:w.folder.id??s.resourceId??"",changeType:w.changeType,folder:w.folder,filePath:w.filePath,change:w.change,allFolders:S,allFiles:k.map(d=>({file:d.file,filePath:d.filePath,change:d.change,changeType:d.changeType,binaryData:d.binaryData}))};return await he(i,"googledrive.webhook.folderChanged",{...m},"completed"),{success:!0,corsairEntityId:v,data:m}}let N={type:"fileChanged",fileId:b?.file.id??s.resourceId??"",changeType:b?.changeType??"updated",file:b?.file,filePath:b?.filePath??"",change:b?.change??f[0],binaryData:b?.binaryData??null,allFiles:k.map(m=>({file:m.file,filePath:m.filePath,change:m.change,changeType:m.changeType,binaryData:m.binaryData})),allFolders:S};return await he(i,"googledrive.webhook.fileChanged",{...N},"completed"),{success:!0,corsairEntityId:v,data:N}}catch(g){return console.error("Failed to process Google Drive webhook:",g),{success:!1,error:`Failed to process change: ${g instanceof Error?g.message:"Unknown error"}`}}}};var be={driveChanged:ye};var co={files:{list:h.list,get:h.get,createFromText:h.createFromText,upload:h.upload,update:h.update,delete:h.delete,copy:h.copy,move:h.move,download:h.download,share:h.share},folders:{create:T.create,get:T.get,list:T.list,delete:T.delete,share:T.share},sharedDrives:{create:G.create,get:G.get,list:G.list,update:G.update,delete:G.delete},search:{filesAndFolders:de.filesAndFolders}},go={"files.list":{input:p.filesList,output:c.filesList},"files.get":{input:p.filesGet,output:c.filesGet},"files.createFromText":{input:p.filesCreateFromText,output:c.filesCreateFromText},"files.upload":{input:p.filesUpload,output:c.filesUpload},"files.update":{input:p.filesUpdate,output:c.filesUpdate},"files.delete":{input:p.filesDelete,output:c.filesDelete},"files.copy":{input:p.filesCopy,output:c.filesCopy},"files.move":{input:p.filesMove,output:c.filesMove},"files.download":{input:p.filesDownload,output:c.filesDownload},"files.share":{input:p.filesShare,output:c.filesShare},"folders.create":{input:p.foldersCreate,output:c.foldersCreate},"folders.get":{input:p.foldersGet,output:c.foldersGet},"folders.list":{input:p.foldersList,output:c.foldersList},"folders.delete":{input:p.foldersDelete,output:c.foldersDelete},"folders.share":{input:p.foldersShare,output:c.foldersShare},"sharedDrives.create":{input:p.sharedDrivesCreate,output:c.sharedDrivesCreate},"sharedDrives.get":{input:p.sharedDrivesGet,output:c.sharedDrivesGet},"sharedDrives.list":{input:p.sharedDrivesList,output:c.sharedDrivesList},"sharedDrives.update":{input:p.sharedDrivesUpdate,output:c.sharedDrivesUpdate},"sharedDrives.delete":{input:p.sharedDrivesDelete,output:c.sharedDrivesDelete},"search.filesAndFolders":{input:p.searchFilesAndFolders,output:c.searchFilesAndFolders}},fo={driveChanged:be.driveChanged},uo={driveChanged:{description:"A file or folder in Google Drive was created, updated, or deleted",payload:me,response:ve}},mo="oauth_2",vo={"files.list":{riskLevel:"read",description:"List files in Google Drive"},"files.get":{riskLevel:"read",description:"Get metadata for a specific file"},"files.createFromText":{riskLevel:"write",description:"Create a new Drive file from text content"},"files.upload":{riskLevel:"write",description:"Upload a file to Google Drive"},"files.update":{riskLevel:"write",description:"Update the content or metadata of a file"},"files.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a file [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"files.copy":{riskLevel:"write",description:"Copy a file in Google Drive"},"files.move":{riskLevel:"write",description:"Move a file to a different folder"},"files.download":{riskLevel:"read",description:"Download the content of a file"},"files.share":{riskLevel:"write",description:"Share a file by granting permissions to users"},"folders.create":{riskLevel:"write",description:"Create a new folder"},"folders.get":{riskLevel:"read",description:"Get metadata for a specific folder"},"folders.list":{riskLevel:"read",description:"List folders in Google Drive"},"folders.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a folder and its contents [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"folders.share":{riskLevel:"write",description:"Share a folder by granting permissions to users"},"sharedDrives.create":{riskLevel:"write",description:"Create a new shared drive"},"sharedDrives.get":{riskLevel:"read",description:"Get info about a shared drive"},"sharedDrives.list":{riskLevel:"read",description:"List shared drives"},"sharedDrives.update":{riskLevel:"write",description:"Update a shared drive"},"sharedDrives.delete":{riskLevel:"destructive",irreversible:!0,description:"Permanently delete a shared drive [DESTRUCTIVE \xB7 IRREVERSIBLE]"},"search.filesAndFolders":{riskLevel:"read",description:"Search for files and folders in Google Drive"}};function Qo(i={}){let o={...i,authType:i.authType??mo};return{id:"googledrive",schema:ue,options:o,oauthConfig:{providerName:"Google",authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",scopes:["https://www.googleapis.com/auth/drive"],authParams:{access_type:"offline",prompt:"consent"}},hooks:o.hooks,webhookHooks:o.webhookHooks,endpoints:co,webhooks:fo,endpointMeta:vo,endpointSchemas:go,webhookSchemas:uo,keyBuilder:async r=>{if(o.key)return o.key;if(r.authType==="oauth_2"){let[s,n,u]=await Promise.all([r.keys.get_access_token(),r.keys.get_expires_at(),r.keys.get_refresh_token()]);if(!u)throw new Error("[corsair:googledrive] No refresh token. Cannot get access token.");let g=await r.keys.get_integration_credentials();if(!g.client_id||!g.client_secret)throw new Error("[corsair:googledrive] No client id or client secret");try{let f=await x({accessToken:s,expiresAt:n,refreshToken:u,clientId:g.client_id,clientSecret:g.client_secret});return f.refreshed&&await Promise.all([r.keys.set_access_token(f.accessToken),r.keys.set_expires_at(String(f.expiresAt))]),r._refreshAuth=async()=>{let v=await x({accessToken:null,expiresAt:null,refreshToken:u,clientId:g.client_id,clientSecret:g.client_secret,forceRefresh:!0});return await r.keys.set_access_token(v.accessToken),await r.keys.set_expires_at(String(v.expiresAt)),v.accessToken},f.accessToken}catch(f){throw new Error(`[corsair:googledrive] Failed to get valid access token: ${f instanceof Error?f.message:String(f)}`)}}return""},pluginWebhookMatcher:r=>{let s=r.headers;if(!(s.from==="noreply@google.com"||typeof s["user-agent"]=="string"&&s["user-agent"].includes("APIs-Google")))return!1;let u=r.body;if(!u?.message?.data)return!1;try{let g=F(u.message.data);return!!g.resourceUri&&g.resourceUri.includes("drive")}catch{return!1}}}}export{U as createGoogleDriveWebhookMatcher,F as decodePubSubMessage,Qo as googledrive,go as googledriveEndpointSchemas};
@@ -0,0 +1,551 @@
1
+ import { z } from 'zod';
2
+ export declare const GoogleDriveFile: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodOptional<z.ZodString>;
5
+ mimeType: z.ZodOptional<z.ZodString>;
6
+ description: z.ZodOptional<z.ZodString>;
7
+ starred: z.ZodOptional<z.ZodBoolean>;
8
+ trashed: z.ZodOptional<z.ZodBoolean>;
9
+ explicitlyTrashed: z.ZodOptional<z.ZodBoolean>;
10
+ parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
12
+ appProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
+ spaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
+ version: z.ZodOptional<z.ZodString>;
15
+ webViewLink: z.ZodOptional<z.ZodString>;
16
+ webContentLink: z.ZodOptional<z.ZodString>;
17
+ iconLink: z.ZodOptional<z.ZodString>;
18
+ hasThumbnail: z.ZodOptional<z.ZodBoolean>;
19
+ thumbnailLink: z.ZodOptional<z.ZodString>;
20
+ thumbnailVersion: z.ZodOptional<z.ZodString>;
21
+ viewedByMe: z.ZodOptional<z.ZodBoolean>;
22
+ viewedByMeTime: z.ZodOptional<z.ZodString>;
23
+ createdTime: z.ZodOptional<z.ZodString>;
24
+ modifiedTime: z.ZodOptional<z.ZodString>;
25
+ modifiedByMeTime: z.ZodOptional<z.ZodString>;
26
+ modifiedByMe: z.ZodOptional<z.ZodBoolean>;
27
+ shared: z.ZodOptional<z.ZodBoolean>;
28
+ ownedByMe: z.ZodOptional<z.ZodBoolean>;
29
+ capabilities: z.ZodOptional<z.ZodObject<{
30
+ canAddChildren: z.ZodOptional<z.ZodBoolean>;
31
+ canChangeCopyRequiresWriterPermission: z.ZodOptional<z.ZodBoolean>;
32
+ canChangeViewersCanCopyContent: z.ZodOptional<z.ZodBoolean>;
33
+ canComment: z.ZodOptional<z.ZodBoolean>;
34
+ canCopy: z.ZodOptional<z.ZodBoolean>;
35
+ canDelete: z.ZodOptional<z.ZodBoolean>;
36
+ canDeleteChildren: z.ZodOptional<z.ZodBoolean>;
37
+ canDownload: z.ZodOptional<z.ZodBoolean>;
38
+ canEdit: z.ZodOptional<z.ZodBoolean>;
39
+ canListChildren: z.ZodOptional<z.ZodBoolean>;
40
+ canModifyContent: z.ZodOptional<z.ZodBoolean>;
41
+ canModifyContentRestriction: z.ZodOptional<z.ZodBoolean>;
42
+ canMoveChildrenOutOfDrive: z.ZodOptional<z.ZodBoolean>;
43
+ canMoveChildrenOutOfTeamDrive: z.ZodOptional<z.ZodBoolean>;
44
+ canMoveChildrenWithinDrive: z.ZodOptional<z.ZodBoolean>;
45
+ canMoveItemIntoTeamDrive: z.ZodOptional<z.ZodBoolean>;
46
+ canMoveItemOutOfDrive: z.ZodOptional<z.ZodBoolean>;
47
+ canMoveItemWithinDrive: z.ZodOptional<z.ZodBoolean>;
48
+ canReadRevisions: z.ZodOptional<z.ZodBoolean>;
49
+ canReadTeamDrive: z.ZodOptional<z.ZodBoolean>;
50
+ canRemoveChildren: z.ZodOptional<z.ZodBoolean>;
51
+ canRename: z.ZodOptional<z.ZodBoolean>;
52
+ canShare: z.ZodOptional<z.ZodBoolean>;
53
+ canTrash: z.ZodOptional<z.ZodBoolean>;
54
+ canTrashChildren: z.ZodOptional<z.ZodBoolean>;
55
+ canUntrash: z.ZodOptional<z.ZodBoolean>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ canAddChildren?: boolean | undefined;
58
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
59
+ canChangeViewersCanCopyContent?: boolean | undefined;
60
+ canComment?: boolean | undefined;
61
+ canCopy?: boolean | undefined;
62
+ canDelete?: boolean | undefined;
63
+ canDeleteChildren?: boolean | undefined;
64
+ canDownload?: boolean | undefined;
65
+ canEdit?: boolean | undefined;
66
+ canListChildren?: boolean | undefined;
67
+ canModifyContent?: boolean | undefined;
68
+ canModifyContentRestriction?: boolean | undefined;
69
+ canMoveChildrenOutOfDrive?: boolean | undefined;
70
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
71
+ canMoveChildrenWithinDrive?: boolean | undefined;
72
+ canMoveItemIntoTeamDrive?: boolean | undefined;
73
+ canMoveItemOutOfDrive?: boolean | undefined;
74
+ canMoveItemWithinDrive?: boolean | undefined;
75
+ canReadRevisions?: boolean | undefined;
76
+ canReadTeamDrive?: boolean | undefined;
77
+ canRemoveChildren?: boolean | undefined;
78
+ canRename?: boolean | undefined;
79
+ canShare?: boolean | undefined;
80
+ canTrash?: boolean | undefined;
81
+ canTrashChildren?: boolean | undefined;
82
+ canUntrash?: boolean | undefined;
83
+ }, {
84
+ canAddChildren?: boolean | undefined;
85
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
86
+ canChangeViewersCanCopyContent?: boolean | undefined;
87
+ canComment?: boolean | undefined;
88
+ canCopy?: boolean | undefined;
89
+ canDelete?: boolean | undefined;
90
+ canDeleteChildren?: boolean | undefined;
91
+ canDownload?: boolean | undefined;
92
+ canEdit?: boolean | undefined;
93
+ canListChildren?: boolean | undefined;
94
+ canModifyContent?: boolean | undefined;
95
+ canModifyContentRestriction?: boolean | undefined;
96
+ canMoveChildrenOutOfDrive?: boolean | undefined;
97
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
98
+ canMoveChildrenWithinDrive?: boolean | undefined;
99
+ canMoveItemIntoTeamDrive?: boolean | undefined;
100
+ canMoveItemOutOfDrive?: boolean | undefined;
101
+ canMoveItemWithinDrive?: boolean | undefined;
102
+ canReadRevisions?: boolean | undefined;
103
+ canReadTeamDrive?: boolean | undefined;
104
+ canRemoveChildren?: boolean | undefined;
105
+ canRename?: boolean | undefined;
106
+ canShare?: boolean | undefined;
107
+ canTrash?: boolean | undefined;
108
+ canTrashChildren?: boolean | undefined;
109
+ canUntrash?: boolean | undefined;
110
+ }>>;
111
+ viewersCanCopyContent: z.ZodOptional<z.ZodBoolean>;
112
+ copyRequiresWriterPermission: z.ZodOptional<z.ZodBoolean>;
113
+ writersCanShare: z.ZodOptional<z.ZodBoolean>;
114
+ permissionIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
115
+ hasAugmentedPermissions: z.ZodOptional<z.ZodBoolean>;
116
+ folderColorRgb: z.ZodOptional<z.ZodString>;
117
+ originalFilename: z.ZodOptional<z.ZodString>;
118
+ fullFileExtension: z.ZodOptional<z.ZodString>;
119
+ fileExtension: z.ZodOptional<z.ZodString>;
120
+ md5Checksum: z.ZodOptional<z.ZodString>;
121
+ size: z.ZodOptional<z.ZodString>;
122
+ quotaBytesUsed: z.ZodOptional<z.ZodString>;
123
+ headRevisionId: z.ZodOptional<z.ZodString>;
124
+ isAppAuthorized: z.ZodOptional<z.ZodBoolean>;
125
+ resourceKey: z.ZodOptional<z.ZodString>;
126
+ sha1Checksum: z.ZodOptional<z.ZodString>;
127
+ sha256Checksum: z.ZodOptional<z.ZodString>;
128
+ filePath: z.ZodOptional<z.ZodString>;
129
+ createdAt: z.ZodOptional<z.ZodDate>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ id: string;
132
+ name?: string | undefined;
133
+ version?: string | undefined;
134
+ description?: string | undefined;
135
+ properties?: Record<string, string> | undefined;
136
+ spaces?: string[] | undefined;
137
+ mimeType?: string | undefined;
138
+ parents?: string[] | undefined;
139
+ starred?: boolean | undefined;
140
+ trashed?: boolean | undefined;
141
+ appProperties?: Record<string, string> | undefined;
142
+ copyRequiresWriterPermission?: boolean | undefined;
143
+ explicitlyTrashed?: boolean | undefined;
144
+ webViewLink?: string | undefined;
145
+ webContentLink?: string | undefined;
146
+ iconLink?: string | undefined;
147
+ hasThumbnail?: boolean | undefined;
148
+ thumbnailLink?: string | undefined;
149
+ thumbnailVersion?: string | undefined;
150
+ viewedByMe?: boolean | undefined;
151
+ viewedByMeTime?: string | undefined;
152
+ createdTime?: string | undefined;
153
+ modifiedTime?: string | undefined;
154
+ modifiedByMeTime?: string | undefined;
155
+ modifiedByMe?: boolean | undefined;
156
+ shared?: boolean | undefined;
157
+ ownedByMe?: boolean | undefined;
158
+ permissionIds?: string[] | undefined;
159
+ hasAugmentedPermissions?: boolean | undefined;
160
+ folderColorRgb?: string | undefined;
161
+ originalFilename?: string | undefined;
162
+ fullFileExtension?: string | undefined;
163
+ fileExtension?: string | undefined;
164
+ md5Checksum?: string | undefined;
165
+ size?: string | undefined;
166
+ quotaBytesUsed?: string | undefined;
167
+ headRevisionId?: string | undefined;
168
+ isAppAuthorized?: boolean | undefined;
169
+ resourceKey?: string | undefined;
170
+ sha1Checksum?: string | undefined;
171
+ sha256Checksum?: string | undefined;
172
+ capabilities?: {
173
+ canAddChildren?: boolean | undefined;
174
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
175
+ canChangeViewersCanCopyContent?: boolean | undefined;
176
+ canComment?: boolean | undefined;
177
+ canCopy?: boolean | undefined;
178
+ canDelete?: boolean | undefined;
179
+ canDeleteChildren?: boolean | undefined;
180
+ canDownload?: boolean | undefined;
181
+ canEdit?: boolean | undefined;
182
+ canListChildren?: boolean | undefined;
183
+ canModifyContent?: boolean | undefined;
184
+ canModifyContentRestriction?: boolean | undefined;
185
+ canMoveChildrenOutOfDrive?: boolean | undefined;
186
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
187
+ canMoveChildrenWithinDrive?: boolean | undefined;
188
+ canMoveItemIntoTeamDrive?: boolean | undefined;
189
+ canMoveItemOutOfDrive?: boolean | undefined;
190
+ canMoveItemWithinDrive?: boolean | undefined;
191
+ canReadRevisions?: boolean | undefined;
192
+ canReadTeamDrive?: boolean | undefined;
193
+ canRemoveChildren?: boolean | undefined;
194
+ canRename?: boolean | undefined;
195
+ canShare?: boolean | undefined;
196
+ canTrash?: boolean | undefined;
197
+ canTrashChildren?: boolean | undefined;
198
+ canUntrash?: boolean | undefined;
199
+ } | undefined;
200
+ viewersCanCopyContent?: boolean | undefined;
201
+ writersCanShare?: boolean | undefined;
202
+ filePath?: string | undefined;
203
+ createdAt?: Date | undefined;
204
+ }, {
205
+ id: string;
206
+ name?: string | undefined;
207
+ version?: string | undefined;
208
+ description?: string | undefined;
209
+ properties?: Record<string, string> | undefined;
210
+ spaces?: string[] | undefined;
211
+ mimeType?: string | undefined;
212
+ parents?: string[] | undefined;
213
+ starred?: boolean | undefined;
214
+ trashed?: boolean | undefined;
215
+ appProperties?: Record<string, string> | undefined;
216
+ copyRequiresWriterPermission?: boolean | undefined;
217
+ explicitlyTrashed?: boolean | undefined;
218
+ webViewLink?: string | undefined;
219
+ webContentLink?: string | undefined;
220
+ iconLink?: string | undefined;
221
+ hasThumbnail?: boolean | undefined;
222
+ thumbnailLink?: string | undefined;
223
+ thumbnailVersion?: string | undefined;
224
+ viewedByMe?: boolean | undefined;
225
+ viewedByMeTime?: string | undefined;
226
+ createdTime?: string | undefined;
227
+ modifiedTime?: string | undefined;
228
+ modifiedByMeTime?: string | undefined;
229
+ modifiedByMe?: boolean | undefined;
230
+ shared?: boolean | undefined;
231
+ ownedByMe?: boolean | undefined;
232
+ permissionIds?: string[] | undefined;
233
+ hasAugmentedPermissions?: boolean | undefined;
234
+ folderColorRgb?: string | undefined;
235
+ originalFilename?: string | undefined;
236
+ fullFileExtension?: string | undefined;
237
+ fileExtension?: string | undefined;
238
+ md5Checksum?: string | undefined;
239
+ size?: string | undefined;
240
+ quotaBytesUsed?: string | undefined;
241
+ headRevisionId?: string | undefined;
242
+ isAppAuthorized?: boolean | undefined;
243
+ resourceKey?: string | undefined;
244
+ sha1Checksum?: string | undefined;
245
+ sha256Checksum?: string | undefined;
246
+ capabilities?: {
247
+ canAddChildren?: boolean | undefined;
248
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
249
+ canChangeViewersCanCopyContent?: boolean | undefined;
250
+ canComment?: boolean | undefined;
251
+ canCopy?: boolean | undefined;
252
+ canDelete?: boolean | undefined;
253
+ canDeleteChildren?: boolean | undefined;
254
+ canDownload?: boolean | undefined;
255
+ canEdit?: boolean | undefined;
256
+ canListChildren?: boolean | undefined;
257
+ canModifyContent?: boolean | undefined;
258
+ canModifyContentRestriction?: boolean | undefined;
259
+ canMoveChildrenOutOfDrive?: boolean | undefined;
260
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
261
+ canMoveChildrenWithinDrive?: boolean | undefined;
262
+ canMoveItemIntoTeamDrive?: boolean | undefined;
263
+ canMoveItemOutOfDrive?: boolean | undefined;
264
+ canMoveItemWithinDrive?: boolean | undefined;
265
+ canReadRevisions?: boolean | undefined;
266
+ canReadTeamDrive?: boolean | undefined;
267
+ canRemoveChildren?: boolean | undefined;
268
+ canRename?: boolean | undefined;
269
+ canShare?: boolean | undefined;
270
+ canTrash?: boolean | undefined;
271
+ canTrashChildren?: boolean | undefined;
272
+ canUntrash?: boolean | undefined;
273
+ } | undefined;
274
+ viewersCanCopyContent?: boolean | undefined;
275
+ writersCanShare?: boolean | undefined;
276
+ filePath?: string | undefined;
277
+ createdAt?: Date | undefined;
278
+ }>;
279
+ export declare const GoogleDriveFolder: z.ZodObject<{
280
+ id: z.ZodString;
281
+ name: z.ZodOptional<z.ZodString>;
282
+ mimeType: z.ZodOptional<z.ZodString>;
283
+ description: z.ZodOptional<z.ZodString>;
284
+ starred: z.ZodOptional<z.ZodBoolean>;
285
+ trashed: z.ZodOptional<z.ZodBoolean>;
286
+ explicitlyTrashed: z.ZodOptional<z.ZodBoolean>;
287
+ parents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
288
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
289
+ appProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
290
+ spaces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
291
+ version: z.ZodOptional<z.ZodString>;
292
+ webViewLink: z.ZodOptional<z.ZodString>;
293
+ webContentLink: z.ZodOptional<z.ZodString>;
294
+ iconLink: z.ZodOptional<z.ZodString>;
295
+ hasThumbnail: z.ZodOptional<z.ZodBoolean>;
296
+ thumbnailLink: z.ZodOptional<z.ZodString>;
297
+ thumbnailVersion: z.ZodOptional<z.ZodString>;
298
+ viewedByMe: z.ZodOptional<z.ZodBoolean>;
299
+ viewedByMeTime: z.ZodOptional<z.ZodString>;
300
+ createdTime: z.ZodOptional<z.ZodString>;
301
+ modifiedTime: z.ZodOptional<z.ZodString>;
302
+ modifiedByMeTime: z.ZodOptional<z.ZodString>;
303
+ modifiedByMe: z.ZodOptional<z.ZodBoolean>;
304
+ shared: z.ZodOptional<z.ZodBoolean>;
305
+ ownedByMe: z.ZodOptional<z.ZodBoolean>;
306
+ capabilities: z.ZodOptional<z.ZodObject<{
307
+ canAddChildren: z.ZodOptional<z.ZodBoolean>;
308
+ canChangeCopyRequiresWriterPermission: z.ZodOptional<z.ZodBoolean>;
309
+ canChangeViewersCanCopyContent: z.ZodOptional<z.ZodBoolean>;
310
+ canComment: z.ZodOptional<z.ZodBoolean>;
311
+ canCopy: z.ZodOptional<z.ZodBoolean>;
312
+ canDelete: z.ZodOptional<z.ZodBoolean>;
313
+ canDeleteChildren: z.ZodOptional<z.ZodBoolean>;
314
+ canDownload: z.ZodOptional<z.ZodBoolean>;
315
+ canEdit: z.ZodOptional<z.ZodBoolean>;
316
+ canListChildren: z.ZodOptional<z.ZodBoolean>;
317
+ canModifyContent: z.ZodOptional<z.ZodBoolean>;
318
+ canModifyContentRestriction: z.ZodOptional<z.ZodBoolean>;
319
+ canMoveChildrenOutOfDrive: z.ZodOptional<z.ZodBoolean>;
320
+ canMoveChildrenOutOfTeamDrive: z.ZodOptional<z.ZodBoolean>;
321
+ canMoveChildrenWithinDrive: z.ZodOptional<z.ZodBoolean>;
322
+ canMoveItemIntoTeamDrive: z.ZodOptional<z.ZodBoolean>;
323
+ canMoveItemOutOfDrive: z.ZodOptional<z.ZodBoolean>;
324
+ canMoveItemWithinDrive: z.ZodOptional<z.ZodBoolean>;
325
+ canReadRevisions: z.ZodOptional<z.ZodBoolean>;
326
+ canReadTeamDrive: z.ZodOptional<z.ZodBoolean>;
327
+ canRemoveChildren: z.ZodOptional<z.ZodBoolean>;
328
+ canRename: z.ZodOptional<z.ZodBoolean>;
329
+ canShare: z.ZodOptional<z.ZodBoolean>;
330
+ canTrash: z.ZodOptional<z.ZodBoolean>;
331
+ canTrashChildren: z.ZodOptional<z.ZodBoolean>;
332
+ canUntrash: z.ZodOptional<z.ZodBoolean>;
333
+ }, "strip", z.ZodTypeAny, {
334
+ canAddChildren?: boolean | undefined;
335
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
336
+ canChangeViewersCanCopyContent?: boolean | undefined;
337
+ canComment?: boolean | undefined;
338
+ canCopy?: boolean | undefined;
339
+ canDelete?: boolean | undefined;
340
+ canDeleteChildren?: boolean | undefined;
341
+ canDownload?: boolean | undefined;
342
+ canEdit?: boolean | undefined;
343
+ canListChildren?: boolean | undefined;
344
+ canModifyContent?: boolean | undefined;
345
+ canModifyContentRestriction?: boolean | undefined;
346
+ canMoveChildrenOutOfDrive?: boolean | undefined;
347
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
348
+ canMoveChildrenWithinDrive?: boolean | undefined;
349
+ canMoveItemIntoTeamDrive?: boolean | undefined;
350
+ canMoveItemOutOfDrive?: boolean | undefined;
351
+ canMoveItemWithinDrive?: boolean | undefined;
352
+ canReadRevisions?: boolean | undefined;
353
+ canReadTeamDrive?: boolean | undefined;
354
+ canRemoveChildren?: boolean | undefined;
355
+ canRename?: boolean | undefined;
356
+ canShare?: boolean | undefined;
357
+ canTrash?: boolean | undefined;
358
+ canTrashChildren?: boolean | undefined;
359
+ canUntrash?: boolean | undefined;
360
+ }, {
361
+ canAddChildren?: boolean | undefined;
362
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
363
+ canChangeViewersCanCopyContent?: boolean | undefined;
364
+ canComment?: boolean | undefined;
365
+ canCopy?: boolean | undefined;
366
+ canDelete?: boolean | undefined;
367
+ canDeleteChildren?: boolean | undefined;
368
+ canDownload?: boolean | undefined;
369
+ canEdit?: boolean | undefined;
370
+ canListChildren?: boolean | undefined;
371
+ canModifyContent?: boolean | undefined;
372
+ canModifyContentRestriction?: boolean | undefined;
373
+ canMoveChildrenOutOfDrive?: boolean | undefined;
374
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
375
+ canMoveChildrenWithinDrive?: boolean | undefined;
376
+ canMoveItemIntoTeamDrive?: boolean | undefined;
377
+ canMoveItemOutOfDrive?: boolean | undefined;
378
+ canMoveItemWithinDrive?: boolean | undefined;
379
+ canReadRevisions?: boolean | undefined;
380
+ canReadTeamDrive?: boolean | undefined;
381
+ canRemoveChildren?: boolean | undefined;
382
+ canRename?: boolean | undefined;
383
+ canShare?: boolean | undefined;
384
+ canTrash?: boolean | undefined;
385
+ canTrashChildren?: boolean | undefined;
386
+ canUntrash?: boolean | undefined;
387
+ }>>;
388
+ viewersCanCopyContent: z.ZodOptional<z.ZodBoolean>;
389
+ copyRequiresWriterPermission: z.ZodOptional<z.ZodBoolean>;
390
+ writersCanShare: z.ZodOptional<z.ZodBoolean>;
391
+ permissionIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
392
+ hasAugmentedPermissions: z.ZodOptional<z.ZodBoolean>;
393
+ folderColorRgb: z.ZodOptional<z.ZodString>;
394
+ filePath: z.ZodOptional<z.ZodString>;
395
+ createdAt: z.ZodOptional<z.ZodDate>;
396
+ }, "strip", z.ZodTypeAny, {
397
+ id: string;
398
+ name?: string | undefined;
399
+ version?: string | undefined;
400
+ description?: string | undefined;
401
+ properties?: Record<string, string> | undefined;
402
+ spaces?: string[] | undefined;
403
+ mimeType?: string | undefined;
404
+ parents?: string[] | undefined;
405
+ starred?: boolean | undefined;
406
+ trashed?: boolean | undefined;
407
+ appProperties?: Record<string, string> | undefined;
408
+ copyRequiresWriterPermission?: boolean | undefined;
409
+ explicitlyTrashed?: boolean | undefined;
410
+ webViewLink?: string | undefined;
411
+ webContentLink?: string | undefined;
412
+ iconLink?: string | undefined;
413
+ hasThumbnail?: boolean | undefined;
414
+ thumbnailLink?: string | undefined;
415
+ thumbnailVersion?: string | undefined;
416
+ viewedByMe?: boolean | undefined;
417
+ viewedByMeTime?: string | undefined;
418
+ createdTime?: string | undefined;
419
+ modifiedTime?: string | undefined;
420
+ modifiedByMeTime?: string | undefined;
421
+ modifiedByMe?: boolean | undefined;
422
+ shared?: boolean | undefined;
423
+ ownedByMe?: boolean | undefined;
424
+ permissionIds?: string[] | undefined;
425
+ hasAugmentedPermissions?: boolean | undefined;
426
+ folderColorRgb?: string | undefined;
427
+ capabilities?: {
428
+ canAddChildren?: boolean | undefined;
429
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
430
+ canChangeViewersCanCopyContent?: boolean | undefined;
431
+ canComment?: boolean | undefined;
432
+ canCopy?: boolean | undefined;
433
+ canDelete?: boolean | undefined;
434
+ canDeleteChildren?: boolean | undefined;
435
+ canDownload?: boolean | undefined;
436
+ canEdit?: boolean | undefined;
437
+ canListChildren?: boolean | undefined;
438
+ canModifyContent?: boolean | undefined;
439
+ canModifyContentRestriction?: boolean | undefined;
440
+ canMoveChildrenOutOfDrive?: boolean | undefined;
441
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
442
+ canMoveChildrenWithinDrive?: boolean | undefined;
443
+ canMoveItemIntoTeamDrive?: boolean | undefined;
444
+ canMoveItemOutOfDrive?: boolean | undefined;
445
+ canMoveItemWithinDrive?: boolean | undefined;
446
+ canReadRevisions?: boolean | undefined;
447
+ canReadTeamDrive?: boolean | undefined;
448
+ canRemoveChildren?: boolean | undefined;
449
+ canRename?: boolean | undefined;
450
+ canShare?: boolean | undefined;
451
+ canTrash?: boolean | undefined;
452
+ canTrashChildren?: boolean | undefined;
453
+ canUntrash?: boolean | undefined;
454
+ } | undefined;
455
+ viewersCanCopyContent?: boolean | undefined;
456
+ writersCanShare?: boolean | undefined;
457
+ filePath?: string | undefined;
458
+ createdAt?: Date | undefined;
459
+ }, {
460
+ id: string;
461
+ name?: string | undefined;
462
+ version?: string | undefined;
463
+ description?: string | undefined;
464
+ properties?: Record<string, string> | undefined;
465
+ spaces?: string[] | undefined;
466
+ mimeType?: string | undefined;
467
+ parents?: string[] | undefined;
468
+ starred?: boolean | undefined;
469
+ trashed?: boolean | undefined;
470
+ appProperties?: Record<string, string> | undefined;
471
+ copyRequiresWriterPermission?: boolean | undefined;
472
+ explicitlyTrashed?: boolean | undefined;
473
+ webViewLink?: string | undefined;
474
+ webContentLink?: string | undefined;
475
+ iconLink?: string | undefined;
476
+ hasThumbnail?: boolean | undefined;
477
+ thumbnailLink?: string | undefined;
478
+ thumbnailVersion?: string | undefined;
479
+ viewedByMe?: boolean | undefined;
480
+ viewedByMeTime?: string | undefined;
481
+ createdTime?: string | undefined;
482
+ modifiedTime?: string | undefined;
483
+ modifiedByMeTime?: string | undefined;
484
+ modifiedByMe?: boolean | undefined;
485
+ shared?: boolean | undefined;
486
+ ownedByMe?: boolean | undefined;
487
+ permissionIds?: string[] | undefined;
488
+ hasAugmentedPermissions?: boolean | undefined;
489
+ folderColorRgb?: string | undefined;
490
+ capabilities?: {
491
+ canAddChildren?: boolean | undefined;
492
+ canChangeCopyRequiresWriterPermission?: boolean | undefined;
493
+ canChangeViewersCanCopyContent?: boolean | undefined;
494
+ canComment?: boolean | undefined;
495
+ canCopy?: boolean | undefined;
496
+ canDelete?: boolean | undefined;
497
+ canDeleteChildren?: boolean | undefined;
498
+ canDownload?: boolean | undefined;
499
+ canEdit?: boolean | undefined;
500
+ canListChildren?: boolean | undefined;
501
+ canModifyContent?: boolean | undefined;
502
+ canModifyContentRestriction?: boolean | undefined;
503
+ canMoveChildrenOutOfDrive?: boolean | undefined;
504
+ canMoveChildrenOutOfTeamDrive?: boolean | undefined;
505
+ canMoveChildrenWithinDrive?: boolean | undefined;
506
+ canMoveItemIntoTeamDrive?: boolean | undefined;
507
+ canMoveItemOutOfDrive?: boolean | undefined;
508
+ canMoveItemWithinDrive?: boolean | undefined;
509
+ canReadRevisions?: boolean | undefined;
510
+ canReadTeamDrive?: boolean | undefined;
511
+ canRemoveChildren?: boolean | undefined;
512
+ canRename?: boolean | undefined;
513
+ canShare?: boolean | undefined;
514
+ canTrash?: boolean | undefined;
515
+ canTrashChildren?: boolean | undefined;
516
+ canUntrash?: boolean | undefined;
517
+ } | undefined;
518
+ viewersCanCopyContent?: boolean | undefined;
519
+ writersCanShare?: boolean | undefined;
520
+ filePath?: string | undefined;
521
+ createdAt?: Date | undefined;
522
+ }>;
523
+ export declare const GoogleDriveSharedDrive: z.ZodObject<{
524
+ id: z.ZodString;
525
+ name: z.ZodOptional<z.ZodString>;
526
+ themeId: z.ZodOptional<z.ZodString>;
527
+ colorRgb: z.ZodOptional<z.ZodString>;
528
+ createdTime: z.ZodOptional<z.ZodString>;
529
+ hidden: z.ZodOptional<z.ZodBoolean>;
530
+ createdAt: z.ZodOptional<z.ZodDate>;
531
+ }, "strip", z.ZodTypeAny, {
532
+ id: string;
533
+ name?: string | undefined;
534
+ themeId?: string | undefined;
535
+ colorRgb?: string | undefined;
536
+ createdTime?: string | undefined;
537
+ hidden?: boolean | undefined;
538
+ createdAt?: Date | undefined;
539
+ }, {
540
+ id: string;
541
+ name?: string | undefined;
542
+ themeId?: string | undefined;
543
+ colorRgb?: string | undefined;
544
+ createdTime?: string | undefined;
545
+ hidden?: boolean | undefined;
546
+ createdAt?: Date | undefined;
547
+ }>;
548
+ export type GoogleDriveFile = z.infer<typeof GoogleDriveFile>;
549
+ export type GoogleDriveFolder = z.infer<typeof GoogleDriveFolder>;
550
+ export type GoogleDriveSharedDrive = z.infer<typeof GoogleDriveSharedDrive>;
551
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../schema/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+C1B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoC5B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;EAQjC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}