@opencloud-eu/web-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +95 -0
  3. package/dist/functions-CsnDdpYv.js +1232 -0
  4. package/dist/functions-ikwhAVhP.cjs +1 -0
  5. package/dist/index-C1H-OgNf.cjs +6 -0
  6. package/dist/index-C6VnMvgz.cjs +6 -0
  7. package/dist/index-DbVGtwLH.cjs +1 -0
  8. package/dist/index-DqVarwg_.js +1705 -0
  9. package/dist/index-Pl8khka8.js +1141 -0
  10. package/dist/index-VvbQMSOr.js +4651 -0
  11. package/dist/index-eFi29SPG.cjs +16 -0
  12. package/dist/index-oQ7995oB.js +672 -0
  13. package/dist/src/errors.d.ts +10 -0
  14. package/dist/src/graph/activities/activities.d.ts +3 -0
  15. package/dist/src/graph/activities/index.d.ts +2 -0
  16. package/dist/src/graph/activities/types.d.ts +5 -0
  17. package/dist/src/graph/applications/applications.d.ts +3 -0
  18. package/dist/src/graph/applications/index.d.ts +2 -0
  19. package/dist/src/graph/applications/types.d.ts +6 -0
  20. package/dist/src/graph/driveItems/driveItems.d.ts +3 -0
  21. package/dist/src/graph/driveItems/index.d.ts +2 -0
  22. package/dist/src/graph/driveItems/types.d.ts +10 -0
  23. package/dist/src/graph/drives/drives.d.ts +3 -0
  24. package/dist/src/graph/drives/index.d.ts +2 -0
  25. package/dist/src/graph/drives/types.d.ts +18 -0
  26. package/dist/src/graph/generated/api.d.ts +6506 -0
  27. package/dist/src/graph/generated/base.d.ts +55 -0
  28. package/dist/src/graph/generated/common.d.ts +54 -0
  29. package/dist/src/graph/generated/configuration.d.ts +91 -0
  30. package/dist/src/graph/generated/index.d.ts +13 -0
  31. package/dist/src/graph/groups/groups.d.ts +3 -0
  32. package/dist/src/graph/groups/index.d.ts +2 -0
  33. package/dist/src/graph/groups/types.d.ts +19 -0
  34. package/dist/src/graph/index.d.ts +20 -0
  35. package/dist/src/graph/permissions/index.d.ts +2 -0
  36. package/dist/src/graph/permissions/permissions.d.ts +3 -0
  37. package/dist/src/graph/permissions/types.d.ts +23 -0
  38. package/dist/src/graph/tags/index.d.ts +2 -0
  39. package/dist/src/graph/tags/tags.d.ts +3 -0
  40. package/dist/src/graph/tags/types.d.ts +7 -0
  41. package/dist/src/graph/types.d.ts +11 -0
  42. package/dist/src/graph/users/index.d.ts +2 -0
  43. package/dist/src/graph/users/types.d.ts +25 -0
  44. package/dist/src/graph/users/users.d.ts +3 -0
  45. package/dist/src/helpers/call.d.ts +1 -0
  46. package/dist/src/helpers/httpError.d.ts +9 -0
  47. package/dist/src/helpers/index.d.ts +7 -0
  48. package/dist/src/helpers/item.d.ts +3 -0
  49. package/dist/src/helpers/publicLink/functions.d.ts +2 -0
  50. package/dist/src/helpers/publicLink/index.d.ts +1 -0
  51. package/dist/src/helpers/resource/functions.d.ts +12 -0
  52. package/dist/src/helpers/resource/index.d.ts +2 -0
  53. package/dist/src/helpers/resource/types.d.ts +103 -0
  54. package/dist/src/helpers/share/constants.d.ts +9 -0
  55. package/dist/src/helpers/share/functions.d.ts +37 -0
  56. package/dist/src/helpers/share/index.d.ts +4 -0
  57. package/dist/src/helpers/share/type.d.ts +32 -0
  58. package/dist/src/helpers/share/types.d.ts +72 -0
  59. package/dist/src/helpers/space/functions.d.ts +27 -0
  60. package/dist/src/helpers/space/index.d.ts +2 -0
  61. package/dist/src/helpers/space/types.d.ts +84 -0
  62. package/dist/src/index.d.ts +19 -0
  63. package/dist/src/ocs/capabilities.d.ts +181 -0
  64. package/dist/src/ocs/index.d.ts +8 -0
  65. package/dist/src/ocs/urlSign.d.ts +18 -0
  66. package/dist/src/sse/index.d.ts +50 -0
  67. package/dist/src/utils/encodePath.d.ts +1 -0
  68. package/dist/src/utils/index.d.ts +2 -0
  69. package/dist/src/utils/urlJoin.d.ts +19 -0
  70. package/dist/src/webdav/clearTrashBin.d.ts +10 -0
  71. package/dist/src/webdav/client/builders.d.ts +8 -0
  72. package/dist/src/webdav/client/dav.d.ts +53 -0
  73. package/dist/src/webdav/client/index.d.ts +3 -0
  74. package/dist/src/webdav/client/parsers.d.ts +8 -0
  75. package/dist/src/webdav/constants/dav.d.ts +106 -0
  76. package/dist/src/webdav/constants/index.d.ts +1 -0
  77. package/dist/src/webdav/copyFiles.d.ts +15 -0
  78. package/dist/src/webdav/createFolder.d.ts +14 -0
  79. package/dist/src/webdav/deleteFile.d.ts +8 -0
  80. package/dist/src/webdav/getFileContents.d.ts +17 -0
  81. package/dist/src/webdav/getFileInfo.d.ts +9 -0
  82. package/dist/src/webdav/getFileUrl.d.ts +15 -0
  83. package/dist/src/webdav/getPathForFileId.d.ts +5 -0
  84. package/dist/src/webdav/getPublicFileUrl.d.ts +6 -0
  85. package/dist/src/webdav/index.d.ts +7 -0
  86. package/dist/src/webdav/listFavoriteFiles.d.ts +12 -0
  87. package/dist/src/webdav/listFileVersions.d.ts +5 -0
  88. package/dist/src/webdav/listFiles.d.ts +21 -0
  89. package/dist/src/webdav/moveFiles.d.ts +15 -0
  90. package/dist/src/webdav/putFileContents.d.ts +18 -0
  91. package/dist/src/webdav/restoreFile.d.ts +12 -0
  92. package/dist/src/webdav/restoreFileVersion.d.ts +10 -0
  93. package/dist/src/webdav/search.d.ts +15 -0
  94. package/dist/src/webdav/setFavorite.d.ts +8 -0
  95. package/dist/src/webdav/types.d.ts +47 -0
  96. package/dist/src/webdav/utils.d.ts +13 -0
  97. package/dist/toString-Cn0xCZ28.js +261 -0
  98. package/dist/toString-hHr716Th.cjs +1 -0
  99. package/dist/vite.config.d.ts +2 -0
  100. package/dist/web-client/graph/generated.cjs +1 -0
  101. package/dist/web-client/graph/generated.js +5499 -0
  102. package/dist/web-client/graph.cjs +1 -0
  103. package/dist/web-client/graph.js +5 -0
  104. package/dist/web-client/ocs.cjs +25 -0
  105. package/dist/web-client/ocs.js +6014 -0
  106. package/dist/web-client/sse.cjs +2 -0
  107. package/dist/web-client/sse.js +218 -0
  108. package/dist/web-client/webdav.cjs +1 -0
  109. package/dist/web-client/webdav.js +10 -0
  110. package/dist/web-client.cjs +1 -0
  111. package/dist/web-client.js +99 -0
  112. package/package.json +67 -0
