@pipedream/sharepoint 0.5.1 → 0.6.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.
@@ -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.2",
7
+ version: "0.0.3",
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.8",
7
+ version: "0.0.9",
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.3",
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-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.8",
7
+ version: "0.0.9",
8
8
  annotations: {
9
9
  destructiveHint: false,
10
10
  openWorldHint: true,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "sharepoint-download-file",
6
6
  name: "Download File",
7
7
  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)",
8
- version: "0.0.8",
8
+ version: "0.0.9",
9
9
  annotations: {
10
10
  destructiveHint: false,
11
11
  openWorldHint: true,
@@ -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.0",
9
+ version: "0.1.1",
10
10
  type: "action",
11
11
  annotations: {
12
12
  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.2",
7
+ version: "0.0.3",
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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -39,12 +39,21 @@ export default {
39
39
  ],
40
40
  description: "The file to retrieve. You can either search for the file here or provide a custom *File ID*.",
41
41
  },
42
+ select: {
43
+ propDefinition: [
44
+ sharepoint,
45
+ "select",
46
+ ],
47
+ },
42
48
  },
43
49
  async run({ $ }) {
44
50
  const response = await this.sharepoint.getDriveItem({
45
51
  $,
46
52
  siteId: this.siteId,
47
53
  fileId: this.fileId,
54
+ params: {
55
+ select: this.select,
56
+ },
48
57
  });
49
58
  $.export("$summary", `Successfully retrieved file with ID: ${this.fileId}`);
50
59
  return response;
@@ -0,0 +1,40 @@
1
+ import sharepoint from "../../sharepoint.app.mjs";
2
+
3
+ export default {
4
+ key: "sharepoint-get-site",
5
+ name: "Get Site",
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.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ sharepoint,
16
+ siteId: {
17
+ propDefinition: [
18
+ sharepoint,
19
+ "siteId",
20
+ ],
21
+ },
22
+ select: {
23
+ propDefinition: [
24
+ sharepoint,
25
+ "select",
26
+ ],
27
+ },
28
+ },
29
+ async run({ $ }) {
30
+ const response = await this.sharepoint.getSite({
31
+ $,
32
+ siteId: this.siteId,
33
+ params: {
34
+ select: this.select,
35
+ },
36
+ });
37
+ $.export("$summary", `Successfully retrieved site with ID: ${this.siteId}`);
38
+ return response;
39
+ },
40
+ };
@@ -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.2",
7
+ version: "0.0.3",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -44,18 +44,37 @@ export default {
44
44
  "excludeFolders",
45
45
  ],
46
46
  },
47
+ select: {
48
+ propDefinition: [
49
+ sharepoint,
50
+ "select",
51
+ ],
52
+ },
53
+ orderBy: {
54
+ type: "string",
55
+ label: "Order By",
56
+ description: "The field to order the results by",
57
+ default: "lastModifiedDateTime",
58
+ optional: true,
59
+ },
47
60
  },
