@reactionary/ucp 0.10.34 → 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
|
-
|
|
3
|
+
getHttpProtocolResultAttributes,
|
|
4
|
+
MemoryCache,
|
|
5
|
+
traceProtocolInvocation
|
|
4
6
|
} from "@reactionary/core";
|
|
5
7
|
import {
|
|
6
8
|
} from "./reactionary-ucp-common.js";
|
|
@@ -27,7 +29,16 @@ class ReactionaryUCPServer {
|
|
|
27
29
|
sessionStore;
|
|
28
30
|
identity;
|
|
29
31
|
async fetch(request) {
|
|
30
|
-
|
|
32
|
+
const route = getRequestRoute(request, this.options.profile);
|
|
33
|
+
return traceProtocolInvocation(
|
|
34
|
+
{
|
|
35
|
+
protocol: "ucp",
|
|
36
|
+
operation: `${request.method} ${getUcpOperationPath(route.path)}`,
|
|
37
|
+
attributes: { "http.request.method": request.method }
|
|
38
|
+
},
|
|
39
|
+
() => this.handleFetch(request),
|
|
40
|
+
getHttpProtocolResultAttributes
|
|
41
|
+
);
|
|
31
42
|
}
|
|
32
43
|
async handleFetch(request) {
|
|
33
44
|
const sessionId = getOrCreateSessionId(request);
|
|
@@ -129,6 +140,9 @@ class ReactionaryUCPServer {
|
|
|
129
140
|
});
|
|
130
141
|
}
|
|
131
142
|
}
|
|
143
|
+
function getUcpOperationPath(path) {
|
|
144
|
+
return path.replace(/^\/carts\/[^/]+/, "/carts/{id}").replace(/^\/checkout-sessions\/[^/]+/, "/checkout-sessions/{id}").replace(/^\/orders\/[^/]+/, "/orders/{id}");
|
|
145
|
+
}
|
|
132
146
|
export {
|
|
133
147
|
ReactionaryUCPServer
|
|
134
148
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/ucp",
|
|
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,7 +9,7 @@
|
|
|
9
9
|
"url": "git+https://github.com/Solteq/reactionary.git"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@reactionary/core": "0.10.
|
|
12
|
+
"@reactionary/core": "0.10.35",
|
|
13
13
|
"zod": "4.1.9"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|