@growth-labs/cms 0.1.3 → 0.2.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/src/index.ts CHANGED
@@ -56,6 +56,9 @@ export {
56
56
  type ContentContributorRow,
57
57
  type ContentImportRow,
58
58
  type ContentItemRow,
59
+ type ContentPublicationAttemptRow,
60
+ type ContentPublicationAttemptState,
61
+ type ContentPublicationOperation,
59
62
  type ContentRelationRow,
60
63
  type ContentRevisionRow,
61
64
  type ContentSlugRedirectRow,
@@ -25,6 +25,9 @@ export type {
25
25
  ContentContributorRow,
26
26
  ContentImportRow,
27
27
  ContentItemRow,
28
+ ContentPublicationAttemptRow,
29
+ ContentPublicationAttemptState,
30
+ ContentPublicationOperation,
28
31
  ContentRelationRow,
29
32
  ContentRevisionRow,
30
33
  ContentSlugRedirectRow,
@@ -713,6 +713,34 @@ CREATE INDEX IF NOT EXISTS idx_content_items_topic_status_type_published
713
713
  ON content_items(primary_topic, status, type, published_at DESC);
714
714
  CREATE INDEX IF NOT EXISTS idx_content_items_published_at ON content_items(published_at DESC);
715
715
  CREATE INDEX IF NOT EXISTS idx_content_items_deleted_at ON content_items(deleted_at);
716
+ `,
717
+ },
718
+ {
719
+ id: '0018_content_publication_attempts',
720
+ sql: `
721
+ CREATE TABLE content_publication_attempts (
722
+ id TEXT PRIMARY KEY,
723
+ operation TEXT NOT NULL CHECK (operation IN ('publish','rollback')),
724
+ content_id TEXT NOT NULL,
725
+ revision_id TEXT NOT NULL,
726
+ previous_revision_id TEXT,
727
+ state TEXT NOT NULL CHECK (state IN ('preparing','prepared','committing','pending_retry','committed','superseded','aborting','aborted','abort_failed')),
728
+ surface_names_json TEXT NOT NULL DEFAULT '[]',
729
+ pending_surface_names_json TEXT NOT NULL DEFAULT '[]',
730
+ prepared_surface_names_json TEXT NOT NULL DEFAULT '[]',
731
+ receipts_json TEXT NOT NULL DEFAULT '[]',
732
+ version INTEGER NOT NULL DEFAULT 0 CHECK (version >= 0),
733
+ package_version TEXT,
734
+ last_error TEXT,
735
+ created_at INTEGER NOT NULL DEFAULT (unixepoch()),
736
+ updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
737
+ FOREIGN KEY (content_id) REFERENCES content_items(id) ON DELETE CASCADE,
738
+ FOREIGN KEY (revision_id) REFERENCES content_revisions(id) ON DELETE CASCADE
739
+ );
740
+ CREATE INDEX idx_content_publication_attempts_recovery
741
+ ON content_publication_attempts(state, updated_at);
742
+ CREATE INDEX idx_content_publication_attempts_content
743
+ ON content_publication_attempts(content_id, created_at DESC);
716
744
  `,
717
745
  },
718
746
  ]
@@ -22,6 +22,7 @@ export const CMS_TABLES = [
22
22
  'foundry_callback_events',
23
23
  'content_contributors',
24
24
  'content_slug_redirects',
25
+ 'content_publication_attempts',
25
26
  // Masthead platform tables (migrations 0008–0011)
26
27
  'workspace_settings',
27
28
  'masthead_users',
@@ -536,6 +536,37 @@ export interface ContentInsightDismissalRow {
536
536
  dismissed_by: string | null
537
537
  }
538
538
 
539
+ export type ContentPublicationOperation = 'publish' | 'rollback'
540
+ export type ContentPublicationAttemptState =
541
+ | 'preparing'
542
+ | 'prepared'
543
+ | 'committing'
544
+ | 'pending_retry'
545
+ | 'committed'
546
+ | 'superseded'
547
+ | 'aborting'
548
+ | 'aborted'
549
+ | 'abort_failed'
550
+
551
+ /** Durable publication outbox row. JSON columns are decoded by the publication engine. */
552
+ export interface ContentPublicationAttemptRow {
553
+ id: string
554
+ operation: ContentPublicationOperation
555
+ content_id: string
556
+ revision_id: string
557
+ previous_revision_id: string | null
558
+ state: ContentPublicationAttemptState
559
+ surface_names_json: string
560
+ pending_surface_names_json: string
561
+ prepared_surface_names_json: string
562
+ receipts_json: string
563
+ version: number
564
+ package_version: string | null
565
+ last_error: string | null
566
+ created_at: number
567
+ updated_at: number
568
+ }
569
+
539
570
  /**
540
571
  * Schema version for the intent_key derivation. Bump ONLY on a breaking change
541
572
  * to the canonical-cluster-id semantics; bumping rotates every intent_key (and