n8n-nodes-onedrive-business 1.1.0 → 1.1.2

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.
@@ -239,18 +239,26 @@ class OneDriveBusinessTrigger {
239
239
  await stateStore.initialize(tenantId, driveId, driveLocation.userId, driveLocation.siteId);
240
240
  // Create webhook handler
241
241
  const webhookHandler = new WebhookHandler_1.WebhookHandler(graphClient, stateStore, subscriptionResource);
242
- // Create subscription
243
- const subscription = await webhookHandler.createOrRenewSubscription(webhookUrl);
244
- // Store subscription ID in workflow static data
245
- const webhookData = this.getWorkflowStaticData('node');
246
- webhookData.subscriptionId = subscription.id;
247
- // Store instances for webhook handling
242
+ // Store instances for webhook handling BEFORE creating subscription
243
+ // This is critical because Microsoft verifies the webhook during creation
248
244
  OneDriveBusinessTrigger.instances.set(nodeId, {
249
245
  stateStore,
250
246
  webhookHandler,
251
247
  });
252
- console.log(`OneDrive Business Trigger activated for node ${nodeId}`);
253
- return true;
248
+ try {
249
+ // Create subscription
250
+ const subscription = await webhookHandler.createOrRenewSubscription(webhookUrl);
251
+ // Store subscription ID in workflow static data
252
+ const webhookData = this.getWorkflowStaticData('node');
253
+ webhookData.subscriptionId = subscription.id;
254
+ console.log(`OneDrive Business Trigger activated for node ${nodeId}`);
255
+ return true;
256
+ }
257
+ catch (error) {
258
+ // Cleanup if subscription fails
259
+ OneDriveBusinessTrigger.instances.delete(nodeId);
260
+ throw error;
261
+ }
254
262
  },
255
263
  async delete() {
256
264
  const webhookData = this.getWorkflowStaticData('node');
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path d="M41.8 17H41c-7.3 0-13.4 5.3-14.7 12.3-.6-.1-1.2-.2-1.8-.2-6.5 0-11.9 4.6-13.2 10.8C5 40.8 0 46.1 0 52.5c0 6.4 5.2 11.5 11.5 11.5h31.9c11.4 0 20.6-9.2 20.6-20.6 0-10.4-7.7-19-17.7-20.3-1.1-9.9-9.5-17.6-19.5-17.6z" fill="#0078D4"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-onedrive-business",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "n8n custom node for OneDrive Business with robust deduplication and webhook triggers",
5
5
  "keywords": [
6
6
  "n8n",
@@ -23,7 +23,7 @@
23
23
  "main": "index.js",
24
24
  "scripts": {
25
25
  "build": "tsc && npm run copy-icons",
26
- "copy-icons": "copyfiles -u 1 \"nodes/**/*.{png,svg}\" dist/",
26
+ "copy-icons": "copyfiles \"nodes/**/*.{png,svg}\" dist/",
27
27
  "dev": "tsc --watch",
28
28
  "format": "prettier nodes --write",
29
29
  "lint": "tslint -p tsconfig.json -c tslint.json",