@podium/client 5.2.0-next.4 → 5.2.0-next.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [5.2.0-next.5](https://github.com/podium-lib/client/compare/v5.2.0-next.4...v5.2.0-next.5) (2024-10-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * replace early hints with header link reading ([4429681](https://github.com/podium-lib/client/commit/44296811441a857fabeaebb583c42da28ec47705))
7
+
1
8
  # [5.2.0-next.4](https://github.com/podium-lib/client/compare/v5.2.0-next.3...v5.2.0-next.4) (2024-09-24)
2
9
 
3
10
 
package/lib/client.js CHANGED
@@ -62,7 +62,6 @@ const MAX_AGE = Infinity;
62
62
  * @property {boolean} [redirectable=false] Set to `true` to allow podlet to respond with a redirect. You need to look for the redirect response from the podlet and return a redirect response to the browser yourself.
63
63
  * @property {import('./resource.js').RequestFilterOptions} [excludeBy] Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
64
64
  * @property {import('./resource.js').RequestFilterOptions} [includeBy] Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
65
- * @property {boolean} [earlyHints=true]
66
65
  */
67
66
 
68
67
  export default class PodiumClient extends EventEmitter {
@@ -213,7 +212,6 @@ export default class PodiumClient extends EventEmitter {
213
212
  httpAgent: this.#options.httpAgent,
214
213
  includeBy: this.#options.includeBy,
215
214
  excludeBy: this.#options.excludeBy,
216
- earlyHints: true,
217
215
  ...options,
218
216
  };
219
217
 
@@ -1,6 +1,6 @@
1
1
  import { PassThrough } from 'stream';
2
2
  import assert from 'assert';
3
- import { toPreloadAssetObjects } from './utils.js';
3
+ import { toPreloadAssetObjects, filterAssets } from './utils.js';
4
4
 
5
5
  /**
6
6
  * @typedef {object} PodiumClientHttpOutgoingOptions
@@ -70,7 +70,6 @@ export default class PodletClientHttpOutgoing extends PassThrough {
70
70
  #uri;
71
71
  #js;
72
72
  #css;
73
- #hintsReceived = false;
74
73
 
75
74
  /**
76
75
  * @constructor
@@ -154,7 +153,9 @@ export default class PodletClientHttpOutgoing extends PassThrough {
154
153
 
155
154
  get js() {
156
155
  // return the internal js value or, fallback to the manifest for backwards compatibility
157
- return this.#js || this.#manifest.js;
156
+ return this.#js && this.#js.length
157
+ ? this.#js
158
+ : filterAssets('content', this.#manifest.js);
158
159
  }
159
160
 
160
161
  set js(value) {
@@ -163,7 +164,9 @@ export default class PodletClientHttpOutgoing extends PassThrough {
163
164
 
164
165
  get css() {
165
166
  // return the internal css value or, fallback to the manifest for backwards compatibility
166
- return this.#css || this.#manifest.css;
167
+ return this.#css && this.#css.length
168
+ ? this.#css
169
+ : filterAssets('content', this.#manifest.css);
167
170
  }
168
171
 
169
172
  set css(value) {
@@ -301,20 +304,6 @@ export default class PodletClientHttpOutgoing extends PassThrough {
301
304
  this.#redirect = value;
302
305
  }
303
306
 
304
- get hintsReceived() {
305
- return this.#hintsReceived;
306
- }
307
-
308
- set hintsReceived(value) {
309
- this.#hintsReceived = value;
310
- if (this.#hintsReceived) {
311
- this.#incoming?.hints?.addReceivedHint(this.#name, {
312
- js: this.js,
313
- css: this.css,
314
- });
315
- }
316
- }
317
-
318
307
  /**
319
308
  * Whether the podlet can signal redirects to the layout.
320
309
  *
@@ -346,10 +335,18 @@ export default class PodletClientHttpOutgoing extends PassThrough {
346
335
  pushFallback() {
347
336
  // @ts-expect-error Internal property
348
337
  this.push(this.#manifest._fallback);
349
- // @ts-expect-error Internal property
350
- this.js = this.#manifest._js;
351
- // @ts-expect-error Internal property
352
- this.css = this.#manifest._css;
338
+ this.js =
339
+ // @ts-expect-error Internal property
340
+ this.#manifest._js && this.#manifest._js.length
341
+ ? // @ts-expect-error Internal property
342
+ filterAssets('fallback', this.#manifest._js)
343
+ : filterAssets('fallback', this.#manifest.js);
344
+ this.css =
345
+ // @ts-expect-error Internal property
346
+ this.#manifest._css && this.#manifest._css.length
347
+ ? // @ts-expect-error Internal property
348
+ filterAssets('fallback', this.#manifest._css)
349
+ : filterAssets('fallback', this.#manifest.css);
353
350
  this.push(null);
354
351
  this.#isFallback = true;
355
352
  // assume the hints from the podlet have failed and fallback assets will be used
@@ -27,7 +27,6 @@ const UA_STRING = `${pkg.name} ${pkg.version}`;
27
27
  * @property {string} clientName
28
28
  * @property {import('./http.js').default} [http]
29
29
  * @property {import('abslog').AbstractLoggerOptions} [logger]
30
- * @property {boolean} [earlyHints]
31
30
  */
32
31
 
33
32
  export default class PodletClientContentResolver {
@@ -35,7 +34,6 @@ export default class PodletClientContentResolver {
35
34
  #metrics;
36
35
  #histogram;
37
36
  #http;
38
- #earlyHints;
39
37
 
40
38
  /**
41
39
  * @constructor
@@ -46,8 +44,6 @@ export default class PodletClientContentResolver {
46
44
  this.#http = options.http || new HTTP();
47
45
  const name = options.clientName;
48
46
  this.#log = abslog(options.logger);
49
- this.#earlyHints =
50
- typeof options.earlyHints === 'boolean' ? options.earlyHints : true;
51
47
  this.#metrics = new Metrics();
52
48
  this.#histogram = this.#metrics.histogram({
53
49
  name: 'podium_client_resolver_content_resolve',
@@ -96,10 +92,7 @@ export default class PodletClientContentResolver {
96
92
  outgoing.pushFallback();
97
93
  outgoing.emit(
98
94
  'beforeStream',
99
- new Response({
100
- js: utils.filterAssets('fallback', outgoing.manifest.js),
101
- css: utils.filterAssets('fallback', outgoing.manifest.css),
102
- }),
95
+ new Response({ js: outgoing.js, css: outgoing.css }),
103
96
  );
104
97
  return outgoing;
105
98
  }
@@ -119,10 +112,7 @@ export default class PodletClientContentResolver {
119
112
  outgoing.pushFallback();
120
113
  outgoing.emit(
121
114
  'beforeStream',
122
- new Response({
123
- js: utils.filterAssets('fallback', outgoing.manifest.js),
124
- css: utils.filterAssets('fallback', outgoing.manifest.css),
125
- }),
115
+ new Response({ js: outgoing.js, css: outgoing.css }),
126
116
  );
127
117
  return outgoing;
128
118
  }
@@ -146,26 +136,6 @@ export default class PodletClientContentResolver {
146
136
  method: 'GET',
147
137
  query: outgoing.reqOptions.query,
148
138
  headers,
149
- onInfo: ({ statusCode, headers }) => {
150
- if (statusCode === 103 && !outgoing.hintsReceived) {
151
- const parsedAssetObjects = parseLinkHeaders(headers.link);
152
-
153
- const scriptObjects = parsedAssetObjects.filter(
154
- (asset) => asset instanceof AssetJs,
155
- );
156
- const styleObjects = parsedAssetObjects.filter(
157
- (asset) => asset instanceof AssetCss,
158
- );
159
- // set the content js asset objects
160
- outgoing.js = filterAssets('content', scriptObjects);
161
- // set the content css asset objects
162
- outgoing.css = filterAssets('content', styleObjects);
163
- // write the early hints to the browser
164
- if (this.#earlyHints) outgoing.writeEarlyHints();
165
-
166
- outgoing.hintsReceived = true;
167
- }
168
- },
169
139
  };
170
140
 
171
141
  if (outgoing.redirectable) {
@@ -189,6 +159,19 @@ export default class PodletClientContentResolver {
189
159
  body,
190
160
  } = await this.#http.request(uri, reqOptions);
191
161
 
162
+ const parsedAssetObjects = parseLinkHeaders(hdrs.link);
163
+
164
+ const scriptObjects = parsedAssetObjects.filter(
165
+ (asset) => asset instanceof AssetJs,
166
+ );
167
+ const styleObjects = parsedAssetObjects.filter(
168
+ (asset) => asset instanceof AssetCss,
169
+ );
170
+ // set the content js asset objects
171
+ outgoing.js = filterAssets('content', scriptObjects);
172
+ // set the content css asset objects
173
+ outgoing.css = filterAssets('content', styleObjects);
174
+
192
175
  // Remote responds but with an http error code
193
176
  const resError = statusCode >= 400;
194
177
  if (resError && outgoing.throwable) {
@@ -229,16 +212,7 @@ export default class PodletClientContentResolver {
229
212
  outgoing.pushFallback();
230
213
  outgoing.emit(
231
214
  'beforeStream',
232
- new Response({
233
- js: utils.filterAssets(
234
- 'fallback',
235
- outgoing.manifest.js,
236
- ),
237
- css: utils.filterAssets(
238
- 'fallback',
239
- outgoing.manifest.css,
240
- ),
241
- }),
215
+ new Response({ js: outgoing.js, css: outgoing.css }),
242
216
  );
243
217
 
244
218
  // Body must be consumed; https://github.com/nodejs/undici/issues/583#issuecomment-855384858
@@ -287,8 +261,8 @@ export default class PodletClientContentResolver {
287
261
  'beforeStream',
288
262
  new Response({
289
263
  headers: outgoing.headers,
290
- js: utils.filterAssets('content', outgoing.manifest.js),
291
- css: utils.filterAssets('content', outgoing.manifest.css),
264
+ js: outgoing.js,
265
+ css: outgoing.css,
292
266
  redirect: outgoing.redirect,
293
267
  }),
294
268
  );
@@ -328,10 +302,7 @@ export default class PodletClientContentResolver {
328
302
  outgoing.pushFallback();
329
303
  outgoing.emit(
330
304
  'beforeStream',
331
- new Response({
332
- js: utils.filterAssets('fallback', outgoing.js),
333
- css: utils.filterAssets('fallback', outgoing.css),
334
- }),
305
+ new Response({ js: outgoing.js, css: outgoing.css }),
335
306
  );
336
307
 
337
308
  return outgoing;
@@ -96,40 +96,12 @@ export default class PodletClientFallbackResolver {
96
96
  'User-Agent': UA_STRING,
97
97
  };
98
98
 
99
- let hintsReceived = false;
100
-
101
99
  /** @type {import('./http.js').PodiumHttpClientRequestOptions} */
102
100
  const reqOptions = {
103
101
  rejectUnauthorized: outgoing.rejectUnauthorized,
104
102
  timeout: outgoing.timeout,
105
103
  method: 'GET',
106
104
  headers,
107
- onInfo({ statusCode, headers }) {
108
- if (statusCode === 103 && !hintsReceived) {
109
- const parsedAssetObjects = parseLinkHeaders(headers.link);
110
-
111
- const scriptObjects = parsedAssetObjects.filter(
112
- (asset) => asset instanceof AssetJs,
113
- );
114
- const styleObjects = parsedAssetObjects.filter(
115
- (asset) => asset instanceof AssetCss,
116
- );
117
- // set the content js asset fallback objects
118
- // @ts-expect-error internal property
119
- outgoing.manifest._js = filterAssets(
120
- 'fallback',
121
- scriptObjects,
122
- );
123
- // set the fallback css asset fallback objects
124
- // @ts-expect-error internal property
125
- outgoing.manifest._css = filterAssets(
126
- 'fallback',
127
- styleObjects,
128
- );
129
-
130
- hintsReceived = true;
131
- }
132
- },
133
105
  };
134
106
 
135
107
  const timer = this.#histogram.timer({
@@ -142,10 +114,26 @@ export default class PodletClientFallbackResolver {
142
114
  this.#log.debug(
143
115
  `start reading fallback content from remote resource - resource: ${outgoing.name} - url: ${outgoing.fallbackUri}`,
144
116
  );
145
- const { statusCode, body } = await this.#http.request(
146
- outgoing.fallbackUri,
147
- reqOptions,
117
+ const {
118
+ statusCode,
119
+ body,
120
+ headers: resHeaders,
121
+ } = await this.#http.request(outgoing.fallbackUri, reqOptions);
122
+
123
+ const parsedAssetObjects = parseLinkHeaders(resHeaders.link);
124
+
125
+ const scriptObjects = parsedAssetObjects.filter(
126
+ (asset) => asset instanceof AssetJs,
127
+ );
128
+ const styleObjects = parsedAssetObjects.filter(
129
+ (asset) => asset instanceof AssetCss,
148
130
  );
131
+ // set the content js asset fallback objects
132
+ // @ts-expect-error internal property
133
+ outgoing.manifest._js = filterAssets('fallback', scriptObjects);
134
+ // set the fallback css asset fallback objects
135
+ // @ts-expect-error internal property
136
+ outgoing.manifest._css = filterAssets('fallback', styleObjects);
149
137
 
150
138
  // Remote responds but with an http error code
151
139
  const resError = statusCode !== 200;
package/lib/resource.js CHANGED
@@ -105,10 +105,6 @@ export default class PodiumClientResource {
105
105
  throw new TypeError(
106
106
  'you must pass an instance of "HttpIncoming" as the first argument to the .fetch() method',
107
107
  );
108
- // add the name of this resource as expecting a hint to be received
109
- // we use this to track across resources and emit a hint completion event once
110
- // all hints from all resources have been received.
111
- incoming.hints.addExpectedHint(this.#options.name);
112
108
  const outgoing = new HttpOutgoing(this.#options, reqOptions, incoming);
113
109
 
114
110
  if (this.#options.excludeBy) {
@@ -163,8 +159,7 @@ export default class PodiumClientResource {
163
159
 
164
160
  this.#state.setInitializingState();
165
161
 
166
- const { headers, redirect, isFallback } =
167
- await this.#resolver.resolve(outgoing);
162
+ const { headers, redirect } = await this.#resolver.resolve(outgoing);
168
163
 
169
164
  const chunks = [];
170
165
 
@@ -179,14 +174,8 @@ export default class PodiumClientResource {
179
174
  return new Response({
180
175
  headers,
181
176
  content,
182
- css: utils.filterAssets(
183
- isFallback ? 'fallback' : 'content',
184
- outgoing.css,
185
- ),
186
- js: utils.filterAssets(
187
- isFallback ? 'fallback' : 'content',
188
- outgoing.js,
189
- ),
177
+ css: outgoing.css,
178
+ js: outgoing.js,
190
179
  redirect,
191
180
  });
192
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podium/client",
3
- "version": "5.2.0-next.4",
3
+ "version": "5.2.0-next.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -48,7 +48,7 @@
48
48
  "undici": "6.19.8"
49
49
  },
50
50
  "devDependencies": {
51
- "@podium/test-utils": "3.1.0-next.3",
51
+ "@podium/test-utils": "3.1.0-next.5",
52
52
  "@semantic-release/changelog": "6.0.3",
53
53
  "@semantic-release/git": "10.0.1",
54
54
  "@semantic-release/github": "10.0.6",
@@ -60,7 +60,7 @@
60
60
  "eslint": "9.6.0",
61
61
  "eslint-config-prettier": "9.1.0",
62
62
  "eslint-plugin-prettier": "5.1.3",
63
- "express": "4.19.2",
63
+ "express": "4.21.1",
64
64
  "get-stream": "9.0.1",
65
65
  "globals": "15.8.0",
66
66
  "http-proxy": "1.18.1",
@@ -69,6 +69,6 @@
69
69
  "prettier": "3.3.2",
70
70
  "semantic-release": "23.1.1",
71
71
  "tap": "18.7.2",
72
- "typescript": "5.4.5"
72
+ "typescript": "5.6.3"
73
73
  }
74
74
  }
package/types/client.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  /**
3
2
  * @typedef {import('./resource.js').default} PodiumClientResource
4
3
  * @typedef {import('./resource.js').PodiumClientResourceOptions} PodiumClientResourceOptions
@@ -29,7 +28,6 @@
29
28
  * @property {boolean} [redirectable=false] Set to `true` to allow podlet to respond with a redirect. You need to look for the redirect response from the podlet and return a redirect response to the browser yourself.
30
29
  * @property {import('./resource.js').RequestFilterOptions} [excludeBy] Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
31
30
  * @property {import('./resource.js').RequestFilterOptions} [includeBy] Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
32
- * @property {boolean} [earlyHints=true]
33
31
  */
34
32
  export default class PodiumClient extends EventEmitter<[never]> {
35
33
  /**
@@ -63,14 +61,14 @@ export default class PodiumClient extends EventEmitter<[never]> {
63
61
  refreshManifests(): Promise<void>;
64
62
  #private;
65
63
  }
66
- export type PodiumClientResource = import('./resource.js').default;
67
- export type PodiumClientResourceOptions = import('./resource.js').PodiumClientResourceOptions;
68
- export type PodiumClientResponse = import('./response.js').default;
69
- export type PodiumRedirect = import('./http-outgoing.js').PodiumRedirect;
70
- export type PodletManifest = import('@podium/schemas').PodletManifestSchema;
64
+ export type PodiumClientResource = import("./resource.js").default;
65
+ export type PodiumClientResourceOptions = import("./resource.js").PodiumClientResourceOptions;
66
+ export type PodiumClientResponse = import("./response.js").default;
67
+ export type PodiumRedirect = import("./http-outgoing.js").PodiumRedirect;
68
+ export type PodletManifest = import("@podium/schemas").PodletManifestSchema;
71
69
  export type PodiumClientOptions = {
72
70
  name: string;
73
- logger?: import('abslog').AbstractLoggerOptions;
71
+ logger?: import("abslog").AbstractLoggerOptions;
74
72
  retries?: number;
75
73
  /**
76
74
  * In milliseconds
@@ -80,8 +78,8 @@ export type PodiumClientOptions = {
80
78
  rejectUnauthorized?: boolean;
81
79
  resolveThreshold?: number;
82
80
  resolveMax?: number;
83
- httpAgent?: import('http').Agent;
84
- httpsAgent?: import('https').Agent;
81
+ httpAgent?: import("http").Agent;
82
+ httpsAgent?: import("https").Agent;
85
83
  };
86
84
  export type RegisterOptions = {
87
85
  /**
@@ -111,12 +109,11 @@ export type RegisterOptions = {
111
109
  /**
112
110
  * Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
113
111
  */
114
- excludeBy?: import('./resource.js').RequestFilterOptions;
112
+ excludeBy?: import("./resource.js").RequestFilterOptions;
115
113
  /**
116
114
  * Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
117
115
  */
118
- includeBy?: import('./resource.js').RequestFilterOptions;
119
- earlyHints?: boolean;
116
+ includeBy?: import("./resource.js").RequestFilterOptions;
120
117
  };
121
118
  import EventEmitter from 'events';
122
119
  import Metrics from '@metrics/client';
@@ -45,7 +45,7 @@ export default class PodletClientHttpOutgoing extends PassThrough {
45
45
  * @param {PodiumClientResourceOptions} [reqOptions]
46
46
  * @param {import('@podium/utils').HttpIncoming} [incoming]
47
47
  */
48
- constructor(options?: PodiumClientHttpOutgoingOptions, reqOptions?: PodiumClientResourceOptions, incoming?: import('@podium/utils').HttpIncoming);
48
+ constructor(options?: PodiumClientHttpOutgoingOptions, reqOptions?: PodiumClientResourceOptions, incoming?: import("@podium/utils").HttpIncoming);
49
49
  set js(value: any);
50
50
  get js(): any;
51
51
  set css(value: any);
@@ -53,7 +53,7 @@ export default class PodletClientHttpOutgoing extends PassThrough {
53
53
  get rejectUnauthorized(): boolean;
54
54
  get reqOptions(): {
55
55
  pathname: string;
56
- headers: import('http').IncomingHttpHeaders;
56
+ headers: import("http").IncomingHttpHeaders;
57
57
  query: object;
58
58
  };
59
59
  get throwable(): boolean;
@@ -105,8 +105,6 @@ export default class PodletClientHttpOutgoing extends PassThrough {
105
105
  * @see https://podium-lib.io/docs/layout/handling_redirects
106
106
  */
107
107
  get redirect(): PodiumRedirect;
108
- set hintsReceived(value: boolean);
109
- get hintsReceived(): boolean;
110
108
  set redirectable(value: boolean);
111
109
  /**
112
110
  * Whether the podlet can signal redirects to the layout.
@@ -127,6 +125,7 @@ export default class PodletClientHttpOutgoing extends PassThrough {
127
125
  */
128
126
  get isFallback(): boolean;
129
127
  pushFallback(): void;
128
+ hintsReceived: boolean;
130
129
  writeEarlyHints(cb?: () => void): void;
131
130
  get [Symbol.toStringTag](): string;
132
131
  #private;
@@ -146,12 +145,12 @@ export type PodiumClientHttpOutgoingOptions = {
146
145
  throwable?: boolean;
147
146
  redirectable?: boolean;
148
147
  rejectUnauthorized?: boolean;
149
- httpAgent?: import('http').Agent;
150
- httpsAgent?: import('https').Agent;
148
+ httpAgent?: import("http").Agent;
149
+ httpsAgent?: import("https").Agent;
151
150
  };
152
151
  export type PodiumClientResourceOptions = {
153
152
  pathname?: string;
154
- headers?: import('http').IncomingHttpHeaders;
153
+ headers?: import("http").IncomingHttpHeaders;
155
154
  query?: object;
156
155
  };
157
156
  export type PodiumRedirect = {
@@ -176,8 +175,8 @@ export type PodletManifest = {
176
175
  version: string;
177
176
  content: string;
178
177
  fallback: string;
179
- js: Array<import('@podium/utils').AssetJs>;
180
- css: Array<import('@podium/utils').AssetCss>;
178
+ js: Array<import("@podium/utils").AssetJs>;
179
+ css: Array<import("@podium/utils").AssetCss>;
181
180
  proxy: Record<string, string> | Array<PodletProxySchema>;
182
181
  team: string;
183
182
  };
package/types/http.d.ts CHANGED
@@ -17,16 +17,16 @@ export default class HTTP {
17
17
  * @param {PodiumHttpClientRequestOptions} options
18
18
  * @returns {Promise<Pick<import('undici').Dispatcher.ResponseData, 'statusCode' | 'headers' | 'body'>>}
19
19
  */
20
- request(url: string, options: PodiumHttpClientRequestOptions): Promise<Pick<import('undici').Dispatcher.ResponseData, 'statusCode' | 'headers' | 'body'>>;
20
+ request(url: string, options: PodiumHttpClientRequestOptions): Promise<Pick<import("undici").Dispatcher.ResponseData, "statusCode" | "headers" | "body">>;
21
21
  }
22
22
  export type PodiumHttpClientRequestOptions = {
23
- method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
23
+ method: "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
24
24
  json?: boolean;
25
25
  rejectUnauthorized?: boolean;
26
26
  follow?: boolean;
27
27
  timeout?: number;
28
28
  query?: object;
29
- headers?: import('http').IncomingHttpHeaders;
29
+ headers?: import("http").IncomingHttpHeaders;
30
30
  onInfo?: (info: {
31
31
  statusCode: number;
32
32
  headers: Record<string, string | string[]>;
@@ -15,17 +15,17 @@ export default class PodletClientCacheResolver {
15
15
  * @param {import('./http-outgoing.js').default} outgoing
16
16
  * @returns {Promise<import('./http-outgoing.js').default>}
17
17
  */
18
- load(outgoing: import('./http-outgoing.js').default): Promise<import('./http-outgoing.js').default>;
18
+ load(outgoing: import("./http-outgoing.js").default): Promise<import("./http-outgoing.js").default>;
19
19
  /**
20
20
  * Saves the podlet's manifest to the cache
21
21
  *
22
22
  * @param {import('./http-outgoing.js').default} outgoing
23
23
  * @returns {Promise<import('./http-outgoing.js').default>}
24
24
  */
25
- save(outgoing: import('./http-outgoing.js').default): Promise<import('./http-outgoing.js').default>;
25
+ save(outgoing: import("./http-outgoing.js").default): Promise<import("./http-outgoing.js").default>;
26
26
  get [Symbol.toStringTag](): string;
27
27
  #private;
28
28
  }
29
29
  export type PodletClientCacheResolverOptions = {
30
- logger?: import('abslog').AbstractLoggerOptions;
30
+ logger?: import("abslog").AbstractLoggerOptions;
31
31
  };
@@ -3,7 +3,6 @@
3
3
  * @property {string} clientName
4
4
  * @property {import('./http.js').default} [http]
5
5
  * @property {import('abslog').AbstractLoggerOptions} [logger]
6
- * @property {boolean} [earlyHints]
7
6
  */
8
7
  export default class PodletClientContentResolver {
9
8
  /**
@@ -18,14 +17,13 @@ export default class PodletClientContentResolver {
18
17
  * @param {import('./http-outgoing.js').default} outgoing
19
18
  * @returns {Promise<import('./http-outgoing.js').default>}
20
19
  */
21
- resolve(outgoing: import('./http-outgoing.js').default): Promise<import('./http-outgoing.js').default>;
20
+ resolve(outgoing: import("./http-outgoing.js").default): Promise<import("./http-outgoing.js").default>;
22
21
  get [Symbol.toStringTag](): string;
23
22
  #private;
24
23
  }
25
24
  export type PodletClientContentResolverOptions = {
26
25
  clientName: string;
27
- http?: import('./http.js').default;
28
- logger?: import('abslog').AbstractLoggerOptions;
29
- earlyHints?: boolean;
26
+ http?: import("./http.js").default;
27
+ logger?: import("abslog").AbstractLoggerOptions;
30
28
  };
31
29
  import Metrics from '@metrics/client';
@@ -18,20 +18,20 @@ export default class PodletClientResolver {
18
18
  * @param {import('./http-outgoing.js').default} outgoing
19
19
  * @returns {Promise<import('./http-outgoing.js').default>}
20
20
  */
21
- resolve(outgoing: import('./http-outgoing.js').default): Promise<import('./http-outgoing.js').default>;
21
+ resolve(outgoing: import("./http-outgoing.js").default): Promise<import("./http-outgoing.js").default>;
22
22
  /**
23
23
  * Refresh the podlet's cached manifest and fallback
24
24
  *
25
25
  * @param {import('./http-outgoing.js').default} outgoing
26
26
  * @returns {Promise<boolean>} `true` if successful
27
27
  */
28
- refresh(outgoing: import('./http-outgoing.js').default): Promise<boolean>;
28
+ refresh(outgoing: import("./http-outgoing.js").default): Promise<boolean>;
29
29
  get [Symbol.toStringTag](): string;
30
30
  #private;
31
31
  }
32
32
  export type PodletClientResolverOptions = {
33
33
  clientName: string;
34
- logger?: import('abslog').AbstractLoggerOptions;
34
+ logger?: import("abslog").AbstractLoggerOptions;
35
35
  earlyHints?: boolean;
36
36
  };
37
37
  import Metrics from '@metrics/client';
@@ -17,13 +17,13 @@ export default class PodletClientFallbackResolver {
17
17
  * @param {import('./http-outgoing.js').default} outgoing
18
18
  * @returns {Promise<import('./http-outgoing.js').default>}
19
19
  */
20
- resolve(outgoing: import('./http-outgoing.js').default): Promise<import('./http-outgoing.js').default>;
20
+ resolve(outgoing: import("./http-outgoing.js").default): Promise<import("./http-outgoing.js").default>;
21
21
  get [Symbol.toStringTag](): string;
22
22
  #private;
23
23
  }
24
24
  export type PodletClientFallbackResolverOptions = {
25
25
  clientName: string;
26
- http?: import('./http.js').default;
27
- logger?: import('abslog').AbstractLoggerOptions;
26
+ http?: import("./http.js").default;
27
+ logger?: import("abslog").AbstractLoggerOptions;
28
28
  };
29
29
  import Metrics from '@metrics/client';
@@ -15,13 +15,13 @@ export default class PodletClientManifestResolver {
15
15
  * @param {import('./http-outgoing.js').default} outgoing
16
16
  * @returns {Promise<import('./http-outgoing.js').default>}
17
17
  */
18
- resolve(outgoing: import('./http-outgoing.js').default): Promise<import('./http-outgoing.js').default>;
18
+ resolve(outgoing: import("./http-outgoing.js").default): Promise<import("./http-outgoing.js").default>;
19
19
  get [Symbol.toStringTag](): string;
20
20
  #private;
21
21
  }
22
22
  export type PodletClientManifestResolverOptions = {
23
23
  clientName: string;
24
- logger?: import('abslog').AbstractLoggerOptions;
25
- http?: import('./http.js').default;
24
+ logger?: import("abslog").AbstractLoggerOptions;
25
+ http?: import("./http.js").default;
26
26
  };
27
27
  import Metrics from '@metrics/client';
@@ -26,7 +26,7 @@ export default class PodiumClientResource {
26
26
  * @param {import('./state.js').default} state
27
27
  * @param {PodiumClientResourceOptions} options
28
28
  */
29
- constructor(registry: any, state: import('./state.js').default, options?: PodiumClientResourceOptions);
29
+ constructor(registry: any, state: import("./state.js").default, options?: PodiumClientResourceOptions);
30
30
  get metrics(): Metrics;
31
31
  get name(): string;
32
32
  get uri(): string;
@@ -45,7 +45,7 @@ export default class PodiumClientResource {
45
45
  * incoming.podlets = [header]; // Register the podlet's JS and CSS assets with the layout's HTML template
46
46
  * ```
47
47
  */
48
- fetch(incoming: import('@podium/utils').HttpIncoming, reqOptions?: import('./http-outgoing.js').PodiumClientResourceOptions): Promise<import('./response.js').default>;
48
+ fetch(incoming: import("@podium/utils").HttpIncoming, reqOptions?: import("./http-outgoing.js").PodiumClientResourceOptions): Promise<import("./response.js").default>;
49
49
  /**
50
50
  * Stream the podlet's content, or fallback if the podlet is unavailable.
51
51
  *
@@ -53,7 +53,7 @@ export default class PodiumClientResource {
53
53
  * @param {import('./http-outgoing.js').PodiumClientResourceOptions} [reqOptions={}]
54
54
  * @returns {import('./http-outgoing.js').default}
55
55
  */
56
- stream(incoming: import('@podium/utils').HttpIncoming, reqOptions?: import('./http-outgoing.js').PodiumClientResourceOptions): import('./http-outgoing.js').default;
56
+ stream(incoming: import("@podium/utils").HttpIncoming, reqOptions?: import("./http-outgoing.js").PodiumClientResourceOptions): import("./http-outgoing.js").default;
57
57
  /**
58
58
  * Refresh the podlet's manifest and fallback in the cache.
59
59
  *
@@ -61,7 +61,7 @@ export default class PodiumClientResource {
61
61
  * @param {import('./http-outgoing.js').PodiumClientResourceOptions} [reqOptions={}]
62
62
  * @returns {Promise<boolean>} `true` if succesful
63
63
  */
64
- refresh(incoming?: import('@podium/utils').HttpIncoming, reqOptions?: import('./http-outgoing.js').PodiumClientResourceOptions): Promise<boolean>;
64
+ refresh(incoming?: import("@podium/utils").HttpIncoming, reqOptions?: import("./http-outgoing.js").PodiumClientResourceOptions): Promise<boolean>;
65
65
  [inspect](): {
66
66
  metrics: Metrics;
67
67
  name: string;
@@ -77,7 +77,7 @@ export type RequestFilterOptions = {
77
77
  deviceType?: string[];
78
78
  };
79
79
  export type PodiumClientResourceOptions = {
80
- logger?: import('abslog').AbstractLoggerOptions;
80
+ logger?: import("abslog").AbstractLoggerOptions;
81
81
  clientName: string;
82
82
  name: string;
83
83
  /**
@@ -93,8 +93,8 @@ export type PodiumClientResourceOptions = {
93
93
  throwable?: boolean;
94
94
  redirectable?: boolean;
95
95
  rejectUnauthorized?: boolean;
96
- httpAgent?: import('http').Agent;
97
- httpsAgent?: import('https').Agent;
96
+ httpAgent?: import("http").Agent;
97
+ httpsAgent?: import("https").Agent;
98
98
  /**
99
99
  * Used by `fetch` to conditionally skip fetching the podlet content based on values on the request.
100
100
  */
@@ -39,9 +39,9 @@ export default class PodiumClientResponse {
39
39
  export type PodiumClientResponseOptions = {
40
40
  content?: string;
41
41
  headers?: object;
42
- js?: Array<import('@podium/utils').AssetJs>;
43
- css?: Array<import('@podium/utils').AssetCss>;
44
- redirect?: import('./http-outgoing.js').PodiumRedirect | null;
42
+ js?: Array<import("@podium/utils").AssetJs>;
43
+ css?: Array<import("@podium/utils").AssetCss>;
44
+ redirect?: import("./http-outgoing.js").PodiumRedirect | null;
45
45
  };
46
46
  declare const inspect: unique symbol;
47
47
  export {};
package/types/state.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  /**
3
2
  * @typedef {object} PodiumClientStateOptions
4
3
  * @property {number} [resolveThreshold=10000]
package/types/utils.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  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
- export function filterAssets<T extends AssetCss | AssetJs>(scope: "content" | "fallback" | "all", assets: T[]): T[];
4
+ export function filterAssets<T extends import("@podium/utils").AssetCss | import("@podium/utils").AssetJs>(scope: "content" | "fallback" | "all", assets: T[]): T[];
5
5
  export function parseLinkHeaders(headers: any): any[];
6
6
  export function toPreloadAssetObjects(assetObjects: any): any;
7
- import { AssetCss } from '@podium/utils';
8
- import { AssetJs } from '@podium/utils';