@happyvertical/garrula 0.1.6 → 0.1.8

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/Garrula.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Agent, AgentAdminRoute, AgentOptions, AgentUISlots } from '@happyvertical/smrt-agents';
2
2
  import { GarrulaConfig } from './config.js';
3
3
  import { OutboundStores } from './outbound/service.js';
4
- import { CreateDraftInput, CreateDraftResult, DraftClaim, DraftingAI, IngestResult, OutboundDraft, OutboundPostKind, OutboundSettings, OutboundSettingsPatch, OutboundState, PublishDueResult, SourceEvent, SpendSummary } from './outbound/types.js';
4
+ import { AttachMediaInput, CreateDraftInput, CreateDraftResult, DraftClaim, DraftingAI, IngestResult, OutboundDraft, OutboundPostKind, OutboundSettings, OutboundSettingsPatch, OutboundState, PublishDueResult, SourceEvent, SpendSummary } from './outbound/types.js';
5
5
  import { AnalyticsSyncResult, ArticleVideoPostRequest, GarrulaCollections, GarrulaHost, GarrulaSocialPost, PublishPostOptions, PublishPostResult, SocialFactory, StoryLinkPostRequest } from './types.js';
6
6
  export interface GarrulaOptions extends AgentOptions {
7
7
  collections?: GarrulaCollections;
@@ -97,6 +97,10 @@ export declare class Garrula extends Agent {
97
97
  }, options?: {
98
98
  tenantId?: string;
99
99
  }): Promise<OutboundDraft>;
100
+ /** Attach video/image media (and optional variants/YouTube metadata). Withdraws approval. */
101
+ attachMedia(id: string, media: AttachMediaInput, options?: {
102
+ tenantId?: string;
103
+ }): Promise<OutboundDraft>;
100
104
  approve(id: string, options?: {
101
105
  tenantId?: string;
102
106
  approvedBy?: string;
@@ -213,6 +217,13 @@ export declare class Garrula extends Agent {
213
217
  private resolveRequestTenantId;
214
218
  private normalizeTenantId;
215
219
  private getPostAccount;
220
+ /**
221
+ * Renew an account whose recorded expiry has passed, as publishing would:
222
+ * refresh the access token when it is due and save the new token set, which
223
+ * clears the lapsed expiry on a refreshable OAuth 2 account. Throws when the
224
+ * account has no credentials, cannot refresh, or the refresh fails.
225
+ */
226
+ private renewLapsedAccount;
216
227
  /**
217
228
  * Build the account's adapter with a usable access token. A token that is
218
229
  * expired or close to it (or of unknown age) is refreshed first and the new
@@ -232,8 +243,8 @@ export declare class Garrula extends Agent {
232
243
  * Save a refreshed token set on the account (encrypted, tenant-scoped).
233
244
  * `tokenExpiresAt` on the account means "the connection lapses then", so it
234
245
  * is cleared for refreshable OAuth 2 tokens and moved forward for Threads.
235
- * A failed save is logged and the fresh token is still used for this
236
- * publish.
246
+ * A failed save is logged, the account's in-memory state is restored, and
247
+ * the fresh token is still used for this publish.
237
248
  */
238
249
  private saveRefreshedCredentials;
239
250
  /**
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { Garrula, GARRULA_ACCOUNT_INACTIVE_MESSAGE, GARRULA_POST_BUSY_MESSAGE, GARRULA_TENANT_BLOCKED_MESSAGE, setGarrulaConfig, setGarrulaHost, type GarrulaOptions, } from './Garrula.js';
2
- export type { AnalyticsSyncResult, ArticleVideoPostRequest, GarrulaCollections, GarrulaHost, GarrulaListOptions, GarrulaPostAnalytics, GarrulaPostType, GarrulaSocialAccount, GarrulaSocialAdapter, GarrulaSocialConfig, GarrulaSocialPost, GarrulaTargetPlatform, GarrulaClaimDatabase, PublishPostOptions, PublishPostResult, SocialFactory, StoryLinkPostRequest, } from './types.js';
3
- export { DEFAULT_GARRULA_CONFIG, resolveGarrulaConfig, type GarrulaConfig, } from './config.js';
1
+ export { DEFAULT_GARRULA_CONFIG, type GarrulaConfig, resolveGarrulaConfig, } from './config.js';
4
2
  export { GarrulaReconnectError, reconnectMessage } from './credentials.js';
3
+ export { GARRULA_ACCOUNT_INACTIVE_MESSAGE, GARRULA_POST_BUSY_MESSAGE, GARRULA_TENANT_BLOCKED_MESSAGE, Garrula, type GarrulaOptions, setGarrulaConfig, setGarrulaHost, } from './Garrula.js';
5
4
  export { GarrulaOutboundPost, GarrulaOutboundPostCollection, GarrulaOutboundSettings, GarrulaOutboundSettingsCollection, GarrulaSourceEvent, GarrulaSourceEventCollection, GarrulaSpendEntry, GarrulaSpendEntryCollection, } from './outbound/models.js';
6
5
  export { DEFAULT_OUTBOUND_RATES, FALLBACK_X_RATES, type PlatformRates, } from './outbound/rates.js';
7
6
  export { createOutboundStores, OutboundService, type OutboundStores } from './outbound/service.js';
8
7
  export { DEFAULT_AUTONOMY, DEFAULT_SOURCE_RULES } from './outbound/sources.js';
9
- export { OUTBOUND_TRANSITIONS, canTransition } from './outbound/state.js';
10
- export { type AutonomyMode, type ClaimEvidence, type CreateDraftInput, type CreateDraftResult, type DraftClaim, type DraftingAI, type IngestResult, type LinkPolicy, type OutboundDraft, type OutboundPostKind, type OutboundRefusal, type OutboundRefusalCode, type OutboundSourceKind, OutboundError, type OutboundSettings, type OutboundSettingsPatch, type OutboundState, type PublishDueResult, type SourceEvent, type SourceEventKind, type SourceRule, type SpendEntryView, type SpendSummary, } from './outbound/types.js';
8
+ export { canTransition, OUTBOUND_TRANSITIONS } from './outbound/state.js';
9
+ export { type AttachMediaInput, type AutonomyMode, type ClaimEvidence, type CreateDraftInput, type CreateDraftResult, type DraftClaim, type DraftingAI, type IngestResult, type LinkPolicy, type MediaVariant, type OutboundDraft, OutboundError, type OutboundMedia, type OutboundPostKind, type OutboundRefusal, type OutboundRefusalCode, type OutboundSettings, type OutboundSettingsPatch, type OutboundSourceKind, type OutboundState, type PublishDueResult, type SourceEvent, type SourceEventKind, type SourceRule, type SpendEntryView, type SpendSummary, type VideoAspectRatio, X_REPOST_MODES, type XRepostMode, YOUTUBE_MAX_DESCRIPTION_LENGTH, YOUTUBE_MAX_TITLE_LENGTH, type YouTubeVideoMetadata, } from './outbound/types.js';
10
+ export type { AnalyticsSyncResult, ArticleVideoPostRequest, GarrulaClaimDatabase, GarrulaCollections, GarrulaHost, GarrulaListOptions, GarrulaPostAnalytics, GarrulaPostType, GarrulaSocialAccount, GarrulaSocialAdapter, GarrulaSocialConfig, GarrulaSocialPost, GarrulaTargetPlatform, PublishPostOptions, PublishPostResult, SocialFactory, StoryLinkPostRequest, } from './types.js';