@@ -0,0 +1,55 @@
1
+ import { Configuration } from './configuration';
2
+ import { AxiosInstance, RawAxiosRequestConfig } from 'axios';
3
+ export declare const BASE_PATH: string;
4
+ /**
5
+ *
6
+ * @export
7
+ */
8
+ export declare const COLLECTION_FORMATS: {
9
+ csv: string;
10
+ ssv: string;
11
+ tsv: string;
12
+ pipes: string;
13
+ };
14
+ /**
15
+ *
16
+ * @export
17
+ * @interface RequestArgs
18
+ */
19
+ export interface RequestArgs {
20
+ url: string;
21
+ options: RawAxiosRequestConfig;
22
+ }
23
+ /**
24
+ *
25
+ * @export
26
+ * @class BaseAPI
27
+ */
28
+ export declare class BaseAPI {
29
+ protected basePath: string;
30
+ protected axios: AxiosInstance;
31
+ protected configuration: Configuration | undefined;
32
+ constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
33
+ }
34
+ /**
35
+ *
36
+ * @export
37
+ * @class RequiredError
38
+ * @extends {Error}
39
+ */
40
+ export declare class RequiredError extends Error {
41
+ field: string;
42
+ constructor(field: string, msg?: string);
43
+ }
44
+ interface ServerMap {
45
+ [key: string]: {
46
+ url: string;
47
+ description: string;
48
+ }[];
49
+ }
50
+ /**
51
+ *
52
+ * @export
53
+ */
54
+ export declare const operationServerMap: ServerMap;
55
+ export {};
@@ -0,0 +1,54 @@
1
+ import { Configuration } from './configuration';
2
+ import { RequestArgs } from './base';
3
+ import { AxiosInstance, AxiosResponse } from 'axios';
4
+ /**
5
+ *
6
+ * @export
7
+ */
8
+ export declare const DUMMY_BASE_URL = "https://example.com";
9
+ /**
10
+ *
11
+ * @throws {RequiredError}
12
+ * @export
13
+ */
14
+ export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
15
+ /**
16
+ *
17
+ * @export
18
+ */
19
+ export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
20
+ /**
21
+ *
22
+ * @export
23
+ */
24
+ export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
25
+ /**
26
+ *
27
+ * @export
28
+ */
29
+ export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
30
+ /**
31
+ *
32
+ * @export
33
+ */
34
+ export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
35
+ /**
36
+ *
37
+ * @export
38
+ */
39
+ export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
40
+ /**
41
+ *
42
+ * @export
43
+ */
44
+ export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
45
+ /**
46
+ *
47
+ * @export
48
+ */
49
+ export declare const toPathString: (url: URL) => string;
50
+ /**
51
+ *
52
+ * @export
53
+ */
54
+ export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Libre Graph API
3
+ * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
4
+ *
5
+ * The version of the OpenAPI document: v1.0.4
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export interface ConfigurationParameters {
13
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
14
+ username?: string;
15
+ password?: string;
16
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
17
+ basePath?: string;
18
+ serverIndex?: number;
19
+ baseOptions?: any;
20
+ formDataCtor?: new () => any;
21
+ }
22
+ export declare class Configuration {
23
+ /**
24
+ * parameter for apiKey security
25
+ * @param name security name
26
+ * @memberof Configuration
27
+ */
28
+ apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
29
+ /**
30
+ * parameter for basic security
31
+ *
32
+ * @type {string}
33
+ * @memberof Configuration
34
+ */
35
+ username?: string;
36
+ /**
37
+ * parameter for basic security
38
+ *
39
+ * @type {string}
40
+ * @memberof Configuration
41
+ */
42
+ password?: string;
43
+ /**
44
+ * parameter for oauth2 security
45
+ * @param name security name
46
+ * @param scopes oauth2 scope
47
+ * @memberof Configuration
48
+ */
49
+ accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
50
+ /**
51
+ * override base path
52
+ *
53
+ * @type {string}
54
+ * @memberof Configuration
55
+ */
56
+ basePath?: string;
57
+ /**
58
+ * override server index
59
+ *
60
+ * @type {number}
61
+ * @memberof Configuration
62
+ */
63
+ serverIndex?: number;
64
+ /**
65
+ * base options for axios calls
66
+ *
67
+ * @type {any}
68
+ * @memberof Configuration
69
+ */
70
+ baseOptions?: any;
71
+ /**
72
+ * The FormData constructor that will be used to create multipart form data
73
+ * requests. You can inject this here so that execution environments that
74
+ * do not support the FormData class can still run the generated client.
75
+ *
76
+ * @type {new () => FormData}
77
+ */
78
+ formDataCtor?: new () => any;
79
+ constructor(param?: ConfigurationParameters);
80
+ /**
81
+ * Check if the given MIME is a JSON MIME.
82
+ * JSON MIME examples:
83
+ * application/json
84
+ * application/json; charset=UTF8
85
+ * APPLICATION/JSON
86
+ * application/vnd.company+json
87
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
88
+ * @return True if the given MIME is JSON, false otherwise.
89
+ */
90
+ isJsonMime(mime: string): boolean;
91
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Libre Graph API
3
+ * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
4
+ *
5
+ * The version of the OpenAPI document: v1.0.4
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ export * from './api';
13
+ export * from './configuration';
@@ -0,0 +1,3 @@
1
+ import { GraphFactoryOptions } from './../types';
2
+ import { GraphGroups } from './types';
3
+ export declare const GroupsFactory: ({ axiosClient, config }: GraphFactoryOptions) => GraphGroups;
@@ -0,0 +1,2 @@
1
+ export * from './groups';
2
+ export * from './types';
@@ -0,0 +1,19 @@
1
+ import { Group } from '../generated';
2
+ import { GraphRequestOptions } from '../types';
3
+ export interface GraphGroups {
4
+ getGroup: (id: string, options?: {
5
+ expand?: Array<'members'>;
6
+ select?: Array<'id' | 'description' | 'displayName' | 'members'>;
7
+ }, requestOptions?: GraphRequestOptions) => Promise<Group>;
8
+ createGroup: (data: Group, requestOptions?: GraphRequestOptions) => Promise<Group>;
9
+ editGroup: (id: string, data: Group, requestOptions?: GraphRequestOptions) => Promise<void>;
10
+ deleteGroup: (id: string, ifMatch?: string, requestOptions?: GraphRequestOptions) => Promise<void>;
11
+ listGroups: (options?: {
12
+ expand?: Array<'members'>;
13
+ orderBy?: Array<'displayName' | 'displayName desc'>;
14
+ search?: string;
15
+ select?: Array<'id' | 'description' | 'displayName' | 'mail' | 'members'>;
16
+ }, requestOptions?: GraphRequestOptions) => Promise<Group[]>;
17
+ addMember: (groupId: string, userId: string, requestOptions?: GraphRequestOptions) => Promise<void>;
18
+ deleteMember: (groupId: string, userId: string, ifMatch?: string, requestOptions?: GraphRequestOptions) => Promise<void>;
19
+ }
@@ -0,0 +1,20 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { GraphUsers } from './users';
3
+ import { GraphGroups } from './groups';
4
+ import { GraphApplications } from './applications';
5
+ import { GraphDrives } from './drives';
6
+ import { GraphDriveItems } from './driveItems';
7
+ import { GraphTags } from './tags';
8
+ import { GraphActivities } from './activities';
9
+ import { GraphPermissions } from './permissions';
10
+ export interface Graph {
11
+ activities: GraphActivities;
12
+ applications: GraphApplications;
13
+ tags: GraphTags;
14
+ drives: GraphDrives;
15
+ driveItems: GraphDriveItems;
16
+ users: GraphUsers;
17
+ groups: GraphGroups;
18
+ permissions: GraphPermissions;
19
+ }
20
+ export declare const graph: (baseURI: string, axiosClient: AxiosInstance) => Graph;
@@ -0,0 +1,2 @@
1
+ export * from './permissions';
2
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import { GraphFactoryOptions } from './../types';
2
+ import { GraphPermissions } from './types';
3
+ export declare const PermissionsFactory: ({ axiosClient, config }: GraphFactoryOptions) => GraphPermissions;
@@ -0,0 +1,23 @@
1
+ import { CollaboratorShare, LinkShare, ShareRole } from '../../helpers';
2
+ import { DriveItemCreateLink, DriveItemInvite, ListPermissionsSpaceRootSelectEnum, Permission, SharingLinkPassword, UnifiedRoleDefinition } from '../generated';
3
+ import { GraphRequestOptions } from '../types';
4
+ type Share = CollaboratorShare | LinkShare;
5
+ type ListPermissionsResponse = {
6
+ shares: Share[];
7
+ allowedActions: string[];
8
+ allowedRoles: UnifiedRoleDefinition[];
9
+ };
10
+ export interface GraphPermissions {
11
+ getPermission<T extends Share>(driveId: string, itemId: string, permId: string, graphRoles?: Record<string, ShareRole>, requestOptions?: GraphRequestOptions): Promise<T>;
12
+ listPermissions(driveId: string, itemId: string, graphRoles?: Record<string, ShareRole>, options?: {
13
+ filter?: string;
14
+ select?: Array<ListPermissionsSpaceRootSelectEnum>;
15
+ }, requestOptions?: GraphRequestOptions): Promise<ListPermissionsResponse>;
16
+ updatePermission<T extends Share>(driveId: string, itemId: string, permId: string, data: Permission, graphRoles?: Record<string, ShareRole>, requestOptions?: GraphRequestOptions): Promise<T>;
17
+ deletePermission(driveId: string, itemId: string, permId: string, requestOptions?: GraphRequestOptions): Promise<void>;
18
+ createInvite(driveId: string, itemId: string, data: DriveItemInvite, graphRoles?: Record<string, ShareRole>, requestOptions?: GraphRequestOptions): Promise<CollaboratorShare>;
19
+ createLink(driveId: string, itemId: string, data: DriveItemCreateLink, requestOptions?: GraphRequestOptions): Promise<LinkShare>;
20
+ setPermissionPassword(driveId: string, itemId: string, permId: string, data: SharingLinkPassword, requestOptions?: GraphRequestOptions): Promise<LinkShare>;
21
+ listRoleDefinitions(requestOptions?: GraphRequestOptions): Promise<UnifiedRoleDefinition[]>;
22
+ }
23
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './tags';
2
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import { GraphFactoryOptions } from './../types';
2
+ import { GraphTags } from './types';
3
+ export declare const TagsFactory: ({ axiosClient, config }: GraphFactoryOptions) => GraphTags;
@@ -0,0 +1,7 @@
1
+ import { TagAssignment, TagUnassignment } from '../generated';
2
+ import { GraphRequestOptions } from '../types';
3
+ export interface GraphTags {
4
+ listTags(requestOptions?: GraphRequestOptions): Promise<string[]>;
5
+ assignTags(data: TagAssignment, requestOptions?: GraphRequestOptions): Promise<void>;
6
+ unassignTags(data: TagUnassignment, requestOptions?: GraphRequestOptions): Promise<void>;
7
+ }
@@ -0,0 +1,11 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Configuration } from './generated';
3
+ export interface GraphFactoryOptions {
4
+ axiosClient: AxiosInstance;
5
+ config: Configuration;
6
+ }
7
+ export interface GraphRequestOptions {
8
+ headers?: Record<string, string>;
9
+ params?: Record<string, string>;
10
+ signal?: AbortSignal;
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './users';
@@ -0,0 +1,25 @@
1
+ import { AppRoleAssignment, ExportPersonalDataRequest, PasswordChange, User } from '../generated';
2
+ import { GraphRequestOptions } from '../types';
3
+ export interface GraphUsers {
4
+ getUser: (id: string, options?: {
5
+ expand?: Array<'memberOf' | 'drive' | 'drives' | 'appRoleAssignments'>;
6
+ select?: Array<'id' | 'displayName' | 'drive' | 'drives' | 'mail' | 'memberOf' | 'onPremisesSamAccountName' | 'surname'>;
7
+ }, requestOptions?: GraphRequestOptions) => Promise<User>;
8
+ createUser: (data: User, requestOptions?: GraphRequestOptions) => Promise<User>;
9
+ editUser: (id: string, data: User, requestOptions?: GraphRequestOptions) => Promise<User>;
10
+ deleteUser: (id: string, ifMatch?: string, requestOptions?: GraphRequestOptions) => Promise<void>;
11
+ listUsers: (options?: {
12
+ expand?: Array<'memberOf' | 'drive' | 'drives' | 'appRoleAssignments'>;
13
+ filter?: string;
14
+ orderBy?: Array<'displayName' | 'displayName desc' | 'mail' | 'mail desc' | 'onPremisesSamAccountName' | 'onPremisesSamAccountName desc'>;
15
+ search?: string;
16
+ select?: Array<'id' | 'displayName' | 'mail' | 'memberOf' | 'onPremisesSamAccountName' | 'surname'>;
17
+ }, requestOptions?: GraphRequestOptions) => Promise<User[]>;
18
+ getMe: (options?: {
19
+ expand?: Array<'memberOf'>;
20
+ }, requestOptions?: GraphRequestOptions) => Promise<User>;
21
+ editMe: (user: User, requestOptions?: GraphRequestOptions) => Promise<User>;
22
+ changeOwnPassword: (change: PasswordChange, requestOptions?: GraphRequestOptions) => Promise<void>;
23
+ exportPersonalData: (id: string, destination?: ExportPersonalDataRequest, requestOptions?: GraphRequestOptions) => Promise<void>;
24
+ createUserAppRoleAssignment: (id: string, roleAssignment: AppRoleAssignment, requestOptions?: GraphRequestOptions) => Promise<AppRoleAssignment>;
25
+ }
@@ -0,0 +1,3 @@
1
+ import { GraphFactoryOptions } from './../types';
2
+ import { GraphUsers } from './types';
3
+ export declare const UsersFactory: ({ axiosClient, config }: GraphFactoryOptions) => GraphUsers;
@@ -0,0 +1 @@
1
+ export declare const call: <T>(p: Promise<T>) => Generator<Promise<T>, T, T>;
@@ -0,0 +1,9 @@
1
+ import { HttpError } from '../errors';
2
+ /**
3
+ * Create a HttpError based on a given message, status code and x-request-id.
4
+ */
5
+ export declare const createHttpError: ({ message, statusCode, xReqId }: {
6
+ message: string;
7
+ statusCode: number;
8
+ xReqId: string;
9
+ }) => HttpError;
@@ -0,0 +1,7 @@
1
+ export * from './call';
2
+ export * from './httpError';
3
+ export * from './item';
4
+ export * from './publicLink';
5
+ export * from './resource';
6
+ export * from './share';
7
+ export * from './space';
@@ -0,0 +1,3 @@
1
+ export interface Item {
2
+ id?: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ export declare function buildWebDavPublicPath(publicLinkToken: string, path?: string): string;
2
+ export declare function buildWebDavOcmPath(publicLinkToken: string, path?: string): string;
@@ -0,0 +1 @@
1
+ export * from './functions';
@@ -0,0 +1,12 @@
1
+ import { Resource, SearchResource, TrashResource, WebDavResponseResource } from './types';
2
+ export declare const isTrashResource: (resource: Resource) => resource is TrashResource;
3
+ export declare const isSearchResource: (resource: Resource) => resource is SearchResource;
4
+ export declare const extractDomSelector: (str: string) => string;
5
+ export declare const extractStorageId: (id?: string) => string;
6
+ export declare const extractNodeId: (id?: string) => string;
7
+ export declare const extractNameWithoutExtension: (resource?: Resource) => string;
8
+ export declare const extractExtensionFromFile: (resource: Resource) => string;
9
+ export declare const extractParentFolderName: (resource: Resource) => string | null;
10
+ export declare const isShareRoot: (resource: Resource) => boolean;
11
+ export declare function buildResource(resource: WebDavResponseResource, extraPropNames?: string[]): Resource;
12
+ export declare function buildDeletedResource(resource: WebDavResponseResource): TrashResource;
@@ -0,0 +1,2 @@
1
+ export * from './functions';
2
+ export * from './types';
@@ -0,0 +1,103 @@
1
+ import { DavFileInfoResponse } from '@opencloud-eu/web-client/webdav';
2
+ import { Audio, GeoCoordinates, Identity, Image, Photo, User } from '../../graph/generated';
3
+ import { MongoAbility, SubjectRawRule } from '@casl/ability';
4
+ import { DAVResultResponseProps, FileStat } from 'webdav';
5
+ export type AbilityActions = 'create' | 'create-all' | 'delete' | 'delete-all' | 'read' | 'read-all' | 'set-quota' | 'set-quota-all' | 'update' | 'update-all';
6
+ export type AbilitySubjects = 'Account' | 'Drive' | 'Favorite' | 'Group' | 'Language' | 'Logo' | 'PublicLink' | 'ReadOnlyPublicLinkPassword' | 'Role' | 'Setting' | 'Share';
7
+ export type Ability = MongoAbility<[AbilityActions, AbilitySubjects]>;
8
+ export type AbilityRule = SubjectRawRule<AbilityActions, AbilitySubjects, any>;
9
+ export type ResourceIndicatorCategory = 'system' | 'sharing';
10
+ export interface ResourceIndicator {
11
+ id: string;
12
+ accessibleDescription: string;
13
+ label: string;
14
+ icon: string;
15
+ fillType: 'fill' | 'line' | 'none';
16
+ type: string;
17
+ category: ResourceIndicatorCategory;
18
+ handler?: (resource: Resource) => void;
19
+ }
20
+ export interface Resource {
21
+ id: string;
22
+ fileId?: string;
23
+ parentFolderId?: string;
24
+ storageId?: string;
25
+ readonly nodeId?: string;
26
+ name?: string;
27
+ tags?: string[];
28
+ audio?: Audio;
29
+ location?: GeoCoordinates;
30
+ image?: Image;
31
+ photo?: Photo;
32
+ path: string;
33
+ webDavPath?: string;
34
+ downloadURL?: string;
35
+ type?: string;
36
+ thumbnail?: string;
37
+ processing?: boolean;
38
+ locked?: boolean;
39
+ lockOwner?: string;
40
+ lockTime?: string;
41
+ mimeType?: string;
42
+ isFolder?: boolean;
43
+ mdate?: string;
44
+ indicators?: ResourceIndicator[];
45
+ size?: number | string;
46
+ permissions?: string;
47
+ starred?: boolean;
48
+ etag?: string;
49
+ shareTypes?: number[];
50
+ privateLink?: string;
51
+ owner?: Identity;
52
+ extension?: string;
53
+ extraProps?: Record<string, unknown>;
54
+ remoteItemId?: string;
55
+ remoteItemPath?: string;
56
+ canCreate?(): boolean;
57
+ canUpload?({ user }: {
58
+ user?: User;
59
+ }): boolean;
60
+ canDownload?(): boolean;
61
+ canShare?(args?: {
62
+ user?: User;
63
+ ability?: Ability;
64
+ }): boolean;
65
+ canRename?(args?: {
66
+ user?: User;
67
+ ability?: Ability;
68
+ }): boolean;
69
+ canBeDeleted?(args?: {
70
+ user?: User;
71
+ ability?: Ability;
72
+ }): boolean;
73
+ canDeny?(): boolean;
74
+ canEditTags?(): boolean;
75
+ getDomSelector?(): string;
76
+ isReceivedShare?(): boolean;
77
+ isShareRoot?(): boolean;
78
+ isMounted?(): boolean;
79
+ }
80
+ export interface FolderResource extends Resource {
81
+ __folderResource?: any;
82
+ }
83
+ export interface FileResource extends Resource {
84
+ __fileResource?: any;
85
+ }
86
+ export interface TrashResource extends Resource {
87
+ ddate: string;
88
+ canBeRestored(): boolean;
89
+ }
90
+ export interface WebDavResponseTusSupport {
91
+ extension?: string[];
92
+ maxSize?: number;
93
+ resumable?: string;
94
+ version?: string[];
95
+ }
96
+ export interface WebDavResponseResource extends Omit<FileStat, 'props'> {
97
+ props?: Omit<DAVResultResponseProps, 'getcontentlength'> & DavFileInfoResponse;
98
+ processing?: boolean;
99
+ tusSupport?: WebDavResponseTusSupport;
100
+ }
101
+ export interface SearchResource extends Resource {
102
+ highlights: string;
103
+ }
@@ -0,0 +1,9 @@
1
+ /** @deprecated */
2
+ export declare abstract class SharePermissionBit {
3
+ static readonly Internal: number;
4
+ static readonly Read: number;
5
+ static readonly Update: number;
6
+ static readonly Create: number;
7
+ static readonly Delete: number;
8
+ static readonly Share: number;
9
+ }
@@ -0,0 +1,37 @@
1
+ import { Resource } from '../resource';
2
+ import { ShareResource, OutgoingShareResource, IncomingShareResource, CollaboratorShare, GraphSharePermission, LinkShare, ShareRole } from './types';
3
+ import { DriveItem, Permission, UnifiedRoleDefinition, User } from '../../graph/generated';
4
+ export declare const isShareResource: (resource: Resource) => resource is ShareResource;
5
+ export declare const isOutgoingShareResource: (resource: Resource) => resource is OutgoingShareResource;
6
+ export declare const isIncomingShareResource: (resource: Resource) => resource is IncomingShareResource;
7
+ export declare const isCollaboratorShare: (share: CollaboratorShare | LinkShare) => share is CollaboratorShare;
8
+ export declare const isLinkShare: (share: CollaboratorShare | LinkShare) => share is LinkShare;
9
+ export declare const getShareResourceRoles: ({ driveItem, graphRoles }: {
10
+ driveItem: DriveItem;
11
+ graphRoles: Record<string, ShareRole>;
12
+ }) => UnifiedRoleDefinition[];
13
+ export declare const getShareResourcePermissions: ({ driveItem, shareRoles }: {
14
+ driveItem: DriveItem;
15
+ shareRoles: UnifiedRoleDefinition[];
16
+ }) => GraphSharePermission[];
17
+ export declare function buildIncomingShareResource({ driveItem, graphRoles, serverUrl }: {
18
+ driveItem: DriveItem;
19
+ graphRoles: Record<string, ShareRole>;
20
+ serverUrl: string;
21
+ }): IncomingShareResource;
22
+ export declare function buildOutgoingShareResource({ driveItem, user, serverUrl }: {
23
+ driveItem: DriveItem;
24
+ user: User;
25
+ serverUrl: string;
26
+ }): OutgoingShareResource;
27
+ export declare function buildCollaboratorShare({ graphPermission, graphRoles, resourceId, indirect }: {
28
+ graphPermission: Permission;
29
+ graphRoles: Record<string, ShareRole>;
30
+ resourceId: string;
31
+ indirect?: boolean;
32
+ }): CollaboratorShare;
33
+ export declare function buildLinkShare({ graphPermission, resourceId, indirect }: {
34
+ graphPermission: Permission;
35
+ resourceId: string;
36
+ indirect?: boolean;
37
+ }): LinkShare;
@@ -0,0 +1,4 @@
1
+ export * from './constants';
2
+ export * from './functions';
3
+ export * from './type';
4
+ export * from './types';
@@ -0,0 +1,32 @@
1
+ export declare class ShareType {
2
+ private readonly _key;
3
+ private readonly _value;
4
+ private readonly _label;
5
+ private readonly _icon;
6
+ constructor(key: string, value: number, label: string, icon: string);
7
+ get key(): string;
8
+ get value(): number;
9
+ get label(): string;
10
+ get icon(): string;
11
+ }
12
+ export declare abstract class ShareTypes {
13
+ static readonly user: ShareType;
14
+ static readonly group: ShareType;
15
+ static readonly link: ShareType;
16
+ static readonly guest: ShareType;
17
+ static readonly remote: ShareType;
18
+ static readonly individuals: ShareType[];
19
+ static readonly collectives: ShareType[];
20
+ static readonly unauthenticated: ShareType[];
21
+ static readonly authenticated: ShareType[];
22
+ static readonly all: ShareType[];
23
+ static isIndividual(type: ShareType): boolean;
24
+ static isCollective(type: ShareType): boolean;
25
+ static isUnauthenticated(type: ShareType): boolean;
26
+ static isAuthenticated(type: ShareType): boolean;
27
+ static getByValue(value: number): ShareType;
28
+ static getByValues(values: number[]): ShareType[];
29
+ static getByKeys(keys: string[]): ShareType[];
30
+ static getValues(types: ShareType[]): number[];
31
+ static containsAnyValue(types: ShareType[], values: number[]): boolean;
32
+ }