@thirdweb-dev/service-utils 0.5.0-nightly-6cf298a29-20240308012322 → 0.5.0
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/dist/cjs/cf-worker/index.js +164 -0
- package/dist/cjs/cf-worker/index.js.map +1 -0
- package/dist/cjs/cf-worker/usage.js +55 -0
- package/dist/cjs/cf-worker/usage.js.map +1 -0
- package/dist/cjs/core/api.js +42 -0
- package/dist/cjs/core/api.js.map +1 -0
- package/dist/cjs/core/authorize/client.js +98 -0
- package/dist/cjs/core/authorize/client.js.map +1 -0
- package/dist/cjs/core/authorize/index.js +109 -0
- package/dist/cjs/core/authorize/index.js.map +1 -0
- package/dist/cjs/core/authorize/service.js +50 -0
- package/dist/cjs/core/authorize/service.js.map +1 -0
- package/dist/cjs/core/authorize/types.js +3 -0
- package/dist/cjs/core/authorize/types.js.map +1 -0
- package/dist/cjs/core/rateLimit/index.js +60 -0
- package/dist/cjs/core/rateLimit/index.js.map +1 -0
- package/dist/cjs/core/rateLimit/types.js +3 -0
- package/dist/cjs/core/rateLimit/types.js.map +1 -0
- package/dist/cjs/core/services.js +85 -0
- package/dist/cjs/core/services.js.map +1 -0
- package/dist/cjs/core/types.js +3 -0
- package/dist/cjs/core/types.js.map +1 -0
- package/dist/cjs/core/usage.js +85 -0
- package/dist/cjs/core/usage.js.map +1 -0
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/mocks.js +60 -0
- package/dist/cjs/mocks.js.map +1 -0
- package/dist/cjs/node/index.js +182 -0
- package/dist/cjs/node/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/cf-worker/index.js +156 -0
- package/dist/esm/cf-worker/index.js.map +1 -0
- package/dist/esm/cf-worker/usage.js +53 -0
- package/dist/esm/cf-worker/usage.js.map +1 -0
- package/dist/esm/core/api.js +38 -0
- package/dist/esm/core/api.js.map +1 -0
- package/dist/esm/core/authorize/client.js +93 -0
- package/dist/esm/core/authorize/client.js.map +1 -0
- package/dist/esm/core/authorize/index.js +106 -0
- package/dist/esm/core/authorize/index.js.map +1 -0
- package/dist/esm/core/authorize/service.js +47 -0
- package/dist/esm/core/authorize/service.js.map +1 -0
- package/dist/esm/core/authorize/types.js +2 -0
- package/dist/esm/core/authorize/types.js.map +1 -0
- package/dist/esm/core/rateLimit/index.js +57 -0
- package/dist/esm/core/rateLimit/index.js.map +1 -0
- package/dist/esm/core/rateLimit/types.js +2 -0
- package/dist/esm/core/rateLimit/types.js.map +1 -0
- package/dist/esm/core/services.js +81 -0
- package/dist/esm/core/services.js.map +1 -0
- package/dist/esm/core/types.js +2 -0
- package/dist/esm/core/types.js.map +1 -0
- package/dist/esm/core/usage.js +82 -0
- package/dist/esm/core/usage.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/mocks.js +57 -0
- package/dist/esm/mocks.js.map +1 -0
- package/dist/esm/node/index.js +174 -0
- package/dist/esm/node/index.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/{declarations/src → types}/cf-worker/index.d.ts +8 -9
- package/dist/types/cf-worker/index.d.ts.map +1 -0
- package/dist/types/cf-worker/usage.d.ts +24 -0
- package/dist/types/cf-worker/usage.d.ts.map +1 -0
- package/dist/types/core/api.d.ts +121 -0
- package/dist/types/core/api.d.ts.map +1 -0
- package/dist/types/core/authorize/client.d.ts +17 -0
- package/dist/types/core/authorize/client.d.ts.map +1 -0
- package/dist/{declarations/src → types}/core/authorize/index.d.ts +6 -5
- package/dist/types/core/authorize/index.d.ts.map +1 -0
- package/dist/types/core/authorize/service.d.ts +4 -0
- package/dist/types/core/authorize/service.d.ts.map +1 -0
- package/dist/types/core/authorize/types.d.ts +10 -0
- package/dist/types/core/authorize/types.d.ts.map +1 -0
- package/dist/{declarations/src → types}/core/rateLimit/index.d.ts +4 -4
- package/dist/types/core/rateLimit/index.d.ts.map +1 -0
- package/dist/types/core/rateLimit/types.d.ts.map +1 -0
- package/dist/{declarations/src → types}/core/services.d.ts +55 -23
- package/dist/types/core/services.d.ts.map +1 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/{declarations/src/cf-worker → types/core}/usage.d.ts +84 -30
- package/dist/types/core/usage.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/mocks.d.ts +7 -0
- package/dist/types/mocks.d.ts.map +1 -0
- package/dist/{declarations/src → types}/node/index.d.ts +10 -12
- package/dist/types/node/index.d.ts.map +1 -0
- package/package.json +42 -45
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.d.ts +0 -2
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.d.ts.map +0 -1
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.dev.js +0 -272
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.js +0 -7
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.cjs.prod.js +0 -272
- package/cf-worker/dist/thirdweb-dev-service-utils-cf-worker.esm.js +0 -258
- package/cf-worker/package.json +0 -4
- package/dist/declarations/src/cf-worker/index.d.ts.map +0 -1
- package/dist/declarations/src/cf-worker/usage.d.ts.map +0 -1
- package/dist/declarations/src/core/api.d.ts +0 -84
- package/dist/declarations/src/core/api.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/client.d.ts +0 -9
- package/dist/declarations/src/core/authorize/client.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/index.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/service.d.ts +0 -7
- package/dist/declarations/src/core/authorize/service.d.ts.map +0 -1
- package/dist/declarations/src/core/authorize/types.d.ts +0 -12
- package/dist/declarations/src/core/authorize/types.d.ts.map +0 -1
- package/dist/declarations/src/core/rateLimit/index.d.ts.map +0 -1
- package/dist/declarations/src/core/rateLimit/types.d.ts.map +0 -1
- package/dist/declarations/src/core/services.d.ts.map +0 -1
- package/dist/declarations/src/core/types.d.ts.map +0 -1
- package/dist/declarations/src/core/usageLimit/index.d.ts +0 -5
- package/dist/declarations/src/core/usageLimit/index.d.ts.map +0 -1
- package/dist/declarations/src/core/usageLimit/types.d.ts +0 -9
- package/dist/declarations/src/core/usageLimit/types.d.ts.map +0 -1
- package/dist/declarations/src/index.d.ts +0 -2
- package/dist/declarations/src/index.d.ts.map +0 -1
- package/dist/declarations/src/node/index.d.ts.map +0 -1
- package/dist/index-3b9a0743.esm.js +0 -572
- package/dist/index-62b88cac.cjs.dev.js +0 -576
- package/dist/index-aa324361.cjs.prod.js +0 -576
- package/dist/services-2aecbda8.esm.js +0 -65
- package/dist/services-508322f3.cjs.dev.js +0 -70
- package/dist/services-5c4d6977.cjs.prod.js +0 -70
- package/dist/thirdweb-dev-service-utils.cjs.d.ts +0 -2
- package/dist/thirdweb-dev-service-utils.cjs.d.ts.map +0 -1
- package/dist/thirdweb-dev-service-utils.cjs.dev.js +0 -12
- package/dist/thirdweb-dev-service-utils.cjs.js +0 -7
- package/dist/thirdweb-dev-service-utils.cjs.prod.js +0 -12
- package/dist/thirdweb-dev-service-utils.esm.js +0 -1
- package/node/dist/thirdweb-dev-service-utils-node.cjs.d.ts +0 -2
- package/node/dist/thirdweb-dev-service-utils-node.cjs.d.ts.map +0 -1
- package/node/dist/thirdweb-dev-service-utils-node.cjs.dev.js +0 -193
- package/node/dist/thirdweb-dev-service-utils-node.cjs.js +0 -7
- package/node/dist/thirdweb-dev-service-utils-node.cjs.prod.js +0 -193
- package/node/dist/thirdweb-dev-service-utils-node.esm.js +0 -180
- package/node/package.json +0 -4
- /package/dist/{declarations/src → types}/core/rateLimit/types.d.ts +0 -0
- /package/dist/{declarations/src → types}/core/types.d.ts +0 -0
@@ -21,7 +21,7 @@ export declare const SERVICE_DEFINITIONS: {
|
|
21
21
|
};
|
22
22
|
readonly bundler: {
|
23
23
|
readonly name: "bundler";
|
24
|
-
readonly title: "
|
24
|
+
readonly title: "Account Abstraction";
|
25
25
|
readonly description: "Bundler & Paymaster services";
|
26
26
|
readonly actions: readonly [];
|
27
27
|
};
|
@@ -33,24 +33,36 @@ export declare const SERVICE_DEFINITIONS: {
|
|
33
33
|
};
|
34
34
|
readonly embeddedWallets: {
|
35
35
|
readonly name: "embeddedWallets";
|
36
|
-
readonly title: "
|
36
|
+
readonly title: "In-App Wallets";
|
37
37
|
readonly description: "E-mail and social login wallets for easy web3 onboarding";
|
38
38
|
readonly actions: readonly [];
|
39
39
|
};
|
40
|
-
readonly checkout: {
|
41
|
-
readonly name: "checkout";
|
42
|
-
readonly title: "Checkouts";
|
43
|
-
readonly description: "NFT Checkouts for easy web3 onboarding";
|
44
|
-
readonly actions: readonly [];
|
45
|
-
};
|
46
40
|
readonly pay: {
|
47
41
|
readonly name: "pay";
|
48
42
|
readonly title: "Pay";
|
49
43
|
readonly description: "Pay for a blockchain transaction with any currency";
|
50
44
|
readonly actions: readonly [];
|
51
45
|
};
|
46
|
+
readonly chainsaw: {
|
47
|
+
readonly name: "chainsaw";
|
48
|
+
readonly title: "Chainsaw";
|
49
|
+
readonly description: "Indexed data for any EVM chain";
|
50
|
+
readonly actions: readonly [];
|
51
|
+
};
|
52
|
+
readonly insight: {
|
53
|
+
readonly name: "insight";
|
54
|
+
readonly title: "Insight";
|
55
|
+
readonly description: "Insight services";
|
56
|
+
readonly actions: readonly [];
|
57
|
+
};
|
58
|
+
readonly nebula: {
|
59
|
+
readonly name: "nebula";
|
60
|
+
readonly title: "Nebula";
|
61
|
+
readonly description: "Advanced blockchain reasoning and execution capabilities with AI";
|
62
|
+
readonly actions: readonly [];
|
63
|
+
};
|
52
64
|
};
|
53
|
-
export declare const SERVICE_NAMES: (
|
65
|
+
export declare const SERVICE_NAMES: (keyof typeof SERVICE_DEFINITIONS)[];
|
54
66
|
export declare const SERVICES: ({
|
55
67
|
readonly name: "storage";
|
56
68
|
readonly title: "Storage";
|
@@ -71,7 +83,7 @@ export declare const SERVICES: ({
|
|
71
83
|
readonly actions: readonly [];
|
72
84
|
} | {
|
73
85
|
readonly name: "bundler";
|
74
|
-
readonly title: "
|
86
|
+
readonly title: "Account Abstraction";
|
75
87
|
readonly description: "Bundler & Paymaster services";
|
76
88
|
readonly actions: readonly [];
|
77
89
|
} | {
|
@@ -81,19 +93,29 @@ export declare const SERVICES: ({
|
|
81
93
|
readonly actions: readonly [];
|
82
94
|
} | {
|
83
95
|
readonly name: "embeddedWallets";
|
84
|
-
readonly title: "
|
96
|
+
readonly title: "In-App Wallets";
|
85
97
|
readonly description: "E-mail and social login wallets for easy web3 onboarding";
|
86
98
|
readonly actions: readonly [];
|
87
|
-
} | {
|
88
|
-
readonly name: "checkout";
|
89
|
-
readonly title: "Checkouts";
|
90
|
-
readonly description: "NFT Checkouts for easy web3 onboarding";
|
91
|
-
readonly actions: readonly [];
|
92
99
|
} | {
|
93
100
|
readonly name: "pay";
|
94
101
|
readonly title: "Pay";
|
95
102
|
readonly description: "Pay for a blockchain transaction with any currency";
|
96
103
|
readonly actions: readonly [];
|
104
|
+
} | {
|
105
|
+
readonly name: "chainsaw";
|
106
|
+
readonly title: "Chainsaw";
|
107
|
+
readonly description: "Indexed data for any EVM chain";
|
108
|
+
readonly actions: readonly [];
|
109
|
+
} | {
|
110
|
+
readonly name: "insight";
|
111
|
+
readonly title: "Insight";
|
112
|
+
readonly description: "Insight services";
|
113
|
+
readonly actions: readonly [];
|
114
|
+
} | {
|
115
|
+
readonly name: "nebula";
|
116
|
+
readonly title: "Nebula";
|
117
|
+
readonly description: "Advanced blockchain reasoning and execution capabilities with AI";
|
118
|
+
readonly actions: readonly [];
|
97
119
|
})[];
|
98
120
|
export type ServiceName = (typeof SERVICE_NAMES)[number];
|
99
121
|
export type ServiceAction = {
|
@@ -122,7 +144,7 @@ export declare function getServiceByName(name: ServiceName): {
|
|
122
144
|
readonly actions: readonly [];
|
123
145
|
} | {
|
124
146
|
readonly name: "bundler";
|
125
|
-
readonly title: "
|
147
|
+
readonly title: "Account Abstraction";
|
126
148
|
readonly description: "Bundler & Paymaster services";
|
127
149
|
readonly actions: readonly [];
|
128
150
|
} | {
|
@@ -132,18 +154,28 @@ export declare function getServiceByName(name: ServiceName): {
|
|
132
154
|
readonly actions: readonly [];
|
133
155
|
} | {
|
134
156
|
readonly name: "embeddedWallets";
|
135
|
-
readonly title: "
|
157
|
+
readonly title: "In-App Wallets";
|
136
158
|
readonly description: "E-mail and social login wallets for easy web3 onboarding";
|
137
159
|
readonly actions: readonly [];
|
138
|
-
} | {
|
139
|
-
readonly name: "checkout";
|
140
|
-
readonly title: "Checkouts";
|
141
|
-
readonly description: "NFT Checkouts for easy web3 onboarding";
|
142
|
-
readonly actions: readonly [];
|
143
160
|
} | {
|
144
161
|
readonly name: "pay";
|
145
162
|
readonly title: "Pay";
|
146
163
|
readonly description: "Pay for a blockchain transaction with any currency";
|
147
164
|
readonly actions: readonly [];
|
165
|
+
} | {
|
166
|
+
readonly name: "chainsaw";
|
167
|
+
readonly title: "Chainsaw";
|
168
|
+
readonly description: "Indexed data for any EVM chain";
|
169
|
+
readonly actions: readonly [];
|
170
|
+
} | {
|
171
|
+
readonly name: "insight";
|
172
|
+
readonly title: "Insight";
|
173
|
+
readonly description: "Insight services";
|
174
|
+
readonly actions: readonly [];
|
175
|
+
} | {
|
176
|
+
readonly name: "nebula";
|
177
|
+
readonly title: "Nebula";
|
178
|
+
readonly description: "Advanced blockchain reasoning and execution capabilities with AI";
|
179
|
+
readonly actions: readonly [];
|
148
180
|
};
|
149
181
|
//# sourceMappingURL=services.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../src/core/services.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EtB,CAAC;AAEX,eAAO,MAAM,aAAa,EAErB,CAAC,MAAM,OAAO,mBAAmB,CAAC,EAAE,CAAC;AAE1C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAqC,CAAC;AAE3D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,OAAO,GACjB,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAE1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACnC,CAAC"}
|
@@ -1,9 +1,6 @@
|
|
1
1
|
import { z } from "zod";
|
2
|
-
|
3
|
-
|
4
|
-
*/
|
5
|
-
declare const usageEventSchema: z.ZodObject<{
|
6
|
-
source: z.ZodEnum<["embeddedWallets", "rpc", "storage", "bundler", "paymaster", "relayer", "connectWallet", "checkout", "engine"]>;
|
2
|
+
export declare const usageEventSchema: z.ZodObject<{
|
3
|
+
source: z.ZodString;
|
7
4
|
action: z.ZodString;
|
8
5
|
/**
|
9
6
|
* The following fields are optional.
|
@@ -29,6 +26,7 @@ declare const usageEventSchema: z.ZodObject<{
|
|
29
26
|
sdkName: z.ZodOptional<z.ZodString>;
|
30
27
|
sdkVersion: z.ZodOptional<z.ZodString>;
|
31
28
|
sdkPlatform: z.ZodOptional<z.ZodString>;
|
29
|
+
sdkOS: z.ZodOptional<z.ZodString>;
|
32
30
|
productName: z.ZodOptional<z.ZodString>;
|
33
31
|
transactionValue: z.ZodOptional<z.ZodString>;
|
34
32
|
pathname: z.ZodOptional<z.ZodString>;
|
@@ -42,9 +40,35 @@ declare const usageEventSchema: z.ZodObject<{
|
|
42
40
|
msSinceQueue: z.ZodOptional<z.ZodNumber>;
|
43
41
|
msSinceSend: z.ZodOptional<z.ZodNumber>;
|
44
42
|
msTotalDuration: z.ZodOptional<z.ZodNumber>;
|
43
|
+
swapId: z.ZodOptional<z.ZodString>;
|
44
|
+
tokenAddress: z.ZodOptional<z.ZodString>;
|
45
|
+
amountWei: z.ZodOptional<z.ZodString>;
|
46
|
+
amountUSDCents: z.ZodOptional<z.ZodNumber>;
|
47
|
+
httpMethod: z.ZodOptional<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "CONNECT", "OPTIONS", "TRACE"]>>;
|
48
|
+
ecosystemId: z.ZodOptional<z.ZodString>;
|
49
|
+
ecosystemPartnerId: z.ZodOptional<z.ZodString>;
|
50
|
+
authenticationMethod: z.ZodOptional<z.ZodString>;
|
51
|
+
chainName: z.ZodOptional<z.ZodString>;
|
52
|
+
tokenSymbol: z.ZodOptional<z.ZodString>;
|
53
|
+
dstChainId: z.ZodOptional<z.ZodNumber>;
|
54
|
+
dstTokenAddress: z.ZodOptional<z.ZodString>;
|
55
|
+
dstChainName: z.ZodOptional<z.ZodString>;
|
56
|
+
dstTokenSymbol: z.ZodOptional<z.ZodString>;
|
57
|
+
msLatency: z.ZodOptional<z.ZodNumber>;
|
58
|
+
toAmountUSDCents: z.ZodOptional<z.ZodNumber>;
|
59
|
+
secondaryProvider: z.ZodOptional<z.ZodString>;
|
60
|
+
onRampId: z.ZodOptional<z.ZodString>;
|
61
|
+
evmRequestParams: z.ZodOptional<z.ZodString>;
|
62
|
+
providerIp: z.ZodOptional<z.ZodString>;
|
63
|
+
promptTokens: z.ZodOptional<z.ZodNumber>;
|
64
|
+
completionTokens: z.ZodOptional<z.ZodNumber>;
|
65
|
+
modelName: z.ZodOptional<z.ZodString>;
|
66
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
67
|
+
requestId: z.ZodOptional<z.ZodString>;
|
45
68
|
}, "strip", z.ZodTypeAny, {
|
46
|
-
source:
|
69
|
+
source: string;
|
47
70
|
action: string;
|
71
|
+
errorCode?: string | undefined;
|
48
72
|
accountId?: string | undefined;
|
49
73
|
isClientEvent?: boolean | undefined;
|
50
74
|
apiKeyId?: string | undefined;
|
@@ -66,11 +90,11 @@ declare const usageEventSchema: z.ZodObject<{
|
|
66
90
|
sdkName?: string | undefined;
|
67
91
|
sdkVersion?: string | undefined;
|
68
92
|
sdkPlatform?: string | undefined;
|
93
|
+
sdkOS?: string | undefined;
|
69
94
|
productName?: string | undefined;
|
70
95
|
transactionValue?: string | undefined;
|
71
96
|
pathname?: string | undefined;
|
72
97
|
contractAddress?: string | undefined;
|
73
|
-
errorCode?: string | undefined;
|
74
98
|
httpStatusCode?: number | undefined;
|
75
99
|
functionName?: string | undefined;
|
76
100
|
extension?: string | undefined;
|
@@ -79,9 +103,35 @@ declare const usageEventSchema: z.ZodObject<{
|
|
79
103
|
msSinceQueue?: number | undefined;
|
80
104
|
msSinceSend?: number | undefined;
|
81
105
|
msTotalDuration?: number | undefined;
|
106
|
+
swapId?: string | undefined;
|
107
|
+
tokenAddress?: string | undefined;
|
108
|
+
amountWei?: string | undefined;
|
109
|
+
amountUSDCents?: number | undefined;
|
110
|
+
httpMethod?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "TRACE" | undefined;
|
111
|
+
ecosystemId?: string | undefined;
|
112
|
+
ecosystemPartnerId?: string | undefined;
|
113
|
+
authenticationMethod?: string | undefined;
|
114
|
+
chainName?: string | undefined;
|
115
|
+
tokenSymbol?: string | undefined;
|
116
|
+
dstChainId?: number | undefined;
|
117
|
+
dstTokenAddress?: string | undefined;
|
118
|
+
dstChainName?: string | undefined;
|
119
|
+
dstTokenSymbol?: string | undefined;
|
120
|
+
msLatency?: number | undefined;
|
121
|
+
toAmountUSDCents?: number | undefined;
|
122
|
+
secondaryProvider?: string | undefined;
|
123
|
+
onRampId?: string | undefined;
|
124
|
+
evmRequestParams?: string | undefined;
|
125
|
+
providerIp?: string | undefined;
|
126
|
+
promptTokens?: number | undefined;
|
127
|
+
completionTokens?: number | undefined;
|
128
|
+
modelName?: string | undefined;
|
129
|
+
sessionId?: string | undefined;
|
130
|
+
requestId?: string | undefined;
|
82
131
|
}, {
|
83
|
-
source:
|
132
|
+
source: string;
|
84
133
|
action: string;
|
134
|
+
errorCode?: string | undefined;
|
85
135
|
accountId?: string | undefined;
|
86
136
|
isClientEvent?: boolean | undefined;
|
87
137
|
apiKeyId?: string | undefined;
|
@@ -103,11 +153,11 @@ declare const usageEventSchema: z.ZodObject<{
|
|
103
153
|
sdkName?: string | undefined;
|
104
154
|
sdkVersion?: string | undefined;
|
105
155
|
sdkPlatform?: string | undefined;
|
156
|
+
sdkOS?: string | undefined;
|
106
157
|
productName?: string | undefined;
|
107
158
|
transactionValue?: string | undefined;
|
108
159
|
pathname?: string | undefined;
|
109
160
|
contractAddress?: string | undefined;
|
110
|
-
errorCode?: string | undefined;
|
111
161
|
httpStatusCode?: number | undefined;
|
112
162
|
functionName?: string | undefined;
|
113
163
|
extension?: string | undefined;
|
@@ -116,27 +166,31 @@ declare const usageEventSchema: z.ZodObject<{
|
|
116
166
|
msSinceQueue?: number | undefined;
|
117
167
|
msSinceSend?: number | undefined;
|
118
168
|
msTotalDuration?: number | undefined;
|
169
|
+
swapId?: string | undefined;
|
170
|
+
tokenAddress?: string | undefined;
|
171
|
+
amountWei?: string | undefined;
|
172
|
+
amountUSDCents?: number | undefined;
|
173
|
+
httpMethod?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH" | "HEAD" | "CONNECT" | "OPTIONS" | "TRACE" | undefined;
|
174
|
+
ecosystemId?: string | undefined;
|
175
|
+
ecosystemPartnerId?: string | undefined;
|
176
|
+
authenticationMethod?: string | undefined;
|
177
|
+
chainName?: string | undefined;
|
178
|
+
tokenSymbol?: string | undefined;
|
179
|
+
dstChainId?: number | undefined;
|
180
|
+
dstTokenAddress?: string | undefined;
|
181
|
+
dstChainName?: string | undefined;
|
182
|
+
dstTokenSymbol?: string | undefined;
|
183
|
+
msLatency?: number | undefined;
|
184
|
+
toAmountUSDCents?: number | undefined;
|
185
|
+
secondaryProvider?: string | undefined;
|
186
|
+
onRampId?: string | undefined;
|
187
|
+
evmRequestParams?: string | undefined;
|
188
|
+
providerIp?: string | undefined;
|
189
|
+
promptTokens?: number | undefined;
|
190
|
+
completionTokens?: number | undefined;
|
191
|
+
modelName?: string | undefined;
|
192
|
+
sessionId?: string | undefined;
|
193
|
+
requestId?: string | undefined;
|
119
194
|
}>;
|
120
195
|
export type UsageEvent = z.infer<typeof usageEventSchema>;
|
121
|
-
/**
|
122
|
-
* Publish usage events. Provide the relevant fields for your application.
|
123
|
-
*
|
124
|
-
* Usage in Cloudflare Workers:
|
125
|
-
* ctx.waitUntil(
|
126
|
-
* publishUsageEvents(
|
127
|
-
* [event1, event2],
|
128
|
-
* { queueUrl, accessKeyId, secretAccessKey },
|
129
|
-
* )
|
130
|
-
* )
|
131
|
-
*
|
132
|
-
* @param usageEvents
|
133
|
-
* @param config
|
134
|
-
*/
|
135
|
-
export declare function publishUsageEvents(usageEvents: UsageEvent[], config: {
|
136
|
-
queueUrl: string;
|
137
|
-
accessKeyId: string;
|
138
|
-
secretAccessKey: string;
|
139
|
-
region?: string;
|
140
|
-
}): Promise<void>;
|
141
|
-
export {};
|
142
196
|
//# sourceMappingURL=usage.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/core/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;IAI3B;;OAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EH,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export * from "./core/services.js";
|
2
|
+
export type { ApiResponse, CoreServiceConfig, PolicyResult, UserOpData, ProjectResponse, TeamAndProjectResponse, TeamResponse, } from "./core/api.js";
|
3
|
+
export { fetchTeamAndProject, updateRateLimitedAt } from "./core/api.js";
|
4
|
+
export { authorizeBundleId, authorizeDomain, } from "./core/authorize/client.js";
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,sBAAsB,EACtB,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,4BAA4B,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { CoreServiceConfig, ProjectResponse, TeamAndProjectResponse, TeamResponse } from "./core/api.js";
|
2
|
+
export declare const validProjectResponse: ProjectResponse;
|
3
|
+
export declare const validTeamResponse: TeamResponse;
|
4
|
+
export declare const validTeamAndProjectResponse: TeamAndProjectResponse;
|
5
|
+
export declare const validServiceConfig: CoreServiceConfig;
|
6
|
+
export declare const validBundlerServiceConfig: CoreServiceConfig;
|
7
|
+
//# sourceMappingURL=mocks.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACb,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,oBAAoB,EAAE,eA2BlC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,YAY/B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,sBAGzC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAKhC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,iBAIvC,CAAC"}
|
@@ -1,13 +1,11 @@
|
|
1
|
-
|
2
|
-
import type {
|
3
|
-
import type {
|
4
|
-
import type {
|
5
|
-
import type {
|
6
|
-
|
7
|
-
|
8
|
-
export * from "../core/services";
|
9
|
-
export * from "../core/rateLimit";
|
10
|
-
export * from "../core/usageLimit";
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
2
|
+
import type { CoreServiceConfig } from "../core/api.js";
|
3
|
+
import type { AuthorizationInput, CacheOptions } from "../core/authorize/index.js";
|
4
|
+
import type { AuthorizationResult } from "../core/authorize/types.js";
|
5
|
+
import type { CoreAuthInput } from "../core/types.js";
|
6
|
+
export * from "../core/usage.js";
|
7
|
+
export * from "../core/rateLimit/index.js";
|
8
|
+
export * from "../core/services.js";
|
11
9
|
type NodeServiceConfig = CoreServiceConfig;
|
12
10
|
export type AuthInput = CoreAuthInput & {
|
13
11
|
req: IncomingMessage;
|
@@ -29,11 +27,11 @@ export type AuthInput = CoreAuthInput & {
|
|
29
27
|
* @param {NodeServiceConfig['useWalletAuth']} serviceConfig.useWalletAuth - If true it pings the `wallet/me` or else, `account/me`. You most likely can leave this as false.
|
30
28
|
* @returns {AuthorizationResult} authorizationResult - contains if the request is authorized, and information about the account if it is authorized. Otherwise, it contains the error message and status code.
|
31
29
|
*/
|
32
|
-
export declare function authorizeNode(authInput: AuthInput, serviceConfig: NodeServiceConfig): Promise<AuthorizationResult>;
|
30
|
+
export declare function authorizeNode(authInput: AuthInput, serviceConfig: NodeServiceConfig, cacheOptions?: CacheOptions): Promise<AuthorizationResult>;
|
33
31
|
export declare function extractAuthorizationData(authInput: AuthInput): AuthorizationInput;
|
34
32
|
export declare function hashSecretKey(secretKey: string): string;
|
35
33
|
export declare function deriveClientIdFromSecretKeyHash(secretKeyHash: string): string;
|
36
|
-
export declare function logHttpRequest({
|
34
|
+
export declare function logHttpRequest({ clientId, req, res, isAuthed, statusMessage, latencyMs, }: AuthInput & {
|
37
35
|
source: string;
|
38
36
|
res: ServerResponse;
|
39
37
|
isAuthed?: boolean;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,eAAe,EACf,cAAc,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EACV,kBAAkB,EAClB,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,KAAK,iBAAiB,GAAG,iBAAiB,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG;IACtC,GAAG,EAAE,eAAe,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CACjC,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,iBAAiB,EAChC,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAsB9B;AAaD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAwGpB;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,UAE9C;AAED,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,UAEpE;AAED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,GAAG,EACH,GAAG,EACH,QAAQ,EACR,aAAa,EACb,SAAS,GACV,EAAE,SAAS,GAAG;IAEb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,QAwBA"}
|
package/package.json
CHANGED
@@ -1,23 +1,39 @@
|
|
1
1
|
{
|
2
2
|
"name": "@thirdweb-dev/service-utils",
|
3
|
-
"version": "0.5.0
|
4
|
-
"
|
5
|
-
"
|
3
|
+
"version": "0.5.0",
|
4
|
+
"type": "module",
|
5
|
+
"main": "dist/cjs/index.js",
|
6
|
+
"module": "dist/esm/index.js",
|
7
|
+
"types": "dist/types/index.d.ts",
|
8
|
+
"typings": "dist/types/index.d.ts",
|
6
9
|
"exports": {
|
7
10
|
".": {
|
8
|
-
"
|
9
|
-
"
|
11
|
+
"types": "./dist/types/index.d.ts",
|
12
|
+
"import": "./dist/esm/index.js",
|
13
|
+
"default": "./dist/cjs/index.js"
|
10
14
|
},
|
11
15
|
"./node": {
|
12
|
-
"
|
13
|
-
"
|
16
|
+
"types": "./dist/types/node/index.d.ts",
|
17
|
+
"import": "./dist/esm/node/index.js",
|
18
|
+
"default": "./dist/cjs/node/index.js"
|
14
19
|
},
|
15
20
|
"./cf-worker": {
|
16
|
-
"
|
17
|
-
"
|
21
|
+
"types": "./dist/types/cf-worker/index.d.ts",
|
22
|
+
"import": "./dist/esm/cf-worker/index.js",
|
23
|
+
"default": "./dist/cjs/cf-worker/index.js"
|
18
24
|
},
|
19
25
|
"./package.json": "./package.json"
|
20
26
|
},
|
27
|
+
"typesVersions": {
|
28
|
+
"*": {
|
29
|
+
"node": [
|
30
|
+
"./dist/types/node/index.d.ts"
|
31
|
+
],
|
32
|
+
"cf-worker": [
|
33
|
+
"./dist/types/cf-worker/index.d.ts"
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
21
37
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/pay",
|
22
38
|
"license": "Apache-2.0",
|
23
39
|
"bugs": {
|
@@ -25,47 +41,28 @@
|
|
25
41
|
},
|
26
42
|
"author": "thirdweb eng <eng@thirdweb.com>",
|
27
43
|
"files": [
|
28
|
-
"dist/"
|
29
|
-
"node/",
|
30
|
-
"cf-worker/"
|
44
|
+
"dist/"
|
31
45
|
],
|
32
|
-
"preconstruct": {
|
33
|
-
"entrypoints": [
|
34
|
-
"index.ts",
|
35
|
-
"cf-worker/index.ts",
|
36
|
-
"node/index.ts"
|
37
|
-
],
|
38
|
-
"exports": true
|
39
|
-
},
|
40
46
|
"sideEffects": false,
|
41
|
-
"devDependencies": {
|
42
|
-
"@cloudflare/workers-types": "^4.20230724.0",
|
43
|
-
"@preconstruct/cli": "2.7.0",
|
44
|
-
"@smithy/types": "^2.0.2",
|
45
|
-
"@thirdweb-dev/tsconfig": "^0.1.7",
|
46
|
-
"@types/jest": "^29.5.3",
|
47
|
-
"@types/node": "^18.17.1",
|
48
|
-
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
49
|
-
"@typescript-eslint/parser": "^6.19.1",
|
50
|
-
"eslint": "^8.56.0",
|
51
|
-
"eslint-config-prettier": "^8.9.0",
|
52
|
-
"eslint-config-thirdweb": "^0.1.7",
|
53
|
-
"jest": "^29.6.2",
|
54
|
-
"prettier": "^3.1.1",
|
55
|
-
"ts-jest": "^29.1.1",
|
56
|
-
"typescript": "^5.3.3"
|
57
|
-
},
|
58
47
|
"dependencies": {
|
59
|
-
"aws4fetch": "
|
60
|
-
"zod": "
|
48
|
+
"aws4fetch": "1.0.20",
|
49
|
+
"zod": "3.24.1"
|
50
|
+
},
|
51
|
+
"devDependencies": {
|
52
|
+
"@cloudflare/workers-types": "4.20241205.0",
|
53
|
+
"@types/node": "22.10.2",
|
54
|
+
"typescript": "5.7.2",
|
55
|
+
"vitest": "2.1.8"
|
61
56
|
},
|
62
57
|
"scripts": {
|
63
|
-
"format": "
|
64
|
-
"lint": "
|
65
|
-
"fix": "
|
58
|
+
"format": "biome format ./src --write",
|
59
|
+
"lint": "biome check ./src && tsc --project ./tsconfig.build.json --module esnext --noEmit",
|
60
|
+
"fix": "biome check ./src --fix",
|
66
61
|
"clean": "rm -rf dist/",
|
67
|
-
"build": "
|
68
|
-
"
|
69
|
-
"
|
62
|
+
"build": "pnpm clean && pnpm build:types && pnpm build:cjs && pnpm build:esm",
|
63
|
+
"build:cjs": "tsc --noCheck --project ./tsconfig.build.json --module commonjs --outDir ./dist/cjs --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/cjs/package.json",
|
64
|
+
"build:esm": "tsc --noCheck --project ./tsconfig.build.json --module es2020 --outDir ./dist/esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/esm/package.json",
|
65
|
+
"build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
|
66
|
+
"test": "vitest run"
|
70
67
|
}
|
71
68
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"thirdweb-dev-service-utils-cf-worker.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/cf-worker/index.d.ts"],"names":[],"mappings":"AAAA"}
|