@opencloud-eu/web-client 5.0.0-alpha.1 → 5.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.
Files changed (38) hide show
  1. package/dist/{functions-DoaLjzWZ.js → functions-JSgappH3.js} +58 -54
  2. package/dist/functions-K2XX5sqY.cjs +1 -0
  3. package/dist/index-Bjk4YP4o.js +1447 -0
  4. package/dist/{index-VSN9x0VR.js → index-Brk6gzFd.js} +34 -32
  5. package/dist/index-CDNcS2Ra.cjs +1 -0
  6. package/dist/index-CRMq09Yn.js +1933 -0
  7. package/dist/index-D0bnLDAA.cjs +1 -0
  8. package/dist/index-Dn0XwAD_.cjs +13 -0
  9. package/dist/index-YuBBVVCr.js +3860 -0
  10. package/dist/index-_QOU-c0Z.cjs +4 -0
  11. package/dist/index-cttW6Cve.js +1018 -0
  12. package/dist/index-mNoGEl9R.cjs +6 -0
  13. package/dist/src/index.d.ts +3 -15
  14. package/dist/src/ocs/capabilities.d.ts +0 -1
  15. package/dist/src/ocs/urlSign.d.ts +1 -0
  16. package/dist/src/webdav/getFileUrl.d.ts +1 -7
  17. package/dist/{toString-BMC5nz5v.js → toString-CKeGA2IK.js} +57 -63
  18. package/dist/toString-DsGM1XcL.cjs +1 -0
  19. package/dist/web-client/graph/generated.cjs +1 -1
  20. package/dist/web-client/graph/generated.js +1 -1
  21. package/dist/web-client/graph.cjs +1 -1
  22. package/dist/web-client/graph.js +1 -1
  23. package/dist/web-client/ocs.cjs +1 -20
  24. package/dist/web-client/ocs.js +3 -6043
  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 +67 -84
  29. package/package.json +2 -3
  30. package/dist/functions-D3Ol8cjk.cjs +0 -1
  31. package/dist/index-8RyXehLU.js +0 -1134
  32. package/dist/index-BG-qXJDl.cjs +0 -6
  33. package/dist/index-BfIzVKrn.js +0 -1773
  34. package/dist/index-CVRrfksL.cjs +0 -1
  35. package/dist/index-Cwfbs-Hh.js +0 -4651
  36. package/dist/index-DOiCesBa.cjs +0 -16
  37. package/dist/index-sTep8AuK.cjs +0 -1
  38. package/dist/toString-CEqk2kJI.cjs +0 -1
@@ -1,6 +1,6 @@
1
1
  import { UserApiFactory as N, UsersApiFactory as E, MeUserApiFactory as x, MeChangepasswordApiFactory as L, UserAppRoleAssignmentApiFactory as O, GroupApiFactory as z, GroupsApiFactory as W, ApplicationsApiFactory as V, DrivesApiFactory as j, MeDrivesApi as H, DrivesGetDrivesApi as Y, DriveItemApiFactory as _, DrivesRootApiFactory as R, MeDriveApiFactory as J, TagsApiFactory as Q, ActivitiesApiFactory as Z, RoleManagementApiFactory as $, DrivesPermissionsApiFactory as K, MePhotoApiFactory as X, UserPhotoApiFactory as q, Configuration as C } from "./web-client/graph/generated.js";
