@thirdweb-dev/service-utils 0.8.7-nightly-8aeb4d6308a2624a3e483aa4da408bbbdc8da688-20250208040153 → 0.8.8-nightly-cbfe9ec459b33884136ba23a87effd8ab4e99aeb-20250208050920
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/usageV2.js +17 -4
- package/dist/cjs/cf-worker/usageV2.js.map +1 -1
- package/dist/esm/cf-worker/usageV2.js +17 -4
- package/dist/esm/cf-worker/usageV2.js.map +1 -1
- package/dist/types/cf-worker/usageV2.d.ts +3 -4
- package/dist/types/cf-worker/usageV2.d.ts.map +1 -1
- package/package.json +1 -1
@@ -20,12 +20,25 @@ async function sendUsageV2Events(events, options) {
|
|
20
20
|
const baseUrl = options.environment === "production"
|
21
21
|
? "https://u.thirdweb.com"
|
22
22
|
: "https://u.thirdweb-dev.com";
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
// Unauthed calls are routed to the /client path
|
24
|
+
let url;
|
25
|
+
let headers;
|
26
|
+
if (options.serviceKey) {
|
27
|
+
url = `${baseUrl}/usage-v2/${options.source}`;
|
28
|
+
headers = {
|
26
29
|
"Content-Type": "application/json",
|
27
30
|
"x-service-api-key": options.serviceKey,
|
28
|
-
}
|
31
|
+
};
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
url = `${baseUrl}/usage-v2/${options.source}/client`;
|
35
|
+
headers = {
|
36
|
+
"Content-Type": "application/json",
|
37
|
+
};
|
38
|
+
}
|
39
|
+
const resp = await fetch(url, {
|
40
|
+
method: "POST",
|
41
|
+
headers,
|
29
42
|
body: JSON.stringify({ events }),
|
30
43
|
});
|
31
44
|
if (!resp.ok) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usageV2.js","sourceRoot":"","sources":["../../../src/cf-worker/usageV2.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"usageV2.js","sourceRoot":"","sources":["../../../src/cf-worker/usageV2.ts"],"names":[],"mappings":";;AAiBA,8CAyCC;AAxDD;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,iBAAiB,CACrC,MAAsB,EACtB,OAIC;IAED,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,KAAK,YAAY;QAClC,CAAC,CAAC,wBAAwB;QAC1B,CAAC,CAAC,4BAA4B,CAAC;IAEnC,gDAAgD;IAChD,IAAI,GAAW,CAAC;IAChB,IAAI,OAAoB,CAAC;IACzB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,GAAG,GAAG,GAAG,OAAO,aAAa,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,GAAG;YACR,cAAc,EAAE,kBAAkB;YAClC,mBAAmB,EAAE,OAAO,CAAC,UAAU;SACxC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,GAAG,OAAO,aAAa,OAAO,CAAC,MAAM,SAAS,CAAC;QACrD,OAAO,GAAG;YACR,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC5B,MAAM,EAAE,MAAM;QACd,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,iCAAiC,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CACrE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;AACtB,CAAC"}
|
@@ -17,12 +17,25 @@ export async function sendUsageV2Events(events, options) {
|
|
17
17
|
const baseUrl = options.environment === "production"
|
18
18
|
? "https://u.thirdweb.com"
|
19
19
|
: "https://u.thirdweb-dev.com";
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
// Unauthed calls are routed to the /client path
|
21
|
+
let url;
|
22
|
+
let headers;
|
23
|
+
if (options.serviceKey) {
|
24
|
+
url = `${baseUrl}/usage-v2/${options.source}`;
|
25
|
+
headers = {
|
23
26
|
"Content-Type": "application/json",
|
24
27
|
"x-service-api-key": options.serviceKey,
|
25
|
-
}
|
28
|
+
};
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
url = `${baseUrl}/usage-v2/${options.source}/client`;
|
32
|
+
headers = {
|
33
|
+
"Content-Type": "application/json",
|
34
|
+
};
|
35
|
+
}
|
36
|
+
const resp = await fetch(url, {
|
37
|
+
method: "POST",
|
38
|
+
headers,
|
26
39
|
body: JSON.stringify({ events }),
|
27
40
|
});
|
28
41
|
if (!resp.ok) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usageV2.js","sourceRoot":"","sources":["../../../src/cf-worker/usageV2.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"usageV2.js","sourceRoot":"","sources":["../../../src/cf-worker/usageV2.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAsB,EACtB,OAIC;IAED,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,KAAK,YAAY;QAClC,CAAC,CAAC,wBAAwB;QAC1B,CAAC,CAAC,4BAA4B,CAAC;IAEnC,gDAAgD;IAChD,IAAI,GAAW,CAAC;IAChB,IAAI,OAAoB,CAAC;IACzB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,GAAG,GAAG,GAAG,OAAO,aAAa,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,GAAG;YACR,cAAc,EAAE,kBAAkB;YAClC,mBAAmB,EAAE,OAAO,CAAC,UAAU;SACxC,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,GAAG,GAAG,GAAG,OAAO,aAAa,OAAO,CAAC,MAAM,SAAS,CAAC;QACrD,OAAO,GAAG;YACR,cAAc,EAAE,kBAAkB;SACnC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC5B,MAAM,EAAE,MAAM;QACd,OAAO;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,iCAAiC,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CACrE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;AACtB,CAAC"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import type {
|
2
|
-
import type { UsageV2Event } from "../core/usageV2.js";
|
1
|
+
import type { UsageV2Event, UsageV2Source } from "../core/usageV2.js";
|
3
2
|
/**
|
4
3
|
* Send events to Kafka.
|
5
4
|
* This method may throw. To call this non-blocking:
|
@@ -17,7 +16,7 @@ import type { UsageV2Event } from "../core/usageV2.js";
|
|
17
16
|
*/
|
18
17
|
export declare function sendUsageV2Events(events: UsageV2Event[], options: {
|
19
18
|
environment: "development" | "production";
|
20
|
-
|
21
|
-
serviceKey
|
19
|
+
source: UsageV2Source;
|
20
|
+
serviceKey?: string;
|
22
21
|
}): Promise<void>;
|
23
22
|
//# sourceMappingURL=usageV2.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usageV2.d.ts","sourceRoot":"","sources":["../../../src/cf-worker/usageV2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"usageV2.d.ts","sourceRoot":"","sources":["../../../src/cf-worker/usageV2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,EAAE;IACP,WAAW,EAAE,aAAa,GAAG,YAAY,CAAC;IAC1C,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,IAAI,CAAC,CAkCf"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@thirdweb-dev/service-utils",
|
3
|
-
"version": "0.8.
|
3
|
+
"version": "0.8.8-nightly-cbfe9ec459b33884136ba23a87effd8ab4e99aeb-20250208050920",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|