@salesforce/pwa-kit-runtime 3.9.0-nightly-20241206080208 → 4.0.0-extensibility-preview.0
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/package.json +9 -7
- package/ssr/server/build-remote-server.d.ts +211 -0
- package/ssr/server/build-remote-server.d.ts.map +1 -0
- package/ssr/server/build-remote-server.js +11 -78
- package/ssr/server/build-remote-server.test.js +139 -72
- package/ssr/server/constants.d.ts +18 -0
- package/ssr/server/constants.d.ts.map +1 -0
- package/ssr/server/constants.js +1 -2
- package/ssr/server/express.d.ts +17 -0
- package/ssr/server/express.d.ts.map +1 -0
- package/ssr/server/express.test.js +7 -91
- package/ssr/server/test_fixtures/extensions/another-extension/setup-server.d.ts +5 -0
- package/ssr/server/test_fixtures/extensions/another-extension/setup-server.d.ts.map +1 -0
- package/ssr/server/test_fixtures/extensions/another-extension/setup-server.js +19 -0
- package/ssr/server/test_fixtures/extensions/extension-with-bad-setup-server/setup-server.d.ts +5 -0
- package/ssr/server/test_fixtures/extensions/extension-with-bad-setup-server/setup-server.d.ts.map +1 -0
- package/ssr/server/test_fixtures/extensions/extension-with-bad-setup-server/setup-server.js +16 -0
- package/ssr/server/test_fixtures/extensions/extension-with-setup-server-no-default-export/setup-server.d.ts +2 -0
- package/ssr/server/test_fixtures/extensions/extension-with-setup-server-no-default-export/setup-server.d.ts.map +1 -0
- package/ssr/server/test_fixtures/extensions/extension-with-setup-server-no-default-export/setup-server.js +17 -0
- package/ssr/server/test_fixtures/extensions/extension-without-setup-server/random-file.d.ts +1 -0
- package/ssr/server/test_fixtures/extensions/extension-without-setup-server/random-file.d.ts.map +1 -0
- package/ssr/server/test_fixtures/extensions/extension-without-setup-server/random-file.js +7 -0
- package/ssr/server/test_fixtures/extensions/test-extension/setup-server.d.ts +5 -0
- package/ssr/server/test_fixtures/extensions/test-extension/setup-server.d.ts.map +1 -0
- package/ssr/server/test_fixtures/extensions/test-extension/setup-server.js +28 -0
- package/ssr/server/test_fixtures/main.d.ts +1 -0
- package/ssr/server/test_fixtures/main.d.ts.map +1 -0
- package/ssr/server/test_fixtures/server-renderer.d.ts +6 -0
- package/ssr/server/test_fixtures/server-renderer.d.ts.map +1 -0
- package/ssr/server/test_fixtures/worker.d.ts +1 -0
- package/ssr/server/test_fixtures/worker.d.ts.map +1 -0
- package/utils/logger-factory.d.ts +58 -0
- package/utils/logger-factory.d.ts.map +1 -0
- package/utils/logger-instance.d.ts +3 -0
- package/utils/logger-instance.d.ts.map +1 -0
- package/utils/middleware/index.d.ts +2 -0
- package/utils/middleware/index.d.ts.map +1 -0
- package/utils/middleware/security.d.ts +2 -0
- package/utils/middleware/security.d.ts.map +1 -0
- package/utils/morgan-stream.d.ts +11 -0
- package/utils/morgan-stream.d.ts.map +1 -0
- package/utils/ssr-cache.d.ts +112 -0
- package/utils/ssr-cache.d.ts.map +1 -0
- package/utils/ssr-config.client.d.ts +2 -0
- package/utils/ssr-config.client.d.ts.map +1 -0
- package/utils/ssr-config.client.test.js +4 -0
- package/utils/ssr-config.d.ts +3 -0
- package/utils/ssr-config.d.ts.map +1 -0
- package/utils/ssr-config.server.d.ts +2 -0
- package/utils/ssr-config.server.d.ts.map +1 -0
- package/utils/ssr-namespace-paths.d.ts +7 -0
- package/utils/ssr-namespace-paths.d.ts.map +1 -0
- package/utils/ssr-proxying.d.ts +173 -0
- package/utils/ssr-proxying.d.ts.map +1 -0
- package/utils/ssr-request-processing.d.ts +90 -0
- package/utils/ssr-request-processing.d.ts.map +1 -0
- package/utils/ssr-server/cached-response.d.ts +62 -0
- package/utils/ssr-server/cached-response.d.ts.map +1 -0
- package/utils/ssr-server/configure-proxy.d.ts +5 -0
- package/utils/ssr-server/configure-proxy.d.ts.map +1 -0
- package/utils/ssr-server/metrics-sender.d.ts +83 -0
- package/utils/ssr-server/metrics-sender.d.ts.map +1 -0
- package/utils/ssr-server/metrics-sender.js +1 -1
- package/utils/ssr-server/outgoing-request-hook.d.ts +2 -0
- package/utils/ssr-server/outgoing-request-hook.d.ts.map +1 -0
- package/utils/ssr-server/parse-end-parameters.d.ts +2 -0
- package/utils/ssr-server/parse-end-parameters.d.ts.map +1 -0
- package/utils/ssr-server/process-express-response.d.ts +3 -0
- package/utils/ssr-server/process-express-response.d.ts.map +1 -0
- package/utils/ssr-server/process-lambda-response.d.ts +2 -0
- package/utils/ssr-server/process-lambda-response.d.ts.map +1 -0
- package/utils/ssr-server/update-global-agent-options.d.ts +3 -0
- package/utils/ssr-server/update-global-agent-options.d.ts.map +1 -0
- package/utils/ssr-server/utils.d.ts +13 -0
- package/utils/ssr-server/utils.d.ts.map +1 -0
- package/utils/ssr-server/wrap-response-write.d.ts +2 -0
- package/utils/ssr-server/wrap-response-write.d.ts.map +1 -0
- package/utils/ssr-server.d.ts +11 -0
- package/utils/ssr-server.d.ts.map +1 -0
- package/utils/ssr-shared.d.ts +42 -0
- package/utils/ssr-shared.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-config.server.d.ts","sourceRoot":"","sources":["../../src/utils/ssr-config.server.js"],"names":[],"mappings":"AA6CO,0CAqDN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const ssrNamespace: string;
|
|
2
|
+
export const proxyBasePath: string;
|
|
3
|
+
export const bundleBasePath: string;
|
|
4
|
+
export const cachingBasePath: string;
|
|
5
|
+
export const healthCheckPath: string;
|
|
6
|
+
export const slasPrivateProxyPath: string;
|
|
7
|
+
//# sourceMappingURL=ssr-namespace-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-namespace-paths.d.ts","sourceRoot":"","sources":["../../src/utils/ssr-namespace-paths.js"],"names":[],"mappings":"AAoCA,kCAA2C;AAE3C,mCAAgE;AAChE,oCAAkE;AAClE,qCAAoE;AACpE,qCAAmE;AACnE,0CAAsF"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export const X_PROXY_REQUEST_URL: "x-proxy-request-url";
|
|
2
|
+
export const X_MOBIFY_REQUEST_CLASS: "x-mobify-request-class";
|
|
3
|
+
export const MAX_URL_LENGTH_BYTES: 8192;
|
|
4
|
+
/**
|
|
5
|
+
* This class provides a representation of HTTP request or response
|
|
6
|
+
* headers, that operates in the same way in multiple contexts
|
|
7
|
+
* (i.e. within the Express app as well as the request-processor).
|
|
8
|
+
*
|
|
9
|
+
* Within a Headers instance, headers are referenced using lower-case
|
|
10
|
+
* names. Use getHeader to access the value for a header. If there
|
|
11
|
+
* are multiple values, this will return the first value. This class
|
|
12
|
+
* internally supports round-trip preservation of multi-value headers,
|
|
13
|
+
* but does not yet provide a way to access them.
|
|
14
|
+
*/
|
|
15
|
+
export class Headers {
|
|
16
|
+
/**
|
|
17
|
+
* Construct a Headers object from either an AWS Lambda Event headers
|
|
18
|
+
* object, or an http.IncomingMessage headers object.
|
|
19
|
+
*
|
|
20
|
+
* Project code should never need to call this constructor.
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @param headers {Object} the input headers
|
|
24
|
+
* @param format {String} either 'http' or 'aws'
|
|
25
|
+
*/
|
|
26
|
+
private constructor();
|
|
27
|
+
httpFormat: boolean;
|
|
28
|
+
headers: {};
|
|
29
|
+
_modified: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Return true if and only if any set or delete methods were called on
|
|
32
|
+
* this instance after construction. This does not actually test if
|
|
33
|
+
* the headers values have been changed, just whether any mutating
|
|
34
|
+
* methods have been called.
|
|
35
|
+
* @returns {Boolean}
|
|
36
|
+
*/
|
|
37
|
+
get modified(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Return an array of the header keys (all lower-case)
|
|
40
|
+
*/
|
|
41
|
+
keys(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Get the value of the set-cookie header(s), returning an array
|
|
44
|
+
* of strings. Always returns an array, even if it's empty.
|
|
45
|
+
*/
|
|
46
|
+
getSetCookie(): any;
|
|
47
|
+
/**
|
|
48
|
+
* Set the value of the set-cookie header(s)
|
|
49
|
+
* @param values {string[]}
|
|
50
|
+
*/
|
|
51
|
+
setSetCookie(values: string[]): void;
|
|
52
|
+
/**
|
|
53
|
+
* Return the FIRST value of the header with the given key.
|
|
54
|
+
* This is for single-value headers only: Location, Access-Control-*, etc
|
|
55
|
+
* If the header is not present, returns undefined.
|
|
56
|
+
* @param key {String} header name
|
|
57
|
+
*/
|
|
58
|
+
getHeader(key: string): any;
|
|
59
|
+
/**
|
|
60
|
+
* Set the value of the header with the given key. This is for single-
|
|
61
|
+
* value headers only (see getHeader). Setting the value removes ALL other
|
|
62
|
+
* values for the given key.
|
|
63
|
+
* @param key {String} header name
|
|
64
|
+
* @param value {String} header value
|
|
65
|
+
*/
|
|
66
|
+
setHeader(key: string, value: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove any header with the given key
|
|
69
|
+
* @param key
|
|
70
|
+
*/
|
|
71
|
+
deleteHeader(key: any): void;
|
|
72
|
+
/**
|
|
73
|
+
* Return the headers in AWS (Lambda event) format.
|
|
74
|
+
*
|
|
75
|
+
* Project code should never need to use this method.
|
|
76
|
+
*/
|
|
77
|
+
toAWSFormat(): {};
|
|
78
|
+
/**
|
|
79
|
+
* Return the headers in Express (http.IncomingMessage) format.
|
|
80
|
+
*
|
|
81
|
+
* RFC2616 allows some flexibility in how multiple values are
|
|
82
|
+
* combined into a single header value. We separate with ', '
|
|
83
|
+
* rather than just ',' to maintain previous behaviour.
|
|
84
|
+
*
|
|
85
|
+
* Project code should never need to use this method.
|
|
86
|
+
*/
|
|
87
|
+
toHTTPFormat(): {};
|
|
88
|
+
/**
|
|
89
|
+
* Return the headers in the same format (aws or http) that was
|
|
90
|
+
* used to construct them.
|
|
91
|
+
*
|
|
92
|
+
* Project code should never need to use this method.
|
|
93
|
+
*/
|
|
94
|
+
toObject(): {};
|
|
95
|
+
}
|
|
96
|
+
export function rfc1123(date: Date): string;
|
|
97
|
+
export function cookieAsString(cookie: any): string;
|
|
98
|
+
export function parseHost(host: string): ParsedHost;
|
|
99
|
+
export function rewriteDomain(domain: any, appHostname: any, targetHost: any): any;
|
|
100
|
+
export function rewriteSetCookies({ appHostname, setCookies, targetHost, logging }: string): any;
|
|
101
|
+
export function rewriteProxyResponseHeaders({ appHostname, caching, headers, headerFormat, proxyPath, requestUrl, statusCode, targetProtocol, targetHost, appProtocol, logging }: string): Object;
|
|
102
|
+
/**
|
|
103
|
+
* List of x- headers that are removed from proxied requests.
|
|
104
|
+
* @private
|
|
105
|
+
* @type {string[]}
|
|
106
|
+
*/
|
|
107
|
+
export const X_HEADERS_TO_REMOVE_PROXY: string[];
|
|
108
|
+
/**
|
|
109
|
+
* List of x- headers that are removed from origin requests.
|
|
110
|
+
* @private
|
|
111
|
+
* @type {string[]}
|
|
112
|
+
*/
|
|
113
|
+
export const X_HEADERS_TO_REMOVE_ORIGIN: string[];
|
|
114
|
+
/**
|
|
115
|
+
* X-header key and values to add to proxied requests
|
|
116
|
+
* @private
|
|
117
|
+
* @type {Object}
|
|
118
|
+
*/
|
|
119
|
+
export const X_HEADERS_TO_ADD: Object;
|
|
120
|
+
/**
|
|
121
|
+
* List of headers that are allowed for a caching proxy request.
|
|
122
|
+
* This must match the allowlist that CloudFront uses for a
|
|
123
|
+
* CacheBehavior that does not pass cookies and is not configured
|
|
124
|
+
* to cache based on headers.
|
|
125
|
+
*
|
|
126
|
+
* This is a map from lower-case header name to 'true' - we use an object
|
|
127
|
+
* to make lookups fast, since this mapping might be used for many requests.
|
|
128
|
+
*
|
|
129
|
+
* Also see what is configured in the SSR Manager (ssr-infrastructure repo),
|
|
130
|
+
* in the CloudFront configuration. This list is a superset of that list,
|
|
131
|
+
* since the proxying code must also allow headers that it adds, such as
|
|
132
|
+
* Host, Origin, etc.
|
|
133
|
+
*
|
|
134
|
+
* See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/header-caching.html
|
|
135
|
+
* See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Cookies.html
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
export const ALLOWED_CACHING_PROXY_REQUEST_HEADERS: {
|
|
140
|
+
accept: boolean;
|
|
141
|
+
'accept-charset': boolean;
|
|
142
|
+
'accept-encoding': boolean;
|
|
143
|
+
'accept-language': boolean;
|
|
144
|
+
authorization: boolean;
|
|
145
|
+
range: boolean;
|
|
146
|
+
host: boolean;
|
|
147
|
+
origin: boolean;
|
|
148
|
+
'if-match': boolean;
|
|
149
|
+
'if-modified-since': boolean;
|
|
150
|
+
'if-none-match': boolean;
|
|
151
|
+
'if-range': boolean;
|
|
152
|
+
'if-unmodified-since': boolean;
|
|
153
|
+
};
|
|
154
|
+
export function rewriteProxyRequestHeaders({ caching, headers, headerFormat, targetProtocol, targetHost, logging }: boolean): Object;
|
|
155
|
+
export type ParsedHost = {
|
|
156
|
+
/**
|
|
157
|
+
* The host (10.10.10.10:port), which includes the port (if any)
|
|
158
|
+
*/
|
|
159
|
+
host: string;
|
|
160
|
+
/**
|
|
161
|
+
* The hostname (10.10.10.10), which excludes the port
|
|
162
|
+
*/
|
|
163
|
+
hostname: string;
|
|
164
|
+
/**
|
|
165
|
+
* The host's port
|
|
166
|
+
*/
|
|
167
|
+
port: string;
|
|
168
|
+
/**
|
|
169
|
+
* Whether the hostname is an IP or localhost
|
|
170
|
+
*/
|
|
171
|
+
isIPOrLocalhost: boolean;
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=ssr-proxying.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-proxying.d.ts","sourceRoot":"","sources":["../../src/utils/ssr-proxying.js"],"names":[],"mappings":"AA8BA,wDAAwD;AACxD,8DAA8D;AAC9D,wCAAwC;AAExC;;;;;;;;;;GAUG;AACH;IAkCI;;;;;;;;;OASG;IACH,sBA4BC;IAxBG,oBAAmC;IAInC,YAAiB;IAmBjB,mBAAsB;IAG1B;;;;;;OAMG;IACH,wBAEC;IAED;;OAEG;IACH,iBAEC;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,qBAFkB,MAAM,EAAE,QAYzB;IAED;;;;;OAKG;IACH,4BAOC;IAED;;;;;;OAMG;IACH,4CAIC;IAED;;;OAGG;IACH,6BAIC;IAED;;;;OAIG;IACH,kBAgBC;IAED;;;;;;;;OAQG;IACH,mBAWC;IAED;;;;;OAKG;IACH,eAEC;CACJ;AA+BM,8BAHS,IAAI,UAiBnB;AAOM,oDA2BN;AAkFM,yCAFK,UAAU,CA0CrB;AAGM,mFAyCN;AAeM,iGA6BN;AAuCM,2LAFM,MAAM,CA4IlB;AAED;;;;GAIG;AACH,wCAFU,MAAM,EAAE,CAEuE;AAEzF;;;;GAIG;AACH,yCAFU,MAAM,EAAE,CAQjB;AAED;;;;GAIG;AACH,+BAFU,MAAM,CAIf;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;;;;;;;;;;;;;;EAsBC;AAuBM,8HAFM,MAAM,CAiGlB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class that represents and can manipulate a parsed
|
|
3
|
+
* query string as a subclass of Array.
|
|
4
|
+
*
|
|
5
|
+
* The values in the Array are objects.
|
|
6
|
+
*
|
|
7
|
+
* The values in the Array are objects with 'key', 'originalKey'
|
|
8
|
+
* 'value' and 'originalValue'. The 'key' is decoded (from %-encoding)
|
|
9
|
+
* and lowercased.
|
|
10
|
+
* The 'originalKey' is as it originally occurred in the query string. It's
|
|
11
|
+
* not decoded or lowercased.
|
|
12
|
+
* The 'originalValue' is as it originally occurred in the query string. It's
|
|
13
|
+
* not decoded.
|
|
14
|
+
* The 'value' is decoded (from %-encoding).
|
|
15
|
+
*
|
|
16
|
+
* If the query parameter is 'key=value', all fields are set.
|
|
17
|
+
* If the query parameter is 'key=' then 'value' and 'originalValue' will be
|
|
18
|
+
* the empty string.
|
|
19
|
+
* If the query parameter is just 'key' then 'value' and 'originalValue' will
|
|
20
|
+
* be null.
|
|
21
|
+
* If the query parameter is empty (double-&) then 'key' and 'originalKey' will
|
|
22
|
+
* be '', 'value' and 'originalValue' will be null.
|
|
23
|
+
*
|
|
24
|
+
* It's important that we PRESERVE the order of the parameters
|
|
25
|
+
* because some projects rely on it. The 'querystring' module
|
|
26
|
+
* assigns values to the resulting object in the order that it
|
|
27
|
+
* encounters them in the input string. Since ES2015 there are
|
|
28
|
+
* specific rules defining the order of properties, and apart
|
|
29
|
+
* from one particular case the order is chronological, which is
|
|
30
|
+
* what we want. The order of properties in an object depends on
|
|
31
|
+
* the type of the included properties and their values. Unfortunately,
|
|
32
|
+
* integer indices always come first, and the rules state that
|
|
33
|
+
* "an integer index is a string that, if converted to a 53-bit
|
|
34
|
+
* non-negative integer and back is the same value". This means that
|
|
35
|
+
* any parameter whose key is an integer index will appear out of
|
|
36
|
+
* order in the result. Thus we can't use the 'querystring' module.
|
|
37
|
+
*/
|
|
38
|
+
export class QueryParameters {
|
|
39
|
+
/**
|
|
40
|
+
* Construct a new QueryParameters from the output of
|
|
41
|
+
* any filtering or mapping done on another QueryParameters
|
|
42
|
+
* instance's 'parameters' array.
|
|
43
|
+
* @return {QueryParameters}
|
|
44
|
+
*/
|
|
45
|
+
static from(...args: any[]): QueryParameters;
|
|
46
|
+
constructor(querystring: any);
|
|
47
|
+
_parameters: any;
|
|
48
|
+
/**
|
|
49
|
+
* Access the array of parameters owned by this QueryParameters
|
|
50
|
+
* object.
|
|
51
|
+
*/
|
|
52
|
+
get parameters(): any;
|
|
53
|
+
/**
|
|
54
|
+
* Delete any query parameters with the given key.
|
|
55
|
+
* Key names are matched in a case-insensitive way.
|
|
56
|
+
* @param key {String}
|
|
57
|
+
* @returns {Boolean} true if a parameter was deleted,
|
|
58
|
+
* false if not.
|
|
59
|
+
*/
|
|
60
|
+
deleteByKey(key: string): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Add a query parameter to the array (at the end)
|
|
63
|
+
* @param key {String} Parameter name (key)
|
|
64
|
+
* @param value {String} Parameter value (may be
|
|
65
|
+
* omitted or set to null to store only a key).
|
|
66
|
+
*/
|
|
67
|
+
appendParameter(key: string, value?: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* An Array of all the keys (as lowercased, unescaped strings)
|
|
70
|
+
*/
|
|
71
|
+
get keys(): any;
|
|
72
|
+
/**
|
|
73
|
+
* Return a querystring built from the parameters in this
|
|
74
|
+
* instance, using the originalKey and originalValue properties
|
|
75
|
+
* of each parameter.
|
|
76
|
+
*
|
|
77
|
+
* Any strings that *this* class escapes will be correctly encoded (using
|
|
78
|
+
* %20 for space). There is an issue with input querystrings that
|
|
79
|
+
* are supposed to be encoded correctly, but which contain space
|
|
80
|
+
* characters (in either the key or the value). We don't want to convert
|
|
81
|
+
* them on input because that might cause the querystring as represented
|
|
82
|
+
* by this class to differ from the actual input. Instead, we define the
|
|
83
|
+
* behaviour of this function such that it will rebuild the querystring
|
|
84
|
+
* exactly as input EXCEPT that any spaces will be +-encoded.
|
|
85
|
+
*
|
|
86
|
+
* @return {string}
|
|
87
|
+
*/
|
|
88
|
+
toString(): string;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ssr-request-processing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-request-processing.d.ts","sourceRoot":"","sources":["../../src/utils/ssr-request-processing.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH;IA8BI;;;;;OAKG;IACH,6BAFY,eAAe,CAM1B;IAvCD,8BAmBC;IAjBO,iBAAqB;IAmB7B;;;OAGG;IACH,sBAEC;IAcD;;;;;;OAMG;IACH,kCAMC;IAED;;;;;OAKG;IACH,mDAOC;IAED;;OAEG;IACH,gBAEC;IAED;;;;;;;;;;;;;;;OAeG;IACH,YAFY,MAAM,CASjB;CACJ"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export class CachedResponse {
|
|
2
|
+
/**
|
|
3
|
+
* Construct a CachedResponse from a cache entry. Project
|
|
4
|
+
* code should never need to call this.
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
private constructor();
|
|
8
|
+
_found: boolean;
|
|
9
|
+
_key: any;
|
|
10
|
+
_namespace: any;
|
|
11
|
+
_data: any;
|
|
12
|
+
_metadata: any;
|
|
13
|
+
_expiration: any;
|
|
14
|
+
_req: any;
|
|
15
|
+
_res: any;
|
|
16
|
+
/**
|
|
17
|
+
* Send this response
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private _send;
|
|
21
|
+
/**
|
|
22
|
+
* Get the key used to retrieve this CachedResponse
|
|
23
|
+
*/
|
|
24
|
+
get key(): any;
|
|
25
|
+
/**
|
|
26
|
+
* Get the namespace used to retrieve this CachedResponse
|
|
27
|
+
*/
|
|
28
|
+
get namespace(): any;
|
|
29
|
+
/**
|
|
30
|
+
* true if this instance represents a found entry in the cache,
|
|
31
|
+
* false if no entry was found.
|
|
32
|
+
* @returns {Boolean}
|
|
33
|
+
*/
|
|
34
|
+
get found(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The status code of this CachedResponse (as a Number)
|
|
37
|
+
* @returns {Number}
|
|
38
|
+
*/
|
|
39
|
+
get status(): number;
|
|
40
|
+
/**
|
|
41
|
+
* A reference to the data for the response, which will
|
|
42
|
+
* be a Buffer, or undefined if the response is empty.
|
|
43
|
+
* @returns {Buffer|undefined}
|
|
44
|
+
*/
|
|
45
|
+
get data(): Buffer | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* A reference to the headers for the response. The value is
|
|
48
|
+
* a plain JS object containing the headers in the format used
|
|
49
|
+
* by ExpressJS: keys are always lower-case, values are strings
|
|
50
|
+
* except for set-cookie, which is an array of strings.
|
|
51
|
+
* @returns {{}}
|
|
52
|
+
*/
|
|
53
|
+
get headers(): {};
|
|
54
|
+
/**
|
|
55
|
+
* Get the date & time when this entry would expire. If this
|
|
56
|
+
* instance represents an entry that was not found, returns
|
|
57
|
+
* undefined.
|
|
58
|
+
* @returns {Date|undefined}
|
|
59
|
+
*/
|
|
60
|
+
get expiration(): Date | undefined;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=cached-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-response.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/cached-response.js"],"names":[],"mappings":"AAQA;IACI;;;;OAIG;IACH,sBASC;IARG,gBAA2B;IAC3B,UAAqB;IACrB,gBAAiC;IACjC,WAAuB;IACvB,eAAqC;IACrC,iBAAmC;IACnC,UAAe;IACf,UAAe;IAGnB;;;OAGG;IACH,cAaC;IAED;;OAEG;IACH,eAEC;IAED;;OAEG;IACH,qBAEC;IAED;;;;OAIG;IACH,qBAEC;IAED;;;OAGG;IACH,qBAEC;IAED;;;;OAIG;IACH,+BAEC;IAED;;;;;;OAMG;IACH,kBAEC;IAED;;;;;OAKG;IACH,mCAEC;CACJ"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const ALLOWED_CACHING_PROXY_REQUEST_METHODS: string[];
|
|
2
|
+
export function applyProxyRequestHeaders({ proxyRequest, incomingRequest, caching, logging, proxyPath, targetHost, targetProtocol }: http.ClientRequest): void;
|
|
3
|
+
export function configureProxy({ appHostname, proxyPath, targetProtocol, targetHost, appProtocol, caching }: string): middleware;
|
|
4
|
+
export function configureProxyConfigs(appHostname: string, appProtocol: string): void;
|
|
5
|
+
//# sourceMappingURL=configure-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-proxy.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/configure-proxy.js"],"names":[],"mappings":"AAaA,6DAA+E;AAkCxE,+JAwDN;AAmBM,iIAgKN;AAWM,sFAwBN"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A class that will handle asynchronous sending of CloudWatch
|
|
3
|
+
* metrics.
|
|
4
|
+
*
|
|
5
|
+
* Use MetricsSender.getSender() to get the singleton instance.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export class MetricsSender {
|
|
10
|
+
_CW: import("aws-sdk/clients/cloudwatch") | null;
|
|
11
|
+
_queue: any[];
|
|
12
|
+
/**
|
|
13
|
+
* Return the number of metrics waiting to be sent
|
|
14
|
+
* @returns {number}
|
|
15
|
+
*/
|
|
16
|
+
get queueLength(): number;
|
|
17
|
+
/**
|
|
18
|
+
* Create a CloudWatch AWS SDK client, or return a falsy value
|
|
19
|
+
* if this MetricsSender is not actually sending metrics.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
* @returns {CloudWatch|null}
|
|
23
|
+
*/
|
|
24
|
+
private _setup;
|
|
25
|
+
/**
|
|
26
|
+
* Call putMetricData as needed, including retrying.
|
|
27
|
+
*
|
|
28
|
+
* @private
|
|
29
|
+
* @param {CloudWatch} cw - Cloudwatch client
|
|
30
|
+
* @param {Array} metrics - Array of metrics to send
|
|
31
|
+
* @returns {Promise.<*>} resolved when the metrics are sent
|
|
32
|
+
* (or when they can't be sent).
|
|
33
|
+
*/
|
|
34
|
+
private _putMetricData;
|
|
35
|
+
/**
|
|
36
|
+
* Send any queued metrics. Returns a Promise that resolves when
|
|
37
|
+
* all sending is done.
|
|
38
|
+
* The Promise will never reject.
|
|
39
|
+
*/
|
|
40
|
+
flush(): Promise<void | any[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Add one or more custom metric values to the queue of those waiting
|
|
43
|
+
* to be sent. This function supports simple name-and-value metrics.
|
|
44
|
+
* It doesn't support more complex CloudWatch types.
|
|
45
|
+
*
|
|
46
|
+
* A metric is an object with at least 'name' (string) and 'value'
|
|
47
|
+
* (number, defaults to 0). It may also optionally include 'timestamp'
|
|
48
|
+
* (defaults to the time of the call to send()), and 'unit', which
|
|
49
|
+
* must be one of Seconds, Microseconds, Milliseconds, Bytes, Kilobytes,
|
|
50
|
+
* Megabytes, Gigabytes, Terabytes, Bits, Kilobits, Megabits, Gigabits,
|
|
51
|
+
* Terabits, Percent, Count, Bytes/Second, Kilobytes/Second,
|
|
52
|
+
* Megabytes/Second, Gigabytes/Second, Terabytes/Second,
|
|
53
|
+
* Bits/Second, Kilobits/Second, Megabits/Second, Gigabits/Second,
|
|
54
|
+
* Terabits/Second, Count/Second or None (defaults to 'Count').
|
|
55
|
+
* There may also be a 'dimensions'
|
|
56
|
+
* object, which has dimension names as keys and dimension
|
|
57
|
+
* values as values.
|
|
58
|
+
*
|
|
59
|
+
* If called in the local development server, the metric information
|
|
60
|
+
* will be logged, but the code will not actually emit anything. This
|
|
61
|
+
* can be overridden by defining the SEND_CW_METRICS environment
|
|
62
|
+
* variable, for testing.
|
|
63
|
+
*
|
|
64
|
+
* The metrics are added to an internal queue so that they can be
|
|
65
|
+
* batched up to send more efficiently. They are only sent when
|
|
66
|
+
* flush() is called.
|
|
67
|
+
*
|
|
68
|
+
* @private
|
|
69
|
+
* @param metrics {Array<Object>} - array of name, value objects
|
|
70
|
+
*/
|
|
71
|
+
private send;
|
|
72
|
+
}
|
|
73
|
+
export namespace MetricsSender {
|
|
74
|
+
const _override: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Get the singleton MetricsSender
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @returns {MetricsSender}
|
|
80
|
+
*/
|
|
81
|
+
function getSender(): MetricsSender;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=metrics-sender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics-sender.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/metrics-sender.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH;IAKQ,iDAAe;IAKf,cAAgB;IAGpB;;;OAGG;IACH,0BAEC;IAED;;;;;;OAMG;IACH,eAaC;IAED;;;;;;;;OAQG;IACH,uBA0BC;IAED;;;;OAIG;IACH,+BAyBC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,aA4BC;CACJ;;;IAOD;;;;;OAKG;IACH,oCAKC"}
|
|
@@ -119,7 +119,7 @@ class MetricsSender {
|
|
|
119
119
|
// Send the metrics
|
|
120
120
|
promises.push(this._putMetricData(cw, queue));
|
|
121
121
|
}
|
|
122
|
-
return Promise.all(promises).catch(
|
|
122
|
+
return Promise.all(promises).catch(/* istanbul ignore next */
|
|
123
123
|
err => _loggerInstance.default.warn(`Metrics: error during flush: ${err}`, {
|
|
124
124
|
namespace: 'metrics-sender.flush',
|
|
125
125
|
additionalProperties: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outgoing-request-hook.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/outgoing-request-hook.js"],"names":[],"mappings":"AAiCO,yFAgGN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-end-parameters.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/parse-end-parameters.js"],"names":[],"mappings":"AAMO,oDAwBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-express-response.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/process-express-response.js"],"names":[],"mappings":"AAaO,4DAmCN;AAEM,yEAQN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-lambda-response.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/process-lambda-response.js"],"names":[],"mappings":"AASO,sEA4BN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-global-agent-options.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/update-global-agent-options.js"],"names":[],"mappings":"AAMA,6CAiBC;AAgBM,sEAWN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const verboseProxyLogging: false;
|
|
2
|
+
export function isRemote(): boolean;
|
|
3
|
+
export function getBundleBaseUrl(): string;
|
|
4
|
+
export function setQuiet(quiet: any): void;
|
|
5
|
+
export function isQuiet(): boolean;
|
|
6
|
+
export function localDevLog(...args: any[]): void;
|
|
7
|
+
export function infoLog(...args: any[]): void;
|
|
8
|
+
export function catchAndLog(err: any, context: any): void;
|
|
9
|
+
export function escapeJSText(text: string): string;
|
|
10
|
+
export function getHashForString(text: any): string;
|
|
11
|
+
export function getFullRequestURL(url: any): any;
|
|
12
|
+
export function parseCacheControl(value: string): Object;
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/utils.js"],"names":[],"mappings":"AAkBA,wCAAwC;AAEjC,oCAC0E;AAE1E,2CAEN;AAIM,2CAEN;AAEM,mCAA2B;AAG3B,kDAKN;AAGM,8CAMN;AAMM,0DAaN;AAUM,mDAAmE;AAEnE,oDAIN;AAEM,iDAWN;AAaM,kDAHM,MAAM,CAWlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap-response-write.d.ts","sourceRoot":"","sources":["../../../src/utils/ssr-server/wrap-response-write.js"],"names":[],"mappings":"AAMO,uDA0BN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./ssr-server/cached-response";
|
|
2
|
+
export * from "./ssr-server/configure-proxy";
|
|
3
|
+
export * from "./ssr-server/metrics-sender";
|
|
4
|
+
export * from "./ssr-server/outgoing-request-hook";
|
|
5
|
+
export * from "./ssr-server/parse-end-parameters";
|
|
6
|
+
export * from "./ssr-server/process-express-response";
|
|
7
|
+
export * from "./ssr-server/process-lambda-response";
|
|
8
|
+
export * from "./ssr-server/update-global-agent-options";
|
|
9
|
+
export * from "./ssr-server/utils";
|
|
10
|
+
export * from "./ssr-server/wrap-response-write";
|
|
11
|
+
//# sourceMappingURL=ssr-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-server.d.ts","sourceRoot":"","sources":["../../src/utils/ssr-server.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module progressive-web-sdk/utils/ssr-shared
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Set of valid HTTP protocols for proxying
|
|
7
|
+
* @private
|
|
8
|
+
* @type {string[]}
|
|
9
|
+
*/
|
|
10
|
+
export const validProxyProtocols: string[];
|
|
11
|
+
export function getPackageMobify(): any;
|
|
12
|
+
export function getSSRParameters(): any;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of proxy configs
|
|
15
|
+
* @private
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
export const MAX_PROXY_CONFIGS: number;
|
|
19
|
+
/**
|
|
20
|
+
* An Array of objects with protocol, host, path for each configured proxy.
|
|
21
|
+
* This is *only* usable server-side, where it's set when the SSRServer
|
|
22
|
+
* calls updatePackageMobify.
|
|
23
|
+
*
|
|
24
|
+
* The objects in this array also have the following additional properties,
|
|
25
|
+
* added by configureProxyConfigs in utils/ssr-server:
|
|
26
|
+
* proxyPath is the full /mobify/proxy... path
|
|
27
|
+
* proxy is an http-proxy-middleware function that can be used to proxy a
|
|
28
|
+
* request to a target (it's an ExpressJS function taking req, res and next)
|
|
29
|
+
*
|
|
30
|
+
* @private
|
|
31
|
+
* @type {Array}
|
|
32
|
+
*/
|
|
33
|
+
export let proxyConfigs: any[];
|
|
34
|
+
/**
|
|
35
|
+
* An Array with all the glob patterns from ssrOnly and ssrShared.
|
|
36
|
+
* The names are relative to the 'build' directory.
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
export let ssrFiles: any[];
|
|
40
|
+
export function updatePackageMobify(newValue: Object): void;
|
|
41
|
+
export function reset(): void;
|
|
42
|
+
//# sourceMappingURL=ssr-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-shared.d.ts","sourceRoot":"","sources":["../../src/utils/ssr-shared.js"],"names":[],"mappings":"AASA;;;GAGG;AAOH;;;;GAIG;AACH,kCAFU,MAAM,EAAE,CAEkC;AAM7C,wCAAmD;AACnD,wCAAqF;AAE5F;;;;GAIG;AACH,gCAFU,MAAM,CAEkB;AAElC;;;;;;;;;;;;;GAaG;AACH,+BAA4B;AAE5B;;;;GAIG;AACH,2BAAwB;AAmBjB,8CAFa,MAAM,QAqGzB;AAGM,8BAIN"}
|