48
61
  async run({ $ }) {
62
+ const params = {
63
+ select: this.select,
64
+ orderby: this.orderBy,
65
+ };
49
66
  const response = this.folderId
50
67
  ? await this.sharepoint.listDriveItemsInFolder({
51
68
  $,
52
69
  driveId: this.driveId,
53
70
  folderId: this.folderId,
71
+ params,
54
72
  })
55
73
  : await this.sharepoint.listDriveItems({
56
74
  $,
57
75
  siteId: this.siteId,
58
76
  driveId: this.driveId,
77
+ params,
59
78
  });
60
79
  const values = this.excludeFolders
61
80
  ? response.value.filter(({ folder }) => !folder)
@@ -0,0 +1,57 @@
1
+ import sharepoint from "../../sharepoint.app.mjs";
2
+
3
+ export default {
4
+ key: "sharepoint-list-sites",
5
+ name: "List Sites",
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.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ sharepoint,
16
+ select: {
17
+ propDefinition: [
18
+ sharepoint,
19
+ "select",
20
+ ],
21
+ },
22
+ maxResults: {
23
+ propDefinition: [
24
+ sharepoint,
25
+ "maxResults",
26
+ ],
27
+ },
28
+ },
29
+ async run({ $ }) {
30
+ const sites = [];
31
+ let count = 0;
32
+
33
+ const results = this.sharepoint.paginate({
34
+ fn: this.sharepoint.listAllSites,
35
+ args: {
36
+ $,
37
+ params: {
38
+ select: this.select,
39
+ },
40
+ },
41
+ });
42
+
43
+ for await (const site of results) {
44
+ sites.push(site);
45
+ count++;
46
+ if (this.maxResults && count >= this.maxResults) {
47
+ break;
48
+ }
49
+ }
50
+
51
+ $.export("$summary", `Successfully listed ${count} site${count === 1
52
+ ? ""
53
+ : "s"}`);
54
+
55
+ return sites;
56
+ },
57
+ };
@@ -0,0 +1,84 @@
1
+ import sharepoint from "../../sharepoint.app.mjs";
2
+
3
+ export default {
4
+ key: "sharepoint-search-files",
5
+ name: "Search Files",
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.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ sharepoint,
16
+ queryString: {
17
+ type: "string",
18
+ label: "Query String",
19
+ description: "The search query containing the search terms",
20
+ },
21
+ queryTemplate: {
22
+ type: "string",
23
+ label: "Query Template",
24
+ description: "Provides a way to decorate the query string. Supports both KQL and query variables. Example: `({searchTerms}) AuthorOWSUSER:Adventure` [See the documentation](https://learn.microsoft.com/en-us/graph/search-concept-query-template) for more information.",
25
+ optional: true,
26
+ },
27
+ select: {
28
+ propDefinition: [
29
+ sharepoint,
30
+ "select",
31
+ ],
32
+ },
33
+ size: {
34
+ propDefinition: [
35
+ sharepoint,
36
+ "maxResults",
37
+ ],
38
+ max: 500,
39
+ },
40
+ sortField: {
41
+ type: "string",
42
+ label: "Sort Field",
43
+ description: "The field to sort the results by",
44
+ default: "lastModifiedDateTime",
45
+ optional: true,
46
+ },
47
+ descending: {
48
+ type: "boolean",
49
+ label: "Descending",
50
+ description: "Whether to sort the results in descending order",
51
+ optional: true,
52
+ },
53
+ },
54
+ async run({ $ }) {
55
+ const response = await this.sharepoint.searchQuery({
56
+ $,
57
+ data: {
58
+ requests: [
59
+ {
60
+ entityTypes: [
61
+ "driveItem",
62
+ ],
63
+ query: {
64
+ queryString: this.queryString,
65
+ queryTemplate: this.queryTemplate,
66
+ },
67
+ fields: this.select
68
+ ? this.select.split(",").map((f) => f.trim())
69
+ : undefined,
70
+ size: this.size,
71
+ sortProperties: [
72
+ {
73
+ name: this.sortField,
74
+ isDescending: this.descending,
75
+ },
76
+ ],
77
+ },
78
+ ],
79
+ },
80
+ });
81
+ $.export("$summary", `Successfully searched for ${this.queryString}`);
82
+ return response;
83
+ },
84
+ };
@@ -0,0 +1,63 @@
1
+ import sharepoint from "../../sharepoint.app.mjs";
2
+
3
+ export default {
4
+ key: "sharepoint-search-sites",
5
+ name: "Search Sites",
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.1",
8
+ type: "action",
9
+ annotations: {
10
+ destructiveHint: false,
11
+ openWorldHint: true,
12
+ readOnlyHint: true,
13
+ },
14
+ props: {
15
+ sharepoint,
16
+ query: {
17
+ type: "string",
18
+ label: "Query",
19
+ description: "The query to search for",
20
+ },
21
+ select: {
22
+ propDefinition: [
23
+ sharepoint,
24
+ "select",
25
+ ],
26
+ },
27
+ maxResults: {
28
+ propDefinition: [
29
+ sharepoint,
30
+ "maxResults",
31
+ ],
32
+ },
33
+ },
34
+ async run({ $ }) {
35
+ const sites = [];
36
+ let count = 0;
37
+
38
+ const results = this.sharepoint.paginate({
39
+ fn: this.sharepoint.listAllSites,
40
+ args: {
41
+ $,
42
+ params: {
43
+ search: this.query,
44
+ select: this.select,
45
+ },
46
+ },
47
+ });
48
+
49
+ for await (const site of results) {
50
+ sites.push(site);
51
+ count++;
52
+ if (this.maxResults && count >= this.maxResults) {
53
+ break;
54
+ }
55
+ }
56
+
57
+ $.export("$summary", `Successfully listed ${count} site${count === 1
58
+ ? ""
59
+ : "s"}`);
60
+
61
+ return sites;
62
+ },
63
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "sharepoint-select-files",
5
5
  name: "Select Files",
6
6
  description: "A file picker action that allows browsing and selecting one or more files from SharePoint. Returns the selected files' metadata including pre-authenticated download URLs. [See the documentation](https://learn.microsoft.com/en-us/graph/api/driveitem-get)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -19,42 +19,39 @@ export default {
19
19
  "siteId",
20
20
  ],
21
21
  withLabel: true,
22
- reloadProps: true,
23
22
  },
24
23
  driveId: {
25
24
  propDefinition: [
26
25
  sharepoint,
27
26
  "driveId",
28
27
  (c) => ({
29
- siteId: c.siteId?.__lv?.value || c.siteId,
28
+ siteId: c.siteId?.value || c.siteId,
30
29
  }),
31
30
  ],
32
31
  withLabel: true,
33
- reloadProps: true,
34
32
  },
