@activepieces/piece-microsoft-sharepoint 0.3.4 → 0.3.6

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 -15
  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 -166
  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 -126
  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 -53
  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 -52
  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 -50
  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 -42
  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 -145
  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 -61
  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 -120
  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 -47
  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 -166
  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 -61
  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 -49
  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 -51
  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 -57
  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 -170
  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 -166
  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 -102
  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 -96
  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 -162
  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 -162
  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 -110
  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 -120
  109. package/src/lib/triggers/updated-list-item.js.map +0 -1
@@ -1,19 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newOrUpdatedFileTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
3
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- folderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
7
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
8
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
9
- folderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
10
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
11
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
12
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
13
- folderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
14
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
15
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
16
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
17
- folderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
18
- }>;
19
- //# sourceMappingURL=new-or-updated-file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-or-updated-file.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-or-updated-file.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,eAAe,EAIf,MAAM,gCAAgC,CAAC;AAkFxC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;EAwFlC,CAAC"}
@@ -1,162 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newOrUpdatedFileTrigger = 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 pieces_common_1 = require("@activepieces/pieces-common");
8
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
9
- const common_1 = require("../common");
10
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
11
- const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
12
- const polling = {
13
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
14
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
15
- var _b;
16
- const { siteId, driveId, folderId } = propsValue;
17
- const isTestMode = lastFetchEpochMS === 0;
18
- const cloud = (_b = auth.props) === null || _b === void 0 ? void 0 : _b['cloud'];
19
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
20
- authProvider: {
21
- getAccessToken: () => Promise.resolve(auth.access_token),
22
- },
23
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
24
- });
25
- const files = [];
26
- const endpoint = folderId !== 'root'
27
- ? `/sites/${siteId}/drive/items/${folderId}/children`
28
- : `/sites/${siteId}/drives/${driveId}/items/root/children`;
29
- let response = yield client
30
- .api(endpoint)
31
- .orderby('lastModifiedDateTime desc')
32
- .get();
33
- let stop = false;
34
- while (!stop && response.value.length > 0) {
35
- for (const item of response.value) {
36
- if (!item.file)
37
- continue;
38
- const modifiedMs = (0, dayjs_1.default)(item.lastModifiedDateTime).valueOf();
39
- if (isTestMode) {
40
- files.push(item);
41
- if (files.length >= 10) {
42
- stop = true;
43
- }
44
- continue;
45
- }
46
- if (modifiedMs < lastFetchEpochMS) {
47
- stop = true;
48
- break;
49
- }
50
- files.push(item);
51
- }
52
- if (stop || !response['@odata.nextLink'])
53
- break;
54
- response = yield client.api(response['@odata.nextLink']).get();
55
- }
56
- files.sort((a, b) => {
57
- const aDate = (0, dayjs_1.default)(a.lastModifiedDateTime);
58
- const bDate = (0, dayjs_1.default)(b.lastModifiedDateTime);
59
- return bDate.diff(aDate);
60
- });
61
- return files.map((file) => ({
62
- epochMilliSeconds: (0, dayjs_1.default)(file.lastModifiedDateTime).valueOf(),
63
- data: file,
64
- }));
65
- }),
66
- };
67
- exports.newOrUpdatedFileTrigger = (0, pieces_framework_1.createTrigger)({
68
- auth: auth_1.microsoftSharePointAuth,
69
- name: 'new_or_updated_file',
70
- displayName: 'New or Updated File',
71
- description: 'Triggers when a file is created or updated in a given folder.',
72
- aiMetadata: {
73
- description: 'Fires when a file is created or modified directly inside one monitored folder of a SharePoint drive, based on its last-modified time (polling). Each event represents a file that is new or whose contents/metadata changed; choose this over New File in Folder when edits to existing files should also trigger.',
74
- },
75
- props: {
76
- siteId: common_1.microsoftSharePointCommon.siteId,
77
- driveId: common_1.microsoftSharePointCommon.driveId,
78
- folderId: pieces_framework_1.Property.Dropdown({
79
- auth: auth_1.microsoftSharePointAuth,
80
- displayName: 'Folder to Monitor',
81
- description: 'The folder to watch for new or updated files. Select "Root Folder" for the top-level folder of the drive.',
82
- required: true,
83
- refreshers: ['siteId', 'driveId'],
84
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, siteId, driveId }) {
85
- var _b;
86
- if (!auth || !siteId || !driveId) {
87
- return {
88
- disabled: true,
89
- placeholder: 'Select a site and drive first.',
90
- options: [],
91
- };
92
- }
93
- const authValue = auth;
94
- const cloud = (_b = authValue.props) === null || _b === void 0 ? void 0 : _b['cloud'];
95
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
96
- authProvider: {
97
- getAccessToken: () => Promise.resolve(authValue.access_token),
98
- },
99
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
100
- });
101
- const options = [{ label: 'Root Folder', value: 'root' }];
102
- let response = yield client
103
- .api(`/sites/${siteId}/drives/${driveId}/items/root/children?$filter=folder ne null&$select=id,name`)
104
- .get();
105
- while (response.value.length > 0) {
106
- for (const item of response.value) {
107
- options.push({ label: item.name, value: item.id });
108
- }
109
- if (response['@odata.nextLink']) {
110
- response = yield client.api(response['@odata.nextLink']).get();
111
- }
112
- else {
113
- break;
114
- }
115
- }
116
- return { disabled: false, options };
117
- }),
118
- }),
119
- },
120
- type: pieces_framework_1.TriggerStrategy.POLLING,
121
- sampleData: {
122
- id: '01DRYVE_ID_GOES_HERE',
123
- name: 'Updated-Financials.xlsx',
124
- webUrl: 'https://contoso.sharepoint.com/Shared%20Documents/Updated-Financials.xlsx',
125
- size: 65432,
126
- createdDateTime: '2025-09-26T10:00:00Z',
127
- lastModifiedDateTime: '2025-09-26T14:34:00Z',
128
- file: {
129
- mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
130
- },
131
- parentReference: { id: 'PARENT_FOLDER_ID_HERE' },
132
- },
133
- onEnable(context) {
134
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
135
- yield pieces_common_1.pollingHelper.onEnable(polling, {
136
- auth: context.auth,
137
- store: context.store,
138
- propsValue: context.propsValue,
139
- });
140
- });
141
- },
142
- onDisable(context) {
143
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
144
- yield pieces_common_1.pollingHelper.onDisable(polling, {
145
- auth: context.auth,
146
- store: context.store,
147
- propsValue: context.propsValue,
148
- });
149
- });
150
- },
151
- test(context) {
152
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
153
- return yield pieces_common_1.pollingHelper.test(polling, context);
154
- });
155
- },
156
- run(context) {
157
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
158
- return yield pieces_common_1.pollingHelper.poll(polling, context);
159
- });
160
- },
161
- });
162
- //# sourceMappingURL=new-or-updated-file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-or-updated-file.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-or-updated-file.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAMwC;AACxC,+DAAqF;AACrF,+DAA4D;AAC5D,sCAAsD;AACtD,8EAA2E;AAE3E,0DAA0B;AAQ1B,MAAM,OAAO,GAAsF;IAClG,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;;QACnD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,CA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AAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -1,19 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newOrUpdatedFolderTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
3
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- parentFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
7
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
8
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
9
- parentFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
10
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
11
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
12
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
13
- parentFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
14
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
15
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
16
- driveId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
17
- parentFolderId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
18
- }>;
19
- //# sourceMappingURL=new-or-updated-folder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-or-updated-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-or-updated-folder.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,eAAe,EAIf,MAAM,gCAAgC,CAAC;AAkFxC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;EAwFpC,CAAC"}
@@ -1,162 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newOrUpdatedFolderTrigger = 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 pieces_common_1 = require("@activepieces/pieces-common");
8
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
9
- const common_1 = require("../common");
10
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
11
- const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
12
- const polling = {
13
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
14
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
15
- var _b;
16
- const { siteId, driveId, parentFolderId } = propsValue;
17
- const isTestMode = lastFetchEpochMS === 0;
18
- const cloud = (_b = auth.props) === null || _b === void 0 ? void 0 : _b['cloud'];
19
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
20
- authProvider: {
21
- getAccessToken: () => Promise.resolve(auth.access_token),
22
- },
23
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
24
- });
25
- const folders = [];
26
- const endpoint = parentFolderId !== 'root'
27
- ? `/sites/${siteId}/drive/items/${parentFolderId}/children`
28
- : `/sites/${siteId}/drives/${driveId}/items/root/children`;
29
- let response = yield client
30
- .api(endpoint)
31
- .orderby('lastModifiedDateTime desc')
32
- .get();
33
- let stop = false;
34
- while (!stop && response.value.length > 0) {
35
- for (const item of response.value) {
36
- if (!item.folder)
37
- continue;
38
- const modifiedMs = (0, dayjs_1.default)(item.lastModifiedDateTime).valueOf();
39
- if (isTestMode) {
40
- folders.push(item);
41
- if (folders.length >= 10) {
42
- stop = true;
43
- }
44
- continue;
45
- }
46
- if (modifiedMs < lastFetchEpochMS) {
47
- stop = true;
48
- break;
49
- }
50
- folders.push(item);
51
- }
52
- if (stop || !response['@odata.nextLink'])
53
- break;
54
- response = yield client.api(response['@odata.nextLink']).get();
55
- }
56
- folders.sort((a, b) => {
57
- const aDate = (0, dayjs_1.default)(a.lastModifiedDateTime);
58
- const bDate = (0, dayjs_1.default)(b.lastModifiedDateTime);
59
- return bDate.diff(aDate);
60
- });
61
- return folders.map((folder) => ({
62
- epochMilliSeconds: (0, dayjs_1.default)(folder.lastModifiedDateTime).valueOf(),
63
- data: folder,
64
- }));
65
- }),
66
- };
67
- exports.newOrUpdatedFolderTrigger = (0, pieces_framework_1.createTrigger)({
68
- auth: auth_1.microsoftSharePointAuth,
69
- name: 'new_or_updated_folder',
70
- displayName: 'New or Updated Folder',
71
- description: 'Triggers when a folder is created or updated (e.g., name change).',
72
- aiMetadata: {
73
- description: 'Fires when a subfolder is created or modified (such as a rename) directly inside one monitored parent folder of a SharePoint drive, based on its last-modified time (polling). Each event represents one new or changed folder.',
74
- },
75
- props: {
76
- siteId: common_1.microsoftSharePointCommon.siteId,
77
- driveId: common_1.microsoftSharePointCommon.driveId,
78
- parentFolderId: pieces_framework_1.Property.Dropdown({
79
- auth: auth_1.microsoftSharePointAuth,
80
- displayName: 'Parent Folder to Monitor',
81
- description: 'The folder to watch for new or updated subfolders. Select "Root Folder" to monitor the top-level of the drive.',
82
- required: true,
83
- refreshers: ['siteId', 'driveId'],
84
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, siteId, driveId }) {
85
- var _b;
86
- if (!auth || !siteId || !driveId) {
87
- return {
88
- disabled: true,
89
- placeholder: 'Select a site and drive first.',
90
- options: [],
91
- };
92
- }
93
- const authValue = auth;
94
- const cloud = (_b = authValue.props) === null || _b === void 0 ? void 0 : _b['cloud'];
95
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
96
- authProvider: {
97
- getAccessToken: () => Promise.resolve(authValue.access_token),
98
- },
99
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
100
- });
101
- const options = [{ label: 'Root Folder', value: 'root' }];
102
- let response = yield client
103
- .api(`/sites/${siteId}/drives/${driveId}/items/root/children?$filter=folder ne null&$select=id,name`)
104
- .get();
105
- while (response.value.length > 0) {
106
- for (const item of response.value) {
107
- options.push({ label: item.name, value: item.id });
108
- }
109
- if (response['@odata.nextLink']) {
110
- response = yield client.api(response['@odata.nextLink']).get();
111
- }
112
- else {
113
- break;
114
- }
115
- }
116
- return { disabled: false, options };
117
- }),
118
- }),
119
- },
120
- type: pieces_framework_1.TriggerStrategy.POLLING,
121
- sampleData: {
122
- id: '01DRYVE_FOLDER_ID_GOES_HERE',
123
- name: 'Project Alpha',
124
- webUrl: 'https://contoso.sharepoint.com/Shared%20Documents/Project%20Alpha',
125
- size: 0,
126
- createdDateTime: '2025-09-26T14:50:00Z',
127
- lastModifiedDateTime: '2025-09-26T14:50:00Z',
128
- folder: {
129
- childCount: 0,
130
- },
131
- parentReference: { id: 'PARENT_FOLDER_ID_HERE' },
132
- },
133
- onEnable(context) {
134
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
135
- yield pieces_common_1.pollingHelper.onEnable(polling, {
136
- auth: context.auth,
137
- store: context.store,
138
- propsValue: context.propsValue,
139
- });
140
- });
141
- },
142
- onDisable(context) {
143
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
144
- yield pieces_common_1.pollingHelper.onDisable(polling, {
145
- auth: context.auth,
146
- store: context.store,
147
- propsValue: context.propsValue,
148
- });
149
- });
150
- },
151
- test(context) {
152
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
153
- return yield pieces_common_1.pollingHelper.test(polling, context);
154
- });
155
- },
156
- run(context) {
157
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
158
- return yield pieces_common_1.pollingHelper.poll(polling, context);
159
- });
160
- },
161
- });
162
- //# sourceMappingURL=new-or-updated-folder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-or-updated-folder.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-or-updated-folder.ts"],"names":[],"mappings":";;;;AAAA,kCAAkD;AAClD,qEAMwC;AACxC,+DAAqF;AACrF,+DAA4D;AAC5D,sCAAsD;AACtD,8EAA2E;AAE3E,0DAA0B;AAQ1B,MAAM,OAAO,GAAsF;IAClG,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;;QACnD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC;QACvD,MAAM,UAAU,GAAG,gBAAgB,KAAK,CAAC,CAAC;QA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nD,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newOrUpdatedListTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
3
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
5
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
7
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
9
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
10
- }>;
11
- //# sourceMappingURL=new-or-updated-list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-or-updated-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-or-updated-list.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,eAAe,EAEf,MAAM,gCAAgC,CAAC;AAwExC,eAAO,MAAM,uBAAuB;;;;;;;;EAyClC,CAAC"}
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newOrUpdatedListTrigger = 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 pieces_common_1 = require("@activepieces/pieces-common");
8
- const microsoft_cloud_1 = require("../common/microsoft-cloud");
9
- const common_1 = require("../common");
10
- const microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
11
- const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
12
- const polling = {
13
- strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
14
- items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
15
- var _b;
16
- const { siteId } = propsValue;
17
- const isTestMode = lastFetchEpochMS === 0;
18
- const cloud = (_b = auth.props) === null || _b === void 0 ? void 0 : _b['cloud'];
19
- const client = microsoft_graph_client_1.Client.initWithMiddleware({
20
- authProvider: {
21
- getAccessToken: () => Promise.resolve(auth.access_token),
22
- },
23
- baseUrl: (0, microsoft_cloud_1.getGraphBaseUrl)(cloud),
24
- });
25
- const lists = [];
26
- let response = yield client
27
- .api(`/sites/${siteId}/lists`)
28
- .get();
29
- let stop = false;
30
- while (!stop && response.value.length > 0) {
31
- for (const item of response.value) {
32
- const modifiedMs = (0, dayjs_1.default)(item.lastModifiedDateTime).valueOf();
33
- if (isTestMode) {
34
- lists.push(item);
35
- if (lists.length >= 10) {
36
- stop = true;
37
- }
38
- continue;
39
- }
40
- if (modifiedMs < lastFetchEpochMS) {
41
- stop = true;
42
- break;
43
- }
44
- lists.push(item);
45
- }
46
- if (stop || !response['@odata.nextLink'])
47
- break;
48
- response = yield client.api(response['@odata.nextLink']).get();
49
- }
50
- lists.sort((a, b) => {
51
- const aDate = (0, dayjs_1.default)(a.lastModifiedDateTime);
52
- const bDate = (0, dayjs_1.default)(b.lastModifiedDateTime);
53
- return bDate.diff(aDate);
54
- });
55
- return lists.map((list) => ({
56
- epochMilliSeconds: (0, dayjs_1.default)(list.lastModifiedDateTime).valueOf(),
57
- data: list,
58
- }));
59
- }),
60
- };
61
- exports.newOrUpdatedListTrigger = (0, pieces_framework_1.createTrigger)({
62
- auth: auth_1.microsoftSharePointAuth,
63
- name: 'new_or_updated_list',
64
- displayName: 'New or Updated List',
65
- description: 'Triggers when a list is created or updated in a site.',
66
- aiMetadata: {
67
- description: 'Fires when a list on one specific SharePoint site is created or modified, based on its last-modified time (polling). Each event represents one new or changed list; choose this over New List when edits to existing lists should also trigger.',
68
- },
69
- props: {
70
- siteId: common_1.microsoftSharePointCommon.siteId,
71
- },
72
- type: pieces_framework_1.TriggerStrategy.POLLING,
73
- sampleData: {
74
- id: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
75
- displayName: 'Projects Tracker',
76
- description: 'Updated list for tracking all ongoing projects.',
77
- createdDateTime: '2025-09-26T11:00:00Z',
78
- lastModifiedDateTime: '2025-09-26T14:55:00Z',
79
- webUrl: 'https://contoso.sharepoint.com/sites/MySite/Lists/Projects%20Tracker',
80
- },
81
- onEnable(context) {
82
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
83
- yield pieces_common_1.pollingHelper.onEnable(polling, {
84
- auth: context.auth,
85
- store: context.store,
86
- propsValue: context.propsValue,
87
- });
88
- });
89
- },
90
- onDisable(context) {
91
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
92
- yield pieces_common_1.pollingHelper.onDisable(polling, {
93
- auth: context.auth,
94
- store: context.store,
95
- propsValue: context.propsValue,
96
- });
97
- });
98
- },
99
- test(context) {
100
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
101
- return yield pieces_common_1.pollingHelper.test(polling, context);
102
- });
103
- },
104
- run(context) {
105
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
106
- return yield pieces_common_1.pollingHelper.poll(polling, context);
107
- });
108
- },
109
- });
110
- //# sourceMappingURL=new-or-updated-list.js.map
@@ -1 +0,0 @@
1
- {"version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K,EAAE;QACN,MAAM,EAAE,kCAAyB,CAAC,MAAM;KACxC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAE7B,UAAU,EAAE;QACX,EAAE,EAAE,sCAAsC;QAC1C,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,iDAAiD;QAC9D,eAAe,EAAE,sBAAsB;QACvC,oBAAoB,EAAE,sBAAsB;QAC5C,MAAM,EAAE,sEAAsE;KAC9E;IACK,QAAQ,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC9B,CAAC,CAAC;QACJ,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACtB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACtC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC9B,CAAC,CAAC;QACJ,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YACjB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const updatedListItemTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
3
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
4
- listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
5
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
6
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
7
- listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
9
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
10
- listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
11
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
12
- siteId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
13
- listId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>>;
14
- }>;
15
- //# sourceMappingURL=updated-list-item.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updated-list-item.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/updated-list-item.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAOxC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EA6GjC,CAAC"}