@webpieces/http-client-browser 0.4.868 → 0.4.869
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-client-browser",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.869",
|
|
4
4
|
"description": "Browser HTTP client for webpieces: DI-free (React or Angular), app-managed context store, no AsyncLocalStorage",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@webpieces/core-util": "0.4.
|
|
26
|
-
"@webpieces/http-client-core": "0.4.
|
|
25
|
+
"@webpieces/core-util": "0.4.869",
|
|
26
|
+
"@webpieces/http-client-core": "0.4.869"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -18,23 +18,31 @@ import { RequestOutcome } from '@webpieces/http-client-core';
|
|
|
18
18
|
* `onRequestStart` and `onRequestEnd` are PAIRED: every start is followed by exactly one end, on
|
|
19
19
|
* every path (2xx, HTTP error, network reject), so a counter driven off them cannot leak.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
21
|
+
* Three independent endpoint declarations ride the route, each read from the ROUTE rather than
|
|
22
|
+
* matched on a path string, each false when absent:
|
|
23
|
+
*
|
|
24
|
+
* - `route.hideProgress` (`@Endpoint(..., { hideProgress: true })`) — the user is not waiting on this
|
|
25
|
+
* call (a background download, a log shipper), so a bar driven off these callbacks should skip it.
|
|
26
|
+
* - `route.allowUpgradeInFlight` (`@Endpoint(..., { allowUpgradeInFlight: true })`) — the app may
|
|
27
|
+
* upgrade while this call is in flight, and the call neither blocks nor arms that upgrade. Absent,
|
|
28
|
+
* the call must finish before an upgrade, and its success counts toward arming one — even when it
|
|
29
|
+
* is hidden from the bar.
|
|
30
|
+
* - `route.noLogging` (`@Endpoint(..., { noLogging: true })`) — webpieces already emits no
|
|
31
|
+
* `[API-client-*]` line for it; app-level RPC instrumentation whose own lines would become the next
|
|
32
|
+
* log batch's payload should skip it too.
|
|
33
|
+
*
|
|
34
|
+
* A log shipper declares all three; a background download declares only `hideProgress`.
|
|
27
35
|
*
|
|
28
36
|
* ```typescript
|
|
29
37
|
* class RpcLifecycleListener implements RequestLifecycleListener {
|
|
30
38
|
* onRequestStart(route: RouteMetadata): void {
|
|
31
|
-
* if (route.
|
|
32
|
-
* progressBar.noteRequestStart();
|
|
39
|
+
* if (!route.allowUpgradeInFlight) upgradeGate.noteRequestStart();
|
|
40
|
+
* if (!route.hideProgress) progressBar.noteRequestStart();
|
|
33
41
|
* }
|
|
34
42
|
* onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void {
|
|
35
43
|
* serverVersionBridge.set(outcome.headers?.get('x-myorg-server-version'));
|
|
36
|
-
* if (route.
|
|
37
|
-
* progressBar.noteRequestEnd(!outcome.ok);
|
|
44
|
+
* if (!route.allowUpgradeInFlight) upgradeGate.noteRequestEnd(outcome.ok);
|
|
45
|
+
* if (!route.hideProgress) progressBar.noteRequestEnd(!outcome.ok);
|
|
38
46
|
* }
|
|
39
47
|
* }
|
|
40
48
|
* const factory = new ClientHttpBrowserFactory(store, new RpcLifecycleListener());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestLifecycleListener.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RequestLifecycleListener.ts"],"names":[],"mappings":"","sourcesContent":["import { RouteMetadata } from '@webpieces/core-util';\nimport { RequestOutcome } from '@webpieces/http-client-core';\n\n/**\n * The inbound seam an app implements to observe the FULL lifecycle of every RPC call — symmetric\n * with the outbound header propagation done by {@link MutableContextStore} / {@link ContextMgr}.\n * Registered once on {@link ClientHttpBrowserFactory}; invoked by {@link BrowserProxyClient} around\n * each call.\n *\n * Replaces the older header-only ResponseHeadersListener. `onRequestEnd`'s `outcome.headers` carries\n * the same Response Headers (after settlement, on both ok and error), and it adds the\n * two signals the header-only seam could not give: a START marker, and success-or-error.\n *\n * The driver is a browser app that must drive ONE progress bar across N requests per user action,\n * AND detect that a newer server is deployed than this bundle (the server stamps\n * `x-<org>-server-version` on every response) — reloading only at a safe moment, so a half-filled\n * form is never blown away. It needs, per RPC: bar on, bar off, the outcome, and the headers.\n *\n * `onRequestStart` and `onRequestEnd` are PAIRED: every start is followed by exactly one end, on\n * every path (2xx, HTTP error, network reject), so a counter driven off them cannot leak.\n *\n *
|
|
1
|
+
{"version":3,"file":"RequestLifecycleListener.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RequestLifecycleListener.ts"],"names":[],"mappings":"","sourcesContent":["import { RouteMetadata } from '@webpieces/core-util';\nimport { RequestOutcome } from '@webpieces/http-client-core';\n\n/**\n * The inbound seam an app implements to observe the FULL lifecycle of every RPC call — symmetric\n * with the outbound header propagation done by {@link MutableContextStore} / {@link ContextMgr}.\n * Registered once on {@link ClientHttpBrowserFactory}; invoked by {@link BrowserProxyClient} around\n * each call.\n *\n * Replaces the older header-only ResponseHeadersListener. `onRequestEnd`'s `outcome.headers` carries\n * the same Response Headers (after settlement, on both ok and error), and it adds the\n * two signals the header-only seam could not give: a START marker, and success-or-error.\n *\n * The driver is a browser app that must drive ONE progress bar across N requests per user action,\n * AND detect that a newer server is deployed than this bundle (the server stamps\n * `x-<org>-server-version` on every response) — reloading only at a safe moment, so a half-filled\n * form is never blown away. It needs, per RPC: bar on, bar off, the outcome, and the headers.\n *\n * `onRequestStart` and `onRequestEnd` are PAIRED: every start is followed by exactly one end, on\n * every path (2xx, HTTP error, network reject), so a counter driven off them cannot leak.\n *\n * Three independent endpoint declarations ride the route, each read from the ROUTE rather than\n * matched on a path string, each false when absent:\n *\n * - `route.hideProgress` (`@Endpoint(..., { hideProgress: true })`) — the user is not waiting on this\n * call (a background download, a log shipper), so a bar driven off these callbacks should skip it.\n * - `route.allowUpgradeInFlight` (`@Endpoint(..., { allowUpgradeInFlight: true })`) — the app may\n * upgrade while this call is in flight, and the call neither blocks nor arms that upgrade. Absent,\n * the call must finish before an upgrade, and its success counts toward arming one — even when it\n * is hidden from the bar.\n * - `route.noLogging` (`@Endpoint(..., { noLogging: true })`) — webpieces already emits no\n * `[API-client-*]` line for it; app-level RPC instrumentation whose own lines would become the next\n * log batch's payload should skip it too.\n *\n * A log shipper declares all three; a background download declares only `hideProgress`.\n *\n * ```typescript\n * class RpcLifecycleListener implements RequestLifecycleListener {\n * onRequestStart(route: RouteMetadata): void {\n * if (!route.allowUpgradeInFlight) upgradeGate.noteRequestStart();\n * if (!route.hideProgress) progressBar.noteRequestStart();\n * }\n * onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void {\n * serverVersionBridge.set(outcome.headers?.get('x-myorg-server-version'));\n * if (!route.allowUpgradeInFlight) upgradeGate.noteRequestEnd(outcome.ok);\n * if (!route.hideProgress) progressBar.noteRequestEnd(!outcome.ok);\n * }\n * }\n * const factory = new ClientHttpBrowserFactory(store, new RpcLifecycleListener());\n * ```\n *\n * This is BUSINESS LOGIC (methods), so it is an interface, not a data class — unlike the\n * {@link RequestOutcome} it is handed.\n */\nexport interface RequestLifecycleListener {\n /** Before fetch, once per RPC. */\n onRequestStart(route: RouteMetadata): void;\n\n /** Once, after the call settles, on every path (success, HTTP error, network reject). */\n onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void;\n}\n"]}
|