@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.
- package/LICENSE +661 -0
- package/README.md +95 -0
- package/dist/functions-CsnDdpYv.js +1232 -0
- package/dist/functions-ikwhAVhP.cjs +1 -0
- package/dist/index-C1H-OgNf.cjs +6 -0
- package/dist/index-C6VnMvgz.cjs +6 -0
- package/dist/index-DbVGtwLH.cjs +1 -0
- package/dist/index-DqVarwg_.js +1705 -0
- package/dist/index-Pl8khka8.js +1141 -0
- package/dist/index-VvbQMSOr.js +4651 -0
- package/dist/index-eFi29SPG.cjs +16 -0
- package/dist/index-oQ7995oB.js +672 -0
- package/dist/src/errors.d.ts +10 -0
- package/dist/src/graph/activities/activities.d.ts +3 -0
- package/dist/src/graph/activities/index.d.ts +2 -0
- package/dist/src/graph/activities/types.d.ts +5 -0
- package/dist/src/graph/applications/applications.d.ts +3 -0
- package/dist/src/graph/applications/index.d.ts +2 -0
- package/dist/src/graph/applications/types.d.ts +6 -0
- package/dist/src/graph/driveItems/driveItems.d.ts +3 -0
- package/dist/src/graph/driveItems/index.d.ts +2 -0
- package/dist/src/graph/driveItems/types.d.ts +10 -0
- package/dist/src/graph/drives/drives.d.ts +3 -0
- package/dist/src/graph/drives/index.d.ts +2 -0
- package/dist/src/graph/drives/types.d.ts +18 -0
- package/dist/src/graph/generated/api.d.ts +6506 -0
- package/dist/src/graph/generated/base.d.ts +55 -0
- package/dist/src/graph/generated/common.d.ts +54 -0
- package/dist/src/graph/generated/configuration.d.ts +91 -0
- package/dist/src/graph/generated/index.d.ts +13 -0
- package/dist/src/graph/groups/groups.d.ts +3 -0
- package/dist/src/graph/groups/index.d.ts +2 -0
- package/dist/src/graph/groups/types.d.ts +19 -0
- package/dist/src/graph/index.d.ts +20 -0
- package/dist/src/graph/permissions/index.d.ts +2 -0
- package/dist/src/graph/permissions/permissions.d.ts +3 -0
- package/dist/src/graph/permissions/types.d.ts +23 -0
- package/dist/src/graph/tags/index.d.ts +2 -0
- package/dist/src/graph/tags/tags.d.ts +3 -0
- package/dist/src/graph/tags/types.d.ts +7 -0
- package/dist/src/graph/types.d.ts +11 -0
- package/dist/src/graph/users/index.d.ts +2 -0
- package/dist/src/graph/users/types.d.ts +25 -0
- package/dist/src/graph/users/users.d.ts +3 -0
- package/dist/src/helpers/call.d.ts +1 -0
- package/dist/src/helpers/httpError.d.ts +9 -0
- package/dist/src/helpers/index.d.ts +7 -0
- package/dist/src/helpers/item.d.ts +3 -0
- package/dist/src/helpers/publicLink/functions.d.ts +2 -0
- package/dist/src/helpers/publicLink/index.d.ts +1 -0
- package/dist/src/helpers/resource/functions.d.ts +12 -0
- package/dist/src/helpers/resource/index.d.ts +2 -0
- package/dist/src/helpers/resource/types.d.ts +103 -0
- package/dist/src/helpers/share/constants.d.ts +9 -0
- package/dist/src/helpers/share/functions.d.ts +37 -0
- package/dist/src/helpers/share/index.d.ts +4 -0
- package/dist/src/helpers/share/type.d.ts +32 -0
- package/dist/src/helpers/share/types.d.ts +72 -0
- package/dist/src/helpers/space/functions.d.ts +27 -0
- package/dist/src/helpers/space/index.d.ts +2 -0
- package/dist/src/helpers/space/types.d.ts +84 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/ocs/capabilities.d.ts +181 -0
- package/dist/src/ocs/index.d.ts +8 -0
- package/dist/src/ocs/urlSign.d.ts +18 -0
- package/dist/src/sse/index.d.ts +50 -0
- package/dist/src/utils/encodePath.d.ts +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/urlJoin.d.ts +19 -0
- package/dist/src/webdav/clearTrashBin.d.ts +10 -0
- package/dist/src/webdav/client/builders.d.ts +8 -0
- package/dist/src/webdav/client/dav.d.ts +53 -0
- package/dist/src/webdav/client/index.d.ts +3 -0
- package/dist/src/webdav/client/parsers.d.ts +8 -0
- package/dist/src/webdav/constants/dav.d.ts +106 -0
- package/dist/src/webdav/constants/index.d.ts +1 -0
- package/dist/src/webdav/copyFiles.d.ts +15 -0
- package/dist/src/webdav/createFolder.d.ts +14 -0
- package/dist/src/webdav/deleteFile.d.ts +8 -0
- package/dist/src/webdav/getFileContents.d.ts +17 -0
- package/dist/src/webdav/getFileInfo.d.ts +9 -0
- package/dist/src/webdav/getFileUrl.d.ts +15 -0
- package/dist/src/webdav/getPathForFileId.d.ts +5 -0
- package/dist/src/webdav/getPublicFileUrl.d.ts +6 -0
- package/dist/src/webdav/index.d.ts +7 -0
- package/dist/src/webdav/listFavoriteFiles.d.ts +12 -0
- package/dist/src/webdav/listFileVersions.d.ts +5 -0
- package/dist/src/webdav/listFiles.d.ts +21 -0
- package/dist/src/webdav/moveFiles.d.ts +15 -0
- package/dist/src/webdav/putFileContents.d.ts +18 -0
- package/dist/src/webdav/restoreFile.d.ts +12 -0
- package/dist/src/webdav/restoreFileVersion.d.ts +10 -0
- package/dist/src/webdav/search.d.ts +15 -0
- package/dist/src/webdav/setFavorite.d.ts +8 -0
- package/dist/src/webdav/types.d.ts +47 -0
- package/dist/src/webdav/utils.d.ts +13 -0
- package/dist/toString-Cn0xCZ28.js +261 -0
- package/dist/toString-hHr716Th.cjs +1 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/web-client/graph/generated.cjs +1 -0
- package/dist/web-client/graph/generated.js +5499 -0
- package/dist/web-client/graph.cjs +1 -0
- package/dist/web-client/graph.js +5 -0
- package/dist/web-client/ocs.cjs +25 -0
- package/dist/web-client/ocs.js +6014 -0
- package/dist/web-client/sse.cjs +2 -0
- package/dist/web-client/sse.js +218 -0
- package/dist/web-client/webdav.cjs +1 -0
- package/dist/web-client/webdav.js +10 -0
- package/dist/web-client.cjs +1 -0
- package/dist/web-client.js +99 -0
- package/package.json +67 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Audio, GeoCoordinates, Image, Photo } from '../../graph/generated';
|
|
2
|
+
export declare abstract class DavPermission {
|
|
3
|
+
static readonly Shared: string;
|
|
4
|
+
static readonly Shareable: string;
|
|
5
|
+
static readonly Mounted: string;
|
|
6
|
+
static readonly Deletable: string;
|
|
7
|
+
static readonly Renameable: string;
|
|
8
|
+
static readonly Moveable: string;
|
|
9
|
+
static readonly Updateable: string;
|
|
10
|
+
static readonly FileUpdateable: string;
|
|
11
|
+
static readonly FolderCreateable: string;
|
|
12
|
+
static readonly Deny: string;
|
|
13
|
+
static readonly SecureView: string;
|
|
14
|
+
}
|
|
15
|
+
export type DavErrorCode = 'ERR_LISTING_MEMBERS_NOT_ALLOWED' | 'ERR_INVALID_CREDENTIALS' | 'ERR_MISSING_BASIC_AUTH' | 'ERR_MISSING_BEARER_AUTH' | 'ERR_FILE_NOT_FOUND_IN_ROOT';
|
|
16
|
+
export declare enum DavMethod {
|
|
17
|
+
copy = "COPY",
|
|
18
|
+
delete = "DELETE",
|
|
19
|
+
lock = "LOCK",
|
|
20
|
+
mkcol = "MKCOL",
|
|
21
|
+
move = "MOVE",
|
|
22
|
+
propfind = "PROPFIND",
|
|
23
|
+
proppatch = "PROPPATCH",
|
|
24
|
+
put = "PUT",
|
|
25
|
+
report = "REPORT",
|
|
26
|
+
unlock = "UNLOCK"
|
|
27
|
+
}
|
|
28
|
+
type M<V, T> = {
|
|
29
|
+
value: V;
|
|
30
|
+
type: T;
|
|
31
|
+
};
|
|
32
|
+
declare const DavPropertyMapping: {
|
|
33
|
+
readonly Permissions: M<"permissions", string>;
|
|
34
|
+
readonly IsFavorite: M<"favorite", number>;
|
|
35
|
+
readonly FileId: M<"fileid", string>;
|
|
36
|
+
readonly FileParent: M<"file-parent", string>;
|
|
37
|
+
readonly Name: M<"name", string>;
|
|
38
|
+
readonly OwnerId: M<"owner-id", string>;
|
|
39
|
+
readonly OwnerDisplayName: M<"owner-display-name", string>;
|
|
40
|
+
readonly PrivateLink: M<"privatelink", string>;
|
|
41
|
+
readonly ContentLength: M<"getcontentlength", number>;
|
|
42
|
+
readonly ContentSize: M<"size", number>;
|
|
43
|
+
readonly LastModifiedDate: M<"getlastmodified", string>;
|
|
44
|
+
readonly Tags: M<"tags", string | number>;
|
|
45
|
+
readonly Audio: {
|
|
46
|
+
readonly value: "audio";
|
|
47
|
+
readonly type: Audio;
|
|
48
|
+
};
|
|
49
|
+
readonly Location: {
|
|
50
|
+
readonly value: "location";
|
|
51
|
+
readonly type: GeoCoordinates;
|
|
52
|
+
};
|
|
53
|
+
readonly Image: {
|
|
54
|
+
readonly value: "image";
|
|
55
|
+
readonly type: Image;
|
|
56
|
+
};
|
|
57
|
+
readonly Photo: {
|
|
58
|
+
readonly value: "photo";
|
|
59
|
+
readonly type: Photo;
|
|
60
|
+
};
|
|
61
|
+
readonly ETag: M<"getetag", string>;
|
|
62
|
+
readonly MimeType: M<"getcontenttype", string>;
|
|
63
|
+
readonly ResourceType: M<"resourcetype", string[]>;
|
|
64
|
+
readonly LockDiscovery: {
|
|
65
|
+
readonly value: "lockdiscovery";
|
|
66
|
+
readonly type: Record<string, unknown>;
|
|
67
|
+
};
|
|
68
|
+
readonly LockOwner: M<"owner", string>;
|
|
69
|
+
readonly LockTime: M<"locktime", string>;
|
|
70
|
+
readonly ActiveLock: {
|
|
71
|
+
readonly value: "activelock";
|
|
72
|
+
readonly type: Record<string, unknown>;
|
|
73
|
+
};
|
|
74
|
+
readonly DownloadURL: M<"downloadURL", string>;
|
|
75
|
+
readonly Highlights: M<"highlights", string>;
|
|
76
|
+
readonly MetaPathForUser: M<"meta-path-for-user", string>;
|
|
77
|
+
readonly RemoteItemId: M<"remote-item-id", string>;
|
|
78
|
+
readonly ShareId: M<"shareid", string>;
|
|
79
|
+
readonly ShareRoot: M<"shareroot", string>;
|
|
80
|
+
readonly ShareTypes: {
|
|
81
|
+
readonly value: "share-types";
|
|
82
|
+
readonly type: Record<string, number[]>;
|
|
83
|
+
};
|
|
84
|
+
readonly SharePermissions: M<"share-permissions", string>;
|
|
85
|
+
readonly TrashbinOriginalFilename: M<"trashbin-original-filename", string>;
|
|
86
|
+
readonly TrashbinOriginalLocation: M<"trashbin-original-location", string>;
|
|
87
|
+
readonly TrashbinDeletedDate: M<"trashbin-delete-datetime", string>;
|
|
88
|
+
readonly PublicLinkItemType: M<"public-link-item-type", string>;
|
|
89
|
+
readonly PublicLinkPermission: M<"public-link-permission", string>;
|
|
90
|
+
readonly PublicLinkExpiration: M<"public-link-expiration", string>;
|
|
91
|
+
readonly PublicLinkShareDate: M<"public-link-share-datetime", string>;
|
|
92
|
+
readonly PublicLinkShareOwner: M<"public-link-share-owner", string>;
|
|
93
|
+
};
|
|
94
|
+
type DavPropertyMappingType = typeof DavPropertyMapping;
|
|
95
|
+
export declare const DavProperty: { [K in keyof DavPropertyMappingType as K]: DavPropertyMappingType[K]["value"]; };
|
|
96
|
+
export type DavFileInfoResponse = {
|
|
97
|
+
[K in keyof DavPropertyMappingType as DavPropertyMappingType[K]['value']]: DavPropertyMappingType[K]['type'];
|
|
98
|
+
};
|
|
99
|
+
export type DavPropertyValue = (typeof DavProperty)[keyof typeof DavProperty];
|
|
100
|
+
export declare abstract class DavProperties {
|
|
101
|
+
static readonly Default: DavPropertyValue[];
|
|
102
|
+
static readonly PublicLink: DavPropertyValue[];
|
|
103
|
+
static readonly Trashbin: DavPropertyValue[];
|
|
104
|
+
static readonly DavNamespace: DavPropertyValue[];
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dav';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
3
|
+
import { WebDavOptions } from './types';
|
|
4
|
+
export declare const CopyFilesFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
copyFiles(sourceSpace: SpaceResource, { path: sourcePath, fileId: sourceFileId }: {
|
|
6
|
+
path?: string;
|
|
7
|
+
fileId?: string;
|
|
8
|
+
}, targetSpace: SpaceResource, { path: targetPath, parentFolderId, name }: {
|
|
9
|
+
path?: string;
|
|
10
|
+
parentFolderId?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
}, { overwrite, ...opts }?: {
|
|
13
|
+
overwrite?: boolean;
|
|
14
|
+
} & DAVRequestOptions): Promise<import('./client').DavResult>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FolderResource, SpaceResource } from '../helpers';
|
|
2
|
+
import { GetFileInfoFactory } from './getFileInfo';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client/dav';
|
|
4
|
+
import { WebDavOptions } from './types';
|
|
5
|
+
type CreateFolderOptions = {
|
|
6
|
+
path: string;
|
|
7
|
+
parentFolderId?: string;
|
|
8
|
+
folderName?: string;
|
|
9
|
+
fetchFolder?: boolean;
|
|
10
|
+
} & DAVRequestOptions;
|
|
11
|
+
export declare const CreateFolderFactory: (dav: DAV, getFileInfoFactory: ReturnType<typeof GetFileInfoFactory>, options: WebDavOptions) => {
|
|
12
|
+
createFolder(space: SpaceResource, { path, parentFolderId, folderName, fetchFolder, ...opts }: CreateFolderOptions): Promise<FolderResource>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
4
|
+
export declare const DeleteFileFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
deleteFile(space: SpaceResource, { path, ...opts }: {
|
|
6
|
+
path: string;
|
|
7
|
+
} & DAVRequestOptions): Promise<import('./client').DavResult>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
4
|
+
import { ResponseType } from 'axios';
|
|
5
|
+
export type GetFileContentsResponse = {
|
|
6
|
+
body: any;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
export declare const GetFileContentsFactory: (dav: DAV, { axiosClient }: WebDavOptions) => {
|
|
10
|
+
getFileContents(space: SpaceResource, { fileId, path }: {
|
|
11
|
+
fileId?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
}, { responseType, noCache, headers, ...opts }?: {
|
|
14
|
+
responseType?: ResponseType;
|
|
15
|
+
noCache?: boolean;
|
|
16
|
+
} & DAVRequestOptions): Promise<GetFileContentsResponse>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Resource, SpaceResource } from '../helpers';
|
|
2
|
+
import { ListFilesFactory, ListFilesOptions } from './listFiles';
|
|
3
|
+
import { WebDavOptions } from './types';
|
|
4
|
+
export declare const GetFileInfoFactory: (listFilesFactory: ReturnType<typeof ListFilesFactory>, options?: WebDavOptions) => {
|
|
5
|
+
getFileInfo(space: SpaceResource, resource?: {
|
|
6
|
+
path?: string;
|
|
7
|
+
fileId?: string;
|
|
8
|
+
}, options?: ListFilesOptions): Promise<Resource>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Resource, SpaceResource } from '../helpers';
|
|
2
|
+
import { GetFileContentsFactory } from './getFileContents';
|
|
3
|
+
import { WebDavOptions } from './types';
|
|
4
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
5
|
+
export declare const GetFileUrlFactory: (dav: DAV, getFileContentsFactory: ReturnType<typeof GetFileContentsFactory>, { axiosClient, baseUrl }: WebDavOptions) => {
|
|
6
|
+
getFileUrl(space: SpaceResource, resource: Resource, { disposition, isUrlSigningEnabled, signUrlTimeout, version, doHeadRequest, username, ...opts }: {
|
|
7
|
+
disposition?: "inline" | "attachment";
|
|
8
|
+
isUrlSigningEnabled?: boolean;
|
|
9
|
+
signUrlTimeout?: number;
|
|
10
|
+
version?: string;
|
|
11
|
+
doHeadRequest?: boolean;
|
|
12
|
+
username?: string;
|
|
13
|
+
} & DAVRequestOptions): Promise<string>;
|
|
14
|
+
revokeUrl: (url: string) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { DAV } from './client';
|
|
3
|
+
import { WebDavOptions } from './types';
|
|
4
|
+
export declare const GetPublicFileUrlFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
getPublicFileUrl(space: SpaceResource, publicLinkToken: string): string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Headers } from 'webdav';
|
|
2
|
+
import { WebDAV } from './types';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export type { ListFilesOptions, ListFilesResult } from './listFiles';
|
|
6
|
+
export type { GetFileContentsResponse } from './getFileContents';
|
|
7
|
+
export declare const webdav: (baseURI: string, headers?: () => Headers) => WebDAV;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebDavOptions } from './types';
|
|
2
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
3
|
+
import { DavPropertyValue } from './constants';
|
|
4
|
+
export declare const ListFavoriteFilesFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
listFavoriteFiles({ davProperties, username, ...opts }?: {
|
|
6
|
+
davProperties?: DavPropertyValue[];
|
|
7
|
+
username?: string;
|
|
8
|
+
} & DAVRequestOptions): Promise<{
|
|
9
|
+
results: import('..').WebDavResponseResource[];
|
|
10
|
+
range: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WebDavOptions } from './types';
|
|
2
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
3
|
+
export declare const ListFileVersionsFactory: (dav: DAV, options: WebDavOptions) => {
|
|
4
|
+
listFileVersions(id: string, opts?: DAVRequestOptions): Promise<import('..').Resource[]>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Resource } from '../helpers/resource';
|
|
2
|
+
import { DavPropertyValue } from './constants';
|
|
3
|
+
import { SpaceResource } from '../helpers';
|
|
4
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
5
|
+
import { GetPathForFileIdFactory } from './getPathForFileId';
|
|
6
|
+
import { WebDavOptions } from './types';
|
|
7
|
+
export type ListFilesOptions = {
|
|
8
|
+
depth?: number;
|
|
9
|
+
davProperties?: DavPropertyValue[];
|
|
10
|
+
isTrash?: boolean;
|
|
11
|
+
} & DAVRequestOptions;
|
|
12
|
+
export declare const ListFilesFactory: (dav: DAV, pathForFileIdFactory: ReturnType<typeof GetPathForFileIdFactory>, options: WebDavOptions) => {
|
|
13
|
+
listFiles(space: SpaceResource, { path, fileId }?: {
|
|
14
|
+
path?: string;
|
|
15
|
+
fileId?: string;
|
|
16
|
+
}, { depth, davProperties, isTrash, ...opts }?: ListFilesOptions): Promise<ListFilesResult>;
|
|
17
|
+
};
|
|
18
|
+
export interface ListFilesResult {
|
|
19
|
+
resource: Resource;
|
|
20
|
+
children?: Resource[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
4
|
+
export declare const MoveFilesFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
moveFiles(sourceSpace: SpaceResource, { path: sourcePath, fileId: sourceFileId }: {
|
|
6
|
+
path?: string;
|
|
7
|
+
fileId?: string;
|
|
8
|
+
}, targetSpace: SpaceResource, { path: targetPath, parentFolderId, name }: {
|
|
9
|
+
path?: string;
|
|
10
|
+
parentFolderId?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
}, { overwrite, ...opts }?: {
|
|
13
|
+
overwrite?: boolean;
|
|
14
|
+
} & DAVRequestOptions): Promise<import('./client').DavResult>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { GetFileInfoFactory } from './getFileInfo';
|
|
3
|
+
import { WebDavOptions } from './types';
|
|
4
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
5
|
+
import { ProgressEventCallback } from 'webdav';
|
|
6
|
+
type PutFileContentsOptions = {
|
|
7
|
+
fileName?: string;
|
|
8
|
+
parentFolderId?: string;
|
|
9
|
+
path?: string;
|
|
10
|
+
content?: string | ArrayBuffer;
|
|
11
|
+
previousEntityTag?: string;
|
|
12
|
+
overwrite?: boolean;
|
|
13
|
+
onUploadProgress?: ProgressEventCallback;
|
|
14
|
+
} & DAVRequestOptions;
|
|
15
|
+
export declare const PutFileContentsFactory: (dav: DAV, getFileInfoFactory: ReturnType<typeof GetFileInfoFactory>, options: WebDavOptions) => {
|
|
16
|
+
putFileContents(space: SpaceResource, { fileName, path, parentFolderId, content, previousEntityTag, overwrite, onUploadProgress, ...opts }: PutFileContentsOptions): Promise<import('..').Resource>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
4
|
+
export declare const RestoreFileFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
restoreFile(space: SpaceResource, { id }: {
|
|
6
|
+
id: string;
|
|
7
|
+
}, { path: restorePath }: {
|
|
8
|
+
path: string;
|
|
9
|
+
}, { overwrite, ...opts }?: {
|
|
10
|
+
overwrite?: boolean;
|
|
11
|
+
} & DAVRequestOptions): Promise<import('./client').DavResult>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
4
|
+
export declare const RestoreFileVersionFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
restoreFileVersion(space: SpaceResource, { parentFolderId, name, path }: {
|
|
6
|
+
parentFolderId?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
}, versionId: string, opts?: DAVRequestOptions): Promise<import('./client').DavResult>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SearchResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DavPropertyValue } from './constants';
|
|
4
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
5
|
+
export type SearchOptions = {
|
|
6
|
+
davProperties?: DavPropertyValue[];
|
|
7
|
+
searchLimit?: number;
|
|
8
|
+
} & DAVRequestOptions;
|
|
9
|
+
export type SearchResult = {
|
|
10
|
+
resources: SearchResource[];
|
|
11
|
+
totalResults: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const SearchFactory: (dav: DAV, options: WebDavOptions) => {
|
|
14
|
+
search(term: string, { davProperties, searchLimit, ...opts }: SearchOptions): Promise<SearchResult>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
import { WebDavOptions } from './types';
|
|
3
|
+
import { DAV, DAVRequestOptions } from './client';
|
|
4
|
+
export declare const SetFavoriteFactory: (dav: DAV, options: WebDavOptions) => {
|
|
5
|
+
setFavorite(space: SpaceResource, { path }: {
|
|
6
|
+
path: string;
|
|
7
|
+
}, value: unknown, opts?: DAVRequestOptions): Promise<import('./client').DavResult>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CreateFolderFactory } from './createFolder';
|
|
2
|
+
import { GetFileContentsFactory } from './getFileContents';
|
|
3
|
+
import { GetFileInfoFactory } from './getFileInfo';
|
|
4
|
+
import { GetFileUrlFactory } from './getFileUrl';
|
|
5
|
+
import { GetPublicFileUrlFactory } from './getPublicFileUrl';
|
|
6
|
+
import { ListFilesFactory } from './listFiles';
|
|
7
|
+
import { PutFileContentsFactory } from './putFileContents';
|
|
8
|
+
import { CopyFilesFactory } from './copyFiles';
|
|
9
|
+
import { MoveFilesFactory } from './moveFiles';
|
|
10
|
+
import { DeleteFileFactory } from './deleteFile';
|
|
11
|
+
import { RestoreFileFactory } from './restoreFile';
|
|
12
|
+
import { ListFileVersionsFactory } from './listFileVersions';
|
|
13
|
+
import { RestoreFileVersionFactory } from './restoreFileVersion';
|
|
14
|
+
import { ClearTrashBinFactory } from './clearTrashBin';
|
|
15
|
+
import { SearchFactory } from './search';
|
|
16
|
+
import { GetPathForFileIdFactory } from './getPathForFileId';
|
|
17
|
+
import { SetFavoriteFactory } from './setFavorite';
|
|
18
|
+
import { ListFavoriteFilesFactory } from './listFavoriteFiles';
|
|
19
|
+
import { AxiosInstance } from 'axios';
|
|
20
|
+
import { Headers } from 'webdav';
|
|
21
|
+
export interface WebDavOptions {
|
|
22
|
+
axiosClient: AxiosInstance;
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
headers?: () => Headers;
|
|
25
|
+
}
|
|
26
|
+
export interface WebDAV {
|
|
27
|
+
getFileInfo: ReturnType<typeof GetFileInfoFactory>['getFileInfo'];
|
|
28
|
+
getFileUrl: ReturnType<typeof GetFileUrlFactory>['getFileUrl'];
|
|
29
|
+
getPublicFileUrl: ReturnType<typeof GetPublicFileUrlFactory>['getPublicFileUrl'];
|
|
30
|
+
revokeUrl: ReturnType<typeof GetFileUrlFactory>['revokeUrl'];
|
|
31
|
+
listFiles: ReturnType<typeof ListFilesFactory>['listFiles'];
|
|
32
|
+
createFolder: ReturnType<typeof CreateFolderFactory>['createFolder'];
|
|
33
|
+
getFileContents: ReturnType<typeof GetFileContentsFactory>['getFileContents'];
|
|
34
|
+
putFileContents: ReturnType<typeof PutFileContentsFactory>['putFileContents'];
|
|
35
|
+
getPathForFileId: ReturnType<typeof GetPathForFileIdFactory>['getPathForFileId'];
|
|
36
|
+
copyFiles: ReturnType<typeof CopyFilesFactory>['copyFiles'];
|
|
37
|
+
moveFiles: ReturnType<typeof MoveFilesFactory>['moveFiles'];
|
|
38
|
+
deleteFile: ReturnType<typeof DeleteFileFactory>['deleteFile'];
|
|
39
|
+
restoreFile: ReturnType<typeof RestoreFileFactory>['restoreFile'];
|
|
40
|
+
listFileVersions: ReturnType<typeof ListFileVersionsFactory>['listFileVersions'];
|
|
41
|
+
restoreFileVersion: ReturnType<typeof RestoreFileVersionFactory>['restoreFileVersion'];
|
|
42
|
+
clearTrashBin: ReturnType<typeof ClearTrashBinFactory>['clearTrashBin'];
|
|
43
|
+
search: ReturnType<typeof SearchFactory>['search'];
|
|
44
|
+
listFavoriteFiles: ReturnType<typeof ListFavoriteFilesFactory>['listFavoriteFiles'];
|
|
45
|
+
setFavorite: ReturnType<typeof SetFavoriteFactory>['setFavorite'];
|
|
46
|
+
registerExtraProp(name: string): any;
|
|
47
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SpaceResource } from '../helpers';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a webdav path based on a given `path` or `fileId`. A `path` takes precedence.
|
|
4
|
+
*
|
|
5
|
+
* Public spaces currently don't support id-based paths, hence `path` needs to be provided.
|
|
6
|
+
* Some id-based requests need a resource `name` appended (mkcol, put, copy, move, restore).
|
|
7
|
+
* In this case, the `fileId` is supposed to be the id of the parent folder.
|
|
8
|
+
**/
|
|
9
|
+
export declare const getWebDavPath: (space: SpaceResource, { fileId, path, name }: {
|
|
10
|
+
fileId?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}) => string;
|