n8n-nodes-amis-v1 0.1.6 → 0.1.7

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.
@@ -132,8 +132,9 @@ class MisaAmis {
132
132
  // 1. Load Session
133
133
  const credentials = await this.getCredentials('misaAmisUser');
134
134
  const userIdentity = credentials.userIdentity;
135
+ const safeIdentity = userIdentity.replace(/[^a-z0-9]/gi, '_').toLowerCase();
135
136
  const n8nDir = process.env.N8N_USER_FOLDER || path.join(os.homedir(), '.n8n');
136
- const sessionFilePath = path.join(n8nDir, 'misa_sessions', `${userIdentity}.json`);
137
+ const sessionFilePath = path.join(n8nDir, 'misa_sessions', `${safeIdentity}.json`);
137
138
  if (!fs.existsSync(sessionFilePath)) {
138
139
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Session file not found for user: ${userIdentity}. Please run Login Node first.`);
139
140
  }
@@ -108,14 +108,20 @@ class MisaAmisLogin {
108
108
  const returnData = [];
109
109
  const operation = this.getNodeParameter('operation', 0);
110
110
  const userIdentity = this.getNodeParameter('userIdentity', 0);
111
+ const safeIdentity = userIdentity.replace(/[^a-z0-9]/gi, '_').toLowerCase();
111
112
  const n8nDir = process.env.N8N_USER_FOLDER || path.join(os.homedir(), '.n8n');
112
113
  const storagePath = path.join(n8nDir, 'misa_sessions');
113
- if (!fs.existsSync(storagePath)) {
114
- fs.mkdirSync(storagePath, { recursive: true });
114
+ try {
115
+ if (!fs.existsSync(storagePath)) {
116
+ fs.mkdirSync(storagePath, { recursive: true });
117
+ }
118
+ }
119
+ catch (error) {
120
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to create storage directory '${storagePath}': ${error.message}. Please check permissions.`);
115
121
  }
116
122
  // File paths
117
- const sessionFilePath = path.join(storagePath, `${userIdentity}.json`);
118
- const pendingFilePath = path.join(storagePath, `${userIdentity}.pending.json`);
123
+ const sessionFilePath = path.join(storagePath, `${safeIdentity}.json`);
124
+ const pendingFilePath = path.join(storagePath, `${safeIdentity}.pending.json`);
119
125
  const clientId = '6bcbc4d1-5426-42f7-bc61-69cac2e229f4';
120
126
  const headers = {
121
127
  'Content-Type': 'application/json',
@@ -174,7 +180,9 @@ class MisaAmisLogin {
174
180
  // --- Operation: Check Login ---
175
181
  // READ PENDING STATE
176
182
  if (!fs.existsSync(pendingFilePath)) {
177
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No pending login found for user '${userIdentity}'. Please run 'Generate QR' first.`);
183
+ const allFiles = fs.readdirSync(storagePath);
184
+ const pendingFiles = allFiles.filter(f => f.endsWith('.pending.json'));
185
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No pending login found for user '${userIdentity}'. Path: ${pendingFilePath}. Available pending sessions: ${pendingFiles.join(', ')}`);
178
186
  }
179
187
  const pendingState = JSON.parse(fs.readFileSync(pendingFilePath, 'utf8'));
180
188
  const cdRequestId = pendingState.requestId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-amis-v1",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "n8n node for AMIS v1",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"