commet 0.8.1 → 1.0.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/index.js +41 -24
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_commander10 = require("commander");
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "commet",
|
|
33
|
-
version: "0.
|
|
33
|
+
version: "1.0.0",
|
|
34
34
|
description: "Commet CLI - Manage your billing platform from the command line",
|
|
35
35
|
bin: {
|
|
36
36
|
commet: "./bin/commet"
|
|
@@ -56,18 +56,17 @@ var package_default = {
|
|
|
56
56
|
author: "Commet Team",
|
|
57
57
|
license: "MIT",
|
|
58
58
|
dependencies: {
|
|
59
|
-
"@
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
ora: "^7.0.1"
|
|
59
|
+
"@inquirer/prompts": "8.0.1",
|
|
60
|
+
chalk: "5.6.2",
|
|
61
|
+
commander: "14.0.2",
|
|
62
|
+
"jsonc-parser": "3.3.1",
|
|
63
|
+
open: "11.0.0",
|
|
64
|
+
ora: "9.0.0"
|
|
66
65
|
},
|
|
67
66
|
devDependencies: {
|
|
68
|
-
"@types/node": "
|
|
69
|
-
tsup: "
|
|
70
|
-
typescript: "
|
|
67
|
+
"@types/node": "24.10.1",
|
|
68
|
+
tsup: "8.5.1",
|
|
69
|
+
typescript: "5.9.3"
|
|
71
70
|
},
|
|
72
71
|
engines: {
|
|
73
72
|
node: ">=18.0.0"
|
|
@@ -645,25 +644,29 @@ function validateTypeScriptProject() {
|
|
|
645
644
|
}
|
|
646
645
|
|
|
647
646
|
// src/utils/generator.ts
|
|
648
|
-
function generateTypes(eventTypes, seatTypes,
|
|
647
|
+
function generateTypes(eventTypes, seatTypes, features, plans) {
|
|
649
648
|
const eventTypeUnion = eventTypes.length > 0 ? eventTypes.map((e) => `"${e.code}"`).join(" | ") : "string";
|
|
650
649
|
const seatTypeUnion = seatTypes.length > 0 ? seatTypes.map((s) => `"${s.code}"`).join(" | ") : "string";
|
|
651
|
-
const
|
|
650
|
+
const planCodeUnion = plans.length > 0 ? plans.map((p) => `"${p.code}"`).join(" | ") : "string";
|
|
651
|
+
const featureCodeUnion = features.length > 0 ? features.map((f) => `"${f.code}"`).join(" | ") : "string";
|
|
652
652
|
const eventComments = eventTypes.map(
|
|
653
653
|
(e) => ` * - "${e.code}": ${e.name}${e.description ? ` - ${e.description}` : ""}`
|
|
654
654
|
).join("\n");
|
|
655
655
|
const seatComments = seatTypes.map(
|
|
656
656
|
(s) => ` * - "${s.code}": ${s.name}${s.description ? ` - ${s.description}` : ""} ${s.isFree ? "(Free)" : ""}`
|
|
657
657
|
).join("\n");
|
|
658
|
-
const
|
|
659
|
-
(p) => ` * - "${p.
|
|
658
|
+
const planComments = plans.map(
|
|
659
|
+
(p) => ` * - "${p.code}": ${p.name}${p.description ? ` - ${p.description}` : ""}`
|
|
660
|
+
).join("\n");
|
|
661
|
+
const featureComments = features.map(
|
|
662
|
+
(f) => ` * - "${f.code}": ${f.name} (${f.type})${f.description ? ` - ${f.description}` : ""}`
|
|
660
663
|
).join("\n");
|
|
661
664
|
return `// Auto-generated by Commet CLI
|
|
662
665
|
// Do not edit this file manually - run 'commet pull' to update
|
|
663
666
|
|
|
664
667
|
/**
|
|
665
668
|
* This augments the Commet SDK to automatically use your organization's
|
|
666
|
-
* specific event types, seat types, and
|
|
669
|
+
* specific event types, seat types, plans, and features without requiring generic type parameters.
|
|
667
670
|
*
|
|
668
671
|
* Event types available in your organization:
|
|
669
672
|
${eventComments || " * (none)"}
|
|
@@ -671,15 +674,19 @@ ${eventComments || " * (none)"}
|
|
|
671
674
|
* Seat types available in your organization:
|
|
672
675
|
${seatComments || " * (none)"}
|
|
673
676
|
*
|
|
674
|
-
*
|
|
675
|
-
${
|
|
677
|
+
* Plans available in your organization:
|
|
678
|
+
${planComments || " * (none)"}
|
|
679
|
+
*
|
|
680
|
+
* Features available in your organization:
|
|
681
|
+
${featureComments || " * (none)"}
|
|
676
682
|
*
|
|
677
683
|
*/
|
|
678
684
|
declare module '@commet/node' {
|
|
679
685
|
interface CommetGeneratedTypes {
|
|
680
686
|
eventType: ${eventTypeUnion};
|
|
681
687
|
seatType: ${seatTypeUnion};
|
|
682
|
-
|
|
688
|
+
planCode: ${planCodeUnion};
|
|
689
|
+
featureCode: ${featureCodeUnion};
|
|
683
690
|
}
|
|
684
691
|
}
|
|
685
692
|
|
|
@@ -759,8 +766,13 @@ var pullCommand = new import_commander6.Command("pull").description("Pull type d
|
|
|
759
766
|
console.error(import_chalk7.default.red("Error:"), result.error);
|
|
760
767
|
return;
|
|
761
768
|
}
|
|
762
|
-
const { eventTypes, seatTypes,
|
|
763
|
-
const typeDefinitions = generateTypes(
|
|
769
|
+
const { eventTypes, seatTypes, features, plans } = result.data;
|
|
770
|
+
const typeDefinitions = generateTypes(
|
|
771
|
+
eventTypes,
|
|
772
|
+
seatTypes,
|
|
773
|
+
features,
|
|
774
|
+
plans
|
|
775
|
+
);
|
|
764
776
|
const commetDir = path5.resolve(process.cwd(), ".commet");
|
|
765
777
|
const outputPath = path5.join(commetDir, "types.d.ts");
|
|
766
778
|
fs5.mkdirSync(commetDir, { recursive: true });
|
|
@@ -807,15 +819,20 @@ var pullCommand = new import_commander6.Command("pull").description("Pull type d
|
|
|
807
819
|
);
|
|
808
820
|
console.log(
|
|
809
821
|
import_chalk7.default.dim(
|
|
810
|
-
`
|
|
822
|
+
` Plans: ${plans.length > 0 ? plans.map((p) => p.code).join(", ") : "none"}`
|
|
823
|
+
)
|
|
824
|
+
);
|
|
825
|
+
console.log(
|
|
826
|
+
import_chalk7.default.dim(
|
|
827
|
+
` Features: ${features.length > 0 ? features.map((f) => f.code).join(", ") : "none"}`
|
|
811
828
|
)
|
|
812
829
|
);
|
|
813
830
|
console.log(import_chalk7.default.dim(`
|
|
814
831
|
Output: ${outputPath}`));
|
|
815
|
-
if (eventTypes.length === 0 && seatTypes.length === 0 &&
|
|
832
|
+
if (eventTypes.length === 0 && seatTypes.length === 0 && plans.length === 0 && features.length === 0) {
|
|
816
833
|
console.log(
|
|
817
834
|
import_chalk7.default.yellow(
|
|
818
|
-
"\n\u26A0 No types found. Create event types, seat types, and
|
|
835
|
+
"\n\u26A0 No types found. Create event types, seat types, plans, and features in your Commet dashboard."
|
|
819
836
|
)
|
|
820
837
|
);
|
|
821
838
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Commet CLI - Manage your billing platform from the command line",
|
|
5
5
|
"bin": {
|
|
6
6
|
"commet": "./bin/commet"
|
|
@@ -19,18 +19,17 @@
|
|
|
19
19
|
"author": "Commet Team",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@inquirer/prompts": "
|
|
23
|
-
"chalk": "
|
|
24
|
-
"commander": "
|
|
25
|
-
"jsonc-parser": "
|
|
26
|
-
"open": "
|
|
27
|
-
"ora": "
|
|
28
|
-
"@commet/node": "0.10.0"
|
|
22
|
+
"@inquirer/prompts": "8.0.1",
|
|
23
|
+
"chalk": "5.6.2",
|
|
24
|
+
"commander": "14.0.2",
|
|
25
|
+
"jsonc-parser": "3.3.1",
|
|
26
|
+
"open": "11.0.0",
|
|
27
|
+
"ora": "9.0.0"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
|
-
"@types/node": "
|
|
32
|
-
"tsup": "
|
|
33
|
-
"typescript": "
|
|
30
|
+
"@types/node": "24.10.1",
|
|
31
|
+
"tsup": "8.5.1",
|
|
32
|
+
"typescript": "5.9.3"
|
|
34
33
|
},
|
|
35
34
|
"engines": {
|
|
36
35
|
"node": ">=18.0.0"
|