@happyvertical/smrt-social 0.30.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.
Files changed (47) hide show
  1. package/AGENTS.md +18 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +94 -0
  5. package/dist/__smrt-register__.d.ts +2 -0
  6. package/dist/__smrt-register__.d.ts.map +1 -0
  7. package/dist/collections/index.d.ts +5 -0
  8. package/dist/collections/index.d.ts.map +1 -0
  9. package/dist/collections/oauth-state-collection.d.ts +9 -0
  10. package/dist/collections/oauth-state-collection.d.ts.map +1 -0
  11. package/dist/collections/social-account-collection.d.ts +9 -0
  12. package/dist/collections/social-account-collection.d.ts.map +1 -0
  13. package/dist/collections/social-post-analytics-snapshot-collection.d.ts +18 -0
  14. package/dist/collections/social-post-analytics-snapshot-collection.d.ts.map +1 -0
  15. package/dist/collections/social-post-collection.d.ts +32 -0
  16. package/dist/collections/social-post-collection.d.ts.map +1 -0
  17. package/dist/index.d.ts +6 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +824 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/manifest.json +3363 -0
  22. package/dist/oauth-state.d.ts +127 -0
  23. package/dist/oauth-state.d.ts.map +1 -0
  24. package/dist/server.d.ts +18 -0
  25. package/dist/server.d.ts.map +1 -0
  26. package/dist/server.js +106 -0
  27. package/dist/server.js.map +1 -0
  28. package/dist/smrt-knowledge.json +1398 -0
  29. package/dist/social-account.d.ts +270 -0
  30. package/dist/social-account.d.ts.map +1 -0
  31. package/dist/social-post-analytics-snapshot.d.ts +40 -0
  32. package/dist/social-post-analytics-snapshot.d.ts.map +1 -0
  33. package/dist/social-post.d.ts +258 -0
  34. package/dist/social-post.d.ts.map +1 -0
  35. package/dist/svelte/components/SocialAccountSettings.svelte +243 -0
  36. package/dist/svelte/components/SocialAccountSettings.svelte.d.ts +15 -0
  37. package/dist/svelte/components/SocialAccountSettings.svelte.d.ts.map +1 -0
  38. package/dist/svelte/i18n.d.ts +9 -0
  39. package/dist/svelte/i18n.d.ts.map +1 -0
  40. package/dist/svelte/i18n.js +15 -0
  41. package/dist/svelte/index.d.ts +6 -0
  42. package/dist/svelte/index.d.ts.map +1 -0
  43. package/dist/svelte/index.js +2 -0
  44. package/dist/svelte/types.d.ts +16 -0
  45. package/dist/svelte/types.d.ts.map +1 -0
  46. package/dist/svelte/types.js +1 -0
  47. package/package.json +88 -0
