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