@podium/client 5.2.3 → 5.2.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/CHANGELOG.md +14 -0
- package/lib/resolver.content.js +5 -2
- package/lib/resolver.fallback.js +4 -1
- package/lib/utils.js +6 -3
- package/package.json +1 -1
- package/types/utils.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [5.2.5](https://github.com/podium-lib/client/compare/v5.2.4...v5.2.5) (2024-11-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* correctly build asset urls from link headers ([#446](https://github.com/podium-lib/client/issues/446)) ([5a30079](https://github.com/podium-lib/client/commit/5a30079fb47ee15a49ae6ff77348c400df3fe99a))
|
|
7
|
+
|
|
8
|
+
## [5.2.4](https://github.com/podium-lib/client/compare/v5.2.3...v5.2.4) (2024-11-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* reducing logl evel to info on 404 errors ([e6d6d04](https://github.com/podium-lib/client/commit/e6d6d04a4b30729691cafa68521bcfc743c3db64))
|
|
14
|
+
|
|
1
15
|
## [5.2.3](https://github.com/podium-lib/client/compare/v5.2.2...v5.2.3) (2024-11-13)
|
|
2
16
|
|
|
3
17
|
|
package/lib/resolver.content.js
CHANGED
|
@@ -159,7 +159,10 @@ export default class PodletClientContentResolver {
|
|
|
159
159
|
body,
|
|
160
160
|
} = await this.#http.request(uri, reqOptions);
|
|
161
161
|
|
|
162
|
-
const parsedAssetObjects = parseLinkHeaders(
|
|
162
|
+
const parsedAssetObjects = parseLinkHeaders(
|
|
163
|
+
hdrs.link,
|
|
164
|
+
outgoing.manifestUri,
|
|
165
|
+
);
|
|
163
166
|
|
|
164
167
|
const scriptObjects = parsedAssetObjects.filter(
|
|
165
168
|
(asset) => asset instanceof AssetJs,
|
|
@@ -205,7 +208,7 @@ export default class PodletClientContentResolver {
|
|
|
205
208
|
},
|
|
206
209
|
});
|
|
207
210
|
|
|
208
|
-
this.#log.
|
|
211
|
+
this.#log.debug(
|
|
209
212
|
`remote resource responded with non 200 http status code for content - code: ${statusCode} - resource: ${outgoing.name} - url: ${uri}`,
|
|
210
213
|
);
|
|
211
214
|
outgoing.success = true;
|
package/lib/resolver.fallback.js
CHANGED
|
@@ -120,7 +120,10 @@ export default class PodletClientFallbackResolver {
|
|
|
120
120
|
headers: resHeaders,
|
|
121
121
|
} = await this.#http.request(outgoing.fallbackUri, reqOptions);
|
|
122
122
|
|
|
123
|
-
const parsedAssetObjects = parseLinkHeaders(
|
|
123
|
+
const parsedAssetObjects = parseLinkHeaders(
|
|
124
|
+
resHeaders.link,
|
|
125
|
+
outgoing.manifestUri,
|
|
126
|
+
);
|
|
124
127
|
|
|
125
128
|
const scriptObjects = parsedAssetObjects.filter(
|
|
126
129
|
(asset) => asset instanceof AssetJs,
|
package/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssetJs, AssetCss } from '@podium/utils';
|
|
1
|
+
import { AssetJs, AssetCss, uriRelativeToAbsolute } from '@podium/utils';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a header object has a header.
|
|
@@ -75,14 +75,17 @@ export const filterAssets = (scope, assets) => {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
// parse link headers in AssetCss and AssetJs objects
|
|
78
|
-
export const parseLinkHeaders = (headers) => {
|
|
78
|
+
export const parseLinkHeaders = (headers, manifestUri) => {
|
|
79
79
|
const links = [];
|
|
80
80
|
|
|
81
81
|
if (!headers) return links;
|
|
82
82
|
headers.split(',').forEach((link) => {
|
|
83
83
|
const parts = link.split(';');
|
|
84
84
|
const [href, ...rest] = parts;
|
|
85
|
-
const value =
|
|
85
|
+
const value = uriRelativeToAbsolute(
|
|
86
|
+
href.replace(/<|>|"/g, '').trim(),
|
|
87
|
+
manifestUri,
|
|
88
|
+
);
|
|
86
89
|
|
|
87
90
|
const asset = { value };
|
|
88
91
|
for (const key of rest) {
|
package/package.json
CHANGED
package/types/utils.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export function isHeaderDefined(headers: object, header: string): boolean;
|
|
|
2
2
|
export function hasManifestChange(item: object): boolean;
|
|
3
3
|
export function validateIncoming(incoming?: object): boolean;
|
|
4
4
|
export function filterAssets<T extends import("@podium/utils").AssetCss | import("@podium/utils").AssetJs>(scope: "content" | "fallback" | "all", assets: T[]): T[];
|
|
5
|
-
export function parseLinkHeaders(headers: any): any[];
|
|
5
|
+
export function parseLinkHeaders(headers: any, manifestUri: any): any[];
|
|
6
6
|
export function toPreloadAssetObjects(assetObjects: any): any;
|