@opencloud-eu/web-client 2.4.0 → 3.2.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.
Files changed (33) hide show
  1. package/dist/functions-CYOnwClV.js +1178 -0
  2. package/dist/functions-DEaUzlbB.cjs +1 -0
  3. package/dist/{index-sA0pvHeb.cjs → index-B3tdq56F.cjs} +1 -1
  4. package/dist/{index-DcTD5HFk.js → index-BTGj2rHD.js} +69 -67
  5. package/dist/{index-43W1CNwK.cjs → index-C-U4KVPG.cjs} +5 -5
  6. package/dist/index-D3QfKFAH.cjs +1 -0
  7. package/dist/{index-BEuG72fj.js → index-DxUgq3ag.js} +2 -2
  8. package/dist/index-oCdLZPEA.js +699 -0
  9. package/dist/src/graph/drives/types.d.ts +16 -7
  10. package/dist/src/graph/generated/api.d.ts +333 -24
  11. package/dist/src/graph/generated/configuration.d.ts +1 -1
  12. package/dist/src/graph/generated/index.d.ts +1 -1
  13. package/dist/src/graph/index.d.ts +2 -0
  14. package/dist/src/graph/permissions/types.d.ts +3 -0
  15. package/dist/src/graph/photos/index.d.ts +2 -0
  16. package/dist/src/graph/photos/photo.d.ts +3 -0
  17. package/dist/src/graph/photos/types.d.ts +7 -0
  18. package/dist/src/graph/types.d.ts +2 -1
  19. package/dist/src/helpers/space/functions.d.ts +4 -6
  20. package/dist/src/helpers/space/types.d.ts +3 -8
  21. package/dist/web-client/graph/generated.cjs +1 -1
  22. package/dist/web-client/graph/generated.js +2071 -1731
  23. package/dist/web-client/graph.cjs +1 -1
  24. package/dist/web-client/graph.js +1 -1
  25. package/dist/web-client/webdav.cjs +1 -1
  26. package/dist/web-client/webdav.js +3 -3
  27. package/dist/web-client.cjs +1 -1
  28. package/dist/web-client.js +35 -36
  29. package/package.json +2 -2
  30. package/dist/functions-DJR5h-q5.cjs +0 -1
  31. package/dist/functions-l5kdzi5h.js +0 -1230
  32. package/dist/index-Cjn81zI6.cjs +0 -1
  33. package/dist/index-mFyj5iN2.js +0 -670
