@scopieflows/app-microsoft-sharepoint 0.2.3

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.
Files changed (84) hide show
  1. package/README.md +2 -0
  2. package/package.json +31 -0
  3. package/src/i18n/de.json +131 -0
  4. package/src/i18n/es.json +131 -0
  5. package/src/i18n/fr.json +131 -0
  6. package/src/i18n/ja.json +131 -0
  7. package/src/i18n/nl.json +131 -0
  8. package/src/i18n/pt.json +131 -0
  9. package/src/i18n/ru.json +49 -0
  10. package/src/i18n/translation.json +131 -0
  11. package/src/i18n/vi.json +49 -0
  12. package/src/i18n/zh.json +131 -0
  13. package/src/index.d.ts +2 -0
  14. package/src/index.js +121 -0
  15. package/src/index.js.map +1 -0
  16. package/src/lib/actions/copy-item-within-site.d.ts +8 -0
  17. package/src/lib/actions/copy-item-within-site.js +155 -0
  18. package/src/lib/actions/copy-item-within-site.js.map +1 -0
  19. package/src/lib/actions/copy-item.d.ts +10 -0
  20. package/src/lib/actions/copy-item.js +118 -0
  21. package/src/lib/actions/copy-item.js.map +1 -0
  22. package/src/lib/actions/create-folder.d.ts +6 -0
  23. package/src/lib/actions/create-folder.js +44 -0
  24. package/src/lib/actions/create-folder.js.map +1 -0
  25. package/src/lib/actions/create-list-item.d.ts +5 -0
  26. package/src/lib/actions/create-list-item.js +43 -0
  27. package/src/lib/actions/create-list-item.js.map +1 -0
  28. package/src/lib/actions/create-list.d.ts +5 -0
  29. package/src/lib/actions/create-list.js +41 -0
  30. package/src/lib/actions/create-list.js.map +1 -0
  31. package/src/lib/actions/delete-list-item.d.ts +5 -0
  32. package/src/lib/actions/delete-list-item.js +33 -0
  33. package/src/lib/actions/delete-list-item.js.map +1 -0
  34. package/src/lib/actions/find-file.d.ts +8 -0
  35. package/src/lib/actions/find-file.js +133 -0
  36. package/src/lib/actions/find-file.js.map +1 -0
  37. package/src/lib/actions/get-folder-contents.d.ts +9 -0
  38. package/src/lib/actions/get-folder-contents.js +108 -0
  39. package/src/lib/actions/get-folder-contents.js.map +1 -0
  40. package/src/lib/actions/get-site-information.d.ts +4 -0
  41. package/src/lib/actions/get-site-information.js +38 -0
  42. package/src/lib/actions/get-site-information.js.map +1 -0
  43. package/src/lib/actions/move-file.d.ts +7 -0
  44. package/src/lib/actions/move-file.js +151 -0
  45. package/src/lib/actions/move-file.js.map +1 -0
  46. package/src/lib/actions/publish-page.d.ts +4 -0
  47. package/src/lib/actions/publish-page.js +52 -0
  48. package/src/lib/actions/publish-page.js.map +1 -0
  49. package/src/lib/actions/search-list-item.d.ts +5 -0
  50. package/src/lib/actions/search-list-item.js +40 -0
  51. package/src/lib/actions/search-list-item.js.map +1 -0
  52. package/src/lib/actions/update-list-item.d.ts +6 -0
  53. package/src/lib/actions/update-list-item.js +42 -0
  54. package/src/lib/actions/update-list-item.js.map +1 -0
  55. package/src/lib/actions/upload-file.d.ts +7 -0
  56. package/src/lib/actions/upload-file.js +49 -0
  57. package/src/lib/actions/upload-file.js.map +1 -0
  58. package/src/lib/common/index.d.ts +14 -0
  59. package/src/lib/common/index.js +394 -0
  60. package/src/lib/common/index.js.map +1 -0
  61. package/src/lib/triggers/new-file-in-folder.d.ts +18 -0
  62. package/src/lib/triggers/new-file-in-folder.js +155 -0
  63. package/src/lib/triggers/new-file-in-folder.js.map +1 -0
  64. package/src/lib/triggers/new-file-in-subfolders.d.ts +18 -0
  65. package/src/lib/triggers/new-file-in-subfolders.js +151 -0
  66. package/src/lib/triggers/new-file-in-subfolders.js.map +1 -0
  67. package/src/lib/triggers/new-list-item.d.ts +14 -0
  68. package/src/lib/triggers/new-list-item.js +95 -0
  69. package/src/lib/triggers/new-list-item.js.map +1 -0
  70. package/src/lib/triggers/new-list.d.ts +10 -0
  71. package/src/lib/triggers/new-list.js +89 -0
  72. package/src/lib/triggers/new-list.js.map +1 -0
  73. package/src/lib/triggers/new-or-updated-file.d.ts +18 -0
  74. package/src/lib/triggers/new-or-updated-file.js +152 -0
  75. package/src/lib/triggers/new-or-updated-file.js.map +1 -0
  76. package/src/lib/triggers/new-or-updated-folder.d.ts +18 -0
  77. package/src/lib/triggers/new-or-updated-folder.js +152 -0
  78. package/src/lib/triggers/new-or-updated-folder.js.map +1 -0
  79. package/src/lib/triggers/new-or-updated-list.d.ts +10 -0
  80. package/src/lib/triggers/new-or-updated-list.js +103 -0
  81. package/src/lib/triggers/new-or-updated-list.js.map +1 -0
  82. package/src/lib/triggers/updated-list-item.d.ts +14 -0
  83. package/src/lib/triggers/updated-list-item.js +108 -0
  84. package/src/lib/triggers/updated-list-item.js.map +1 -0
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moveFileAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
9
+ exports.moveFileAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftSharePointAuth,
11
+ name: 'microsoft_sharepoint_move_file',
12
+ displayName: 'Move File',
13
+ description: 'Move a file from one folder to another within the same drive.',
14
+ props: {
15
+ siteId: common_1.microsoftSharePointCommon.siteId,
16
+ driveId: common_1.microsoftSharePointCommon.driveId,
17
+ fileId: pieces_framework_1.Property.Dropdown({
18
+ auth: __1.microsoftSharePointAuth,
19
+ displayName: 'File to Move',
20
+ description: 'The file you want to move.',
21
+ required: true,
22
+ refreshers: ['siteId', 'driveId'],
23
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, siteId, driveId }) {
24
+ if (!auth || !siteId || !driveId) {
25
+ return {
26
+ disabled: true,
27
+ placeholder: 'Select a site and drive first.',
28
+ options: [],
29
+ };
30
+ }
31
+ const authValue = auth;
32
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
33
+ authProvider: {
34
+ getAccessToken: () => Promise.resolve(authValue.access_token),
35
+ },
36
+ });
37
+ const options = [];
38
+ let response = yield client
39
+ .api(`/drives/${driveId}/root/children?$select=id,name,file`
40
+ // `/sites/${siteId}/drives/${driveId}/root/children?$select=id,name,file`
41
+ )
42
+ .get();
43
+ while (response.value.length > 0) {
44
+ for (const item of response.value) {
45
+ if (item.file) {
46
+ options.push({ label: item.name, value: item.id });
47
+ }
48
+ }
49
+ if (response['@odata.nextLink']) {
50
+ response = yield client.api(response['@odata.nextLink']).get();
51
+ }
52
+ else {
53
+ break;
54
+ }
55
+ }
56
+ return { disabled: false, options };
57
+ }),
58
+ }),
59
+ destinationFolderId: pieces_framework_1.Property.Dropdown({
60
+ auth: __1.microsoftSharePointAuth,
61
+ displayName: 'Destination Folder',
62
+ description: 'The folder to move the file into. Select "Root" to move to the top level of the drive.',
63
+ required: true,
64
+ refreshers: ['siteId', 'driveId'],
65
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, siteId, driveId }) {
66
+ if (!auth || !siteId || !driveId) {
67
+ return {
68
+ disabled: true,
69
+ placeholder: 'Select a site and drive first.',
70
+ options: [],
71
+ };
72
+ }
73
+ const authValue = auth;
74
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
75
+ authProvider: {
76
+ getAccessToken: () => Promise.resolve(authValue.access_token),
77
+ },
78
+ });
79
+ const options = [
80
+ { label: 'Root', value: 'root' },
81
+ ];
82
+ let response = yield client
83
+ .api(
84
+ // `/drives/${driveId}/root/children?$filter=folder ne null&$select=id,name`
85
+ `/sites/${siteId}/drives/${driveId}/root/children?$filter=folder ne null&$select=id,name`)
86
+ .get();
87
+ while (response.value.length > 0) {
88
+ for (const item of response.value) {
89
+ options.push({ label: item.name, value: item.id });
90
+ }
91
+ if (response['@odata.nextLink']) {
92
+ response = yield client.api(response['@odata.nextLink']).get();
93
+ }
94
+ else {
95
+ break;
96
+ }
97
+ }
98
+ return { disabled: false, options };
99
+ }),
100
+ }),
101
+ newName: pieces_framework_1.Property.ShortText({
102
+ displayName: 'New Name (Optional)',
103
+ description: 'Provide a new name to rename the file during the move.',
104
+ required: false,
105
+ }),
106
+ },
107
+ run(context) {
108
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
109
+ const { driveId, fileId, destinationFolderId, newName } = context.propsValue;
110
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
111
+ authProvider: {
112
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
113
+ },
114
+ });
115
+ try {
116
+ const effectiveDestinationId = destinationFolderId === 'root'
117
+ ? (yield client.api(`/drives/${driveId}/root`).get()).id
118
+ : destinationFolderId;
119
+ const requestBody = {
120
+ parentReference: {
121
+ id: effectiveDestinationId,
122
+ },
123
+ };
124
+ if (newName) {
125
+ requestBody.name = newName;
126
+ }
127
+ const response = yield client
128
+ .api(`/drives/${driveId}/items/${fileId}`)
129
+ .patch(requestBody);
130
+ return {
131
+ success: true,
132
+ message: 'File moved successfully',
133
+ item: response,
134
+ };
135
+ }
136
+ catch (error) {
137
+ if (error.statusCode === 400) {
138
+ throw new Error(`Invalid request: ${error.message || 'Check your input parameters'}`);
139
+ }
140
+ if (error.statusCode === 403) {
141
+ throw new Error('Insufficient permissions to move this file. Requires Files.ReadWrite or higher.');
142
+ }
143
+ if (error.statusCode === 404) {
144
+ throw new Error('File or destination not found. Please verify the IDs.');
145
+ }
146
+ throw new Error(`Failed to move file: ${error.message || 'Unknown error'}`);
147
+ }
148
+ });
149
+ },
150
+ });
151
+ //# sourceMappingURL=move-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-sharepoint/src/lib/actions/move-file.ts"],"names":[],"mappings":";;;;AAAA,8BAAiD;AACjD,oEAKuC;AACvC,sCAAsD;AACtD,8EAA2E;AAG9D,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,2BAAuB;IAC7B,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,WAAW;IACxB,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AAW,OAAO,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE;oBACxD,CAAC,CAAC,mBAAmB,CAAC;gBAE1B,MAAM,WAAW,GAGb;oBACF,eAAe,EAAE;wBACf,EAAE,EAAE,sBAAsB;qBAC3B;iBACF,CAAC;gBAEF,IAAI,OAAO,EAAE,CAAC;oBACZ,WAAW,CAAC,IAAI,GAAG,OAAO,CAAC;gBAC7B,CAAC;gBAED,MAAM,QAAQ,GAAG,MAAM,MAAM;qBAC1B,GAAG,CAAC,WAAW,OAAO,UAAU,MAAM,EAAE,CAAC;qBACzC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAEtB,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,yBAAyB;oBAClC,IAAI,EAAE,QAAQ;iBACf,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,CAAC,OAAO,IAAI,6BAA6B,EAAE,CAAC,CAAC;gBACxF,CAAC;gBACD,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;gBACrG,CAAC;gBACD,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;gBAC3E,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const publishPageAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ siteId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ pageId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.publishPageAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
9
+ exports.publishPageAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftSharePointAuth,
11
+ name: 'microsoft_sharepoint_publish_page',
12
+ displayName: 'Publish Page',
13
+ description: 'Publishes a SharePoint page, making it available to all users. If the page is checked out, it will be automatically checked in. Note: Pages with active approval flows will not publish until approval is complete.',
14
+ props: {
15
+ siteId: common_1.microsoftSharePointCommon.siteId,
16
+ pageId: common_1.microsoftSharePointCommon.pageId,
17
+ },
18
+ run(context) {
19
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+ const { siteId, pageId } = context.propsValue;
21
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
22
+ authProvider: {
23
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
24
+ },
25
+ });
26
+ try {
27
+ yield client
28
+ .api(`/sites/${siteId}/pages/${pageId}/microsoft.graph.sitePage/publish`)
29
+ .post({});
30
+ return {
31
+ success: true,
32
+ message: 'Page published successfully',
33
+ pageId: pageId,
34
+ siteId: siteId,
35
+ };
36
+ }
37
+ catch (error) {
38
+ if (error.statusCode === 404) {
39
+ throw new Error(`Page not found. Please verify the page ID: ${pageId}`);
40
+ }
41
+ if (error.statusCode === 403) {
42
+ throw new Error('Insufficient permissions to publish this page. Requires Files.ReadWrite or higher.');
43
+ }
44
+ if (error.statusCode === 409) {
45
+ throw new Error('Page cannot be published. It may be awaiting approval or already published.');
46
+ }
47
+ throw new Error(`Failed to publish page: ${error.message || 'Unknown error'}`);
48
+ }
49
+ });
50
+ },
51
+ });
52
+ //# sourceMappingURL=publish-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-page.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-sharepoint/src/lib/actions/publish-page.ts"],"names":[],"mappings":";;;;AAAA,8BAAiD;AACjD,oEAA6D;AAC7D,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,2BAAuB;IAC7B,IAAI,EAAE,mCAAmC;IACzC,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,qNAAqN;IAClO,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,MAAM,EAAE,kCAAyB,CAAC,MAAM;KACzC;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE9C,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACvC,YAAY,EAAE;oBACZ,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBACjE;aACF,CAAC,CAAC;YAEH,IAAI,CAAC;gBACH,MAAM,MAAM;qBACT,GAAG,CAAC,UAAU,MAAM,UAAU,MAAM,mCAAmC,CAAC;qBACxE,IAAI,CAAC,EAAE,CAAC,CAAC;gBAEZ,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,6BAA6B;oBACtC,MAAM,EAAE,MAAM;oBACd,MAAM,EAAE,MAAM;iBACf,CAAC;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,MAAM,IAAI,KAAK,CAAC,8CAA8C,MAAM,EAAE,CAAC,CAAC;gBAC1E,CAAC;gBACD,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;gBACxG,CAAC;gBACD,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;gBACjG,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACjF,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const findListItemAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ siteId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ listId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ searchValue: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
5
+ }>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findListItemAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
9
+ exports.findListItemAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftSharePointAuth,
11
+ name: 'microsoft_sharepoint_search_list_item',
12
+ displayName: 'Find List Item',
13
+ description: 'Finds a item in a list based on name.',
14
+ props: {
15
+ siteId: common_1.microsoftSharePointCommon.siteId,
16
+ listId: common_1.microsoftSharePointCommon.listId,
17
+ searchValue: pieces_framework_1.Property.ShortText({
18
+ displayName: 'Title',
19
+ description: 'Item title to search',
20
+ required: true,
21
+ }),
22
+ },
23
+ run(context) {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const { siteId, listId, searchValue } = context.propsValue;
26
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
27
+ authProvider: {
28
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
29
+ },
30
+ });
31
+ // Escaping single quotes
32
+ const title = searchValue.replaceAll("'", "''");
33
+ return yield client
34
+ .api(`/sites/${siteId}/lists/${listId}/items?$expand=fields&filter=fields/Title eq '${title}'`)
35
+ .headers({ Prefer: 'HonorNonIndexedQueriesWarningMayFailRandomly' })
36
+ .get();
37
+ });
38
+ },
39
+ });
40
+ //# sourceMappingURL=search-list-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-list-item.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-sharepoint/src/lib/actions/search-list-item.ts"],"names":[],"mappings":";;;;AAAA,8BAAiD;AACjD,oEAAuE;AACvE,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,2BAAuB;IAC7B,IAAI,EAAE,uCAAuC;IAC7C,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE3D,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACvC,YAAY,EAAE;oBACZ,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBACjE;aACF,CAAC,CAAC;YAEH,yBAAyB;YACzB,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAChD,OAAO,MAAM,MAAM;iBAChB,GAAG,CACF,UAAU,MAAM,UAAU,MAAM,iDAAiD,KAAK,GAAG,CAC1F;iBACA,OAAO,CAAC,EAAE,MAAM,EAAE,8CAA8C,EAAE,CAAC;iBACnE,GAAG,EAAE,CAAC;QACX,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const updateListItemAction: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ siteId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ listId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ listItemId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
5
+ listColumns: import("@scopieflows/pieces-framework").DynamicProperties<true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
6
+ }>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateListItemAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
9
+ exports.updateListItemAction = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftSharePointAuth,
11
+ name: 'microsoft_sharepoint_update_list_item',
12
+ displayName: 'Update List Item',
13
+ description: 'Updates an existing item in a list.',
14
+ props: {
15
+ siteId: common_1.microsoftSharePointCommon.siteId,
16
+ listId: common_1.microsoftSharePointCommon.listId,
17
+ listItemId: common_1.microsoftSharePointCommon.listItemId,
18
+ listColumns: common_1.microsoftSharePointCommon.listColumns,
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const { siteId, listId, listItemId, listColumns } = context.propsValue;
23
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
24
+ authProvider: {
25
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
26
+ },
27
+ });
28
+ const fieldWithArrayValues = {};
29
+ Object.entries(listColumns).forEach(([key, value]) => {
30
+ // https://learn.microsoft.com/en-us/answers/questions/1517379/upload-multiple-choice-fields-item-in-sharepoint-w
31
+ if (Array.isArray(value)) {
32
+ fieldWithArrayValues[`${key}@odata.type`] = 'Collection(Edm.String)';
33
+ }
34
+ });
35
+ const itemInput = Object.assign(Object.assign({}, listColumns), fieldWithArrayValues);
36
+ return yield client
37
+ .api(`/sites/${siteId}/lists/${listId}/items/${listItemId}/fields`)
38
+ .patch(itemInput);
39
+ });
40
+ },
41
+ });
42
+ //# sourceMappingURL=update-list-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-list-item.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-sharepoint/src/lib/actions/update-list-item.ts"],"names":[],"mappings":";;;;AAAA,8BAAiD;AACjD,oEAA6D;AAC7D,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,2BAAuB;IAC7B,IAAI,EAAE,uCAAuC;IAC7C,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,qCAAqC;IAClD,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,UAAU,EAAE,kCAAyB,CAAC,UAAU;QAChD,WAAW,EAAE,kCAAyB,CAAC,WAAW;KACnD;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvE,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACvC,YAAY,EAAE;oBACZ,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBACjE;aACF,CAAC,CAAC;YACH,MAAM,oBAAoB,GAA2B,EAAE,CAAC;YAExD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBACnD,iHAAiH;gBACjH,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,oBAAoB,CAAC,GAAG,GAAG,aAAa,CAAC,GAAG,wBAAwB,CAAC;gBACvE,CAAC;YACH,CAAC,CAAC,CAAC;YACH,MAAM,SAAS,mCAAQ,WAAW,GAAK,oBAAoB,CAAE,CAAC;YAE9D,OAAO,MAAM,MAAM;iBAChB,GAAG,CAAC,UAAU,MAAM,UAAU,MAAM,UAAU,UAAU,SAAS,CAAC;iBAClE,KAAK,CAAC,SAAS,CAAC,CAAC;QACtB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const uploadFile: import("@scopieflows/pieces-framework").IAction<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {
2
+ siteId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ driveId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ file: import("@scopieflows/pieces-framework").FileProperty<true>;
5
+ parentFolder: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
6
+ fileName: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
7
+ }>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploadFile = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const __1 = require("../../");
6
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
7
+ const common_1 = require("../common");
8
+ const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
9
+ exports.uploadFile = (0, pieces_framework_1.createAction)({
10
+ auth: __1.microsoftSharePointAuth,
11
+ name: 'microsoft_sharepoint_upload_file',
12
+ displayName: 'Upload File',
13
+ description: 'Uploads a new file at path you specify.',
14
+ props: {
15
+ siteId: common_1.microsoftSharePointCommon.siteId,
16
+ driveId: common_1.microsoftSharePointCommon.driveId,
17
+ file: pieces_framework_1.Property.File({
18
+ displayName: "File",
19
+ description: "The file or url you want to upload",
20
+ required: true,
21
+ }),
22
+ parentFolder: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Parent Folder',
24
+ description: `Parent folder, like "/demo/" or "/docs/assignment/".Leave it default if you want to create folder at the root (**CHANGE THIS BACK//**) level.`,
25
+ required: true,
26
+ defaultValue: '/',
27
+ }),
28
+ fileName: pieces_framework_1.Property.ShortText({
29
+ displayName: 'File Name',
30
+ required: true,
31
+ }),
32
+ },
33
+ run(context) {
34
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
35
+ var _a;
36
+ const { siteId, driveId, file, parentFolder, fileName } = context.propsValue;
37
+ const client = microsoft_graph_client_1.Client.initWithMiddleware({
38
+ authProvider: {
39
+ getAccessToken: () => Promise.resolve(context.auth.access_token),
40
+ },
41
+ });
42
+ const parentIdResponse = yield client.api(`/sites/${siteId}/drives/${driveId}/root:${parentFolder}`).get();
43
+ const parentId = (_a = parentIdResponse.id) !== null && _a !== void 0 ? _a : "test";
44
+ const uploadResponse = yield client.api(`/sites/${siteId}/drives/${driveId}/items/${parentId}:/${fileName}:/content`).put(file.data);
45
+ return uploadResponse;
46
+ });
47
+ }
48
+ });
49
+ //# sourceMappingURL=upload-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-file.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/microsoft-sharepoint/src/lib/actions/upload-file.ts"],"names":[],"mappings":";;;;AAAA,8BAAiD;AACjD,oEAAuE;AACvE,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,2BAAuB;IAC7B,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,OAAO,EAAE,kCAAyB,CAAC,OAAO;QAC1C,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,+IAA+I;YAC5J,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,GAAG;SAClB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE7E,MAAM,MAAM,GAAG,+BAAM,CAAC,kBAAkB,CAAC;gBACvC,YAAY,EAAE;oBACZ,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;iBACjE;aACF,CAAC,CAAC;YAEH,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,MAAM,WAAW,OAAO,SAAS,YAAY,EAAE,CAAC,CAAC,GAAG,EAAE,CAAA;YAC1G,MAAM,QAAQ,GAAG,MAAA,gBAAgB,CAAC,EAAE,mCAAI,MAAM,CAAC;YAE/C,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,MAAM,WAAW,OAAO,UAAU,QAAQ,KAAK,QAAQ,WAAW,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAEpI,OAAO,cAAc,CAAA;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const microsoftSharePointCommon: {
2
+ siteId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
3
+ driveId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
4
+ createDriveDropdown: (params: {
5
+ displayName: string;
6
+ refreshers: string[];
7
+ }) => import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
8
+ itemId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
9
+ destinationFolderId: import("@scopieflows/pieces-framework").DropdownProperty<string, false, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
10
+ listId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
11
+ listColumns: import("@scopieflows/pieces-framework").DynamicProperties<true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
12
+ listItemId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
13
+ pageId: import("@scopieflows/pieces-framework").DropdownProperty<string, true, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
14
+ };