@activepieces/piece-microsoft-sharepoint 0.3.4 → 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.
- package/package.json +7 -13
- package/src/index.js +26 -81
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/copy-item-within-site.d.ts +0 -9
- package/src/lib/actions/copy-item-within-site.d.ts.map +0 -1
- package/src/lib/actions/copy-item-within-site.js +0 -166
- package/src/lib/actions/copy-item-within-site.js.map +0 -1
- package/src/lib/actions/copy-item.d.ts +0 -11
- package/src/lib/actions/copy-item.d.ts.map +0 -1
- package/src/lib/actions/copy-item.js +0 -126
- package/src/lib/actions/copy-item.js.map +0 -1
- package/src/lib/actions/create-folder.d.ts +0 -7
- package/src/lib/actions/create-folder.d.ts.map +0 -1
- package/src/lib/actions/create-folder.js +0 -53
- package/src/lib/actions/create-folder.js.map +0 -1
- package/src/lib/actions/create-list-item.d.ts +0 -6
- package/src/lib/actions/create-list-item.d.ts.map +0 -1
- package/src/lib/actions/create-list-item.js +0 -52
- package/src/lib/actions/create-list-item.js.map +0 -1
- package/src/lib/actions/create-list.d.ts +0 -6
- package/src/lib/actions/create-list.d.ts.map +0 -1
- package/src/lib/actions/create-list.js +0 -50
- package/src/lib/actions/create-list.js.map +0 -1
- package/src/lib/actions/delete-list-item.d.ts +0 -6
- package/src/lib/actions/delete-list-item.d.ts.map +0 -1
- package/src/lib/actions/delete-list-item.js +0 -42
- package/src/lib/actions/delete-list-item.js.map +0 -1
- package/src/lib/actions/find-file.d.ts +0 -9
- package/src/lib/actions/find-file.d.ts.map +0 -1
- package/src/lib/actions/find-file.js +0 -145
- package/src/lib/actions/find-file.js.map +0 -1
- package/src/lib/actions/find-site.d.ts +0 -4
- package/src/lib/actions/find-site.d.ts.map +0 -1
- package/src/lib/actions/find-site.js +0 -61
- package/src/lib/actions/find-site.js.map +0 -1
- package/src/lib/actions/get-folder-contents.d.ts +0 -10
- package/src/lib/actions/get-folder-contents.d.ts.map +0 -1
- package/src/lib/actions/get-folder-contents.js +0 -120
- package/src/lib/actions/get-folder-contents.js.map +0 -1
- package/src/lib/actions/get-site-information.d.ts +0 -5
- package/src/lib/actions/get-site-information.d.ts.map +0 -1
- package/src/lib/actions/get-site-information.js +0 -47
- package/src/lib/actions/get-site-information.js.map +0 -1
- package/src/lib/actions/move-file.d.ts +0 -8
- package/src/lib/actions/move-file.d.ts.map +0 -1
- package/src/lib/actions/move-file.js +0 -166
- package/src/lib/actions/move-file.js.map +0 -1
- package/src/lib/actions/publish-page.d.ts +0 -5
- package/src/lib/actions/publish-page.d.ts.map +0 -1
- package/src/lib/actions/publish-page.js +0 -61
- package/src/lib/actions/publish-page.js.map +0 -1
- package/src/lib/actions/search-list-item.d.ts +0 -6
- package/src/lib/actions/search-list-item.d.ts.map +0 -1
- package/src/lib/actions/search-list-item.js +0 -49
- package/src/lib/actions/search-list-item.js.map +0 -1
- package/src/lib/actions/update-list-item.d.ts +0 -7
- package/src/lib/actions/update-list-item.d.ts.map +0 -1
- package/src/lib/actions/update-list-item.js +0 -51
- package/src/lib/actions/update-list-item.js.map +0 -1
- package/src/lib/actions/upload-file.d.ts +0 -8
- package/src/lib/actions/upload-file.d.ts.map +0 -1
- package/src/lib/actions/upload-file.js +0 -57
- package/src/lib/actions/upload-file.js.map +0 -1
- package/src/lib/auth.d.ts +0 -2
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -37
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -15
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -416
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/common/microsoft-cloud.d.ts +0 -5
- package/src/lib/common/microsoft-cloud.d.ts.map +0 -1
- package/src/lib/common/microsoft-cloud.js +0 -38
- package/src/lib/common/microsoft-cloud.js.map +0 -1
- package/src/lib/triggers/new-file-in-folder.d.ts +0 -19
- package/src/lib/triggers/new-file-in-folder.d.ts.map +0 -1
- package/src/lib/triggers/new-file-in-folder.js +0 -170
- package/src/lib/triggers/new-file-in-folder.js.map +0 -1
- package/src/lib/triggers/new-file-in-subfolders.d.ts +0 -19
- package/src/lib/triggers/new-file-in-subfolders.d.ts.map +0 -1
- package/src/lib/triggers/new-file-in-subfolders.js +0 -166
- package/src/lib/triggers/new-file-in-subfolders.js.map +0 -1
- package/src/lib/triggers/new-list-item.d.ts +0 -15
- package/src/lib/triggers/new-list-item.d.ts.map +0 -1
- package/src/lib/triggers/new-list-item.js +0 -102
- package/src/lib/triggers/new-list-item.js.map +0 -1
- package/src/lib/triggers/new-list.d.ts +0 -11
- package/src/lib/triggers/new-list.d.ts.map +0 -1
- package/src/lib/triggers/new-list.js +0 -96
- package/src/lib/triggers/new-list.js.map +0 -1
- package/src/lib/triggers/new-or-updated-file.d.ts +0 -19
- package/src/lib/triggers/new-or-updated-file.d.ts.map +0 -1
- package/src/lib/triggers/new-or-updated-file.js +0 -162
- package/src/lib/triggers/new-or-updated-file.js.map +0 -1
- package/src/lib/triggers/new-or-updated-folder.d.ts +0 -19
- package/src/lib/triggers/new-or-updated-folder.d.ts.map +0 -1
- package/src/lib/triggers/new-or-updated-folder.js +0 -162
- package/src/lib/triggers/new-or-updated-folder.js.map +0 -1
- package/src/lib/triggers/new-or-updated-list.d.ts +0 -11
- package/src/lib/triggers/new-or-updated-list.d.ts.map +0 -1
- package/src/lib/triggers/new-or-updated-list.js +0 -110
- package/src/lib/triggers/new-or-updated-list.js.map +0 -1
- package/src/lib/triggers/updated-list-item.d.ts +0 -15
- package/src/lib/triggers/updated-list-item.d.ts.map +0 -1
- package/src/lib/triggers/updated-list-item.js +0 -120
- package/src/lib/triggers/updated-list-item.js.map +0 -1
package/src/index.d.ts
DELETED
package/src/index.d.ts.map
DELETED
|
@@ -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;;;;;;;EAgKnC,CAAC"}
|
|
@@ -1,166 +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
|
-
audience: 'both',
|
|
23
|
-
aiMetadata: {
|
|
24
|
-
description: 'Copies a file or folder to another folder within the same SharePoint site and drive, optionally renaming the copy; select the root to copy to the drive top level. Use for same-site duplication; for cross-site copies use the across-sites variant. The conflict behavior (fail, replace, or rename) controls name clashes. Not idempotent: each run produces another copy (rename mode) or overwrites the target (replace mode).',
|
|
25
|
-
idempotent: false,
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
siteId: common_1.microsoftSharePointCommon.siteId,
|
|
29
|
-
driveId: common_1.microsoftSharePointCommon.driveId,
|
|
30
|
-
itemId: common_1.microsoftSharePointCommon.itemId,
|
|
31
|
-
destinationFolderId: pieces_framework_1.Property.Dropdown({
|
|
32
|
-
auth: auth_1.microsoftSharePointAuth,
|
|
33
|
-
displayName: 'Destination Folder',
|
|
34
|
-
description: 'The folder to copy the item into. Select "Root" to copy to the top level of the drive.',
|
|
35
|
-
required: true,
|
|
36
|
-
refreshers: ['siteId', 'driveId'],
|
|
37
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, siteId, driveId }) {
|
|
38
|
-
var _b;
|
|
39
|
-
if (!auth || !siteId || !driveId) {
|
|
40
|
-
return {
|
|
41
|
-
disabled: true,
|
|
42
|
-
placeholder: 'Select a site and drive first.',
|
|
43
|
-
options: [],
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
const authValue = auth;
|
|
47
|
-
const cloud = (_b = authValue.props) === null || _b === void 0 ? void 0 : _b['cloud'];
|
|
48
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
49
|
-
authProvider: {
|
|
50
|
-
getAccessToken: () => Promise.resolve(authValue.access_token),
|
|
51
|
-
},
|
|
52
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
53
|
-
});
|
|
54
|
-
const options = [
|
|
55
|
-
{ label: 'Root', value: 'root' }
|
|
56
|
-
];
|
|
57
|
-
let response = yield client
|
|
58
|
-
.api(`/sites/${siteId}/drives/${driveId}/root/children?$filter=folder ne null&$select=id,name`)
|
|
59
|
-
.get();
|
|
60
|
-
while (response.value.length > 0) {
|
|
61
|
-
for (const item of response.value) {
|
|
62
|
-
options.push({
|
|
63
|
-
label: item.name,
|
|
64
|
-
value: item.id,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if (response['@odata.nextLink']) {
|
|
68
|
-
response = yield client.api(response['@odata.nextLink']).get();
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return { disabled: false, options };
|
|
75
|
-
}),
|
|
76
|
-
}),
|
|
77
|
-
newName: pieces_framework_1.Property.ShortText({
|
|
78
|
-
displayName: 'New Name (Optional)',
|
|
79
|
-
description: 'A new name for the copied item. If not provided, the original name is used.',
|
|
80
|
-
required: false,
|
|
81
|
-
}),
|
|
82
|
-
conflictBehavior: pieces_framework_1.Property.StaticDropdown({
|
|
83
|
-
displayName: 'Conflict Behavior',
|
|
84
|
-
description: 'Action to take if a file with the same name already exists in the destination.',
|
|
85
|
-
required: true,
|
|
86
|
-
options: {
|
|
87
|
-
options: [
|
|
88
|
-
{ label: 'Fail on conflict', value: 'fail' },
|
|
89
|
-
{ label: 'Overwrite existing file', value: 'replace' },
|
|
90
|
-
{ label: 'Rename with a number', value: 'rename' },
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
defaultValue: 'fail',
|
|
94
|
-
}),
|
|
95
|
-
},
|
|
96
|
-
run(context) {
|
|
97
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
var _a, _b, _c;
|
|
99
|
-
const { siteId, driveId, itemId, destinationFolderId, newName, conflictBehavior } = context.propsValue;
|
|
100
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
101
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
102
|
-
authProvider: {
|
|
103
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
104
|
-
},
|
|
105
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
106
|
-
});
|
|
107
|
-
const effectiveDestinationId = destinationFolderId === 'root'
|
|
108
|
-
? (yield client.api(`/drives/${driveId}/root`).get()).id
|
|
109
|
-
: destinationFolderId;
|
|
110
|
-
const body = {
|
|
111
|
-
parentReference: {
|
|
112
|
-
id: effectiveDestinationId,
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
if (newName) {
|
|
116
|
-
body.name = newName;
|
|
117
|
-
}
|
|
118
|
-
let initialResponse;
|
|
119
|
-
try {
|
|
120
|
-
initialResponse = yield client
|
|
121
|
-
.api(`/drives/${driveId}/items/${itemId}/copy`)
|
|
122
|
-
.responseType(microsoft_graph_client_1.ResponseType.RAW)
|
|
123
|
-
.query({ '@microsoft.graph.conflictBehavior': conflictBehavior })
|
|
124
|
-
.post(body);
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
if (error.statusCode === 400) {
|
|
128
|
-
throw new Error(`Invalid request: ${error.message || 'Check your input parameters'}`);
|
|
129
|
-
}
|
|
130
|
-
if (error.statusCode === 403) {
|
|
131
|
-
throw new Error('Insufficient permissions to copy this item. Requires Files.ReadWrite or higher.');
|
|
132
|
-
}
|
|
133
|
-
if (error.statusCode === 404) {
|
|
134
|
-
throw new Error('Source item not found. Please verify the site, drive, and item IDs.');
|
|
135
|
-
}
|
|
136
|
-
throw new Error(`Failed to initiate copy operation: ${error.message || 'Unknown error'}`);
|
|
137
|
-
}
|
|
138
|
-
const monitorUrl = initialResponse.headers.get('Location');
|
|
139
|
-
if (!monitorUrl) {
|
|
140
|
-
throw new Error('Could not get monitor URL from copy operation response.');
|
|
141
|
-
}
|
|
142
|
-
let attempts = polling_timeout_secs * 1000 / polling_delay_ms;
|
|
143
|
-
while (attempts > 0) {
|
|
144
|
-
const monitorResponse = yield client.api(monitorUrl).get();
|
|
145
|
-
if (monitorResponse.status === 'completed') {
|
|
146
|
-
return {
|
|
147
|
-
success: true,
|
|
148
|
-
status: 'completed',
|
|
149
|
-
resourceId: monitorResponse.resourceId,
|
|
150
|
-
resourceLocation: monitorResponse.resourceLocation,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
if (monitorResponse.status === 'failed') {
|
|
154
|
-
const errorDetails = ((_b = monitorResponse.error) === null || _b === void 0 ? void 0 : _b.details)
|
|
155
|
-
? monitorResponse.error.details.map((d) => d.message || d.code).join(', ')
|
|
156
|
-
: ((_c = monitorResponse.error) === null || _c === void 0 ? void 0 : _c.message) || 'Unknown error';
|
|
157
|
-
throw new Error(`Copy operation failed: ${errorDetails}`);
|
|
158
|
-
}
|
|
159
|
-
yield delay(polling_delay_ms);
|
|
160
|
-
attempts--;
|
|
161
|
-
}
|
|
162
|
-
throw new Error('Copy operation timed out after 120 seconds.');
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
//# 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,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,qaAAqa;QAClb,UAAU,EAAE,KAAK;KAClB;IACD,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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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;;;;;;;;;EA2HzB,CAAC"}
|
|
@@ -1,126 +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
|
-
audience: 'both',
|
|
23
|
-
aiMetadata: {
|
|
24
|
-
description: 'Copies a file or folder from one SharePoint site/drive to a destination site, drive, and folder within the same tenant, optionally renaming the copy. Use to duplicate content across sites; for same-site copies use the within-site variant. The conflict behavior (fail, replace, or rename) controls what happens on a name clash. Not idempotent: each run produces another copy (rename mode) or overwrites the target (replace mode).',
|
|
25
|
-
idempotent: false,
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
siteId: common_1.microsoftSharePointCommon.siteId,
|
|
29
|
-
driveId: common_1.microsoftSharePointCommon.driveId,
|
|
30
|
-
itemId: common_1.microsoftSharePointCommon.itemId,
|
|
31
|
-
destination_site_id: common_1.microsoftSharePointCommon.siteId,
|
|
32
|
-
destination_drive_id: common_1.microsoftSharePointCommon.createDriveDropdown({
|
|
33
|
-
displayName: 'Destination Drive',
|
|
34
|
-
refreshers: ['destination_site_id'],
|
|
35
|
-
}),
|
|
36
|
-
destination_folder_id: common_1.microsoftSharePointCommon.destinationFolderId,
|
|
37
|
-
new_name: pieces_framework_1.Property.ShortText({
|
|
38
|
-
displayName: 'New Name (Optional)',
|
|
39
|
-
description: 'A new name for the copied item. If not provided, the original name is used.',
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
conflict_behavior: pieces_framework_1.Property.StaticDropdown({
|
|
43
|
-
displayName: 'Conflict Behavior',
|
|
44
|
-
description: 'Action to take if a file with the same name already exists.',
|
|
45
|
-
required: true,
|
|
46
|
-
options: {
|
|
47
|
-
options: [
|
|
48
|
-
{ label: 'Fail on conflict', value: 'fail' },
|
|
49
|
-
{ label: 'Overwrite existing file', value: 'replace' },
|
|
50
|
-
{ label: 'Rename with a number', value: 'rename' },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
defaultValue: 'fail',
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
run(context) {
|
|
57
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
var _a, _b, _c;
|
|
59
|
-
const { siteId, driveId, itemId, destination_drive_id, destination_folder_id, new_name, conflict_behavior, } = context.propsValue;
|
|
60
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
61
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
62
|
-
authProvider: {
|
|
63
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
64
|
-
},
|
|
65
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
66
|
-
});
|
|
67
|
-
const body = {
|
|
68
|
-
parentReference: {
|
|
69
|
-
driveId: destination_drive_id,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
if (destination_folder_id) {
|
|
73
|
-
body.parentReference.id = destination_folder_id;
|
|
74
|
-
}
|
|
75
|
-
if (new_name) {
|
|
76
|
-
body.name = new_name;
|
|
77
|
-
}
|
|
78
|
-
let initialResponse;
|
|
79
|
-
try {
|
|
80
|
-
initialResponse = yield client
|
|
81
|
-
.api(`/drives/${driveId}/items/${itemId}/copy`)
|
|
82
|
-
.responseType(microsoft_graph_client_1.ResponseType.RAW)
|
|
83
|
-
.query({ '@microsoft.graph.conflictBehavior': conflict_behavior })
|
|
84
|
-
.post(body);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
if (error.statusCode === 400) {
|
|
88
|
-
throw new Error(`Invalid request: ${error.message || 'Check your input parameters'}`);
|
|
89
|
-
}
|
|
90
|
-
if (error.statusCode === 403) {
|
|
91
|
-
throw new Error('Insufficient permissions to copy this item. Requires Files.ReadWrite or higher.');
|
|
92
|
-
}
|
|
93
|
-
if (error.statusCode === 404) {
|
|
94
|
-
throw new Error('Source item not found. Please verify the site, drive, and item IDs.');
|
|
95
|
-
}
|
|
96
|
-
throw new Error(`Failed to initiate copy operation: ${error.message || 'Unknown error'}`);
|
|
97
|
-
}
|
|
98
|
-
const monitorUrl = initialResponse.headers.get('Location');
|
|
99
|
-
if (!monitorUrl) {
|
|
100
|
-
throw new Error('Could not get monitor URL from copy operation response.');
|
|
101
|
-
}
|
|
102
|
-
let attempts = polling_timeout_secs * 1000 / polling_delay_ms;
|
|
103
|
-
while (attempts > 0) {
|
|
104
|
-
const monitorResponse = yield client.api(monitorUrl).get();
|
|
105
|
-
if (monitorResponse.status === 'completed') {
|
|
106
|
-
return {
|
|
107
|
-
success: true,
|
|
108
|
-
status: 'completed',
|
|
109
|
-
resourceId: monitorResponse.resourceId,
|
|
110
|
-
resourceLocation: monitorResponse.resourceLocation,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
if (monitorResponse.status === 'failed') {
|
|
114
|
-
const errorDetails = ((_b = monitorResponse.error) === null || _b === void 0 ? void 0 : _b.details)
|
|
115
|
-
? monitorResponse.error.details.map((d) => d.message || d.code).join(', ')
|
|
116
|
-
: ((_c = monitorResponse.error) === null || _c === void 0 ? void 0 : _c.message) || 'Unknown error';
|
|
117
|
-
throw new Error(`Copy operation failed: ${errorDetails}`);
|
|
118
|
-
}
|
|
119
|
-
yield delay(polling_delay_ms);
|
|
120
|
-
attempts--;
|
|
121
|
-
}
|
|
122
|
-
throw new Error('Copy operation timed out after 120 seconds.');
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
//# 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,qEAAwE;AACxE,+DAA4D;AAC5D,sCAAsD;AACtD,8EAAyE;AAEzE,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,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,8BAAuB;IAC7B,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,oCAAoC;IACjD,WAAW,EACT,+FAA+F;IACjG,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE;QACV,WAAW,EAAE,8aAA8a;QAC3b,UAAU,EAAE,KAAK;KAClB;IACD,KAAK,EAAE;QAEL,MAAM,EAAE,kCAAyB,CAAC,MAAM;QACxC,OAAO,EAAE,kCAAyB,CAAC,OAAO;QAC1C,MAAM,EAAE,kCAAyB,CAAC,MAAM;QAExC,mBAAmB,EAAE,kCAAyB,CAAC,MAAM;QACrD,oBAAoB,EAAE,kCAAyB,CAAC,mBAAmB,CAAC;YAClE,WAAW,EAAE,mBAAmB;YAChC,UAAU,EAAE,CAA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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,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;;;;;EA0C7B,CAAC"}
|
|
@@ -1,53 +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
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: {
|
|
17
|
-
description: 'Creates a folder at a given path inside a SharePoint document library (drive), creating it relative to a parent folder path or the drive root. Use to provision a destination folder before uploading or moving files. Requires the target site and drive; the folder is keyed on its path, so re-running with the same path leaves the existing folder in place rather than producing a duplicate.',
|
|
18
|
-
idempotent: true,
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
siteId: common_1.microsoftSharePointCommon.siteId,
|
|
22
|
-
driveId: common_1.microsoftSharePointCommon.driveId,
|
|
23
|
-
parentFolder: pieces_framework_1.Property.ShortText({
|
|
24
|
-
displayName: 'Parent Folder',
|
|
25
|
-
description: `Parent folder,like "/demo/" or "/docs/assignment/".Leave it default if you want to create folder at the root (**/**) level.`,
|
|
26
|
-
required: true,
|
|
27
|
-
defaultValue: '/',
|
|
28
|
-
}),
|
|
29
|
-
folderName: pieces_framework_1.Property.ShortText({
|
|
30
|
-
displayName: 'Folder Name',
|
|
31
|
-
required: true,
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
34
|
-
run(context) {
|
|
35
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
var _a;
|
|
37
|
-
const { driveId, parentFolder, folderName } = context.propsValue;
|
|
38
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
39
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
40
|
-
authProvider: {
|
|
41
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
42
|
-
},
|
|
43
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
44
|
-
});
|
|
45
|
-
const folderPath = parentFolder + folderName;
|
|
46
|
-
// https://stackoverflow.com/questions/66631136/creating-nested-folder-in-sharepoint-with-graph-api-fails
|
|
47
|
-
return yield client.api(`/drives/${driveId}/root:${folderPath}`).patch({
|
|
48
|
-
folder: {},
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
//# 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,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AA;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;;;;EAyC/B,CAAC"}
|
|
@@ -1,52 +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
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: {
|
|
17
|
-
description: 'Adds a new item (row) to a SharePoint list on a given site, setting the list column field values you provide. Use to record a new entry in an existing list. Not idempotent: each call appends another item, so repeating it creates duplicates.',
|
|
18
|
-
idempotent: false,
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
siteId: common_1.microsoftSharePointCommon.siteId,
|
|
22
|
-
listId: common_1.microsoftSharePointCommon.listId,
|
|
23
|
-
listColumns: common_1.microsoftSharePointCommon.listColumns,
|
|
24
|
-
},
|
|
25
|
-
run(context) {
|
|
26
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
var _a;
|
|
28
|
-
const { siteId, listId, listColumns } = context.propsValue;
|
|
29
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
30
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
31
|
-
authProvider: {
|
|
32
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
33
|
-
},
|
|
34
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
35
|
-
});
|
|
36
|
-
const fieldWithArrayValues = {};
|
|
37
|
-
Object.entries(listColumns).forEach(([key, value]) => {
|
|
38
|
-
// https://learn.microsoft.com/en-us/answers/questions/1517379/upload-multiple-choice-fields-item-in-sharepoint-w
|
|
39
|
-
if (Array.isArray(value)) {
|
|
40
|
-
fieldWithArrayValues[`${key}@odata.type`] = 'Collection(Edm.String)';
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
const itemInput = {
|
|
44
|
-
fields: Object.assign(Object.assign({}, listColumns), fieldWithArrayValues),
|
|
45
|
-
};
|
|
46
|
-
return yield client
|
|
47
|
-
.api(`/sites/${siteId}/lists/${listId}/items`)
|
|
48
|
-
.post(itemInput);
|
|
49
|
-
});
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=create-list-item.js.map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,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;;;;EAuC3B,CAAC"}
|
|
@@ -1,50 +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
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: {
|
|
17
|
-
description: 'Creates a new SharePoint list (with a display name and description) on a given site. Use when an agent needs a fresh list to hold structured items. Not idempotent: each call creates another list even if one with the same name already exists.',
|
|
18
|
-
idempotent: false,
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
siteId: common_1.microsoftSharePointCommon.siteId,
|
|
22
|
-
displayName: pieces_framework_1.Property.ShortText({
|
|
23
|
-
displayName: 'List Name',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
description: pieces_framework_1.Property.ShortText({
|
|
27
|
-
displayName: 'List Description',
|
|
28
|
-
required: true,
|
|
29
|
-
}),
|
|
30
|
-
},
|
|
31
|
-
run(context) {
|
|
32
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _a;
|
|
34
|
-
const { siteId, displayName, description } = context.propsValue;
|
|
35
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
36
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
37
|
-
authProvider: {
|
|
38
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
39
|
-
},
|
|
40
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
41
|
-
});
|
|
42
|
-
const listInput = {
|
|
43
|
-
displayName,
|
|
44
|
-
description,
|
|
45
|
-
};
|
|
46
|
-
return yield client.api(`/sites/${siteId}/lists`).post(listInput);
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=create-list.js.map
|
|
@@ -1 +0,0 @@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C,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;;;;EA8B/B,CAAC"}
|
|
@@ -1,42 +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
|
-
audience: 'both',
|
|
16
|
-
aiMetadata: {
|
|
17
|
-
description: 'Permanently removes an item from a SharePoint list, identified by its list item ID on a given site. Use to clean up or retract a specific row. Destructive but idempotent: once the item is gone, repeating the call with the same ID leaves the list unchanged.',
|
|
18
|
-
idempotent: true,
|
|
19
|
-
},
|
|
20
|
-
props: {
|
|
21
|
-
siteId: common_1.microsoftSharePointCommon.siteId,
|
|
22
|
-
listId: common_1.microsoftSharePointCommon.listId,
|
|
23
|
-
listItemId: common_1.microsoftSharePointCommon.listItemId,
|
|
24
|
-
},
|
|
25
|
-
run(context) {
|
|
26
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
var _a;
|
|
28
|
-
const { siteId, listId, listItemId } = context.propsValue;
|
|
29
|
-
const cloud = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['cloud'];
|
|
30
|
-
const client = microsoft_graph_client_1.Client.initWithMiddleware({
|
|
31
|
-
authProvider: {
|
|
32
|
-
getAccessToken: () => Promise.resolve(context.auth.access_token),
|
|
33
|
-
},
|
|
34
|
-
baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
|
|
35
|
-
});
|
|
36
|
-
return yield client
|
|
37
|
-
.api(`/sites/${siteId}/lists/${listId}/items/${listItemId}`)
|
|
38
|
-
.delete();
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=delete-list-item.js.map
|