@@ -1 +0,0 @@
1
- "use strict";const y=require("./web-client/graph/generated.cjs"),b=require("./toString-hHr716Th.cjs"),o=require("./functions-DJR5h-q5.cjs"),N=({axiosClient:e,config:n})=>{const l=y.UserApiFactory(n,n.basePath,e),c=y.UsersApiFactory(n,n.basePath,e),i=y.MeUserApiFactory(n,n.basePath,e),r=y.MeChangepasswordApiFactory(n,n.basePath,e),t=y.UserAppRoleAssignmentApiFactory(n,n.basePath,e);return{async getUser(a,s,u){const{data:d}=await l.getUser(a,s!=null&&s.select?new Set([...s.select]):null,s!=null&&s.expand?new Set([...s.expand]):new Set(["drive","memberOf","appRoleAssignments"]),u);return d},async createUser(a,s){const{data:u}=await c.createUser(a,s);return u},async editUser(a,s,u){const{data:d}=await l.updateUser(a,s,u);return d},async deleteUser(a,s,u){await l.deleteUser(a,s,u)},async listUsers(a,s){const{data:{value:u}}=await c.listUsers(a==null?void 0:a.search,a==null?void 0:a.filter,a!=null&&a.orderBy?new Set([...a.orderBy]):null,a!=null&&a.select?new Set([...a.select]):null,a!=null&&a.expand?new Set([...a.expand]):null,s);return u},async getMe(a,s){const{data:u}=await i.getOwnUser(a!=null&&a.expand?new Set([...a.expand]):new Set(["memberOf"]),s);return u},async editMe(a,s){const{data:u}=await i.updateOwnUser(a,s);return u},async changeOwnPassword(a,s){await r.changeOwnPassword(a,s)},async exportPersonalData(a,s,u){await l.exportPersonalData(a,s,u)},async createUserAppRoleAssignment(a,s,u){const{data:d}=await t.userCreateAppRoleAssignments(a,s,u);return d}}},E=({axiosClient:e,config:n})=>{const l=y.GroupApiFactory(n,n.basePath,e),c=y.GroupsApiFactory(n,n.basePath,e);return{async getGroup(i,r,t){const{data:a}=await l.getGroup(i,r!=null&&r.select?new Set([...r.select]):null,r!=null&&r.expand?new Set([...r.expand]):new Set(["members"]),t);return a},async createGroup(i,r){const{data:t}=await c.createGroup(i,r);return t},async editGroup(i,r,t){const{data:a}=await l.updateGroup(i,r,t);return a},async deleteGroup(i,r,t){await l.deleteGroup(i,r,t)},async listGroups(i,r){const{data:{value:t}}=await c.listGroups(i==null?void 0:i.search,i!=null&&i.orderBy?new Set([...i.orderBy]):null,i!=null&&i.select?new Set([...i.select]):null,i!=null&&i.expand?new Set([...i.expand]):null,r);return t},async addMember(i,r,t){await l.addMember(i,{"@odata.id":b.urlJoin(n.basePath,"v1.0","users",r)},t)},async deleteMember(i,r,t,a){await l.deleteMember(i,r,t,a)}}},L=({axiosClient:e,config:n})=>{const l=y.ApplicationsApiFactory(n,n.basePath,e);return{async getApplication(c,i){const{data:r}=await l.getApplication(c,i);return r},async listApplications(c){const{data:{value:i}}=await l.listApplications(c);return i||[]}}};function x(){}var P=b.getNative(b.root,"Set");function k(e){var n=-1,l=Array(e.size);return e.forEach(function(c){l[++n]=c}),l}var W=1/0,z=P&&1/k(new P([,-0]))[1]==W?function(e){return new P(e)}:x,j=200;function J(e,n,l){var c=-1,i=o.arrayIncludes,r=e.length,t=!0,a=[],s=a;if(r>=j){var u=z(e);if(u)return k(u);t=!1,i=o.cacheHas,s=new o.SetCache}else s=a;e:for(;++c<r;){var d=e[c],h=d;if(d=d!==0?d:0,t&&h===h){for(var m=s.length;m--;)if(s[m]===h)continue e;a.push(d)}else i(s,h,l)||(s!==a&&s.push(h),a.push(d))}return a}function _(e){return e&&e.length?J(e):[]}const U=e=>Object.hasOwn(e,"sharedWith"),O=e=>U(e)&&e.outgoing,H=e=>U(e)&&!e.outgoing,Y=e=>Object.hasOwn(e,"role"),Q=e=>!Object.hasOwn(e,"role"),M=({driveItem:e,graphRoles:n})=>{var l;return(l=e.remoteItem)==null?void 0:l.permissions.reduce((c,i)=>{var r;return(r=i.roles)==null||r.forEach(t=>{const a=n[t];a&&!c.some(({id:s})=>s===a.id)&&c.push(a)}),c},[])},G=({driveItem:e,shareRoles:n})=>{var c;if(!n.length){const i=(c=e.remoteItem)==null?void 0:c.permissions.reduce((r,t)=>{const a=t["@libre.graph.permissions.actions"];return a&&r.push(...a),r},[]);return[...new Set(i)]}const l=n.reduce((i,r)=>(r.rolePermissions.forEach(t=>{i.push(...t.allowedResourceActions)}),i),[]);return[...new Set(l)]};function Z({driveItem:e,graphRoles:n,serverUrl:l}){var m,p,R,w;const c=e.name||e.remoteItem.name,i=o.extractStorageId(e.remoteItem.id),r=e.remoteItem.permissions.map(S=>{const{grantedToV2:v}=S;return{...v.group||v.user,shareType:f(S)}}),t=e.remoteItem.permissions.reduce((S,v)=>{const F=v.invitation.invitedBy.user;return S.some(({id:B})=>B===F.id)||S.push(F),S},[]);let a=_(e.remoteItem.permissions.map(f));t.some(S=>S["@libre.graph.userType"]==="Federated")&&(a=[o.ShareTypes.remote.value]);const u=M({driveItem:e,graphRoles:n}),d=G({driveItem:e,shareRoles:u}),h={id:e.id,remoteItemId:e.remoteItem.id,driveId:(m=e.parentReference)==null?void 0:m.driveId,path:"/",name:c,fileId:e.remoteItem.id,size:e.size,storageId:i,parentFolderId:(p=e.parentReference)==null?void 0:p.id,sdate:e.remoteItem.permissions[0].createdDateTime,tags:[],webDavPath:o.buildWebDavSpacesPath(e.remoteItem.id,"/"),sharedBy:t,owner:(R=e.remoteItem.createdBy)==null?void 0:R.user,sharedWith:r,shareTypes:a,isFolder:!!e.folder,type:e.folder?"folder":"file",mimeType:((w=e.file)==null?void 0:w.mimeType)||"httpd/unix-directory",mdate:e.lastModifiedDateTime?new Date(e.lastModifiedDateTime).toUTCString():void 0,syncEnabled:e["@client.synchronize"],hidden:e["@UI.Hidden"],shareRoles:u,sharePermissions:d,outgoing:!1,privateLink:b.urlJoin(l,"f",e.remoteItem.id),canRename:()=>e["@client.synchronize"],canDownload:()=>d.includes(o.GraphSharePermission.readContent),canUpload:()=>d.includes(o.GraphSharePermission.createUpload),canCreate:()=>d.includes(o.GraphSharePermission.createChildren),canBeDeleted:()=>d.includes(o.GraphSharePermission.deleteStandard),canEditTags:()=>d.includes(o.GraphSharePermission.createChildren),isMounted:()=>!1,isReceivedShare:()=>!0,canShare:()=>!1,canDeny:()=>!1,getDomSelector:()=>o.extractDomSelector(e.id)};return h.extension=o.extractExtensionFromFile(h),h}function $({driveItem:e,user:n,serverUrl:l}){var t,a,s;const c=o.extractStorageId(e.id),i=b.urlJoin(e.parentReference.path,e.name),r={id:e.id,driveId:(t=e.parentReference)==null?void 0:t.driveId,path:i,name:e.name,fileId:e.id,size:e.size,storageId:c,parentFolderId:(a=e.parentReference)==null?void 0:a.id,sdate:e.permissions[0].createdDateTime,tags:[],webDavPath:o.buildWebDavSpacesPath(c,i),sharedBy:[{id:n.id,displayName:n.displayName}],owner:{id:n.id,displayName:n.displayName},sharedWith:e.permissions.map(u=>{if(u.link)return{id:u.id,displayName:u.link["@libre.graph.displayName"],shareType:o.ShareTypes.link.value};const d=f(u);return{...u.grantedToV2.user||u.grantedToV2.group,shareType:d}}),shareTypes:e.permissions.map(f),isFolder:!!e.folder,type:e.folder?"folder":"file",mimeType:((s=e.file)==null?void 0:s.mimeType)||"httpd/unix-directory",outgoing:!0,privateLink:b.urlJoin(l,"f",e.id),canRename:()=>!0,canDownload:()=>!0,canUpload:()=>!0,canCreate:()=>!0,canBeDeleted:()=>!0,canEditTags:()=>!0,isMounted:()=>!1,isReceivedShare:()=>!0,canShare:()=>!0,canDeny:()=>!0,getDomSelector:()=>o.extractDomSelector(e.id)};return r.extension=o.extractExtensionFromFile(r),r}function A({graphPermission:e,graphRoles:n,resourceId:l,indirect:c=!1}){var t,a,s;const i=n[(t=e.roles)==null?void 0:t[0]],r=(s=(a=e.invitation)==null?void 0:a.invitedBy)==null?void 0:s.user;return{id:e.id,resourceId:l,indirect:c,shareType:f(e),role:i,sharedBy:{id:r==null?void 0:r.id,displayName:r==null?void 0:r.displayName},sharedWith:e.grantedToV2.user||e.grantedToV2.group,permissions:e["@libre.graph.permissions.actions"]?e["@libre.graph.permissions.actions"]:i.rolePermissions.flatMap(u=>u.allowedResourceActions),createdDateTime:e.createdDateTime,expirationDateTime:e.expirationDateTime}}function g({graphPermission:e,resourceId:n,indirect:l=!1}){var i,r;const c=(r=(i=e.invitation)==null?void 0:i.invitedBy)==null?void 0:r.user;return{id:e.id,resourceId:n,indirect:l,shareType:o.ShareTypes.link.value,sharedBy:{id:c==null?void 0:c.id,displayName:c==null?void 0:c.displayName},hasPassword:e.hasPassword,createdDateTime:e.createdDateTime,expirationDateTime:e.expirationDateTime,displayName:e.link["@libre.graph.displayName"],isQuickLink:e.link["@libre.graph.quickLink"],type:e.link.type,webUrl:e.link.webUrl,preventsDownload:e.link.preventsDownload}}function f({link:e,grantedToV2:n}){var l;return e?o.ShareTypes.link.value:n!=null&&n.group?o.ShareTypes.group.value:((l=n==null?void 0:n.user)==null?void 0:l["@libre.graph.userType"])==="Federated"?o.ShareTypes.remote.value:o.ShareTypes.user.value}const D=e=>new URL(e.webUrl).origin,K={manager:"312c0871-5ef7-4b3a-85b6-0e4074c64049",editor:"58c63c02-1d89-4572-916a-870abc5a1b7d",viewer:"a8d5fe5e-96e3-418d-825b-534dbdf22b99"},T=e=>{var n,l;return(l=(n=e.root)==null?void 0:n.permissions)==null||l.forEach(c=>{var r;c.grantedToV2=c.grantedToV2||((r=c.grantedToIdentities)==null?void 0:r[0]),delete c.grantedToIdentities;const i=c.roles[0];i&&(c.roles[0]=K[i])}),e},V=({axiosClient:e,config:n})=>{const l=y.DrivesApiFactory(n,n.basePath,e),c=new y.MeDrivesApi(n,n.basePath,e),i=new y.DrivesGetDrivesApi(n,n.basePath,e);return{async getDrive(r,t,a){let{data:s}=await l.getDrive(r,a);return s=T(s),o.buildSpace({...s,serverUrl:D(s)},t)},async createDrive(r,t,a){let{data:s}=await l.createDrive(r,a);return s=T(s),o.buildSpace({...s,serverUrl:D(s)},t)},async updateDrive(r,t,a,s){let{data:u}=await l.updateDrive(r,t,s);return u=T(u),o.buildSpace({...u,serverUrl:D(u)},a)},async disableDrive(r,t,a){await l.deleteDrive(r,t,a)},async deleteDrive(r,t,a){await l.deleteDrive(r,t,{headers:{...(a==null?void 0:a.headers)&&a.headers||{},Purge:"T"},...a&&{requestOptions:a}||{}})},async listMyDrives(r,t,a){const{data:{value:s}}=await c.listMyDrivesBeta(t==null?void 0:t.orderBy,t==null?void 0:t.filter,a);return s.map(u=>o.buildSpace({...u,serverUrl:D(u)},r))},async listAllDrives(r,t,a){const{data:{value:s}}=await i.listAllDrivesBeta(t==null?void 0:t.orderBy,t==null?void 0:t.filter,a);return s.map(u=>o.buildSpace({...u,serverUrl:D(u)},r))}}},X=({axiosClient:e,config:n})=>{const l=y.DriveItemApiFactory(n,n.basePath,e),c=y.DrivesRootApiFactory(n,n.basePath,e),i=y.MeDriveApiFactory(n,n.basePath,e);return{async getDriveItem(r,t,a){const{data:s}=await l.getDriveItem(r,t,a);return s},async createDriveItem(r,t,a){const{data:s}=await c.createDriveItem(r,t,a);return s},async updateDriveItem(r,t,a,s){const{data:u}=await l.updateDriveItem(r,t,a,s);return u},async deleteDriveItem(r,t,a){await l.deleteDriveItem(r,t,a)},async listSharedByMe(r){const{data:t}=await i.listSharedByMe(r);return(t==null?void 0:t.value)||[]},async listSharedWithMe(r){const{data:t}=await i.listSharedWithMe(r);return(t==null?void 0:t.value)||[]}}},C=({axiosClient:e,config:n})=>{const l=y.TagsApiFactory(n,n.basePath,e);return{async listTags(c){const{data:{value:i}}=await l.getTags(c);return i||[]},async assignTags(c,i){await l.assignTags(c,i)},async unassignTags(c,i){await l.unassignTags(c,i)}}},q=({axiosClient:e,config:n})=>{const l=y.ActivitiesApiFactory(n,n.basePath,e);return{async listActivities(c,i){const{data:{value:r}}=await l.getActivities(c,i);return r||[]}}},I=({axiosClient:e,config:n})=>{const l=y.DrivesRootApiFactory(n,n.basePath,e),c=y.RoleManagementApiFactory(n,n.basePath,e),i=y.DrivesPermissionsApiFactory(n,n.basePath,e);return{async getPermission(r,t,a,s,u){const{data:d}=await i.getPermission(r,t,a,u);return d.link?g({graphPermission:d,resourceId:t}):A({graphPermission:d,resourceId:t,graphRoles:s||{}})},async listPermissions(r,t,a,s,u){let d;if(r===t){const{data:w}=await l.listPermissionsSpaceRoot(r,s==null?void 0:s.filter,s!=null&&s.select?new Set([...s.select]):null,u);d=w}else{const{data:w}=await i.listPermissions(r,t,s==null?void 0:s.filter,s!=null&&s.select?new Set([...s.select]):null,u);d=w}const h=d.value||[],m=d["@libre.graph.permissions.actions.allowedValues"],p=d["@libre.graph.permissions.roles.allowedValues"];return{shares:h.map(w=>w.link?g({graphPermission:w,resourceId:t}):A({graphPermission:w,resourceId:t,graphRoles:a||{}})),allowedActions:m,allowedRoles:p}},async updatePermission(r,t,a,s,u,d){let h;if(r===t){const{data:m}=await l.updatePermissionSpaceRoot(r,a,s,d);h=m}else{const{data:m}=await i.updatePermission(r,t,a,s,d);h=m}return h.link?g({graphPermission:h,resourceId:t}):A({graphPermission:h,resourceId:t,graphRoles:u||{}})},async deletePermission(r,t,a,s){if(r===t){await l.deletePermissionSpaceRoot(r,a,s);return}await i.deletePermission(r,t,a,s)},async createInvite(r,t,a,s,u){var h,m;let d;if(r===t){const{data:p}=await l.inviteSpaceRoot(r,a,u);d=(h=p.value)==null?void 0:h[0]}else{const{data:p}=await i.invite(r,t,a,u);d=(m=p.value)==null?void 0:m[0]}if(!d)throw new Error("no permission returned");return A({graphPermission:d,resourceId:t,graphRoles:s||{}})},async createLink(r,t,a,s){let u;if(r===t){const{data:d}=await l.createLinkSpaceRoot(r,a,s);u=d}else{const{data:d}=await i.createLink(r,t,a,s);u=d}return g({graphPermission:u,resourceId:t})},async setPermissionPassword(r,t,a,s,u){let d;if(r===t){const{data:h}=await l.setPermissionPasswordSpaceRoot(r,a,s,u);d=h}else{const{data:h}=await i.setPermissionPassword(r,t,a,s,u);d=h}return g({graphPermission:d,resourceId:t})},async listRoleDefinitions(r){const{data:t}=await c.listPermissionRoleDefinitions(r);return t}}},ee=(e,n)=>{const l=new URL(e);l.pathname=[...l.pathname.split("/"),"graph"].filter(Boolean).join("/");const c=new y.Configuration({basePath:l.href});return{activities:q({axiosClient:n,config:c}),applications:L({axiosClient:n,config:c}),tags:C({axiosClient:n,config:c}),drives:V({axiosClient:n,config:c}),driveItems:X({axiosClient:n,config:c}),users:N({axiosClient:n,config:c}),groups:E({axiosClient:n,config:c}),permissions:I({axiosClient:n,config:c})}};exports.buildCollaboratorShare=A;exports.buildIncomingShareResource=Z;exports.buildLinkShare=g;exports.buildOutgoingShareResource=$;exports.getShareResourcePermissions=G;exports.getShareResourceRoles=M;exports.graph=ee;exports.isCollaboratorShare=Y;exports.isIncomingShareResource=H;exports.isLinkShare=Q;exports.isOutgoingShareResource=O;exports.isShareResource=U;
@@ -1,670 +0,0 @@
1
- import { UserApiFactory as z, UsersApiFactory as W, MeUserApiFactory as j, MeChangepasswordApiFactory as H, UserAppRoleAssignmentApiFactory as Y, GroupApiFactory as _, GroupsApiFactory as J, ApplicationsApiFactory as O, DrivesApiFactory as Q, MeDrivesApi as Z, DrivesGetDrivesApi as $, DriveItemApiFactory as K, DrivesRootApiFactory as k, MeDriveApiFactory as V, TagsApiFactory as X, ActivitiesApiFactory as C, RoleManagementApiFactory as q, DrivesPermissionsApiFactory as I, Configuration as ee } from "./web-client/graph/generated.js";
2
- import { u as F, g as ae, r as re } from "./toString-Cn0xCZ28.js";
3
- import { E as te, F as se, H as ne, d as M, n as p, o as G, h as B, e as N, G as D, u as g } from "./functions-l5kdzi5h.js";
4
- const ce = ({ axiosClient: e, config: n }) => {
5
- const l = z(n, n.basePath, e), i = W(n, n.basePath, e), c = j(n, n.basePath, e), r = H(
6
- n,
7
- n.basePath,
8
- e
9
- ), t = Y(
10
- n,
11
- n.basePath,
12
- e
13
- );
14
- return {
15
- async getUser(a, s, u) {
16
- const { data: d } = await l.getUser(
17
- a,
18
- s != null && s.select ? /* @__PURE__ */ new Set([...s.select]) : null,
19
- s != null && s.expand ? /* @__PURE__ */ new Set([...s.expand]) : /* @__PURE__ */ new Set(["drive", "memberOf", "appRoleAssignments"]),
20
- u
21
- );
22
- return d;
23
- },
24
- async createUser(a, s) {
25
- const { data: u } = await i.createUser(a, s);
26
- return u;
27
- },
28
- async editUser(a, s, u) {
29
- const { data: d } = await l.updateUser(a, s, u);
30
- return d;
31
- },
32
- async deleteUser(a, s, u) {
33
- await l.deleteUser(a, s, u);
34
- },
35
- async listUsers(a, s) {
36
- const {
37
- data: { value: u }
38
- } = await i.listUsers(
39
- a == null ? void 0 : a.search,
40
- a == null ? void 0 : a.filter,
41
- a != null && a.orderBy ? /* @__PURE__ */ new Set([...a.orderBy]) : null,
42
- a != null && a.select ? /* @__PURE__ */ new Set([...a.select]) : null,
43
- a != null && a.expand ? /* @__PURE__ */ new Set([...a.expand]) : null,
44
- s
45
- );
46
- return u;
47
- },
48
- async getMe(a, s) {
49
- const { data: u } = await c.getOwnUser(
50
- a != null && a.expand ? /* @__PURE__ */ new Set([...a.expand]) : /* @__PURE__ */ new Set(["memberOf"]),
51
- s
52
- );
53
- return u;
54
- },
55
- async editMe(a, s) {
56
- const { data: u } = await c.updateOwnUser(a, s);
57
- return u;
58
- },
59
- async changeOwnPassword(a, s) {
60
- await r.changeOwnPassword(a, s);
61
- },
62
- async exportPersonalData(a, s, u) {
63
- await l.exportPersonalData(a, s, u);
64
- },
65
- async createUserAppRoleAssignment(a, s, u) {
66
- const { data: d } = await t.userCreateAppRoleAssignments(
67
- a,
68
- s,
69
- u
70
- );
71
- return d;
72
- }
73
- };
74
- }, ie = ({ axiosClient: e, config: n }) => {
75
- const l = _(n, n.basePath, e), i = J(n, n.basePath, e);
76
- return {
77
- async getGroup(c, r, t) {
78
- const { data: a } = await l.getGroup(
79
- c,
80
- r != null && r.select ? /* @__PURE__ */ new Set([...r.select]) : null,
81
- r != null && r.expand ? /* @__PURE__ */ new Set([...r.expand]) : /* @__PURE__ */ new Set(["members"]),
82
- t
83
- );
84
- return a;
85
- },
86
- async createGroup(c, r) {
87
- const { data: t } = await i.createGroup(c, r);
88
- return t;
89
- },
90
- async editGroup(c, r, t) {
91
- const { data: a } = await l.updateGroup(c, r, t);
92
- return a;
93
- },
94
- async deleteGroup(c, r, t) {
95
- await l.deleteGroup(c, r, t);
96
- },
97
- async listGroups(c, r) {
98
- const {
99
- data: { value: t }
100
- } = await i.listGroups(
101
- c == null ? void 0 : c.search,
102
- c != null && c.orderBy ? /* @__PURE__ */ new Set([...c.orderBy]) : null,
103
- c != null && c.select ? /* @__PURE__ */ new Set([...c.select]) : null,
104
- c != null && c.expand ? /* @__PURE__ */ new Set([...c.expand]) : null,
105
- r
106
- );
107
- return t;
108
- },
109
- async addMember(c, r, t) {
110
- await l.addMember(
111
- c,
112
- { "@odata.id": F(n.basePath, "v1.0", "users", r) },
113
- t
114
- );
115
- },
116
- async deleteMember(c, r, t, a) {
117
- await l.deleteMember(c, r, t, a);
118
- }
119
- };
120
- }, le = ({
121
- axiosClient: e,
122
- config: n
123
- }) => {
124
- const l = O(n, n.basePath, e);
125
- return {
126
- async getApplication(i, c) {
127
- const { data: r } = await l.getApplication(i, c);
128
- return r;
129
- },
130
- async listApplications(i) {
131
- const {
132
- data: { value: c }
133
- } = await l.listApplications(i);
134
- return c || [];
135
- }
136
- };
137
- };
138
- function ue() {
139
- }
140
- var T = ae(re, "Set");
141
- function E(e) {
142
- var n = -1, l = Array(e.size);
143
- return e.forEach(function(i) {
144
- l[++n] = i;
145
- }), l;
146
- }
147
- var de = 1 / 0, oe = T && 1 / E(new T([, -0]))[1] == de ? function(e) {
148
- return new T(e);
149
- } : ue, ye = 200;
150
- function he(e, n, l) {
151
- var i = -1, c = se, r = e.length, t = !0, a = [], s = a;
152
- if (r >= ye) {
153
- var u = oe(e);
154
- if (u)
155
- return E(u);
156
- t = !1, c = ne, s = new te();
157
- } else
158
- s = a;
159
- e:
160
- for (; ++i < r; ) {
161
- var d = e[i], o = d;
162
- if (d = d !== 0 ? d : 0, t && o === o) {
163
- for (var y = s.length; y--; )
164
- if (s[y] === o)
165
- continue e;
166
- a.push(d);
167
- } else c(s, o, l) || (s !== a && s.push(o), a.push(d));
168
- }
169
- return a;
170
- }
171
- function me(e) {
172
- return e && e.length ? he(e) : [];
173
- }
174
- const L = (e) => Object.hasOwn(e, "sharedWith"), Re = (e) => L(e) && e.outgoing, Te = (e) => L(e) && !e.outgoing, Ue = (e) => Object.hasOwn(e, "role"), ke = (e) => !Object.hasOwn(e, "role"), we = ({
175
- driveItem: e,
176
- graphRoles: n
177
- }) => {
178
- var l;
179
- return (l = e.remoteItem) == null ? void 0 : l.permissions.reduce((i, c) => {
180
- var r;
181
- return (r = c.roles) == null || r.forEach((t) => {
182
- const a = n[t];
183
- a && !i.some(({ id: s }) => s === a.id) && i.push(a);
184
- }), i;
185
- }, []);
186
- }, pe = ({
187
- driveItem: e,
188
- shareRoles: n
189
- }) => {
190
- var i;
191
- if (!n.length) {
192
- const c = (i = e.remoteItem) == null ? void 0 : i.permissions.reduce(
193
- (r, t) => {
194
- const a = t["@libre.graph.permissions.actions"];
195
- return a && r.push(...a), r;
196
- },
197
- []
198
- );
199
- return [...new Set(c)];
200
- }
201
- const l = n.reduce((c, r) => (r.rolePermissions.forEach((t) => {
202
- c.push(...t.allowedResourceActions);
203
- }), c), []);
204
- return [...new Set(l)];
205
- };
206
- function Me({
207
- driveItem: e,
208
- graphRoles: n,
209
- serverUrl: l
210
- }) {
211
- var y, m, P, h;
212
- const i = e.name || e.remoteItem.name, c = M(e.remoteItem.id), r = e.remoteItem.permissions.map((w) => {
213
- const { grantedToV2: S } = w;
214
- return {
215
- ...S.group || S.user,
216
- shareType: f(w)
217
- };
218
- }), t = e.remoteItem.permissions.reduce((w, S) => {
219
- const R = S.invitation.invitedBy.user;
220
- return w.some(({ id: x }) => x === R.id) || w.push(R), w;
221
- }, []);
222
- let a = me(e.remoteItem.permissions.map(f));
223
- t.some((w) => w["@libre.graph.userType"] === "Federated") && (a = [p.remote.value]);
224
- const u = we({ driveItem: e, graphRoles: n }), d = pe({ driveItem: e, shareRoles: u }), o = {
225
- id: e.id,
226
- remoteItemId: e.remoteItem.id,
227
- driveId: (y = e.parentReference) == null ? void 0 : y.driveId,
228
- path: "/",
229
- name: i,
230
- fileId: e.remoteItem.id,
231
- size: e.size,
232
- storageId: c,
233
- parentFolderId: (m = e.parentReference) == null ? void 0 : m.id,
234
- sdate: e.remoteItem.permissions[0].createdDateTime,
235
- tags: [],
236
- webDavPath: G(e.remoteItem.id, "/"),
237
- sharedBy: t,
238
- owner: (P = e.remoteItem.createdBy) == null ? void 0 : P.user,
239
- sharedWith: r,
240
- shareTypes: a,
241
- isFolder: !!e.folder,
242
- type: e.folder ? "folder" : "file",
243
- mimeType: ((h = e.file) == null ? void 0 : h.mimeType) || "httpd/unix-directory",
244
- mdate: e.lastModifiedDateTime ? new Date(e.lastModifiedDateTime).toUTCString() : void 0,
245
- syncEnabled: e["@client.synchronize"],
246
- hidden: e["@UI.Hidden"],
247
- shareRoles: u,
248
- sharePermissions: d,
249
- outgoing: !1,
250
- privateLink: F(l, "f", e.remoteItem.id),
251
- canRename: () => e["@client.synchronize"],
252
- canDownload: () => d.includes(D.readContent),
253
- canUpload: () => d.includes(D.createUpload),
254
- canCreate: () => d.includes(D.createChildren),
255
- canBeDeleted: () => d.includes(D.deleteStandard),
256
- canEditTags: () => d.includes(D.createChildren),
257
- isMounted: () => !1,
258
- isReceivedShare: () => !0,
259
- canShare: () => !1,
260
- canDeny: () => !1,
261
- getDomSelector: () => N(e.id)
262
- };
263
- return o.extension = B(o), o;
264
- }
265
- function Ge({
266
- driveItem: e,
267
- user: n,
268
- serverUrl: l
269
- }) {
270
- var t, a, s;
271
- const i = M(e.id), c = F(e.parentReference.path, e.name), r = {
272
- id: e.id,
273
- driveId: (t = e.parentReference) == null ? void 0 : t.driveId,
274
- path: c,
275
- name: e.name,
276
- fileId: e.id,
277
- size: e.size,
278
- storageId: i,
279
- parentFolderId: (a = e.parentReference) == null ? void 0 : a.id,
280
- sdate: e.permissions[0].createdDateTime,
281
- tags: [],
282
- webDavPath: G(i, c),
283
- sharedBy: [{ id: n.id, displayName: n.displayName }],
284
- owner: { id: n.id, displayName: n.displayName },
285
- sharedWith: e.permissions.map((u) => {
286
- if (u.link)
287
- return {
288
- id: u.id,
289
- displayName: u.link["@libre.graph.displayName"],
290
- shareType: p.link.value
291
- };
292
- const d = f(u);
293
- return { ...u.grantedToV2.user || u.grantedToV2.group, shareType: d };
294
- }),
295
- shareTypes: e.permissions.map(f),
296
- isFolder: !!e.folder,
297
- type: e.folder ? "folder" : "file",
298
- mimeType: ((s = e.file) == null ? void 0 : s.mimeType) || "httpd/unix-directory",
299
- outgoing: !0,
300
- privateLink: F(l, "f", e.id),
301
- canRename: () => !0,
302
- canDownload: () => !0,
303
- canUpload: () => !0,
304
- canCreate: () => !0,
305
- canBeDeleted: () => !0,
306
- canEditTags: () => !0,
307
- isMounted: () => !1,
308
- isReceivedShare: () => !0,
309
- canShare: () => !0,
310
- canDeny: () => !0,
311
- getDomSelector: () => N(e.id)
312
- };
313
- return r.extension = B(r), r;
314
- }
315
- function v({
316
- graphPermission: e,
317
- graphRoles: n,
318
- resourceId: l,
319
- indirect: i = !1
320
- }) {
321
- var t, a, s;
322
- const c = n[(t = e.roles) == null ? void 0 : t[0]], r = (s = (a = e.invitation) == null ? void 0 : a.invitedBy) == null ? void 0 : s.user;
323
- return {
324
- id: e.id,
325
- resourceId: l,
326
- indirect: i,
327
- shareType: f(e),
328
- role: c,
329
- sharedBy: { id: r == null ? void 0 : r.id, displayName: r == null ? void 0 : r.displayName },
330
- sharedWith: e.grantedToV2.user || e.grantedToV2.group,
331
- permissions: e["@libre.graph.permissions.actions"] ? e["@libre.graph.permissions.actions"] : c.rolePermissions.flatMap((u) => u.allowedResourceActions),
332
- createdDateTime: e.createdDateTime,
333
- expirationDateTime: e.expirationDateTime
334
- };
335
- }
336
- function b({
337
- graphPermission: e,
338
- resourceId: n,
339
- indirect: l = !1
340
- }) {
341
- var c, r;
342
- const i = (r = (c = e.invitation) == null ? void 0 : c.invitedBy) == null ? void 0 : r.user;
343
- return {
344
- id: e.id,
345
- resourceId: n,
346
- indirect: l,
347
- shareType: p.link.value,
348
- sharedBy: { id: i == null ? void 0 : i.id, displayName: i == null ? void 0 : i.displayName },
349
- hasPassword: e.hasPassword,
350
- createdDateTime: e.createdDateTime,
351
- expirationDateTime: e.expirationDateTime,
352
- displayName: e.link["@libre.graph.displayName"],
353
- isQuickLink: e.link["@libre.graph.quickLink"],
354
- type: e.link.type,
355
- webUrl: e.link.webUrl,
356
- preventsDownload: e.link.preventsDownload
357
- };
358
- }
359
- function f({ link: e, grantedToV2: n }) {
360
- var l;
361
- return e ? p.link.value : n != null && n.group ? p.group.value : ((l = n == null ? void 0 : n.user) == null ? void 0 : l["@libre.graph.userType"]) === "Federated" ? p.remote.value : p.user.value;
362
- }
363
- const A = (e) => new URL(e.webUrl).origin, De = {
364
- manager: "312c0871-5ef7-4b3a-85b6-0e4074c64049",
365
- editor: "58c63c02-1d89-4572-916a-870abc5a1b7d",
366
- viewer: "a8d5fe5e-96e3-418d-825b-534dbdf22b99"
367
- }, U = (e) => {
368
- var n, l;
369
- return (l = (n = e.root) == null ? void 0 : n.permissions) == null || l.forEach((i) => {
370
- var r;
371
- i.grantedToV2 = i.grantedToV2 || ((r = i.grantedToIdentities) == null ? void 0 : r[0]), delete i.grantedToIdentities;
372
- const c = i.roles[0];
373
- c && (i.roles[0] = De[c]);
374
- }), e;
375
- }, ge = ({ axiosClient: e, config: n }) => {
376
- const l = Q(n, n.basePath, e), i = new Z(n, n.basePath, e), c = new $(n, n.basePath, e);
377
- return {
378
- async getDrive(r, t, a) {
379
- let { data: s } = await l.getDrive(r, a);
380
- return s = U(s), g({ ...s, serverUrl: A(s) }, t);
381
- },
382
- async createDrive(r, t, a) {
383
- let { data: s } = await l.createDrive(r, a);
384
- return s = U(s), g({ ...s, serverUrl: A(s) }, t);
385
- },
386
- async updateDrive(r, t, a, s) {
387
- let { data: u } = await l.updateDrive(r, t, s);
388
- return u = U(u), g({ ...u, serverUrl: A(u) }, a);
389
- },
390
- async disableDrive(r, t, a) {
391
- await l.deleteDrive(r, t, a);
392
- },
393
- async deleteDrive(r, t, a) {
394
- await l.deleteDrive(r, t, {
395
- headers: {
396
- ...(a == null ? void 0 : a.headers) && a.headers || {},
397
- Purge: "T"
398
- },
399
- ...a && { requestOptions: a } || {}
400
- });
401
- },
402
- async listMyDrives(r, t, a) {
403
- const {
404
- data: { value: s }
405
- } = await i.listMyDrivesBeta(t == null ? void 0 : t.orderBy, t == null ? void 0 : t.filter, a);
406
- return s.map((u) => g({ ...u, serverUrl: A(u) }, r));
407
- },
408
- async listAllDrives(r, t, a) {
409
- const {
410
- data: { value: s }
411
- } = await c.listAllDrivesBeta(t == null ? void 0 : t.orderBy, t == null ? void 0 : t.filter, a);
412
- return s.map((u) => g({ ...u, serverUrl: A(u) }, r));
413
- }
414
- };
415
- }, be = ({
416
- axiosClient: e,
417
- config: n
418
- }) => {
419
- const l = K(n, n.basePath, e), i = k(n, n.basePath, e), c = V(n, n.basePath, e);
420
- return {
421
- async getDriveItem(r, t, a) {
422
- const { data: s } = await l.getDriveItem(r, t, a);
423
- return s;
424
- },
425
- async createDriveItem(r, t, a) {
426
- const { data: s } = await i.createDriveItem(
427
- r,
428
- t,
429
- a
430
- );
431
- return s;
432
- },
433
- async updateDriveItem(r, t, a, s) {
434
- const { data: u } = await l.updateDriveItem(
435
- r,
436
- t,
437
- a,
438
- s
439
- );
440
- return u;
441
- },
442
- async deleteDriveItem(r, t, a) {
443
- await l.deleteDriveItem(r, t, a);
444
- },
445
- async listSharedByMe(r) {
446
- const { data: t } = await c.listSharedByMe(r);
447
- return (t == null ? void 0 : t.value) || [];
448
- },
449
- async listSharedWithMe(r) {
450
- const { data: t } = await c.listSharedWithMe(r);
451
- return (t == null ? void 0 : t.value) || [];
452
- }
453
- };
454
- }, Ae = ({ axiosClient: e, config: n }) => {
455
- const l = X(n, n.basePath, e);
456
- return {
457
- async listTags(i) {
458
- const {
459
- data: { value: c }
460
- } = await l.getTags(i);
461
- return c || [];
462
- },
463
- async assignTags(i, c) {
464
- await l.assignTags(i, c);
465
- },
466
- async unassignTags(i, c) {
467
- await l.unassignTags(i, c);
468
- }
469
- };
470
- }, fe = ({
471
- axiosClient: e,
472
- config: n
473
- }) => {
474
- const l = C(n, n.basePath, e);
475
- return {
476
- async listActivities(i, c) {
477
- const {
478
- data: { value: r }
479
- } = await l.getActivities(i, c);
480
- return r || [];
481
- }
482
- };
483
- }, Se = ({
484
- axiosClient: e,
485
- config: n
486
- }) => {
487
- const l = k(n, n.basePath, e), i = q(n, n.basePath, e), c = I(
488
- n,
489
- n.basePath,
490
- e
491
- );
492
- return {
493
- async getPermission(r, t, a, s, u) {
494
- const { data: d } = await c.getPermission(
495
- r,
496
- t,
497
- a,
498
- u
499
- );
500
- return d.link ? b({ graphPermission: d, resourceId: t }) : v({
501
- graphPermission: d,
502
- resourceId: t,
503
- graphRoles: s || {}
504
- });
505
- },
506
- async listPermissions(r, t, a, s, u) {
507
- let d;
508
- if (r === t) {
509
- const { data: h } = await l.listPermissionsSpaceRoot(
510
- r,
511
- s == null ? void 0 : s.filter,
512
- s != null && s.select ? /* @__PURE__ */ new Set([...s.select]) : null,
513
- u
514
- );
515
- d = h;
516
- } else {
517
- const { data: h } = await c.listPermissions(
518
- r,
519
- t,
520
- s == null ? void 0 : s.filter,
521
- s != null && s.select ? /* @__PURE__ */ new Set([...s.select]) : null,
522
- u
523
- );
524
- d = h;
525
- }
526
- const o = d.value || [], y = d["@libre.graph.permissions.actions.allowedValues"], m = d["@libre.graph.permissions.roles.allowedValues"];
527
- return { shares: o.map((h) => h.link ? b({ graphPermission: h, resourceId: t }) : v({
528
- graphPermission: h,
529
- resourceId: t,
530
- graphRoles: a || {}
531
- })), allowedActions: y, allowedRoles: m };
532
- },
533
- async updatePermission(r, t, a, s, u, d) {
534
- let o;
535
- if (r === t) {
536
- const { data: y } = await l.updatePermissionSpaceRoot(
537
- r,
538
- a,
539
- s,
540
- d
541
- );
542
- o = y;
543
- } else {
544
- const { data: y } = await c.updatePermission(
545
- r,
546
- t,
547
- a,
548
- s,
549
- d
550
- );
551
- o = y;
552
- }
553
- return o.link ? b({ graphPermission: o, resourceId: t }) : v({
554
- graphPermission: o,
555
- resourceId: t,
556
- graphRoles: u || {}
557
- });
558
- },
559
- async deletePermission(r, t, a, s) {
560
- if (r === t) {
561
- await l.deletePermissionSpaceRoot(r, a, s);
562
- return;
563
- }
564
- await c.deletePermission(r, t, a, s);
565
- },
566
- async createInvite(r, t, a, s, u) {
567
- var o, y;
568
- let d;
569
- if (r === t) {
570
- const { data: m } = await l.inviteSpaceRoot(
571
- r,
572
- a,
573
- u
574
- );
575
- d = (o = m.value) == null ? void 0 : o[0];
576
- } else {
577
- const { data: m } = await c.invite(
578
- r,
579
- t,
580
- a,
581
- u
582
- );
583
- d = (y = m.value) == null ? void 0 : y[0];
584
- }
585
- if (!d)
586
- throw new Error("no permission returned");
587
- return v({
588
- graphPermission: d,
589
- resourceId: t,
590
- graphRoles: s || {}
591
- });
592
- },
593
- async createLink(r, t, a, s) {
594
- let u;
595
- if (r === t) {
596
- const { data: d } = await l.createLinkSpaceRoot(
597
- r,
598
- a,
599
- s
600
- );
601
- u = d;
602
- } else {
603
- const { data: d } = await c.createLink(
604
- r,
605
- t,
606
- a,
607
- s
608
- );
609
- u = d;
610
- }
611
- return b({ graphPermission: u, resourceId: t });
612
- },
613
- async setPermissionPassword(r, t, a, s, u) {
614
- let d;
615
- if (r === t) {
616
- const { data: o } = await l.setPermissionPasswordSpaceRoot(
617
- r,
618
- a,
619
- s,
620
- u
621
- );
622
- d = o;
623
- } else {
624
- const { data: o } = await c.setPermissionPassword(
625
- r,
626
- t,
627
- a,
628
- s,
629
- u
630
- );
631
- d = o;
632
- }
633
- return b({ graphPermission: d, resourceId: t });
634
- },
635
- async listRoleDefinitions(r) {
636
- const { data: t } = await i.listPermissionRoleDefinitions(r);
637
- return t;
638
- }
639
- };
640
- }, Be = (e, n) => {
641
- const l = new URL(e);
642
- l.pathname = [...l.pathname.split("/"), "graph"].filter(Boolean).join("/");
643
- const i = new ee({
644
- basePath: l.href
645
- });
646
- return {
647
- activities: fe({ axiosClient: n, config: i }),
648
- applications: le({ axiosClient: n, config: i }),
649
- tags: Ae({ axiosClient: n, config: i }),
650
- drives: ge({ axiosClient: n, config: i }),
651
- driveItems: be({ axiosClient: n, config: i }),
652
- users: ce({ axiosClient: n, config: i }),
653
- groups: ie({ axiosClient: n, config: i }),
654
- permissions: Se({ axiosClient: n, config: i })
655
- };
656
- };
657
- export {
658
- Re as a,
659
- Te as b,
660
- Ue as c,
661
- ke as d,
662
- we as e,
663
- pe as f,
664
- Be as g,
665
- Me as h,
666
- L as i,
667
- Ge as j,
668
- v as k,
669
- b as l
670
- };