commet 0.4.2 → 0.4.3
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/index.js +21 -24
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -543,40 +543,37 @@ function generateTypes(eventTypes, seatTypes) {
|
|
|
543
543
|
// Do not edit this file manually - run 'commet pull' to update
|
|
544
544
|
|
|
545
545
|
/**
|
|
546
|
-
*
|
|
546
|
+
* Module augmentation for automatic type inference
|
|
547
|
+
*
|
|
548
|
+
* This augments the Commet SDK to automatically use your organization's
|
|
549
|
+
* specific event and seat types without requiring generic type parameters.
|
|
550
|
+
*
|
|
551
|
+
* Event types available in your organization:
|
|
547
552
|
${eventComments}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* Seat types available in your organization
|
|
553
|
+
*
|
|
554
|
+
* Seat types available in your organization:
|
|
553
555
|
${seatComments}
|
|
554
|
-
*/
|
|
555
|
-
export type CommetSeatType = ${seatTypeUnion};
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Use these types with the Commet SDK for type-safe event and seat tracking
|
|
559
556
|
*
|
|
560
557
|
* @example
|
|
561
|
-
* import { Commet } from 'commet';
|
|
562
|
-
* import type { CommetEventType, CommetSeatType } from './.commet';
|
|
558
|
+
* import { Commet } from '@commet/node';
|
|
563
559
|
*
|
|
564
560
|
* const commet = new Commet({ apiKey: 'your-api-key' });
|
|
565
561
|
*
|
|
566
|
-
* //
|
|
567
|
-
* await commet.usage.
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
* timestamp: new Date(),
|
|
562
|
+
* // \u2705 Autocomplete works automatically!
|
|
563
|
+
* await commet.usage.events.create({
|
|
564
|
+
* eventType: 'api_call', // Only accepts your event types
|
|
565
|
+
* customerId: 'cus_123'
|
|
571
566
|
* });
|
|
572
567
|
*
|
|
573
|
-
* //
|
|
574
|
-
* await commet.seats.
|
|
575
|
-
* customerId: 'cust_123',
|
|
576
|
-
* seatType: 'admin_seat', // Autocomplete works!
|
|
577
|
-
* totalSeats: 5,
|
|
578
|
-
* });
|
|
568
|
+
* // \u2705 Same for seats
|
|
569
|
+
* await commet.seats.add('cus_123', 'admin', 5);
|
|
579
570
|
*/
|
|
571
|
+
declare module '@commet/node' {
|
|
572
|
+
interface CommetGeneratedTypes {
|
|
573
|
+
eventType: ${eventTypeUnion};
|
|
574
|
+
seatType: ${seatTypeUnion};
|
|
575
|
+
}
|
|
576
|
+
}
|
|
580
577
|
`;
|
|
581
578
|
}
|
|
582
579
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commet",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Commet CLI - Manage your billing platform from the command line",
|
|
5
5
|
"bin": {
|
|
6
6
|
"commet": "./bin/commet"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"commander": "^12.0.0",
|
|
25
25
|
"open": "^10.0.0",
|
|
26
26
|
"ora": "^7.0.1",
|
|
27
|
-
"@commet/node": "0.
|
|
27
|
+
"@commet/node": "0.5.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@biomejs/biome": "^1.9.4",
|