@@ -0,0 +1,270 @@
1
+ import { SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core';
2
+ /**
3
+ * Supported social platforms
4
+ */
5
+ export type SocialPlatformType = 'youtube' | 'threads' | 'x' | 'bluesky' | 'facebook';
6
+ /**
7
+ * Account connection status
8
+ */
9
+ export type AccountStatus = 'connected' | 'disconnected' | 'expired' | 'missing_permissions' | 'error';
10
+ /**
11
+ * Link behavior for posts with links
12
+ */
13
+ export type LinkBehavior = 'description' | 'inline' | 'attachment' | 'reply' | 'none';
14
+ /**
15
+ * Controls how far publish operations are allowed to go.
16
+ */
17
+ export type PublishMode = 'dry_run' | 'stage_remote' | 'private_or_scheduled' | 'public';
18
+ /**
19
+ * Social account creation options
20
+ */
21
+ export interface SocialAccountOptions extends SmrtObjectOptions {
22
+ /**
23
+ * Human-readable name for the account
24
+ */
25
+ name?: string;
26
+ /**
27
+ * Social platform type
28
+ */
29
+ platform?: SocialPlatformType;
30
+ /**
31
+ * Platform-specific user ID
32
+ */
33
+ platformUserId?: string | null;
34
+ /**
35
+ * Platform username/handle
36
+ */
37
+ platformUsername?: string | null;
38
+ /**
39
+ * Profile URL on the platform
40
+ */
41
+ platformUrl?: string | null;
42
+ /**
43
+ * Deprecated raw OAuth access token
44
+ */
45
+ accessToken?: string | null;
46
+ /**
47
+ * Deprecated raw OAuth refresh token
48
+ */
49
+ refreshToken?: string | null;
50
+ /**
51
+ * Secret name containing the full platform credential payload
52
+ */
53
+ credentialSecretId?: string | null;
54
+ /**
55
+ * Secret name containing the OAuth access token
56
+ */
57
+ accessTokenSecretName?: string | null;
58
+ /**
59
+ * Secret name containing the OAuth refresh token
60
+ */
61
+ refreshTokenSecretName?: string | null;
62
+ /**
63
+ * Token expiration time
64
+ */
65
+ tokenExpiresAt?: Date | null;
66
+ /**
67
+ * Whether the account is active
68
+ * @default true
69
+ */
70
+ isActive?: boolean;
71
+ /**
72
+ * Default hashtags to add to posts
73
+ */
74
+ defaultHashtags?: string[];
75
+ /**
76
+ * Granted OAuth scopes or platform permissions
77
+ */
78
+ scopes?: string[];
79
+ /**
80
+ * Required permissions that still need approval/granting
81
+ */
82
+ missingPermissions?: string[];
83
+ /**
84
+ * How to handle links in posts
85
+ * @default 'description'
86
+ */
87
+ linkBehavior?: LinkBehavior;
88
+ /**
89
+ * Safety mode for publish operations.
90
+ * @default 'dry_run'
91
+ */
92
+ publishMode?: PublishMode;
93
+ /**
94
+ * Separate latch required before public publishing can happen.
95
+ * @default false
96
+ */
97
+ publicPublishingAllowed?: boolean;
98
+ /**
99
+ * Account connection status
100
+ * @default 'connected'
101
+ */
102
+ status?: AccountStatus;
103
+ /**
104
+ * Error message if status is 'error'
105
+ */
106
+ errorMessage?: string | null;
107
+ /**
108
+ * Tenant ID for multi-tenant isolation
109
+ */
110
+ tenantId?: string | null;
111
+ }
112
+ /**
113
+ * Connected social media account for publishing
114
+ *
115
+ * SocialAccount represents a connected social platform account
116
+ * with OAuth credentials and publishing settings. Accounts can
117
+ * be used to publish content to multiple platforms.
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * import { SocialAccount } from '@happyvertical/smrt-social';
122
+ *
123
+ * const account = new SocialAccount({
124
+ * name: 'Bentley News YouTube',
125
+ * platform: 'youtube',
126
+ * platformUserId: 'UC...',
127
+ * platformUsername: 'Bentley News',
128
+ * accessToken: '...encrypted...',
129
+ * refreshToken: '...encrypted...',
130
+ * tokenExpiresAt: new Date('2026-02-25'),
131
+ * defaultHashtags: ['news', 'local', 'bentley'],
132
+ * linkBehavior: 'description',
133
+ * });
134
+ * await account.save();
135
+ * ```
136
+ */
137
+ export declare class SocialAccount extends SmrtObject {
138
+ /**
139
+ * Tenant ID for multi-tenant isolation
140
+ */
141
+ tenantId: string | null;
142
+ /**
143
+ * Human-readable name for the account
144
+ */
145
+ name: string;
146
+ /**
147
+ * Social platform type
148
+ */
149
+ platform: SocialPlatformType;
150
+ /**
151
+ * Platform-specific user ID
152
+ */
153
+ platformUserId: string | null;
154
+ /**
155
+ * Platform username/handle
156
+ */
157
+ platformUsername: string | null;
158
+ /**
159
+ * Profile URL on the platform
160
+ */
161
+ platformUrl: string | null;
162
+ /**
163
+ * Deprecated raw OAuth access token.
164
+ * Prefer credentialSecretId/accessTokenSecretName.
165
+ */
166
+ accessToken: string | null;
167
+ /**
168
+ * Deprecated raw OAuth refresh token.
169
+ * Prefer credentialSecretId/refreshTokenSecretName.
170
+ */
171
+ refreshToken: string | null;
172
+ /**
173
+ * Secret name containing the complete platform credential payload.
174
+ */
175
+ credentialSecretId: string | null;
176
+ /**
177
+ * Secret name containing only the access token.
178
+ */
179
+ accessTokenSecretName: string | null;
180
+ /**
181
+ * Secret name containing only the refresh token.
182
+ */
183
+ refreshTokenSecretName: string | null;
184
+ /**
185
+ * Token expiration time
186
+ */
187
+ tokenExpiresAt: Date | null;
188
+ /**
189
+ * Whether the account is active
190
+ */
191
+ isActive: boolean;
192
+ /**
193
+ * Default hashtags to add to posts
194
+ */
195
+ defaultHashtags: string[];
196
+ /**
197
+ * Granted OAuth scopes or platform permissions.
198
+ */
199
+ scopes: string[];
200
+ /**
201
+ * Required permissions that still need app review or user grant.
202
+ */
203
+ missingPermissions: string[];
204
+ /**
205
+ * How to handle links in posts
206
+ * - description: Include link in post body/description
207
+ * - reply: Post link as a reply (better for X algorithm)
208
+ * - none: Don't include link
209
+ */
210
+ linkBehavior: LinkBehavior;
211
+ /**
212
+ * Safety mode for publish operations.
213
+ */
214
+ publishMode: PublishMode;
215
+ /**
216
+ * Separate latch required before public publishing is allowed.
217
+ */
218
+ publicPublishingAllowed: boolean;
219
+ /**
220
+ * Account connection status
221
+ */
222
+ status: AccountStatus;
223
+ /**
224
+ * Error message if status is 'error'
225
+ */
226
+ errorMessage: string | null;
227
+ constructor(options?: SocialAccountOptions);
228
+ /**
229
+ * Social accounts need a slug identity that is scoped by tenant and platform.
230
+ * A newsroom may connect `@localnews` on X, YouTube, Threads, and Facebook;
231
+ * the generic name-derived slug would make those accounts overwrite each
232
+ * other through SMRT's slug/context upsert identity.
233
+ */
234
+ getSlug(): Promise<string | null | undefined>;
235
+ /**
236
+ * Check if the token is expired or will expire soon
237
+ */
238
+ get isTokenExpired(): boolean;
239
+ /**
240
+ * Check if the account needs attention (expired or error)
241
+ */
242
+ get needsAttention(): boolean;
243
+ /**
244
+ * Check if the account is ready for publishing
245
+ */
246
+ get isReady(): boolean;
247
+ /**
248
+ * Effective publish mode after applying the public-publishing latch.
249
+ */
250
+ get effectivePublishMode(): PublishMode;
251
+ /**
252
+ * Check whether any usable credential reference exists.
253
+ */
254
+ get hasCredentials(): boolean;
255
+ /**
256
+ * Store all platform credentials in smrt-secrets as a single JSON payload.
257
+ */
258
+ setCredentials(credentials: Record<string, unknown>, options?: {
259
+ description?: string;
260
+ category?: string;
261
+ }): Promise<void>;
262
+ /**
263
+ * Retrieve platform credentials from smrt-secrets, falling back to deprecated fields.
264
+ */
265
+ getCredentials(): Promise<Record<string, unknown> | null>;
266
+ private withCredentialTenantContext;
267
+ private getCredentialTenantId;
268
+ private requireCredentialTenantId;
269
+ }
270
+ //# sourceMappingURL=social-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-account.d.ts","sourceRoot":"","sources":["../src/social-account.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAU5D;;GAEG;AACH,MAAM,MA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CAAM;IAE/B;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAM;IAEtB;;OAEG;IACH,kBAAkB,EAAE,MAAM,EAAE,CAAM;IAElC;;;;;OAKG;IACH,YAAY,EAAE,YAAY,CAAiB;IAE3C;;OAEG;IACH,WAAW,EAAE,WAAW,CAAa;IAErC;;OAEG;IACH,uBAAuB,EAAE,OAAO,CAAS;IAEzC;;OAEG;IACH,MAAM,EAAE,aAAa,CAAe;IAEpC;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;gBAEvB,OAAO,GAAE,oBAAyB;IAmD9C;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAyBnD;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAK5B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAO5B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CASrB;IAED;;OAEG;IACH,IAAI,oBAAoB,IAAI,WAAW,CAKtC;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,OAAO,CAI5B;IAED;;OAEG;IACG,cAAc,CAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,GAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACd,GACL,OAAO,CAAC,IAAI,CAAC;IA4BhB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;YA+CjD,2BAA2B;IAazC,OAAO,CAAC,qBAAqB;IAQ7B,OAAO,CAAC,yBAAyB;CAOlC"}
@@ -0,0 +1,40 @@
1
+ import { SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core';
2
+ import { SocialPlatformType } from './social-account.js';
3
+ import { PostAnalytics } from './social-post.js';
4
+ export type RawAnalyticsPayload = Record<string, unknown> | unknown[] | null;
5
+ export interface SocialPostAnalyticsSnapshotOptions extends SmrtObjectOptions {
6
+ /**
7
+ * Tenant ID for multi-tenant isolation
8
+ */
9
+ tenantId?: string | null;
10
+ /**
11
+ * Social post being measured
12
+ */
13
+ socialPostId?: string | null;
14
+ /**
15
+ * Platform that produced this snapshot
16
+ */
17
+ platform?: SocialPlatformType | null;
18
+ /**
19
+ * Normalized platform analytics.
20
+ */
21
+ analytics?: PostAnalytics;
22
+ /**
23
+ * Raw platform payload
24
+ */
25
+ raw?: RawAnalyticsPayload;
26
+ /**
27
+ * When the platform data was captured
28
+ */
29
+ capturedAt?: Date;
30
+ }
31
+ export declare class SocialPostAnalyticsSnapshot extends SmrtObject {
32
+ tenantId: string | null;
33
+ socialPostId: string | null;
34
+ platform: SocialPlatformType | null;
35
+ analytics: PostAnalytics;
36
+ raw: RawAnalyticsPayload;
37
+ capturedAt: Date;
38
+ constructor(options?: SocialPostAnalyticsSnapshotOptions);
39
+ }
40
+ //# sourceMappingURL=social-post-analytics-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-post-analytics-snapshot.d.ts","sourceRoot":"","sources":["../src/social-post-analytics-snapshot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAqB,UAAU,EAAQ,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;AAE7E,MAAM,WAAW,kCAAmC,SAAQ,iBAAiB;IAC3E;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAErC;;OAEG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAE1B;;OAEG;IACH,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,qBAWa,2BAA4B,SAAQ,UAAU;IAEzD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAG/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IAGnC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAQ;IAE3C,SAAS,EAAE,aAAa,CAAM;IAG9B,GAAG,EAAE,mBAAmB,CAAQ;IAEhC,UAAU,EAAE,IAAI,CAAc;gBAElB,OAAO,GAAE,kCAAuC;CAW7D"}
@@ -0,0 +1,258 @@
1
+ import { SmrtObjectOptions, SmrtObject } from '@happyvertical/smrt-core';
2
+ /**
3
+ * Post status
4
+ */
5
+ export type PostStatus = 'draft' | 'pending_approval' | 'approved' | 'scheduled' | 'publishing' | 'dry_run' | 'staged' | 'published' | 'failed' | 'cancelled';
6
+ /**
7
+ * Social post type
8
+ */
9
+ export type SocialPostType = 'text' | 'link' | 'image' | 'video';
10
+ /**
11
+ * Post analytics
12
+ */
13
+ export interface PostAnalytics {
14
+ /**
15
+ * View/impression count
16
+ */
17
+ views?: number;
18
+ /**
19
+ * Impression count when the platform distinguishes it from views
20
+ */
21
+ impressions?: number;
22
+ /**
23
+ * Like/favorite count
24
+ */
25
+ likes?: number;
26
+ /**
27
+ * Comment count
28
+ */
29
+ comments?: number;
30
+ /**
31
+ * Share/repost count
32
+ */
33
+ shares?: number;
34
+ /**
35
+ * Link click count
36
+ */
37
+ clicks?: number;
38
+ /**
39
+ * Raw platform analytics payload
40
+ */
41
+ raw?: unknown;
42
+ /**
43
+ * When analytics were last updated
44
+ */
45
+ lastUpdated?: Date;
46
+ }
47
+ /**
48
+ * Social post creation options
49
+ */
50
+ export interface SocialPostOptions extends SmrtObjectOptions {
51
+ /**
52
+ * Social account to publish to
53
+ */
54
+ socialAccountId?: string | null;
55
+ /**
56
+ * Video content to publish
57
+ */
58
+ videoContentId?: string | null;
59
+ /**
60
+ * Generic content ID (for non-video content)
61
+ */
62
+ contentId?: string | null;
63
+ /**
64
+ * High-level post type
65
+ */
66
+ postType?: SocialPostType;
67
+ /**
68
+ * Public media URL for platforms that cannot upload buffers
69
+ */
70
+ mediaUrl?: string | null;
71
+ /**
72
+ * Post title (for platforms that support it)
73
+ */
74
+ title?: string | null;
75
+ /**
76
+ * Post description/caption
77
+ */
78
+ description?: string;
79
+ /**
80
+ * Hashtags to include
81
+ */
82
+ hashtags?: string[];
83
+ /**
84
+ * Link URL to include
85
+ */
86
+ linkUrl?: string | null;
87
+ /**
88
+ * Platform-specific post ID (after publishing)
89
+ */
90
+ platformPostId?: string | null;
91
+ /**
92
+ * Public post URL (after publishing)
93
+ */
94
+ platformUrl?: string | null;
95
+ /**
96
+ * Scheduled publish time
97
+ */
98
+ scheduledAt?: Date | null;
99
+ /**
100
+ * Actual publish time
101
+ */
102
+ publishedAt?: Date | null;
103
+ /**
104
+ * Post status
105
+ * @default 'draft'
106
+ */
107
+ status?: PostStatus;
108
+ /**
109
+ * Error message if status is 'failed'
110
+ */
111
+ errorMessage?: string | null;
112
+ /**
113
+ * Engagement analytics
114
+ */
115
+ analytics?: PostAnalytics;
116
+ /**
117
+ * When analytics were last synced
118
+ */
119
+ analyticsLastSyncedAt?: Date | null;
120
+ /**
121
+ * Tenant ID for multi-tenant isolation
122
+ */
123
+ tenantId?: string | null;
124
+ }
125
+ /**
126
+ * Social media post for multi-platform publishing
127
+ *
128
+ * SocialPost represents a post published or scheduled to a social
129
+ * platform. It tracks publishing status and engagement analytics,
130
+ * and can reference VideoContent for video posts.
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * import { SocialPost } from '@happyvertical/smrt-social';
135
+ *
136
+ * const post = new SocialPost({
137
+ * socialAccountId: 'account-123',
138
+ * videoContentId: 'video-456',
139
+ * title: 'Breaking News from Bentley',
140
+ * description: 'Latest updates from the town council meeting.',
141
+ * hashtags: ['news', 'local', 'bentley'],
142
+ * linkUrl: 'https://example.com/article',
143
+ * scheduledAt: new Date('2026-01-26T18:00:00Z'),
144
+ * });
145
+ * await post.save();
146
+ * ```
147
+ */
148
+ export declare class SocialPost extends SmrtObject {
149
+ /**
150
+ * Tenant ID for multi-tenant isolation
151
+ */
152
+ tenantId: string | null;
153
+ /**
154
+ * Social account to publish to
155
+ */
156
+ socialAccountId: string | null;
157
+ /**
158
+ * Video content to publish
159
+ */
160
+ videoContentId: string | null;
161
+ /**
162
+ * Generic content ID (for non-video content)
163
+ */
164
+ contentId: string | null;
165
+ /**
166
+ * High-level post type
167
+ */
168
+ postType: SocialPostType;
169
+ /**
170
+ * Public media URL for platforms that require URL media publishing
171
+ */
172
+ mediaUrl: string | null;
173
+ /**
174
+ * Post title (for platforms that support it)
175
+ */
176
+ title: string | null;
177
+ /**
178
+ * Post description/caption
179
+ */
180
+ description: string;
181
+ /**
182
+ * Hashtags to include
183
+ */
184
+ hashtags: string[];
185
+ /**
186
+ * Link URL to include in the post
187
+ */
188
+ linkUrl: string | null;
189
+ /**
190
+ * Platform-specific post ID (set after publishing)
191
+ */
192
+ platformPostId: string | null;
193
+ /**
194
+ * Public post URL (set after publishing)
195
+ */
196
+ platformUrl: string | null;
197
+ /**
198
+ * Scheduled publish time
199
+ * If set, post will be scheduled instead of published immediately
200
+ */
201
+ scheduledAt: Date | null;
202
+ /**
203
+ * Actual publish time
204
+ */
205
+ publishedAt: Date | null;
206
+ /**
207
+ * Post status
208
+ * - draft: Not yet submitted for publishing
209
+ * - pending_approval: Awaiting editorial approval
210
+ * - approved: Approved and ready to publish
211
+ * - scheduled: Queued for future publishing
212
+ * - publishing: Currently being published
213
+ * - dry_run: Payload was validated without remote write
214
+ * - staged: Non-public platform object/container was created
215
+ * - published: Successfully published
216
+ * - failed: Publishing failed
217
+ * - cancelled: Publishing was cancelled
218
+ */
219
+ status: PostStatus;
220
+ /**
221
+ * Error message if status is 'failed'
222
+ */
223
+ errorMessage: string | null;
224
+ /**
225
+ * Engagement analytics
226
+ */
227
+ analytics: PostAnalytics;
228
+ /**
229
+ * When analytics were last synced
230
+ */
231
+ analyticsLastSyncedAt: Date | null;
232
+ constructor(options?: SocialPostOptions);
233
+ /**
234
+ * Check if the post is scheduled for future publishing
235
+ */
236
+ get isScheduled(): boolean;
237
+ /**
238
+ * Check if the post has been published
239
+ */
240
+ get isPublished(): boolean;
241
+ /**
242
+ * Check if the post can be edited (draft or failed)
243
+ */
244
+ get isEditable(): boolean;
245
+ /**
246
+ * Check if the post is due for publishing now.
247
+ */
248
+ get isDueForPublish(): boolean;
249
+ /**
250
+ * Get formatted hashtag string
251
+ */
252
+ get hashtagString(): string;
253
+ /**
254
+ * Get the full post text with hashtags
255
+ */
256
+ get fullText(): string;
257
+ }
258
+ //# sourceMappingURL=social-post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social-post.d.ts","sourceRoot":"","sources":["../src/social-post.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAGL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAKlC;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,kBAAkB,GAClB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC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