2
- import { u as v, g as I, r as ee } from "./toString-BMC5nz5v.js";
3
- import { E as ae, F as te, H as re, d as U, n as h, o as T, h as k, e as B, G as g, v as A } from "./functions-DoaLjzWZ.js";
2
+ import { u as F, g as I, r as ee } from "./toString-CKeGA2IK.js";
3
+ import { E as ae, F as te, H as re, r as U, b as h, k as T, n as k, m as B, G as g, g as A } from "./functions-JSgappH3.js";
4
4
  const se = ({ axiosClient: e, config: s }) => {
5
5
  const o = N(s, s.basePath, e), c = E(s, s.basePath, e), i = x(s, s.basePath, e), a = L(
6
6
  s,
@@ -109,7 +109,7 @@ const se = ({ axiosClient: e, config: s }) => {
109
109
  async addMember(i, a, t) {
110
110
  await o.addMember(
111
111
  i,
112
- { "@odata.id": v(s.basePath, "v1.0", "users", a) },
112
+ { "@odata.id": F(s.basePath, "v1.0", "users", a) },
113
113
  t
114
114
  );
115
115
  },
@@ -137,15 +137,15 @@ const se = ({ axiosClient: e, config: s }) => {
137
137
  };
138
138
  function oe() {
139
139
  }
140
- var F = I(ee, "Set");
140
+ var v = I(ee, "Set");
141
141
  function M(e) {
142
142
  var s = -1, o = Array(e.size);
143
143
  return e.forEach(function(c) {
144
144
  o[++s] = c;
145
145
  }), o;
146
146
  }
147
- var ce = 1 / 0, le = F && 1 / M(new F([, -0]))[1] == ce ? function(e) {
148
- return new F(e);
147
+ var ce = 1 / 0, le = v && 1 / M(new v([, -0]))[1] == ce ? function(e) {
148
+ return new v(e);
149
149
  } : oe, ue = 200;
150
150
  function de(e, s, o) {
151
151
  var c = -1, i = te, a = e.length, t = !0, r = [], n = r;
@@ -171,7 +171,7 @@ function de(e, s, o) {
171
171
  function pe(e) {
172
172
  return e && e.length ? de(e) : [];
173
173
  }
174
- const G = (e) => Object.hasOwn(e, "sharedWith"), Fe = (e) => G(e) && e.outgoing, fe = (e) => G(e) && !e.outgoing, Re = (e) => Object.hasOwn(e, "role"), Ue = (e) => !Object.hasOwn(e, "role"), ye = ({
174
+ const G = (e) => Object.hasOwn(e, "sharedWith"), ve = (e) => G(e) && e.outgoing, fe = (e) => G(e) && !e.outgoing, Re = (e) => Object.hasOwn(e, "role"), Ue = (e) => !Object.hasOwn(e, "role"), ye = ({
175
175
  driveItem: e,
176
176
  graphRoles: s
177
177
  }) => e.remoteItem?.permissions.reduce((o, c) => (c.roles?.forEach((i) => {
@@ -205,13 +205,13 @@ function Te({
205
205
  const { grantedToV2: w } = p;
206
206
  return {
207
207
  ...w.group || w.user,
208
- shareType: b(p)
208
+ shareType: S(p)
209
209
  };
210
210
  }), t = e.remoteItem.permissions.reduce((p, w) => {
211
211
  const m = w.invitation.invitedBy.user;
212
212
  return p.some(({ id: f }) => f === m.id) || p.push(m), p;
213
213
  }, []);
214
- let r = pe(e.remoteItem.permissions.map(b));
214
+ let r = pe(e.remoteItem.permissions.map(S));
215
215
  t.some((p) => p["@libre.graph.userType"] === "Federated") && (r = [h.remote.value]);
216
216
  const u = ye({ driveItem: e, graphRoles: s }), l = he({ driveItem: e, shareRoles: u }), d = {
217
217
  id: e.id,
@@ -239,7 +239,7 @@ function Te({
239
239
  shareRoles: u,
240
240
  sharePermissions: l,
241
241
  outgoing: !1,
242
- privateLink: v(o, "f", e.remoteItem.id),
242
+ privateLink: F(o, "f", e.remoteItem.id),
243
243
  hasPreview: () => !!e.thumbnails,
244
244
  canRename: () => e["@client.synchronize"],
245
245
  canDownload: () => l.includes(g.readContent),
@@ -250,6 +250,7 @@ function Te({
250
250
  isMounted: () => !1,
251
251
  isReceivedShare: () => !0,
252
252
  canShare: () => !1,
253
+ isShareRoot: () => !0,
253
254
  getDomSelector: () => B(e.id)
254
255
  };
255
256
  return d.extension = k(d), d;
@@ -259,7 +260,7 @@ function ke({
259
260
  user: s,
260
261
  serverUrl: o
261
262
  }) {
262
- const c = U(e.id), i = v(e.parentReference.path, e.name), a = {
263
+ const c = U(e.id), i = F(e.parentReference.path, e.name), a = {
263
264
  id: e.id,
264
265
  driveId: e.parentReference?.driveId,
265
266
  path: i,
@@ -280,15 +281,15 @@ function ke({
280
281
  displayName: t.link["@libre.graph.displayName"],
281
282
  shareType: h.link.value
282
283
  };
283
- const r = b(t);
284
+ const r = S(t);
284
285
  return { ...t.grantedToV2.user || t.grantedToV2.group, shareType: r };
285
286
  }),
286
- shareTypes: e.permissions.map(b),
287
+ shareTypes: e.permissions.map(S),
287
288
  isFolder: !!e.folder,
288
289
  type: e.folder ? "folder" : "file",
289
290
  mimeType: e.file?.mimeType || "httpd/unix-directory",
290
291
  outgoing: !0,
291
- privateLink: v(o, "f", e.id),
292
+ privateLink: F(o, "f", e.id),
292
293
  hasPreview: () => !!e.thumbnails,
293
294
  canRename: () => !0,
294
295
  canDownload: () => !0,
@@ -297,13 +298,14 @@ function ke({
297
298
  canBeDeleted: () => !0,
298
299
  canEditTags: () => !0,
299
300
  isMounted: () => !1,
301
+ isShareRoot: () => !1,
300
302
  isReceivedShare: () => !0,
301
303
  canShare: () => !0,
302
304
  getDomSelector: () => B(e.id)
303
305
  };
304
306
  return a.extension = k(a), a;
305
307
  }
306
- function S({
308
+ function b({
307
309
  graphPermission: e,
308
310
  graphRoles: s,
309
311
  resourceId: o,
@@ -314,7 +316,7 @@ function S({
314
316
  id: e.id,
315
317
  resourceId: o,
316
318
  indirect: c,
317
- shareType: b(e),
319
+ shareType: S(e),
318
320
  role: i,
319
321
  sharedBy: { id: a?.id, displayName: a?.displayName },
320
322
  sharedWith: e.grantedToV2.user || e.grantedToV2.group,
@@ -345,7 +347,7 @@ function P({
345
347
  preventsDownload: e.link.preventsDownload
346
348
  };
347
349
  }
348
- function b({ link: e, grantedToV2: s }) {
350
+ function S({ link: e, grantedToV2: s }) {
349
351
  return e ? h.link.value : s?.group ? h.group.value : s?.user?.["@libre.graph.userType"] === "Federated" ? h.remote.value : h.user.value;
350
352
  }
351
353
  const D = (e) => new URL(e.webUrl).origin, we = ({ axiosClient: e, config: s }) => {
@@ -489,7 +491,7 @@ const D = (e) => new URL(e.webUrl).origin, we = ({ axiosClient: e, config: s })
489
491
  r,
490
492
  u
491
493
  );
492
- return l.link ? P({ graphPermission: l, resourceId: t }) : S({
494
+ return l.link ? P({ graphPermission: l, resourceId: t }) : b({
493
495
  graphPermission: l,
494
496
  resourceId: t,
495
497
  graphRoles: n || {}
@@ -520,7 +522,7 @@ const D = (e) => new URL(e.webUrl).origin, we = ({ axiosClient: e, config: s })
520
522
  l = y;
521
523
  }
522
524
  const d = l.value || [], p = l["@libre.graph.permissions.actions.allowedValues"], w = l["@libre.graph.permissions.roles.allowedValues"], m = l["@odata.count"];
523
- return { shares: d.map((y) => y.link ? P({ graphPermission: y, resourceId: t }) : S({
525
+ return { shares: d.map((y) => y.link ? P({ graphPermission: y, resourceId: t }) : b({
524
526
  graphPermission: y,
525
527
  resourceId: t,
526
528
  graphRoles: r || {}
@@ -546,7 +548,7 @@ const D = (e) => new URL(e.webUrl).origin, we = ({ axiosClient: e, config: s })
546
548
  );
547
549
  d = p;
548
550
  }
549
- return d.link ? P({ graphPermission: d, resourceId: t }) : S({
551
+ return d.link ? P({ graphPermission: d, resourceId: t }) : b({
550
552
  graphPermission: d,
551
553
  resourceId: t,
552
554
  graphRoles: u || {}
@@ -579,7 +581,7 @@ const D = (e) => new URL(e.webUrl).origin, we = ({ axiosClient: e, config: s })
579
581
  }
580
582
  if (!l)
581
583
  throw new Error("no permission returned");
582
- return S({
584
+ return b({
583
585
  graphPermission: l,
584
586
  resourceId: t,
585
587
  graphRoles: n || {}
@@ -671,16 +673,16 @@ const D = (e) => new URL(e.webUrl).origin, we = ({ axiosClient: e, config: s })
671
673
  };
672
674
  };
673
675
  export {
674
- Fe as a,
675
- fe as b,
676
- Re as c,
677
- Ue as d,
676
+ Te as a,
677
+ b,
678
+ P as c,
679
+ ke as d,
678
680
  ye as e,
679
- he as f,
680
- Be as g,
681
- Te as h,
682
- G as i,
683
- ke as j,
684
- S as k,
685
- P as l
681
+ Be as f,
682
+ he as g,
683
+ fe as h,
684
+ Re as i,
685
+ Ue as j,
686
+ ve as k,
687
+ G as l
686
688
  };
@@ -0,0 +1 @@
1
+ "use strict";const h=require("./web-client/graph/generated.cjs"),g=require("./toString-DsGM1XcL.cjs"),d=require("./functions-K2XX5sqY.cjs"),k=({axiosClient:e,config:s})=>{const o=h.UserApiFactory(s,s.basePath,e),c=h.UsersApiFactory(s,s.basePath,e),i=h.MeUserApiFactory(s,s.basePath,e),a=h.MeChangepasswordApiFactory(s,s.basePath,e),t=h.UserAppRoleAssignmentApiFactory(s,s.basePath,e);return{async getUser(r,n,u){const{data:l}=await o.getUser(r,n?.select?new Set([...n.select]):null,n?.expand?new Set([...n.expand]):new Set(["drive","memberOf","appRoleAssignments"]),u);return l},async createUser(r,n){const{data:u}=await c.createUser(r,n);return u},async editUser(r,n,u){const{data:l}=await o.updateUser(r,n,u);return l},async deleteUser(r,n,u){await o.deleteUser(r,n,u)},async listUsers(r,n){const{data:{value:u}}=await c.listUsers(r?.search,r?.filter,r?.orderBy?new Set([...r.orderBy]):null,r?.select?new Set([...r.select]):null,r?.expand?new Set([...r.expand]):null,n);return u},async getMe(r,n){const{data:u}=await i.getOwnUser(r?.expand?new Set([...r.expand]):new Set(["memberOf"]),n);return u},async editMe(r,n){const{data:u}=await i.updateOwnUser(r,n);return u},async changeOwnPassword(r,n){await a.changeOwnPassword(r,n)},async exportPersonalData(r,n,u){await o.exportPersonalData(r,n,u)},async createUserAppRoleAssignment(r,n,u){const{data:l}=await t.userCreateAppRoleAssignments(r,n,u);return l}}},B=({axiosClient:e,config:s})=>{const o=h.GroupApiFactory(s,s.basePath,e),c=h.GroupsApiFactory(s,s.basePath,e);return{async getGroup(i,a,t){const{data:r}=await o.getGroup(i,a?.select?new Set([...a.select]):null,a?.expand?new Set([...a.expand]):new Set(["members"]),t);return r},async createGroup(i,a){const{data:t}=await c.createGroup(i,a);return t},async editGroup(i,a,t){const{data:r}=await o.updateGroup(i,a,t);return r},async deleteGroup(i,a,t){await o.deleteGroup(i,a,t)},async listGroups(i,a){const{data:{value:t}}=await c.listGroups(i?.search,i?.orderBy?new Set([...i.orderBy]):null,i?.select?new Set([...i.select]):null,i?.expand?new Set([...i.expand]):null,a);return t},async addMember(i,a,t){await o.addMember(i,{"@odata.id":g.urlJoin(s.basePath,"v1.0","users",a)},t)},async deleteMember(i,a,t,r){await o.deleteMember(i,a,t,r)}}},M=({axiosClient:e,config:s})=>{const o=h.ApplicationsApiFactory(s,s.basePath,e);return{async getApplication(c,i){const{data:a}=await o.getApplication(c,i);return a},async listApplications(c){const{data:{value:i}}=await o.listApplications(c);return i||[]}}};function G(){}var F=g.getNative(g.root,"Set");function T(e){var s=-1,o=Array(e.size);return e.forEach(function(c){o[++s]=c}),o}var N=1/0,x=F&&1/T(new F([,-0]))[1]==N?function(e){return new F(e)}:G,L=200;function E(e,s,o){var c=-1,i=d.arrayIncludes,a=e.length,t=!0,r=[],n=r;if(a>=L){var u=x(e);if(u)return T(u);t=!1,i=d.cacheHas,n=new d.SetCache}else n=r;e:for(;++c<a;){var l=e[c],p=l;if(l=l!==0?l:0,t&&p===p){for(var y=n.length;y--;)if(n[y]===p)continue e;r.push(l)}else i(n,p,o)||(n!==r&&n.push(p),r.push(l))}return r}function O(e){return e&&e.length?E(e):[]}const v=e=>Object.hasOwn(e,"sharedWith"),W=e=>v(e)&&e.outgoing,z=e=>v(e)&&!e.outgoing,V=e=>Object.hasOwn(e,"role"),j=e=>!Object.hasOwn(e,"role"),f=({driveItem:e,graphRoles:s})=>e.remoteItem?.permissions.reduce((o,c)=>(c.roles?.forEach(i=>{const a=s[i];a&&!o.some(({id:t})=>t===a.id)&&o.push(a)}),o),[]),U=({driveItem:e,shareRoles:s})=>{if(!s.length){const c=e.remoteItem?.permissions.reduce((i,a)=>{const t=a["@libre.graph.permissions.actions"];return t&&i.push(...t),i},[]);return[...new Set(c)]}const o=s.reduce((c,i)=>(i.rolePermissions.forEach(a=>{c.push(...a.allowedResourceActions)}),c),[]);return[...new Set(o)]};function J({driveItem:e,graphRoles:s,serverUrl:o}){const c=e.name||e.remoteItem.name,i=d.extractStorageId(e.remoteItem.id),a=e.remoteItem.permissions.map(y=>{const{grantedToV2:m}=y;return{...m.group||m.user,shareType:D(y)}}),t=e.remoteItem.permissions.reduce((y,m)=>{const b=m.invitation.invitedBy.user;return y.some(({id:R})=>R===b.id)||y.push(b),y},[]);let r=O(e.remoteItem.permissions.map(D));t.some(y=>y["@libre.graph.userType"]==="Federated")&&(r=[d.ShareTypes.remote.value]);const u=f({driveItem:e,graphRoles:s}),l=U({driveItem:e,shareRoles:u}),p={id:e.id,remoteItemId:e.remoteItem.id,driveId:e.parentReference?.driveId,path:"/",name:c,fileId:e.remoteItem.id,size:e.size,storageId:i,parentFolderId:e.parentReference?.id,sdate:e.remoteItem.permissions[0].createdDateTime,tags:[],webDavPath:d.buildWebDavSpacesPath(e.remoteItem.id,"/"),sharedBy:t,owner:e.remoteItem.createdBy?.user,sharedWith:a,shareTypes:r,isFolder:!!e.folder,type:e.folder?"folder":"file",mimeType:e.file?.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:l,outgoing:!1,privateLink:g.urlJoin(o,"f",e.remoteItem.id),hasPreview:()=>!!e.thumbnails,canRename:()=>e["@client.synchronize"],canDownload:()=>l.includes(d.GraphSharePermission.readContent),canUpload:()=>l.includes(d.GraphSharePermission.createUpload),canCreate:()=>l.includes(d.GraphSharePermission.createChildren),canBeDeleted:()=>l.includes(d.GraphSharePermission.deleteStandard),canEditTags:()=>l.includes(d.GraphSharePermission.createUpload),isMounted:()=>!1,isReceivedShare:()=>!0,canShare:()=>!1,isShareRoot:()=>!0,getDomSelector:()=>d.extractDomSelector(e.id)};return p.extension=d.extractExtensionFromFile(p),p}function _({driveItem:e,user:s,serverUrl:o}){const c=d.extractStorageId(e.id),i=g.urlJoin(e.parentReference.path,e.name),a={id:e.id,driveId:e.parentReference?.driveId,path:i,name:e.name,fileId:e.id,size:e.size,storageId:c,parentFolderId:e.parentReference?.id,sdate:e.permissions[0].createdDateTime,tags:[],webDavPath:d.buildWebDavSpacesPath(c,i),sharedBy:[{id:s.id,displayName:s.displayName}],owner:{id:s.id,displayName:s.displayName},sharedWith:e.permissions.map(t=>{if(t.link)return{id:t.id,displayName:t.link["@libre.graph.displayName"],shareType:d.ShareTypes.link.value};const r=D(t);return{...t.grantedToV2.user||t.grantedToV2.group,shareType:r}}),shareTypes:e.permissions.map(D),isFolder:!!e.folder,type:e.folder?"folder":"file",mimeType:e.file?.mimeType||"httpd/unix-directory",outgoing:!0,privateLink:g.urlJoin(o,"f",e.id),hasPreview:()=>!!e.thumbnails,canRename:()=>!0,canDownload:()=>!0,canUpload:()=>!0,canCreate:()=>!0,canBeDeleted:()=>!0,canEditTags:()=>!0,isMounted:()=>!1,isShareRoot:()=>!1,isReceivedShare:()=>!0,canShare:()=>!0,getDomSelector:()=>d.extractDomSelector(e.id)};return a.extension=d.extractExtensionFromFile(a),a}function A({graphPermission:e,graphRoles:s,resourceId:o,indirect:c=!1}){const i=s[e.roles?.[0]],a=e.invitation?.invitedBy?.user;return{id:e.id,resourceId:o,indirect:c,shareType:D(e),role:i,sharedBy:{id:a?.id,displayName:a?.displayName},sharedWith:e.grantedToV2.user||e.grantedToV2.group,permissions:e["@libre.graph.permissions.actions"]?e["@libre.graph.permissions.actions"]:i.rolePermissions.flatMap(t=>t.allowedResourceActions),createdDateTime:e.createdDateTime,expirationDateTime:e.expirationDateTime}}function S({graphPermission:e,resourceId:s,indirect:o=!1}){const c=e.invitation?.invitedBy?.user;return{id:e.id,resourceId:s,indirect:o,shareType:d.ShareTypes.link.value,sharedBy:{id:c?.id,displayName: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 D({link:e,grantedToV2:s}){return e?d.ShareTypes.link.value:s?.group?d.ShareTypes.group.value:s?.user?.["@libre.graph.userType"]==="Federated"?d.ShareTypes.remote.value:d.ShareTypes.user.value}const P=e=>new URL(e.webUrl).origin,H=({axiosClient:e,config:s})=>{const o=h.DrivesApiFactory(s,s.basePath,e),c=new h.MeDrivesApi(s,s.basePath,e),i=new h.DrivesGetDrivesApi(s,s.basePath,e);return{async getDrive(a,t,r){const{data:n}=await o.getDrive(a,t?.select?new Set([...t.select]):null,r);return d.buildSpace({...n,serverUrl:P(n)})},async createDrive(a,t){const{data:r}=await o.createDrive(a,t);return d.buildSpace({...r,serverUrl:P(r)})},async updateDrive(a,t,r){const{data:n}=await o.updateDrive(a,t,r);return d.buildSpace({...n,serverUrl:P(n)})},async disableDrive(a,t,r){await o.deleteDrive(a,t,r)},async deleteDrive(a,t,r){await o.deleteDrive(a,t,{headers:{...r?.headers&&r.headers||{},Purge:"T"},...r&&{requestOptions:r}||{}})},async listMyDrives(a,t){const{data:{value:r}}=await c.listMyDrivesBeta(a?.orderBy,a?.filter,a?.expand,a?.select?new Set([...a.select]):null,t);return r.map(n=>d.buildSpace({...n,serverUrl:P(n)}))},async listAllDrives(a,t){const{data:{value:r}}=await i.listAllDrivesBeta(a?.orderBy,a?.filter,a?.expand,a?.select?new Set([...a.select]):null,t);return r.map(n=>d.buildSpace({...n,serverUrl:P(n)}))}}},Y=({axiosClient:e,config:s})=>{const o=h.DriveItemApiFactory(s,s.basePath,e),c=h.DrivesRootApiFactory(s,s.basePath,e),i=h.MeDriveApiFactory(s,s.basePath,e);return{async getDriveItem(a,t,r){const{data:n}=await o.getDriveItem(a,t,r);return n},async createDriveItem(a,t,r){const{data:n}=await c.createDriveItem(a,t,r);return n},async updateDriveItem(a,t,r,n){const{data:u}=await o.updateDriveItem(a,t,r,n);return u},async deleteDriveItem(a,t,r){await o.deleteDriveItem(a,t,r)},async listSharedByMe(a,t){const{data:r}=await i.listSharedByMe(a?.expand,t);return r?.value||[]},async listSharedWithMe(a,t){const{data:r}=await i.listSharedWithMe(a?.expand,t);return r?.value||[]}}},Q=({axiosClient:e,config:s})=>{const o=h.TagsApiFactory(s,s.basePath,e);return{async listTags(c){const{data:{value:i}}=await o.getTags(c);return i||[]},async assignTags(c,i){await o.assignTags(c,i)},async unassignTags(c,i){await o.unassignTags(c,i)}}},Z=({axiosClient:e,config:s})=>{const o=h.ActivitiesApiFactory(s,s.basePath,e);return{async listActivities(c,i){const{data:{value:a}}=await o.getActivities(c,i);return a||[]}}},$=({axiosClient:e,config:s})=>{const o=h.DrivesRootApiFactory(s,s.basePath,e),c=h.RoleManagementApiFactory(s,s.basePath,e),i=h.DrivesPermissionsApiFactory(s,s.basePath,e);return{async getPermission(a,t,r,n,u){const{data:l}=await i.getPermission(a,t,r,u);return l.link?S({graphPermission:l,resourceId:t}):A({graphPermission:l,resourceId:t,graphRoles:n||{}})},async listPermissions(a,t,r,n,u){let l;if(a===t){const{data:w}=await o.listPermissionsSpaceRoot(a,n?.filter,n?.select?new Set([...n.select]):null,n?.count,n?.top||0,u);l=w}else{const{data:w}=await i.listPermissions(a,t,n?.filter,n?.select?new Set([...n.select]):null,n?.count,n?.top||0,u);l=w}const p=l.value||[],y=l["@libre.graph.permissions.actions.allowedValues"],m=l["@libre.graph.permissions.roles.allowedValues"],b=l["@odata.count"];return{shares:p.map(w=>w.link?S({graphPermission:w,resourceId:t}):A({graphPermission:w,resourceId:t,graphRoles:r||{}})),allowedActions:y,allowedRoles:m,count:b}},async updatePermission(a,t,r,n,u,l){let p;if(a===t){const{data:y}=await o.updatePermissionSpaceRoot(a,r,n,l);p=y}else{const{data:y}=await i.updatePermission(a,t,r,n,l);p=y}return p.link?S({graphPermission:p,resourceId:t}):A({graphPermission:p,resourceId:t,graphRoles:u||{}})},async deletePermission(a,t,r,n){if(a===t){await o.deletePermissionSpaceRoot(a,r,n);return}await i.deletePermission(a,t,r,n)},async createInvite(a,t,r,n,u){let l;if(a===t){const{data:p}=await o.inviteSpaceRoot(a,r,u);l=p.value?.[0]}else{const{data:p}=await i.invite(a,t,r,u);l=p.value?.[0]}if(!l)throw new Error("no permission returned");return A({graphPermission:l,resourceId:t,graphRoles:n||{}})},async createLink(a,t,r,n){let u;if(a===t){const{data:l}=await o.createLinkSpaceRoot(a,r,n);u=l}else{const{data:l}=await i.createLink(a,t,r,n);u=l}return S({graphPermission:u,resourceId:t})},async setPermissionPassword(a,t,r,n,u){let l;if(a===t){const{data:p}=await o.setPermissionPasswordSpaceRoot(a,r,n,u);l=p}else{const{data:p}=await i.setPermissionPassword(a,t,r,n,u);l=p}return S({graphPermission:l,resourceId:t})},async listRoleDefinitions(a){const{data:t}=await c.listPermissionRoleDefinitions(a);return t}}},K=({axiosClient:e,config:s})=>{const o=h.MePhotoApiFactory(s,s.basePath,e),c=h.UserPhotoApiFactory(s,s.basePath,e);return{async getOwnUserPhoto(i){const{data:a}=await o.getOwnUserPhoto(i);return a},async deleteOwnUserPhoto(i){const{data:a}=await o.deleteOwnUserPhoto(i);return a},async updateOwnUserPhotoPatch(i,a){const{data:t}=await o.updateOwnUserPhotoPatch(i,a);return t},async getUserPhoto(i,a){const{data:t}=await c.getUserPhoto(i,a);return t}}},X=(e,s)=>{const o=new URL(e);o.pathname=[...o.pathname.split("/"),"graph"].filter(Boolean).join("/");const c=new h.Configuration({basePath:o.href});return{activities:Z({axiosClient:s,config:c}),applications:M({axiosClient:s,config:c}),tags:Q({axiosClient:s,config:c}),drives:H({axiosClient:s,config:c}),driveItems:Y({axiosClient:s,config:c}),users:k({axiosClient:s,config:c}),groups:B({axiosClient:s,config:c}),permissions:$({axiosClient:s,config:c}),photos:K({axiosClient:s,config:c})}};exports.buildCollaboratorShare=A;exports.buildIncomingShareResource=J;exports.buildLinkShare=S;exports.buildOutgoingShareResource=_;exports.getShareResourcePermissions=U;exports.getShareResourceRoles=f;exports.graph=X;exports.isCollaboratorShare=V;exports.isIncomingShareResource=z;exports.isLinkShare=j;exports.isOutgoingShareResource=W;exports.isShareResource=v;