@eltjs/sdk-microsoft-sharepoint 0.3.10 → 0.3.12
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/drive-item.d.ts +1 -2
- package/dist/drive-item.js +1 -1
- package/dist/sharepoint-client.d.ts +14 -1
- package/dist/sharepoint-client.js +24 -1
- package/package.json +4 -4
package/dist/drive-item.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const DRIVE_ITEM_FIELDS: string;
|
|
3
3
|
/** A file or a folder of a drive, as it is now. */
|
|
4
|
-
declare const presentDriveItem: z.ZodObject<{
|
|
4
|
+
export declare const presentDriveItem: z.ZodObject<{
|
|
5
5
|
id: z.ZodString;
|
|
6
6
|
name: z.ZodString;
|
|
7
7
|
size: z.ZodNumber;
|
|
@@ -144,4 +144,3 @@ export declare const driveItem: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
144
144
|
export type DriveItem = z.infer<typeof driveItem>;
|
|
145
145
|
/** A file or a folder of a drive as it is now: a drive item that is not deleted. */
|
|
146
146
|
export type PresentDriveItem = z.infer<typeof presentDriveItem>;
|
|
147
|
-
export {};
|
package/dist/drive-item.js
CHANGED
|
@@ -28,7 +28,7 @@ const parentReference = z.object({
|
|
|
28
28
|
path: z.string().optional(),
|
|
29
29
|
});
|
|
30
30
|
/** A file or a folder of a drive, as it is now. */
|
|
31
|
-
const presentDriveItem = z.object({
|
|
31
|
+
export const presentDriveItem = z.object({
|
|
32
32
|
id: z.string(),
|
|
33
33
|
name: z.string(),
|
|
34
34
|
size: z.number(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Column } from './column.ts';
|
|
2
2
|
import { type DeltaPage } from './delta.ts';
|
|
3
|
-
import { type DriveItem } from './drive-item.ts';
|
|
3
|
+
import { type DriveItem, type PresentDriveItem } from './drive-item.ts';
|
|
4
4
|
import { type Drive } from './drive.ts';
|
|
5
5
|
import { type SharePointClientOptions } from './graph.ts';
|
|
6
6
|
import { type ListItem, type PresentListItem } from './list-item.ts';
|
|
@@ -36,6 +36,19 @@ export declare class SharePointClient {
|
|
|
36
36
|
* changes after it. `link` is a nextLink or a deltaLink of an earlier page.
|
|
37
37
|
*/
|
|
38
38
|
driveDelta(driveId: string, link: string | undefined, signal: AbortSignal): AsyncGenerator<DeltaPage<DriveItem>, void, undefined>;
|
|
39
|
+
/**
|
|
40
|
+
* The delta link of a drive as it is now, without its items: a later
|
|
41
|
+
* `driveDelta` from it gives only the changes after this call.
|
|
42
|
+
*/
|
|
43
|
+
latestDriveDeltaLink(driveId: string, signal: AbortSignal): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* The file or the folder at `path` from the root of a drive, such as
|
|
46
|
+
* `02 BD Resources/Proposals`. No item there fails with a GraphError of
|
|
47
|
+
* status 404.
|
|
48
|
+
*/
|
|
49
|
+
driveItemAt(driveId: string, path: string, signal: AbortSignal): Promise<PresentDriveItem>;
|
|
50
|
+
/** The files and folders directly in a folder of a drive. */
|
|
51
|
+
children(driveId: string, folderId: string, signal: AbortSignal): Promise<readonly PresentDriveItem[]>;
|
|
39
52
|
/**
|
|
40
53
|
* The items of a list with their fields: every one without `link`, else
|
|
41
54
|
* the changes after it. `link` is a nextLink or a deltaLink of an earlier
|
|
@@ -3,7 +3,7 @@ import { Readable } from 'node:stream';
|
|
|
3
3
|
import { pipeline } from 'node:stream/promises';
|
|
4
4
|
import { column } from './column.js';
|
|
5
5
|
import { deltaPage } from './delta.js';
|
|
6
|
-
import { DRIVE_ITEM_FIELDS, driveItem } from './drive-item.js';
|
|
6
|
+
import { DRIVE_ITEM_FIELDS, driveItem, presentDriveItem, } from './drive-item.js';
|
|
7
7
|
import { DRIVE_FIELDS, drive } from './drive.js';
|
|
8
8
|
import { DeltaExpiredError, GraphError, SharePointSiteNotFoundError, } from './errors.js';
|
|
9
9
|
import { Graph } from './graph.js';
|
|
@@ -64,6 +64,29 @@ export class SharePointClient {
|
|
|
64
64
|
driveDelta(driveId, link, signal) {
|
|
65
65
|
return this.#delta(link ?? `/drives/${driveId}/root/delta?$select=${DRIVE_ITEM_FIELDS}`, driveItem, `the drive ${driveId}`, signal);
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* The delta link of a drive as it is now, without its items: a later
|
|
69
|
+
* `driveDelta` from it gives only the changes after this call.
|
|
70
|
+
*/
|
|
71
|
+
async latestDriveDeltaLink(driveId, signal) {
|
|
72
|
+
const page = await this.#graph.json(`/drives/${driveId}/root/delta?token=latest&$select=${DRIVE_ITEM_FIELDS}`, deltaPage(driveItem), `the drive ${driveId}`, signal);
|
|
73
|
+
if (!('deltaLink' in page))
|
|
74
|
+
throw new TypeError(`Graph answered the latest delta of the drive ${driveId} with a next link, not a delta link`);
|
|
75
|
+
return page.deltaLink;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The file or the folder at `path` from the root of a drive, such as
|
|
79
|
+
* `02 BD Resources/Proposals`. No item there fails with a GraphError of
|
|
80
|
+
* status 404.
|
|
81
|
+
*/
|
|
82
|
+
driveItemAt(driveId, path, signal) {
|
|
83
|
+
const segments = path.split('/').map(encodeURIComponent).join('/');
|
|
84
|
+
return this.#graph.json(`/drives/${driveId}/root:/${segments}?$select=${DRIVE_ITEM_FIELDS}`, presentDriveItem, `the drive ${driveId}`, signal);
|
|
85
|
+
}
|
|
86
|
+
/** The files and folders directly in a folder of a drive. */
|
|
87
|
+
children(driveId, folderId, signal) {
|
|
88
|
+
return this.#graph.collection(`/drives/${driveId}/items/${folderId}/children?$select=${DRIVE_ITEM_FIELDS}`, presentDriveItem, `the drive ${driveId}`, signal);
|
|
89
|
+
}
|
|
67
90
|
/**
|
|
68
91
|
* The items of a list with their fields: every one without `link`, else
|
|
69
92
|
* the changes after it. `link` is a nextLink or a deltaLink of an earlier
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eltjs/sdk-microsoft-sharepoint",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Reads SharePoint Online sites through Microsoft Graph with an app-only token: drives, lists, pages, delta feeds, downloads and a change signal. It knows nothing of elt.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@azure/msal-node": "^7.2.2",
|
|
40
|
-
"@zukhruf/async": "^0.8.
|
|
40
|
+
"@zukhruf/async": "^0.8.27",
|
|
41
41
|
"zod": "4.6.5"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@zukhruf/fs": "^0.8.
|
|
45
|
-
"@zukhruf/testing": "^0.8.
|
|
44
|
+
"@zukhruf/fs": "^0.8.27",
|
|
45
|
+
"@zukhruf/testing": "^0.8.27",
|
|
46
46
|
"msw": "^3.0.3"
|
|
47
47
|
}
|
|
48
48
|
}
|