@byline/db-mysql 4.14.0 → 4.15.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/database/schema/index.d.ts +575 -0
- package/dist/database/schema/index.js +81 -1
- package/dist/database/schema/schema-pins.test.node.js +45 -0
- package/dist/index.js +3 -0
- package/dist/modules/scheduler/scheduler-store.d.ts +13 -0
- package/dist/modules/scheduler/scheduler-store.js +237 -0
- package/dist/modules/storage/publish-schedules.d.ts +85 -0
- package/dist/modules/storage/publish-schedules.js +406 -0
- package/dist/modules/storage/storage-commands.d.ts +2 -0
- package/dist/modules/storage/storage-commands.js +3 -0
- package/dist/modules/storage/storage-queries.d.ts +2 -0
- package/dist/modules/storage/storage-queries.js +3 -0
- package/package.json +5 -5
|
@@ -485,6 +485,319 @@ export declare const documentVersions: import("drizzle-orm/mysql-core").MySqlTab
|
|
|
485
485
|
};
|
|
486
486
|
dialect: 'mysql';
|
|
487
487
|
}>;
|
|
488
|
+
export declare const documentPublishSchedules: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
489
|
+
name: "byline_document_publish_schedules";
|
|
490
|
+
schema: undefined;
|
|
491
|
+
columns: {
|
|
492
|
+
document_id: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
493
|
+
name: "document_id";
|
|
494
|
+
tableName: "byline_document_publish_schedules";
|
|
495
|
+
dataType: "custom";
|
|
496
|
+
columnType: "MySqlCustomColumn";
|
|
497
|
+
data: string;
|
|
498
|
+
driverParam: string;
|
|
499
|
+
notNull: true;
|
|
500
|
+
hasDefault: false;
|
|
501
|
+
isPrimaryKey: true;
|
|
502
|
+
isAutoincrement: false;
|
|
503
|
+
hasRuntimeDefault: false;
|
|
504
|
+
enumValues: undefined;
|
|
505
|
+
baseColumn: never;
|
|
506
|
+
identity: undefined;
|
|
507
|
+
generated: undefined;
|
|
508
|
+
}, {}, {}>;
|
|
509
|
+
collection_id: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
510
|
+
name: "collection_id";
|
|
511
|
+
tableName: "byline_document_publish_schedules";
|
|
512
|
+
dataType: "custom";
|
|
513
|
+
columnType: "MySqlCustomColumn";
|
|
514
|
+
data: string;
|
|
515
|
+
driverParam: string;
|
|
516
|
+
notNull: true;
|
|
517
|
+
hasDefault: false;
|
|
518
|
+
isPrimaryKey: false;
|
|
519
|
+
isAutoincrement: false;
|
|
520
|
+
hasRuntimeDefault: false;
|
|
521
|
+
enumValues: undefined;
|
|
522
|
+
baseColumn: never;
|
|
523
|
+
identity: undefined;
|
|
524
|
+
generated: undefined;
|
|
525
|
+
}, {}, {}>;
|
|
526
|
+
target_version_id: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
527
|
+
name: "target_version_id";
|
|
528
|
+
tableName: "byline_document_publish_schedules";
|
|
529
|
+
dataType: "custom";
|
|
530
|
+
columnType: "MySqlCustomColumn";
|
|
531
|
+
data: string;
|
|
532
|
+
driverParam: string;
|
|
533
|
+
notNull: true;
|
|
534
|
+
hasDefault: false;
|
|
535
|
+
isPrimaryKey: false;
|
|
536
|
+
isAutoincrement: false;
|
|
537
|
+
hasRuntimeDefault: false;
|
|
538
|
+
enumValues: undefined;
|
|
539
|
+
baseColumn: never;
|
|
540
|
+
identity: undefined;
|
|
541
|
+
generated: undefined;
|
|
542
|
+
}, {}, {}>;
|
|
543
|
+
publish_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
544
|
+
name: "publish_at";
|
|
545
|
+
tableName: "byline_document_publish_schedules";
|
|
546
|
+
dataType: "date";
|
|
547
|
+
columnType: "MySqlDateTime";
|
|
548
|
+
data: Date;
|
|
549
|
+
driverParam: string | number;
|
|
550
|
+
notNull: true;
|
|
551
|
+
hasDefault: false;
|
|
552
|
+
isPrimaryKey: false;
|
|
553
|
+
isAutoincrement: false;
|
|
554
|
+
hasRuntimeDefault: false;
|
|
555
|
+
enumValues: undefined;
|
|
556
|
+
baseColumn: never;
|
|
557
|
+
identity: undefined;
|
|
558
|
+
generated: undefined;
|
|
559
|
+
}, {}, {}>;
|
|
560
|
+
state: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
561
|
+
name: "state";
|
|
562
|
+
tableName: "byline_document_publish_schedules";
|
|
563
|
+
dataType: "string";
|
|
564
|
+
columnType: "MySqlVarChar";
|
|
565
|
+
data: string;
|
|
566
|
+
driverParam: string | number;
|
|
567
|
+
notNull: true;
|
|
568
|
+
hasDefault: true;
|
|
569
|
+
isPrimaryKey: false;
|
|
570
|
+
isAutoincrement: false;
|
|
571
|
+
hasRuntimeDefault: false;
|
|
572
|
+
enumValues: [string, ...string[]];
|
|
573
|
+
baseColumn: never;
|
|
574
|
+
identity: undefined;
|
|
575
|
+
generated: undefined;
|
|
576
|
+
}, {}, {}>;
|
|
577
|
+
suspended_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
578
|
+
name: "suspended_at";
|
|
579
|
+
tableName: "byline_document_publish_schedules";
|
|
580
|
+
dataType: "date";
|
|
581
|
+
columnType: "MySqlDateTime";
|
|
582
|
+
data: Date;
|
|
583
|
+
driverParam: string | number;
|
|
584
|
+
notNull: false;
|
|
585
|
+
hasDefault: false;
|
|
586
|
+
isPrimaryKey: false;
|
|
587
|
+
isAutoincrement: false;
|
|
588
|
+
hasRuntimeDefault: false;
|
|
589
|
+
enumValues: undefined;
|
|
590
|
+
baseColumn: never;
|
|
591
|
+
identity: undefined;
|
|
592
|
+
generated: undefined;
|
|
593
|
+
}, {}, {}>;
|
|
594
|
+
suspended_reason: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
595
|
+
name: "suspended_reason";
|
|
596
|
+
tableName: "byline_document_publish_schedules";
|
|
597
|
+
dataType: "string";
|
|
598
|
+
columnType: "MySqlVarChar";
|
|
599
|
+
data: string;
|
|
600
|
+
driverParam: string | number;
|
|
601
|
+
notNull: false;
|
|
602
|
+
hasDefault: false;
|
|
603
|
+
isPrimaryKey: false;
|
|
604
|
+
isAutoincrement: false;
|
|
605
|
+
hasRuntimeDefault: false;
|
|
606
|
+
enumValues: [string, ...string[]];
|
|
607
|
+
baseColumn: never;
|
|
608
|
+
identity: undefined;
|
|
609
|
+
generated: undefined;
|
|
610
|
+
}, {}, {}>;
|
|
611
|
+
scheduled_by: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
612
|
+
name: "scheduled_by";
|
|
613
|
+
tableName: "byline_document_publish_schedules";
|
|
614
|
+
dataType: "custom";
|
|
615
|
+
columnType: "MySqlCustomColumn";
|
|
616
|
+
data: string;
|
|
617
|
+
driverParam: string;
|
|
618
|
+
notNull: false;
|
|
619
|
+
hasDefault: false;
|
|
620
|
+
isPrimaryKey: false;
|
|
621
|
+
isAutoincrement: false;
|
|
622
|
+
hasRuntimeDefault: false;
|
|
623
|
+
enumValues: undefined;
|
|
624
|
+
baseColumn: never;
|
|
625
|
+
identity: undefined;
|
|
626
|
+
generated: undefined;
|
|
627
|
+
}, {}, {}>;
|
|
628
|
+
last_authorized_by: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
629
|
+
name: "last_authorized_by";
|
|
630
|
+
tableName: "byline_document_publish_schedules";
|
|
631
|
+
dataType: "custom";
|
|
632
|
+
columnType: "MySqlCustomColumn";
|
|
633
|
+
data: string;
|
|
634
|
+
driverParam: string;
|
|
635
|
+
notNull: false;
|
|
636
|
+
hasDefault: false;
|
|
637
|
+
isPrimaryKey: false;
|
|
638
|
+
isAutoincrement: false;
|
|
639
|
+
hasRuntimeDefault: false;
|
|
640
|
+
enumValues: undefined;
|
|
641
|
+
baseColumn: never;
|
|
642
|
+
identity: undefined;
|
|
643
|
+
generated: undefined;
|
|
644
|
+
}, {}, {}>;
|
|
645
|
+
last_authorized_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
646
|
+
name: "last_authorized_at";
|
|
647
|
+
tableName: "byline_document_publish_schedules";
|
|
648
|
+
dataType: "date";
|
|
649
|
+
columnType: "MySqlDateTime";
|
|
650
|
+
data: Date;
|
|
651
|
+
driverParam: string | number;
|
|
652
|
+
notNull: true;
|
|
653
|
+
hasDefault: false;
|
|
654
|
+
isPrimaryKey: false;
|
|
655
|
+
isAutoincrement: false;
|
|
656
|
+
hasRuntimeDefault: false;
|
|
657
|
+
enumValues: undefined;
|
|
658
|
+
baseColumn: never;
|
|
659
|
+
identity: undefined;
|
|
660
|
+
generated: undefined;
|
|
661
|
+
}, {}, {}>;
|
|
662
|
+
scheduled_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
663
|
+
name: "scheduled_at";
|
|
664
|
+
tableName: "byline_document_publish_schedules";
|
|
665
|
+
dataType: "date";
|
|
666
|
+
columnType: "MySqlDateTime";
|
|
667
|
+
data: Date;
|
|
668
|
+
driverParam: string | number;
|
|
669
|
+
notNull: true;
|
|
670
|
+
hasDefault: true;
|
|
671
|
+
isPrimaryKey: false;
|
|
672
|
+
isAutoincrement: false;
|
|
673
|
+
hasRuntimeDefault: false;
|
|
674
|
+
enumValues: undefined;
|
|
675
|
+
baseColumn: never;
|
|
676
|
+
identity: undefined;
|
|
677
|
+
generated: undefined;
|
|
678
|
+
}, {}, {}>;
|
|
679
|
+
updated_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
680
|
+
name: "updated_at";
|
|
681
|
+
tableName: "byline_document_publish_schedules";
|
|
682
|
+
dataType: "date";
|
|
683
|
+
columnType: "MySqlDateTime";
|
|
684
|
+
data: Date;
|
|
685
|
+
driverParam: string | number;
|
|
686
|
+
notNull: true;
|
|
687
|
+
hasDefault: true;
|
|
688
|
+
isPrimaryKey: false;
|
|
689
|
+
isAutoincrement: false;
|
|
690
|
+
hasRuntimeDefault: false;
|
|
691
|
+
enumValues: undefined;
|
|
692
|
+
baseColumn: never;
|
|
693
|
+
identity: undefined;
|
|
694
|
+
generated: undefined;
|
|
695
|
+
}, {}, {}>;
|
|
696
|
+
execution_token: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
697
|
+
name: "execution_token";
|
|
698
|
+
tableName: "byline_document_publish_schedules";
|
|
699
|
+
dataType: "custom";
|
|
700
|
+
columnType: "MySqlCustomColumn";
|
|
701
|
+
data: string;
|
|
702
|
+
driverParam: string;
|
|
703
|
+
notNull: false;
|
|
704
|
+
hasDefault: false;
|
|
705
|
+
isPrimaryKey: false;
|
|
706
|
+
isAutoincrement: false;
|
|
707
|
+
hasRuntimeDefault: false;
|
|
708
|
+
enumValues: undefined;
|
|
709
|
+
baseColumn: never;
|
|
710
|
+
identity: undefined;
|
|
711
|
+
generated: undefined;
|
|
712
|
+
}, {}, {}>;
|
|
713
|
+
execution_expires_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
714
|
+
name: "execution_expires_at";
|
|
715
|
+
tableName: "byline_document_publish_schedules";
|
|
716
|
+
dataType: "date";
|
|
717
|
+
columnType: "MySqlDateTime";
|
|
718
|
+
data: Date;
|
|
719
|
+
driverParam: string | number;
|
|
720
|
+
notNull: false;
|
|
721
|
+
hasDefault: false;
|
|
722
|
+
isPrimaryKey: false;
|
|
723
|
+
isAutoincrement: false;
|
|
724
|
+
hasRuntimeDefault: false;
|
|
725
|
+
enumValues: undefined;
|
|
726
|
+
baseColumn: never;
|
|
727
|
+
identity: undefined;
|
|
728
|
+
generated: undefined;
|
|
729
|
+
}, {}, {}>;
|
|
730
|
+
last_attempt_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
731
|
+
name: "last_attempt_at";
|
|
732
|
+
tableName: "byline_document_publish_schedules";
|
|
733
|
+
dataType: "date";
|
|
734
|
+
columnType: "MySqlDateTime";
|
|
735
|
+
data: Date;
|
|
736
|
+
driverParam: string | number;
|
|
737
|
+
notNull: false;
|
|
738
|
+
hasDefault: false;
|
|
739
|
+
isPrimaryKey: false;
|
|
740
|
+
isAutoincrement: false;
|
|
741
|
+
hasRuntimeDefault: false;
|
|
742
|
+
enumValues: undefined;
|
|
743
|
+
baseColumn: never;
|
|
744
|
+
identity: undefined;
|
|
745
|
+
generated: undefined;
|
|
746
|
+
}, {}, {}>;
|
|
747
|
+
next_attempt_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
748
|
+
name: "next_attempt_at";
|
|
749
|
+
tableName: "byline_document_publish_schedules";
|
|
750
|
+
dataType: "date";
|
|
751
|
+
columnType: "MySqlDateTime";
|
|
752
|
+
data: Date;
|
|
753
|
+
driverParam: string | number;
|
|
754
|
+
notNull: true;
|
|
755
|
+
hasDefault: false;
|
|
756
|
+
isPrimaryKey: false;
|
|
757
|
+
isAutoincrement: false;
|
|
758
|
+
hasRuntimeDefault: false;
|
|
759
|
+
enumValues: undefined;
|
|
760
|
+
baseColumn: never;
|
|
761
|
+
identity: undefined;
|
|
762
|
+
generated: undefined;
|
|
763
|
+
}, {}, {}>;
|
|
764
|
+
attempt_count: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
765
|
+
name: "attempt_count";
|
|
766
|
+
tableName: "byline_document_publish_schedules";
|
|
767
|
+
dataType: "number";
|
|
768
|
+
columnType: "MySqlInt";
|
|
769
|
+
data: number;
|
|
770
|
+
driverParam: string | number;
|
|
771
|
+
notNull: true;
|
|
772
|
+
hasDefault: true;
|
|
773
|
+
isPrimaryKey: false;
|
|
774
|
+
isAutoincrement: false;
|
|
775
|
+
hasRuntimeDefault: false;
|
|
776
|
+
enumValues: undefined;
|
|
777
|
+
baseColumn: never;
|
|
778
|
+
identity: undefined;
|
|
779
|
+
generated: undefined;
|
|
780
|
+
}, {}, {}>;
|
|
781
|
+
last_error: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
782
|
+
name: "last_error";
|
|
783
|
+
tableName: "byline_document_publish_schedules";
|
|
784
|
+
dataType: "string";
|
|
785
|
+
columnType: "MySqlText";
|
|
786
|
+
data: string;
|
|
787
|
+
driverParam: string;
|
|
788
|
+
notNull: false;
|
|
789
|
+
hasDefault: false;
|
|
790
|
+
isPrimaryKey: false;
|
|
791
|
+
isAutoincrement: false;
|
|
792
|
+
hasRuntimeDefault: false;
|
|
793
|
+
enumValues: [string, ...string[]];
|
|
794
|
+
baseColumn: never;
|
|
795
|
+
identity: undefined;
|
|
796
|
+
generated: undefined;
|
|
797
|
+
}, {}, {}>;
|
|
798
|
+
};
|
|
799
|
+
dialect: 'mysql';
|
|
800
|
+
}>;
|
|
488
801
|
export declare const documentPaths: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
489
802
|
name: "byline_document_paths";
|
|
490
803
|
schema: undefined;
|
|
@@ -3452,4 +3765,266 @@ export declare const auditLog: import("drizzle-orm/mysql-core").MySqlTableWithCo
|
|
|
3452
3765
|
};
|
|
3453
3766
|
dialect: 'mysql';
|
|
3454
3767
|
}>;
|
|
3768
|
+
export declare const recurringTasks: import("drizzle-orm/mysql-core").MySqlTableWithColumns<{
|
|
3769
|
+
name: "byline_recurring_tasks";
|
|
3770
|
+
schema: undefined;
|
|
3771
|
+
columns: {
|
|
3772
|
+
created_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3773
|
+
name: string;
|
|
3774
|
+
tableName: "byline_recurring_tasks";
|
|
3775
|
+
dataType: "date";
|
|
3776
|
+
columnType: "MySqlDateTime";
|
|
3777
|
+
data: Date;
|
|
3778
|
+
driverParam: string | number;
|
|
3779
|
+
notNull: true;
|
|
3780
|
+
hasDefault: true;
|
|
3781
|
+
isPrimaryKey: false;
|
|
3782
|
+
isAutoincrement: false;
|
|
3783
|
+
hasRuntimeDefault: false;
|
|
3784
|
+
enumValues: undefined;
|
|
3785
|
+
baseColumn: never;
|
|
3786
|
+
identity: undefined;
|
|
3787
|
+
generated: undefined;
|
|
3788
|
+
}, {}, {}>;
|
|
3789
|
+
updated_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3790
|
+
name: string;
|
|
3791
|
+
tableName: "byline_recurring_tasks";
|
|
3792
|
+
dataType: "date";
|
|
3793
|
+
columnType: "MySqlDateTime";
|
|
3794
|
+
data: Date;
|
|
3795
|
+
driverParam: string | number;
|
|
3796
|
+
notNull: true;
|
|
3797
|
+
hasDefault: true;
|
|
3798
|
+
isPrimaryKey: false;
|
|
3799
|
+
isAutoincrement: false;
|
|
3800
|
+
hasRuntimeDefault: false;
|
|
3801
|
+
enumValues: undefined;
|
|
3802
|
+
baseColumn: never;
|
|
3803
|
+
identity: undefined;
|
|
3804
|
+
generated: undefined;
|
|
3805
|
+
}, {}, {}>;
|
|
3806
|
+
name: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3807
|
+
name: "name";
|
|
3808
|
+
tableName: "byline_recurring_tasks";
|
|
3809
|
+
dataType: "string";
|
|
3810
|
+
columnType: "MySqlVarChar";
|
|
3811
|
+
data: string;
|
|
3812
|
+
driverParam: string | number;
|
|
3813
|
+
notNull: true;
|
|
3814
|
+
hasDefault: false;
|
|
3815
|
+
isPrimaryKey: true;
|
|
3816
|
+
isAutoincrement: false;
|
|
3817
|
+
hasRuntimeDefault: false;
|
|
3818
|
+
enumValues: [string, ...string[]];
|
|
3819
|
+
baseColumn: never;
|
|
3820
|
+
identity: undefined;
|
|
3821
|
+
generated: undefined;
|
|
3822
|
+
}, {}, {}>;
|
|
3823
|
+
interval_ms: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3824
|
+
name: "interval_ms";
|
|
3825
|
+
tableName: "byline_recurring_tasks";
|
|
3826
|
+
dataType: "number";
|
|
3827
|
+
columnType: "MySqlBigInt53";
|
|
3828
|
+
data: number;
|
|
3829
|
+
driverParam: string | number;
|
|
3830
|
+
notNull: true;
|
|
3831
|
+
hasDefault: false;
|
|
3832
|
+
isPrimaryKey: false;
|
|
3833
|
+
isAutoincrement: false;
|
|
3834
|
+
hasRuntimeDefault: false;
|
|
3835
|
+
enumValues: undefined;
|
|
3836
|
+
baseColumn: never;
|
|
3837
|
+
identity: undefined;
|
|
3838
|
+
generated: undefined;
|
|
3839
|
+
}, {}, {}>;
|
|
3840
|
+
next_run_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3841
|
+
name: "next_run_at";
|
|
3842
|
+
tableName: "byline_recurring_tasks";
|
|
3843
|
+
dataType: "date";
|
|
3844
|
+
columnType: "MySqlDateTime";
|
|
3845
|
+
data: Date;
|
|
3846
|
+
driverParam: string | number;
|
|
3847
|
+
notNull: true;
|
|
3848
|
+
hasDefault: false;
|
|
3849
|
+
isPrimaryKey: false;
|
|
3850
|
+
isAutoincrement: false;
|
|
3851
|
+
hasRuntimeDefault: false;
|
|
3852
|
+
enumValues: undefined;
|
|
3853
|
+
baseColumn: never;
|
|
3854
|
+
identity: undefined;
|
|
3855
|
+
generated: undefined;
|
|
3856
|
+
}, {}, {}>;
|
|
3857
|
+
lease_token: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3858
|
+
name: "lease_token";
|
|
3859
|
+
tableName: "byline_recurring_tasks";
|
|
3860
|
+
dataType: "custom";
|
|
3861
|
+
columnType: "MySqlCustomColumn";
|
|
3862
|
+
data: string;
|
|
3863
|
+
driverParam: string;
|
|
3864
|
+
notNull: false;
|
|
3865
|
+
hasDefault: false;
|
|
3866
|
+
isPrimaryKey: false;
|
|
3867
|
+
isAutoincrement: false;
|
|
3868
|
+
hasRuntimeDefault: false;
|
|
3869
|
+
enumValues: undefined;
|
|
3870
|
+
baseColumn: never;
|
|
3871
|
+
identity: undefined;
|
|
3872
|
+
generated: undefined;
|
|
3873
|
+
}, {}, {}>;
|
|
3874
|
+
lease_owner: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3875
|
+
name: "lease_owner";
|
|
3876
|
+
tableName: "byline_recurring_tasks";
|
|
3877
|
+
dataType: "string";
|
|
3878
|
+
columnType: "MySqlVarChar";
|
|
3879
|
+
data: string;
|
|
3880
|
+
driverParam: string | number;
|
|
3881
|
+
notNull: false;
|
|
3882
|
+
hasDefault: false;
|
|
3883
|
+
isPrimaryKey: false;
|
|
3884
|
+
isAutoincrement: false;
|
|
3885
|
+
hasRuntimeDefault: false;
|
|
3886
|
+
enumValues: [string, ...string[]];
|
|
3887
|
+
baseColumn: never;
|
|
3888
|
+
identity: undefined;
|
|
3889
|
+
generated: undefined;
|
|
3890
|
+
}, {}, {}>;
|
|
3891
|
+
lease_expires_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3892
|
+
name: "lease_expires_at";
|
|
3893
|
+
tableName: "byline_recurring_tasks";
|
|
3894
|
+
dataType: "date";
|
|
3895
|
+
columnType: "MySqlDateTime";
|
|
3896
|
+
data: Date;
|
|
3897
|
+
driverParam: string | number;
|
|
3898
|
+
notNull: false;
|
|
3899
|
+
hasDefault: false;
|
|
3900
|
+
isPrimaryKey: false;
|
|
3901
|
+
isAutoincrement: false;
|
|
3902
|
+
hasRuntimeDefault: false;
|
|
3903
|
+
enumValues: undefined;
|
|
3904
|
+
baseColumn: never;
|
|
3905
|
+
identity: undefined;
|
|
3906
|
+
generated: undefined;
|
|
3907
|
+
}, {}, {}>;
|
|
3908
|
+
last_started_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3909
|
+
name: "last_started_at";
|
|
3910
|
+
tableName: "byline_recurring_tasks";
|
|
3911
|
+
dataType: "date";
|
|
3912
|
+
columnType: "MySqlDateTime";
|
|
3913
|
+
data: Date;
|
|
3914
|
+
driverParam: string | number;
|
|
3915
|
+
notNull: false;
|
|
3916
|
+
hasDefault: false;
|
|
3917
|
+
isPrimaryKey: false;
|
|
3918
|
+
isAutoincrement: false;
|
|
3919
|
+
hasRuntimeDefault: false;
|
|
3920
|
+
enumValues: undefined;
|
|
3921
|
+
baseColumn: never;
|
|
3922
|
+
identity: undefined;
|
|
3923
|
+
generated: undefined;
|
|
3924
|
+
}, {}, {}>;
|
|
3925
|
+
last_succeeded_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3926
|
+
name: "last_succeeded_at";
|
|
3927
|
+
tableName: "byline_recurring_tasks";
|
|
3928
|
+
dataType: "date";
|
|
3929
|
+
columnType: "MySqlDateTime";
|
|
3930
|
+
data: Date;
|
|
3931
|
+
driverParam: string | number;
|
|
3932
|
+
notNull: false;
|
|
3933
|
+
hasDefault: false;
|
|
3934
|
+
isPrimaryKey: false;
|
|
3935
|
+
isAutoincrement: false;
|
|
3936
|
+
hasRuntimeDefault: false;
|
|
3937
|
+
enumValues: undefined;
|
|
3938
|
+
baseColumn: never;
|
|
3939
|
+
identity: undefined;
|
|
3940
|
+
generated: undefined;
|
|
3941
|
+
}, {}, {}>;
|
|
3942
|
+
last_failed_at: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3943
|
+
name: "last_failed_at";
|
|
3944
|
+
tableName: "byline_recurring_tasks";
|
|
3945
|
+
dataType: "date";
|
|
3946
|
+
columnType: "MySqlDateTime";
|
|
3947
|
+
data: Date;
|
|
3948
|
+
driverParam: string | number;
|
|
3949
|
+
notNull: false;
|
|
3950
|
+
hasDefault: false;
|
|
3951
|
+
isPrimaryKey: false;
|
|
3952
|
+
isAutoincrement: false;
|
|
3953
|
+
hasRuntimeDefault: false;
|
|
3954
|
+
enumValues: undefined;
|
|
3955
|
+
baseColumn: never;
|
|
3956
|
+
identity: undefined;
|
|
3957
|
+
generated: undefined;
|
|
3958
|
+
}, {}, {}>;
|
|
3959
|
+
last_duration_ms: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3960
|
+
name: "last_duration_ms";
|
|
3961
|
+
tableName: "byline_recurring_tasks";
|
|
3962
|
+
dataType: "number";
|
|
3963
|
+
columnType: "MySqlBigInt53";
|
|
3964
|
+
data: number;
|
|
3965
|
+
driverParam: string | number;
|
|
3966
|
+
notNull: false;
|
|
3967
|
+
hasDefault: false;
|
|
3968
|
+
isPrimaryKey: false;
|
|
3969
|
+
isAutoincrement: false;
|
|
3970
|
+
hasRuntimeDefault: false;
|
|
3971
|
+
enumValues: undefined;
|
|
3972
|
+
baseColumn: never;
|
|
3973
|
+
identity: undefined;
|
|
3974
|
+
generated: undefined;
|
|
3975
|
+
}, {}, {}>;
|
|
3976
|
+
consecutive_failures: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3977
|
+
name: "consecutive_failures";
|
|
3978
|
+
tableName: "byline_recurring_tasks";
|
|
3979
|
+
dataType: "number";
|
|
3980
|
+
columnType: "MySqlInt";
|
|
3981
|
+
data: number;
|
|
3982
|
+
driverParam: string | number;
|
|
3983
|
+
notNull: true;
|
|
3984
|
+
hasDefault: true;
|
|
3985
|
+
isPrimaryKey: false;
|
|
3986
|
+
isAutoincrement: false;
|
|
3987
|
+
hasRuntimeDefault: false;
|
|
3988
|
+
enumValues: undefined;
|
|
3989
|
+
baseColumn: never;
|
|
3990
|
+
identity: undefined;
|
|
3991
|
+
generated: undefined;
|
|
3992
|
+
}, {}, {}>;
|
|
3993
|
+
last_status: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
3994
|
+
name: "last_status";
|
|
3995
|
+
tableName: "byline_recurring_tasks";
|
|
3996
|
+
dataType: "string";
|
|
3997
|
+
columnType: "MySqlVarChar";
|
|
3998
|
+
data: string;
|
|
3999
|
+
driverParam: string | number;
|
|
4000
|
+
notNull: true;
|
|
4001
|
+
hasDefault: true;
|
|
4002
|
+
isPrimaryKey: false;
|
|
4003
|
+
isAutoincrement: false;
|
|
4004
|
+
hasRuntimeDefault: false;
|
|
4005
|
+
enumValues: [string, ...string[]];
|
|
4006
|
+
baseColumn: never;
|
|
4007
|
+
identity: undefined;
|
|
4008
|
+
generated: undefined;
|
|
4009
|
+
}, {}, {}>;
|
|
4010
|
+
last_error: import("drizzle-orm/mysql-core").MySqlColumn<{
|
|
4011
|
+
name: "last_error";
|
|
4012
|
+
tableName: "byline_recurring_tasks";
|
|
4013
|
+
dataType: "string";
|
|
4014
|
+
columnType: "MySqlText";
|
|
4015
|
+
data: string;
|
|
4016
|
+
driverParam: string;
|
|
4017
|
+
notNull: false;
|
|
4018
|
+
hasDefault: false;
|
|
4019
|
+
isPrimaryKey: false;
|
|
4020
|
+
isAutoincrement: false;
|
|
4021
|
+
hasRuntimeDefault: false;
|
|
4022
|
+
enumValues: [string, ...string[]];
|
|
4023
|
+
baseColumn: never;
|
|
4024
|
+
identity: undefined;
|
|
4025
|
+
generated: undefined;
|
|
4026
|
+
}, {}, {}>;
|
|
4027
|
+
};
|
|
4028
|
+
dialect: 'mysql';
|
|
4029
|
+
}>;
|
|
3455
4030
|
export { adminPermissions, adminPermissionsRelations, adminRefreshTokens, adminRefreshTokensRelations, adminRoleAdminUser, adminRoleAdminUserRelations, adminRoles, adminRolesRelations, adminUserPreferences, adminUsers, adminUsersRelations, } from './auth.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Copyright (c) Infonomic Company Limited
|
|
7
7
|
*/
|
|
8
8
|
import { eq, relations, sql } from 'drizzle-orm';
|
|
9
|
-
import { bigint, boolean, date, datetime, decimal, float, foreignKey, index, int, json, mysqlTable, mysqlView, primaryKey, text, time, unique, varchar, } from 'drizzle-orm/mysql-core';
|
|
9
|
+
import { bigint, boolean, check, date, datetime, decimal, float, foreignKey, index, int, json, mysqlTable, mysqlView, primaryKey, text, time, unique, varchar, } from 'drizzle-orm/mysql-core';
|
|
10
10
|
import { createdAt, timestamps, uuidChar, varcharByteSorted, varcharCaseSensitive, } from './common.js';
|
|
11
11
|
// Every foreign key below is declared with the table-level `foreignKey()`
|
|
12
12
|
// builder and an explicit, short `fk_<table>_<column>` name, rather than
|
|
@@ -115,6 +115,55 @@ export const documentVersions = mysqlTable('byline_document_versions', {
|
|
|
115
115
|
// Ensure logical document belongs to only one collection
|
|
116
116
|
index('idx_documents_document_collection').on(table.document_id, table.collection_id),
|
|
117
117
|
]);
|
|
118
|
+
// Scheduled publication — one active intent row per logical document.
|
|
119
|
+
// This is document lifecycle metadata, not authored/versioned content. The
|
|
120
|
+
// target version is pinned until a later content write suspends the row for
|
|
121
|
+
// explicit re-confirmation. See specs/2026-08-22-scheduled-publish.md.
|
|
122
|
+
export const documentPublishSchedules = mysqlTable('byline_document_publish_schedules', {
|
|
123
|
+
document_id: uuidChar('document_id').primaryKey(),
|
|
124
|
+
collection_id: uuidChar('collection_id').notNull(),
|
|
125
|
+
target_version_id: uuidChar('target_version_id').notNull(),
|
|
126
|
+
publish_at: datetime('publish_at', { fsp: 6 }).notNull(),
|
|
127
|
+
state: varchar('state', { length: 32 }).notNull().default('armed'),
|
|
128
|
+
suspended_at: datetime('suspended_at', { fsp: 6 }),
|
|
129
|
+
suspended_reason: varchar('suspended_reason', { length: 32 }),
|
|
130
|
+
// Historical and current authorizers are deliberately not foreign keys:
|
|
131
|
+
// deleting an admin account must not revoke an already-authorized schedule.
|
|
132
|
+
scheduled_by: uuidChar('scheduled_by'),
|
|
133
|
+
last_authorized_by: uuidChar('last_authorized_by'),
|
|
134
|
+
last_authorized_at: datetime('last_authorized_at', { fsp: 6 }).notNull(),
|
|
135
|
+
scheduled_at: datetime('scheduled_at', { fsp: 6 }).notNull().default(sql `CURRENT_TIMESTAMP(6)`),
|
|
136
|
+
updated_at: datetime('updated_at', { fsp: 6 }).notNull().default(sql `CURRENT_TIMESTAMP(6)`),
|
|
137
|
+
execution_token: uuidChar('execution_token'),
|
|
138
|
+
execution_expires_at: datetime('execution_expires_at', { fsp: 6 }),
|
|
139
|
+
last_attempt_at: datetime('last_attempt_at', { fsp: 6 }),
|
|
140
|
+
next_attempt_at: datetime('next_attempt_at', { fsp: 6 }).notNull(),
|
|
141
|
+
attempt_count: int('attempt_count').notNull().default(0),
|
|
142
|
+
// Sanitized by the storage command and capped at 2 KiB; never stores a
|
|
143
|
+
// stack or document content.
|
|
144
|
+
last_error: text('last_error'),
|
|
145
|
+
}, (table) => [
|
|
146
|
+
foreignKey({
|
|
147
|
+
name: 'fk_publish_schedules_document',
|
|
148
|
+
columns: [table.document_id],
|
|
149
|
+
foreignColumns: [documents.id],
|
|
150
|
+
}).onDelete('cascade'),
|
|
151
|
+
foreignKey({
|
|
152
|
+
name: 'fk_publish_schedules_collection',
|
|
153
|
+
columns: [table.collection_id],
|
|
154
|
+
foreignColumns: [collections.id],
|
|
155
|
+
}).onDelete('cascade'),
|
|
156
|
+
foreignKey({
|
|
157
|
+
name: 'fk_publish_schedules_target_version',
|
|
158
|
+
columns: [table.target_version_id],
|
|
159
|
+
foreignColumns: [documentVersions.id],
|
|
160
|
+
}).onDelete('cascade'),
|
|
161
|
+
check('check_publish_schedules_state', sql `${table.state} IN ('armed', 'needs_reconfirm')`),
|
|
162
|
+
check('check_publish_schedules_suspended_reason', sql `${table.suspended_reason} IS NULL OR ${table.suspended_reason} = 'content_edited'`),
|
|
163
|
+
// MySQL has no partial indexes, so state is the leading discriminator.
|
|
164
|
+
index('idx_document_publish_schedules_due').on(table.state, table.next_attempt_at, table.publish_at),
|
|
165
|
+
index('idx_document_publish_schedules_execution_expiry').on(table.execution_expires_at),
|
|
166
|
+
]);
|
|
118
167
|
// Document paths — one row per (logical document, content locale).
|
|
119
168
|
// Promotes `path` out of the version row so per-collection uniqueness can
|
|
120
169
|
// be enforced at the DB layer without colliding with the sticky
|
|
@@ -894,6 +943,37 @@ export const auditLog = mysqlTable('byline_audit_log', {
|
|
|
894
943
|
index('idx_audit_log_action').on(table.action, table.id),
|
|
895
944
|
]);
|
|
896
945
|
// ---------------------------------------------------------------------------
|
|
946
|
+
// Recurring-task scheduler — byline_recurring_tasks
|
|
947
|
+
// ---------------------------------------------------------------------------
|
|
948
|
+
// Recurring-task scheduler (specs/2026-08-22-scheduler.md).
|
|
949
|
+
// Code-registered definitions are authoritative; rows for definitions removed
|
|
950
|
+
// from code are retained as dormant history and never executed.
|
|
951
|
+
export const recurringTasks = mysqlTable('byline_recurring_tasks', {
|
|
952
|
+
name: varchar('name', { length: 255 }).primaryKey(),
|
|
953
|
+
// bigint: MySQL INT tops out at ~24.9 days in milliseconds, and a 30-day
|
|
954
|
+
// interval is a legitimate configuration. `mode: 'number'` is safe because
|
|
955
|
+
// boot-time validation guarantees every millisecond value is a JS safe integer.
|
|
956
|
+
interval_ms: bigint('interval_ms', { mode: 'number' }).notNull(),
|
|
957
|
+
next_run_at: datetime('next_run_at', { fsp: 6 }).notNull(),
|
|
958
|
+
// A token unique to one claim — not a stable machine id. Every health and
|
|
959
|
+
// schedule write is conditional on it, so a slow runner whose lease expired
|
|
960
|
+
// cannot overwrite a newer run.
|
|
961
|
+
lease_token: uuidChar('lease_token'),
|
|
962
|
+
// Bounded, non-secret diagnostic label (machine id + pid). Correctness never
|
|
963
|
+
// depends on owner uniqueness.
|
|
964
|
+
lease_owner: varchar('lease_owner', { length: 255 }),
|
|
965
|
+
lease_expires_at: datetime('lease_expires_at', { fsp: 6 }),
|
|
966
|
+
last_started_at: datetime('last_started_at', { fsp: 6 }),
|
|
967
|
+
last_succeeded_at: datetime('last_succeeded_at', { fsp: 6 }),
|
|
968
|
+
last_failed_at: datetime('last_failed_at', { fsp: 6 }),
|
|
969
|
+
last_duration_ms: bigint('last_duration_ms', { mode: 'number' }),
|
|
970
|
+
consecutive_failures: int('consecutive_failures').notNull().default(0),
|
|
971
|
+
last_status: varchar('last_status', { length: 32 }).notNull().default('never_run'),
|
|
972
|
+
// Sanitized message, capped at 2 KiB by the store. Full stacks go to the logger.
|
|
973
|
+
last_error: text('last_error'),
|
|
974
|
+
...timestamps,
|
|
975
|
+
});
|
|
976
|
+
// ---------------------------------------------------------------------------
|
|
897
977
|
// Auth schema — byline_admin_users, byline_admin_roles, etc.
|
|
898
978
|
// See ./auth.ts for definitions and rationale.
|
|
899
979
|
// ---------------------------------------------------------------------------
|