@thirdweb-dev/service-utils 0.4.33-nightly-e7434891354f351d2a399daebdddae9cf1fc817b-20240623000619 → 0.4.33-nightly-7be7b6ff84b83ee587d369f4e8da5a2d9f80b8c2-20240626221701
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/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.dev.js +12 -2
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.prod.js +12 -2
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.esm.js +12 -2
- package/dist/declarations/src/cf-worker/usage.d.ts +30 -0
- package/dist/declarations/src/cf-worker/usage.d.ts.map +1 -1
- package/node/dist/thirdweb-dev-service-utils-node.cjs.dev.js +2 -2
- package/node/dist/thirdweb-dev-service-utils-node.cjs.prod.js +2 -2
- package/node/dist/thirdweb-dev-service-utils-node.esm.js +2 -2
- package/package.json +1 -1
@@ -68,7 +68,17 @@ const usageEventSchema = zod.z.object({
|
|
68
68
|
httpMethod: zod.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "CONNECT", "OPTIONS", "TRACE"]).optional(),
|
69
69
|
// Used to identify the ecosystem that the an ecosystem wallet belongs too
|
70
70
|
ecosystemId: zod.z.string().optional(),
|
71
|
-
ecosystemPartnerId: zod.z.string().optional()
|
71
|
+
ecosystemPartnerId: zod.z.string().optional(),
|
72
|
+
chainName: zod.z.string().optional(),
|
73
|
+
tokenSymbol: zod.z.string().optional(),
|
74
|
+
dstChainId: zod.z.number().optional(),
|
75
|
+
dstTokenAddress: zod.z.string().optional(),
|
76
|
+
dstChainName: zod.z.string().optional(),
|
77
|
+
dstTokenSymbol: zod.z.string().optional(),
|
78
|
+
msLatency: zod.z.number().optional(),
|
79
|
+
toAmountUSDCents: zod.z.number().optional(),
|
80
|
+
secondaryProvider: zod.z.string().optional(),
|
81
|
+
onRampId: zod.z.string().optional()
|
72
82
|
});
|
73
83
|
/**
|
74
84
|
* Publish usage events. Provide the relevant fields for your application.
|
@@ -205,7 +215,7 @@ async function extractAuthorizationData(authInput) {
|
|
205
215
|
const authHeader = headers.get("authorization");
|
206
216
|
if (authHeader) {
|
207
217
|
const [type, token] = authHeader.split(" ");
|
208
|
-
if (type
|
218
|
+
if (type?.toLowerCase() === "bearer" && !!token) {
|
209
219
|
jwt = token;
|
210
220
|
}
|
211
221
|
}
|
@@ -68,7 +68,17 @@ const usageEventSchema = zod.z.object({
|
|
68
68
|
httpMethod: zod.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "CONNECT", "OPTIONS", "TRACE"]).optional(),
|
69
69
|
// Used to identify the ecosystem that the an ecosystem wallet belongs too
|
70
70
|
ecosystemId: zod.z.string().optional(),
|
71
|
-
ecosystemPartnerId: zod.z.string().optional()
|
71
|
+
ecosystemPartnerId: zod.z.string().optional(),
|
72
|
+
chainName: zod.z.string().optional(),
|
73
|
+
tokenSymbol: zod.z.string().optional(),
|
74
|
+
dstChainId: zod.z.number().optional(),
|
75
|
+
dstTokenAddress: zod.z.string().optional(),
|
76
|
+
dstChainName: zod.z.string().optional(),
|
77
|
+
dstTokenSymbol: zod.z.string().optional(),
|
78
|
+
msLatency: zod.z.number().optional(),
|
79
|
+
toAmountUSDCents: zod.z.number().optional(),
|
80
|
+
secondaryProvider: zod.z.string().optional(),
|
81
|
+
onRampId: zod.z.string().optional()
|
72
82
|
});
|
73
83
|
/**
|
74
84
|
* Publish usage events. Provide the relevant fields for your application.
|
@@ -205,7 +215,7 @@ async function extractAuthorizationData(authInput) {
|
|
205
215
|
const authHeader = headers.get("authorization");
|
206
216
|
if (authHeader) {
|
207
217
|
const [type, token] = authHeader.split(" ");
|
208
|
-
if (type
|
218
|
+
if (type?.toLowerCase() === "bearer" && !!token) {
|
209
219
|
jwt = token;
|
210
220
|
}
|
211
221
|
}
|
@@ -65,7 +65,17 @@ const usageEventSchema = z.object({
|
|
65
65
|
httpMethod: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "CONNECT", "OPTIONS", "TRACE"]).optional(),
|
66
66
|
// Used to identify the ecosystem that the an ecosystem wallet belongs too
|
67
67
|
ecosystemId: z.string().optional(),
|
68
|
-
ecosystemPartnerId: z.string().optional()
|
68
|
+
ecosystemPartnerId: z.string().optional(),
|
69
|
+
chainName: z.string().optional(),
|
70
|
+
tokenSymbol: z.string().optional(),
|
71
|
+
dstChainId: z.number().optional(),
|
72
|
+
dstTokenAddress: z.string().optional(),
|
73
|
+
dstChainName: z.string().optional(),
|
74
|
+
dstTokenSymbol: z.string().optional(),
|
75
|
+
msLatency: z.number().optional(),
|
76
|
+
toAmountUSDCents: z.number().optional(),
|
77
|
+
secondaryProvider: z.string().optional(),
|
78
|
+
onRampId: z.string().optional()
|
69
79
|
});
|
70
80
|
/**
|
71
81
|
* Publish usage events. Provide the relevant fields for your application.
|
@@ -202,7 +212,7 @@ async function extractAuthorizationData(authInput) {
|
|
202
212
|
const authHeader = headers.get("authorization");
|
203
213
|
if (authHeader) {
|
204
214
|
const [type, token] = authHeader.split(" ");
|
205
|
-
if (type
|
215
|
+
if (type?.toLowerCase() === "bearer" && !!token) {
|
206
216
|
jwt = token;
|
207
217
|
}
|
208
218
|
}
|
@@ -50,6 +50,16 @@ declare const usageEventSchema: z.ZodObject<{
|
|
50
50
|
httpMethod: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "CONNECT", "OPTIONS", "TRACE"]>>;
|
51
51
|
ecosystemId: z.ZodOptional<z.ZodString>;
|
52
52
|
ecosystemPartnerId: z.ZodOptional<z.ZodString>;
|
53
|
+
chainName: z.ZodOptional<z.ZodString>;
|
54
|
+
tokenSymbol: z.ZodOptional<z.ZodString>;
|
55
|
+
dstChainId: z.ZodOptional<z.ZodNumber>;
|
56
|
+
dstTokenAddress: z.ZodOptional<z.ZodString>;
|
57
|
+
dstChainName: z.ZodOptional<z.ZodString>;
|
58
|
+
dstTokenSymbol: z.ZodOptional<z.ZodString>;
|
59
|
+
msLatency: z.ZodOptional<z.ZodNumber>;
|
60
|
+
toAmountUSDCents: z.ZodOptional<z.ZodNumber>;
|
61
|
+
secondaryProvider: z.ZodOptional<z.ZodString>;
|
62
|
+
onRampId: z.ZodOptional<z.ZodString>;
|
53
63
|
}, "strip", z.ZodTypeAny, {
|
54
64
|
source: "storage" | "rpc" | "bundler" | "relayer" | "embeddedWallets" | "checkout" | "pay" | "ecosystemWallets" | "paymaster" | "connectWallet" | "engine";
|
55
65
|
action: string;
|
@@ -95,6 +105,16 @@ declare const usageEventSchema: z.ZodObject<{
|
|
95
105
|
httpMethod?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "TRACE" | undefined;
|
96
106
|
ecosystemId?: string | undefined;
|
97
107
|
ecosystemPartnerId?: string | undefined;
|
108
|
+
chainName?: string | undefined;
|
109
|
+
tokenSymbol?: string | undefined;
|
110
|
+
dstChainId?: number | undefined;
|
111
|
+
dstTokenAddress?: string | undefined;
|
112
|
+
dstChainName?: string | undefined;
|
113
|
+
dstTokenSymbol?: string | undefined;
|
114
|
+
msLatency?: number | undefined;
|
115
|
+
toAmountUSDCents?: number | undefined;
|
116
|
+
secondaryProvider?: string | undefined;
|
117
|
+
onRampId?: string | undefined;
|
98
118
|
}, {
|
99
119
|
source: "storage" | "rpc" | "bundler" | "relayer" | "embeddedWallets" | "checkout" | "pay" | "ecosystemWallets" | "paymaster" | "connectWallet" | "engine";
|
100
120
|
action: string;
|
@@ -140,6 +160,16 @@ declare const usageEventSchema: z.ZodObject<{
|
|
140
160
|
httpMethod?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "TRACE" | undefined;
|
141
161
|
ecosystemId?: string | undefined;
|
142
162
|
ecosystemPartnerId?: string | undefined;
|
163
|
+
chainName?: string | undefined;
|
164
|
+
tokenSymbol?: string | undefined;
|
165
|
+
dstChainId?: number | undefined;
|
166
|
+
dstTokenAddress?: string | undefined;
|
167
|
+
dstChainName?: string | undefined;
|
168
|
+
dstTokenSymbol?: string | undefined;
|
169
|
+
msLatency?: number | undefined;
|
170
|
+
toAmountUSDCents?: number | undefined;
|
171
|
+
secondaryProvider?: string | undefined;
|
172
|
+
onRampId?: string | undefined;
|
143
173
|
}>;
|
144
174
|
export type UsageEvent = z.infer<typeof usageEventSchema>;
|
145
175
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usage.d.ts","sourceRoot":"../../../../src/cf-worker","sources":["usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;IAgBpB;;OAEG
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"../../../../src/cf-worker","sources":["usage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;IAgBpB;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEH,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,UAAU,EAAE,EACzB,MAAM,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
@@ -48,7 +48,7 @@ async function authorizeNode(authInput, serviceConfig) {
|
|
48
48
|
function getHeader(headers, headerName) {
|
49
49
|
const header = headers[headerName];
|
50
50
|
if (Array.isArray(header)) {
|
51
|
-
return header[0];
|
51
|
+
return header?.[0] ?? null;
|
52
52
|
}
|
53
53
|
return header ?? null;
|
54
54
|
}
|
@@ -114,7 +114,7 @@ function extractAuthorizationData(authInput) {
|
|
114
114
|
const authorizationHeader = getHeader(headers, "authorization");
|
115
115
|
if (authorizationHeader) {
|
116
116
|
const [type, token] = authorizationHeader.split(" ");
|
117
|
-
if (type
|
117
|
+
if (type?.toLowerCase() === "bearer" && !!token) {
|
118
118
|
jwt = token;
|
119
119
|
const walletAuthHeader = getHeader(headers, "x-authorize-wallet");
|
120
120
|
// IK a stringified boolean is not ideal, but it's required to pass it in the headers.
|
@@ -48,7 +48,7 @@ async function authorizeNode(authInput, serviceConfig) {
|
|
48
48
|
function getHeader(headers, headerName) {
|
49
49
|
const header = headers[headerName];
|
50
50
|
if (Array.isArray(header)) {
|
51
|
-
return header[0];
|
51
|
+
return header?.[0] ?? null;
|
52
52
|
}
|
53
53
|
return header ?? null;
|
54
54
|
}
|
@@ -114,7 +114,7 @@ function extractAuthorizationData(authInput) {
|
|
114
114
|
const authorizationHeader = getHeader(headers, "authorization");
|
115
115
|
if (authorizationHeader) {
|
116
116
|
const [type, token] = authorizationHeader.split(" ");
|
117
|
-
if (type
|
117
|
+
if (type?.toLowerCase() === "bearer" && !!token) {
|
118
118
|
jwt = token;
|
119
119
|
const walletAuthHeader = getHeader(headers, "x-authorize-wallet");
|
120
120
|
// IK a stringified boolean is not ideal, but it's required to pass it in the headers.
|
@@ -45,7 +45,7 @@ async function authorizeNode(authInput, serviceConfig) {
|
|
45
45
|
function getHeader(headers, headerName) {
|
46
46
|
const header = headers[headerName];
|
47
47
|
if (Array.isArray(header)) {
|
48
|
-
return header[0];
|
48
|
+
return header?.[0] ?? null;
|
49
49
|
}
|
50
50
|
return header ?? null;
|
51
51
|
}
|
@@ -111,7 +111,7 @@ function extractAuthorizationData(authInput) {
|
|
111
111
|
const authorizationHeader = getHeader(headers, "authorization");
|
112
112
|
if (authorizationHeader) {
|
113
113
|
const [type, token] = authorizationHeader.split(" ");
|
114
|
-
if (type
|
114
|
+
if (type?.toLowerCase() === "bearer" && !!token) {
|
115
115
|
jwt = token;
|
116
116
|
const walletAuthHeader = getHeader(headers, "x-authorize-wallet");
|
117
117
|
// IK a stringified boolean is not ideal, but it's required to pass it in the headers.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@thirdweb-dev/service-utils",
|
3
|
-
"version": "0.4.33-nightly-
|
3
|
+
"version": "0.4.33-nightly-7be7b6ff84b83ee587d369f4e8da5a2d9f80b8c2-20240626221701",
|
4
4
|
"main": "dist/thirdweb-dev-service-utils.cjs.js",
|
5
5
|
"module": "dist/thirdweb-dev-service-utils.esm.js",
|
6
6
|
"exports": {
|