@paragraph-com/cli 0.1.1 → 0.3.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 +927 -35
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -980,7 +980,7 @@ var require_command = __commonJS({
|
|
|
980
980
|
var EventEmitter = __require("events").EventEmitter;
|
|
981
981
|
var childProcess = __require("child_process");
|
|
982
982
|
var path2 = __require("path");
|
|
983
|
-
var
|
|
983
|
+
var fs9 = __require("fs");
|
|
984
984
|
var process2 = __require("process");
|
|
985
985
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
986
986
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1913,10 +1913,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1913
1913
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1914
1914
|
function findFile(baseDir, baseName) {
|
|
1915
1915
|
const localBin = path2.resolve(baseDir, baseName);
|
|
1916
|
-
if (
|
|
1916
|
+
if (fs9.existsSync(localBin)) return localBin;
|
|
1917
1917
|
if (sourceExt.includes(path2.extname(baseName))) return void 0;
|
|
1918
1918
|
const foundExt = sourceExt.find(
|
|
1919
|
-
(ext) =>
|
|
1919
|
+
(ext) => fs9.existsSync(`${localBin}${ext}`)
|
|
1920
1920
|
);
|
|
1921
1921
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1922
1922
|
return void 0;
|
|
@@ -1928,7 +1928,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1928
1928
|
if (this._scriptPath) {
|
|
1929
1929
|
let resolvedScriptPath;
|
|
1930
1930
|
try {
|
|
1931
|
-
resolvedScriptPath =
|
|
1931
|
+
resolvedScriptPath = fs9.realpathSync(this._scriptPath);
|
|
1932
1932
|
} catch (err) {
|
|
1933
1933
|
resolvedScriptPath = this._scriptPath;
|
|
1934
1934
|
}
|
|
@@ -3266,7 +3266,7 @@ async function loadSellPeers() {
|
|
|
3266
3266
|
throw err;
|
|
3267
3267
|
}
|
|
3268
3268
|
}
|
|
3269
|
-
var BASE_URL, currentApiKey, setCurrentApiKey, ParagraphApiError, customAxios, getParagraphAPI, QueryResult, executeAbi, permit2Abi, AuthResource, MISSING_COIN_PEERS_MESSAGE, CoinsResource, FeedResource, MeResource, PostsResource, PublicationsResource, SearchResource, SubscribersResource, UsersResource, ParagraphAPI;
|
|
3269
|
+
var BASE_URL, currentApiKey, setCurrentApiKey, ParagraphApiError, customAxios, getParagraphAPI, QueryResult, executeAbi, permit2Abi, AnalyticsResource, AuthResource, MISSING_COIN_PEERS_MESSAGE, CoinsResource, EmailsResource, FeedResource, MeResource, PostsResource, PublicationsResource, SearchResource, SubscribersResource, UsersResource, ParagraphAPI;
|
|
3270
3270
|
var init_dist = __esm({
|
|
3271
3271
|
"node_modules/@paragraph-com/sdk/dist/index.mjs"() {
|
|
3272
3272
|
"use strict";
|
|
@@ -3330,6 +3330,16 @@ var init_dist = __esm({
|
|
|
3330
3330
|
}
|
|
3331
3331
|
);
|
|
3332
3332
|
};
|
|
3333
|
+
const updatePublication2 = (publicationId, updatePublicationBody2) => {
|
|
3334
|
+
return customAxios(
|
|
3335
|
+
{
|
|
3336
|
+
url: `/v1/publications/${publicationId}`,
|
|
3337
|
+
method: "PATCH",
|
|
3338
|
+
headers: { "Content-Type": "application/json" },
|
|
3339
|
+
data: updatePublicationBody2
|
|
3340
|
+
}
|
|
3341
|
+
);
|
|
3342
|
+
};
|
|
3333
3343
|
const getPublicationBySlug = (slug) => {
|
|
3334
3344
|
return customAxios(
|
|
3335
3345
|
{
|
|
@@ -3621,6 +3631,16 @@ var init_dist = __esm({
|
|
|
3621
3631
|
}
|
|
3622
3632
|
);
|
|
3623
3633
|
};
|
|
3634
|
+
const removeSubscriber2 = (removeSubscriberBody2) => {
|
|
3635
|
+
return customAxios(
|
|
3636
|
+
{
|
|
3637
|
+
url: `/v1/subscribers`,
|
|
3638
|
+
method: "DELETE",
|
|
3639
|
+
headers: { "Content-Type": "application/json" },
|
|
3640
|
+
data: removeSubscriberBody2
|
|
3641
|
+
}
|
|
3642
|
+
);
|
|
3643
|
+
};
|
|
3624
3644
|
const listSubscribers2 = (params) => {
|
|
3625
3645
|
return customAxios(
|
|
3626
3646
|
{
|
|
@@ -3657,6 +3677,34 @@ var init_dist = __esm({
|
|
|
3657
3677
|
}
|
|
3658
3678
|
);
|
|
3659
3679
|
};
|
|
3680
|
+
const analyticsQuery = (analyticsQueryBody2) => {
|
|
3681
|
+
return customAxios(
|
|
3682
|
+
{
|
|
3683
|
+
url: `/v1/analytics/query`,
|
|
3684
|
+
method: "POST",
|
|
3685
|
+
headers: { "Content-Type": "application/json" },
|
|
3686
|
+
data: analyticsQueryBody2
|
|
3687
|
+
}
|
|
3688
|
+
);
|
|
3689
|
+
};
|
|
3690
|
+
const analyticsSchema = () => {
|
|
3691
|
+
return customAxios(
|
|
3692
|
+
{
|
|
3693
|
+
url: `/v1/analytics/schema`,
|
|
3694
|
+
method: "GET"
|
|
3695
|
+
}
|
|
3696
|
+
);
|
|
3697
|
+
};
|
|
3698
|
+
const sendCustomEmail2 = (sendCustomEmailBody2) => {
|
|
3699
|
+
return customAxios(
|
|
3700
|
+
{
|
|
3701
|
+
url: `/v1/emails/send`,
|
|
3702
|
+
method: "POST",
|
|
3703
|
+
headers: { "Content-Type": "application/json" },
|
|
3704
|
+
data: sendCustomEmailBody2
|
|
3705
|
+
}
|
|
3706
|
+
);
|
|
3707
|
+
};
|
|
3660
3708
|
const createAuthSession = (createAuthSessionBody2) => {
|
|
3661
3709
|
return customAxios(
|
|
3662
3710
|
{
|
|
@@ -3683,7 +3731,7 @@ var init_dist = __esm({
|
|
|
3683
3731
|
}
|
|
3684
3732
|
);
|
|
3685
3733
|
};
|
|
3686
|
-
return { getPublicationById, getPublicationBySlug, getPublicationByDomain: getPublicationByDomain2, getSubscriberCount: getSubscriberCount2, getPostsFeed, getPostsByTag: getPostsByTag2, getPosts, getPostById, updatePost: updatePost2, deletePost: deletePost2, getPostByPublicationIdAndPostSlug, getPostByPublicationSlugAndPostSlug, createPost: createPost2, listOwnPosts, updatePostBySlug, deletePostBySlug, sendTestEmail: sendTestEmail2, getMe, getUser: getUser2, getUserByWallet, getCoin: getCoin2, getCoinByContract, getCoinHoldersById, getCoinHoldersByContract, getBuyArgsById, getBuyArgsByContract, getSellArgsById, getSellArgsByContract, getQuoteById, getQuoteByContract, getPopularCoins: getPopularCoins2, importSubscribers: importSubscribers2, addSubscriber: addSubscriber2, listSubscribers: listSubscribers2, searchPosts: searchPosts2, searchBlogs: searchBlogs2, searchCoins: searchCoins2, createAuthSession, getAuthSession, deleteAuthSession };
|
|
3734
|
+
return { getPublicationById, updatePublication: updatePublication2, getPublicationBySlug, getPublicationByDomain: getPublicationByDomain2, getSubscriberCount: getSubscriberCount2, getPostsFeed, getPostsByTag: getPostsByTag2, getPosts, getPostById, updatePost: updatePost2, deletePost: deletePost2, getPostByPublicationIdAndPostSlug, getPostByPublicationSlugAndPostSlug, createPost: createPost2, listOwnPosts, updatePostBySlug, deletePostBySlug, sendTestEmail: sendTestEmail2, getMe, getUser: getUser2, getUserByWallet, getCoin: getCoin2, getCoinByContract, getCoinHoldersById, getCoinHoldersByContract, getBuyArgsById, getBuyArgsByContract, getSellArgsById, getSellArgsByContract, getQuoteById, getQuoteByContract, getPopularCoins: getPopularCoins2, importSubscribers: importSubscribers2, addSubscriber: addSubscriber2, removeSubscriber: removeSubscriber2, listSubscribers: listSubscribers2, searchPosts: searchPosts2, searchBlogs: searchBlogs2, searchCoins: searchCoins2, analyticsQuery, analyticsSchema, sendCustomEmail: sendCustomEmail2, createAuthSession, getAuthSession, deleteAuthSession };
|
|
3687
3735
|
};
|
|
3688
3736
|
QueryResult = class {
|
|
3689
3737
|
constructor(promise) {
|
|
@@ -3739,6 +3787,99 @@ var init_dist = __esm({
|
|
|
3739
3787
|
]
|
|
3740
3788
|
}
|
|
3741
3789
|
];
|
|
3790
|
+
AnalyticsResource = class {
|
|
3791
|
+
constructor(api) {
|
|
3792
|
+
this.api = api;
|
|
3793
|
+
}
|
|
3794
|
+
/**
|
|
3795
|
+
* Executes a read-only SQL query against the analytics schema for your
|
|
3796
|
+
* publication. The query runs in a transaction scoped to your publication —
|
|
3797
|
+
* you do not need to (and cannot) reference a blog id in the SQL. Requires
|
|
3798
|
+
* an API key.
|
|
3799
|
+
*
|
|
3800
|
+
* **SQL requirements:**
|
|
3801
|
+
* - `SELECT` or `WITH` (CTE) statements only
|
|
3802
|
+
* - Reference tables unprefixed (e.g. `FROM posts`) — the `analytics`
|
|
3803
|
+
* schema is the default `search_path`
|
|
3804
|
+
* - No semicolons, writes, DDL, or superuser functions
|
|
3805
|
+
* - Hard limit of 10,000 rows; excess rows are truncated and
|
|
3806
|
+
* `truncated: true` is returned
|
|
3807
|
+
* - 30-second statement timeout
|
|
3808
|
+
*
|
|
3809
|
+
* Call {@link AnalyticsResource.schema} first if you need to discover the
|
|
3810
|
+
* available tables and columns.
|
|
3811
|
+
*
|
|
3812
|
+
* @example
|
|
3813
|
+
* ```ts
|
|
3814
|
+
* const api = new ParagraphAPI({ apiKey: "your-api-key" });
|
|
3815
|
+
*
|
|
3816
|
+
* // Top 5 posts by views
|
|
3817
|
+
* const { rows } = await api.analytics.query({
|
|
3818
|
+
* sql: `
|
|
3819
|
+
* SELECT title, total_views, open_rate
|
|
3820
|
+
* FROM post_analytics_summary
|
|
3821
|
+
* ORDER BY total_views DESC
|
|
3822
|
+
* LIMIT 5
|
|
3823
|
+
* `,
|
|
3824
|
+
* });
|
|
3825
|
+
* rows.forEach(r => console.log(r.title, r.total_views));
|
|
3826
|
+
*
|
|
3827
|
+
* // Subscriber count
|
|
3828
|
+
* const { rows: [counts] } = await api.analytics.query({
|
|
3829
|
+
* sql: "SELECT active_count FROM blog_subscriber_counts",
|
|
3830
|
+
* });
|
|
3831
|
+
* console.log("Active subscribers:", counts.active_count);
|
|
3832
|
+
*
|
|
3833
|
+
* // Average open rate across the last 30 days
|
|
3834
|
+
* const { rows: [avg] } = await api.analytics.query({
|
|
3835
|
+
* sql: `
|
|
3836
|
+
* SELECT AVG(open_rate) AS avg_open_rate
|
|
3837
|
+
* FROM post_analytics_summary
|
|
3838
|
+
* WHERE published_at > NOW() - INTERVAL '30 days'
|
|
3839
|
+
* `,
|
|
3840
|
+
* });
|
|
3841
|
+
* ```
|
|
3842
|
+
*
|
|
3843
|
+
* @param body - An object containing the SQL string.
|
|
3844
|
+
* @param body.sql - A `SELECT` or `WITH` query against the analytics schema.
|
|
3845
|
+
* @returns A promise that resolves to an object with `rows`, `rowCount`,
|
|
3846
|
+
* `fields` (column names), and `truncated` (whether the 10,000-row cap was hit).
|
|
3847
|
+
*/
|
|
3848
|
+
query(body) {
|
|
3849
|
+
return this.api.analyticsQuery(body);
|
|
3850
|
+
}
|
|
3851
|
+
/**
|
|
3852
|
+
* Returns column metadata for every table and view in the analytics schema.
|
|
3853
|
+
* Useful for discovering available tables and columns before writing a query.
|
|
3854
|
+
* Requires an API key.
|
|
3855
|
+
*
|
|
3856
|
+
* @example
|
|
3857
|
+
* ```ts
|
|
3858
|
+
* const api = new ParagraphAPI({ apiKey: "your-api-key" });
|
|
3859
|
+
*
|
|
3860
|
+
* const { tables } = await api.analytics.schema();
|
|
3861
|
+
*
|
|
3862
|
+
* // Group columns by table
|
|
3863
|
+
* const byTable = new Map<string, string[]>();
|
|
3864
|
+
* for (const col of tables) {
|
|
3865
|
+
* const cols = byTable.get(col.table_name) ?? [];
|
|
3866
|
+
* cols.push(`${col.column_name} (${col.data_type})`);
|
|
3867
|
+
* byTable.set(col.table_name, cols);
|
|
3868
|
+
* }
|
|
3869
|
+
* for (const [table, cols] of byTable) {
|
|
3870
|
+
* console.log(`\n${table}:`);
|
|
3871
|
+
* cols.forEach(c => console.log(` - ${c}`));
|
|
3872
|
+
* }
|
|
3873
|
+
* ```
|
|
3874
|
+
*
|
|
3875
|
+
* @returns A promise that resolves to an object with a `tables` array,
|
|
3876
|
+
* where each item describes one column (`table_name`, `column_name`,
|
|
3877
|
+
* `data_type`, `is_nullable`).
|
|
3878
|
+
*/
|
|
3879
|
+
schema() {
|
|
3880
|
+
return this.api.analyticsSchema();
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3742
3883
|
AuthResource = class {
|
|
3743
3884
|
constructor(api) {
|
|
3744
3885
|
this.api = api;
|
|
@@ -4099,6 +4240,68 @@ var init_dist = __esm({
|
|
|
4099
4240
|
throw new Error("Invalid identifier provided to getQuote.");
|
|
4100
4241
|
}
|
|
4101
4242
|
};
|
|
4243
|
+
EmailsResource = class {
|
|
4244
|
+
constructor(api) {
|
|
4245
|
+
this.api = api;
|
|
4246
|
+
}
|
|
4247
|
+
/**
|
|
4248
|
+
* Sends a custom email from your publication to a list of recipient
|
|
4249
|
+
* addresses. Markdown body, rendered to HTML server-side. Each recipient
|
|
4250
|
+
* receives the email individually with a mandatory unsubscribe footer.
|
|
4251
|
+
* Requires an API key.
|
|
4252
|
+
*
|
|
4253
|
+
* **Eligibility:** Publications must be approved by Paragraph before they
|
|
4254
|
+
* can send custom emails. Ineligible publications receive a 403.
|
|
4255
|
+
*
|
|
4256
|
+
* **Per-recipient filtering:**
|
|
4257
|
+
* - Malformed addresses and known disposable domains are skipped (`invalid`).
|
|
4258
|
+
* - Addresses that previously unsubscribed from this publication are skipped
|
|
4259
|
+
* (`suppressed`).
|
|
4260
|
+
* - Skipped recipients are returned in the response; nothing is delivered to
|
|
4261
|
+
* them.
|
|
4262
|
+
*
|
|
4263
|
+
* **Caps:** Maximum of 10,000 addresses per call.
|
|
4264
|
+
*
|
|
4265
|
+
* **Async delivery:** A 200 response means recipients were accepted, not
|
|
4266
|
+
* delivered. Sends are queued asynchronously.
|
|
4267
|
+
*
|
|
4268
|
+
* @example
|
|
4269
|
+
* ```ts
|
|
4270
|
+
* const api = new ParagraphAPI({ apiKey: "your-api-key" });
|
|
4271
|
+
*
|
|
4272
|
+
* // Send a markdown email to a list of recipients
|
|
4273
|
+
* const { accepted, skipped } = await api.emails.send({
|
|
4274
|
+
* subject: "Hello from Paragraph",
|
|
4275
|
+
* body: "# Welcome\n\nThanks for reading.",
|
|
4276
|
+
* emails: ["reader@example.com", "another@example.com"],
|
|
4277
|
+
* });
|
|
4278
|
+
* console.log(`${accepted} queued, ${skipped.length} skipped`);
|
|
4279
|
+
* skipped.forEach(s => console.log(`${s.email}: ${s.reason}`));
|
|
4280
|
+
*
|
|
4281
|
+
* // Dry run — check filtering without sending
|
|
4282
|
+
* const preview = await api.emails.send({
|
|
4283
|
+
* subject: "Preview",
|
|
4284
|
+
* body: "Body here",
|
|
4285
|
+
* emails: ["reader@example.com"],
|
|
4286
|
+
* dryRun: true,
|
|
4287
|
+
* });
|
|
4288
|
+
* ```
|
|
4289
|
+
*
|
|
4290
|
+
* @param body - The email send request.
|
|
4291
|
+
* @param body.subject - Subject line (1–998 characters).
|
|
4292
|
+
* @param body.body - Markdown body, rendered to HTML server-side (max 100KB).
|
|
4293
|
+
* @param body.emails - Recipient email addresses (max 10,000).
|
|
4294
|
+
* @param body.dryRun - If true, run filtering and return the accepted/skipped
|
|
4295
|
+
* split without scheduling delivery.
|
|
4296
|
+
* @returns A promise resolving to `{ accepted, skipped }`. `accepted` is the
|
|
4297
|
+
* number of recipients queued for delivery; `skipped` lists rejected
|
|
4298
|
+
* recipients with their reason (`suppressed`, `invalid`, or
|
|
4299
|
+
* `scheduling_failed`).
|
|
4300
|
+
*/
|
|
4301
|
+
send(body) {
|
|
4302
|
+
return this.api.sendCustomEmail(body);
|
|
4303
|
+
}
|
|
4304
|
+
};
|
|
4102
4305
|
FeedResource = class {
|
|
4103
4306
|
constructor(api) {
|
|
4104
4307
|
this.api = api;
|
|
@@ -4361,6 +4564,12 @@ var init_dist = __esm({
|
|
|
4361
4564
|
* id: "postId",
|
|
4362
4565
|
* scheduledAt: null,
|
|
4363
4566
|
* });
|
|
4567
|
+
*
|
|
4568
|
+
* // Backdate a post — publishedAt sticks across re-publishes
|
|
4569
|
+
* await api.posts.update({
|
|
4570
|
+
* id: "postId",
|
|
4571
|
+
* publishedAt: new Date("2024-01-01T00:00:00Z").getTime(),
|
|
4572
|
+
* });
|
|
4364
4573
|
* ```
|
|
4365
4574
|
*
|
|
4366
4575
|
* @param params - An object containing either `id` or `slug` to identify the post, plus the fields to update.
|
|
@@ -4469,6 +4678,45 @@ var init_dist = __esm({
|
|
|
4469
4678
|
}
|
|
4470
4679
|
throw new Error("Invalid identifier provided to get.");
|
|
4471
4680
|
}
|
|
4681
|
+
/**
|
|
4682
|
+
* Updates settings for the publication associated with the API key.
|
|
4683
|
+
* Only provided fields are updated; omitted fields remain unchanged.
|
|
4684
|
+
* Requires an API key, and `publicationId` must match the publication that owns the key.
|
|
4685
|
+
*
|
|
4686
|
+
* @example
|
|
4687
|
+
* ```ts
|
|
4688
|
+
* const api = new ParagraphAPI({ apiKey: "your-api-key" });
|
|
4689
|
+
*
|
|
4690
|
+
* // Update name and theme
|
|
4691
|
+
* await api.publications.update("publicationId", {
|
|
4692
|
+
* name: "My Blog",
|
|
4693
|
+
* themeColor: "purple-600",
|
|
4694
|
+
* headerFont: "serif",
|
|
4695
|
+
* });
|
|
4696
|
+
*
|
|
4697
|
+
* // Pin posts to the top of the homepage (replaces the existing pinned list, max 50)
|
|
4698
|
+
* await api.publications.update("publicationId", {
|
|
4699
|
+
* pinnedPostIds: ["postId1", "postId2"],
|
|
4700
|
+
* });
|
|
4701
|
+
*
|
|
4702
|
+
* // Set a featured post — use a post ID, "latest", "popular", or "disabled"
|
|
4703
|
+
* await api.publications.update("publicationId", {
|
|
4704
|
+
* featuredPost: "latest",
|
|
4705
|
+
* });
|
|
4706
|
+
*
|
|
4707
|
+
* // Email notifications are merged onto existing settings; only the toggles you send change
|
|
4708
|
+
* await api.publications.update("publicationId", {
|
|
4709
|
+
* emailNotifications: { newSubscriber: true },
|
|
4710
|
+
* });
|
|
4711
|
+
* ```
|
|
4712
|
+
*
|
|
4713
|
+
* @param publicationId - The unique identifier of the publication to update.
|
|
4714
|
+
* @param body - The fields to update. See {@link UpdatePublicationBody}.
|
|
4715
|
+
* @returns A promise that resolves to the updated publication.
|
|
4716
|
+
*/
|
|
4717
|
+
update(publicationId, body) {
|
|
4718
|
+
return this.api.updatePublication(publicationId, body);
|
|
4719
|
+
}
|
|
4472
4720
|
};
|
|
4473
4721
|
SearchResource = class {
|
|
4474
4722
|
constructor(api) {
|
|
@@ -4616,6 +4864,35 @@ var init_dist = __esm({
|
|
|
4616
4864
|
create(body) {
|
|
4617
4865
|
return this.api.addSubscriber(body);
|
|
4618
4866
|
}
|
|
4867
|
+
/**
|
|
4868
|
+
* Removes a subscriber from the publication associated with the API key.
|
|
4869
|
+
* The subscriber is identified by email, wallet, or both. If both are provided,
|
|
4870
|
+
* they must resolve to the same user. This is a hard delete; consider calling
|
|
4871
|
+
* `get()` first to confirm the subscriber exists. Requires an API key.
|
|
4872
|
+
*
|
|
4873
|
+
* @example
|
|
4874
|
+
* ```ts
|
|
4875
|
+
* const api = new ParagraphAPI({ apiKey: "your-api-key" });
|
|
4876
|
+
*
|
|
4877
|
+
* // Remove subscriber by email
|
|
4878
|
+
* await api.subscribers.remove({ email: "user@example.com" });
|
|
4879
|
+
*
|
|
4880
|
+
* // Remove subscriber by wallet
|
|
4881
|
+
* await api.subscribers.remove({ wallet: "0x1234..." });
|
|
4882
|
+
*
|
|
4883
|
+
* // Pass both — must resolve to the same user
|
|
4884
|
+
* await api.subscribers.remove({
|
|
4885
|
+
* email: "user@example.com",
|
|
4886
|
+
* wallet: "0x1234...",
|
|
4887
|
+
* });
|
|
4888
|
+
* ```
|
|
4889
|
+
*
|
|
4890
|
+
* @param body - The subscriber to remove. At least one of email or wallet must be provided.
|
|
4891
|
+
* @returns A promise that resolves to the result of the operation.
|
|
4892
|
+
*/
|
|
4893
|
+
remove(body) {
|
|
4894
|
+
return this.api.removeSubscriber(body);
|
|
4895
|
+
}
|
|
4619
4896
|
/**
|
|
4620
4897
|
* Imports subscribers from a CSV file into the publication associated with the API key.
|
|
4621
4898
|
* Requires an API key.
|
|
@@ -4686,6 +4963,7 @@ var init_dist = __esm({
|
|
|
4686
4963
|
constructor(options) {
|
|
4687
4964
|
this.apiKey = options?.apiKey;
|
|
4688
4965
|
this.api = wrapAPIWithAuth(getParagraphAPI(), this.apiKey, setCurrentApiKey);
|
|
4966
|
+
this.analytics = new AnalyticsResource(this.api);
|
|
4689
4967
|
this.auth = new AuthResource(this.api);
|
|
4690
4968
|
this.publications = new PublicationsResource(this.api);
|
|
4691
4969
|
this.subscribers = new SubscribersResource(this.api);
|
|
@@ -4693,6 +4971,7 @@ var init_dist = __esm({
|
|
|
4693
4971
|
this.feed = new FeedResource(this.api);
|
|
4694
4972
|
this.users = new UsersResource(this.api);
|
|
4695
4973
|
this.coins = new CoinsResource(this.api);
|
|
4974
|
+
this.emails = new EmailsResource(this.api);
|
|
4696
4975
|
this.search = new SearchResource(this.api);
|
|
4697
4976
|
this.me = new MeResource(this.api);
|
|
4698
4977
|
}
|
|
@@ -6906,7 +7185,7 @@ var init_auth2 = __esm({
|
|
|
6906
7185
|
|
|
6907
7186
|
// node_modules/@paragraph-com/sdk/dist/zod.mjs
|
|
6908
7187
|
import * as zod from "zod";
|
|
6909
|
-
var getPublicationByIdParams, getPublicationByIdResponseSlugMax, getPublicationByIdResponseSummaryMax, getPublicationByIdResponse, getPublicationBySlugPathSlugMax, getPublicationBySlugParams, getPublicationBySlugResponseSlugMax, getPublicationBySlugResponseSummaryMax, getPublicationBySlugResponse, getPublicationByDomainParams, getPublicationByDomainResponseSlugMax, getPublicationByDomainResponseSummaryMax, getPublicationByDomainResponse, getSubscriberCountParams, getSubscriberCountResponse, getPostsFeedQueryLimitDefault, getPostsFeedQueryLimitMax, getPostsFeedQueryParams, getPostsFeedResponseItemsItemPostTitleMax, getPostsFeedResponseItemsItemPostSubtitleMax, getPostsFeedResponseItemsItemPostSlugMax, getPostsFeedResponseItemsItemPostAuthorsItemWalletAddressRegExp, getPostsFeedResponseItemsItemPostAuthorsItemBioMax, getPostsFeedResponseItemsItemPublicationSlugMax, getPostsFeedResponseItemsItemPublicationSummaryMax, getPostsFeedResponseItemsItemUserWalletAddressRegExp, getPostsFeedResponseItemsItemUserBioMax, getPostsFeedResponse, getPostsByTagParams, getPostsByTagQueryLimitDefault, getPostsByTagQueryLimitMax, getPostsByTagQueryParams, getPostsByTagResponseItemsItemTitleMax, getPostsByTagResponseItemsItemSubtitleMax, getPostsByTagResponseItemsItemSlugMax, getPostsByTagResponseItemsItemAuthorsItemWalletAddressRegExp, getPostsByTagResponseItemsItemAuthorsItemBioMax, getPostsByTagResponse, getPostsParams, getPostsQueryLimitDefault, getPostsQueryLimitMax, getPostsQueryParams, getPostsResponseItemsItemTitleMax, getPostsResponseItemsItemSubtitleMax, getPostsResponseItemsItemSlugMax, getPostsResponseItemsItemAuthorsItemWalletAddressRegExp, getPostsResponseItemsItemAuthorsItemBioMax, getPostsResponse, getPostByIdParams, getPostByIdQueryParams, getPostByIdResponseTitleMax, getPostByIdResponseSubtitleMax, getPostByIdResponseSlugMax, getPostByIdResponseAuthorsItemWalletAddressRegExp, getPostByIdResponseAuthorsItemBioMax, getPostByIdResponse, updatePostParams, updatePostBodyTitleMax, updatePostBodySubtitleMax, updatePostBodySlugMax, updatePostBodyPostPreviewMax, updatePostBodyScheduledAtMin, updatePostBody, updatePostResponse, deletePostParams, deletePostBody, deletePostResponse, getPostByPublicationIdAndPostSlugPathPostSlugMax, getPostByPublicationIdAndPostSlugParams, getPostByPublicationIdAndPostSlugQueryParams, getPostByPublicationIdAndPostSlugResponseTitleMax, getPostByPublicationIdAndPostSlugResponseSubtitleMax, getPostByPublicationIdAndPostSlugResponseSlugMax, getPostByPublicationIdAndPostSlugResponseAuthorsItemWalletAddressRegExp, getPostByPublicationIdAndPostSlugResponseAuthorsItemBioMax, getPostByPublicationIdAndPostSlugResponse, getPostByPublicationSlugAndPostSlugPathPublicationSlugMax, getPostByPublicationSlugAndPostSlugPathPostSlugMax, getPostByPublicationSlugAndPostSlugParams, getPostByPublicationSlugAndPostSlugQueryParams, getPostByPublicationSlugAndPostSlugResponseTitleMax, getPostByPublicationSlugAndPostSlugResponseSubtitleMax, getPostByPublicationSlugAndPostSlugResponseSlugMax, getPostByPublicationSlugAndPostSlugResponseAuthorsItemWalletAddressRegExp, getPostByPublicationSlugAndPostSlugResponseAuthorsItemBioMax, getPostByPublicationSlugAndPostSlugResponse, createPostBodyTitleMax, createPostBodySubtitleMax, createPostBodySlugMax, createPostBodyPostPreviewMax, createPostBodyScheduledAtMin, createPostBody, createPostResponse, listOwnPostsQueryLimitDefault, listOwnPostsQueryLimitMax, listOwnPostsQueryParams, listOwnPostsResponseItemsItemTitleMax, listOwnPostsResponseItemsItemSubtitleMax, listOwnPostsResponseItemsItemSlugMax, listOwnPostsResponseItemsItemAuthorsItemWalletAddressRegExp, listOwnPostsResponseItemsItemAuthorsItemBioMax, listOwnPostsResponse, updatePostBySlugPathSlugMax, updatePostBySlugParams, updatePostBySlugBodyTitleMax, updatePostBySlugBodySubtitleMax, updatePostBySlugBodySlugMax, updatePostBySlugBodyPostPreviewMax, updatePostBySlugBodyScheduledAtMin, updatePostBySlugBody, updatePostBySlugResponse, deletePostBySlugPathSlugMax, deletePostBySlugParams, deletePostBySlugBody, deletePostBySlugResponse, sendTestEmailParams, sendTestEmailBody, sendTestEmailResponse, getMeResponseSlugMax, getMeResponseSummaryMax, getMeResponse, getUserParams, getUserResponseWalletAddressRegExp, getUserResponseBioMax, getUserResponse, getUserByWalletPathWalletAddressRegExp, getUserByWalletParams, getUserByWalletResponseWalletAddressRegExp, getUserByWalletResponseBioMax, getUserByWalletResponse, getCoinParams, getCoinResponseContractAddressRegExp, getCoinResponse, getCoinByContractPathContractAddressRegExp, getCoinByContractParams, getCoinByContractResponseContractAddressRegExp, getCoinByContractResponse, getCoinHoldersByIdParams, getCoinHoldersByIdQueryLimitDefault, getCoinHoldersByIdQueryLimitMax, getCoinHoldersByIdQueryParams, getCoinHoldersByIdResponseItemsItemWalletAddressRegExp, getCoinHoldersByIdResponseItemsItemBalanceRegExp, getCoinHoldersByIdResponse, getCoinHoldersByContractPathContractAddressRegExp, getCoinHoldersByContractParams, getCoinHoldersByContractQueryLimitDefault, getCoinHoldersByContractQueryLimitMax, getCoinHoldersByContractQueryParams, getCoinHoldersByContractResponseItemsItemWalletAddressRegExp, getCoinHoldersByContractResponseItemsItemBalanceRegExp, getCoinHoldersByContractResponse, getBuyArgsByIdParams, getBuyArgsByIdQueryWalletAddressRegExp, getBuyArgsByIdQueryAmountRegExp, getBuyArgsByIdQueryParams, getBuyArgsByIdResponseCommandsRegExp, getBuyArgsByIdResponseInputsItemRegExp, getBuyArgsByIdResponse, getBuyArgsByContractPathContractAddressRegExp, getBuyArgsByContractParams, getBuyArgsByContractQueryWalletAddressRegExp, getBuyArgsByContractQueryAmountRegExp, getBuyArgsByContractQueryParams, getBuyArgsByContractResponseCommandsRegExp, getBuyArgsByContractResponseInputsItemRegExp, getBuyArgsByContractResponse, getSellArgsByIdParams, getSellArgsByIdQueryWalletAddressRegExp, getSellArgsByIdQueryAmountRegExp, getSellArgsByIdQueryParams, getSellArgsByIdResponseCommandsRegExp, getSellArgsByIdResponseInputsItemRegExp, getSellArgsByIdResponse, getSellArgsByContractPathContractAddressRegExp, getSellArgsByContractParams, getSellArgsByContractQueryWalletAddressRegExp, getSellArgsByContractQueryAmountRegExp, getSellArgsByContractQueryParams, getSellArgsByContractResponseCommandsRegExp, getSellArgsByContractResponseInputsItemRegExp, getSellArgsByContractResponse, getQuoteByIdParams, getQuoteByIdQueryAmountRegExp, getQuoteByIdQueryParams, getQuoteByIdResponse, getQuoteByContractParams, getQuoteByContractQueryAmountRegExp, getQuoteByContractQueryParams, getQuoteByContractResponse, getPopularCoinsResponseCoinsItemContractAddressRegExp, getPopularCoinsResponse, importSubscribersBody, importSubscribersResponse, addSubscriberBodyWalletRegExp, addSubscriberBody, addSubscriberResponse, listSubscribersQueryLimitDefault, listSubscribersQueryLimitMax, listSubscribersQueryParams, listSubscribersResponseItemsItemWalletAddressRegExp, listSubscribersResponse, searchPostsQueryParams, searchPostsResponseItem, searchPostsResponse, searchBlogsQueryParams, searchBlogsResponseItem, searchBlogsResponse, searchCoinsQueryParams, searchCoinsResponseItem, searchCoinsResponse, createAuthSessionBodyDeviceNameMax, createAuthSessionBodyCallbackUrlMax, createAuthSessionBody, getAuthSessionParams, getAuthSessionResponse, deleteAuthSessionParams, deleteAuthSessionResponse;
|
|
7188
|
+
var getPublicationByIdParams, getPublicationByIdResponseSlugMax, getPublicationByIdResponseSummaryMax, getPublicationByIdResponse, updatePublicationParams, updatePublicationBodyNameMax, updatePublicationBodySummaryMax, updatePublicationBodyPinnedPostIdsItemMax, updatePublicationBodyPinnedPostIdsMax, updatePublicationBody, updatePublicationResponseSlugMax, updatePublicationResponseSummaryMax, updatePublicationResponse, getPublicationBySlugPathSlugMax, getPublicationBySlugParams, getPublicationBySlugResponseSlugMax, getPublicationBySlugResponseSummaryMax, getPublicationBySlugResponse, getPublicationByDomainParams, getPublicationByDomainResponseSlugMax, getPublicationByDomainResponseSummaryMax, getPublicationByDomainResponse, getSubscriberCountParams, getSubscriberCountResponse, getPostsFeedQueryLimitDefault, getPostsFeedQueryLimitMax, getPostsFeedQueryParams, getPostsFeedResponseItemsItemPostTitleMax, getPostsFeedResponseItemsItemPostSubtitleMax, getPostsFeedResponseItemsItemPostSlugMax, getPostsFeedResponseItemsItemPostAuthorsItemWalletAddressRegExp, getPostsFeedResponseItemsItemPostAuthorsItemBioMax, getPostsFeedResponseItemsItemPublicationSlugMax, getPostsFeedResponseItemsItemPublicationSummaryMax, getPostsFeedResponseItemsItemUserWalletAddressRegExp, getPostsFeedResponseItemsItemUserBioMax, getPostsFeedResponse, getPostsByTagParams, getPostsByTagQueryLimitDefault, getPostsByTagQueryLimitMax, getPostsByTagQueryParams, getPostsByTagResponseItemsItemTitleMax, getPostsByTagResponseItemsItemSubtitleMax, getPostsByTagResponseItemsItemSlugMax, getPostsByTagResponseItemsItemAuthorsItemWalletAddressRegExp, getPostsByTagResponseItemsItemAuthorsItemBioMax, getPostsByTagResponse, getPostsParams, getPostsQueryLimitDefault, getPostsQueryLimitMax, getPostsQueryParams, getPostsResponseItemsItemTitleMax, getPostsResponseItemsItemSubtitleMax, getPostsResponseItemsItemSlugMax, getPostsResponseItemsItemAuthorsItemWalletAddressRegExp, getPostsResponseItemsItemAuthorsItemBioMax, getPostsResponse, getPostByIdParams, getPostByIdQueryParams, getPostByIdResponseTitleMax, getPostByIdResponseSubtitleMax, getPostByIdResponseSlugMax, getPostByIdResponseAuthorsItemWalletAddressRegExp, getPostByIdResponseAuthorsItemBioMax, getPostByIdResponse, updatePostParams, updatePostBodyTitleMax, updatePostBodySubtitleMax, updatePostBodySlugMax, updatePostBodyPostPreviewMax, updatePostBodyScheduledAtMin, updatePostBodyPublishedAtMin, updatePostBody, updatePostResponse, deletePostParams, deletePostBody, deletePostResponse, getPostByPublicationIdAndPostSlugPathPostSlugMax, getPostByPublicationIdAndPostSlugParams, getPostByPublicationIdAndPostSlugQueryParams, getPostByPublicationIdAndPostSlugResponseTitleMax, getPostByPublicationIdAndPostSlugResponseSubtitleMax, getPostByPublicationIdAndPostSlugResponseSlugMax, getPostByPublicationIdAndPostSlugResponseAuthorsItemWalletAddressRegExp, getPostByPublicationIdAndPostSlugResponseAuthorsItemBioMax, getPostByPublicationIdAndPostSlugResponse, getPostByPublicationSlugAndPostSlugPathPublicationSlugMax, getPostByPublicationSlugAndPostSlugPathPostSlugMax, getPostByPublicationSlugAndPostSlugParams, getPostByPublicationSlugAndPostSlugQueryParams, getPostByPublicationSlugAndPostSlugResponseTitleMax, getPostByPublicationSlugAndPostSlugResponseSubtitleMax, getPostByPublicationSlugAndPostSlugResponseSlugMax, getPostByPublicationSlugAndPostSlugResponseAuthorsItemWalletAddressRegExp, getPostByPublicationSlugAndPostSlugResponseAuthorsItemBioMax, getPostByPublicationSlugAndPostSlugResponse, createPostBodyTitleMax, createPostBodySubtitleMax, createPostBodySlugMax, createPostBodyPostPreviewMax, createPostBodyScheduledAtMin, createPostBody, createPostResponse, listOwnPostsQueryLimitDefault, listOwnPostsQueryLimitMax, listOwnPostsQueryParams, listOwnPostsResponseItemsItemTitleMax, listOwnPostsResponseItemsItemSubtitleMax, listOwnPostsResponseItemsItemSlugMax, listOwnPostsResponseItemsItemAuthorsItemWalletAddressRegExp, listOwnPostsResponseItemsItemAuthorsItemBioMax, listOwnPostsResponse, updatePostBySlugPathSlugMax, updatePostBySlugParams, updatePostBySlugBodyTitleMax, updatePostBySlugBodySubtitleMax, updatePostBySlugBodySlugMax, updatePostBySlugBodyPostPreviewMax, updatePostBySlugBodyScheduledAtMin, updatePostBySlugBodyPublishedAtMin, updatePostBySlugBody, updatePostBySlugResponse, deletePostBySlugPathSlugMax, deletePostBySlugParams, deletePostBySlugBody, deletePostBySlugResponse, sendTestEmailParams, sendTestEmailBody, sendTestEmailResponse, getMeResponseSlugMax, getMeResponseSummaryMax, getMeResponse, getUserParams, getUserResponseWalletAddressRegExp, getUserResponseBioMax, getUserResponse, getUserByWalletPathWalletAddressRegExp, getUserByWalletParams, getUserByWalletResponseWalletAddressRegExp, getUserByWalletResponseBioMax, getUserByWalletResponse, getCoinParams, getCoinResponseContractAddressRegExp, getCoinResponse, getCoinByContractPathContractAddressRegExp, getCoinByContractParams, getCoinByContractResponseContractAddressRegExp, getCoinByContractResponse, getCoinHoldersByIdParams, getCoinHoldersByIdQueryLimitDefault, getCoinHoldersByIdQueryLimitMax, getCoinHoldersByIdQueryParams, getCoinHoldersByIdResponseItemsItemWalletAddressRegExp, getCoinHoldersByIdResponseItemsItemBalanceRegExp, getCoinHoldersByIdResponse, getCoinHoldersByContractPathContractAddressRegExp, getCoinHoldersByContractParams, getCoinHoldersByContractQueryLimitDefault, getCoinHoldersByContractQueryLimitMax, getCoinHoldersByContractQueryParams, getCoinHoldersByContractResponseItemsItemWalletAddressRegExp, getCoinHoldersByContractResponseItemsItemBalanceRegExp, getCoinHoldersByContractResponse, getBuyArgsByIdParams, getBuyArgsByIdQueryWalletAddressRegExp, getBuyArgsByIdQueryAmountRegExp, getBuyArgsByIdQueryParams, getBuyArgsByIdResponseCommandsRegExp, getBuyArgsByIdResponseInputsItemRegExp, getBuyArgsByIdResponse, getBuyArgsByContractPathContractAddressRegExp, getBuyArgsByContractParams, getBuyArgsByContractQueryWalletAddressRegExp, getBuyArgsByContractQueryAmountRegExp, getBuyArgsByContractQueryParams, getBuyArgsByContractResponseCommandsRegExp, getBuyArgsByContractResponseInputsItemRegExp, getBuyArgsByContractResponse, getSellArgsByIdParams, getSellArgsByIdQueryWalletAddressRegExp, getSellArgsByIdQueryAmountRegExp, getSellArgsByIdQueryParams, getSellArgsByIdResponseCommandsRegExp, getSellArgsByIdResponseInputsItemRegExp, getSellArgsByIdResponse, getSellArgsByContractPathContractAddressRegExp, getSellArgsByContractParams, getSellArgsByContractQueryWalletAddressRegExp, getSellArgsByContractQueryAmountRegExp, getSellArgsByContractQueryParams, getSellArgsByContractResponseCommandsRegExp, getSellArgsByContractResponseInputsItemRegExp, getSellArgsByContractResponse, getQuoteByIdParams, getQuoteByIdQueryAmountRegExp, getQuoteByIdQueryParams, getQuoteByIdResponse, getQuoteByContractParams, getQuoteByContractQueryAmountRegExp, getQuoteByContractQueryParams, getQuoteByContractResponse, getPopularCoinsResponseCoinsItemContractAddressRegExp, getPopularCoinsResponse, importSubscribersBody, importSubscribersResponse, addSubscriberBodyWalletRegExp, addSubscriberBody, addSubscriberResponse, removeSubscriberBodyWalletRegExp, removeSubscriberBody, removeSubscriberResponse, listSubscribersQueryLimitDefault, listSubscribersQueryLimitMax, listSubscribersQueryParams, listSubscribersResponseItemsItemWalletAddressRegExp, listSubscribersResponse, searchPostsQueryParams, searchPostsResponseItem, searchPostsResponse, searchBlogsQueryParams, searchBlogsResponseItem, searchBlogsResponse, searchCoinsQueryParams, searchCoinsResponseItem, searchCoinsResponse, analyticsQueryBody, analyticsQueryResponse, analyticsSchemaResponse, sendCustomEmailBodySubjectMax, sendCustomEmailBodyBodyMax, sendCustomEmailBodyEmailsItemMin, sendCustomEmailBodyEmailsItemMax, sendCustomEmailBodyEmailsMax, sendCustomEmailBody, sendCustomEmailResponse, createAuthSessionBodyDeviceNameMax, createAuthSessionBodyCallbackUrlMax, createAuthSessionBody, getAuthSessionParams, getAuthSessionResponse, deleteAuthSessionParams, deleteAuthSessionResponse;
|
|
6910
7189
|
var init_zod = __esm({
|
|
6911
7190
|
"node_modules/@paragraph-com/sdk/dist/zod.mjs"() {
|
|
6912
7191
|
"use strict";
|
|
@@ -6922,7 +7201,86 @@ var init_zod = __esm({
|
|
|
6922
7201
|
"slug": zod.string().min(1).max(getPublicationByIdResponseSlugMax).describe("URL-friendly identifier for the publication; accessible at paragraph.com/@[slug]"),
|
|
6923
7202
|
"customDomain": zod.string().url().optional().describe("Custom domain configured for this publication"),
|
|
6924
7203
|
"summary": zod.string().max(getPublicationByIdResponseSummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
6925
|
-
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image")
|
|
7204
|
+
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image"),
|
|
7205
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7206
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7207
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7208
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7209
|
+
"showMostPopular": zod.boolean().optional().describe("Whether the 'most popular posts' widget is shown"),
|
|
7210
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7211
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7212
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7213
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on this publication's posts"),
|
|
7214
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7215
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7216
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7217
|
+
"pinnedPostIds": zod.array(zod.string()).optional().describe("Ordered list of post IDs pinned to the top of the publication's homepage. Pinned posts render in their own section above the regular feed."),
|
|
7218
|
+
"emailNotifications": zod.object({
|
|
7219
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7220
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7221
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7222
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7223
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
7224
|
+
});
|
|
7225
|
+
updatePublicationParams = zod.object({
|
|
7226
|
+
"publicationId": zod.string().describe("Unique identifier of the publication to update")
|
|
7227
|
+
});
|
|
7228
|
+
updatePublicationBodyNameMax = 100;
|
|
7229
|
+
updatePublicationBodySummaryMax = 500;
|
|
7230
|
+
updatePublicationBodyPinnedPostIdsItemMax = 64;
|
|
7231
|
+
updatePublicationBodyPinnedPostIdsMax = 50;
|
|
7232
|
+
updatePublicationBody = zod.object({
|
|
7233
|
+
"name": zod.string().min(1).max(updatePublicationBodyNameMax).optional().describe("Display name of the publication"),
|
|
7234
|
+
"summary": zod.string().max(updatePublicationBodySummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
7235
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7236
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7237
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7238
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7239
|
+
"showMostPopular": zod.boolean().optional().describe("Whether to show the 'most popular posts' widget"),
|
|
7240
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7241
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7242
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7243
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on posts"),
|
|
7244
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7245
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7246
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7247
|
+
"pinnedPostIds": zod.array(zod.string().min(1).max(updatePublicationBodyPinnedPostIdsItemMax)).max(updatePublicationBodyPinnedPostIdsMax).optional().describe("Ordered list of post IDs to pin to the top of the homepage. Each ID must belong to this publication. Replaces the existing pinned list. Maximum 50 IDs."),
|
|
7248
|
+
"emailNotifications": zod.object({
|
|
7249
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7250
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7251
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7252
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7253
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
7254
|
+
});
|
|
7255
|
+
updatePublicationResponseSlugMax = 256;
|
|
7256
|
+
updatePublicationResponseSummaryMax = 500;
|
|
7257
|
+
updatePublicationResponse = zod.object({
|
|
7258
|
+
"id": zod.string().describe("Unique identifier for the publication"),
|
|
7259
|
+
"name": zod.string().describe("Display name of the publication"),
|
|
7260
|
+
"ownerUserId": zod.string().describe("ID of the user who owns this publication"),
|
|
7261
|
+
"slug": zod.string().min(1).max(updatePublicationResponseSlugMax).describe("URL-friendly identifier for the publication; accessible at paragraph.com/@[slug]"),
|
|
7262
|
+
"customDomain": zod.string().url().optional().describe("Custom domain configured for this publication"),
|
|
7263
|
+
"summary": zod.string().max(updatePublicationResponseSummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
7264
|
+
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image"),
|
|
7265
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7266
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7267
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7268
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7269
|
+
"showMostPopular": zod.boolean().optional().describe("Whether the 'most popular posts' widget is shown"),
|
|
7270
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7271
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7272
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7273
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on this publication's posts"),
|
|
7274
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7275
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7276
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7277
|
+
"pinnedPostIds": zod.array(zod.string()).optional().describe("Ordered list of post IDs pinned to the top of the publication's homepage. Pinned posts render in their own section above the regular feed."),
|
|
7278
|
+
"emailNotifications": zod.object({
|
|
7279
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7280
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7281
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7282
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7283
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
6926
7284
|
});
|
|
6927
7285
|
getPublicationBySlugPathSlugMax = 256;
|
|
6928
7286
|
getPublicationBySlugParams = zod.object({
|
|
@@ -6937,7 +7295,26 @@ var init_zod = __esm({
|
|
|
6937
7295
|
"slug": zod.string().min(1).max(getPublicationBySlugResponseSlugMax).describe("URL-friendly identifier for the publication; accessible at paragraph.com/@[slug]"),
|
|
6938
7296
|
"customDomain": zod.string().url().optional().describe("Custom domain configured for this publication"),
|
|
6939
7297
|
"summary": zod.string().max(getPublicationBySlugResponseSummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
6940
|
-
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image")
|
|
7298
|
+
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image"),
|
|
7299
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7300
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7301
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7302
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7303
|
+
"showMostPopular": zod.boolean().optional().describe("Whether the 'most popular posts' widget is shown"),
|
|
7304
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7305
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7306
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7307
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on this publication's posts"),
|
|
7308
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7309
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7310
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7311
|
+
"pinnedPostIds": zod.array(zod.string()).optional().describe("Ordered list of post IDs pinned to the top of the publication's homepage. Pinned posts render in their own section above the regular feed."),
|
|
7312
|
+
"emailNotifications": zod.object({
|
|
7313
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7314
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7315
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7316
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7317
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
6941
7318
|
});
|
|
6942
7319
|
getPublicationByDomainParams = zod.object({
|
|
6943
7320
|
"domain": zod.string().describe("Custom domain of the publication")
|
|
@@ -6951,7 +7328,26 @@ var init_zod = __esm({
|
|
|
6951
7328
|
"slug": zod.string().min(1).max(getPublicationByDomainResponseSlugMax).describe("URL-friendly identifier for the publication; accessible at paragraph.com/@[slug]"),
|
|
6952
7329
|
"customDomain": zod.string().url().optional().describe("Custom domain configured for this publication"),
|
|
6953
7330
|
"summary": zod.string().max(getPublicationByDomainResponseSummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
6954
|
-
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image")
|
|
7331
|
+
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image"),
|
|
7332
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7333
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7334
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7335
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7336
|
+
"showMostPopular": zod.boolean().optional().describe("Whether the 'most popular posts' widget is shown"),
|
|
7337
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7338
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7339
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7340
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on this publication's posts"),
|
|
7341
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7342
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7343
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7344
|
+
"pinnedPostIds": zod.array(zod.string()).optional().describe("Ordered list of post IDs pinned to the top of the publication's homepage. Pinned posts render in their own section above the regular feed."),
|
|
7345
|
+
"emailNotifications": zod.object({
|
|
7346
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7347
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7348
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7349
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7350
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
6955
7351
|
});
|
|
6956
7352
|
getSubscriberCountParams = zod.object({
|
|
6957
7353
|
"publicationId": zod.string().describe("Unique identifier of the publication")
|
|
@@ -7004,7 +7400,7 @@ var init_zod = __esm({
|
|
|
7004
7400
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7005
7401
|
})).optional().describe("Authors of this post"),
|
|
7006
7402
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7007
|
-
"views": zod.number().optional().describe("Total
|
|
7403
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7008
7404
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7009
7405
|
}).describe("The post content"),
|
|
7010
7406
|
"publication": zod.object({
|
|
@@ -7014,7 +7410,26 @@ var init_zod = __esm({
|
|
|
7014
7410
|
"slug": zod.string().min(1).max(getPostsFeedResponseItemsItemPublicationSlugMax).describe("URL-friendly identifier for the publication; accessible at paragraph.com/@[slug]"),
|
|
7015
7411
|
"customDomain": zod.string().url().optional().describe("Custom domain configured for this publication"),
|
|
7016
7412
|
"summary": zod.string().max(getPostsFeedResponseItemsItemPublicationSummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
7017
|
-
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image")
|
|
7413
|
+
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image"),
|
|
7414
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7415
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7416
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7417
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7418
|
+
"showMostPopular": zod.boolean().optional().describe("Whether the 'most popular posts' widget is shown"),
|
|
7419
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7420
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7421
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7422
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on this publication's posts"),
|
|
7423
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7424
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7425
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7426
|
+
"pinnedPostIds": zod.array(zod.string()).optional().describe("Ordered list of post IDs pinned to the top of the publication's homepage. Pinned posts render in their own section above the regular feed."),
|
|
7427
|
+
"emailNotifications": zod.object({
|
|
7428
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7429
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7430
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7431
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7432
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
7018
7433
|
}).describe("The publication this post belongs to"),
|
|
7019
7434
|
"user": zod.object({
|
|
7020
7435
|
"id": zod.string().describe("Unique identifier for the user"),
|
|
@@ -7079,7 +7494,7 @@ var init_zod = __esm({
|
|
|
7079
7494
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7080
7495
|
})).optional().describe("Authors of this post"),
|
|
7081
7496
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7082
|
-
"views": zod.number().optional().describe("Total
|
|
7497
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7083
7498
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7084
7499
|
})).describe("Array of items in this page"),
|
|
7085
7500
|
"pagination": zod.object({
|
|
@@ -7131,7 +7546,7 @@ var init_zod = __esm({
|
|
|
7131
7546
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7132
7547
|
})).optional().describe("Authors of this post"),
|
|
7133
7548
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7134
|
-
"views": zod.number().optional().describe("Total
|
|
7549
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7135
7550
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7136
7551
|
})).describe("Array of items in this page"),
|
|
7137
7552
|
"pagination": zod.object({
|
|
@@ -7178,7 +7593,7 @@ var init_zod = __esm({
|
|
|
7178
7593
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7179
7594
|
})).optional().describe("Authors of this post"),
|
|
7180
7595
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7181
|
-
"views": zod.number().optional().describe("Total
|
|
7596
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7182
7597
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7183
7598
|
});
|
|
7184
7599
|
updatePostParams = zod.object({
|
|
@@ -7189,6 +7604,7 @@ var init_zod = __esm({
|
|
|
7189
7604
|
updatePostBodySlugMax = 256;
|
|
7190
7605
|
updatePostBodyPostPreviewMax = 500;
|
|
7191
7606
|
updatePostBodyScheduledAtMin = 0;
|
|
7607
|
+
updatePostBodyPublishedAtMin = 0;
|
|
7192
7608
|
updatePostBody = zod.object({
|
|
7193
7609
|
"markdown": zod.string().optional().describe("Post content in Markdown format. Replaces full content \u2014 rich blocks created in the editor will be lost"),
|
|
7194
7610
|
"title": zod.string().max(updatePostBodyTitleMax).optional().describe("Title of the post"),
|
|
@@ -7198,7 +7614,8 @@ var init_zod = __esm({
|
|
|
7198
7614
|
"categories": zod.union([zod.array(zod.string()), zod.string()]).optional().describe("Category tags for the post. Can also be a comma-separated string."),
|
|
7199
7615
|
"status": zod.enum(["draft", "published", "archived"]).optional().describe("Set to 'published' to publish, 'draft' to unpublish, or 'archived' to archive"),
|
|
7200
7616
|
"scheduledAt": zod.number().min(updatePostBodyScheduledAtMin).nullish().describe("Unix timestamp (milliseconds) to schedule the post's first publish at a future time. Must be in the future and at most 30 days out. Only valid for draft posts that haven't been published or already scheduled. Cannot be combined with status: 'draft' or 'archived'. Pass null to cancel a previously scheduled publish."),
|
|
7201
|
-
"sendNewsletter": zod.union([zod.boolean(), zod.enum(["true", "false", "1", "0"])]).optional().describe("Whether to send an email newsletter to subscribers when the post publishes. Only meaningful when publishing (status: 'published') or scheduling (scheduledAt set). Default: false")
|
|
7617
|
+
"sendNewsletter": zod.union([zod.boolean(), zod.enum(["true", "false", "1", "0"])]).optional().describe("Whether to send an email newsletter to subscribers when the post publishes. Only meaningful when publishing (status: 'published') or scheduling (scheduledAt set). Default: false"),
|
|
7618
|
+
"publishedAt": zod.number().min(updatePostBodyPublishedAtMin).optional().describe("Unix timestamp (milliseconds) to set as the post's publish date. Once set, the date is preserved across re-publishes.")
|
|
7202
7619
|
});
|
|
7203
7620
|
updatePostResponse = zod.object({
|
|
7204
7621
|
"success": zod.literal(true).describe("Whether the update succeeded")
|
|
@@ -7250,7 +7667,7 @@ var init_zod = __esm({
|
|
|
7250
7667
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7251
7668
|
})).optional().describe("Authors of this post"),
|
|
7252
7669
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7253
|
-
"views": zod.number().optional().describe("Total
|
|
7670
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7254
7671
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7255
7672
|
});
|
|
7256
7673
|
getPostByPublicationSlugAndPostSlugPathPublicationSlugMax = 256;
|
|
@@ -7294,7 +7711,7 @@ var init_zod = __esm({
|
|
|
7294
7711
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7295
7712
|
})).optional().describe("Authors of this post"),
|
|
7296
7713
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7297
|
-
"views": zod.number().optional().describe("Total
|
|
7714
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7298
7715
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7299
7716
|
});
|
|
7300
7717
|
createPostBodyTitleMax = 200;
|
|
@@ -7359,7 +7776,7 @@ var init_zod = __esm({
|
|
|
7359
7776
|
}).optional().describe("Farcaster profile information, if linked")
|
|
7360
7777
|
})).optional().describe("Authors of this post"),
|
|
7361
7778
|
"authorIds": zod.array(zod.string()).optional().describe("IDs of the authors of this post"),
|
|
7362
|
-
"views": zod.number().optional().describe("Total
|
|
7779
|
+
"views": zod.number().optional().describe("Total views. Only included when fetching your own posts via GET /v1/posts"),
|
|
7363
7780
|
"status": zod.enum(["published", "draft", "scheduled", "archived"]).optional().describe("Current publish status. Only set on authenticated endpoints (listOwn, getById for your own post). Use this instead of publishedAt to determine publish state \u2014 publishedAt is preserved across unpublishing.")
|
|
7364
7781
|
})).describe("Array of items in this page"),
|
|
7365
7782
|
"pagination": zod.object({
|
|
@@ -7377,6 +7794,7 @@ var init_zod = __esm({
|
|
|
7377
7794
|
updatePostBySlugBodySlugMax = 256;
|
|
7378
7795
|
updatePostBySlugBodyPostPreviewMax = 500;
|
|
7379
7796
|
updatePostBySlugBodyScheduledAtMin = 0;
|
|
7797
|
+
updatePostBySlugBodyPublishedAtMin = 0;
|
|
7380
7798
|
updatePostBySlugBody = zod.object({
|
|
7381
7799
|
"markdown": zod.string().optional().describe("Post content in Markdown format. Replaces full content \u2014 rich blocks created in the editor will be lost"),
|
|
7382
7800
|
"title": zod.string().max(updatePostBySlugBodyTitleMax).optional().describe("Title of the post"),
|
|
@@ -7386,7 +7804,8 @@ var init_zod = __esm({
|
|
|
7386
7804
|
"categories": zod.union([zod.array(zod.string()), zod.string()]).optional().describe("Category tags for the post. Can also be a comma-separated string."),
|
|
7387
7805
|
"status": zod.enum(["draft", "published", "archived"]).optional().describe("Set to 'published' to publish, 'draft' to unpublish, or 'archived' to archive"),
|
|
7388
7806
|
"scheduledAt": zod.number().min(updatePostBySlugBodyScheduledAtMin).nullish().describe("Unix timestamp (milliseconds) to schedule the post's first publish at a future time. Must be in the future and at most 30 days out. Only valid for draft posts that haven't been published or already scheduled. Cannot be combined with status: 'draft' or 'archived'. Pass null to cancel a previously scheduled publish."),
|
|
7389
|
-
"sendNewsletter": zod.union([zod.boolean(), zod.enum(["true", "false", "1", "0"])]).optional().describe("Whether to send an email newsletter to subscribers when the post publishes. Only meaningful when publishing (status: 'published') or scheduling (scheduledAt set). Default: false")
|
|
7807
|
+
"sendNewsletter": zod.union([zod.boolean(), zod.enum(["true", "false", "1", "0"])]).optional().describe("Whether to send an email newsletter to subscribers when the post publishes. Only meaningful when publishing (status: 'published') or scheduling (scheduledAt set). Default: false"),
|
|
7808
|
+
"publishedAt": zod.number().min(updatePostBySlugBodyPublishedAtMin).optional().describe("Unix timestamp (milliseconds) to set as the post's publish date. Once set, the date is preserved across re-publishes.")
|
|
7390
7809
|
});
|
|
7391
7810
|
updatePostBySlugResponse = zod.object({
|
|
7392
7811
|
"success": zod.literal(true).describe("Whether the update succeeded")
|
|
@@ -7415,7 +7834,26 @@ var init_zod = __esm({
|
|
|
7415
7834
|
"slug": zod.string().min(1).max(getMeResponseSlugMax).describe("URL-friendly identifier for the publication; accessible at paragraph.com/@[slug]"),
|
|
7416
7835
|
"customDomain": zod.string().url().optional().describe("Custom domain configured for this publication"),
|
|
7417
7836
|
"summary": zod.string().max(getMeResponseSummaryMax).optional().describe("Brief description of the publication (max 500 characters)"),
|
|
7418
|
-
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image")
|
|
7837
|
+
"logoUrl": zod.string().url().optional().describe("URL to the publication's logo image"),
|
|
7838
|
+
"postListType": zod.enum(["feed", "grid", "full-post"]).optional().describe("Homepage layout. 'feed' is a single-column list of cards, 'grid' is a 3-column grid, 'full-post' shows full posts in a single column."),
|
|
7839
|
+
"themeColor": zod.enum(["default", "orange-500", "rose-600", "pink-500", "fuchsia-600", "purple-600", "violet-600", "indigo-600", "blue-600", "sky-600", "cyan-600", "teal-600", "emerald-600", "green-600", "lime-600", "yellow-700", "amber-600", "orange-600", "stone-800", "rose-900", "indigo-950", "teal-950", "lime-950", "orange-950"]).optional().describe("Theme accent color for the publication"),
|
|
7840
|
+
"headerFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for headers"),
|
|
7841
|
+
"bodyFont": zod.enum(["default", "serif", "mono"]).optional().describe("Font family used for body text"),
|
|
7842
|
+
"showMostPopular": zod.boolean().optional().describe("Whether the 'most popular posts' widget is shown"),
|
|
7843
|
+
"hideStats": zod.boolean().optional().describe("Whether to hide stats like subscriber count, post count, and collects"),
|
|
7844
|
+
"featuredPost": zod.string().min(1).optional().describe("Featured post selector. Use 'latest' for the most recent post, 'popular' for the most-viewed post, 'disabled' to hide the featured slot, or the ID of a specific post in this publication."),
|
|
7845
|
+
"disableComments": zod.union([zod.boolean(), zod.enum(["on-platform"])]).optional().describe("Comment visibility. true disables all comments, false enables them, 'on-platform' hides on-Paragraph comments while keeping Farcaster comments."),
|
|
7846
|
+
"disableHighlights": zod.boolean().optional().describe("Whether to disable highlights on this publication's posts"),
|
|
7847
|
+
"enableTableOfContents": zod.boolean().optional().describe("Whether the table of contents is enabled on posts"),
|
|
7848
|
+
"enableSubscribePopup": zod.boolean().optional().describe("Whether to show the subscribe popup to first-time visitors arriving from external links"),
|
|
7849
|
+
"enableSubscribeScroll": zod.boolean().optional().describe("Whether to show the subscribe popup when first-time visitors scroll a post"),
|
|
7850
|
+
"pinnedPostIds": zod.array(zod.string()).optional().describe("Ordered list of post IDs pinned to the top of the publication's homepage. Pinned posts render in their own section above the regular feed."),
|
|
7851
|
+
"emailNotifications": zod.object({
|
|
7852
|
+
"newComment": zod.boolean().optional().describe("Email the writer when someone comments on a post"),
|
|
7853
|
+
"newSubscriber": zod.boolean().optional().describe("Email the writer when a new free subscriber signs up"),
|
|
7854
|
+
"newPaidSubscriber": zod.boolean().optional().describe("Email the writer when a new paid subscriber signs up"),
|
|
7855
|
+
"newContentCollected": zod.boolean().optional().describe("Email the writer when someone collects their content")
|
|
7856
|
+
}).optional().describe("Owner-side email notification toggles")
|
|
7419
7857
|
});
|
|
7420
7858
|
getUserParams = zod.object({
|
|
7421
7859
|
"userId": zod.string().describe("Unique identifier of the user")
|
|
@@ -7711,6 +8149,14 @@ var init_zod = __esm({
|
|
|
7711
8149
|
addSubscriberResponse = zod.object({
|
|
7712
8150
|
"success": zod.literal(true).describe("Whether the subscriber was added")
|
|
7713
8151
|
});
|
|
8152
|
+
removeSubscriberBodyWalletRegExp = new RegExp("^0x[a-fA-F0-9]{40}$");
|
|
8153
|
+
removeSubscriberBody = zod.object({
|
|
8154
|
+
"email": zod.string().email().optional().describe("Email address of the subscriber to remove"),
|
|
8155
|
+
"wallet": zod.string().regex(removeSubscriberBodyWalletRegExp).optional().describe("Wallet address of the subscriber to remove (0x format)")
|
|
8156
|
+
});
|
|
8157
|
+
removeSubscriberResponse = zod.object({
|
|
8158
|
+
"success": zod.literal(true).describe("Whether the subscriber was removed")
|
|
8159
|
+
});
|
|
7714
8160
|
listSubscribersQueryLimitDefault = 10;
|
|
7715
8161
|
listSubscribersQueryLimitMax = 100;
|
|
7716
8162
|
listSubscribersQueryParams = zod.object({
|
|
@@ -7811,6 +8257,43 @@ var init_zod = __esm({
|
|
|
7811
8257
|
"activeSubscriberCount": zod.number().describe("Number of active subscribers to this publication")
|
|
7812
8258
|
});
|
|
7813
8259
|
searchCoinsResponse = zod.array(searchCoinsResponseItem);
|
|
8260
|
+
analyticsQueryBody = zod.object({
|
|
8261
|
+
"sql": zod.string().min(1).describe("A SELECT or WITH query against the analytics schema. The analytics.* prefix is implicit.")
|
|
8262
|
+
});
|
|
8263
|
+
analyticsQueryResponse = zod.object({
|
|
8264
|
+
"rows": zod.array(zod.record(zod.string(), zod.unknown())).describe("Result rows. Each row is a column-name \u2192 value map."),
|
|
8265
|
+
"rowCount": zod.number().describe("Number of rows returned (after truncation if any)"),
|
|
8266
|
+
"fields": zod.array(zod.object({
|
|
8267
|
+
"name": zod.string()
|
|
8268
|
+
})).describe("Column names in row order"),
|
|
8269
|
+
"truncated": zod.boolean().describe("True if the result was truncated at the 10,000 row limit")
|
|
8270
|
+
});
|
|
8271
|
+
analyticsSchemaResponse = zod.object({
|
|
8272
|
+
"tables": zod.array(zod.object({
|
|
8273
|
+
"table_name": zod.string(),
|
|
8274
|
+
"column_name": zod.string(),
|
|
8275
|
+
"data_type": zod.string(),
|
|
8276
|
+
"is_nullable": zod.string()
|
|
8277
|
+
})).describe("One row per column, grouped by table in ordinal order")
|
|
8278
|
+
});
|
|
8279
|
+
sendCustomEmailBodySubjectMax = 998;
|
|
8280
|
+
sendCustomEmailBodyBodyMax = 1e5;
|
|
8281
|
+
sendCustomEmailBodyEmailsItemMin = 3;
|
|
8282
|
+
sendCustomEmailBodyEmailsItemMax = 254;
|
|
8283
|
+
sendCustomEmailBodyEmailsMax = 1e4;
|
|
8284
|
+
sendCustomEmailBody = zod.object({
|
|
8285
|
+
"subject": zod.string().min(1).max(sendCustomEmailBodySubjectMax).describe("Subject line of the email"),
|
|
8286
|
+
"body": zod.string().min(1).max(sendCustomEmailBodyBodyMax).describe("Email body. Markdown; rendered to HTML server-side. Max 100KB."),
|
|
8287
|
+
"emails": zod.array(zod.string().min(sendCustomEmailBodyEmailsItemMin).max(sendCustomEmailBodyEmailsItemMax)).min(1).max(sendCustomEmailBodyEmailsMax).describe('Recipient email addresses (max 10,000). Malformed addresses are returned in `skipped` with `reason: "invalid"` rather than rejecting the whole request.'),
|
|
8288
|
+
"dryRun": zod.boolean().optional().describe("If true, run filtering and return the accepted/skipped split without scheduling delivery")
|
|
8289
|
+
});
|
|
8290
|
+
sendCustomEmailResponse = zod.object({
|
|
8291
|
+
"accepted": zod.number().describe("Number of recipients queued for delivery (or that would be queued when dryRun is true)"),
|
|
8292
|
+
"skipped": zod.array(zod.object({
|
|
8293
|
+
"email": zod.string(),
|
|
8294
|
+
"reason": zod.enum(["suppressed", "invalid", "scheduling_failed"])
|
|
8295
|
+
})).describe("Recipients that were rejected, with the reason each one was skipped. `scheduling_failed` means filtering passed but the delivery task could not be queued \u2014 retry these addresses.")
|
|
8296
|
+
});
|
|
7814
8297
|
createAuthSessionBodyDeviceNameMax = 100;
|
|
7815
8298
|
createAuthSessionBodyCallbackUrlMax = 2048;
|
|
7816
8299
|
createAuthSessionBody = zod.object({
|
|
@@ -7858,9 +8341,15 @@ async function resolvePublication(identifier, apiKey) {
|
|
|
7858
8341
|
}
|
|
7859
8342
|
return getPublication(identifier, apiKey);
|
|
7860
8343
|
}
|
|
8344
|
+
async function updatePublication(publicationId, body, apiKey) {
|
|
8345
|
+
updatePublicationBody.parse(body);
|
|
8346
|
+
const client = createClient(apiKey);
|
|
8347
|
+
return client.publications.update(publicationId, body);
|
|
8348
|
+
}
|
|
7861
8349
|
var init_publications = __esm({
|
|
7862
8350
|
"src/services/publications.ts"() {
|
|
7863
8351
|
"use strict";
|
|
8352
|
+
init_zod();
|
|
7864
8353
|
init_client();
|
|
7865
8354
|
}
|
|
7866
8355
|
});
|
|
@@ -7964,7 +8453,8 @@ async function updatePost(idOrSlug, params) {
|
|
|
7964
8453
|
title: params.title,
|
|
7965
8454
|
subtitle: params.subtitle,
|
|
7966
8455
|
markdown: params.markdown,
|
|
7967
|
-
categories: params.tags
|
|
8456
|
+
categories: params.tags,
|
|
8457
|
+
publishedAt: params.publishedAt
|
|
7968
8458
|
};
|
|
7969
8459
|
updatePostBody.parse(body);
|
|
7970
8460
|
const client = createClient(params.apiKey);
|
|
@@ -8257,29 +8747,44 @@ Examples:
|
|
|
8257
8747
|
handleError(err);
|
|
8258
8748
|
}
|
|
8259
8749
|
});
|
|
8260
|
-
const updateCmd = (parent) => parent.command("update [id-or-slug]").description("Update a post").option("--id <id-or-slug>", "Post ID or slug").option("--title <title>", "Post title").option("--text <markdown>", "Post content as markdown string").option("--file <path>", "Read post content from a file").option("--subtitle <subtitle>", "Post subtitle").option("--tags <tags>", "Comma-separated tags").addHelpText("after", `
|
|
8750
|
+
const updateCmd = (parent) => parent.command("update [id-or-slug]").description("Update a post").option("--id <id-or-slug>", "Post ID or slug").option("--title <title>", "Post title").option("--text <markdown>", "Post content as markdown string").option("--file <path>", "Read post content from a file").option("--subtitle <subtitle>", "Post subtitle").option("--tags <tags>", "Comma-separated tags").option("--published-at <time>", "Set the post's display publish date (ISO 8601 or Unix ms). Sticks across re-publishes \u2014 useful for backdating.").addHelpText("after", `
|
|
8261
8751
|
Examples:
|
|
8262
8752
|
$ paragraph post update my-post --title "New Title"
|
|
8263
8753
|
$ paragraph post update --id my-post --title "New Title"
|
|
8264
8754
|
$ paragraph post update my-post --file ./updated.md
|
|
8265
8755
|
$ cat updated.md | paragraph post update my-post
|
|
8266
|
-
$ paragraph post update my-post --tags "web3,defi" --json
|
|
8756
|
+
$ paragraph post update my-post --tags "web3,defi" --json
|
|
8757
|
+
$ paragraph post update my-post --published-at "2024-01-01T00:00:00Z"`).action(async function(idOrSlug, opts) {
|
|
8267
8758
|
try {
|
|
8268
8759
|
const id = requireArg(idOrSlug, opts.id, "post ID or slug");
|
|
8269
8760
|
const apiKey = requireApiKey();
|
|
8270
8761
|
const markdown = await resolveMarkdown(opts);
|
|
8271
|
-
|
|
8272
|
-
|
|
8762
|
+
const publishedAt = opts.publishedAt ? parseScheduleTime(opts.publishedAt) : void 0;
|
|
8763
|
+
if (!opts.title && !opts.subtitle && !markdown && !opts.tags && publishedAt === void 0) {
|
|
8764
|
+
throw new Error(
|
|
8765
|
+
"Nothing to update. Provide --title, --subtitle, --text, --file, --tags, or --published-at."
|
|
8766
|
+
);
|
|
8273
8767
|
}
|
|
8274
8768
|
await updatePost(id, {
|
|
8275
8769
|
apiKey,
|
|
8276
8770
|
title: opts.title,
|
|
8277
8771
|
markdown,
|
|
8278
8772
|
subtitle: opts.subtitle,
|
|
8279
|
-
tags: opts.tags?.split(",").map((t) => t.trim())
|
|
8773
|
+
tags: opts.tags?.split(",").map((t) => t.trim()),
|
|
8774
|
+
publishedAt
|
|
8280
8775
|
});
|
|
8281
8776
|
writeSuccess(`Post updated: ${id}`);
|
|
8282
|
-
outputData(
|
|
8777
|
+
outputData(
|
|
8778
|
+
this,
|
|
8779
|
+
{ ID: id },
|
|
8780
|
+
{
|
|
8781
|
+
id,
|
|
8782
|
+
updated: true,
|
|
8783
|
+
title: opts.title,
|
|
8784
|
+
subtitle: opts.subtitle,
|
|
8785
|
+
publishedAt
|
|
8786
|
+
}
|
|
8787
|
+
);
|
|
8283
8788
|
} catch (err) {
|
|
8284
8789
|
handleError(err);
|
|
8285
8790
|
}
|
|
@@ -8532,6 +9037,7 @@ var init_post = __esm({
|
|
|
8532
9037
|
});
|
|
8533
9038
|
|
|
8534
9039
|
// src/cli/commands/publication.ts
|
|
9040
|
+
import * as fs3 from "fs";
|
|
8535
9041
|
function registerPublicationCommands(program2) {
|
|
8536
9042
|
const publication = program2.command("publication").description("Manage publications");
|
|
8537
9043
|
publication.command("get [identifier]").description("Get publication details by ID, slug, or domain").option("--id <identifier>", "Publication ID, slug, or domain").addHelpText("after", `
|
|
@@ -8556,6 +9062,106 @@ Examples:
|
|
|
8556
9062
|
handleError(err);
|
|
8557
9063
|
}
|
|
8558
9064
|
});
|
|
9065
|
+
publication.command("update [publication-id]").description("Update publication settings (only provided fields are changed)").option("--id <id>", "Publication ID").option("--from-json <file>", "Read the full update body from a JSON file (merged with explicit flags; flags win)").option("--name <name>", "Display name").option("--summary <summary>", "Brief description (max 500 chars)").option("--theme-color <color>", "Theme accent color (e.g. 'purple-600', 'default')").option("--header-font <font>", "Header font: default | serif | mono").option("--body-font <font>", "Body font: default | serif | mono").option("--post-list-type <type>", "Homepage layout: feed | grid | full-post").option("--featured-post <selector>", "Post ID, or 'latest' | 'popular' | 'disabled'").option("--pinned-post-ids <ids>", "Comma-separated post IDs to pin (max 50, replaces existing list)").option("--disable-comments <value>", "Comment visibility: true | false | on-platform").option(
|
|
9066
|
+
"--email-notifications <pairs>",
|
|
9067
|
+
"Owner email toggles as key=value,... (keys: newComment, newSubscriber, newPaidSubscriber, newContentCollected)"
|
|
9068
|
+
).addHelpText("after", `
|
|
9069
|
+
Examples:
|
|
9070
|
+
$ paragraph publication update abc123 --name "My Blog" --theme-color purple-600
|
|
9071
|
+
$ paragraph publication update abc123 --featured-post latest
|
|
9072
|
+
$ paragraph publication update abc123 --pinned-post-ids id1,id2,id3
|
|
9073
|
+
$ paragraph publication update abc123 --disable-comments on-platform
|
|
9074
|
+
$ paragraph publication update abc123 --email-notifications newSubscriber=true,newComment=false
|
|
9075
|
+
$ paragraph publication update abc123 --from-json ./settings.json
|
|
9076
|
+
$ paragraph publication update abc123 --from-json ./base.json --name "Override Name"`).action(async function(positionalId, opts) {
|
|
9077
|
+
try {
|
|
9078
|
+
const id = requireArg(positionalId, opts.id, "publication ID");
|
|
9079
|
+
const apiKey = requireApiKey();
|
|
9080
|
+
const body = {};
|
|
9081
|
+
if (opts.fromJson) {
|
|
9082
|
+
if (!fs3.existsSync(opts.fromJson)) {
|
|
9083
|
+
throw new Error(`File not found: "${opts.fromJson}".`);
|
|
9084
|
+
}
|
|
9085
|
+
const parsed = JSON.parse(fs3.readFileSync(opts.fromJson, "utf-8"));
|
|
9086
|
+
Object.assign(body, parsed);
|
|
9087
|
+
}
|
|
9088
|
+
if (opts.name !== void 0) body.name = opts.name;
|
|
9089
|
+
if (opts.summary !== void 0) body.summary = opts.summary;
|
|
9090
|
+
if (opts.themeColor !== void 0)
|
|
9091
|
+
body.themeColor = opts.themeColor;
|
|
9092
|
+
if (opts.headerFont !== void 0)
|
|
9093
|
+
body.headerFont = opts.headerFont;
|
|
9094
|
+
if (opts.bodyFont !== void 0) body.bodyFont = opts.bodyFont;
|
|
9095
|
+
if (opts.postListType !== void 0)
|
|
9096
|
+
body.postListType = opts.postListType;
|
|
9097
|
+
if (opts.featuredPost !== void 0)
|
|
9098
|
+
body.featuredPost = opts.featuredPost;
|
|
9099
|
+
if (opts.pinnedPostIds !== void 0) {
|
|
9100
|
+
const ids = opts.pinnedPostIds.split(",").map((s) => s.trim()).filter(Boolean);
|
|
9101
|
+
if (ids.length > 50) {
|
|
9102
|
+
throw new Error(
|
|
9103
|
+
`--pinned-post-ids accepts at most 50 IDs (got ${ids.length}).`
|
|
9104
|
+
);
|
|
9105
|
+
}
|
|
9106
|
+
body.pinnedPostIds = ids;
|
|
9107
|
+
}
|
|
9108
|
+
if (opts.disableComments !== void 0) {
|
|
9109
|
+
const v = opts.disableComments;
|
|
9110
|
+
if (v === "true") body.disableComments = true;
|
|
9111
|
+
else if (v === "false") body.disableComments = false;
|
|
9112
|
+
else if (v === "on-platform") body.disableComments = "on-platform";
|
|
9113
|
+
else
|
|
9114
|
+
throw new Error(
|
|
9115
|
+
`--disable-comments must be 'true', 'false', or 'on-platform' (got "${v}").`
|
|
9116
|
+
);
|
|
9117
|
+
}
|
|
9118
|
+
if (opts.emailNotifications !== void 0) {
|
|
9119
|
+
const pairs = opts.emailNotifications.split(",").map((s) => s.trim()).filter(Boolean);
|
|
9120
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
9121
|
+
"newComment",
|
|
9122
|
+
"newSubscriber",
|
|
9123
|
+
"newPaidSubscriber",
|
|
9124
|
+
"newContentCollected"
|
|
9125
|
+
]);
|
|
9126
|
+
const out = {};
|
|
9127
|
+
for (const pair of pairs) {
|
|
9128
|
+
const [key, value] = pair.split("=");
|
|
9129
|
+
if (!allowed.has(key)) {
|
|
9130
|
+
throw new Error(
|
|
9131
|
+
`--email-notifications: unknown key "${key}". Allowed: newComment, newSubscriber, newPaidSubscriber, newContentCollected.`
|
|
9132
|
+
);
|
|
9133
|
+
}
|
|
9134
|
+
if (value !== "true" && value !== "false") {
|
|
9135
|
+
throw new Error(
|
|
9136
|
+
`--email-notifications: value for "${key}" must be 'true' or 'false' (got "${value}").`
|
|
9137
|
+
);
|
|
9138
|
+
}
|
|
9139
|
+
out[key] = value === "true";
|
|
9140
|
+
}
|
|
9141
|
+
body.emailNotifications = out;
|
|
9142
|
+
}
|
|
9143
|
+
if (Object.keys(body).length === 0) {
|
|
9144
|
+
throw new Error(
|
|
9145
|
+
"Nothing to update. Provide at least one field flag, or pass --from-json <file>."
|
|
9146
|
+
);
|
|
9147
|
+
}
|
|
9148
|
+
const updated = await updatePublication(id, body, apiKey);
|
|
9149
|
+
writeSuccess(`Publication updated: ${updated.name}`);
|
|
9150
|
+
outputData(
|
|
9151
|
+
this,
|
|
9152
|
+
{
|
|
9153
|
+
ID: updated.id,
|
|
9154
|
+
Name: updated.name,
|
|
9155
|
+
Slug: updated.slug,
|
|
9156
|
+
Theme: updated.themeColor,
|
|
9157
|
+
"Pinned posts": updated.pinnedPostIds?.length ?? 0
|
|
9158
|
+
},
|
|
9159
|
+
updated
|
|
9160
|
+
);
|
|
9161
|
+
} catch (err) {
|
|
9162
|
+
handleError(err);
|
|
9163
|
+
}
|
|
9164
|
+
});
|
|
8559
9165
|
}
|
|
8560
9166
|
var init_publication = __esm({
|
|
8561
9167
|
"src/cli/commands/publication.ts"() {
|
|
@@ -8638,7 +9244,7 @@ var init_search2 = __esm({
|
|
|
8638
9244
|
});
|
|
8639
9245
|
|
|
8640
9246
|
// src/services/subscribers.ts
|
|
8641
|
-
import * as
|
|
9247
|
+
import * as fs4 from "fs";
|
|
8642
9248
|
async function listSubscribers(apiKey, pagination) {
|
|
8643
9249
|
const client = createClient(apiKey);
|
|
8644
9250
|
const result = await client.subscribers.get(
|
|
@@ -8667,9 +9273,14 @@ async function addSubscriber(params, apiKey) {
|
|
|
8667
9273
|
const client = createClient(apiKey);
|
|
8668
9274
|
await client.subscribers.create(params);
|
|
8669
9275
|
}
|
|
9276
|
+
async function removeSubscriber(params, apiKey) {
|
|
9277
|
+
removeSubscriberBody.parse(params);
|
|
9278
|
+
const client = createClient(apiKey);
|
|
9279
|
+
await client.subscribers.remove(params);
|
|
9280
|
+
}
|
|
8670
9281
|
async function importSubscribers(csvPath, apiKey) {
|
|
8671
9282
|
const client = createClient(apiKey);
|
|
8672
|
-
const csvContent =
|
|
9283
|
+
const csvContent = fs4.readFileSync(csvPath, "utf-8");
|
|
8673
9284
|
const file = new Blob([csvContent], { type: "text/csv" });
|
|
8674
9285
|
await client.subscribers.importCsv({ file });
|
|
8675
9286
|
}
|
|
@@ -8755,6 +9366,41 @@ Examples:
|
|
|
8755
9366
|
handleError(err);
|
|
8756
9367
|
}
|
|
8757
9368
|
});
|
|
9369
|
+
subscriber.command("remove").description("Remove a subscriber by email or wallet address (hard delete, irreversible)").option("--email <email>", "Subscriber email address").option("--wallet <address>", "Subscriber wallet address (0x format)").option("--yes", "Skip confirmation prompt").addHelpText("after", `
|
|
9370
|
+
Examples:
|
|
9371
|
+
$ paragraph subscriber remove --email user@example.com
|
|
9372
|
+
$ paragraph subscriber remove --wallet 0x1234...abcd
|
|
9373
|
+
$ paragraph subscriber remove --email user@example.com --yes
|
|
9374
|
+
$ paragraph subscriber remove --email user@example.com --json --yes`).action(async function(opts) {
|
|
9375
|
+
try {
|
|
9376
|
+
if (!opts.email && !opts.wallet) {
|
|
9377
|
+
throw new Error("Provide --email or --wallet (or both).");
|
|
9378
|
+
}
|
|
9379
|
+
const apiKey = requireApiKey();
|
|
9380
|
+
const target = opts.email || opts.wallet;
|
|
9381
|
+
if (!opts.yes) {
|
|
9382
|
+
const ok = await confirm(
|
|
9383
|
+
`Permanently remove subscriber ${target}? This cannot be undone.`
|
|
9384
|
+
);
|
|
9385
|
+
if (!ok) {
|
|
9386
|
+
writeInfo("Cancelled.");
|
|
9387
|
+
return;
|
|
9388
|
+
}
|
|
9389
|
+
}
|
|
9390
|
+
await removeSubscriber(
|
|
9391
|
+
{ email: opts.email, wallet: opts.wallet },
|
|
9392
|
+
apiKey
|
|
9393
|
+
);
|
|
9394
|
+
writeSuccess(`Subscriber removed: ${target}`);
|
|
9395
|
+
outputData(
|
|
9396
|
+
this,
|
|
9397
|
+
{ Email: opts.email, Wallet: opts.wallet },
|
|
9398
|
+
{ email: opts.email, wallet: opts.wallet, removed: true }
|
|
9399
|
+
);
|
|
9400
|
+
} catch (err) {
|
|
9401
|
+
handleError(err);
|
|
9402
|
+
}
|
|
9403
|
+
});
|
|
8758
9404
|
subscriber.command("import").description("Import subscribers from a CSV file").requiredOption("--csv <file>", "Path to CSV file").addHelpText("after", `
|
|
8759
9405
|
Examples:
|
|
8760
9406
|
$ paragraph subscriber import --csv ./subscribers.csv
|
|
@@ -8776,6 +9422,7 @@ var init_subscriber = __esm({
|
|
|
8776
9422
|
init_subscribers();
|
|
8777
9423
|
init_output();
|
|
8778
9424
|
init_error();
|
|
9425
|
+
init_prompt();
|
|
8779
9426
|
init_args();
|
|
8780
9427
|
}
|
|
8781
9428
|
});
|
|
@@ -8995,10 +9642,251 @@ var init_user = __esm({
|
|
|
8995
9642
|
}
|
|
8996
9643
|
});
|
|
8997
9644
|
|
|
9645
|
+
// src/services/analytics.ts
|
|
9646
|
+
async function runQuery(sql, apiKey) {
|
|
9647
|
+
const client = createClient(apiKey);
|
|
9648
|
+
return client.analytics.query({ sql });
|
|
9649
|
+
}
|
|
9650
|
+
async function getSchema(apiKey) {
|
|
9651
|
+
const client = createClient(apiKey);
|
|
9652
|
+
return client.analytics.schema();
|
|
9653
|
+
}
|
|
9654
|
+
var init_analytics = __esm({
|
|
9655
|
+
"src/services/analytics.ts"() {
|
|
9656
|
+
"use strict";
|
|
9657
|
+
init_client();
|
|
9658
|
+
}
|
|
9659
|
+
});
|
|
9660
|
+
|
|
9661
|
+
// src/cli/commands/analytics.ts
|
|
9662
|
+
import * as fs5 from "fs";
|
|
9663
|
+
async function resolveSql(opts) {
|
|
9664
|
+
if (opts.sql) return opts.sql;
|
|
9665
|
+
if (opts.file) {
|
|
9666
|
+
if (!fs5.existsSync(opts.file)) {
|
|
9667
|
+
throw new Error(`File not found: "${opts.file}".`);
|
|
9668
|
+
}
|
|
9669
|
+
return fs5.readFileSync(opts.file, "utf-8");
|
|
9670
|
+
}
|
|
9671
|
+
const stdin = await readStdin();
|
|
9672
|
+
return stdin || void 0;
|
|
9673
|
+
}
|
|
9674
|
+
function registerAnalyticsCommands(program2) {
|
|
9675
|
+
const cmd = program2.command("analytics").description("Query your publication's analytics data");
|
|
9676
|
+
cmd.command("query").description("Run a read-only SQL query against the analytics schema").option("--sql <sql>", "SQL string (SELECT or WITH only)").option("--file <path>", "Read SQL from a file").addHelpText("after", `
|
|
9677
|
+
Examples:
|
|
9678
|
+
$ paragraph analytics query --sql "SELECT * FROM blog_subscriber_counts"
|
|
9679
|
+
$ paragraph analytics query --file ./query.sql
|
|
9680
|
+
$ paragraph analytics query --file ./query.sql --json
|
|
9681
|
+
$ echo "SELECT title, total_views FROM post_analytics_summary ORDER BY total_views DESC LIMIT 5" | paragraph analytics query`).action(async function(opts) {
|
|
9682
|
+
try {
|
|
9683
|
+
const sql = await resolveSql(opts);
|
|
9684
|
+
if (!sql) {
|
|
9685
|
+
throw new Error(
|
|
9686
|
+
"Provide SQL via --sql, --file, or pipe to stdin."
|
|
9687
|
+
);
|
|
9688
|
+
}
|
|
9689
|
+
const apiKey = requireApiKey();
|
|
9690
|
+
const result = await runQuery(sql, apiKey);
|
|
9691
|
+
if (isJsonMode(this)) {
|
|
9692
|
+
outputData(this, {}, result);
|
|
9693
|
+
return;
|
|
9694
|
+
}
|
|
9695
|
+
if (result.rows.length === 0) {
|
|
9696
|
+
writeInfo("No rows.");
|
|
9697
|
+
return;
|
|
9698
|
+
}
|
|
9699
|
+
const headers = result.fields.map((f) => f.name);
|
|
9700
|
+
const rows = result.rows.map(
|
|
9701
|
+
(r) => headers.map((h) => {
|
|
9702
|
+
const v = r[h];
|
|
9703
|
+
if (v === null || v === void 0) return "";
|
|
9704
|
+
if (typeof v === "object") return JSON.stringify(v);
|
|
9705
|
+
return String(v);
|
|
9706
|
+
})
|
|
9707
|
+
);
|
|
9708
|
+
outputTable(this, headers, rows, result.rows);
|
|
9709
|
+
const summary = `${result.rowCount} row${result.rowCount === 1 ? "" : "s"}${result.truncated ? " (truncated at 10,000)" : ""}`;
|
|
9710
|
+
writeInfo(summary);
|
|
9711
|
+
} catch (err) {
|
|
9712
|
+
handleError(err);
|
|
9713
|
+
}
|
|
9714
|
+
});
|
|
9715
|
+
cmd.command("schema").description("List all tables and columns in the analytics schema").option("--table <name>", "Filter to columns of a single table").addHelpText("after", `
|
|
9716
|
+
Examples:
|
|
9717
|
+
$ paragraph analytics schema
|
|
9718
|
+
$ paragraph analytics schema --table post_analytics_summary
|
|
9719
|
+
$ paragraph analytics schema --json`).action(async function(opts) {
|
|
9720
|
+
try {
|
|
9721
|
+
const apiKey = requireApiKey();
|
|
9722
|
+
const result = await getSchema(apiKey);
|
|
9723
|
+
const items8 = opts.table ? result.tables.filter((c) => c.table_name === opts.table) : result.tables;
|
|
9724
|
+
if (opts.table && items8.length === 0) {
|
|
9725
|
+
throw new Error(
|
|
9726
|
+
`No table named "${opts.table}". Run \`paragraph analytics schema\` to list available tables.`
|
|
9727
|
+
);
|
|
9728
|
+
}
|
|
9729
|
+
outputTable(
|
|
9730
|
+
this,
|
|
9731
|
+
["Table", "Column", "Type", "Nullable"],
|
|
9732
|
+
items8.map((c) => [
|
|
9733
|
+
c.table_name,
|
|
9734
|
+
c.column_name,
|
|
9735
|
+
c.data_type,
|
|
9736
|
+
c.is_nullable
|
|
9737
|
+
]),
|
|
9738
|
+
items8
|
|
9739
|
+
);
|
|
9740
|
+
} catch (err) {
|
|
9741
|
+
handleError(err);
|
|
9742
|
+
}
|
|
9743
|
+
});
|
|
9744
|
+
}
|
|
9745
|
+
var init_analytics2 = __esm({
|
|
9746
|
+
"src/cli/commands/analytics.ts"() {
|
|
9747
|
+
"use strict";
|
|
9748
|
+
init_auth();
|
|
9749
|
+
init_analytics();
|
|
9750
|
+
init_stdin();
|
|
9751
|
+
init_output();
|
|
9752
|
+
init_error();
|
|
9753
|
+
}
|
|
9754
|
+
});
|
|
9755
|
+
|
|
9756
|
+
// src/services/emails.ts
|
|
9757
|
+
async function sendCustomEmail(params) {
|
|
9758
|
+
const client = createClient(params.apiKey);
|
|
9759
|
+
return client.emails.send({
|
|
9760
|
+
subject: params.subject,
|
|
9761
|
+
body: params.body,
|
|
9762
|
+
emails: params.emails,
|
|
9763
|
+
...params.dryRun ? { dryRun: true } : {}
|
|
9764
|
+
});
|
|
9765
|
+
}
|
|
9766
|
+
var init_emails = __esm({
|
|
9767
|
+
"src/services/emails.ts"() {
|
|
9768
|
+
"use strict";
|
|
9769
|
+
init_client();
|
|
9770
|
+
}
|
|
9771
|
+
});
|
|
9772
|
+
|
|
9773
|
+
// src/cli/commands/email.ts
|
|
9774
|
+
import * as fs6 from "fs";
|
|
9775
|
+
async function resolveBody(opts) {
|
|
9776
|
+
if (opts.body) return opts.body;
|
|
9777
|
+
if (opts.bodyFile) {
|
|
9778
|
+
if (!fs6.existsSync(opts.bodyFile)) {
|
|
9779
|
+
throw new Error(
|
|
9780
|
+
`File not found: "${opts.bodyFile}". Check the path, or use --body <markdown> to pass content inline.`
|
|
9781
|
+
);
|
|
9782
|
+
}
|
|
9783
|
+
return fs6.readFileSync(opts.bodyFile, "utf-8");
|
|
9784
|
+
}
|
|
9785
|
+
const stdin = await readStdin();
|
|
9786
|
+
return stdin || void 0;
|
|
9787
|
+
}
|
|
9788
|
+
function collectRecipients(value, previous) {
|
|
9789
|
+
const parts = value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
9790
|
+
return previous.concat(parts);
|
|
9791
|
+
}
|
|
9792
|
+
function registerEmailCommands(program2) {
|
|
9793
|
+
const email = program2.command("email").description("Send custom emails from your publication");
|
|
9794
|
+
email.command("send").description("Send a custom markdown email to a list of recipients").requiredOption("--subject <subject>", "Email subject").option("--body <markdown>", "Email body as markdown string").option("--body-file <path>", "Read email body from a file").option(
|
|
9795
|
+
"--to <emails>",
|
|
9796
|
+
"Recipient email (repeatable, or comma-separated)",
|
|
9797
|
+
collectRecipients,
|
|
9798
|
+
[]
|
|
9799
|
+
).option(
|
|
9800
|
+
"--dry-run",
|
|
9801
|
+
"Run filtering and show the accepted/skipped split without sending"
|
|
9802
|
+
).option("--yes", "Skip the confirmation prompt before sending").addHelpText(
|
|
9803
|
+
"after",
|
|
9804
|
+
`
|
|
9805
|
+
Examples:
|
|
9806
|
+
$ paragraph email send --subject "Hello" --body "# Hi" --to reader@example.com
|
|
9807
|
+
$ paragraph email send --subject "Update" --body-file ./body.md --to a@x.com --to b@x.com
|
|
9808
|
+
$ paragraph email send --subject "Update" --body-file ./body.md --to "a@x.com,b@x.com"
|
|
9809
|
+
$ cat body.md | paragraph email send --subject "Update" --to reader@example.com
|
|
9810
|
+
$ paragraph email send --subject "Update" --body "# Hi" --to a@x.com --dry-run`
|
|
9811
|
+
).action(async function(opts) {
|
|
9812
|
+
try {
|
|
9813
|
+
const apiKey = requireApiKey();
|
|
9814
|
+
const body = await resolveBody(opts);
|
|
9815
|
+
if (!body) {
|
|
9816
|
+
throw new Error(
|
|
9817
|
+
"Provide email body via --body, --body-file, or pipe to stdin."
|
|
9818
|
+
);
|
|
9819
|
+
}
|
|
9820
|
+
const recipients = opts.to;
|
|
9821
|
+
if (recipients.length === 0) {
|
|
9822
|
+
throw new Error(
|
|
9823
|
+
"Provide at least one recipient via --to <email>. Repeat the flag or pass a comma-separated list."
|
|
9824
|
+
);
|
|
9825
|
+
}
|
|
9826
|
+
if (!opts.dryRun && !opts.yes) {
|
|
9827
|
+
if (!process.stdin.isTTY) {
|
|
9828
|
+
throw new Error(
|
|
9829
|
+
"Cannot confirm send in non-interactive mode. Use --yes to confirm, or --dry-run to preview."
|
|
9830
|
+
);
|
|
9831
|
+
}
|
|
9832
|
+
const ok = await confirm(
|
|
9833
|
+
`Send "${opts.subject}" to ${recipients.length} recipient${recipients.length === 1 ? "" : "s"}?`
|
|
9834
|
+
);
|
|
9835
|
+
if (!ok) {
|
|
9836
|
+
process.stderr.write("Aborted.\n");
|
|
9837
|
+
process.exit(1);
|
|
9838
|
+
}
|
|
9839
|
+
}
|
|
9840
|
+
const result = await sendCustomEmail({
|
|
9841
|
+
apiKey,
|
|
9842
|
+
subject: opts.subject,
|
|
9843
|
+
body,
|
|
9844
|
+
emails: recipients,
|
|
9845
|
+
dryRun: opts.dryRun
|
|
9846
|
+
});
|
|
9847
|
+
const action = opts.dryRun ? "Dry run" : "Email queued";
|
|
9848
|
+
writeSuccess(
|
|
9849
|
+
`${action}: ${result.accepted} accepted, ${result.skipped.length} skipped`
|
|
9850
|
+
);
|
|
9851
|
+
if (result.skipped.length > 0) {
|
|
9852
|
+
writeInfo("Skipped recipients:");
|
|
9853
|
+
for (const s of result.skipped) {
|
|
9854
|
+
process.stderr.write(` ${s.email} \u2014 ${s.reason}
|
|
9855
|
+
`);
|
|
9856
|
+
}
|
|
9857
|
+
}
|
|
9858
|
+
outputData(
|
|
9859
|
+
this,
|
|
9860
|
+
{
|
|
9861
|
+
Subject: opts.subject,
|
|
9862
|
+
Recipients: recipients.length,
|
|
9863
|
+
Accepted: result.accepted,
|
|
9864
|
+
Skipped: result.skipped.length,
|
|
9865
|
+
DryRun: opts.dryRun ? "yes" : "no"
|
|
9866
|
+
},
|
|
9867
|
+
{ ...result, dryRun: !!opts.dryRun }
|
|
9868
|
+
);
|
|
9869
|
+
} catch (err) {
|
|
9870
|
+
handleError(err);
|
|
9871
|
+
}
|
|
9872
|
+
});
|
|
9873
|
+
}
|
|
9874
|
+
var init_email = __esm({
|
|
9875
|
+
"src/cli/commands/email.ts"() {
|
|
9876
|
+
"use strict";
|
|
9877
|
+
init_auth();
|
|
9878
|
+
init_emails();
|
|
9879
|
+
init_output();
|
|
9880
|
+
init_error();
|
|
9881
|
+
init_stdin();
|
|
9882
|
+
init_prompt();
|
|
9883
|
+
}
|
|
9884
|
+
});
|
|
9885
|
+
|
|
8998
9886
|
// src/cli/program.ts
|
|
8999
9887
|
function createProgram() {
|
|
9000
9888
|
const program2 = new Command();
|
|
9001
|
-
program2.name("paragraph").description("CLI for Paragraph").version("0.
|
|
9889
|
+
program2.name("paragraph").description("CLI for Paragraph").version("0.3.0", "-v, --version").option("--json", "Output as JSON").option("--verbose", "Show detailed output for debugging").exitOverride().configureOutput({
|
|
9002
9890
|
writeOut: (str) => process.stdout.write(str),
|
|
9003
9891
|
writeErr: (str) => {
|
|
9004
9892
|
if (process.argv.includes("--json")) {
|
|
@@ -9017,6 +9905,8 @@ function createProgram() {
|
|
|
9017
9905
|
registerSubscriberCommands(program2);
|
|
9018
9906
|
registerCoinCommands(program2);
|
|
9019
9907
|
registerUserCommands(program2);
|
|
9908
|
+
registerAnalyticsCommands(program2);
|
|
9909
|
+
registerEmailCommands(program2);
|
|
9020
9910
|
return program2;
|
|
9021
9911
|
}
|
|
9022
9912
|
var init_program = __esm({
|
|
@@ -9030,6 +9920,8 @@ var init_program = __esm({
|
|
|
9030
9920
|
init_subscriber();
|
|
9031
9921
|
init_coin();
|
|
9032
9922
|
init_user();
|
|
9923
|
+
init_analytics2();
|
|
9924
|
+
init_email();
|
|
9033
9925
|
}
|
|
9034
9926
|
});
|
|
9035
9927
|
|
|
@@ -10283,7 +11175,7 @@ import { useState as useState9 } from "react";
|
|
|
10283
11175
|
import { Box as Box21, Text as Text14, useInput as useInput17 } from "ink";
|
|
10284
11176
|
import { TextInput as TextInput5, Spinner as Spinner9 } from "@inkjs/ui";
|
|
10285
11177
|
import { StatusMessage as StatusMessage9 } from "@inkjs/ui";
|
|
10286
|
-
import * as
|
|
11178
|
+
import * as fs7 from "fs";
|
|
10287
11179
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
10288
11180
|
function PostCreate() {
|
|
10289
11181
|
const { goBack } = useNavigation();
|
|
@@ -10305,7 +11197,7 @@ function PostCreate() {
|
|
|
10305
11197
|
try {
|
|
10306
11198
|
let markdown = "";
|
|
10307
11199
|
if (filePath) {
|
|
10308
|
-
markdown =
|
|
11200
|
+
markdown = fs7.readFileSync(filePath, "utf-8");
|
|
10309
11201
|
} else {
|
|
10310
11202
|
throw new Error("A file path is required for post content.");
|
|
10311
11203
|
}
|
|
@@ -10431,7 +11323,7 @@ import { useState as useState10 } from "react";
|
|
|
10431
11323
|
import { Box as Box22, Text as Text15, useInput as useInput18 } from "ink";
|
|
10432
11324
|
import { TextInput as TextInput6, Spinner as Spinner10 } from "@inkjs/ui";
|
|
10433
11325
|
import { StatusMessage as StatusMessage10 } from "@inkjs/ui";
|
|
10434
|
-
import * as
|
|
11326
|
+
import * as fs8 from "fs";
|
|
10435
11327
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
10436
11328
|
function PostUpdate() {
|
|
10437
11329
|
const { goBack, screen } = useNavigation();
|
|
@@ -10452,7 +11344,7 @@ function PostUpdate() {
|
|
|
10452
11344
|
setStep("updating");
|
|
10453
11345
|
try {
|
|
10454
11346
|
let markdown;
|
|
10455
|
-
if (filePath) markdown =
|
|
11347
|
+
if (filePath) markdown = fs8.readFileSync(filePath, "utf-8");
|
|
10456
11348
|
await updatePost(idOrSlug, {
|
|
10457
11349
|
apiKey,
|
|
10458
11350
|
title: title || void 0,
|