@pipedream/sharepoint 0.8.3 → 0.8.4
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/actions/create-folder/create-folder.mjs +1 -1
- package/actions/create-item/create-item.mjs +1 -1
- package/actions/create-link/create-link.mjs +1 -1
- package/actions/create-list/create-list.mjs +1 -1
- package/actions/download-file/download-file.mjs +1 -1
- package/actions/download-files/download-files.mjs +1 -1
- package/actions/find-file-by-name/find-file-by-name.mjs +1 -1
- package/actions/find-files-with-metadata/find-files-with-metadata.mjs +1 -1
- package/actions/get-excel-table/get-excel-table.mjs +1 -1
- package/actions/get-file-by-id/get-file-by-id.mjs +1 -1
- package/actions/get-site/get-site.mjs +1 -1
- package/actions/list-files-in-folder/list-files-in-folder.mjs +1 -1
- package/actions/list-sites/list-sites.mjs +1 -1
- package/actions/retrieve-file-metadata/retrieve-file-metadata.mjs +1 -1
- package/actions/search-and-filter-files/search-and-filter-files.mjs +1 -1
- package/actions/search-files/search-files.mjs +1 -1
- package/actions/search-sites/search-sites.mjs +1 -1
- package/actions/update-item/update-item.mjs +1 -1
- package/actions/upload-file/upload-file.mjs +1 -1
- package/common/constants.mjs +7 -0
- package/common/file-picker-base.mjs +7 -2
- package/package.json +1 -1
- package/sharepoint.app.mjs +1 -3
- package/sources/new-file-created/new-file-created.mjs +1 -1
- package/sources/new-folder-created/new-folder-created.mjs +1 -1
- package/sources/new-list-item/new-list-item.mjs +1 -1
- package/sources/updated-file-instant/updated-file-instant.mjs +38 -17
- package/sources/updated-list-item/updated-list-item.mjs +1 -1
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-create-folder",
|
|
5
5
|
name: "Create Folder",
|
|
6
6
|
description: "Create a new folder in SharePoint. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_post_children?view=odsp-graph-online)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-create-item",
|
|
5
5
|
name: "Create Item",
|
|
6
6
|
description: "Create a new item in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-create-link",
|
|
6
6
|
name: "Create Link",
|
|
7
7
|
description: "Create a sharing link for a DriveItem. [See the documentation](https://docs.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.9",
|
|
9
9
|
type: "action",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-create-list",
|
|
5
5
|
name: "Create List",
|
|
6
6
|
description: "Create a new list in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/list-create?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.13",
|
|
8
8
|
annotations: {
|
|
9
9
|
destructiveHint: false,
|
|
10
10
|
openWorldHint: true,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "sharepoint-download-file",
|
|
9
9
|
name: "Download File",
|
|
10
10
|
description: "Download a Microsoft Sharepoint file to the /tmp directory. [See the documentation](https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http)",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.14",
|
|
12
12
|
annotations: {
|
|
13
13
|
destructiveHint: false,
|
|
14
14
|
openWorldHint: true,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "sharepoint-download-files",
|
|
7
7
|
name: "Download Files",
|
|
8
8
|
description: "Browse and select files from SharePoint and get their metadata along with pre-authenticated download URLs (valid ~1 hour). [See the documentation](https://learn.microsoft.com/en-us/graph/api/driveitem-get)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.3",
|
|
10
10
|
type: "action",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
key: "sharepoint-find-file-by-name",
|
|
7
7
|
name: "Find File by Name",
|
|
8
8
|
description: "Search for a file or folder by name. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_search)",
|
|
9
|
-
version: "0.1.
|
|
9
|
+
version: "0.1.6",
|
|
10
10
|
type: "action",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Find Files in List with Metadata",
|
|
6
6
|
description:
|
|
7
7
|
"Search and filter items in a SharePoint list based on metadata and custom columns. [See docs here](https://learn.microsoft.com/en-us/graph/api/listitem-list)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.4",
|
|
9
9
|
type: "action",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-get-excel-table",
|
|
5
5
|
name: "Get Excel Table",
|
|
6
6
|
description: "Retrieve a table from an Excel spreadsheet stored in Sharepoint [See the documentation](https://learn.microsoft.com/en-us/graph/api/table-range?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.8",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-get-file-by-id",
|
|
5
5
|
name: "Get File by ID",
|
|
6
6
|
description: "Retrieves a file by ID. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-get-site",
|
|
5
5
|
name: "Get Site",
|
|
6
6
|
description: "Get a site in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-list-files-in-folder",
|
|
5
5
|
name: "List Files in Folder",
|
|
6
6
|
description: "Retrieves a list of the files and/or folders directly within a folder. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.7",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-list-sites",
|
|
5
5
|
name: "List Sites",
|
|
6
6
|
description: "List all sites in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/site-list?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "sharepoint-retrieve-file-metadata",
|
|
9
9
|
name: "Retrieve File Metadata",
|
|
10
10
|
description: "Browse and select files from SharePoint to retrieve their metadata (name, size, dates, etc.) without download URLs. [See the documentation](https://learn.microsoft.com/en-us/graph/api/driveitem-get)",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.3",
|
|
12
12
|
type: "action",
|
|
13
13
|
annotations: {
|
|
14
14
|
destructiveHint: false,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Search and Filter Files",
|
|
7
7
|
description:
|
|
8
8
|
"Search and filter SharePoint files based on metadata and custom columns. This action allows you to query files using SharePoint's custom properties, managed metadata, and other column values. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-list)",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.4",
|
|
10
10
|
type: "action",
|
|
11
11
|
annotations: {
|
|
12
12
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-search-files",
|
|
5
5
|
name: "Search Files",
|
|
6
6
|
description: "Search for files in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/search-query?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "sharepoint-search-sites",
|
|
5
5
|
name: "Search Sites",
|
|
6
6
|
description: "Search for sites in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/site-search?view=graph-rest-1.0&tabs=http)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.5",
|
|
8
8
|
type: "action",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: false,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-update-item",
|
|
6
6
|
name: "Update Item",
|
|
7
7
|
description: "Updates an existing item in Microsoft Sharepoint. [See the documentation](https://learn.microsoft.com/en-us/graph/api/listitem-update?view=graph-rest-1.0&tabs=http)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.13",
|
|
9
9
|
annotations: {
|
|
10
10
|
destructiveHint: true,
|
|
11
11
|
openWorldHint: true,
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "sharepoint-upload-file",
|
|
6
6
|
name: "Upload File",
|
|
7
7
|
description: "Upload a file to OneDrive. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online)",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.8",
|
|
9
9
|
type: "action",
|
|
10
10
|
annotations: {
|
|
11
11
|
destructiveHint: false,
|
package/common/constants.mjs
CHANGED
|
@@ -87,6 +87,12 @@ const HTML_CONVERTIBLE_FORMATS = [
|
|
|
87
87
|
"fluid",
|
|
88
88
|
"wbtx",
|
|
89
89
|
];
|
|
90
|
+
/**
|
|
91
|
+
* OData $expand value to include custom column values from the
|
|
92
|
+
* associated list item when fetching drive items.
|
|
93
|
+
*/
|
|
94
|
+
const LIST_ITEM_FIELDS_EXPAND = "listItem($expand=fields)";
|
|
95
|
+
|
|
90
96
|
const RETURN_CONTENT_TYPE_OPTIONS = [
|
|
91
97
|
{
|
|
92
98
|
label: "Only Files",
|
|
@@ -105,6 +111,7 @@ const RETURN_CONTENT_TYPE_OPTIONS = [
|
|
|
105
111
|
export {
|
|
106
112
|
WEBHOOK_SUBSCRIPTION_EXPIRATION_TIME_MILLISECONDS,
|
|
107
113
|
WEBHOOK_SUBSCRIPTION_RENEWAL_SECONDS,
|
|
114
|
+
LIST_ITEM_FIELDS_EXPAND,
|
|
108
115
|
};
|
|
109
116
|
|
|
110
117
|
export default {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import sharepoint from "../sharepoint.app.mjs";
|
|
2
|
+
import { LIST_ITEM_FIELDS_EXPAND } from "./constants.mjs";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Shared prop definitions for file picker actions.
|
|
@@ -176,10 +177,14 @@ export const filePickerMethods = {
|
|
|
176
177
|
files.map(async (selected) => {
|
|
177
178
|
// When includeDownloadUrl is true, omit $select to get @microsoft.graph.downloadUrl
|
|
178
179
|
// (Graph API excludes downloadUrl when using $select)
|
|
180
|
+
// Always expand listItem fields to include custom column values
|
|
179
181
|
const params = includeDownloadUrl
|
|
180
|
-
? {
|
|
182
|
+
? {
|
|
183
|
+
$expand: LIST_ITEM_FIELDS_EXPAND,
|
|
184
|
+
}
|
|
181
185
|
: {
|
|
182
186
|
$select: "id,name,size,webUrl,createdDateTime,lastModifiedDateTime,createdBy,lastModifiedBy,parentReference,file,folder,image,video,audio,photo,shared,fileSystemInfo,cTag,eTag,sharepointIds",
|
|
187
|
+
$expand: LIST_ITEM_FIELDS_EXPAND,
|
|
183
188
|
};
|
|
184
189
|
|
|
185
190
|
const file = await this.sharepoint.getDriveItem({
|
|
@@ -273,7 +278,7 @@ export const filePickerMethods = {
|
|
|
273
278
|
|
|
274
279
|
// If all files failed, throw an error
|
|
275
280
|
if (fileResults.length === 0 && errors.length > 0) {
|
|
276
|
-
throw new Error(`Failed to fetch all selected files
|
|
281
|
+
throw new Error(`Failed to fetch all selected files:\n${errors.map((e) => ` ${e.fileName}: ${e.error}`).join("\n")}`);
|
|
277
282
|
}
|
|
278
283
|
|
|
279
284
|
// If single file, return it directly for backwards compatibility
|
package/package.json
CHANGED
package/sharepoint.app.mjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { randomUUID } from "crypto";
|
|
2
2
|
import sharepoint from "../../sharepoint.app.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
LIST_ITEM_FIELDS_EXPAND,
|
|
5
|
+
WEBHOOK_SUBSCRIPTION_RENEWAL_SECONDS,
|
|
6
|
+
} from "../../common/constants.mjs";
|
|
4
7
|
|
|
5
8
|
export default {
|
|
6
9
|
key: "sharepoint-updated-file-instant",
|
|
7
10
|
name: "File Updated or Deleted (Instant)",
|
|
8
11
|
description: "Emit a new event when specific files are updated or deleted in a SharePoint document library",
|
|
9
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.4",
|
|
10
13
|
type: "source",
|
|
11
14
|
dedupe: "unique",
|
|
12
15
|
props: {
|
|
@@ -378,27 +381,45 @@ export default {
|
|
|
378
381
|
|
|
379
382
|
console.log(`Found ${changedFiles.length} changed monitored files`);
|
|
380
383
|
|
|
384
|
+
// Fetch fresh data for non-deleted files in parallel
|
|
385
|
+
// Delta response lacks downloadUrl and listItem fields
|
|
386
|
+
const nonDeletedFiles = changedFiles.filter((f) => !f.deleted);
|
|
387
|
+
const freshResults = await Promise.allSettled(
|
|
388
|
+
nonDeletedFiles.map((file) =>
|
|
389
|
+
this.sharepoint.getDriveItem({
|
|
390
|
+
driveId,
|
|
391
|
+
fileId: file.id,
|
|
392
|
+
params: {
|
|
393
|
+
$expand: LIST_ITEM_FIELDS_EXPAND,
|
|
394
|
+
},
|
|
395
|
+
})),
|
|
396
|
+
);
|
|
397
|
+
const freshDataMap = new Map();
|
|
398
|
+
freshResults.forEach((result, i) => {
|
|
399
|
+
if (result.status === "fulfilled") {
|
|
400
|
+
freshDataMap.set(nonDeletedFiles[i].id, result.value);
|
|
401
|
+
} else {
|
|
402
|
+
console.log(
|
|
403
|
+
`Could not fetch details for ${nonDeletedFiles[i].name}: `
|
|
404
|
+
+ `${result.reason?.message}`,
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
|
|
381
409
|
// Emit events for each changed file
|
|
382
410
|
for (const file of changedFiles) {
|
|
383
|
-
|
|
384
|
-
// Skip fetching download URL for deleted files (they no longer exist)
|
|
385
|
-
let downloadUrl = file["@microsoft.graph.downloadUrl"];
|
|
386
|
-
if (!downloadUrl && !file.deleted) {
|
|
387
|
-
try {
|
|
388
|
-
const freshFile = await this.sharepoint.getDriveItem({
|
|
389
|
-
driveId,
|
|
390
|
-
fileId: file.id,
|
|
391
|
-
});
|
|
392
|
-
downloadUrl = freshFile["@microsoft.graph.downloadUrl"];
|
|
393
|
-
} catch (err) {
|
|
394
|
-
console.log(`Could not fetch download URL for ${file.name}: ${err.message}`);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
411
|
+
const freshFile = freshDataMap.get(file.id);
|
|
397
412
|
|
|
398
413
|
this.$emit(
|
|
399
414
|
{
|
|
415
|
+
eventType: file.deleted
|
|
416
|
+
? "deleted"
|
|
417
|
+
: "updated",
|
|
400
418
|
file,
|
|
401
|
-
downloadUrl
|
|
419
|
+
downloadUrl:
|
|
420
|
+
freshFile?.["@microsoft.graph.downloadUrl"] ?? null,
|
|
421
|
+
listItemFields:
|
|
422
|
+
freshFile?.listItem?.fields ?? null,
|
|
402
423
|
},
|
|
403
424
|
this.generateMeta(file),
|
|
404
425
|
);
|