@thirdweb-dev/service-utils 0.8.10-nightly-3f6d525b51d14a00c4b12fcda0b5d77c55625107-20250227000332 → 0.8.11-nightly-47c9c43a875a81aa357ebf3c741f256c317c5cfd-20250301025507
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/node/usageV2.js
CHANGED
@@ -4,6 +4,8 @@ exports.UsageV2Producer = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
5
5
|
const usageV2_js_1 = require("../core/usageV2.js");
|
6
6
|
const kafka_js_1 = require("./kafka.js");
|
7
|
+
const TEAM_ID_PREFIX = "team_";
|
8
|
+
const PROJECT_ID_PREFIX = "prj_";
|
7
9
|
/**
|
8
10
|
* Creates a UsageV2Producer which opens a persistent TCP connection.
|
9
11
|
* This class is thread-safe so your service should re-use one instance.
|
@@ -55,9 +57,13 @@ class UsageV2Producer {
|
|
55
57
|
// Default to now.
|
56
58
|
created_at: event.created_at ?? new Date(),
|
57
59
|
// Remove the "team_" prefix, if any.
|
58
|
-
team_id: event.team_id.startsWith(
|
59
|
-
? event.team_id.slice(
|
60
|
+
team_id: event.team_id.startsWith(TEAM_ID_PREFIX)
|
61
|
+
? event.team_id.slice(TEAM_ID_PREFIX.length)
|
60
62
|
: event.team_id,
|
63
|
+
// Remove the "prj_" prefix, if any.
|
64
|
+
project_id: event.project_id?.startsWith(PROJECT_ID_PREFIX)
|
65
|
+
? event.project_id.slice(PROJECT_ID_PREFIX.length)
|
66
|
+
: event.project_id,
|
61
67
|
}));
|
62
68
|
await this.kafkaProducer.send(this.topic, parsedEvents);
|
63
69
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usageV2.js","sourceRoot":"","sources":["../../../src/node/usageV2.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,mDAI4B;AAC5B,yCAA2C;AAE3C;;;;;;;;;;;GAWG;AACH,MAAa,eAAe;IAI1B,YAAY,MAg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AQ;SAC1B,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,GAAG,IAAA,yBAAY,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,UAAU,CAAC,MAAsB;QACrC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC1C,GAAG,KAAK;YACR,+BAA+B;YAC/B,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,IAAA,wBAAU,GAAE;YAC5B,kBAAkB;YAClB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE;YAC1C,qCAAqC;YACrC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;gBAC/C,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;gBAC5C,CAAC,CAAC,KAAK,CAAC,OAAO;YACjB,oCAAoC;YACpC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC;gBACzD,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC;gBAClD,CAAC,CAAC,KAAK,CAAC,UAAU;SACrB,CAAC,CAAC,CAAC;QACJ,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;CACF;AAjED,0CAiEC"}
|
package/dist/esm/node/usageV2.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
2
2
|
import { getTopicName, } from "../core/usageV2.js";
|
3
3
|
import { KafkaProducer } from "./kafka.js";
|
4
|
+
const TEAM_ID_PREFIX = "team_";
|
5
|
+
const PROJECT_ID_PREFIX = "prj_";
|
4
6
|
/**
|
5
7
|
* Creates a UsageV2Producer which opens a persistent TCP connection.
|
6
8
|
* This class is thread-safe so your service should re-use one instance.
|
@@ -52,9 +54,13 @@ export class UsageV2Producer {
|
|
52
54
|
// Default to now.
|
53
55
|
created_at: event.created_at ?? new Date(),
|
54
56
|
// Remove the "team_" prefix, if any.
|
55
|
-
team_id: event.team_id.startsWith(
|
56
|
-
? event.team_id.slice(
|
57
|
+
team_id: event.team_id.startsWith(TEAM_ID_PREFIX)
|
58
|
+
? event.team_id.slice(TEAM_ID_PREFIX.length)
|
57
59
|
: event.team_id,
|
60
|
+
// Remove the "prj_" prefix, if any.
|
61
|
+
project_id: event.project_id?.startsWith(PROJECT_ID_PREFIX)
|
62
|
+
? event.project_id.slice(PROJECT_ID_PREFIX.length)
|
63
|
+
: event.project_id,
|
58
64
|
}));
|
59
65
|
await this.kafkaProducer.send(this.topic, parsedEvents);
|
60
66
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usageV2.js","sourceRoot":"","sources":["../../../src/node/usageV2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAGL,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,eAAe;IAI1B,YAAY,MAgBX;QAnBO;;;;;WAA6B;QAC7B;;;;;WAAc;QAmBpB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC;YACrC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;QACH,IAAI,CAAC,KA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AM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC1C,GAAG,KAAK;YACR,+BAA+B;YAC/B,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,UAAU,EAAE;YAC5B,kBAAkB;YAClB,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE;YAC1C,qCAAqC;YACrC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;gBAC/C,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;gBAC5C,CAAC,CAAC,KAAK,CAAC,OAAO;YACjB,oCAAoC;YACpC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,iBAAiB,CAAC;gBACzD,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC;gBAClD,CAAC,CAAC,KAAK,CAAC,UAAU;SACrB,CAAC,CAAC,CAAC;QACJ,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;CACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"usageV2.d.ts","sourceRoot":"","sources":["../../../src/node/usageV2.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAC;
|
1
|
+
{"version":3,"file":"usageV2.d.ts","sourceRoot":"","sources":["../../../src/node/usageV2.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAC;AAM5B;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE;QAClB;;WAEG;QACH,YAAY,EAAE,MAAM,CAAC;QACrB;;WAEG;QACH,YAAY,EAAE,MAAM,CAAC;QACrB;;WAEG;QACH,MAAM,EAAE,aAAa,CAAC;QAEtB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB;IAUD;;;;;;;;OAQG;IACG,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvD;;;OAGG;IACG,UAAU;CAGjB"}
|
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.11-nightly-47c9c43a875a81aa357ebf3c741f256c317c5cfd-20250301025507",
|
4
4
|
"type": "module",
|
5
5
|
"main": "dist/cjs/index.js",
|
6
6
|
"module": "dist/esm/index.js",
|