@opencloud-eu/web-client 4.3.0 → 5.0.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.
- package/dist/functions-BqiR_ap_.cjs +1 -0
- package/dist/{functions-BBrAOhdi.js → functions-fAVnHNMc.js} +3 -5
- package/dist/{index-D_FAmyNm.cjs → index--afUD72W.cjs} +6 -6
- package/dist/index-BtxJsB8k.cjs +6 -0
- package/dist/{index-BfIzVKrn.js → index-DD48hLOx.js} +468 -443
- package/dist/{index-Di9dm5GN.js → index-Dis7HZol.js} +15 -13
- package/dist/index-DxKfohmw.cjs +1 -0
- package/dist/{index-GwKxs7Aj.js → index-ZkBDpWBP.js} +14 -17
- package/dist/src/index.d.ts +3 -15
- package/dist/src/ocs/capabilities.d.ts +0 -1
- package/dist/src/webdav/getFileUrl.d.ts +1 -7
- package/dist/web-client/graph/generated.cjs +1 -1
- package/dist/web-client/graph/generated.js +1 -1
- package/dist/web-client/graph.cjs +1 -1
- package/dist/web-client/graph.js +1 -1
- package/dist/web-client/webdav.cjs +1 -1
- package/dist/web-client/webdav.js +3 -3
- package/dist/web-client.cjs +1 -1
- package/dist/web-client.js +67 -84
- package/package.json +1 -1
- package/dist/functions-C2T1nL62.cjs +0 -1
- package/dist/index-BG-qXJDl.cjs +0 -6
- package/dist/index-o5kQnO1p.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
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-
|
|
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-fAVnHNMc.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,
|
|
@@ -205,13 +205,13 @@ function Te({
|
|
|
205
205
|
const { grantedToV2: w } = p;
|
|
206
206
|
return {
|
|
207
207
|
...w.group || w.user,
|
|
208
|
-
shareType:
|
|
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(
|
|
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,
|
|
@@ -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;
|
|
@@ -280,10 +281,10 @@ function ke({
|
|
|
280
281
|
displayName: t.link["@libre.graph.displayName"],
|
|
281
282
|
shareType: h.link.value
|
|
282
283
|
};
|
|
283
|
-
const r =
|
|
284
|
+
const r = S(t);
|
|
284
285
|
return { ...t.grantedToV2.user || t.grantedToV2.group, shareType: r };
|
|
285
286
|
}),
|
|
286
|
-
shareTypes: e.permissions.map(
|
|
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",
|
|
@@ -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
|
|
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:
|
|
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
|
|
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 }) :
|
|
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 }) :
|
|
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 }) :
|
|
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
|
|
584
|
+
return b({
|
|
583
585
|
graphPermission: l,
|
|
584
586
|
resourceId: t,
|
|
585
587
|
graphRoles: n || {}
|
|
@@ -681,6 +683,6 @@ export {
|
|
|
681
683
|
Te as h,
|
|
682
684
|
G as i,
|
|
683
685
|
ke as j,
|
|
684
|
-
|
|
686
|
+
b as k,
|
|
685
687
|
P as l
|
|
686
688
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const h=require("./web-client/graph/generated.cjs"),g=require("./toString-CEqk2kJI.cjs"),d=require("./functions-BqiR_ap_.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Nr } from "./index-
|
|
2
|
-
import { D as st, I as he, J as me, t as xr, l as ue, p as Kt, m as Pr, K as se } from "./functions-
|
|
1
|
+
import { a as Nr } from "./index-DD48hLOx.js";
|
|
2
|
+
import { D as st, I as he, J as me, t as xr, l as ue, p as Kt, m as Pr, K as se } from "./functions-fAVnHNMc.js";
|
|
3
3
|
import { u as M } from "./toString-BMC5nz5v.js";
|
|
4
4
|
import { ocs as Er } from "./web-client/ocs.js";
|
|
5
5
|
import { p as oe, g as ve } from "./index-8RyXehLU.js";
|
|
@@ -91,32 +91,29 @@ const re = (r, { fileId: e, path: t, name: n }) => {
|
|
|
91
91
|
}), Sr = (r, e, t, { axiosClient: n, baseUrl: a }) => ({
|
|
92
92
|
async getFileUrl(u, c, {
|
|
93
93
|
disposition: i = "attachment",
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
doHeadRequest: f = !1,
|
|
98
|
-
username: l = "",
|
|
99
|
-
...g
|
|
94
|
+
version: h = null,
|
|
95
|
+
username: o = "",
|
|
96
|
+
...s
|
|
100
97
|
}) {
|
|
101
98
|
if (i === "inline") {
|
|
102
|
-
const
|
|
99
|
+
const l = await e.getFileContents(u, c, {
|
|
103
100
|
responseType: "blob",
|
|
104
|
-
...
|
|
101
|
+
...s
|
|
105
102
|
});
|
|
106
|
-
return URL.createObjectURL(
|
|
103
|
+
return URL.createObjectURL(l.body);
|
|
107
104
|
}
|
|
108
|
-
if (
|
|
109
|
-
if (!
|
|
105
|
+
if (h) {
|
|
106
|
+
if (!o)
|
|
110
107
|
throw new Error("username is required for URL signing");
|
|
111
|
-
const
|
|
112
|
-
return await Er(a, n).signUrl(
|
|
108
|
+
const l = r.getFileUrl(M("meta", c.fileId, "v", h));
|
|
109
|
+
return await Er(a, n).signUrl(l, o);
|
|
113
110
|
}
|
|
114
111
|
if (c.downloadURL)
|
|
115
112
|
return c.downloadURL;
|
|
116
|
-
const { downloadURL:
|
|
113
|
+
const { downloadURL: f } = await t.getFileInfo(u, c, {
|
|
117
114
|
davProperties: [he.DownloadURL]
|
|
118
115
|
});
|
|
119
|
-
return
|
|
116
|
+
return f;
|
|
120
117
|
},
|
|
121
118
|
revokeUrl: (u) => {
|
|
122
119
|
u && u.startsWith("blob:") && URL.revokeObjectURL(u);
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { WebDAV, webdav } from './webdav';
|
|
1
|
+
import { graph } from './graph';
|
|
2
|
+
import { ocs } from './ocs';
|
|
3
|
+
import { webdav } from './webdav';
|
|
5
4
|
export * from './errors';
|
|
6
5
|
export * from './helpers';
|
|
7
6
|
export * from './utils';
|
|
8
7
|
export { graph, ocs, webdav };
|
|
9
|
-
interface Client {
|
|
10
|
-
graph: Graph;
|
|
11
|
-
ocs: OCS;
|
|
12
|
-
webdav: WebDAV;
|
|
13
|
-
}
|
|
14
|
-
type ClientOptions = {
|
|
15
|
-
axiosClient: AxiosInstance;
|
|
16
|
-
baseURI: string;
|
|
17
|
-
};
|
|
18
|
-
/** @deprecated use `graph()`, `ocs()` and `webdav()` to initialize and use clients */
|
|
19
|
-
export declare const client: ({ axiosClient, baseURI }: ClientOptions) => Client;
|
|
@@ -4,15 +4,9 @@ import { WebDavOptions } from './types';
|
|
|
4
4
|
import { DAV, DAVRequestOptions } from './client';
|
|
5
5
|
import { GetFileInfoFactory } from './getFileInfo';
|
|
6
6
|
export declare const GetFileUrlFactory: (dav: DAV, getFileContentsFactory: ReturnType<typeof GetFileContentsFactory>, getFileInfoFactory: ReturnType<typeof GetFileInfoFactory>, { axiosClient, baseUrl }: WebDavOptions) => {
|
|
7
|
-
getFileUrl(space: SpaceResource, resource: Resource, { disposition,
|
|
7
|
+
getFileUrl(space: SpaceResource, resource: Resource, { disposition, version, username, ...opts }: {
|
|
8
8
|
disposition?: "inline" | "attachment";
|
|
9
|
-
/** @deprecated no need to specify, the server always supports this */
|
|
10
|
-
isUrlSigningEnabled?: boolean;
|
|
11
|
-
/** @deprecated this has no effect */
|
|
12
|
-
signUrlTimeout?: number;
|
|
13
9
|
version?: string;
|
|
14
|
-
/** @deprecated */
|
|
15
|
-
doHeadRequest?: boolean;
|
|
16
10
|
username?: string;
|
|
17
11
|
} & DAVRequestOptions): Promise<string>;
|
|
18
12
|
revokeUrl: (url: string) => void;
|