@eltjs/source-microsoft-sharepoint 0.0.0-stage → 0.3.11
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 +202 -0
- package/README.md +214 -2
- package/dist/delta-stream.d.ts +22 -0
- package/dist/delta-stream.js +115 -0
- package/dist/list-item-record.d.ts +59 -0
- package/dist/list-item-record.js +59 -0
- package/dist/sharepoint-run.d.ts +19 -0
- package/dist/sharepoint-run.js +57 -0
- package/dist/sharepoint-source.d.ts +33 -0
- package/dist/sharepoint-source.js +100 -0
- package/dist/sharepoint-stream.d.ts +70 -0
- package/dist/sharepoint-stream.js +84 -0
- package/dist/snapshot-stream.d.ts +13 -0
- package/dist/snapshot-stream.js +25 -0
- package/dist/streams/access-requests-stream.d.ts +8 -0
- package/dist/streams/access-requests-stream.js +20 -0
- package/dist/streams/drive-items-stream.d.ts +10 -0
- package/dist/streams/drive-items-stream.js +163 -0
- package/dist/streams/drives-stream.d.ts +46 -0
- package/dist/streams/drives-stream.js +52 -0
- package/dist/streams/list-columns-stream.d.ts +69 -0
- package/dist/streams/list-columns-stream.js +75 -0
- package/dist/streams/list-items-stream.d.ts +10 -0
- package/dist/streams/list-items-stream.js +36 -0
- package/dist/streams/lists-stream.d.ts +58 -0
- package/dist/streams/lists-stream.js +64 -0
- package/dist/streams/pages-stream.d.ts +74 -0
- package/dist/streams/pages-stream.js +83 -0
- package/dist/streams/sites-stream.d.ts +46 -0
- package/dist/streams/sites-stream.js +49 -0
- package/package.json +52 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RecordDraft } from '@eltjs/elt';
|
|
2
|
+
import type { SharePointRun } from '../sharepoint-run.ts';
|
|
3
|
+
import { SnapshotStream } from '../snapshot-stream.ts';
|
|
4
|
+
declare const properties: {
|
|
5
|
+
readonly siteUrl: {
|
|
6
|
+
type: 'string';
|
|
7
|
+
minLength: 1;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
readonly driveId: {
|
|
11
|
+
readonly type: 'string';
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
readonly description: "Graph's ID of the document library. driveItems.driveId refers to it.";
|
|
14
|
+
};
|
|
15
|
+
readonly name: {
|
|
16
|
+
readonly type: 'string';
|
|
17
|
+
readonly description: 'The name of the document library.';
|
|
18
|
+
};
|
|
19
|
+
readonly description: {
|
|
20
|
+
readonly type: readonly ['string', 'null'];
|
|
21
|
+
readonly description: 'The description of the document library. NULL when nobody wrote one.';
|
|
22
|
+
};
|
|
23
|
+
readonly driveType: {
|
|
24
|
+
readonly type: 'string';
|
|
25
|
+
readonly description: 'The kind of drive: documentLibrary for a SharePoint library.';
|
|
26
|
+
};
|
|
27
|
+
readonly webUrl: {
|
|
28
|
+
readonly type: 'string';
|
|
29
|
+
readonly description: 'The URL of the document library.';
|
|
30
|
+
};
|
|
31
|
+
readonly createdDateTime: {
|
|
32
|
+
readonly type: 'string';
|
|
33
|
+
readonly format: 'date-time';
|
|
34
|
+
readonly description: 'When the document library was created, in UTC.';
|
|
35
|
+
};
|
|
36
|
+
readonly lastModifiedDateTime: {
|
|
37
|
+
readonly type: 'string';
|
|
38
|
+
readonly format: 'date-time';
|
|
39
|
+
readonly description: 'When a file or a folder of the document library last changed, in UTC.';
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare class DrivesStream extends SnapshotStream {
|
|
43
|
+
constructor();
|
|
44
|
+
protected scan(url: string, run: SharePointRun, signal: AbortSignal): AsyncGenerator<RecordDraft<typeof properties>>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { instant, sharePointFields, siteUrl } from '../sharepoint-stream.js';
|
|
2
|
+
import { SnapshotStream } from '../snapshot-stream.js';
|
|
3
|
+
const { id, text, nullableText, timestamp } = sharePointFields;
|
|
4
|
+
const properties = {
|
|
5
|
+
siteUrl,
|
|
6
|
+
driveId: {
|
|
7
|
+
...id,
|
|
8
|
+
description: "Graph's ID of the document library. driveItems.driveId refers to it.",
|
|
9
|
+
},
|
|
10
|
+
name: { ...text, description: 'The name of the document library.' },
|
|
11
|
+
description: {
|
|
12
|
+
...nullableText,
|
|
13
|
+
description: 'The description of the document library. NULL when nobody wrote one.',
|
|
14
|
+
},
|
|
15
|
+
driveType: {
|
|
16
|
+
...text,
|
|
17
|
+
description: 'The kind of drive: documentLibrary for a SharePoint library.',
|
|
18
|
+
},
|
|
19
|
+
webUrl: { ...text, description: 'The URL of the document library.' },
|
|
20
|
+
createdDateTime: {
|
|
21
|
+
...timestamp,
|
|
22
|
+
description: 'When the document library was created, in UTC.',
|
|
23
|
+
},
|
|
24
|
+
lastModifiedDateTime: {
|
|
25
|
+
...timestamp,
|
|
26
|
+
description: 'When a file or a folder of the document library last changed, in UTC.',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export class DrivesStream extends SnapshotStream {
|
|
30
|
+
constructor() {
|
|
31
|
+
super({
|
|
32
|
+
name: 'drives',
|
|
33
|
+
description: 'One record for each document library of the site, as Graph shows it: a drive of files and folders. Primary key siteUrl, driveId. An incremental read deletes a library that Graph no longer lists.',
|
|
34
|
+
properties,
|
|
35
|
+
primaryKey: ['siteUrl', 'driveId'],
|
|
36
|
+
covers: 'Every document library of each configured site.',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async *scan(url, run, signal) {
|
|
40
|
+
for (const drive of await run.drives(url, signal))
|
|
41
|
+
yield {
|
|
42
|
+
siteUrl: url,
|
|
43
|
+
driveId: drive.id,
|
|
44
|
+
name: drive.name,
|
|
45
|
+
description: drive.description ?? null,
|
|
46
|
+
driveType: drive.driveType,
|
|
47
|
+
webUrl: drive.webUrl,
|
|
48
|
+
createdDateTime: instant(drive.createdDateTime),
|
|
49
|
+
lastModifiedDateTime: instant(drive.lastModifiedDateTime),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { RecordDraft } from '@eltjs/elt';
|
|
2
|
+
import type { SharePointRun } from '../sharepoint-run.ts';
|
|
3
|
+
import { SnapshotStream } from '../snapshot-stream.ts';
|
|
4
|
+
declare const properties: {
|
|
5
|
+
readonly siteUrl: {
|
|
6
|
+
type: 'string';
|
|
7
|
+
minLength: 1;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
readonly listId: {
|
|
11
|
+
readonly type: 'string';
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
readonly description: 'The list of the column: lists.listId.';
|
|
14
|
+
};
|
|
15
|
+
readonly columnId: {
|
|
16
|
+
readonly type: 'string';
|
|
17
|
+
readonly minLength: 1;
|
|
18
|
+
readonly description: "Graph's ID of the column. A site column has the same ID in each list that uses it.";
|
|
19
|
+
};
|
|
20
|
+
readonly name: {
|
|
21
|
+
readonly type: 'string';
|
|
22
|
+
readonly description: 'The name of the column: the key of its value in the fields of listItems and accessRequests.';
|
|
23
|
+
};
|
|
24
|
+
readonly displayName: {
|
|
25
|
+
readonly type: 'string';
|
|
26
|
+
readonly description: 'The title of the column.';
|
|
27
|
+
};
|
|
28
|
+
readonly description: {
|
|
29
|
+
readonly type: readonly ['string', 'null'];
|
|
30
|
+
readonly description: 'The description of the column. NULL when nobody wrote one.';
|
|
31
|
+
};
|
|
32
|
+
readonly columnGroup: {
|
|
33
|
+
readonly type: readonly ['string', 'null'];
|
|
34
|
+
readonly description: 'The group of the column. NULL when it has none.';
|
|
35
|
+
};
|
|
36
|
+
readonly hidden: {
|
|
37
|
+
readonly type: 'boolean';
|
|
38
|
+
readonly description: 'Whether SharePoint hides the column from forms.';
|
|
39
|
+
};
|
|
40
|
+
readonly indexed: {
|
|
41
|
+
readonly type: 'boolean';
|
|
42
|
+
readonly description: 'Whether the column is indexed.';
|
|
43
|
+
};
|
|
44
|
+
readonly readOnly: {
|
|
45
|
+
readonly type: 'boolean';
|
|
46
|
+
readonly description: 'Whether nobody can edit the column.';
|
|
47
|
+
};
|
|
48
|
+
readonly required: {
|
|
49
|
+
readonly type: 'boolean';
|
|
50
|
+
readonly description: 'Whether each item needs a value.';
|
|
51
|
+
};
|
|
52
|
+
readonly enforceUniqueValues: {
|
|
53
|
+
readonly type: 'boolean';
|
|
54
|
+
readonly description: 'Whether no two items can have the same value.';
|
|
55
|
+
};
|
|
56
|
+
readonly type: {
|
|
57
|
+
readonly type: readonly ['string', 'null'];
|
|
58
|
+
readonly description: 'The type of the column, as the facet of Graph: text, choice, number, dateTime, lookup, personOrGroup, boolean, calculated, currency, geolocation, hyperlinkOrPicture, term, thumbnail or contentApprovalStatus. NULL for a type that Graph does not model.';
|
|
59
|
+
};
|
|
60
|
+
readonly settings: {
|
|
61
|
+
readonly type: readonly ['string', 'null'];
|
|
62
|
+
readonly description: 'The settings of the type as JSON, such as the choices of a choice column. NULL for a type that Graph does not model.';
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export declare class ListColumnsStream extends SnapshotStream {
|
|
66
|
+
constructor();
|
|
67
|
+
protected scan(url: string, run: SharePointRun, signal: AbortSignal): AsyncGenerator<RecordDraft<typeof properties>>;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { json, sharePointFields, siteUrl } from '../sharepoint-stream.js';
|
|
2
|
+
import { SnapshotStream } from '../snapshot-stream.js';
|
|
3
|
+
const { id, text, nullableText, boolean } = sharePointFields;
|
|
4
|
+
const properties = {
|
|
5
|
+
siteUrl,
|
|
6
|
+
listId: { ...id, description: 'The list of the column: lists.listId.' },
|
|
7
|
+
columnId: {
|
|
8
|
+
...id,
|
|
9
|
+
description: "Graph's ID of the column. A site column has the same ID in each list that uses it.",
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
...text,
|
|
13
|
+
description: 'The name of the column: the key of its value in the fields of listItems and accessRequests.',
|
|
14
|
+
},
|
|
15
|
+
displayName: { ...text, description: 'The title of the column.' },
|
|
16
|
+
description: {
|
|
17
|
+
...nullableText,
|
|
18
|
+
description: 'The description of the column. NULL when nobody wrote one.',
|
|
19
|
+
},
|
|
20
|
+
columnGroup: {
|
|
21
|
+
...nullableText,
|
|
22
|
+
description: 'The group of the column. NULL when it has none.',
|
|
23
|
+
},
|
|
24
|
+
hidden: {
|
|
25
|
+
...boolean,
|
|
26
|
+
description: 'Whether SharePoint hides the column from forms.',
|
|
27
|
+
},
|
|
28
|
+
indexed: { ...boolean, description: 'Whether the column is indexed.' },
|
|
29
|
+
readOnly: { ...boolean, description: 'Whether nobody can edit the column.' },
|
|
30
|
+
required: { ...boolean, description: 'Whether each item needs a value.' },
|
|
31
|
+
enforceUniqueValues: {
|
|
32
|
+
...boolean,
|
|
33
|
+
description: 'Whether no two items can have the same value.',
|
|
34
|
+
},
|
|
35
|
+
type: {
|
|
36
|
+
...nullableText,
|
|
37
|
+
description: 'The type of the column, as the facet of Graph: text, choice, number, dateTime, lookup, personOrGroup, boolean, calculated, currency, geolocation, hyperlinkOrPicture, term, thumbnail or contentApprovalStatus. NULL for a type that Graph does not model.',
|
|
38
|
+
},
|
|
39
|
+
settings: {
|
|
40
|
+
...nullableText,
|
|
41
|
+
description: 'The settings of the type as JSON, such as the choices of a choice column. NULL for a type that Graph does not model.',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export class ListColumnsStream extends SnapshotStream {
|
|
45
|
+
constructor() {
|
|
46
|
+
super({
|
|
47
|
+
name: 'listColumns',
|
|
48
|
+
description: 'One record for each column of each list of the site that is not hidden from Graph. Primary key siteUrl, listId, columnId. An incremental read deletes a column that Graph no longer lists.',
|
|
49
|
+
properties,
|
|
50
|
+
primaryKey: ['siteUrl', 'listId', 'columnId'],
|
|
51
|
+
covers: 'The columns of every list of each configured site, as Graph lists them.',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async *scan(url, run, signal) {
|
|
55
|
+
const { id: siteId } = await run.site(url, signal);
|
|
56
|
+
for (const list of await run.lists(url, signal))
|
|
57
|
+
for (const column of await run.client.columns(siteId, list.id, signal))
|
|
58
|
+
yield {
|
|
59
|
+
siteUrl: url,
|
|
60
|
+
listId: list.id,
|
|
61
|
+
columnId: column.id,
|
|
62
|
+
name: column.name,
|
|
63
|
+
displayName: column.displayName,
|
|
64
|
+
description: column.description ?? null,
|
|
65
|
+
columnGroup: column.columnGroup ?? null,
|
|
66
|
+
hidden: column.hidden,
|
|
67
|
+
indexed: column.indexed,
|
|
68
|
+
readOnly: column.readOnly,
|
|
69
|
+
required: column.required,
|
|
70
|
+
enforceUniqueValues: column.enforceUniqueValues,
|
|
71
|
+
type: column.type?.name ?? null,
|
|
72
|
+
settings: json(column.type?.settings),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CopyConfiguration, SourceMessage } from '@eltjs/elt';
|
|
2
|
+
import type { DeltaPage, ListItem } from '@eltjs/sdk-microsoft-sharepoint';
|
|
3
|
+
import { DeltaStream } from '../delta-stream.ts';
|
|
4
|
+
import type { SharePointRun } from '../sharepoint-run.ts';
|
|
5
|
+
export declare class ListItemsStream extends DeltaStream<ListItem> {
|
|
6
|
+
constructor();
|
|
7
|
+
protected collections(url: string, run: SharePointRun, signal: AbortSignal): Promise<readonly string[]>;
|
|
8
|
+
protected pages(url: string, listId: string, link: string | undefined, run: SharePointRun, signal: AbortSignal): AsyncGenerator<DeltaPage<ListItem>>;
|
|
9
|
+
protected messages(configuration: CopyConfiguration, url: string, listId: string, item: ListItem): AsyncGenerator<SourceMessage>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DeltaStream } from '../delta-stream.js';
|
|
2
|
+
import { accessRequestTemplate, listItemProperties, listItemRecord, } from '../list-item-record.js';
|
|
3
|
+
export class ListItemsStream extends DeltaStream {
|
|
4
|
+
constructor() {
|
|
5
|
+
super({
|
|
6
|
+
name: 'listItems',
|
|
7
|
+
description: 'One record for each item of each list of the site, the items of document libraries included, with the value of each column as JSON. The lists of the requests for access are in accessRequests. Primary key siteUrl, listId, itemId. Read through the list items delta of Graph: the first read loads every item, and later reads apply the changes and deletions after it.',
|
|
8
|
+
properties: listItemProperties,
|
|
9
|
+
primaryKey: ['siteUrl', 'listId', 'itemId'],
|
|
10
|
+
covers: 'Every item of every list of each configured site but the lists of the requests for access, then the changes that the list items delta of Graph reports.',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async collections(url, run, signal) {
|
|
14
|
+
return (await run.lists(url, signal))
|
|
15
|
+
.filter((list) => list.list.template !== accessRequestTemplate)
|
|
16
|
+
.map((list) => list.id);
|
|
17
|
+
}
|
|
18
|
+
async *pages(url, listId, link, run, signal) {
|
|
19
|
+
const { id: siteId } = await run.site(url, signal);
|
|
20
|
+
yield* run.client.listItemsDelta(siteId, listId, link, signal);
|
|
21
|
+
}
|
|
22
|
+
async *messages(configuration, url, listId, item) {
|
|
23
|
+
if (item.deleted !== undefined) {
|
|
24
|
+
yield* this.deletion(configuration, {
|
|
25
|
+
siteUrl: url,
|
|
26
|
+
listId,
|
|
27
|
+
itemId: item.id,
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
yield {
|
|
32
|
+
stream: this.stream.name,
|
|
33
|
+
data: this.validated(listItemRecord(url, listId, item)),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { RecordDraft } from '@eltjs/elt';
|
|
2
|
+
import type { SharePointRun } from '../sharepoint-run.ts';
|
|
3
|
+
import { SnapshotStream } from '../snapshot-stream.ts';
|
|
4
|
+
declare const properties: {
|
|
5
|
+
readonly siteUrl: {
|
|
6
|
+
type: 'string';
|
|
7
|
+
minLength: 1;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
readonly listId: {
|
|
11
|
+
readonly type: 'string';
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
readonly description: "Graph's ID of the list. listColumns, listItems and accessRequests refer to it as listId.";
|
|
14
|
+
};
|
|
15
|
+
readonly name: {
|
|
16
|
+
readonly type: 'string';
|
|
17
|
+
readonly description: 'The name of the list in its URL.';
|
|
18
|
+
};
|
|
19
|
+
readonly displayName: {
|
|
20
|
+
readonly type: 'string';
|
|
21
|
+
readonly description: 'The title of the list.';
|
|
22
|
+
};
|
|
23
|
+
readonly description: {
|
|
24
|
+
readonly type: readonly ['string', 'null'];
|
|
25
|
+
readonly description: 'The description of the list. NULL when nobody wrote one.';
|
|
26
|
+
};
|
|
27
|
+
readonly webUrl: {
|
|
28
|
+
readonly type: 'string';
|
|
29
|
+
readonly description: 'The URL of the list.';
|
|
30
|
+
};
|
|
31
|
+
readonly template: {
|
|
32
|
+
readonly type: 'string';
|
|
33
|
+
readonly description: 'What kind of list it is, such as genericList, events, documentLibrary (a document library, also in drives) or accessRequest (the requests for access to the site, read by accessRequests).';
|
|
34
|
+
};
|
|
35
|
+
readonly hidden: {
|
|
36
|
+
readonly type: 'boolean';
|
|
37
|
+
readonly description: 'Whether SharePoint hides the list from the site contents.';
|
|
38
|
+
};
|
|
39
|
+
readonly contentTypesEnabled: {
|
|
40
|
+
readonly type: 'boolean';
|
|
41
|
+
readonly description: 'Whether the list has content types of its own.';
|
|
42
|
+
};
|
|
43
|
+
readonly createdDateTime: {
|
|
44
|
+
readonly type: 'string';
|
|
45
|
+
readonly format: 'date-time';
|
|
46
|
+
readonly description: 'When the list was created, in UTC.';
|
|
47
|
+
};
|
|
48
|
+
readonly lastModifiedDateTime: {
|
|
49
|
+
readonly type: 'string';
|
|
50
|
+
readonly format: 'date-time';
|
|
51
|
+
readonly description: 'When the list or one of its items last changed, in UTC.';
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare class ListsStream extends SnapshotStream {
|
|
55
|
+
constructor();
|
|
56
|
+
protected scan(url: string, run: SharePointRun, signal: AbortSignal): AsyncGenerator<RecordDraft<typeof properties>>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { instant, sharePointFields, siteUrl } from '../sharepoint-stream.js';
|
|
2
|
+
import { SnapshotStream } from '../snapshot-stream.js';
|
|
3
|
+
const { id, text, nullableText, boolean, timestamp } = sharePointFields;
|
|
4
|
+
const properties = {
|
|
5
|
+
siteUrl,
|
|
6
|
+
listId: {
|
|
7
|
+
...id,
|
|
8
|
+
description: "Graph's ID of the list. listColumns, listItems and accessRequests refer to it as listId.",
|
|
9
|
+
},
|
|
10
|
+
name: { ...text, description: 'The name of the list in its URL.' },
|
|
11
|
+
displayName: { ...text, description: 'The title of the list.' },
|
|
12
|
+
description: {
|
|
13
|
+
...nullableText,
|
|
14
|
+
description: 'The description of the list. NULL when nobody wrote one.',
|
|
15
|
+
},
|
|
16
|
+
webUrl: { ...text, description: 'The URL of the list.' },
|
|
17
|
+
template: {
|
|
18
|
+
...text,
|
|
19
|
+
description: 'What kind of list it is, such as genericList, events, documentLibrary (a document library, also in drives) or accessRequest (the requests for access to the site, read by accessRequests).',
|
|
20
|
+
},
|
|
21
|
+
hidden: {
|
|
22
|
+
...boolean,
|
|
23
|
+
description: 'Whether SharePoint hides the list from the site contents.',
|
|
24
|
+
},
|
|
25
|
+
contentTypesEnabled: {
|
|
26
|
+
...boolean,
|
|
27
|
+
description: 'Whether the list has content types of its own.',
|
|
28
|
+
},
|
|
29
|
+
createdDateTime: {
|
|
30
|
+
...timestamp,
|
|
31
|
+
description: 'When the list was created, in UTC.',
|
|
32
|
+
},
|
|
33
|
+
lastModifiedDateTime: {
|
|
34
|
+
...timestamp,
|
|
35
|
+
description: 'When the list or one of its items last changed, in UTC.',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export class ListsStream extends SnapshotStream {
|
|
39
|
+
constructor() {
|
|
40
|
+
super({
|
|
41
|
+
name: 'lists',
|
|
42
|
+
description: 'One record for each list of the site, hidden lists and document libraries included. Graph leaves out the lists it marks system. Primary key siteUrl, listId. An incremental read deletes a list that Graph no longer lists.',
|
|
43
|
+
properties,
|
|
44
|
+
primaryKey: ['siteUrl', 'listId'],
|
|
45
|
+
covers: 'Every list of each configured site that Graph does not mark system.',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async *scan(url, run, signal) {
|
|
49
|
+
for (const list of await run.lists(url, signal))
|
|
50
|
+
yield {
|
|
51
|
+
siteUrl: url,
|
|
52
|
+
listId: list.id,
|
|
53
|
+
name: list.name,
|
|
54
|
+
displayName: list.displayName,
|
|
55
|
+
description: list.description ?? null,
|
|
56
|
+
webUrl: list.webUrl,
|
|
57
|
+
template: list.list.template,
|
|
58
|
+
hidden: list.list.hidden,
|
|
59
|
+
contentTypesEnabled: list.list.contentTypesEnabled,
|
|
60
|
+
createdDateTime: instant(list.createdDateTime),
|
|
61
|
+
lastModifiedDateTime: instant(list.lastModifiedDateTime),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { RecordDraft } from '@eltjs/elt';
|
|
2
|
+
import type { SharePointRun } from '../sharepoint-run.ts';
|
|
3
|
+
import { SnapshotStream } from '../snapshot-stream.ts';
|
|
4
|
+
declare const properties: {
|
|
5
|
+
readonly siteUrl: {
|
|
6
|
+
type: 'string';
|
|
7
|
+
minLength: 1;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
readonly pageId: {
|
|
11
|
+
readonly type: 'string';
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
readonly description: "Graph's ID of the page.";
|
|
14
|
+
};
|
|
15
|
+
readonly name: {
|
|
16
|
+
readonly type: 'string';
|
|
17
|
+
readonly description: 'The file name of the page, such as Home.aspx.';
|
|
18
|
+
};
|
|
19
|
+
readonly title: {
|
|
20
|
+
readonly type: 'string';
|
|
21
|
+
readonly description: 'The title of the page.';
|
|
22
|
+
};
|
|
23
|
+
readonly description: {
|
|
24
|
+
readonly type: readonly ['string', 'null'];
|
|
25
|
+
readonly description: 'The description of the page. NULL when it has none.';
|
|
26
|
+
};
|
|
27
|
+
readonly webUrl: {
|
|
28
|
+
readonly type: 'string';
|
|
29
|
+
readonly description: 'The URL of the page.';
|
|
30
|
+
};
|
|
31
|
+
readonly pageLayout: {
|
|
32
|
+
readonly type: readonly ['string', 'null'];
|
|
33
|
+
readonly description: 'The layout of the page, such as article or home. NULL when Graph gives none.';
|
|
34
|
+
};
|
|
35
|
+
readonly eTag: {
|
|
36
|
+
readonly type: readonly ['string', 'null'];
|
|
37
|
+
readonly description: 'The version tag of the page, which changes when the page changes. NULL when Graph gives none.';
|
|
38
|
+
};
|
|
39
|
+
readonly createdDateTime: {
|
|
40
|
+
readonly type: readonly ['string', 'null'];
|
|
41
|
+
readonly format: 'date-time';
|
|
42
|
+
readonly description: 'When the page was created, in UTC. NULL when Graph gives none.';
|
|
43
|
+
};
|
|
44
|
+
readonly lastModifiedDateTime: {
|
|
45
|
+
readonly type: 'string';
|
|
46
|
+
readonly format: 'date-time';
|
|
47
|
+
readonly description: 'When the page last changed, in UTC.';
|
|
48
|
+
};
|
|
49
|
+
readonly createdBy: {
|
|
50
|
+
type: readonly ['string', 'null'];
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
readonly lastModifiedBy: {
|
|
54
|
+
type: readonly ['string', 'null'];
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
readonly publishingLevel: {
|
|
58
|
+
readonly type: readonly ['string', 'null'];
|
|
59
|
+
readonly description: 'Whether the page is published or a draft: published, draft or checkout. NULL when Graph gives none.';
|
|
60
|
+
};
|
|
61
|
+
readonly publishingVersion: {
|
|
62
|
+
readonly type: readonly ['string', 'null'];
|
|
63
|
+
readonly description: 'The version of the page, such as 2.0 for a published page. NULL when Graph gives none.';
|
|
64
|
+
};
|
|
65
|
+
readonly html: {
|
|
66
|
+
readonly type: readonly ['string', 'null'];
|
|
67
|
+
readonly description: 'The HTML that people wrote on the page: the inner HTML of each text web part, in the order of the canvas, one after the other on its own line. Images, embedded documents and other web parts give no text. NULL when the page has no text web part.';
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare class PagesStream extends SnapshotStream {
|
|
71
|
+
constructor();
|
|
72
|
+
protected scan(url: string, run: SharePointRun, signal: AbortSignal): AsyncGenerator<RecordDraft<typeof properties>>;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { createdBy, instant, json, lastModifiedBy, nullableInstant, sharePointFields, siteUrl, } from '../sharepoint-stream.js';
|
|
2
|
+
import { SnapshotStream } from '../snapshot-stream.js';
|
|
3
|
+
const { id, text, nullableText, timestamp, nullableTimestamp } = sharePointFields;
|
|
4
|
+
const properties = {
|
|
5
|
+
siteUrl,
|
|
6
|
+
pageId: { ...id, description: "Graph's ID of the page." },
|
|
7
|
+
name: {
|
|
8
|
+
...text,
|
|
9
|
+
description: 'The file name of the page, such as Home.aspx.',
|
|
10
|
+
},
|
|
11
|
+
title: { ...text, description: 'The title of the page.' },
|
|
12
|
+
description: {
|
|
13
|
+
...nullableText,
|
|
14
|
+
description: 'The description of the page. NULL when it has none.',
|
|
15
|
+
},
|
|
16
|
+
webUrl: { ...text, description: 'The URL of the page.' },
|
|
17
|
+
pageLayout: {
|
|
18
|
+
...nullableText,
|
|
19
|
+
description: 'The layout of the page, such as article or home. NULL when Graph gives none.',
|
|
20
|
+
},
|
|
21
|
+
eTag: {
|
|
22
|
+
...nullableText,
|
|
23
|
+
description: 'The version tag of the page, which changes when the page changes. NULL when Graph gives none.',
|
|
24
|
+
},
|
|
25
|
+
createdDateTime: {
|
|
26
|
+
...nullableTimestamp,
|
|
27
|
+
description: 'When the page was created, in UTC. NULL when Graph gives none.',
|
|
28
|
+
},
|
|
29
|
+
lastModifiedDateTime: {
|
|
30
|
+
...timestamp,
|
|
31
|
+
description: 'When the page last changed, in UTC.',
|
|
32
|
+
},
|
|
33
|
+
createdBy,
|
|
34
|
+
lastModifiedBy,
|
|
35
|
+
publishingLevel: {
|
|
36
|
+
...nullableText,
|
|
37
|
+
description: 'Whether the page is published or a draft: published, draft or checkout. NULL when Graph gives none.',
|
|
38
|
+
},
|
|
39
|
+
publishingVersion: {
|
|
40
|
+
...nullableText,
|
|
41
|
+
description: 'The version of the page, such as 2.0 for a published page. NULL when Graph gives none.',
|
|
42
|
+
},
|
|
43
|
+
html: {
|
|
44
|
+
...nullableText,
|
|
45
|
+
description: 'The HTML that people wrote on the page: the inner HTML of each text web part, in the order of the canvas, one after the other on its own line. Images, embedded documents and other web parts give no text. NULL when the page has no text web part.',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export class PagesStream extends SnapshotStream {
|
|
49
|
+
constructor() {
|
|
50
|
+
super({
|
|
51
|
+
name: 'pages',
|
|
52
|
+
description: 'One record for each modern page of the Site Pages library of the site, with the HTML of its text web parts. Primary key siteUrl, pageId. An incremental read deletes a page that Graph no longer lists.',
|
|
53
|
+
properties,
|
|
54
|
+
primaryKey: ['siteUrl', 'pageId'],
|
|
55
|
+
covers: 'Every modern page of each configured site, and the text web parts of each page.',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async *scan(url, run, signal) {
|
|
59
|
+
const { id: siteId } = await run.site(url, signal);
|
|
60
|
+
for (const page of await run.client.pages(siteId, signal)) {
|
|
61
|
+
const parts = await run.client.textWebParts(siteId, page.id, signal);
|
|
62
|
+
yield {
|
|
63
|
+
siteUrl: url,
|
|
64
|
+
pageId: page.id,
|
|
65
|
+
name: page.name,
|
|
66
|
+
title: page.title,
|
|
67
|
+
description: page.description ?? null,
|
|
68
|
+
webUrl: page.webUrl,
|
|
69
|
+
pageLayout: page.pageLayout ?? null,
|
|
70
|
+
eTag: page.eTag ?? null,
|
|
71
|
+
createdDateTime: nullableInstant(page.createdDateTime),
|
|
72
|
+
lastModifiedDateTime: instant(page.lastModifiedDateTime),
|
|
73
|
+
createdBy: json(page.createdBy),
|
|
74
|
+
lastModifiedBy: json(page.lastModifiedBy),
|
|
75
|
+
publishingLevel: page.publishingState?.level ?? null,
|
|
76
|
+
publishingVersion: page.publishingState?.versionId ?? null,
|
|
77
|
+
html: parts.length === 0
|
|
78
|
+
? null
|
|
79
|
+
: parts.map((part) => part.innerHtml).join('\n'),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { RecordDraft } from '@eltjs/elt';
|
|
2
|
+
import type { SharePointRun } from '../sharepoint-run.ts';
|
|
3
|
+
import { SnapshotStream } from '../snapshot-stream.ts';
|
|
4
|
+
declare const properties: {
|
|
5
|
+
readonly siteUrl: {
|
|
6
|
+
type: 'string';
|
|
7
|
+
minLength: 1;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
readonly siteId: {
|
|
11
|
+
readonly type: 'string';
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
readonly description: "Graph's ID of the site: <host>,<site collection ID>,<web ID>.";
|
|
14
|
+
};
|
|
15
|
+
readonly name: {
|
|
16
|
+
readonly type: 'string';
|
|
17
|
+
readonly description: 'The name of the site in its URL.';
|
|
18
|
+
};
|
|
19
|
+
readonly displayName: {
|
|
20
|
+
readonly type: 'string';
|
|
21
|
+
readonly description: 'The title of the site.';
|
|
22
|
+
};
|
|
23
|
+
readonly description: {
|
|
24
|
+
readonly type: readonly ['string', 'null'];
|
|
25
|
+
readonly description: 'The description of the site. NULL when nobody wrote one.';
|
|
26
|
+
};
|
|
27
|
+
readonly webUrl: {
|
|
28
|
+
readonly type: 'string';
|
|
29
|
+
readonly description: 'The URL of the site that Graph gives.';
|
|
30
|
+
};
|
|
31
|
+
readonly createdDateTime: {
|
|
32
|
+
readonly type: 'string';
|
|
33
|
+
readonly format: 'date-time';
|
|
34
|
+
readonly description: 'When the site was created, in UTC.';
|
|
35
|
+
};
|
|
36
|
+
readonly lastModifiedDateTime: {
|
|
37
|
+
readonly type: 'string';
|
|
38
|
+
readonly format: 'date-time';
|
|
39
|
+
readonly description: 'When the site last changed, in UTC.';
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare class SitesStream extends SnapshotStream {
|
|
43
|
+
constructor();
|
|
44
|
+
protected scan(url: string, run: SharePointRun, signal: AbortSignal): AsyncGenerator<RecordDraft<typeof properties>>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { instant, sharePointFields, siteUrl } from '../sharepoint-stream.js';
|
|
2
|
+
import { SnapshotStream } from '../snapshot-stream.js';
|
|
3
|
+
const { id, text, nullableText, timestamp } = sharePointFields;
|
|
4
|
+
const properties = {
|
|
5
|
+
siteUrl,
|
|
6
|
+
siteId: {
|
|
7
|
+
...id,
|
|
8
|
+
description: "Graph's ID of the site: <host>,<site collection ID>,<web ID>.",
|
|
9
|
+
},
|
|
10
|
+
name: { ...text, description: 'The name of the site in its URL.' },
|
|
11
|
+
displayName: { ...text, description: 'The title of the site.' },
|
|
12
|
+
description: {
|
|
13
|
+
...nullableText,
|
|
14
|
+
description: 'The description of the site. NULL when nobody wrote one.',
|
|
15
|
+
},
|
|
16
|
+
webUrl: { ...text, description: 'The URL of the site that Graph gives.' },
|
|
17
|
+
createdDateTime: {
|
|
18
|
+
...timestamp,
|
|
19
|
+
description: 'When the site was created, in UTC.',
|
|
20
|
+
},
|
|
21
|
+
lastModifiedDateTime: {
|
|
22
|
+
...timestamp,
|
|
23
|
+
description: 'When the site last changed, in UTC.',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export class SitesStream extends SnapshotStream {
|
|
27
|
+
constructor() {
|
|
28
|
+
super({
|
|
29
|
+
name: 'sites',
|
|
30
|
+
description: 'One record for each configured site that the app can read. Primary key siteUrl, siteId. An incremental read deletes a site whose ID changed at its URL.',
|
|
31
|
+
properties,
|
|
32
|
+
primaryKey: ['siteUrl', 'siteId'],
|
|
33
|
+
covers: 'The site at each configured URL.',
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async *scan(url, run, signal) {
|
|
37
|
+
const site = await run.site(url, signal);
|
|
38
|
+
yield {
|
|
39
|
+
siteUrl: url,
|
|
40
|
+
siteId: site.id,
|
|
41
|
+
name: site.name,
|
|
42
|
+
displayName: site.displayName,
|
|
43
|
+
description: site.description ?? null,
|
|
44
|
+
webUrl: site.webUrl,
|
|
45
|
+
createdDateTime: instant(site.createdDateTime),
|
|
46
|
+
lastModifiedDateTime: instant(site.lastModifiedDateTime),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|