infinity-forge 0.63.3 → 0.63.5
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/dist/sites/components/default-pages/sitemap/index.d.ts +4 -0
- package/dist/sites/components/default-pages/sitemap/index.js +64 -0
- package/dist/sites/components/default-pages/sitemap/index.js.map +1 -0
- package/dist/sites/services/generate-sitemap.d.ts +11 -0
- package/dist/sites/services/generate-sitemap.js +67 -0
- package/dist/sites/services/generate-sitemap.js.map +1 -0
- package/dist/sites/services/index.d.ts +2 -1
- package/dist/sites/services/index.js +1 -0
- package/dist/sites/services/index.js.map +1 -1
- package/dist/sites/utils/format-date.d.ts +1 -0
- package/dist/sites/utils/format-date.js +8 -0
- package/dist/sites/utils/format-date.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getServerSideProps = void 0;
|
|
40
|
+
var services_1 = require("../../../../sites/services/index.js");
|
|
41
|
+
var generate_sitemap_1 = require("../../../../sites/services/generate-sitemap.js");
|
|
42
|
+
var getServerSideProps = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
var productsResponse;
|
|
44
|
+
var _a;
|
|
45
|
+
return __generator(this, function (_b) {
|
|
46
|
+
switch (_b.label) {
|
|
47
|
+
case 0: return [4 /*yield*/, Promise.all([(0, services_1.api)({ method: 'get', url: 'Product/list/GetAll' })])];
|
|
48
|
+
case 1:
|
|
49
|
+
productsResponse = (_b.sent())[0];
|
|
50
|
+
return [2 /*return*/, (0, generate_sitemap_1.generateSitemap)({
|
|
51
|
+
res: ctx.res,
|
|
52
|
+
baseUrl: ctx.req.headers.host,
|
|
53
|
+
staticPages: ['', 'sobre', 'contato'],
|
|
54
|
+
dynamicPages: [(_a = productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data) === null || _a === void 0 ? void 0 : _a.products.map(function (product) { return "/produto/".concat(product === null || product === void 0 ? void 0 : product.sku, "/").concat(product === null || product === void 0 ? void 0 : product.url); })],
|
|
55
|
+
})];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}); };
|
|
59
|
+
exports.getServerSideProps = getServerSideProps;
|
|
60
|
+
var SitemapXML = function () {
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
63
|
+
exports.default = SitemapXML;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/sites/components/default-pages/sitemap/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAAsC;AACtC,sEAAmE;AAE5D,IAAM,kBAAkB,GAAuB,UAAO,GAAG;;;;;oBACnC,qBAAM,OAAO,CAAC,GAAG,CAAC,CAAC,IAAA,cAAG,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAA;;gBAA3F,gBAAgB,GAAI,CAAA,SAAuE,CAAA,GAA3E;gBAEvB,sBAAO,IAAA,kCAAe,EAAC;wBACrB,GAAG,EAAE,GAAG,CAAC,GAAG;wBACZ,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI;wBAC7B,WAAW,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC;wBACrC,YAAY,EAAE,CAAC,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,IAAI,0CAAE,QAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,IAAK,OAAA,mBAAY,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,cAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAE,EAA1C,CAA0C,CAAC,CAAC;qBAC9G,CAAC,EAAA;;;KACH,CAAA;AATY,QAAA,kBAAkB,sBAS9B;AAED,IAAM,UAAU,GAAa;IAC3B,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,kBAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ServerResponse } from 'http';
|
|
2
|
+
interface IGenerateSitemapProps {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
staticPages: string[];
|
|
5
|
+
dynamicPages: string[];
|
|
6
|
+
res: ServerResponse;
|
|
7
|
+
}
|
|
8
|
+
export declare function generateSitemap({ baseUrl, staticPages, dynamicPages, res }: IGenerateSitemapProps): Promise<{
|
|
9
|
+
props: {};
|
|
10
|
+
}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.generateSitemap = generateSitemap;
|
|
40
|
+
var format_date_1 = require("../utils/format-date.js");
|
|
41
|
+
var generateXMLTemplate = function (content) {
|
|
42
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\" xmlns:xhtml=\"http://www.w3.org/1999/xhtml\" xmlns:mobile=\"http://www.google.com/schemas/sitemap-mobile/1.0\" xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\" xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\">\n".concat(content, "</urlset>");
|
|
43
|
+
};
|
|
44
|
+
var CURRENT_DATE = (0, format_date_1.formatDate)(new Date());
|
|
45
|
+
var createUrlEntry = function (baseUrl, url) {
|
|
46
|
+
return "\n <url>\n <loc>".concat(baseUrl + url, "</loc>\n <lastmod>").concat(CURRENT_DATE, "</lastmod>\n <priority>1</priority>\n <changefreq>daily</changefreq>\n </url>\n ");
|
|
47
|
+
};
|
|
48
|
+
function generateSitemap(_a) {
|
|
49
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
50
|
+
var staticPagesXML, dynamicPagesXML, combinedXMLContent, sitemapContent;
|
|
51
|
+
var baseUrl = _b.baseUrl, staticPages = _b.staticPages, dynamicPages = _b.dynamicPages, res = _b.res;
|
|
52
|
+
return __generator(this, function (_c) {
|
|
53
|
+
res.setHeader('Cache-Control', 's-maxage=30, stale-while-revalidate');
|
|
54
|
+
res.setHeader('Content-Type', 'application/xml');
|
|
55
|
+
staticPagesXML = staticPages.map(function (page) { return createUrlEntry(baseUrl, page); }).join('');
|
|
56
|
+
dynamicPagesXML = dynamicPages.map(function (page) { return createUrlEntry(baseUrl, page); }).join('');
|
|
57
|
+
combinedXMLContent = [staticPagesXML, dynamicPagesXML].join('');
|
|
58
|
+
sitemapContent = generateXMLTemplate(combinedXMLContent);
|
|
59
|
+
res.write(sitemapContent);
|
|
60
|
+
res.end();
|
|
61
|
+
return [2 /*return*/, {
|
|
62
|
+
props: {},
|
|
63
|
+
}];
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=generate-sitemap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-sitemap.js","sourceRoot":"","sources":["../../../src/sites/services/generate-sitemap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,0CAoBC;AA9CD,oDAAiD;AAEjD,IAAM,mBAAmB,GAAG,UAAC,OAAe;IAC1C,OAAO,maAA4Y,OAAO,cAAW,CAAA;AACva,CAAC,CAAA;AAED,IAAM,YAAY,GAAG,IAAA,wBAAU,EAAC,IAAI,IAAI,EAAE,CAAC,CAAA;AAE3C,IAAM,cAAc,GAAG,UAAC,OAAe,EAAE,GAAW;IAClD,OAAO,kCAEI,OAAO,GAAG,GAAG,oCACT,YAAY,mGAI1B,CAAA;AACH,CAAC,CAAA;AASD,SAAsB,eAAe;wDAAC,EAAkE;;YAAhE,OAAO,aAAA,EAAE,WAAW,iBAAA,EAAE,YAAY,kBAAA,EAAE,GAAG,SAAA;;YAC7E,GAAG,CAAC,SAAS,CAAC,eAAe,EAAE,qCAAqC,CAAC,CAAA;YAErE,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAA;YAE1C,cAAc,GAAG,WAAW,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAA7B,CAA6B,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAElF,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,EAA7B,CAA6B,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAEpF,kBAAkB,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAE/D,cAAc,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAA;YAE9D,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;YAEzB,GAAG,CAAC,GAAG,EAAE,CAAA;YAET,sBAAO;oBACL,KAAK,EAAE,EAAE;iBACV,EAAA;;;CACF"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './api.js';
|
|
2
|
+
export * from './generate-sitemap.js';
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./api.js"), exports);
|
|
18
|
+
__exportStar(require("./generate-sitemap.js"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sites/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sites/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,qDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatDate: (date: Date) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDate = void 0;
|
|
4
|
+
var formatDate = function (date) {
|
|
5
|
+
return "".concat(date.getDate(), "/").concat(date.getMonth() + 1, "/").concat(date.getFullYear());
|
|
6
|
+
};
|
|
7
|
+
exports.formatDate = formatDate;
|
|
8
|
+
//# sourceMappingURL=format-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-date.js","sourceRoot":"","sources":["../../../src/sites/utils/format-date.ts"],"names":[],"mappings":";;;AAAO,IAAM,UAAU,GAAG,UAAC,IAAU;IACnC,OAAO,UAAG,IAAI,CAAC,OAAO,EAAE,cAAI,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,cAAI,IAAI,CAAC,WAAW,EAAE,CAAE,CAAA;AACzE,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB"}
|