@activepieces/piece-microsoft-sharepoint 0.3.3 → 0.3.5

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 (109) hide show
  1. package/package.json +7 -13
  2. package/src/index.js +26 -81
  3. package/src/index.d.ts +0 -2
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/copy-item-within-site.d.ts +0 -9
  7. package/src/lib/actions/copy-item-within-site.d.ts.map +0 -1
  8. package/src/lib/actions/copy-item-within-site.js +0 -161
  9. package/src/lib/actions/copy-item-within-site.js.map +0 -1
  10. package/src/lib/actions/copy-item.d.ts +0 -11
  11. package/src/lib/actions/copy-item.d.ts.map +0 -1
  12. package/src/lib/actions/copy-item.js +0 -121
  13. package/src/lib/actions/copy-item.js.map +0 -1
  14. package/src/lib/actions/create-folder.d.ts +0 -7
  15. package/src/lib/actions/create-folder.d.ts.map +0 -1
  16. package/src/lib/actions/create-folder.js +0 -48
  17. package/src/lib/actions/create-folder.js.map +0 -1
  18. package/src/lib/actions/create-list-item.d.ts +0 -6
  19. package/src/lib/actions/create-list-item.d.ts.map +0 -1
  20. package/src/lib/actions/create-list-item.js +0 -47
  21. package/src/lib/actions/create-list-item.js.map +0 -1
  22. package/src/lib/actions/create-list.d.ts +0 -6
  23. package/src/lib/actions/create-list.d.ts.map +0 -1
  24. package/src/lib/actions/create-list.js +0 -45
  25. package/src/lib/actions/create-list.js.map +0 -1
  26. package/src/lib/actions/delete-list-item.d.ts +0 -6
  27. package/src/lib/actions/delete-list-item.d.ts.map +0 -1
  28. package/src/lib/actions/delete-list-item.js +0 -37
  29. package/src/lib/actions/delete-list-item.js.map +0 -1
  30. package/src/lib/actions/find-file.d.ts +0 -9
  31. package/src/lib/actions/find-file.d.ts.map +0 -1
  32. package/src/lib/actions/find-file.js +0 -140
  33. package/src/lib/actions/find-file.js.map +0 -1
  34. package/src/lib/actions/find-site.d.ts +0 -4
  35. package/src/lib/actions/find-site.d.ts.map +0 -1
  36. package/src/lib/actions/find-site.js +0 -56
  37. package/src/lib/actions/find-site.js.map +0 -1
  38. package/src/lib/actions/get-folder-contents.d.ts +0 -10
  39. package/src/lib/actions/get-folder-contents.d.ts.map +0 -1
  40. package/src/lib/actions/get-folder-contents.js +0 -115
  41. package/src/lib/actions/get-folder-contents.js.map +0 -1
  42. package/src/lib/actions/get-site-information.d.ts +0 -5
  43. package/src/lib/actions/get-site-information.d.ts.map +0 -1
  44. package/src/lib/actions/get-site-information.js +0 -42
  45. package/src/lib/actions/get-site-information.js.map +0 -1
  46. package/src/lib/actions/move-file.d.ts +0 -8
  47. package/src/lib/actions/move-file.d.ts.map +0 -1
  48. package/src/lib/actions/move-file.js +0 -161
  49. package/src/lib/actions/move-file.js.map +0 -1
  50. package/src/lib/actions/publish-page.d.ts +0 -5
  51. package/src/lib/actions/publish-page.d.ts.map +0 -1
  52. package/src/lib/actions/publish-page.js +0 -56
  53. package/src/lib/actions/publish-page.js.map +0 -1
  54. package/src/lib/actions/search-list-item.d.ts +0 -6
  55. package/src/lib/actions/search-list-item.d.ts.map +0 -1
  56. package/src/lib/actions/search-list-item.js +0 -44
  57. package/src/lib/actions/search-list-item.js.map +0 -1
  58. package/src/lib/actions/update-list-item.d.ts +0 -7
  59. package/src/lib/actions/update-list-item.d.ts.map +0 -1
  60. package/src/lib/actions/update-list-item.js +0 -46
  61. package/src/lib/actions/update-list-item.js.map +0 -1
  62. package/src/lib/actions/upload-file.d.ts +0 -8
  63. package/src/lib/actions/upload-file.d.ts.map +0 -1
  64. package/src/lib/actions/upload-file.js +0 -52
  65. package/src/lib/actions/upload-file.js.map +0 -1
  66. package/src/lib/auth.d.ts +0 -2
  67. package/src/lib/auth.d.ts.map +0 -1
  68. package/src/lib/auth.js +0 -37
  69. package/src/lib/auth.js.map +0 -1
  70. package/src/lib/common/index.d.ts +0 -15
  71. package/src/lib/common/index.d.ts.map +0 -1
  72. package/src/lib/common/index.js +0 -416
  73. package/src/lib/common/index.js.map +0 -1
  74. package/src/lib/common/microsoft-cloud.d.ts +0 -5
  75. package/src/lib/common/microsoft-cloud.d.ts.map +0 -1
  76. package/src/lib/common/microsoft-cloud.js +0 -38
  77. package/src/lib/common/microsoft-cloud.js.map +0 -1
  78. package/src/lib/triggers/new-file-in-folder.d.ts +0 -19
  79. package/src/lib/triggers/new-file-in-folder.d.ts.map +0 -1
  80. package/src/lib/triggers/new-file-in-folder.js +0 -167
  81. package/src/lib/triggers/new-file-in-folder.js.map +0 -1
  82. package/src/lib/triggers/new-file-in-subfolders.d.ts +0 -19
  83. package/src/lib/triggers/new-file-in-subfolders.d.ts.map +0 -1
  84. package/src/lib/triggers/new-file-in-subfolders.js +0 -163
  85. package/src/lib/triggers/new-file-in-subfolders.js.map +0 -1
  86. package/src/lib/triggers/new-list-item.d.ts +0 -15
  87. package/src/lib/triggers/new-list-item.d.ts.map +0 -1
  88. package/src/lib/triggers/new-list-item.js +0 -99
  89. package/src/lib/triggers/new-list-item.js.map +0 -1
  90. package/src/lib/triggers/new-list.d.ts +0 -11
  91. package/src/lib/triggers/new-list.d.ts.map +0 -1
  92. package/src/lib/triggers/new-list.js +0 -93
  93. package/src/lib/triggers/new-list.js.map +0 -1
  94. package/src/lib/triggers/new-or-updated-file.d.ts +0 -19
  95. package/src/lib/triggers/new-or-updated-file.d.ts.map +0 -1
  96. package/src/lib/triggers/new-or-updated-file.js +0 -159
  97. package/src/lib/triggers/new-or-updated-file.js.map +0 -1
  98. package/src/lib/triggers/new-or-updated-folder.d.ts +0 -19
  99. package/src/lib/triggers/new-or-updated-folder.d.ts.map +0 -1
  100. package/src/lib/triggers/new-or-updated-folder.js +0 -159
  101. package/src/lib/triggers/new-or-updated-folder.js.map +0 -1
  102. package/src/lib/triggers/new-or-updated-list.d.ts +0 -11
  103. package/src/lib/triggers/new-or-updated-list.d.ts.map +0 -1
  104. package/src/lib/triggers/new-or-updated-list.js +0 -107
  105. package/src/lib/triggers/new-or-updated-list.js.map +0 -1
  106. package/src/lib/triggers/updated-list-item.d.ts +0 -15
  107. package/src/lib/triggers/updated-list-item.d.ts.map +0 -1
  108. package/src/lib/triggers/updated-list-item.js +0 -117
  109. package/src/lib/triggers/updated-list-item.js.map +0 -1
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const microsoftSharePoint: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,mBAAmB,+JA4C9B,CAAC"}
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,kEAA+D;AAC/D,qEAGwC;AACxC,iDAAqD;AAErD,+DAAiE;AACjE,2DAA6D;AAC7D,qEAAsE;AACtE,qEAAsE;AACtE,qEAAoE;AACpE,qEAAsE;AACtE,2DAAuD;AAEvD,uDAAyD;AACzD,+EAA+E;AAC/E,uDAAyD;AACzD,2EAA4E;AAC5E,6EAA8E;AAC9E,uDAAyD;AACzD,uDAAyD;AACzD,6DAA+D;AAE/D,qCAAqD;AACrD,0EAA2E;AAC3E,kFAAmF;AACnF,sDAAyD;AACzD,gEAAkE;AAClE,4EAA6E;AAC7E,gFAAiF;AACjF,4EAA6E;AAC7E,wEAA0E;AAE7D,QAAA,mBAAmB,GAAG,IAAA,8BAAW,EAAC;IAC7C,WAAW,EAAE,sBAAsB;IACnC,IAAI,EAAE,8BAAuB;IAC7B,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,8DAA8D;IACvE,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,CAAC;IAC7C,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,mBAAmB,CAAC;IAC1D,OAAO,EAAE;QACP,kCAAkB;QAClB,8BAAgB;QAChB,uCAAoB;QACpB,uCAAoB;QACpB,uCAAoB;QACpB,qCAAkB;QAClB,wBAAU;QACV,gCAAiB;QACjB,0BAAc;QACd,gDAAwB;QACxB,0BAAc;QACd,0BAAc;QACd,6CAAuB;QACvB,+CAAwB;QACxB,0BAAc;QACd,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,8BAAuB;YAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;;gBAChB,MAAM,KAAK,GAAG,MAAC,IAA4B,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;gBACnF,OAAO,IAAA,iCAAe,EAAC,KAAK,CAAC,GAAG,OAAO,CAAC;YAC1C,CAAC;YACD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACtE,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE;QACR,2CAAsB;QACtB,mDAA0B;QAC1B,6CAAuB;QACvB,iDAAyB;QACzB,kCAAkB;QAClB,0CAAsB;QACtB,yBAAc;QACd,6CAAuB;KACxB;CACF,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare const copyItemWithinSiteAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- itemId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- destinationFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
6
- newName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
- conflictBehavior: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
8
- }>;
9
- //# sourceMappingURL=copy-item-within-site.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-item-within-site.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/copy-item-within-site.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,wBAAwB;;;;;;;EA2JnC,CAAC"}
@@ -1,161 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copyItemWithinSiteAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const auth_1 = require("../auth");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
8
- const common_1 = require("../common");
9
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
10
- const polling_delay_ms = 2000;
11
- const polling_timeout_secs = 120;
12
- function delay(ms) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- return new Promise((resolve) => setTimeout(resolve, ms));
15
- });
16
- }
17
- exports.copyItemWithinSiteAction = (0, pieces_framework_1.createAction)({
18
- auth: auth_1.microsoftSharePointAuth,
19
- name: 'microsoft_sharepoint_copy_item_within_site',
20
- displayName: 'Copy File or Folder (Within Site)',
21
- description: 'Copy a file or folder to another folder within the same site.',
22
- props: {
23
- siteId: common_1.microsoftSharePointCommon.siteId,
24
- driveId: common_1.microsoftSharePointCommon.driveId,
25
- itemId: common_1.microsoftSharePointCommon.itemId,
26
- destinationFolderId: pieces_framework_1.Property.Dropdown({
27
- auth: auth_1.microsoftSharePointAuth,
28
- displayName: 'Destination Folder',
29
- description: 'The folder to copy the item into. Select "Root" to copy to the top level of the drive.',
30
- required: true,
31
- refreshers: ['siteId', 'driveId'],
32
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, siteId, driveId }) {
33
- var _b;
34
- if (!auth || !siteId || !driveId) {
35
- return {
36
- disabled: true,
37
- placeholder: 'Select a site and drive first.',
38
- options: [],
39
- };
40
- }
41
- const authValue = auth;
42
- const cloud = (_b = authValue.props) === null || _b === void 0 ? void 0 : _b['cloud'];
43
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
44
- authProvider: {
45
- getAccessToken: () => Promise.resolve(authValue.access_token),
46
- },
47
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
48
- });
49
- const options = [
50
- { label: 'Root', value: 'root' }
51
- ];
52
- let response = yield client
53
- .api(`/sites/${siteId}/drives/${driveId}/root/children?$filter=folder ne null&$select=id,name`)
54
- .get();
55
- while (response.value.length > 0) {
56
- for (const item of response.value) {
57
- options.push({
58
- label: item.name,
59
- value: item.id,
60
- });
61
- }
62
- if (response['@odata.nextLink']) {
63
- response = yield client.api(response['@odata.nextLink']).get();
64
- }
65
- else {
66
- break;
67
- }
68
- }
69
- return { disabled: false, options };
70
- }),
71
- }),
72
- newName: pieces_framework_1.Property.ShortText({
73
- displayName: 'New Name (Optional)',
74
- description: 'A new name for the copied item. If not provided, the original name is used.',
75
- required: false,
76
- }),
77
- conflictBehavior: pieces_framework_1.Property.StaticDropdown({
78
- displayName: 'Conflict Behavior',
79
- description: 'Action to take if a file with the same name already exists in the destination.',
80
- required: true,
81
- options: {
82
- options: [
83
- { label: 'Fail on conflict', value: 'fail' },
84
- { label: 'Overwrite existing file', value: 'replace' },
85
- { label: 'Rename with a number', value: 'rename' },
86
- ],
87
- },
88
- defaultValue: 'fail',
89
- }),
90
- },
91
- run(context) {
92
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
- var _a, _b, _c;
94
- const { siteId, driveId, itemId, destinationFolderId, newName, conflictBehavior } = context.propsValue;
95
- const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
96
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
97
- authProvider: {
98
- getAccessToken: () => Promise.resolve(context.auth.access_token),
99
- },
100
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
101
- });
102
- const effectiveDestinationId = destinationFolderId === 'root'
103
- ? (yield client.api(`/drives/${driveId}/root`).get()).id
104
- : destinationFolderId;
105
- const body = {
106
- parentReference: {
107
- id: effectiveDestinationId,
108
- },
109
- };
110
- if (newName) {
111
- body.name = newName;
112
- }
113
- let initialResponse;
114
- try {
115
- initialResponse = yield client
116
- .api(`/drives/${driveId}/items/${itemId}/copy`)
117
- .responseType(microsoft_graph_client_1.ResponseType.RAW)
118
- .query({ '@microsoft.graph.conflictBehavior': conflictBehavior })
119
- .post(body);
120
- }
121
- catch (error) {
122
- if (error.statusCode === 400) {
123
- throw new Error(`Invalid request: ${error.message || 'Check your input parameters'}`);
124
- }
125
- if (error.statusCode === 403) {
126
- throw new Error('Insufficient permissions to copy this item. Requires Files.ReadWrite or higher.');
127
- }
128
- if (error.statusCode === 404) {
129
- throw new Error('Source item not found. Please verify the site, drive, and item IDs.');
130
- }
131
- throw new Error(`Failed to initiate copy operation: ${error.message || 'Unknown error'}`);
132
- }
133
- const monitorUrl = initialResponse.headers.get('Location');
134
- if (!monitorUrl) {
135
- throw new Error('Could not get monitor URL from copy operation response.');
136
- }
137
- let attempts = polling_timeout_secs * 1000 / polling_delay_ms;
138
- while (attempts > 0) {
139
- const monitorResponse = yield client.api(monitorUrl).get();
140
- if (monitorResponse.status === 'completed') {
141
- return {
142
- success: true,
143
- status: 'completed',
144
- resourceId: monitorResponse.resourceId,
145
- resourceLocation: monitorResponse.resourceLocation,
146
- };
147
- }
148
- if (monitorResponse.status === 'failed') {
149
- const errorDetails = ((_b = monitorResponse.error) === null || _b === void 0 ? void 0 : _b.details)
150
- ? monitorResponse.error.details.map((d) => d.message || d.code).join(', ')
151
- : ((_c = monitorResponse.error) === null || _c === void 0 ? void 0 : _c.message) || 'Unknown error';
152
- throw new Error(`Copy operation failed: ${errorDetails}`);
153
- }
154
- yield delay(polling_delay_ms);
155
- attempts--;
156
- }
157
- throw new Error('Copy operation timed out after 120 seconds.');
158
- });
159
- },
160
- });
161
- //# sourceMappingURL=copy-item-within-site.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-item-within-site.js","sourceRoot":"","sources":["../../../../src/lib/actions/copy-item-within-site.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAMwC;AACxC,+DAA4D;AAC5D,sCAAsD;AACtD,8EAAyF;AAGzF,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,SAAe,KAAK,CAAC,EAAU;;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CAAA;AAEY,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,8BAAuB;IAC7B,IAAI,EAAE,4CAA4C;IAClD,WAAW,EAAE,mCAAmC;IAChD,WAAW,EAAE,+DAA+D;IAC5E,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,OAAO,EAAE,kCAAyB,CAAC,OAAO;QAC1C,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,mBAAmB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACrC,IAAI,EAAE,8BAAuB;YAC7B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,wFAAwF;YACrG,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;YACjC,OAAO,EAAE,KAAkC,EAAE,oDAA7B,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;;gBACvC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,OA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AoB,GAAG,IAAI,GAAG,gBAAgB,CAAC;YAC9D,OAAO,QAAQ,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC;gBAC3D,IAAI,eAAe,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;oBAC3C,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE,WAAW;wBACnB,UAAU,EAAE,eAAe,CAAC,UAAU;wBACtC,gBAAgB,EAAE,eAAe,CAAC,gBAAgB;qBACnD,CAAC;gBACJ,CAAC;gBACD,IAAI,eAAe,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;oBACxC,MAAM,YAAY,GAAG,CAAA,MAAA,eAAe,CAAC,KAAK,0CAAE,OAAO;wBACjD,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;wBAC/E,CAAC,CAAC,CAAA,MAAA,eAAe,CAAC,KAAK,0CAAE,OAAO,KAAI,eAAe,CAAC;oBACtD,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;gBAC5D,CAAC;gBACD,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBAC9B,QAAQ,EAAE,CAAC;YACb,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- export declare const copyItemAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- itemId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- destination_site_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
6
- destination_drive_id: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
7
- destination_folder_id: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
8
- new_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
- conflict_behavior: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
10
- }>;
11
- //# sourceMappingURL=copy-item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/copy-item.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc;;;;;;;;;EAsHzB,CAAC"}
@@ -1,121 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.copyItemAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const auth_1 = require("../auth");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
8
- const common_1 = require("../common");
9
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
10
- const polling_delay_ms = 2000;
11
- const polling_timeout_secs = 120;
12
- function delay(ms) {
13
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- return new Promise((resolve) => setTimeout(resolve, ms));
15
- });
16
- }
17
- exports.copyItemAction = (0, pieces_framework_1.createAction)({
18
- auth: auth_1.microsoftSharePointAuth,
19
- name: 'microsoft_sharepoint_copy_item',
20
- displayName: 'Copy File or Folder (Across Sites)',
21
- description: 'Copy a file or folder from one site to another within the same tenant, with overwrite option.',
22
- props: {
23
- siteId: common_1.microsoftSharePointCommon.siteId,
24
- driveId: common_1.microsoftSharePointCommon.driveId,
25
- itemId: common_1.microsoftSharePointCommon.itemId,
26
- destination_site_id: common_1.microsoftSharePointCommon.siteId,
27
- destination_drive_id: common_1.microsoftSharePointCommon.createDriveDropdown({
28
- displayName: 'Destination Drive',
29
- refreshers: ['destination_site_id'],
30
- }),
31
- destination_folder_id: common_1.microsoftSharePointCommon.destinationFolderId,
32
- new_name: pieces_framework_1.Property.ShortText({
33
- displayName: 'New Name (Optional)',
34
- description: 'A new name for the copied item. If not provided, the original name is used.',
35
- required: false,
36
- }),
37
- conflict_behavior: pieces_framework_1.Property.StaticDropdown({
38
- displayName: 'Conflict Behavior',
39
- description: 'Action to take if a file with the same name already exists.',
40
- required: true,
41
- options: {
42
- options: [
43
- { label: 'Fail on conflict', value: 'fail' },
44
- { label: 'Overwrite existing file', value: 'replace' },
45
- { label: 'Rename with a number', value: 'rename' },
46
- ],
47
- },
48
- defaultValue: 'fail',
49
- }),
50
- },
51
- run(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- var _a, _b, _c;
54
- const { siteId, driveId, itemId, destination_drive_id, destination_folder_id, new_name, conflict_behavior, } = context.propsValue;
55
- const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
56
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
57
- authProvider: {
58
- getAccessToken: () => Promise.resolve(context.auth.access_token),
59
- },
60
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
61
- });
62
- const body = {
63
- parentReference: {
64
- driveId: destination_drive_id,
65
- },
66
- };
67
- if (destination_folder_id) {
68
- body.parentReference.id = destination_folder_id;
69
- }
70
- if (new_name) {
71
- body.name = new_name;
72
- }
73
- let initialResponse;
74
- try {
75
- initialResponse = yield client
76
- .api(`/drives/${driveId}/items/${itemId}/copy`)
77
- .responseType(microsoft_graph_client_1.ResponseType.RAW)
78
- .query({ '@microsoft.graph.conflictBehavior': conflict_behavior })
79
- .post(body);
80
- }
81
- catch (error) {
82
- if (error.statusCode === 400) {
83
- throw new Error(`Invalid request: ${error.message || 'Check your input parameters'}`);
84
- }
85
- if (error.statusCode === 403) {
86
- throw new Error('Insufficient permissions to copy this item. Requires Files.ReadWrite or higher.');
87
- }
88
- if (error.statusCode === 404) {
89
- throw new Error('Source item not found. Please verify the site, drive, and item IDs.');
90
- }
91
- throw new Error(`Failed to initiate copy operation: ${error.message || 'Unknown error'}`);
92
- }
93
- const monitorUrl = initialResponse.headers.get('Location');
94
- if (!monitorUrl) {
95
- throw new Error('Could not get monitor URL from copy operation response.');
96
- }
97
- let attempts = polling_timeout_secs * 1000 / polling_delay_ms;
98
- while (attempts > 0) {
99
- const monitorResponse = yield client.api(monitorUrl).get();
100
- if (monitorResponse.status === 'completed') {
101
- return {
102
- success: true,
103
- status: 'completed',
104
- resourceId: monitorResponse.resourceId,
105
- resourceLocation: monitorResponse.resourceLocation,
106
- };
107
- }
108
- if (monitorResponse.status === 'failed') {
109
- const errorDetails = ((_b = monitorResponse.error) === null || _b === void 0 ? void 0 : _b.details)
110
- ? monitorResponse.error.details.map((d) => d.message || d.code).join(', ')
111
- : ((_c = monitorResponse.error) === null || _c === void 0 ? void 0 : _c.message) || 'Unknown error';
112
- throw new Error(`Copy operation failed: ${errorDetails}`);
113
- }
114
- yield delay(polling_delay_ms);
115
- attempts--;
116
- }
117
- throw new Error('Copy operation timed out after 120 seconds.');
118
- });
119
- },
120
- });
121
- //# sourceMappingURL=copy-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"copy-item.js","sourceRoot":"","sources":["../../../../src/lib/actions/copy-item.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qE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,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;wBAC/E,CAAC,CAAC,CAAA,MAAA,eAAe,CAAC,KAAK,0CAAE,OAAO,KAAI,eAAe,CAAC;oBACtD,MAAM,IAAI,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;gBAC5D,CAAC;gBACD,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBAC9B,QAAQ,EAAE,CAAC;YACb,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- export declare const createFolderAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- parentFolder: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
- folderName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
- }>;
7
- //# sourceMappingURL=create-folder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-folder.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB;;;;;EAqC7B,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFolderAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const auth_1 = require("../auth");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
8
- const common_1 = require("../common");
9
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
10
- exports.createFolderAction = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.microsoftSharePointAuth,
12
- name: 'microsoft_sharepoint_create_folder',
13
- displayName: 'Create Folder',
14
- description: 'Creates a new folder at path you specify.',
15
- props: {
16
- siteId: common_1.microsoftSharePointCommon.siteId,
17
- driveId: common_1.microsoftSharePointCommon.driveId,
18
- parentFolder: pieces_framework_1.Property.ShortText({
19
- displayName: 'Parent Folder',
20
- description: `Parent folder,like "/demo/" or "/docs/assignment/".Leave it default if you want to create folder at the root (**/**) level.`,
21
- required: true,
22
- defaultValue: '/',
23
- }),
24
- folderName: pieces_framework_1.Property.ShortText({
25
- displayName: 'Folder Name',
26
- required: true,
27
- }),
28
- },
29
- run(context) {
30
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
31
- var _a;
32
- const { driveId, parentFolder, folderName } = context.propsValue;
33
- const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
34
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
35
- authProvider: {
36
- getAccessToken: () => Promise.resolve(context.auth.access_token),
37
- },
38
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
39
- });
40
- const folderPath = parentFolder + folderName;
41
- // https://stackoverflow.com/questions/66631136/creating-nested-folder-in-sharepoint-with-graph-api-fails
42
- return yield client.api(`/drives/${driveId}/root:${folderPath}`).patch({
43
- folder: {},
44
- });
45
- });
46
- },
47
- });
48
- //# sourceMappingURL=create-folder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-folder.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-folder.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAAwE;AACxE,+DAA4D;AAC5D,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,8BAAuB;IAC7B,IAAI,EAAE,oCAAoC;IAC1C,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,2CAA2C;IACxD,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,OAAO,EAAE,kCAAyB,CAAC,OAAO;QAC1C,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,6HAA6H;YAC1I,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,GAAG;SAClB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjE,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,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;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAChC,CAAC,CAAC;YAEH,MAAM,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;YAE7C,yGAAyG;YACzG,OAAO,MAAM,MAAM,CAAC,GAAG,CAAC,WAAW,OAAO,SAAS,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC;gBACrE,MAAM,EAAE,EAAE;aACX,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const createListItemAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- listColumns: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- }>;
6
- //# sourceMappingURL=create-list-item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-list-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-list-item.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB;;;;EAoC/B,CAAC"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createListItemAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const auth_1 = require("../auth");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
8
- const common_1 = require("../common");
9
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
10
- exports.createListItemAction = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.microsoftSharePointAuth,
12
- name: 'microsoft_sharepoint_create_list_item',
13
- displayName: 'Create List Item',
14
- description: 'Creates a new item in a list.',
15
- props: {
16
- siteId: common_1.microsoftSharePointCommon.siteId,
17
- listId: common_1.microsoftSharePointCommon.listId,
18
- listColumns: common_1.microsoftSharePointCommon.listColumns,
19
- },
20
- run(context) {
21
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- var _a;
23
- const { siteId, listId, listColumns } = context.propsValue;
24
- const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
25
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
26
- authProvider: {
27
- getAccessToken: () => Promise.resolve(context.auth.access_token),
28
- },
29
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
30
- });
31
- const fieldWithArrayValues = {};
32
- Object.entries(listColumns).forEach(([key, value]) => {
33
- // https://learn.microsoft.com/en-us/answers/questions/1517379/upload-multiple-choice-fields-item-in-sharepoint-w
34
- if (Array.isArray(value)) {
35
- fieldWithArrayValues[`${key}@odata.type`] = 'Collection(Edm.String)';
36
- }
37
- });
38
- const itemInput = {
39
- fields: Object.assign(Object.assign({}, listColumns), fieldWithArrayValues),
40
- };
41
- return yield client
42
- .api(`/sites/${siteId}/lists/${listId}/items`)
43
- .post(itemInput);
44
- });
45
- },
46
- });
47
- //# sourceMappingURL=create-list-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-list-item.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-list-item.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAA8D;AAC9D,+DAA4D;AAC5D,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,8BAAuB;IAC7B,IAAI,EAAE,uCAAuC;IAC7C,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,+BAA+B;IAC5C,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,WAAW,EAAE,kCAAyB,CAAC,WAAW;KACnD;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE3D,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,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;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAChC,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,GAAG;gBAChB,MAAM,kCAAO,WAAW,GAAK,oBAAoB,CAAE;aACpD,CAAC;YAEF,OAAO,MAAM,MAAM;iBAChB,GAAG,CAAC,UAAU,MAAM,UAAU,MAAM,QAAQ,CAAC;iBAC7C,IAAI,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const createListAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- displayName: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- description: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
- }>;
6
- //# sourceMappingURL=create-list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-list.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;EAkC3B,CAAC"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createListAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const auth_1 = require("../auth");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
8
- const common_1 = require("../common");
9
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
10
- exports.createListAction = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.microsoftSharePointAuth,
12
- name: 'microsoft_sharepoint_create_list',
13
- displayName: 'Create List',
14
- description: 'Creates a new list.',
15
- props: {
16
- siteId: common_1.microsoftSharePointCommon.siteId,
17
- displayName: pieces_framework_1.Property.ShortText({
18
- displayName: 'List Name',
19
- required: true,
20
- }),
21
- description: pieces_framework_1.Property.ShortText({
22
- displayName: 'List Description',
23
- required: true,
24
- }),
25
- },
26
- run(context) {
27
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
- var _a;
29
- const { siteId, displayName, description } = context.propsValue;
30
- const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
31
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
32
- authProvider: {
33
- getAccessToken: () => Promise.resolve(context.auth.access_token),
34
- },
35
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
36
- });
37
- const listInput = {
38
- displayName,
39
- description,
40
- };
41
- return yield client.api(`/sites/${siteId}/lists`).post(listInput);
42
- });
43
- },
44
- });
45
- //# sourceMappingURL=create-list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-list.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-list.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAAwE;AACxE,+DAA4D;AAC5D,sCAAsD;AACtD,8EAA2D;AAG9C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,8BAAuB;IAC7B,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qBAAqB;IAClC,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhE,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,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;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAChC,CAAC,CAAC;YAEH,MAAM,SAAS,GAAS;gBACtB,WAAW;gBACX,WAAW;aACZ,CAAC;YAEF,OAAO,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpE,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const deleteListItemAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- listItemId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- }>;
6
- //# sourceMappingURL=delete-list-item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-list-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-list-item.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB;;;;EAyB/B,CAAC"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteListItemAction = void 0;
4
- const tslib_1 = require("tslib");
5
- const auth_1 = require("../auth");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
8
- const common_1 = require("../common");
9
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
10
- exports.deleteListItemAction = (0, pieces_framework_1.createAction)({
11
- auth: auth_1.microsoftSharePointAuth,
12
- name: 'microsoft_sharepoint_delete_list_item',
13
- displayName: 'Delete List Item',
14
- description: 'Deletes an existing item from a list.',
15
- props: {
16
- siteId: common_1.microsoftSharePointCommon.siteId,
17
- listId: common_1.microsoftSharePointCommon.listId,
18
- listItemId: common_1.microsoftSharePointCommon.listItemId,
19
- },
20
- run(context) {
21
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
- var _a;
23
- const { siteId, listId, listItemId } = context.propsValue;
24
- const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
25
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
26
- authProvider: {
27
- getAccessToken: () => Promise.resolve(context.auth.access_token),
28
- },
29
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
30
- });
31
- return yield client
32
- .api(`/sites/${siteId}/lists/${listId}/items/${listItemId}`)
33
- .delete();
34
- });
35
- },
36
- });
37
- //# sourceMappingURL=delete-list-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-list-item.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-list-item.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAA8D;AAC9D,+DAA4D;AAC5D,sCAAsD;AACtD,8EAA2D;AAE9C,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,8BAAuB;IAC7B,IAAI,EAAE,uCAAuC;IAC7C,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,uCAAuC;IACpD,KAAK,EAAE;QACL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,UAAU,EAAE,kCAAyB,CAAC,UAAU;KACjD;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1D,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,OAAO,CAAuB,CAAC;YAClE,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;gBACD,OAAO,EAAE,IAAA,iCAAe,EAAC,KAAK,CAAC;aAChC,CAAC,CAAC;YAEH,OAAO,MAAM,MAAM;iBAChB,GAAG,CAAC,UAAU,MAAM,UAAU,MAAM,UAAU,UAAU,EAAE,CAAC;iBAC3D,MAAM,EAAE,CAAC;QACd,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare const findFileAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
3
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- findMethod: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
5
- filePath: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
- searchQuery: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
- searchFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
8
- }>;
9
- //# sourceMappingURL=find-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-file.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc;;;;;;;EAgIzB,CAAC"}