quidproquo-web 0.1.9 → 0.1.11
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/lib/commonjs/actions/index.d.ts +0 -1
- package/lib/commonjs/actions/index.js +0 -1
- package/lib/commonjs/actions/index.js.map +1 -1
- package/lib/commonjs/federation/forceReloadFederatedRemote.d.ts +14 -0
- package/lib/commonjs/federation/forceReloadFederatedRemote.js +95 -0
- package/lib/commonjs/federation/forceReloadFederatedRemote.js.map +1 -0
- package/lib/commonjs/federation/index.d.ts +1 -0
- package/lib/commonjs/{actions/api → federation}/index.js +1 -3
- package/lib/commonjs/federation/index.js.map +1 -0
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/esm/actions/index.d.ts +0 -1
- package/lib/esm/actions/index.js +0 -1
- package/lib/esm/actions/index.js.map +1 -1
- package/lib/esm/federation/forceReloadFederatedRemote.d.ts +14 -0
- package/lib/esm/federation/forceReloadFederatedRemote.js +89 -0
- package/lib/esm/federation/forceReloadFederatedRemote.js.map +1 -0
- package/lib/esm/federation/index.d.ts +1 -0
- package/lib/esm/federation/index.js +2 -0
- package/lib/esm/federation/index.js.map +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/lib/commonjs/actions/api/ApiActionType.d.ts +0 -3
- package/lib/commonjs/actions/api/ApiActionType.js +0 -8
- package/lib/commonjs/actions/api/ApiActionType.js.map +0 -1
- package/lib/commonjs/actions/api/ApiRequestActionRequester.d.ts +0 -3
- package/lib/commonjs/actions/api/ApiRequestActionRequester.js +0 -19
- package/lib/commonjs/actions/api/ApiRequestActionRequester.js.map +0 -1
- package/lib/commonjs/actions/api/ApiRequestActionRequesterTypes.d.ts +0 -18
- package/lib/commonjs/actions/api/ApiRequestActionRequesterTypes.js +0 -3
- package/lib/commonjs/actions/api/ApiRequestActionRequesterTypes.js.map +0 -1
- package/lib/commonjs/actions/api/index.d.ts +0 -3
- package/lib/commonjs/actions/api/index.js.map +0 -1
- package/lib/esm/actions/api/ApiActionType.d.ts +0 -3
- package/lib/esm/actions/api/ApiActionType.js +0 -5
- package/lib/esm/actions/api/ApiActionType.js.map +0 -1
- package/lib/esm/actions/api/ApiRequestActionRequester.d.ts +0 -3
- package/lib/esm/actions/api/ApiRequestActionRequester.js +0 -16
- package/lib/esm/actions/api/ApiRequestActionRequester.js.map +0 -1
- package/lib/esm/actions/api/ApiRequestActionRequesterTypes.d.ts +0 -18
- package/lib/esm/actions/api/ApiRequestActionRequesterTypes.js +0 -2
- package/lib/esm/actions/api/ApiRequestActionRequesterTypes.js.map +0 -1
- package/lib/esm/actions/api/index.d.ts +0 -3
- package/lib/esm/actions/api/index.js +0 -4
- package/lib/esm/actions/api/index.js.map +0 -1
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./api"), exports);
|
|
18
17
|
__exportStar(require("./queryParams"), exports);
|
|
19
18
|
__exportStar(require("./window"), exports);
|
|
20
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,2CAAyB","sourcesContent":["export * from './queryParams';\nexport * from './window';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type InjectedFunction = (...args: never[]) => unknown;
|
|
2
|
+
export type FederationRuntimeApi = {
|
|
3
|
+
getInstance: InjectedFunction;
|
|
4
|
+
registerRemotes: InjectedFunction;
|
|
5
|
+
registerPlugins: InjectedFunction;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Prepare a federated remote for a hot-swap: after this call, the next
|
|
9
|
+
* loadRemote() of the remote fetches and executes its CURRENT deployment.
|
|
10
|
+
* `reloadNonce` must be a fresh value per swap (a per-remote counter).
|
|
11
|
+
* Returns false (with a console warning) when the remote is not registered.
|
|
12
|
+
*/
|
|
13
|
+
export declare const forceReloadFederatedRemote: (runtimeApi: FederationRuntimeApi, remoteName: string, reloadNonce: number) => boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Hot-swap support for a module-federation remote: make the NEXT loadRemote of a
|
|
3
|
+
// given remote genuinely re-fetch and re-execute its current deployment, instead of
|
|
4
|
+
// serving any of the FIVE stale layers a naive force re-registration leaves behind
|
|
5
|
+
// (each one found the hard way):
|
|
6
|
+
//
|
|
7
|
+
// 1. The MF runtime caches (moduleCache, manifest snapshot): force re-registration
|
|
8
|
+
// with a nonce'd entry URL clears them and guarantees a fresh manifest fetch.
|
|
9
|
+
// 2. The container global: loadEntryScript short-circuits on `window[globalName]`
|
|
10
|
+
// BEFORE fetching the entry, silently reusing the old container. Cleared by
|
|
11
|
+
// ASSIGNING undefined, not `delete` — the global is a top-level `var` from a
|
|
12
|
+
// classic script, so the window property is non-configurable and delete throws;
|
|
13
|
+
// the runtime's short-circuit is a truthiness check, so undefined is enough.
|
|
14
|
+
// 3. The bundler's chunk-loading global (`rspackChunk<name>` / `webpackChunk<name>`):
|
|
15
|
+
// shared by BUILD NAME — every chunk file of every previously loaded copy of the
|
|
16
|
+
// remote pushed its modules into it, and a fresh container drains that array on
|
|
17
|
+
// boot. Chunk ids are stable across builds, so without a reset the new container
|
|
18
|
+
// sees the old build's chunks as already loaded and NEVER fetches its own files —
|
|
19
|
+
// the swap re-executes the OLD code under a new identity. The old container keeps
|
|
20
|
+
// its captured reference to the old array, so it is unaffected.
|
|
21
|
+
// 4. The DOM script-tag dedup: both the MF sdk and the chunk loader reuse an existing
|
|
22
|
+
// <script> tag whose src matches (never re-executing it), so every one of the
|
|
23
|
+
// remote's tags (entry AND chunks) is swept.
|
|
24
|
+
// 5. The browser HTTP cache of the fixed-name remoteEntry.js: a createScript runtime
|
|
25
|
+
// plugin serves the entry script with the reload nonce on its src — a never-seen
|
|
26
|
+
// URL that no cache layer can answer.
|
|
27
|
+
//
|
|
28
|
+
// The MF runtime bindings are INJECTED (see FederationRuntimeApi): they must be the
|
|
29
|
+
// host bundle's own instance — the bundler aliases '@module-federation/enhanced/runtime'
|
|
30
|
+
// onto the runtime it embeds, and importing a second copy here would target the wrong
|
|
31
|
+
// (or no) instance. Injection also keeps this package dependency-free.
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.forceReloadFederatedRemote = void 0;
|
|
34
|
+
// Remotes with a reload in flight: mf container name -> current reload nonce.
|
|
35
|
+
// Module scope is safe: quidproquo-web is a module-federation shared singleton, so
|
|
36
|
+
// one copy serves the page.
|
|
37
|
+
const remoteReloadNonces = new Map();
|
|
38
|
+
let cacheBustPluginRegistered = false;
|
|
39
|
+
const ensureCacheBustPlugin = (registerPlugins) => {
|
|
40
|
+
if (cacheBustPluginRegistered) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
cacheBustPluginRegistered = true;
|
|
44
|
+
registerPlugins([
|
|
45
|
+
{
|
|
46
|
+
name: 'qpq-federated-reload-cache-bust',
|
|
47
|
+
createScript(args) {
|
|
48
|
+
const reloadNonce = args.remoteInfo ? remoteReloadNonces.get(args.remoteInfo.name) : undefined;
|
|
49
|
+
if (!reloadNonce) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const script = document.createElement('script');
|
|
53
|
+
script.src = `${args.url.split('?')[0]}?reload=${reloadNonce}`;
|
|
54
|
+
return script;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
]);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Prepare a federated remote for a hot-swap: after this call, the next
|
|
61
|
+
* loadRemote() of the remote fetches and executes its CURRENT deployment.
|
|
62
|
+
* `reloadNonce` must be a fresh value per swap (a per-remote counter).
|
|
63
|
+
* Returns false (with a console warning) when the remote is not registered.
|
|
64
|
+
*/
|
|
65
|
+
const forceReloadFederatedRemote = (runtimeApi, remoteName, reloadNonce) => {
|
|
66
|
+
var _a;
|
|
67
|
+
const { getInstance, registerRemotes, registerPlugins } = runtimeApi;
|
|
68
|
+
const remote = (_a = getInstance()) === null || _a === void 0 ? void 0 : _a.options.remotes.find((candidate) => ('alias' in candidate && candidate.alias === remoteName) || candidate.name === remoteName);
|
|
69
|
+
if (!remote || !('entry' in remote)) {
|
|
70
|
+
console.warn(`[qpq-federated-reload] remote "${remoteName}" not found in MF runtime options - a reload will serve the cached bundle`);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
ensureCacheBustPlugin(registerPlugins);
|
|
74
|
+
remoteReloadNonces.set(remote.name, reloadNonce);
|
|
75
|
+
// Layer 2: the container global.
|
|
76
|
+
globalThis[remote.name] = undefined;
|
|
77
|
+
// Layer 3: the bundler chunk-loading globals (rspack and webpack builds).
|
|
78
|
+
globalThis[`rspackChunk${remote.name}`] = undefined;
|
|
79
|
+
globalThis[`webpackChunk${remote.name}`] = undefined;
|
|
80
|
+
const baseEntry = remote.entry.split('?')[0];
|
|
81
|
+
const entryDir = baseEntry.slice(0, baseEntry.lastIndexOf('/'));
|
|
82
|
+
// Layer 4: sweep ALL of this remote's script tags (entry AND chunks).
|
|
83
|
+
document.querySelectorAll('script[src]').forEach((scriptTag) => {
|
|
84
|
+
var _a;
|
|
85
|
+
const src = (_a = scriptTag.getAttribute('src')) !== null && _a !== void 0 ? _a : '';
|
|
86
|
+
if (src.startsWith(entryDir)) {
|
|
87
|
+
scriptTag.remove();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
// Layer 1: force re-registration with the nonce'd entry.
|
|
91
|
+
registerRemotes([Object.assign(Object.assign({}, remote), { entry: `${baseEntry}?reload=${reloadNonce}` })], { force: true });
|
|
92
|
+
return true;
|
|
93
|
+
};
|
|
94
|
+
exports.forceReloadFederatedRemote = forceReloadFederatedRemote;
|
|
95
|
+
//# sourceMappingURL=forceReloadFederatedRemote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forceReloadFederatedRemote.js","sourceRoot":"","sources":["../../../src/federation/forceReloadFederatedRemote.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,oFAAoF;AACpF,mFAAmF;AACnF,iCAAiC;AACjC,EAAE;AACF,qFAAqF;AACrF,mFAAmF;AACnF,oFAAoF;AACpF,iFAAiF;AACjF,kFAAkF;AAClF,qFAAqF;AACrF,kFAAkF;AAClF,wFAAwF;AACxF,sFAAsF;AACtF,qFAAqF;AACrF,sFAAsF;AACtF,uFAAuF;AACvF,uFAAuF;AACvF,qEAAqE;AACrE,wFAAwF;AACxF,mFAAmF;AACnF,kDAAkD;AAClD,uFAAuF;AACvF,sFAAsF;AACtF,2CAA2C;AAC3C,EAAE;AACF,oFAAoF;AACpF,yFAAyF;AACzF,sFAAsF;AACtF,uEAAuE;;;AAqBvE,8EAA8E;AAC9E,mFAAmF;AACnF,4BAA4B;AAC5B,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAErD,IAAI,yBAAyB,GAAG,KAAK,CAAC;AAEtC,MAAM,qBAAqB,GAAG,CAAC,eAA6D,EAAQ,EAAE;IACpG,IAAI,yBAAyB,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,yBAAyB,GAAG,IAAI,CAAC;IAEjC,eAAe,CAAC;QACd;YACE,IAAI,EAAE,iCAAiC;YACvC,YAAY,CAAC,IAAoD;gBAC/D,MAAM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I,CAAC,GAAG,SAAS,CAAC;IAEjE,0EAA0E;IACzE,UAAsC,CAAC,cAAc,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IAChF,UAAsC,CAAC,eAAe,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IAElF,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhE,sEAAsE;IACtE,QAAQ,CAAC,gBAAgB,CAAoB,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;;QAChF,MAAM,GAAG,GAAG,MAAA,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC;QAChD,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,SAAS,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,yDAAyD;IACzD,eAAe,CAAC,iCAAM,MAAM,KAAE,KAAK,EAAE,GAAG,SAAS,WAAW,WAAW,EAAE,IAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/F,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AArCW,QAAA,0BAA0B,8BAqCrC","sourcesContent":["// Hot-swap support for a module-federation remote: make the NEXT loadRemote of a\n// given remote genuinely re-fetch and re-execute its current deployment, instead of\n// serving any of the FIVE stale layers a naive force re-registration leaves behind\n// (each one found the hard way):\n//\n// 1. The MF runtime caches (moduleCache, manifest snapshot): force re-registration\n// with a nonce'd entry URL clears them and guarantees a fresh manifest fetch.\n// 2. The container global: loadEntryScript short-circuits on `window[globalName]`\n// BEFORE fetching the entry, silently reusing the old container. Cleared by\n// ASSIGNING undefined, not `delete` — the global is a top-level `var` from a\n// classic script, so the window property is non-configurable and delete throws;\n// the runtime's short-circuit is a truthiness check, so undefined is enough.\n// 3. The bundler's chunk-loading global (`rspackChunk<name>` / `webpackChunk<name>`):\n// shared by BUILD NAME — every chunk file of every previously loaded copy of the\n// remote pushed its modules into it, and a fresh container drains that array on\n// boot. Chunk ids are stable across builds, so without a reset the new container\n// sees the old build's chunks as already loaded and NEVER fetches its own files —\n// the swap re-executes the OLD code under a new identity. The old container keeps\n// its captured reference to the old array, so it is unaffected.\n// 4. The DOM script-tag dedup: both the MF sdk and the chunk loader reuse an existing\n// <script> tag whose src matches (never re-executing it), so every one of the\n// remote's tags (entry AND chunks) is swept.\n// 5. The browser HTTP cache of the fixed-name remoteEntry.js: a createScript runtime\n// plugin serves the entry script with the reload nonce on its src — a never-seen\n// URL that no cache layer can answer.\n//\n// The MF runtime bindings are INJECTED (see FederationRuntimeApi): they must be the\n// host bundle's own instance — the bundler aliases '@module-federation/enhanced/runtime'\n// onto the runtime it embeds, and importing a second copy here would target the wrong\n// (or no) instance. Injection also keeps this package dependency-free.\n\n// Universal function supertype: any concrete MF runtime function is assignable.\ntype InjectedFunction = (...args: never[]) => unknown;\n\nexport type FederationRuntimeApi = {\n getInstance: InjectedFunction;\n registerRemotes: InjectedFunction;\n registerPlugins: InjectedFunction;\n};\n\ntype FederatedRemote = { name: string; alias?: string; entry: string };\n\ntype ResolvedFederationRuntime = {\n getInstance: () => { options: { remotes: (FederatedRemote | { name: string })[] } } | null | undefined;\n registerRemotes: (remotes: FederatedRemote[], options?: { force?: boolean }) => void;\n registerPlugins: (\n plugins: { name: string; createScript: (args: { url: string; remoteInfo?: { name: string } }) => HTMLScriptElement | undefined }[],\n ) => void;\n};\n\n// Remotes with a reload in flight: mf container name -> current reload nonce.\n// Module scope is safe: quidproquo-web is a module-federation shared singleton, so\n// one copy serves the page.\nconst remoteReloadNonces = new Map<string, number>();\n\nlet cacheBustPluginRegistered = false;\n\nconst ensureCacheBustPlugin = (registerPlugins: ResolvedFederationRuntime['registerPlugins']): void => {\n if (cacheBustPluginRegistered) {\n return;\n }\n cacheBustPluginRegistered = true;\n\n registerPlugins([\n {\n name: 'qpq-federated-reload-cache-bust',\n createScript(args: { url: string; remoteInfo?: { name: string } }) {\n const reloadNonce = args.remoteInfo ? remoteReloadNonces.get(args.remoteInfo.name) : undefined;\n\n if (!reloadNonce) {\n return undefined;\n }\n\n const script = document.createElement('script');\n script.src = `${args.url.split('?')[0]}?reload=${reloadNonce}`;\n return script;\n },\n },\n ]);\n};\n\n/**\n * Prepare a federated remote for a hot-swap: after this call, the next\n * loadRemote() of the remote fetches and executes its CURRENT deployment.\n * `reloadNonce` must be a fresh value per swap (a per-remote counter).\n * Returns false (with a console warning) when the remote is not registered.\n */\nexport const forceReloadFederatedRemote = (runtimeApi: FederationRuntimeApi, remoteName: string, reloadNonce: number): boolean => {\n const { getInstance, registerRemotes, registerPlugins } = runtimeApi as ResolvedFederationRuntime;\n\n const remote = getInstance()?.options.remotes.find(\n (candidate) => ('alias' in candidate && candidate.alias === remoteName) || candidate.name === remoteName,\n );\n\n if (!remote || !('entry' in remote)) {\n console.warn(`[qpq-federated-reload] remote \"${remoteName}\" not found in MF runtime options - a reload will serve the cached bundle`);\n return false;\n }\n\n ensureCacheBustPlugin(registerPlugins);\n remoteReloadNonces.set(remote.name, reloadNonce);\n\n // Layer 2: the container global.\n (globalThis as Record<string, unknown>)[remote.name] = undefined;\n\n // Layer 3: the bundler chunk-loading globals (rspack and webpack builds).\n (globalThis as Record<string, unknown>)[`rspackChunk${remote.name}`] = undefined;\n (globalThis as Record<string, unknown>)[`webpackChunk${remote.name}`] = undefined;\n\n const baseEntry = remote.entry.split('?')[0];\n const entryDir = baseEntry.slice(0, baseEntry.lastIndexOf('/'));\n\n // Layer 4: sweep ALL of this remote's script tags (entry AND chunks).\n document.querySelectorAll<HTMLScriptElement>('script[src]').forEach((scriptTag) => {\n const src = scriptTag.getAttribute('src') ?? '';\n if (src.startsWith(entryDir)) {\n scriptTag.remove();\n }\n });\n\n // Layer 1: force re-registration with the nonce'd entry.\n registerRemotes([{ ...remote, entry: `${baseEntry}?reload=${reloadNonce}` }], { force: true });\n\n return true;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './forceReloadFederatedRemote';
|
|
@@ -14,7 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./ApiRequestActionRequester"), exports);
|
|
19
|
-
__exportStar(require("./ApiRequestActionRequesterTypes"), exports);
|
|
17
|
+
__exportStar(require("./forceReloadFederatedRemote"), exports);
|
|
20
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/federation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C","sourcesContent":["export * from './forceReloadFederatedRemote';\n"]}
|
package/lib/commonjs/index.d.ts
CHANGED
package/lib/commonjs/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./actions"), exports);
|
|
18
|
+
__exportStar(require("./federation"), exports);
|
|
18
19
|
__exportStar(require("./services"), exports);
|
|
19
20
|
__exportStar(require("./tools"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB","sourcesContent":["export * from './actions';\nexport * from './services';\nexport * from './tools';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,+CAA6B;AAC7B,6CAA2B;AAC3B,0CAAwB","sourcesContent":["export * from './actions';\nexport * from './federation';\nexport * from './services';\nexport * from './tools';\n"]}
|
package/lib/esm/actions/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC","sourcesContent":["export * from './queryParams';\nexport * from './window';\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type InjectedFunction = (...args: never[]) => unknown;
|
|
2
|
+
export type FederationRuntimeApi = {
|
|
3
|
+
getInstance: InjectedFunction;
|
|
4
|
+
registerRemotes: InjectedFunction;
|
|
5
|
+
registerPlugins: InjectedFunction;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Prepare a federated remote for a hot-swap: after this call, the next
|
|
9
|
+
* loadRemote() of the remote fetches and executes its CURRENT deployment.
|
|
10
|
+
* `reloadNonce` must be a fresh value per swap (a per-remote counter).
|
|
11
|
+
* Returns false (with a console warning) when the remote is not registered.
|
|
12
|
+
*/
|
|
13
|
+
export declare const forceReloadFederatedRemote: (runtimeApi: FederationRuntimeApi, remoteName: string, reloadNonce: number) => boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Hot-swap support for a module-federation remote: make the NEXT loadRemote of a
|
|
2
|
+
// given remote genuinely re-fetch and re-execute its current deployment, instead of
|
|
3
|
+
// serving any of the FIVE stale layers a naive force re-registration leaves behind
|
|
4
|
+
// (each one found the hard way):
|
|
5
|
+
//
|
|
6
|
+
// 1. The MF runtime caches (moduleCache, manifest snapshot): force re-registration
|
|
7
|
+
// with a nonce'd entry URL clears them and guarantees a fresh manifest fetch.
|
|
8
|
+
// 2. The container global: loadEntryScript short-circuits on `window[globalName]`
|
|
9
|
+
// BEFORE fetching the entry, silently reusing the old container. Cleared by
|
|
10
|
+
// ASSIGNING undefined, not `delete` — the global is a top-level `var` from a
|
|
11
|
+
// classic script, so the window property is non-configurable and delete throws;
|
|
12
|
+
// the runtime's short-circuit is a truthiness check, so undefined is enough.
|
|
13
|
+
// 3. The bundler's chunk-loading global (`rspackChunk<name>` / `webpackChunk<name>`):
|
|
14
|
+
// shared by BUILD NAME — every chunk file of every previously loaded copy of the
|
|
15
|
+
// remote pushed its modules into it, and a fresh container drains that array on
|
|
16
|
+
// boot. Chunk ids are stable across builds, so without a reset the new container
|
|
17
|
+
// sees the old build's chunks as already loaded and NEVER fetches its own files —
|
|
18
|
+
// the swap re-executes the OLD code under a new identity. The old container keeps
|
|
19
|
+
// its captured reference to the old array, so it is unaffected.
|
|
20
|
+
// 4. The DOM script-tag dedup: both the MF sdk and the chunk loader reuse an existing
|
|
21
|
+
// <script> tag whose src matches (never re-executing it), so every one of the
|
|
22
|
+
// remote's tags (entry AND chunks) is swept.
|
|
23
|
+
// 5. The browser HTTP cache of the fixed-name remoteEntry.js: a createScript runtime
|
|
24
|
+
// plugin serves the entry script with the reload nonce on its src — a never-seen
|
|
25
|
+
// URL that no cache layer can answer.
|
|
26
|
+
//
|
|
27
|
+
// The MF runtime bindings are INJECTED (see FederationRuntimeApi): they must be the
|
|
28
|
+
// host bundle's own instance — the bundler aliases '@module-federation/enhanced/runtime'
|
|
29
|
+
// onto the runtime it embeds, and importing a second copy here would target the wrong
|
|
30
|
+
// (or no) instance. Injection also keeps this package dependency-free.
|
|
31
|
+
// Remotes with a reload in flight: mf container name -> current reload nonce.
|
|
32
|
+
// Module scope is safe: quidproquo-web is a module-federation shared singleton, so
|
|
33
|
+
// one copy serves the page.
|
|
34
|
+
const remoteReloadNonces = new Map();
|
|
35
|
+
let cacheBustPluginRegistered = false;
|
|
36
|
+
const ensureCacheBustPlugin = (registerPlugins) => {
|
|
37
|
+
if (cacheBustPluginRegistered) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
cacheBustPluginRegistered = true;
|
|
41
|
+
registerPlugins([
|
|
42
|
+
{
|
|
43
|
+
name: 'qpq-federated-reload-cache-bust',
|
|
44
|
+
createScript(args) {
|
|
45
|
+
const reloadNonce = args.remoteInfo ? remoteReloadNonces.get(args.remoteInfo.name) : undefined;
|
|
46
|
+
if (!reloadNonce) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const script = document.createElement('script');
|
|
50
|
+
script.src = `${args.url.split('?')[0]}?reload=${reloadNonce}`;
|
|
51
|
+
return script;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Prepare a federated remote for a hot-swap: after this call, the next
|
|
58
|
+
* loadRemote() of the remote fetches and executes its CURRENT deployment.
|
|
59
|
+
* `reloadNonce` must be a fresh value per swap (a per-remote counter).
|
|
60
|
+
* Returns false (with a console warning) when the remote is not registered.
|
|
61
|
+
*/
|
|
62
|
+
export const forceReloadFederatedRemote = (runtimeApi, remoteName, reloadNonce) => {
|
|
63
|
+
const { getInstance, registerRemotes, registerPlugins } = runtimeApi;
|
|
64
|
+
const remote = getInstance()?.options.remotes.find((candidate) => ('alias' in candidate && candidate.alias === remoteName) || candidate.name === remoteName);
|
|
65
|
+
if (!remote || !('entry' in remote)) {
|
|
66
|
+
console.warn(`[qpq-federated-reload] remote "${remoteName}" not found in MF runtime options - a reload will serve the cached bundle`);
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
ensureCacheBustPlugin(registerPlugins);
|
|
70
|
+
remoteReloadNonces.set(remote.name, reloadNonce);
|
|
71
|
+
// Layer 2: the container global.
|
|
72
|
+
globalThis[remote.name] = undefined;
|
|
73
|
+
// Layer 3: the bundler chunk-loading globals (rspack and webpack builds).
|
|
74
|
+
globalThis[`rspackChunk${remote.name}`] = undefined;
|
|
75
|
+
globalThis[`webpackChunk${remote.name}`] = undefined;
|
|
76
|
+
const baseEntry = remote.entry.split('?')[0];
|
|
77
|
+
const entryDir = baseEntry.slice(0, baseEntry.lastIndexOf('/'));
|
|
78
|
+
// Layer 4: sweep ALL of this remote's script tags (entry AND chunks).
|
|
79
|
+
document.querySelectorAll('script[src]').forEach((scriptTag) => {
|
|
80
|
+
const src = scriptTag.getAttribute('src') ?? '';
|
|
81
|
+
if (src.startsWith(entryDir)) {
|
|
82
|
+
scriptTag.remove();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
// Layer 1: force re-registration with the nonce'd entry.
|
|
86
|
+
registerRemotes([{ ...remote, entry: `${baseEntry}?reload=${reloadNonce}` }], { force: true });
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=forceReloadFederatedRemote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forceReloadFederatedRemote.js","sourceRoot":"","sources":["../../../src/federation/forceReloadFederatedRemote.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,oFAAoF;AACpF,mFAAmF;AACnF,iCAAiC;AACjC,EAAE;AACF,qFAAqF;AACrF,mFAAmF;AACnF,oFAAoF;AACpF,iFAAiF;AACjF,kFAAkF;AAClF,qFAAqF;AACrF,kFAAkF;AAClF,wFAAwF;AACxF,sFAAsF;AACtF,qFAAqF;AACrF,sFAAsF;AACtF,uFAAuF;AACvF,uFAAuF;AACvF,qEAAqE;AACrE,wFAAwF;AACxF,mFAAmF;AACnF,kDAAkD;AAClD,uFAAuF;AACvF,sFAAsF;AACtF,2CAA2C;AAC3C,EAAE;AACF,oFAAoF;AACpF,yFAAyF;AACz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EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/F,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["// Hot-swap support for a module-federation remote: make the NEXT loadRemote of a\n// given remote genuinely re-fetch and re-execute its current deployment, instead of\n// serving any of the FIVE stale layers a naive force re-registration leaves behind\n// (each one found the hard way):\n//\n// 1. The MF runtime caches (moduleCache, manifest snapshot): force re-registration\n// with a nonce'd entry URL clears them and guarantees a fresh manifest fetch.\n// 2. The container global: loadEntryScript short-circuits on `window[globalName]`\n// BEFORE fetching the entry, silently reusing the old container. Cleared by\n// ASSIGNING undefined, not `delete` — the global is a top-level `var` from a\n// classic script, so the window property is non-configurable and delete throws;\n// the runtime's short-circuit is a truthiness check, so undefined is enough.\n// 3. The bundler's chunk-loading global (`rspackChunk<name>` / `webpackChunk<name>`):\n// shared by BUILD NAME — every chunk file of every previously loaded copy of the\n// remote pushed its modules into it, and a fresh container drains that array on\n// boot. Chunk ids are stable across builds, so without a reset the new container\n// sees the old build's chunks as already loaded and NEVER fetches its own files —\n// the swap re-executes the OLD code under a new identity. The old container keeps\n// its captured reference to the old array, so it is unaffected.\n// 4. The DOM script-tag dedup: both the MF sdk and the chunk loader reuse an existing\n// <script> tag whose src matches (never re-executing it), so every one of the\n// remote's tags (entry AND chunks) is swept.\n// 5. The browser HTTP cache of the fixed-name remoteEntry.js: a createScript runtime\n// plugin serves the entry script with the reload nonce on its src — a never-seen\n// URL that no cache layer can answer.\n//\n// The MF runtime bindings are INJECTED (see FederationRuntimeApi): they must be the\n// host bundle's own instance — the bundler aliases '@module-federation/enhanced/runtime'\n// onto the runtime it embeds, and importing a second copy here would target the wrong\n// (or no) instance. Injection also keeps this package dependency-free.\n\n// Universal function supertype: any concrete MF runtime function is assignable.\ntype InjectedFunction = (...args: never[]) => unknown;\n\nexport type FederationRuntimeApi = {\n getInstance: InjectedFunction;\n registerRemotes: InjectedFunction;\n registerPlugins: InjectedFunction;\n};\n\ntype FederatedRemote = { name: string; alias?: string; entry: string };\n\ntype ResolvedFederationRuntime = {\n getInstance: () => { options: { remotes: (FederatedRemote | { name: string })[] } } | null | undefined;\n registerRemotes: (remotes: FederatedRemote[], options?: { force?: boolean }) => void;\n registerPlugins: (\n plugins: { name: string; createScript: (args: { url: string; remoteInfo?: { name: string } }) => HTMLScriptElement | undefined }[],\n ) => void;\n};\n\n// Remotes with a reload in flight: mf container name -> current reload nonce.\n// Module scope is safe: quidproquo-web is a module-federation shared singleton, so\n// one copy serves the page.\nconst remoteReloadNonces = new Map<string, number>();\n\nlet cacheBustPluginRegistered = false;\n\nconst ensureCacheBustPlugin = (registerPlugins: ResolvedFederationRuntime['registerPlugins']): void => {\n if (cacheBustPluginRegistered) {\n return;\n }\n cacheBustPluginRegistered = true;\n\n registerPlugins([\n {\n name: 'qpq-federated-reload-cache-bust',\n createScript(args: { url: string; remoteInfo?: { name: string } }) {\n const reloadNonce = args.remoteInfo ? remoteReloadNonces.get(args.remoteInfo.name) : undefined;\n\n if (!reloadNonce) {\n return undefined;\n }\n\n const script = document.createElement('script');\n script.src = `${args.url.split('?')[0]}?reload=${reloadNonce}`;\n return script;\n },\n },\n ]);\n};\n\n/**\n * Prepare a federated remote for a hot-swap: after this call, the next\n * loadRemote() of the remote fetches and executes its CURRENT deployment.\n * `reloadNonce` must be a fresh value per swap (a per-remote counter).\n * Returns false (with a console warning) when the remote is not registered.\n */\nexport const forceReloadFederatedRemote = (runtimeApi: FederationRuntimeApi, remoteName: string, reloadNonce: number): boolean => {\n const { getInstance, registerRemotes, registerPlugins } = runtimeApi as ResolvedFederationRuntime;\n\n const remote = getInstance()?.options.remotes.find(\n (candidate) => ('alias' in candidate && candidate.alias === remoteName) || candidate.name === remoteName,\n );\n\n if (!remote || !('entry' in remote)) {\n console.warn(`[qpq-federated-reload] remote \"${remoteName}\" not found in MF runtime options - a reload will serve the cached bundle`);\n return false;\n }\n\n ensureCacheBustPlugin(registerPlugins);\n remoteReloadNonces.set(remote.name, reloadNonce);\n\n // Layer 2: the container global.\n (globalThis as Record<string, unknown>)[remote.name] = undefined;\n\n // Layer 3: the bundler chunk-loading globals (rspack and webpack builds).\n (globalThis as Record<string, unknown>)[`rspackChunk${remote.name}`] = undefined;\n (globalThis as Record<string, unknown>)[`webpackChunk${remote.name}`] = undefined;\n\n const baseEntry = remote.entry.split('?')[0];\n const entryDir = baseEntry.slice(0, baseEntry.lastIndexOf('/'));\n\n // Layer 4: sweep ALL of this remote's script tags (entry AND chunks).\n document.querySelectorAll<HTMLScriptElement>('script[src]').forEach((scriptTag) => {\n const src = scriptTag.getAttribute('src') ?? '';\n if (src.startsWith(entryDir)) {\n scriptTag.remove();\n }\n });\n\n // Layer 1: force re-registration with the nonce'd entry.\n registerRemotes([{ ...remote, entry: `${baseEntry}?reload=${reloadNonce}` }], { force: true });\n\n return true;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './forceReloadFederatedRemote';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/federation/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC","sourcesContent":["export * from './forceReloadFederatedRemote';\n"]}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["export * from './actions';\nexport * from './services';\nexport * from './tools';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["export * from './actions';\nexport * from './federation';\nexport * from './services';\nexport * from './tools';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/joe-coady/quidproquo#readme",
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"quidproquo-core": "0.1.
|
|
36
|
-
"quidproquo-tsconfig": "0.1.
|
|
37
|
-
"quidproquo-webserver": "0.1.
|
|
35
|
+
"quidproquo-core": "0.1.11",
|
|
36
|
+
"quidproquo-tsconfig": "0.1.11",
|
|
37
|
+
"quidproquo-webserver": "0.1.11",
|
|
38
38
|
"typescript": "^5.8.2"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiActionType = void 0;
|
|
4
|
-
var ApiActionType;
|
|
5
|
-
(function (ApiActionType) {
|
|
6
|
-
ApiActionType["Request"] = "@quidproquo-web/Api/Request";
|
|
7
|
-
})(ApiActionType || (exports.ApiActionType = ApiActionType = {}));
|
|
8
|
-
//# sourceMappingURL=ApiActionType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiActionType.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiActionType.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,wDAAuC,CAAA;AACzC,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB","sourcesContent":["export enum ApiActionType {\n Request = '@quidproquo-web/Api/Request',\n}\n"]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { HTTPMethod } from 'quidproquo-core';
|
|
2
|
-
import { ApiRequestActionRequester, ApiRequestOptions } from './ApiRequestActionRequesterTypes';
|
|
3
|
-
export declare function askApiRequest<T, R>(service: string, method: HTTPMethod, endpoint: string, options?: ApiRequestOptions<T>): ApiRequestActionRequester<T, R>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.askApiRequest = askApiRequest;
|
|
4
|
-
const ApiActionType_1 = require("./ApiActionType");
|
|
5
|
-
function* askApiRequest(service, method, endpoint, options) {
|
|
6
|
-
return yield {
|
|
7
|
-
type: ApiActionType_1.ApiActionType.Request,
|
|
8
|
-
payload: {
|
|
9
|
-
service,
|
|
10
|
-
endpoint,
|
|
11
|
-
method,
|
|
12
|
-
body: options === null || options === void 0 ? void 0 : options.body,
|
|
13
|
-
headers: options === null || options === void 0 ? void 0 : options.headers,
|
|
14
|
-
params: options === null || options === void 0 ? void 0 : options.params,
|
|
15
|
-
responseType: (options === null || options === void 0 ? void 0 : options.responseType) || 'json',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=ApiRequestActionRequester.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRequestActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequester.ts"],"names":[],"mappings":";;AAKA,sCAkBC;AArBD,mDAAgD;AAGhD,QAAe,CAAC,CAAC,aAAa,CAC5B,OAAe,EACf,MAAkB,EAClB,QAAgB,EAChB,OAA8B;IAE9B,OAAO,MAAM;QACX,IAAI,EAAE,6BAAa,CAAC,OAAO;QAC3B,OAAO,EAAE;YACP,OAAO;YACP,QAAQ;YACR,MAAM;YACN,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;YACnB,OAAO,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO;YACzB,MAAM,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM;YACvB,YAAY,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,MAAM;SAC9C;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { HTTPMethod } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\nimport { ApiRequestActionRequester, ApiRequestOptions } from './ApiRequestActionRequesterTypes';\n\nexport function* askApiRequest<T, R>(\n service: string,\n method: HTTPMethod,\n endpoint: string,\n options?: ApiRequestOptions<T>,\n): ApiRequestActionRequester<T, R> {\n return yield {\n type: ApiActionType.Request,\n payload: {\n service,\n endpoint,\n method,\n body: options?.body,\n headers: options?.headers,\n params: options?.params,\n responseType: options?.responseType || 'json',\n },\n };\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Action, ActionProcessor, ActionRequester, HTTPMethod, HTTPNetworkResponse, HTTPRequestOptions, ResponseType } from 'quidproquo-core';
|
|
2
|
-
import { ApiActionType } from './ApiActionType';
|
|
3
|
-
export type ApiRequestOptions<T> = Omit<HTTPRequestOptions<T>, 'basePath'>;
|
|
4
|
-
export interface ApiRequestActionPayload<T> {
|
|
5
|
-
service: string;
|
|
6
|
-
endpoint: string;
|
|
7
|
-
method: HTTPMethod;
|
|
8
|
-
body?: T;
|
|
9
|
-
params?: Record<string, string>;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
responseType: ResponseType;
|
|
12
|
-
}
|
|
13
|
-
export interface ApiRequestAction<T> extends Action<ApiRequestActionPayload<T>> {
|
|
14
|
-
type: ApiActionType.Request;
|
|
15
|
-
payload: ApiRequestActionPayload<T>;
|
|
16
|
-
}
|
|
17
|
-
export type ApiRequestActionProcessor<T, R> = ActionProcessor<ApiRequestAction<T>, HTTPNetworkResponse<R>>;
|
|
18
|
-
export type ApiRequestActionRequester<T, R> = ActionRequester<ApiRequestAction<T>, HTTPNetworkResponse<R>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRequestActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester, HTTPMethod, HTTPNetworkResponse, HTTPRequestOptions, ResponseType } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\n\n// basePath is resolved by the processor, so it is omitted from the caller options\nexport type ApiRequestOptions<T> = Omit<HTTPRequestOptions<T>, 'basePath'>;\n\n// Payload\nexport interface ApiRequestActionPayload<T> {\n service: string;\n endpoint: string;\n method: HTTPMethod;\n body?: T;\n params?: Record<string, string>;\n headers?: Record<string, string>;\n responseType: ResponseType;\n}\n\n// Action\nexport interface ApiRequestAction<T> extends Action<ApiRequestActionPayload<T>> {\n type: ApiActionType.Request;\n payload: ApiRequestActionPayload<T>;\n}\n\n// Function Types\nexport type ApiRequestActionProcessor<T, R> = ActionProcessor<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\nexport type ApiRequestActionRequester<T, R> = ActionRequester<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8DAA4C;AAC5C,mEAAiD","sourcesContent":["export * from './ApiActionType';\nexport * from './ApiRequestActionRequester';\nexport * from './ApiRequestActionRequesterTypes';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiActionType.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiActionType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,wDAAuC,CAAA;AACzC,CAAC,EAFW,aAAa,KAAb,aAAa,QAExB","sourcesContent":["export enum ApiActionType {\n Request = '@quidproquo-web/Api/Request',\n}\n"]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { HTTPMethod } from 'quidproquo-core';
|
|
2
|
-
import { ApiRequestActionRequester, ApiRequestOptions } from './ApiRequestActionRequesterTypes';
|
|
3
|
-
export declare function askApiRequest<T, R>(service: string, method: HTTPMethod, endpoint: string, options?: ApiRequestOptions<T>): ApiRequestActionRequester<T, R>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ApiActionType } from './ApiActionType';
|
|
2
|
-
export function* askApiRequest(service, method, endpoint, options) {
|
|
3
|
-
return yield {
|
|
4
|
-
type: ApiActionType.Request,
|
|
5
|
-
payload: {
|
|
6
|
-
service,
|
|
7
|
-
endpoint,
|
|
8
|
-
method,
|
|
9
|
-
body: options?.body,
|
|
10
|
-
headers: options?.headers,
|
|
11
|
-
params: options?.params,
|
|
12
|
-
responseType: options?.responseType || 'json',
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ApiRequestActionRequester.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRequestActionRequester.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequester.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,SAAS,CAAC,CAAC,aAAa,CAC5B,OAAe,EACf,MAAkB,EAClB,QAAgB,EAChB,OAA8B;IAE9B,OAAO,MAAM;QACX,IAAI,EAAE,aAAa,CAAC,OAAO;QAC3B,OAAO,EAAE;YACP,OAAO;YACP,QAAQ;YACR,MAAM;YACN,IAAI,EAAE,OAAO,EAAE,IAAI;YACnB,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,MAAM,EAAE,OAAO,EAAE,MAAM;YACvB,YAAY,EAAE,OAAO,EAAE,YAAY,IAAI,MAAM;SAC9C;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { HTTPMethod } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\nimport { ApiRequestActionRequester, ApiRequestOptions } from './ApiRequestActionRequesterTypes';\n\nexport function* askApiRequest<T, R>(\n service: string,\n method: HTTPMethod,\n endpoint: string,\n options?: ApiRequestOptions<T>,\n): ApiRequestActionRequester<T, R> {\n return yield {\n type: ApiActionType.Request,\n payload: {\n service,\n endpoint,\n method,\n body: options?.body,\n headers: options?.headers,\n params: options?.params,\n responseType: options?.responseType || 'json',\n },\n };\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Action, ActionProcessor, ActionRequester, HTTPMethod, HTTPNetworkResponse, HTTPRequestOptions, ResponseType } from 'quidproquo-core';
|
|
2
|
-
import { ApiActionType } from './ApiActionType';
|
|
3
|
-
export type ApiRequestOptions<T> = Omit<HTTPRequestOptions<T>, 'basePath'>;
|
|
4
|
-
export interface ApiRequestActionPayload<T> {
|
|
5
|
-
service: string;
|
|
6
|
-
endpoint: string;
|
|
7
|
-
method: HTTPMethod;
|
|
8
|
-
body?: T;
|
|
9
|
-
params?: Record<string, string>;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
responseType: ResponseType;
|
|
12
|
-
}
|
|
13
|
-
export interface ApiRequestAction<T> extends Action<ApiRequestActionPayload<T>> {
|
|
14
|
-
type: ApiActionType.Request;
|
|
15
|
-
payload: ApiRequestActionPayload<T>;
|
|
16
|
-
}
|
|
17
|
-
export type ApiRequestActionProcessor<T, R> = ActionProcessor<ApiRequestAction<T>, HTTPNetworkResponse<R>>;
|
|
18
|
-
export type ApiRequestActionRequester<T, R> = ActionRequester<ApiRequestAction<T>, HTTPNetworkResponse<R>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ApiRequestActionRequesterTypes.js","sourceRoot":"","sources":["../../../../src/actions/api/ApiRequestActionRequesterTypes.ts"],"names":[],"mappings":"","sourcesContent":["import { Action, ActionProcessor, ActionRequester, HTTPMethod, HTTPNetworkResponse, HTTPRequestOptions, ResponseType } from 'quidproquo-core';\n\nimport { ApiActionType } from './ApiActionType';\n\n// basePath is resolved by the processor, so it is omitted from the caller options\nexport type ApiRequestOptions<T> = Omit<HTTPRequestOptions<T>, 'basePath'>;\n\n// Payload\nexport interface ApiRequestActionPayload<T> {\n service: string;\n endpoint: string;\n method: HTTPMethod;\n body?: T;\n params?: Record<string, string>;\n headers?: Record<string, string>;\n responseType: ResponseType;\n}\n\n// Action\nexport interface ApiRequestAction<T> extends Action<ApiRequestActionPayload<T>> {\n type: ApiActionType.Request;\n payload: ApiRequestActionPayload<T>;\n}\n\n// Function Types\nexport type ApiRequestActionProcessor<T, R> = ActionProcessor<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\nexport type ApiRequestActionRequester<T, R> = ActionRequester<ApiRequestAction<T>, HTTPNetworkResponse<R>>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/actions/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './ApiActionType';\nexport * from './ApiRequestActionRequester';\nexport * from './ApiRequestActionRequesterTypes';\n"]}
|