35
33
  folderId: {
36
34
  propDefinition: [
37
35
  sharepoint,
38
36
  "folderId",
39
37
  (c) => ({
40
- siteId: c.siteId?.__lv?.value || c.siteId,
41
- driveId: c.driveId?.__lv?.value || c.driveId,
38
+ siteId: c.siteId?.value || c.siteId,
39
+ driveId: c.driveId?.value || c.driveId,
42
40
  }),
43
41
  ],
44
42
  label: "Folder",
45
43
  description: "The folder to browse. Leave empty to browse the root of the drive.",
46
44
  optional: true,
47
45
  withLabel: true,
48
- reloadProps: true,
49
46
  },
50
47
  fileOrFolderIds: {
51
48
  propDefinition: [
52
49
  sharepoint,
53
50
  "fileOrFolderId",
54
51
  (c) => ({
55
- siteId: c.siteId?.__lv?.value || c.siteId,
56
- driveId: c.driveId?.__lv?.value || c.driveId,
57
- folderId: c.folderId?.__lv?.value || c.folderId,
52
+ siteId: c.siteId?.value || c.siteId,
53
+ driveId: c.driveId?.value || c.driveId,
54
+ folderId: c.folderId?.value || c.folderId,
58
55
  }),
59
56
  ],
60
57
  type: "string[]",
@@ -66,8 +63,8 @@ export default {
66
63
  methods: {
67
64
  resolveValue(prop) {
68
65
  if (!prop) return null;
69
- if (typeof prop === "object" && prop.__lv) {
70
- return prop.__lv.value;
66
+ if (typeof prop === "object" && prop?.value) {
67
+ return prop.value;
71
68
  }
72
69
  return prop;
73
70
  },
@@ -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",
8
+ version: "0.0.9",
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.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  annotations: {
11
11
  destructiveHint: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/sharepoint",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Pipedream Microsoft Sharepoint Online Components",
5
5
  "main": "sharepoint.app.mjs",
6
6
  "keywords": [
@@ -8,12 +8,20 @@ export default {
8
8
  type: "string",
9
9
  label: "Site",
10
10
  description: "Identifier of a site",
11
- async options({ prevContext }) {
11
+ useQuery: true,
12
+ async options({
13
+ prevContext, query,
14
+ }) {
12
15
  const args = prevContext?.nextLink
13
16
  ? {
14
17
  url: prevContext.nextLink,
15
18
  }
16
19
  : {};
20
+ if (query) {
21
+ args.params = {
22
+ search: query,
23
+ };
24
+ }
17
25
  const response = await this.listAllSites(args);
18
26
  const options = response.value?.map(({
19
27
  id: value, displayName: label,
@@ -266,6 +274,19 @@ export default {
266
274
  description: "Set to `true` to return only files in the response. Defaults to `false`",
267
275
  optional: true,
268
276
  },
277
+ select: {
278
+ type: "string",
279
+ label: "Select",
280
+ description: "A comma-separated list of properties to return in the response",
281
+ optional: true,
282
+ },
283
+ maxResults: {
284
+ type: "integer",
285
+ label: "Max Results",
286
+ description: "The maximum number of results to return",
287
+ optional: true,
288
+ default: 100,
289
+ },
269
290
  fileOrFolderId: {
270
291
  type: "string",
271
292
  label: "File or Folder",
@@ -331,15 +352,29 @@ export default {
331
352
  ...args,
332
353
  });
333
354
  },
355
+ getSite({
356
+ siteId, ...args
357
+ }) {
358
+ return this._makeRequest({
359
+ path: `/sites/${siteId}`,
360
+ ...args,
361
+ });
362
+ },
334
363
  listSites(args = {}) {
335
364
  return this._makeRequest({
336
365
  path: "/me/followedSites",
337
366
  ...args,
338
367
  });
339
368
  },
340
- listAllSites(args = {}) {
369
+ listAllSites({
370
+ params = {}, ...args
371
+ } = {}) {
372
+ if (!params.search) {
373
+ params.search = "*";
374
+ }
341
375
  return this._makeRequest({
342
- path: "/sites?search=*",
376
+ path: "/sites",
377
+ params,
343
378
  ...args,
344
379
  });
345
380
  },
@@ -503,6 +538,13 @@ export default {
503
538
  ...args,
504
539
  });
505
540
  },
541
+ searchQuery(args = {}) {
542
+ return this._makeRequest({
543
+ method: "POST",
544
+ path: "/search/query",
545
+ ...args,
546
+ });
547
+ },
506
548
  async *paginate({
507
549
  fn, args,
508
550
  }) {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "sharepoint-new-file-created",
6
6
  name: "New File Created",
7
7
  description: "Emit new event when a new file is created in Microsoft Sharepoint.",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "sharepoint-new-folder-created",
6
6
  name: "New Folder Created",
7
7
  description: "Emit new event when a new folder is created in Microsoft Sharepoint.",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "sharepoint-new-list-item",
6
6
  name: "New List Item",
7
7
  description: "Emit new event when a new list item is created in Microsoft Sharepoint.",
8
- version: "0.0.7",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "sharepoint-updated-list-item",
6
6
  name: "Updated List Item",
7
7
  description: "Emit new event when a list item is updated in Microsoft Sharepoint.",
8
- version: "0.0.7",
8
+ version: "0.0.8",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {