n8n-nodes-digit 0.1.13 → 0.1.14

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.
@@ -34,7 +34,6 @@ exports.description = {
34
34
  required: true,
35
35
  },
36
36
  ],
37
- // baseURL intentionally not set here
38
37
  requestDefaults: {
39
38
  headers: {
40
39
  Accept: 'application/json',
@@ -87,7 +86,7 @@ class DIGIT {
87
86
  if (!baseUrl.startsWith('http')) {
88
87
  throw new Error('DIGIT Credentials: Base URL must start with http:// or https://');
89
88
  }
90
- // normalize trailing slash
89
+ // Normalize trailing slash
91
90
  baseUrl = baseUrl.replace(/\/+$/, '');
92
91
  // -------------------------------
93
92
  // Detect gateway environment
@@ -109,7 +108,7 @@ class DIGIT {
109
108
  if (operation === 'auth_decode_token') {
110
109
  for (let i = 0; i < items.length; i++) {
111
110
  const tokenParam = this.getNodeParameter('accessToken', i);
112
- const raw = tokenParam.replace(/^Bearer\s+/i, '');
111
+ const raw = tokenParam.replace(/^Bearer\s+/i, '').trim();
113
112
  const base64Url = raw.split('.')[1];
114
113
  const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
115
114
  const payload = JSON.parse(buffer_1.Buffer.from(base64, 'base64').toString('utf8'));
@@ -143,15 +142,14 @@ class DIGIT {
143
142
  const fileId = this.getNodeParameter('fileId', i);
144
143
  const tenantId = this.getNodeParameter('tenantId', i);
145
144
  const accessToken = this.getNodeParameter('accessToken', i);
145
+ const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
146
146
  const response = await this.helpers.httpRequest({
147
147
  method: 'GET',
148
148
  url: new URL(`/filestore/v1/files/${fileId}`, baseUrl).toString(),
149
149
  qs: { tenantId },
150
150
  headers: {
151
- 'X-Tenant-Id': tenantId,
152
- Authorization: accessToken.startsWith('Bearer')
153
- ? accessToken
154
- : `Bearer ${accessToken}`,
151
+ 'X-Tenant-Id': tenantId.toLowerCase(),
152
+ Authorization: `Bearer ${cleanToken}`,
155
153
  },
156
154
  json: true,
157
155
  });
@@ -170,18 +168,17 @@ class DIGIT {
170
168
  const tenantId = this.getNodeParameter('tenantId', i);
171
169
  const codes = this.getNodeParameter('codes', i);
172
170
  const accessToken = this.getNodeParameter('accessToken', i);
171
+ const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
173
172
  const response = await this.helpers.httpRequest({
174
173
  method: 'GET',
175
174
  url: new URL('/egov-location/location/v11/boundarys/_search', baseUrl).toString(),
176
175
  qs: {
177
- tenantId,
176
+ tenantId: tenantId.toLowerCase(),
178
177
  boundaryCodes: codes,
179
178
  },
180
179
  headers: {
181
- 'X-Tenant-Id': tenantId,
182
- Authorization: accessToken.startsWith('Bearer')
183
- ? accessToken
184
- : `Bearer ${accessToken}`,
180
+ 'X-Tenant-Id': tenantId.toLowerCase(),
181
+ Authorization: `Bearer ${cleanToken}`,
185
182
  },
186
183
  json: true,
187
184
  });
@@ -198,6 +195,7 @@ class DIGIT {
198
195
  if (operation === 'idgen_generate') {
199
196
  for (let i = 0; i < items.length; i++) {
200
197
  const accessToken = this.getNodeParameter('accessToken', i);
198
+ const cleanToken = accessToken.replace(/^Bearer\s+/i, '').trim();
201
199
  let body;
202
200
  try {
203
201
  body = JSON.parse(this.getNodeParameter('requestBody', i));
@@ -212,9 +210,7 @@ class DIGIT {
212
210
  method: 'POST',
213
211
  url: new URL(idgenPath, baseUrl).toString(),
214
212
  headers: {
215
- Authorization: accessToken.startsWith('Bearer')
216
- ? accessToken
217
- : `Bearer ${accessToken}`,
213
+ Authorization: `Bearer ${cleanToken}`,
218
214
  },
219
215
  body,
220
216
  json: true,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-digit",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "DIGIT Platform nodes for n8n",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-digit",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "DIGIT Platform nodes for n8n",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",