@paragraph-com/cli 0.0.2 → 0.0.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 +13 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43464,10 +43464,10 @@ async function getSubscriberCount(publicationId) {
|
|
|
43464
43464
|
const result = await client.subscribers.getCount({ id: publicationId });
|
|
43465
43465
|
return result.count || 0;
|
|
43466
43466
|
}
|
|
43467
|
-
async function addSubscriber(
|
|
43468
|
-
addSubscriberBody.parse(
|
|
43467
|
+
async function addSubscriber(params, apiKey) {
|
|
43468
|
+
addSubscriberBody.parse(params);
|
|
43469
43469
|
const client = createClient2(apiKey);
|
|
43470
|
-
await client.subscribers.create(
|
|
43470
|
+
await client.subscribers.create(params);
|
|
43471
43471
|
}
|
|
43472
43472
|
async function importSubscribers(csvPath, apiKey) {
|
|
43473
43473
|
const client = createClient2(apiKey);
|
|
@@ -43529,15 +43529,19 @@ Examples:
|
|
|
43529
43529
|
handleError(err);
|
|
43530
43530
|
}
|
|
43531
43531
|
});
|
|
43532
|
-
subscriber.command("add").description("Add a subscriber").
|
|
43532
|
+
subscriber.command("add").description("Add a subscriber by email or wallet address").option("--email <email>", "Subscriber email address").option("--wallet <address>", "Subscriber wallet address (0x format)").addHelpText("after", `
|
|
43533
43533
|
Examples:
|
|
43534
43534
|
$ paragraph subscriber add --email user@example.com
|
|
43535
|
+
$ paragraph subscriber add --wallet 0x1234...abcd
|
|
43535
43536
|
$ paragraph subscriber add --email user@example.com --json`).action(async function(opts) {
|
|
43536
43537
|
try {
|
|
43538
|
+
if (!opts.email && !opts.wallet) {
|
|
43539
|
+
throw new Error("Provide --email or --wallet (or both).");
|
|
43540
|
+
}
|
|
43537
43541
|
const apiKey = requireApiKey();
|
|
43538
|
-
await addSubscriber(opts.email, apiKey);
|
|
43539
|
-
writeSuccess(`Subscriber added: ${opts.email}`);
|
|
43540
|
-
outputData(this, { Email: opts.email }, { email: opts.email, added: true });
|
|
43542
|
+
await addSubscriber({ email: opts.email, wallet: opts.wallet }, apiKey);
|
|
43543
|
+
writeSuccess(`Subscriber added: ${opts.email || opts.wallet}`);
|
|
43544
|
+
outputData(this, { Email: opts.email, Wallet: opts.wallet }, { email: opts.email, wallet: opts.wallet, added: true });
|
|
43541
43545
|
} catch (err) {
|
|
43542
43546
|
handleError(err);
|
|
43543
43547
|
}
|
|
@@ -43785,7 +43789,7 @@ var init_user = __esm({
|
|
|
43785
43789
|
// src/cli/program.ts
|
|
43786
43790
|
function createProgram() {
|
|
43787
43791
|
const program2 = new Command();
|
|
43788
|
-
program2.name("paragraph").description("CLI for Paragraph").version("0.0.
|
|
43792
|
+
program2.name("paragraph").description("CLI for Paragraph").version("0.0.3", "-v, --version").option("--json", "Output as JSON").option("--verbose", "Show detailed output for debugging").exitOverride().configureOutput({
|
|
43789
43793
|
writeOut: (str) => process.stdout.write(str),
|
|
43790
43794
|
writeErr: (str) => {
|
|
43791
43795
|
if (process.argv.includes("--json")) {
|
|
@@ -45784,7 +45788,7 @@ function SubscriberAdd() {
|
|
|
45784
45788
|
const submit = async (email) => {
|
|
45785
45789
|
setLoading(true);
|
|
45786
45790
|
try {
|
|
45787
|
-
await addSubscriber(email, apiKey);
|
|
45791
|
+
await addSubscriber({ email }, apiKey);
|
|
45788
45792
|
setMessage(`Subscriber added: ${email}`);
|
|
45789
45793
|
} catch (err) {
|
|
45790
45794
|
setError(err instanceof Error ? err.message : String(err));
|