authscape 1.0.736 → 1.0.737
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/index.js +42 -24
- package/package.json +1 -1
- package/src/lib/sitemap-route.js +7 -1
- package/src/services/sitemapService.js +7 -1
package/index.js
CHANGED
|
@@ -8144,7 +8144,7 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
|
|
|
8144
8144
|
function createSitemapRoute(apiUri) {
|
|
8145
8145
|
return /*#__PURE__*/function () {
|
|
8146
8146
|
var _GET = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
|
8147
|
-
var url, protocol, host, domain, encodedDomain, apiUrl, response, sitemap;
|
|
8147
|
+
var url, protocol, host, domain, encodedDomain, apiUrl, response, errorBody, sitemap;
|
|
8148
8148
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8149
8149
|
while (1) switch (_context.prev = _context.next) {
|
|
8150
8150
|
case 0:
|
|
@@ -8174,19 +8174,28 @@ function createSitemapRoute(apiUri) {
|
|
|
8174
8174
|
encodedDomain = encodeURIComponent(domain);
|
|
8175
8175
|
apiUrl = "".concat(apiUri, "/api/Sitemap?domain=").concat(encodedDomain);
|
|
8176
8176
|
console.log('Fetching sitemap from:', apiUrl);
|
|
8177
|
-
|
|
8177
|
+
console.log('Domain being sent:', domain);
|
|
8178
|
+
console.log('Encoded domain:', encodedDomain);
|
|
8179
|
+
_context.next = 15;
|
|
8178
8180
|
return fetch(apiUrl);
|
|
8179
|
-
case
|
|
8181
|
+
case 15:
|
|
8180
8182
|
response = _context.sent;
|
|
8181
8183
|
if (response.ok) {
|
|
8182
|
-
_context.next =
|
|
8184
|
+
_context.next = 24;
|
|
8183
8185
|
break;
|
|
8184
8186
|
}
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
_context.next =
|
|
8187
|
+
console.error('API Response Status:', response.status);
|
|
8188
|
+
console.error('API Response StatusText:', response.statusText);
|
|
8189
|
+
_context.next = 21;
|
|
8188
8190
|
return response.text();
|
|
8189
|
-
case
|
|
8191
|
+
case 21:
|
|
8192
|
+
errorBody = _context.sent;
|
|
8193
|
+
console.error('API Response Body:', errorBody);
|
|
8194
|
+
throw new Error("API request failed with status ".concat(response.status, ": ").concat(errorBody));
|
|
8195
|
+
case 24:
|
|
8196
|
+
_context.next = 26;
|
|
8197
|
+
return response.text();
|
|
8198
|
+
case 26:
|
|
8190
8199
|
sitemap = _context.sent;
|
|
8191
8200
|
console.log('Sitemap fetched successfully, length:', sitemap.length);
|
|
8192
8201
|
|
|
@@ -8198,8 +8207,8 @@ function createSitemapRoute(apiUri) {
|
|
|
8198
8207
|
'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate'
|
|
8199
8208
|
}
|
|
8200
8209
|
}));
|
|
8201
|
-
case
|
|
8202
|
-
_context.prev =
|
|
8210
|
+
case 31:
|
|
8211
|
+
_context.prev = 31;
|
|
8203
8212
|
_context.t0 = _context["catch"](0);
|
|
8204
8213
|
console.error('AuthScape Sitemap Error:', _context.t0);
|
|
8205
8214
|
return _context.abrupt("return", new Response("Error generating sitemap: ".concat(_context.t0.message || _context.t0), {
|
|
@@ -8208,11 +8217,11 @@ function createSitemapRoute(apiUri) {
|
|
|
8208
8217
|
'Content-Type': 'text/plain'
|
|
8209
8218
|
}
|
|
8210
8219
|
}));
|
|
8211
|
-
case
|
|
8220
|
+
case 35:
|
|
8212
8221
|
case "end":
|
|
8213
8222
|
return _context.stop();
|
|
8214
8223
|
}
|
|
8215
|
-
}, _callee, null, [[0,
|
|
8224
|
+
}, _callee, null, [[0, 31]]);
|
|
8216
8225
|
}));
|
|
8217
8226
|
function GET(_x) {
|
|
8218
8227
|
return _GET.apply(this, arguments);
|
|
@@ -9510,7 +9519,7 @@ function generateSitemap(_x, _x2, _x3) {
|
|
|
9510
9519
|
}
|
|
9511
9520
|
function _generateSitemap() {
|
|
9512
9521
|
_generateSitemap = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res, apiUri) {
|
|
9513
|
-
var host, domain, encodedDomain, apiUrl, response, sitemap;
|
|
9522
|
+
var host, domain, encodedDomain, apiUrl, response, errorBody, sitemap;
|
|
9514
9523
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9515
9524
|
while (1) switch (_context.prev = _context.next) {
|
|
9516
9525
|
case 0:
|
|
@@ -9527,21 +9536,30 @@ function _generateSitemap() {
|
|
|
9527
9536
|
encodedDomain = encodeURIComponent(domain);
|
|
9528
9537
|
apiUrl = "".concat(apiUri, "/api/Sitemap?domain=").concat(encodedDomain);
|
|
9529
9538
|
console.log('Fetching sitemap from:', apiUrl);
|
|
9539
|
+
console.log('Domain being sent:', domain);
|
|
9540
|
+
console.log('Encoded domain:', encodedDomain);
|
|
9530
9541
|
|
|
9531
9542
|
// Make a basic HTTP GET request to AuthScape API
|
|
9532
|
-
_context.next =
|
|
9543
|
+
_context.next = 10;
|
|
9533
9544
|
return fetch(apiUrl);
|
|
9534
|
-
case
|
|
9545
|
+
case 10:
|
|
9535
9546
|
response = _context.sent;
|
|
9536
9547
|
if (response.ok) {
|
|
9537
|
-
_context.next =
|
|
9548
|
+
_context.next = 19;
|
|
9538
9549
|
break;
|
|
9539
9550
|
}
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
_context.next =
|
|
9551
|
+
console.error('API Response Status:', response.status);
|
|
9552
|
+
console.error('API Response StatusText:', response.statusText);
|
|
9553
|
+
_context.next = 16;
|
|
9543
9554
|
return response.text();
|
|
9544
|
-
case
|
|
9555
|
+
case 16:
|
|
9556
|
+
errorBody = _context.sent;
|
|
9557
|
+
console.error('API Response Body:', errorBody);
|
|
9558
|
+
throw new Error("API request failed with status ".concat(response.status, ": ").concat(errorBody));
|
|
9559
|
+
case 19:
|
|
9560
|
+
_context.next = 21;
|
|
9561
|
+
return response.text();
|
|
9562
|
+
case 21:
|
|
9545
9563
|
sitemap = _context.sent;
|
|
9546
9564
|
console.log('Sitemap fetched successfully, length:', sitemap.length);
|
|
9547
9565
|
|
|
@@ -9556,8 +9574,8 @@ function _generateSitemap() {
|
|
|
9556
9574
|
return _context.abrupt("return", {
|
|
9557
9575
|
props: {}
|
|
9558
9576
|
});
|
|
9559
|
-
case
|
|
9560
|
-
_context.prev =
|
|
9577
|
+
case 31:
|
|
9578
|
+
_context.prev = 31;
|
|
9561
9579
|
_context.t0 = _context["catch"](0);
|
|
9562
9580
|
console.error('AuthScape Sitemap Error:', _context.t0);
|
|
9563
9581
|
|
|
@@ -9569,11 +9587,11 @@ function _generateSitemap() {
|
|
|
9569
9587
|
return _context.abrupt("return", {
|
|
9570
9588
|
props: {}
|
|
9571
9589
|
});
|
|
9572
|
-
case
|
|
9590
|
+
case 39:
|
|
9573
9591
|
case "end":
|
|
9574
9592
|
return _context.stop();
|
|
9575
9593
|
}
|
|
9576
|
-
}, _callee, null, [[0,
|
|
9594
|
+
}, _callee, null, [[0, 31]]);
|
|
9577
9595
|
}));
|
|
9578
9596
|
return _generateSitemap.apply(this, arguments);
|
|
9579
9597
|
}
|
package/package.json
CHANGED
package/src/lib/sitemap-route.js
CHANGED
|
@@ -40,11 +40,17 @@ export function createSitemapRoute(apiUri) {
|
|
|
40
40
|
const apiUrl = `${apiUri}/api/Sitemap?domain=${encodedDomain}`;
|
|
41
41
|
|
|
42
42
|
console.log('Fetching sitemap from:', apiUrl);
|
|
43
|
+
console.log('Domain being sent:', domain);
|
|
44
|
+
console.log('Encoded domain:', encodedDomain);
|
|
43
45
|
|
|
44
46
|
const response = await fetch(apiUrl);
|
|
45
47
|
|
|
46
48
|
if (!response.ok) {
|
|
47
|
-
|
|
49
|
+
console.error('API Response Status:', response.status);
|
|
50
|
+
console.error('API Response StatusText:', response.statusText);
|
|
51
|
+
const errorBody = await response.text();
|
|
52
|
+
console.error('API Response Body:', errorBody);
|
|
53
|
+
throw new Error(`API request failed with status ${response.status}: ${errorBody}`);
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
// Get the sitemap XML
|
|
@@ -28,12 +28,18 @@ export async function generateSitemap(req, res, apiUri) {
|
|
|
28
28
|
const apiUrl = `${apiUri}/api/Sitemap?domain=${encodedDomain}`;
|
|
29
29
|
|
|
30
30
|
console.log('Fetching sitemap from:', apiUrl);
|
|
31
|
+
console.log('Domain being sent:', domain);
|
|
32
|
+
console.log('Encoded domain:', encodedDomain);
|
|
31
33
|
|
|
32
34
|
// Make a basic HTTP GET request to AuthScape API
|
|
33
35
|
const response = await fetch(apiUrl);
|
|
34
36
|
|
|
35
37
|
if (!response.ok) {
|
|
36
|
-
|
|
38
|
+
console.error('API Response Status:', response.status);
|
|
39
|
+
console.error('API Response StatusText:', response.statusText);
|
|
40
|
+
const errorBody = await response.text();
|
|
41
|
+
console.error('API Response Body:', errorBody);
|
|
42
|
+
throw new Error(`API request failed with status ${response.status}: ${errorBody}`);
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
// Get the sitemap XML from the API
|