@edifice.io/client 2.6.7-develop-pedago.20260930173910 → 2.6.7-develop-integration.20261001195124
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/googledrive/Service.d.ts +52 -0
- package/dist/googledrive/interface.d.ts +41 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +506 -323
- package/dist/nextcloud/Service.d.ts +42 -0
- package/dist/nextcloud/interface.d.ts +27 -0
- package/dist/services/OdeServices.d.ts +8 -0
- package/package.json +3 -3
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IOdeServices } from '../services/OdeServices';
|
|
2
|
+
import { WorkspaceElement, WorkspaceVisibility } from '../workspace/interface';
|
|
3
|
+
import { GoogleDriveCopyFailure, GoogleDriveDocument } from './interface';
|
|
4
|
+
/**
|
|
5
|
+
* Raised when the backend failed to copy at least one document into the
|
|
6
|
+
* workspace. Carries the documents that were copied anyway, so a caller can
|
|
7
|
+
* still use them instead of discarding the whole selection.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GoogleDriveCopyError extends Error {
|
|
10
|
+
readonly copied: WorkspaceElement[];
|
|
11
|
+
readonly failures: GoogleDriveCopyFailure[];
|
|
12
|
+
constructor(message: string, copied: WorkspaceElement[], failures: GoogleDriveCopyFailure[]);
|
|
13
|
+
}
|
|
14
|
+
export declare class GoogleDriveService {
|
|
15
|
+
private context;
|
|
16
|
+
constructor(context: IOdeServices);
|
|
17
|
+
private get http();
|
|
18
|
+
/**
|
|
19
|
+
* List a user's Google Drive documents and folders inside a given folder.
|
|
20
|
+
*
|
|
21
|
+
* Google Drive addresses its entries by opaque id, not by path: `parentId` is
|
|
22
|
+
* the id of the folder to list. The query param is nonetheless named `path`,
|
|
23
|
+
* as the backend kept the name it uses for Nextcloud.
|
|
24
|
+
*
|
|
25
|
+
* @param userId - the id of the user whose files are listed.
|
|
26
|
+
* @param parentId - id of the folder to list; the Drive root when omitted.
|
|
27
|
+
*/
|
|
28
|
+
listDocuments(userId: string, parentId?: string): Promise<GoogleDriveDocument[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Copy Google Drive documents into the entcore workspace.
|
|
31
|
+
*
|
|
32
|
+
* @param userId - the id of the user whose files are copied.
|
|
33
|
+
* @param ids - Drive ids of the documents to copy.
|
|
34
|
+
* @param parentId - the workspace folder to copy into; user's root when omitted.
|
|
35
|
+
* @param params.application - the application the documents are added from.
|
|
36
|
+
* @param params.visibility - "protected" files the documents under the
|
|
37
|
+
* documents added from applications, the way an upload does.
|
|
38
|
+
* @throws GoogleDriveCopyError when the backend reports at least one failure.
|
|
39
|
+
*/
|
|
40
|
+
copyDocumentToWorkspace(userId: string, ids: string[], parentId?: string, params?: {
|
|
41
|
+
application?: string;
|
|
42
|
+
visibility?: WorkspaceVisibility;
|
|
43
|
+
}): Promise<WorkspaceElement[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Build the URL to download/preview a Google Drive document.
|
|
46
|
+
* There is no dedicated thumbnail endpoint on the backend, so this is also
|
|
47
|
+
* used as an image preview source for image documents.
|
|
48
|
+
* @param userId - the id of the user who owns the file.
|
|
49
|
+
* @param doc - the document to build the URL for.
|
|
50
|
+
*/
|
|
51
|
+
getFileUrl(userId: string, doc: GoogleDriveDocument): string;
|
|
52
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Mime type identifying a folder in Google Drive. */
|
|
2
|
+
export declare const GOOGLE_DRIVE_FOLDER_MIME_TYPE = "application/vnd.google-apps.folder";
|
|
3
|
+
/** A user's Google Drive document or folder, as consumed by the frontend. */
|
|
4
|
+
export interface GoogleDriveDocument {
|
|
5
|
+
/** Drive file id. Used as a unique id, and as the parent id when browsing. */
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
ownerDisplayName?: string;
|
|
9
|
+
contentType?: string;
|
|
10
|
+
size?: number;
|
|
11
|
+
isFolder: boolean;
|
|
12
|
+
lastModified?: string;
|
|
13
|
+
shared?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Raw DTO returned by the `/googledrive/files/user/:userId` endpoint. */
|
|
16
|
+
export interface GoogleDriveDocumentResponse {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
mimeType: string;
|
|
20
|
+
size?: number;
|
|
21
|
+
modifiedTime?: string;
|
|
22
|
+
shared?: boolean;
|
|
23
|
+
ownerDisplayName?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Per-document outcome returned by the copy-to-workspace endpoint. Unlike the
|
|
27
|
+
* Nextcloud equivalent, which returns a flat array of workspace documents, each
|
|
28
|
+
* entry here wraps the created document under `workspace` and carries its own
|
|
29
|
+
* status, so a copy can partially fail.
|
|
30
|
+
*/
|
|
31
|
+
export interface GoogleDriveCopyResult<TWorkspaceElement> {
|
|
32
|
+
id: string;
|
|
33
|
+
status?: 'ok' | 'error';
|
|
34
|
+
message?: string;
|
|
35
|
+
workspace?: TWorkspaceElement | null;
|
|
36
|
+
}
|
|
37
|
+
/** A single document the backend failed to copy into the workspace. */
|
|
38
|
+
export interface GoogleDriveCopyFailure {
|
|
39
|
+
id: string;
|
|
40
|
+
message?: string;
|
|
41
|
+
}
|