@reactionary/acp 0.10.33 → 0.10.35
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createInitialRequestContext,
|
|
3
|
+
getHttpProtocolResultAttributes,
|
|
3
4
|
MemoryCache,
|
|
5
|
+
traceProtocolInvocation,
|
|
4
6
|
SessionSchema
|
|
5
7
|
} from "@reactionary/core";
|
|
6
8
|
import {
|
|
@@ -37,6 +39,17 @@ class ReactionaryACPServer {
|
|
|
37
39
|
sessionStore;
|
|
38
40
|
checkoutSessionStore;
|
|
39
41
|
async fetch(request) {
|
|
42
|
+
return traceProtocolInvocation(
|
|
43
|
+
{
|
|
44
|
+
protocol: "acp",
|
|
45
|
+
operation: `${request.method} ${getAcpOperationPath(request, this.options.basePath)}`,
|
|
46
|
+
attributes: { "http.request.method": request.method }
|
|
47
|
+
},
|
|
48
|
+
() => this.handleFetch(request),
|
|
49
|
+
getHttpProtocolResultAttributes
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
async handleFetch(request) {
|
|
40
53
|
const sessionId = getOrCreateSessionId(request);
|
|
41
54
|
const requestContext = await this.createRequestContext(sessionId);
|
|
42
55
|
const requestedFeed = this.getRequestedProductFeed(request);
|
|
@@ -840,6 +853,10 @@ async function sendWebResponse(response, webResponse) {
|
|
|
840
853
|
}
|
|
841
854
|
response.end();
|
|
842
855
|
}
|
|
856
|
+
function getAcpOperationPath(request, basePath) {
|
|
857
|
+
const pathname = getProtocolPathname(request, basePath);
|
|
858
|
+
return pathname.replace(/^\/checkout_sessions\/[^/]+/, "/checkout_sessions/{id}").replace(/^\/product_feeds\/[^/]+/, "/product_feeds/{id}");
|
|
859
|
+
}
|
|
843
860
|
export {
|
|
844
861
|
ReactionaryACPServer
|
|
845
862
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/acp",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"url": "git+https://github.com/Solteq/reactionary.git"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@reactionary/core": "0.10.
|
|
13
|
-
"@reactionary/feeds": "0.10.
|
|
12
|
+
"@reactionary/core": "0.10.35",
|
|
13
|
+
"@reactionary/feeds": "0.10.35",
|
|
14
14
|
"zod": "4.1.9"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
@@ -100,6 +100,7 @@ export declare class ReactionaryACPServer<TClient extends ReactionaryACPClient =
|
|
|
100
100
|
private readonly checkoutSessionStore;
|
|
101
101
|
constructor(clientFactory: ReactionaryACPClientFactory<TClient>, options?: ReactionaryACPServerOptions);
|
|
102
102
|
fetch(request: Request): Promise<Response>;
|
|
103
|
+
private handleFetch;
|
|
103
104
|
getHandler(): ReactionaryACPHttpHandler;
|
|
104
105
|
toNodeHandler(): ReactionaryACPNodeRequestHandler;
|
|
105
106
|
close(): Promise<void>;
|