@sitecore-content-sdk/core 0.1.0-beta.1
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/LICENSE.txt +202 -0
- package/README.md +11 -0
- package/dist/cjs/cache-client.js +54 -0
- package/dist/cjs/constants.js +13 -0
- package/dist/cjs/data-fetcher.js +33 -0
- package/dist/cjs/debug.js +43 -0
- package/dist/cjs/editing/component-library.js +104 -0
- package/dist/cjs/editing/graphql-editing-service.js +186 -0
- package/dist/cjs/editing/index.js +23 -0
- package/dist/cjs/editing/models.js +23 -0
- package/dist/cjs/editing/rest-component-layout-service.js +76 -0
- package/dist/cjs/editing/utils.js +86 -0
- package/dist/cjs/graphql/app-root-query.js +73 -0
- package/dist/cjs/graphql/graphql-edge-proxy.js +21 -0
- package/dist/cjs/graphql/index.js +13 -0
- package/dist/cjs/graphql/search-service.js +61 -0
- package/dist/cjs/graphql-request-client.js +152 -0
- package/dist/cjs/i18n/dictionary-service.js +45 -0
- package/dist/cjs/i18n/graphql-dictionary-service.js +136 -0
- package/dist/cjs/i18n/index.js +7 -0
- package/dist/cjs/index.js +55 -0
- package/dist/cjs/layout/content-styles.js +70 -0
- package/dist/cjs/layout/graphql-layout-service.js +86 -0
- package/dist/cjs/layout/index.js +24 -0
- package/dist/cjs/layout/layout-service.js +9 -0
- package/dist/cjs/layout/models.js +35 -0
- package/dist/cjs/layout/themes.js +74 -0
- package/dist/cjs/layout/utils.js +110 -0
- package/dist/cjs/media/index.js +38 -0
- package/dist/cjs/media/media-api.js +96 -0
- package/dist/cjs/models.js +2 -0
- package/dist/cjs/native-fetcher.js +200 -0
- package/dist/cjs/personalize/graphql-personalize-service.js +114 -0
- package/dist/cjs/personalize/index.js +14 -0
- package/dist/cjs/personalize/layout-personalizer.js +97 -0
- package/dist/cjs/personalize/utils.js +136 -0
- package/dist/cjs/site/graphql-error-pages-service.js +89 -0
- package/dist/cjs/site/graphql-redirects-service.js +105 -0
- package/dist/cjs/site/graphql-robots-service.js +83 -0
- package/dist/cjs/site/graphql-siteinfo-service.js +107 -0
- package/dist/cjs/site/graphql-sitemap-service.js +93 -0
- package/dist/cjs/site/index.js +22 -0
- package/dist/cjs/site/site-resolver.js +79 -0
- package/dist/cjs/site/utils.js +43 -0
- package/dist/cjs/utils/env.js +26 -0
- package/dist/cjs/utils/index.js +20 -0
- package/dist/cjs/utils/is-server.js +10 -0
- package/dist/cjs/utils/timeout-promise.js +31 -0
- package/dist/cjs/utils/utils.js +222 -0
- package/dist/esm/cache-client.js +50 -0
- package/dist/esm/constants.js +10 -0
- package/dist/esm/data-fetcher.js +28 -0
- package/dist/esm/debug.js +36 -0
- package/dist/esm/editing/component-library.js +98 -0
- package/dist/esm/editing/graphql-editing-service.js +179 -0
- package/dist/esm/editing/index.js +5 -0
- package/dist/esm/editing/models.js +20 -0
- package/dist/esm/editing/rest-component-layout-service.js +72 -0
- package/dist/esm/editing/utils.js +76 -0
- package/dist/esm/graphql/app-root-query.js +69 -0
- package/dist/esm/graphql/graphql-edge-proxy.js +16 -0
- package/dist/esm/graphql/index.js +4 -0
- package/dist/esm/graphql/search-service.js +57 -0
- package/dist/esm/graphql-request-client.js +144 -0
- package/dist/esm/i18n/dictionary-service.js +41 -0
- package/dist/esm/i18n/graphql-dictionary-service.js +129 -0
- package/dist/esm/i18n/index.js +2 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/layout/content-styles.js +62 -0
- package/dist/esm/layout/graphql-layout-service.js +79 -0
- package/dist/esm/layout/index.js +6 -0
- package/dist/esm/layout/layout-service.js +5 -0
- package/dist/esm/layout/models.js +32 -0
- package/dist/esm/layout/themes.js +69 -0
- package/dist/esm/layout/utils.js +102 -0
- package/dist/esm/media/index.js +2 -0
- package/dist/esm/media/media-api.js +86 -0
- package/dist/esm/models.js +1 -0
- package/dist/esm/native-fetcher.js +193 -0
- package/dist/esm/personalize/graphql-personalize-service.js +107 -0
- package/dist/esm/personalize/index.js +3 -0
- package/dist/esm/personalize/layout-personalizer.js +92 -0
- package/dist/esm/personalize/utils.js +128 -0
- package/dist/esm/site/graphql-error-pages-service.js +82 -0
- package/dist/esm/site/graphql-redirects-service.js +98 -0
- package/dist/esm/site/graphql-robots-service.js +76 -0
- package/dist/esm/site/graphql-siteinfo-service.js +100 -0
- package/dist/esm/site/graphql-sitemap-service.js +86 -0
- package/dist/esm/site/index.js +7 -0
- package/dist/esm/site/site-resolver.js +75 -0
- package/dist/esm/site/utils.js +37 -0
- package/dist/esm/utils/env.js +22 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/is-server.js +8 -0
- package/dist/esm/utils/timeout-promise.js +28 -0
- package/dist/esm/utils/utils.js +207 -0
- package/editing.d.ts +1 -0
- package/editing.js +1 -0
- package/graphql.d.ts +1 -0
- package/graphql.js +1 -0
- package/i18n.d.ts +1 -0
- package/i18n.js +1 -0
- package/layout.d.ts +1 -0
- package/layout.js +1 -0
- package/media.d.ts +1 -0
- package/media.js +1 -0
- package/package.json +76 -0
- package/personalize.d.ts +1 -0
- package/personalize.js +1 -0
- package/site.d.ts +1 -0
- package/site.js +1 -0
- package/types/cache-client.d.ts +64 -0
- package/types/constants.d.ts +7 -0
- package/types/data-fetcher.d.ts +34 -0
- package/types/debug.d.ts +26 -0
- package/types/editing/component-library.d.ts +48 -0
- package/types/editing/graphql-editing-service.d.ts +90 -0
- package/types/editing/index.d.ts +6 -0
- package/types/editing/models.d.ts +52 -0
- package/types/editing/rest-component-layout-service.d.ts +100 -0
- package/types/editing/utils.d.ts +70 -0
- package/types/graphql/app-root-query.d.ts +32 -0
- package/types/graphql/graphql-edge-proxy.d.ts +15 -0
- package/types/graphql/index.d.ts +4 -0
- package/types/graphql/search-service.d.ts +95 -0
- package/types/graphql-request-client.d.ts +159 -0
- package/types/i18n/dictionary-service.d.ts +56 -0
- package/types/i18n/graphql-dictionary-service.d.ts +94 -0
- package/types/i18n/index.d.ts +2 -0
- package/types/index.d.ts +8 -0
- package/types/layout/content-styles.d.ts +18 -0
- package/types/layout/graphql-layout-service.d.ts +58 -0
- package/types/layout/index.d.ts +6 -0
- package/types/layout/layout-service.d.ts +19 -0
- package/types/layout/models.d.ts +145 -0
- package/types/layout/themes.d.ts +11 -0
- package/types/layout/utils.d.ts +40 -0
- package/types/media/index.d.ts +2 -0
- package/types/media/media-api.d.ts +55 -0
- package/types/models.d.ts +6 -0
- package/types/native-fetcher.d.ts +121 -0
- package/types/personalize/graphql-personalize-service.d.ts +80 -0
- package/types/personalize/index.d.ts +3 -0
- package/types/personalize/layout-personalizer.d.ts +27 -0
- package/types/personalize/utils.d.ts +69 -0
- package/types/site/graphql-error-pages-service.d.ts +57 -0
- package/types/site/graphql-redirects-service.d.ts +68 -0
- package/types/site/graphql-robots-service.d.ts +49 -0
- package/types/site/graphql-siteinfo-service.d.ts +70 -0
- package/types/site/graphql-sitemap-service.d.ts +55 -0
- package/types/site/index.d.ts +7 -0
- package/types/site/site-resolver.d.ts +27 -0
- package/types/site/utils.d.ts +24 -0
- package/types/utils/env.d.ts +7 -0
- package/types/utils/index.d.ts +3 -0
- package/types/utils/is-server.d.ts +6 -0
- package/types/utils/timeout-promise.d.ts +17 -0
- package/types/utils/utils.d.ts +71 -0
- package/utils.d.ts +1 -0
- package/utils.js +1 -0
|
@@ -0,0 +1,89 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphQLErrorPagesService = void 0;
|
|
16
|
+
const constants_1 = require("../constants");
|
|
17
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
18
|
+
// The default query for request error handling
|
|
19
|
+
const defaultQuery = /* GraphQL */ `
|
|
20
|
+
query ErrorPagesQuery($siteName: String!, $language: String!) {
|
|
21
|
+
site {
|
|
22
|
+
siteInfo(site: $siteName) {
|
|
23
|
+
errorHandling(language: $language) {
|
|
24
|
+
notFoundPage {
|
|
25
|
+
rendered
|
|
26
|
+
}
|
|
27
|
+
notFoundPagePath
|
|
28
|
+
serverErrorPage {
|
|
29
|
+
rendered
|
|
30
|
+
}
|
|
31
|
+
serverErrorPagePath
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
/**
|
|
38
|
+
* Service that fetch the error pages data using Sitecore's GraphQL API.
|
|
39
|
+
*/
|
|
40
|
+
class GraphQLErrorPagesService {
|
|
41
|
+
/**
|
|
42
|
+
* Creates an instance of graphQL error pages service with the provided options
|
|
43
|
+
* @param {GraphQLErrorPagesServiceConfig} options instance
|
|
44
|
+
*/
|
|
45
|
+
constructor(options) {
|
|
46
|
+
this.options = options;
|
|
47
|
+
this.graphQLClient = this.getGraphQLClient();
|
|
48
|
+
}
|
|
49
|
+
get query() {
|
|
50
|
+
return defaultQuery;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Fetch list of error pages for the site
|
|
54
|
+
* @returns {ErrorPages} list of url's error pages
|
|
55
|
+
* @throws {Error} if the siteName is empty.
|
|
56
|
+
*/
|
|
57
|
+
fetchErrorPages() {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const siteName = this.options.siteName;
|
|
60
|
+
const language = this.options.language;
|
|
61
|
+
if (!siteName) {
|
|
62
|
+
throw new Error(constants_1.siteNameError);
|
|
63
|
+
}
|
|
64
|
+
return this.graphQLClient.request(this.query, {
|
|
65
|
+
siteName,
|
|
66
|
+
language,
|
|
67
|
+
})
|
|
68
|
+
.then((result) => result.site.siteInfo ? result.site.siteInfo.errorHandling : null)
|
|
69
|
+
.catch((e) => Promise.reject(e));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
|
|
74
|
+
* library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
|
|
75
|
+
* want to use something else.
|
|
76
|
+
* @returns {GraphQLClient} implementation
|
|
77
|
+
*/
|
|
78
|
+
getGraphQLClient() {
|
|
79
|
+
if (!this.options.clientFactory) {
|
|
80
|
+
throw new Error('clientFactory needs to be provided when initializing GraphQL client.');
|
|
81
|
+
}
|
|
82
|
+
return this.options.clientFactory({
|
|
83
|
+
debugger: debug_1.default.errorpages,
|
|
84
|
+
retries: this.options.retries,
|
|
85
|
+
retryStrategy: this.options.retryStrategy,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.GraphQLErrorPagesService = GraphQLErrorPagesService;
|
|
@@ -0,0 +1,105 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphQLRedirectsService = exports.REDIRECT_TYPE_SERVER_TRANSFER = exports.REDIRECT_TYPE_302 = exports.REDIRECT_TYPE_301 = void 0;
|
|
16
|
+
const constants_1 = require("../constants");
|
|
17
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
18
|
+
const cache_client_1 = require("../cache-client");
|
|
19
|
+
exports.REDIRECT_TYPE_301 = 'REDIRECT_301';
|
|
20
|
+
exports.REDIRECT_TYPE_302 = 'REDIRECT_302';
|
|
21
|
+
exports.REDIRECT_TYPE_SERVER_TRANSFER = 'SERVER_TRANSFER';
|
|
22
|
+
// The default query for request redirects of site
|
|
23
|
+
const defaultQuery = /* GraphQL */ `
|
|
24
|
+
query RedirectsQuery($siteName: String!) {
|
|
25
|
+
site {
|
|
26
|
+
siteInfo(site: $siteName) {
|
|
27
|
+
redirects {
|
|
28
|
+
pattern
|
|
29
|
+
target
|
|
30
|
+
redirectType
|
|
31
|
+
isQueryStringPreserved
|
|
32
|
+
locale
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
/**
|
|
39
|
+
* The GraphQLRedirectsService class is used to query the JSS redirects using Graphql endpoint
|
|
40
|
+
*/
|
|
41
|
+
class GraphQLRedirectsService {
|
|
42
|
+
/**
|
|
43
|
+
* Creates an instance of graphQL redirects service with the provided options
|
|
44
|
+
* @param {GraphQLRedirectsServiceConfig} options instance
|
|
45
|
+
*/
|
|
46
|
+
constructor(options) {
|
|
47
|
+
this.options = options;
|
|
48
|
+
this.graphQLClient = this.getGraphQLClient();
|
|
49
|
+
this.cache = this.getCacheClient();
|
|
50
|
+
}
|
|
51
|
+
get query() {
|
|
52
|
+
return defaultQuery;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Fetch an array of redirects from API
|
|
56
|
+
* @param {string} siteName site name
|
|
57
|
+
* @returns Promise<RedirectInfo[]>
|
|
58
|
+
* @throws {Error} if the siteName is empty.
|
|
59
|
+
*/
|
|
60
|
+
fetchRedirects(siteName) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
if (!siteName) {
|
|
64
|
+
throw new Error(constants_1.siteNameError);
|
|
65
|
+
}
|
|
66
|
+
const cacheKey = `redirects-${siteName}`;
|
|
67
|
+
let data = this.cache.getCacheValue(cacheKey);
|
|
68
|
+
if (!data) {
|
|
69
|
+
data = yield this.graphQLClient.request(this.query, {
|
|
70
|
+
siteName,
|
|
71
|
+
});
|
|
72
|
+
this.cache.setCacheValue(cacheKey, data);
|
|
73
|
+
}
|
|
74
|
+
return ((_b = (_a = data === null || data === void 0 ? void 0 : data.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.redirects) || [];
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
|
|
79
|
+
* library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
|
|
80
|
+
* want to use something else.
|
|
81
|
+
* @returns {GraphQLClient} implementation
|
|
82
|
+
*/
|
|
83
|
+
getGraphQLClient() {
|
|
84
|
+
if (!this.options.clientFactory) {
|
|
85
|
+
throw new Error('clientFactory needs to be provided when initializing GraphQL client.');
|
|
86
|
+
}
|
|
87
|
+
return this.options.clientFactory({
|
|
88
|
+
debugger: debug_1.default.redirects,
|
|
89
|
+
fetch: this.options.fetch,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Gets cache client implementation
|
|
94
|
+
* Override this method if custom cache needs to be used
|
|
95
|
+
* @returns CacheClient instance
|
|
96
|
+
*/
|
|
97
|
+
getCacheClient() {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
return new cache_client_1.MemoryCacheClient({
|
|
100
|
+
cacheEnabled: (_a = this.options.cacheEnabled) !== null && _a !== void 0 ? _a : true,
|
|
101
|
+
cacheTimeout: (_b = this.options.cacheTimeout) !== null && _b !== void 0 ? _b : 10,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.GraphQLRedirectsService = GraphQLRedirectsService;
|
|
@@ -0,0 +1,83 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphQLRobotsService = void 0;
|
|
16
|
+
const constants_1 = require("../constants");
|
|
17
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
18
|
+
// The default query for request robots.txt
|
|
19
|
+
const defaultQuery = /* GraphQL */ `
|
|
20
|
+
query RobotsQuery($siteName: String!) {
|
|
21
|
+
site {
|
|
22
|
+
siteInfo(site: $siteName) {
|
|
23
|
+
robots
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
/**
|
|
29
|
+
* Service that fetch the robots.txt data using Sitecore's GraphQL API.
|
|
30
|
+
*/
|
|
31
|
+
class GraphQLRobotsService {
|
|
32
|
+
/**
|
|
33
|
+
* Creates an instance of graphQL robots.txt service with the provided options
|
|
34
|
+
* @param {GraphQLRobotsServiceConfig} options instance
|
|
35
|
+
*/
|
|
36
|
+
constructor(options) {
|
|
37
|
+
this.options = options;
|
|
38
|
+
this.graphQLClient = this.getGraphQLClient();
|
|
39
|
+
}
|
|
40
|
+
get query() {
|
|
41
|
+
return defaultQuery;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Fetch a data of robots.txt from API
|
|
45
|
+
* @returns text of robots.txt
|
|
46
|
+
* @throws {Error} if the siteName is empty.
|
|
47
|
+
*/
|
|
48
|
+
fetchRobots() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const siteName = this.options.siteName;
|
|
51
|
+
if (!siteName) {
|
|
52
|
+
throw new Error(constants_1.siteNameError);
|
|
53
|
+
}
|
|
54
|
+
const robotsResult = this.graphQLClient.request(this.query, {
|
|
55
|
+
siteName,
|
|
56
|
+
});
|
|
57
|
+
try {
|
|
58
|
+
return robotsResult.then((result) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
return (_b = (_a = result === null || result === void 0 ? void 0 : result.site) === null || _a === void 0 ? void 0 : _a.siteInfo) === null || _b === void 0 ? void 0 : _b.robots;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
return Promise.reject(e);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
|
|
70
|
+
* library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
|
|
71
|
+
* want to use something else.
|
|
72
|
+
* @returns {GraphQLClient} implementation
|
|
73
|
+
*/
|
|
74
|
+
getGraphQLClient() {
|
|
75
|
+
if (!this.options.clientFactory) {
|
|
76
|
+
throw new Error('clientFactory needs to be provided when initializing GraphQL client.');
|
|
77
|
+
}
|
|
78
|
+
return this.options.clientFactory({
|
|
79
|
+
debugger: debug_1.default.robots,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.GraphQLRobotsService = GraphQLRobotsService;
|
|
@@ -0,0 +1,107 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphQLSiteInfoService = void 0;
|
|
16
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
17
|
+
const cache_client_1 = require("../cache-client");
|
|
18
|
+
const siteQuery = /* GraphQL */ `
|
|
19
|
+
query {
|
|
20
|
+
site {
|
|
21
|
+
siteInfoCollection {
|
|
22
|
+
name
|
|
23
|
+
hostName: hostname
|
|
24
|
+
language
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
class GraphQLSiteInfoService {
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instance of graphQL service to retrieve site configuration list from Sitecore
|
|
32
|
+
* @param {GraphQLSiteInfoServiceConfig} config instance
|
|
33
|
+
*/
|
|
34
|
+
constructor(config) {
|
|
35
|
+
this.config = config;
|
|
36
|
+
this.graphQLClient = this.getGraphQLClient();
|
|
37
|
+
this.cache = this.getCacheClient();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* site query is available on XM Cloud and XP 10.4+
|
|
41
|
+
*/
|
|
42
|
+
get siteQuery() {
|
|
43
|
+
return siteQuery;
|
|
44
|
+
}
|
|
45
|
+
fetchSiteInfo() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const cachedResult = this.cache.getCacheValue(this.getCacheKey());
|
|
48
|
+
if (cachedResult) {
|
|
49
|
+
return cachedResult;
|
|
50
|
+
}
|
|
51
|
+
if (process.env.SITECORE) {
|
|
52
|
+
debug_1.default.multisite('Skipping site information fetch (building on XM Cloud)');
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
const results = yield this.fetchWithSiteQuery();
|
|
56
|
+
this.cache.setCacheValue(this.getCacheKey(), results);
|
|
57
|
+
return results;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
fetchWithSiteQuery() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
const response = yield this.graphQLClient.request(this.siteQuery);
|
|
64
|
+
const result = (_b = (_a = response === null || response === void 0 ? void 0 : response.site) === null || _a === void 0 ? void 0 : _a.siteInfoCollection) === null || _b === void 0 ? void 0 : _b.reduce((result, current) => {
|
|
65
|
+
// filter out built in website
|
|
66
|
+
current.name !== 'website' &&
|
|
67
|
+
result.push({
|
|
68
|
+
name: current.name,
|
|
69
|
+
hostName: current.hostName,
|
|
70
|
+
language: current.language,
|
|
71
|
+
});
|
|
72
|
+
return result;
|
|
73
|
+
}, []);
|
|
74
|
+
return result;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets cache client implementation
|
|
79
|
+
* Override this method if custom cache needs to be used
|
|
80
|
+
* @returns CacheClient instance
|
|
81
|
+
*/
|
|
82
|
+
getCacheClient() {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return new cache_client_1.MemoryCacheClient({
|
|
85
|
+
cacheEnabled: (_a = this.config.cacheEnabled) !== null && _a !== void 0 ? _a : true,
|
|
86
|
+
cacheTimeout: (_b = this.config.cacheTimeout) !== null && _b !== void 0 ? _b : 10,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
|
|
91
|
+
* library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
|
|
92
|
+
* want to use something else.
|
|
93
|
+
* @returns {GraphQLClient} implementation
|
|
94
|
+
*/
|
|
95
|
+
getGraphQLClient() {
|
|
96
|
+
if (!this.config.clientFactory) {
|
|
97
|
+
throw new Error('clientFactory needs to be provided when initializing GraphQL client.');
|
|
98
|
+
}
|
|
99
|
+
return this.config.clientFactory({
|
|
100
|
+
debugger: debug_1.default.multisite,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
getCacheKey() {
|
|
104
|
+
return 'siteinfo-service-cache';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.GraphQLSiteInfoService = GraphQLSiteInfoService;
|
|
@@ -0,0 +1,93 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphQLSitemapXmlService = void 0;
|
|
16
|
+
const constants_1 = require("../constants");
|
|
17
|
+
const debug_1 = __importDefault(require("../debug"));
|
|
18
|
+
const PREFIX_NAME_SITEMAP = 'sitemap';
|
|
19
|
+
// The default query for request sitemaps
|
|
20
|
+
const defaultQuery = /* GraphQL */ `
|
|
21
|
+
query SitemapQuery($siteName: String!) {
|
|
22
|
+
site {
|
|
23
|
+
siteInfo(site: $siteName) {
|
|
24
|
+
sitemap
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
/**
|
|
30
|
+
* Service that fetch the sitemaps data using Sitecore's GraphQL API.
|
|
31
|
+
*/
|
|
32
|
+
class GraphQLSitemapXmlService {
|
|
33
|
+
/**
|
|
34
|
+
* Creates an instance of graphQL sitemaps service with the provided options
|
|
35
|
+
* @param {GraphQLSitemapXmlServiceConfig} options instance
|
|
36
|
+
*/
|
|
37
|
+
constructor(options) {
|
|
38
|
+
this.options = options;
|
|
39
|
+
this.graphQLClient = this.getGraphQLClient();
|
|
40
|
+
}
|
|
41
|
+
get query() {
|
|
42
|
+
return defaultQuery;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fetch list of sitemaps for the site
|
|
46
|
+
* @returns {string[]} list of sitemap paths
|
|
47
|
+
* @throws {Error} if the siteName is empty.
|
|
48
|
+
*/
|
|
49
|
+
fetchSitemaps() {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const siteName = this.options.siteName;
|
|
52
|
+
if (!siteName) {
|
|
53
|
+
throw new Error(constants_1.siteNameError);
|
|
54
|
+
}
|
|
55
|
+
const sitemapResult = this.graphQLClient.request(this.query, {
|
|
56
|
+
siteName,
|
|
57
|
+
});
|
|
58
|
+
try {
|
|
59
|
+
return sitemapResult.then((result) => result.site.siteInfo.sitemap);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
return Promise.reject(e);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get sitemap file path for sitemap id
|
|
68
|
+
* @param {string} id the sitemap id (can be empty for default 'sitemap.xml' file)
|
|
69
|
+
* @returns {string | undefined} the sitemap file path or undefined if one doesn't exist
|
|
70
|
+
*/
|
|
71
|
+
getSitemap(id) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const searchSitemap = `${PREFIX_NAME_SITEMAP}${id}.xml`;
|
|
74
|
+
const sitemaps = yield this.fetchSitemaps();
|
|
75
|
+
return sitemaps.find((sitemap) => sitemap.includes(searchSitemap));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets a GraphQL client that can make requests to the API. Uses graphql-request as the default
|
|
80
|
+
* library for fetching graphql data (@see GraphQLRequestClient). Override this method if you
|
|
81
|
+
* want to use something else.
|
|
82
|
+
* @returns {GraphQLClient} implementation
|
|
83
|
+
*/
|
|
84
|
+
getGraphQLClient() {
|
|
85
|
+
if (!this.options.clientFactory) {
|
|
86
|
+
throw new Error('clientFactory needs to be provided when initializing GraphQL client.');
|
|
87
|
+
}
|
|
88
|
+
return this.options.clientFactory({
|
|
89
|
+
debugger: debug_1.default.sitemap,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.GraphQLSitemapXmlService = GraphQLSitemapXmlService;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SiteResolver = exports.normalizeSiteRewrite = exports.getSiteRewriteData = exports.getSiteRewrite = exports.GraphQLSiteInfoService = exports.GraphQLErrorPagesService = exports.GraphQLSitemapXmlService = exports.GraphQLRedirectsService = exports.REDIRECT_TYPE_SERVER_TRANSFER = exports.REDIRECT_TYPE_302 = exports.REDIRECT_TYPE_301 = exports.GraphQLRobotsService = void 0;
|
|
4
|
+
var graphql_robots_service_1 = require("./graphql-robots-service");
|
|
5
|
+
Object.defineProperty(exports, "GraphQLRobotsService", { enumerable: true, get: function () { return graphql_robots_service_1.GraphQLRobotsService; } });
|
|
6
|
+
var graphql_redirects_service_1 = require("./graphql-redirects-service");
|
|
7
|
+
Object.defineProperty(exports, "REDIRECT_TYPE_301", { enumerable: true, get: function () { return graphql_redirects_service_1.REDIRECT_TYPE_301; } });
|
|
8
|
+
Object.defineProperty(exports, "REDIRECT_TYPE_302", { enumerable: true, get: function () { return graphql_redirects_service_1.REDIRECT_TYPE_302; } });
|
|
9
|
+
Object.defineProperty(exports, "REDIRECT_TYPE_SERVER_TRANSFER", { enumerable: true, get: function () { return graphql_redirects_service_1.REDIRECT_TYPE_SERVER_TRANSFER; } });
|
|
10
|
+
Object.defineProperty(exports, "GraphQLRedirectsService", { enumerable: true, get: function () { return graphql_redirects_service_1.GraphQLRedirectsService; } });
|
|
11
|
+
var graphql_sitemap_service_1 = require("./graphql-sitemap-service");
|
|
12
|
+
Object.defineProperty(exports, "GraphQLSitemapXmlService", { enumerable: true, get: function () { return graphql_sitemap_service_1.GraphQLSitemapXmlService; } });
|
|
13
|
+
var graphql_error_pages_service_1 = require("./graphql-error-pages-service");
|
|
14
|
+
Object.defineProperty(exports, "GraphQLErrorPagesService", { enumerable: true, get: function () { return graphql_error_pages_service_1.GraphQLErrorPagesService; } });
|
|
15
|
+
var graphql_siteinfo_service_1 = require("./graphql-siteinfo-service");
|
|
16
|
+
Object.defineProperty(exports, "GraphQLSiteInfoService", { enumerable: true, get: function () { return graphql_siteinfo_service_1.GraphQLSiteInfoService; } });
|
|
17
|
+
var utils_1 = require("./utils");
|
|
18
|
+
Object.defineProperty(exports, "getSiteRewrite", { enumerable: true, get: function () { return utils_1.getSiteRewrite; } });
|
|
19
|
+
Object.defineProperty(exports, "getSiteRewriteData", { enumerable: true, get: function () { return utils_1.getSiteRewriteData; } });
|
|
20
|
+
Object.defineProperty(exports, "normalizeSiteRewrite", { enumerable: true, get: function () { return utils_1.normalizeSiteRewrite; } });
|
|
21
|
+
var site_resolver_1 = require("./site-resolver");
|
|
22
|
+
Object.defineProperty(exports, "SiteResolver", { enumerable: true, get: function () { return site_resolver_1.SiteResolver; } });
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SiteResolver = void 0;
|
|
4
|
+
// Delimiters for multi-value hostnames
|
|
5
|
+
const DELIMITERS = /\||,|;/g;
|
|
6
|
+
/**
|
|
7
|
+
* Resolves site based on the provided host or site name
|
|
8
|
+
*/
|
|
9
|
+
class SiteResolver {
|
|
10
|
+
/**
|
|
11
|
+
* @param {SiteInfo[]} sites Array of sites to be used in resolution
|
|
12
|
+
*/
|
|
13
|
+
constructor(sites) {
|
|
14
|
+
this.sites = sites;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve site by host name
|
|
17
|
+
* @param {string} hostName the host name
|
|
18
|
+
* @returns {SiteInfo} the resolved site
|
|
19
|
+
* @throws {Error} if a matching site is not found
|
|
20
|
+
*/
|
|
21
|
+
this.getByHost = (hostName) => {
|
|
22
|
+
for (const [hostname, site] of this.getHostMap()) {
|
|
23
|
+
if (this.matchesPattern(hostName, hostname)) {
|
|
24
|
+
return site;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new Error(`Could not resolve site for host ${hostName}`);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Resolve site by site name
|
|
31
|
+
* @param {string} siteName the site name
|
|
32
|
+
* @returns {SiteInfo} the resolved site
|
|
33
|
+
* @throws {Error} if a matching site is not found
|
|
34
|
+
*/
|
|
35
|
+
this.getByName = (siteName) => {
|
|
36
|
+
const siteInfo = this.sites.find((info) => info.name.toLocaleLowerCase() === siteName.toLocaleLowerCase());
|
|
37
|
+
if (!siteInfo) {
|
|
38
|
+
throw new Error(`Could not resolve site for name ${siteName}`);
|
|
39
|
+
}
|
|
40
|
+
return siteInfo;
|
|
41
|
+
};
|
|
42
|
+
this.getHostMap = () => {
|
|
43
|
+
const map = new Map();
|
|
44
|
+
// First collect unique hostnames.
|
|
45
|
+
// For sites with same hostname defined, priority is given to the first encountered.
|
|
46
|
+
this.sites.forEach((site) => {
|
|
47
|
+
const hostnames = site.hostName
|
|
48
|
+
.replace(/\s/g, '')
|
|
49
|
+
.toLocaleLowerCase()
|
|
50
|
+
.split(DELIMITERS);
|
|
51
|
+
hostnames.forEach((hostname) => {
|
|
52
|
+
if (!map.has(hostname)) {
|
|
53
|
+
map.set(hostname, site);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
// Now order by specificity.
|
|
58
|
+
// This equivalates to sorting from longest to shortest with the assumption
|
|
59
|
+
// that your match is less specific as wildcards are introduced.
|
|
60
|
+
// E.g. order.eu.site.com → *.eu.site.com → *.site.com → *
|
|
61
|
+
// In case of a tie (e.g. *.site.com vs i.site.com), prefer one with less wildcards.
|
|
62
|
+
return new Map(Array.from(map).sort((a, b) => {
|
|
63
|
+
if (a[0].length === b[0].length) {
|
|
64
|
+
return (a[0].match(/\*/g) || []).length - (b[0].match(/\*/g) || []).length;
|
|
65
|
+
}
|
|
66
|
+
return b[0].length - a[0].length;
|
|
67
|
+
}));
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// b[0].match(/\*/g) || []).length
|
|
71
|
+
matchesPattern(hostname, pattern) {
|
|
72
|
+
// dots should be treated as chars
|
|
73
|
+
// stars should be treated as wildcards
|
|
74
|
+
const regExpPattern = pattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
|
|
75
|
+
const regExp = new RegExp(`^${regExpPattern}$`, 'gi');
|
|
76
|
+
return !!hostname.match(regExp);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.SiteResolver = SiteResolver;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SITE_PREFIX = void 0;
|
|
4
|
+
exports.getSiteRewrite = getSiteRewrite;
|
|
5
|
+
exports.getSiteRewriteData = getSiteRewriteData;
|
|
6
|
+
exports.normalizeSiteRewrite = normalizeSiteRewrite;
|
|
7
|
+
exports.SITE_PREFIX = '_site_';
|
|
8
|
+
/**
|
|
9
|
+
* Get a site rewrite path for given pathname
|
|
10
|
+
* @param {string} pathname the pathname
|
|
11
|
+
* @param {SiteRewriteData} data the site data to include in the rewrite
|
|
12
|
+
* @returns {string} the rewrite path
|
|
13
|
+
*/
|
|
14
|
+
function getSiteRewrite(pathname, data) {
|
|
15
|
+
const path = pathname.startsWith('/') ? pathname : '/' + pathname;
|
|
16
|
+
return `/${exports.SITE_PREFIX}${data.siteName}${path}`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get site data from the rewrite path
|
|
20
|
+
* @param {string} pathname the pathname
|
|
21
|
+
* @param {string} defaultSiteName the default site name
|
|
22
|
+
* @returns {SiteRewriteData} the site data from the rewrite
|
|
23
|
+
*/
|
|
24
|
+
function getSiteRewriteData(pathname, defaultSiteName) {
|
|
25
|
+
const data = {
|
|
26
|
+
siteName: defaultSiteName,
|
|
27
|
+
};
|
|
28
|
+
const path = pathname.endsWith('/') ? pathname : pathname + '/';
|
|
29
|
+
const result = path.match(`${exports.SITE_PREFIX}(.*?)\\/`);
|
|
30
|
+
if (result && result[1] !== '') {
|
|
31
|
+
data.siteName = result[1];
|
|
32
|
+
}
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalize a site rewrite path (remove site data)
|
|
37
|
+
* @param {string} pathname the pathname
|
|
38
|
+
* @returns {string} the pathname with site data removed
|
|
39
|
+
*/
|
|
40
|
+
function normalizeSiteRewrite(pathname) {
|
|
41
|
+
const result = pathname.match(`${exports.SITE_PREFIX}.*?(?:\\/|$)`);
|
|
42
|
+
return result === null ? pathname : pathname.replace(result[0], '');
|
|
43
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryParseEnvValue = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Method to parse JSON-formatted environment variables
|
|
6
|
+
* @param {string} envValue - can be undefined when providing values via process.env
|
|
7
|
+
* @param {T} defaultValue - default value
|
|
8
|
+
* @returns {T | string} parsed value
|
|
9
|
+
*/
|
|
10
|
+
const tryParseEnvValue = (envValue, defaultValue) => {
|
|
11
|
+
if (!envValue) {
|
|
12
|
+
return defaultValue;
|
|
13
|
+
}
|
|
14
|
+
if (envValue.startsWith('{') && envValue.endsWith('}')) {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(envValue);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
console.warn('Parsing of env variable failed');
|
|
20
|
+
console.warn(`Attempted to parse ${envValue}`);
|
|
21
|
+
return defaultValue;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return defaultValue;
|
|
25
|
+
};
|
|
26
|
+
exports.tryParseEnvValue = tryParseEnvValue;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tryParseEnvValue = exports.mergeURLSearchParams = exports.escapeNonSpecialQuestionMarks = exports.areURLSearchParamsEqual = exports.isRegexOrUrl = exports.getAllowedOriginsFromEnv = exports.enforceCors = exports.isTimeoutError = exports.isAbsoluteUrl = exports.resolveUrl = exports.isServer = void 0;
|
|
7
|
+
var is_server_1 = require("./is-server");
|
|
8
|
+
Object.defineProperty(exports, "isServer", { enumerable: true, get: function () { return __importDefault(is_server_1).default; } });
|
|
9
|
+
var utils_1 = require("./utils");
|
|
10
|
+
Object.defineProperty(exports, "resolveUrl", { enumerable: true, get: function () { return utils_1.resolveUrl; } });
|
|
11
|
+
Object.defineProperty(exports, "isAbsoluteUrl", { enumerable: true, get: function () { return utils_1.isAbsoluteUrl; } });
|
|
12
|
+
Object.defineProperty(exports, "isTimeoutError", { enumerable: true, get: function () { return utils_1.isTimeoutError; } });
|
|
13
|
+
Object.defineProperty(exports, "enforceCors", { enumerable: true, get: function () { return utils_1.enforceCors; } });
|
|
14
|
+
Object.defineProperty(exports, "getAllowedOriginsFromEnv", { enumerable: true, get: function () { return utils_1.getAllowedOriginsFromEnv; } });
|
|
15
|
+
Object.defineProperty(exports, "isRegexOrUrl", { enumerable: true, get: function () { return utils_1.isRegexOrUrl; } });
|
|
16
|
+
Object.defineProperty(exports, "areURLSearchParamsEqual", { enumerable: true, get: function () { return utils_1.areURLSearchParamsEqual; } });
|
|
17
|
+
Object.defineProperty(exports, "escapeNonSpecialQuestionMarks", { enumerable: true, get: function () { return utils_1.escapeNonSpecialQuestionMarks; } });
|
|
18
|
+
Object.defineProperty(exports, "mergeURLSearchParams", { enumerable: true, get: function () { return utils_1.mergeURLSearchParams; } });
|
|
19
|
+
var env_1 = require("./env");
|
|
20
|
+
Object.defineProperty(exports, "tryParseEnvValue", { enumerable: true, get: function () { return env_1.tryParseEnvValue; } });
|