@adatechnology/content-module 0.0.0-stage → 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.
@@ -0,0 +1,1286 @@
1
+ import { PostStatus, PostSortField, PostCounts, TagCount, ContentModuleConfig, ClockPort, ContentHooks, ContentImageStoragePort, LoggerPort, ContentFeedConfig, SitemapEntry, PostEventType, Post, CreatePostInput, UpdatePostInput, PublishPostInput, ListPostsQuery, Paginated, PostSummary, PublicPost, ListPublishedPostsQuery, PublicPostSummary, RecurrenceRule, CreateRecurrenceInput, UpdateRecurrenceInput, RepublishPostInput, SaveAsTemplateInput, CreateFromTemplateInput, RecurrenceFrequency } from '@adatechnology/content-contracts';
2
+ import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
3
+ import { PgDatabase, PgQueryResultHKT } from 'drizzle-orm/pg-core';
4
+ import * as drizzle_orm from 'drizzle-orm';
5
+ import { ModuleRouteTable } from '@adatechnology/module-http';
6
+
7
+ /**
8
+ * Copyright (c) 2026 Ada Technology. MIT License.
9
+ */
10
+
11
+ type ContentDatabase = PgDatabase<PgQueryResultHKT, any, any>;
12
+ type DrizzleMigrateFunction = (db: never, config: {
13
+ migrationsFolder: string;
14
+ migrationsTable?: string;
15
+ }) => Promise<void>;
16
+
17
+ /**
18
+ * Copyright (c) 2026 Ada Technology. MIT License.
19
+ */
20
+ declare const contentSchema: drizzle_orm_pg_core.PgSchema<"content">;
21
+ declare const posts: drizzle_orm_pg_core.PgTableWithColumns<{
22
+ name: "posts";
23
+ schema: "content";
24
+ columns: {
25
+ id: drizzle_orm_pg_core.PgColumn<{
26
+ name: "id";
27
+ tableName: "posts";
28
+ dataType: "string";
29
+ columnType: "PgUUID";
30
+ data: string;
31
+ driverParam: string;
32
+ notNull: true;
33
+ hasDefault: true;
34
+ isPrimaryKey: true;
35
+ isAutoincrement: false;
36
+ hasRuntimeDefault: false;
37
+ enumValues: undefined;
38
+ baseColumn: never;
39
+ identity: undefined;
40
+ generated: undefined;
41
+ }, {}, {}>;
42
+ companyId: drizzle_orm_pg_core.PgColumn<{
43
+ name: "company_id";
44
+ tableName: "posts";
45
+ dataType: "string";
46
+ columnType: "PgUUID";
47
+ data: string;
48
+ driverParam: string;
49
+ notNull: true;
50
+ hasDefault: false;
51
+ isPrimaryKey: false;
52
+ isAutoincrement: false;
53
+ hasRuntimeDefault: false;
54
+ enumValues: undefined;
55
+ baseColumn: never;
56
+ identity: undefined;
57
+ generated: undefined;
58
+ }, {}, {}>;
59
+ slug: drizzle_orm_pg_core.PgColumn<{
60
+ name: "slug";
61
+ tableName: "posts";
62
+ dataType: "string";
63
+ columnType: "PgVarchar";
64
+ data: string;
65
+ driverParam: string;
66
+ notNull: true;
67
+ hasDefault: false;
68
+ isPrimaryKey: false;
69
+ isAutoincrement: false;
70
+ hasRuntimeDefault: false;
71
+ enumValues: [string, ...string[]];
72
+ baseColumn: never;
73
+ identity: undefined;
74
+ generated: undefined;
75
+ }, {}, {
76
+ length: 120;
77
+ }>;
78
+ shortId: drizzle_orm_pg_core.PgColumn<{
79
+ name: "short_id";
80
+ tableName: "posts";
81
+ dataType: "string";
82
+ columnType: "PgVarchar";
83
+ data: string;
84
+ driverParam: string;
85
+ notNull: true;
86
+ hasDefault: false;
87
+ isPrimaryKey: false;
88
+ isAutoincrement: false;
89
+ hasRuntimeDefault: false;
90
+ enumValues: [string, ...string[]];
91
+ baseColumn: never;
92
+ identity: undefined;
93
+ generated: undefined;
94
+ }, {}, {
95
+ length: 6;
96
+ }>;
97
+ title: drizzle_orm_pg_core.PgColumn<{
98
+ name: "title";
99
+ tableName: "posts";
100
+ dataType: "string";
101
+ columnType: "PgVarchar";
102
+ data: string;
103
+ driverParam: string;
104
+ notNull: true;
105
+ hasDefault: false;
106
+ isPrimaryKey: false;
107
+ isAutoincrement: false;
108
+ hasRuntimeDefault: false;
109
+ enumValues: [string, ...string[]];
110
+ baseColumn: never;
111
+ identity: undefined;
112
+ generated: undefined;
113
+ }, {}, {
114
+ length: 200;
115
+ }>;
116
+ excerpt: drizzle_orm_pg_core.PgColumn<{
117
+ name: "excerpt";
118
+ tableName: "posts";
119
+ dataType: "string";
120
+ columnType: "PgVarchar";
121
+ data: string;
122
+ driverParam: string;
123
+ notNull: false;
124
+ hasDefault: false;
125
+ isPrimaryKey: false;
126
+ isAutoincrement: false;
127
+ hasRuntimeDefault: false;
128
+ enumValues: [string, ...string[]];
129
+ baseColumn: never;
130
+ identity: undefined;
131
+ generated: undefined;
132
+ }, {}, {
133
+ length: 500;
134
+ }>;
135
+ body: drizzle_orm_pg_core.PgColumn<{
136
+ name: "body";
137
+ tableName: "posts";
138
+ dataType: "string";
139
+ columnType: "PgText";
140
+ data: string;
141
+ driverParam: string;
142
+ notNull: true;
143
+ hasDefault: true;
144
+ isPrimaryKey: false;
145
+ isAutoincrement: false;
146
+ hasRuntimeDefault: false;
147
+ enumValues: [string, ...string[]];
148
+ baseColumn: never;
149
+ identity: undefined;
150
+ generated: undefined;
151
+ }, {}, {}>;
152
+ coverImageUrl: drizzle_orm_pg_core.PgColumn<{
153
+ name: "cover_image_url";
154
+ tableName: "posts";
155
+ dataType: "string";
156
+ columnType: "PgVarchar";
157
+ data: string;
158
+ driverParam: string;
159
+ notNull: false;
160
+ hasDefault: false;
161
+ isPrimaryKey: false;
162
+ isAutoincrement: false;
163
+ hasRuntimeDefault: false;
164
+ enumValues: [string, ...string[]];
165
+ baseColumn: never;
166
+ identity: undefined;
167
+ generated: undefined;
168
+ }, {}, {
169
+ length: 2048;
170
+ }>;
171
+ coverImageAlt: drizzle_orm_pg_core.PgColumn<{
172
+ name: "cover_image_alt";
173
+ tableName: "posts";
174
+ dataType: "string";
175
+ columnType: "PgVarchar";
176
+ data: string;
177
+ driverParam: string;
178
+ notNull: false;
179
+ hasDefault: false;
180
+ isPrimaryKey: false;
181
+ isAutoincrement: false;
182
+ hasRuntimeDefault: false;
183
+ enumValues: [string, ...string[]];
184
+ baseColumn: never;
185
+ identity: undefined;
186
+ generated: undefined;
187
+ }, {}, {
188
+ length: 300;
189
+ }>;
190
+ tags: drizzle_orm_pg_core.PgColumn<{
191
+ name: "tags";
192
+ tableName: "posts";
193
+ dataType: "array";
194
+ columnType: "PgArray";
195
+ data: string[];
196
+ driverParam: string | string[];
197
+ notNull: true;
198
+ hasDefault: true;
199
+ isPrimaryKey: false;
200
+ isAutoincrement: false;
201
+ hasRuntimeDefault: false;
202
+ enumValues: [string, ...string[]];
203
+ baseColumn: drizzle_orm.Column<{
204
+ name: "tags";
205
+ tableName: "posts";
206
+ dataType: "string";
207
+ columnType: "PgText";
208
+ data: string;
209
+ driverParam: string;
210
+ notNull: false;
211
+ hasDefault: false;
212
+ isPrimaryKey: false;
213
+ isAutoincrement: false;
214
+ hasRuntimeDefault: false;
215
+ enumValues: [string, ...string[]];
216
+ baseColumn: never;
217
+ identity: undefined;
218
+ generated: undefined;
219
+ }, {}, {}>;
220
+ identity: undefined;
221
+ generated: undefined;
222
+ }, {}, {
223
+ baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{
224
+ name: "tags";
225
+ dataType: "string";
226
+ columnType: "PgText";
227
+ data: string;
228
+ enumValues: [string, ...string[]];
229
+ driverParam: string;
230
+ }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>;
231
+ size: undefined;
232
+ }>;
233
+ tagLabels: drizzle_orm_pg_core.PgColumn<{
234
+ name: "tag_labels";
235
+ tableName: "posts";
236
+ dataType: "json";
237
+ columnType: "PgJsonb";
238
+ data: Record<string, string>;
239
+ driverParam: unknown;
240
+ notNull: true;
241
+ hasDefault: true;
242
+ isPrimaryKey: false;
243
+ isAutoincrement: false;
244
+ hasRuntimeDefault: false;
245
+ enumValues: undefined;
246
+ baseColumn: never;
247
+ identity: undefined;
248
+ generated: undefined;
249
+ }, {}, {
250
+ $type: Record<string, string>;
251
+ }>;
252
+ status: drizzle_orm_pg_core.PgColumn<{
253
+ name: "status";
254
+ tableName: "posts";
255
+ dataType: "string";
256
+ columnType: "PgVarchar";
257
+ data: string;
258
+ driverParam: string;
259
+ notNull: true;
260
+ hasDefault: true;
261
+ isPrimaryKey: false;
262
+ isAutoincrement: false;
263
+ hasRuntimeDefault: false;
264
+ enumValues: [string, ...string[]];
265
+ baseColumn: never;
266
+ identity: undefined;
267
+ generated: undefined;
268
+ }, {}, {
269
+ length: 12;
270
+ }>;
271
+ isTemplate: drizzle_orm_pg_core.PgColumn<{
272
+ name: "is_template";
273
+ tableName: "posts";
274
+ dataType: "boolean";
275
+ columnType: "PgBoolean";
276
+ data: boolean;
277
+ driverParam: boolean;
278
+ notNull: true;
279
+ hasDefault: true;
280
+ isPrimaryKey: false;
281
+ isAutoincrement: false;
282
+ hasRuntimeDefault: false;
283
+ enumValues: undefined;
284
+ baseColumn: never;
285
+ identity: undefined;
286
+ generated: undefined;
287
+ }, {}, {}>;
288
+ publishedAt: drizzle_orm_pg_core.PgColumn<{
289
+ name: "published_at";
290
+ tableName: "posts";
291
+ dataType: "date";
292
+ columnType: "PgTimestamp";
293
+ data: Date;
294
+ driverParam: string;
295
+ notNull: false;
296
+ hasDefault: false;
297
+ isPrimaryKey: false;
298
+ isAutoincrement: false;
299
+ hasRuntimeDefault: false;
300
+ enumValues: undefined;
301
+ baseColumn: never;
302
+ identity: undefined;
303
+ generated: undefined;
304
+ }, {}, {}>;
305
+ authorName: drizzle_orm_pg_core.PgColumn<{
306
+ name: "author_name";
307
+ tableName: "posts";
308
+ dataType: "string";
309
+ columnType: "PgVarchar";
310
+ data: string;
311
+ driverParam: string;
312
+ notNull: false;
313
+ hasDefault: false;
314
+ isPrimaryKey: false;
315
+ isAutoincrement: false;
316
+ hasRuntimeDefault: false;
317
+ enumValues: [string, ...string[]];
318
+ baseColumn: never;
319
+ identity: undefined;
320
+ generated: undefined;
321
+ }, {}, {
322
+ length: 120;
323
+ }>;
324
+ seoTitle: drizzle_orm_pg_core.PgColumn<{
325
+ name: "seo_title";
326
+ tableName: "posts";
327
+ dataType: "string";
328
+ columnType: "PgVarchar";
329
+ data: string;
330
+ driverParam: string;
331
+ notNull: false;
332
+ hasDefault: false;
333
+ isPrimaryKey: false;
334
+ isAutoincrement: false;
335
+ hasRuntimeDefault: false;
336
+ enumValues: [string, ...string[]];
337
+ baseColumn: never;
338
+ identity: undefined;
339
+ generated: undefined;
340
+ }, {}, {
341
+ length: 200;
342
+ }>;
343
+ seoDescription: drizzle_orm_pg_core.PgColumn<{
344
+ name: "seo_description";
345
+ tableName: "posts";
346
+ dataType: "string";
347
+ columnType: "PgVarchar";
348
+ data: string;
349
+ driverParam: string;
350
+ notNull: false;
351
+ hasDefault: false;
352
+ isPrimaryKey: false;
353
+ isAutoincrement: false;
354
+ hasRuntimeDefault: false;
355
+ enumValues: [string, ...string[]];
356
+ baseColumn: never;
357
+ identity: undefined;
358
+ generated: undefined;
359
+ }, {}, {
360
+ length: 320;
361
+ }>;
362
+ canonicalUrl: drizzle_orm_pg_core.PgColumn<{
363
+ name: "canonical_url";
364
+ tableName: "posts";
365
+ dataType: "string";
366
+ columnType: "PgVarchar";
367
+ data: string;
368
+ driverParam: string;
369
+ notNull: false;
370
+ hasDefault: false;
371
+ isPrimaryKey: false;
372
+ isAutoincrement: false;
373
+ hasRuntimeDefault: false;
374
+ enumValues: [string, ...string[]];
375
+ baseColumn: never;
376
+ identity: undefined;
377
+ generated: undefined;
378
+ }, {}, {
379
+ length: 2048;
380
+ }>;
381
+ readingTimeMinutes: drizzle_orm_pg_core.PgColumn<{
382
+ name: "reading_time_minutes";
383
+ tableName: "posts";
384
+ dataType: "number";
385
+ columnType: "PgInteger";
386
+ data: number;
387
+ driverParam: string | number;
388
+ notNull: true;
389
+ hasDefault: true;
390
+ isPrimaryKey: false;
391
+ isAutoincrement: false;
392
+ hasRuntimeDefault: false;
393
+ enumValues: undefined;
394
+ baseColumn: never;
395
+ identity: undefined;
396
+ generated: undefined;
397
+ }, {}, {}>;
398
+ createdAt: drizzle_orm_pg_core.PgColumn<{
399
+ name: "created_at";
400
+ tableName: "posts";
401
+ dataType: "date";
402
+ columnType: "PgTimestamp";
403
+ data: Date;
404
+ driverParam: string;
405
+ notNull: true;
406
+ hasDefault: true;
407
+ isPrimaryKey: false;
408
+ isAutoincrement: false;
409
+ hasRuntimeDefault: false;
410
+ enumValues: undefined;
411
+ baseColumn: never;
412
+ identity: undefined;
413
+ generated: undefined;
414
+ }, {}, {}>;
415
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
416
+ name: "updated_at";
417
+ tableName: "posts";
418
+ dataType: "date";
419
+ columnType: "PgTimestamp";
420
+ data: Date;
421
+ driverParam: string;
422
+ notNull: true;
423
+ hasDefault: true;
424
+ isPrimaryKey: false;
425
+ isAutoincrement: false;
426
+ hasRuntimeDefault: false;
427
+ enumValues: undefined;
428
+ baseColumn: never;
429
+ identity: undefined;
430
+ generated: undefined;
431
+ }, {}, {}>;
432
+ };
433
+ dialect: "pg";
434
+ }>;
435
+ type PostRow = typeof posts.$inferSelect;
436
+ type NewPostRow = typeof posts.$inferInsert;
437
+ declare const recurrenceRules: drizzle_orm_pg_core.PgTableWithColumns<{
438
+ name: "recurrence_rules";
439
+ schema: "content";
440
+ columns: {
441
+ id: drizzle_orm_pg_core.PgColumn<{
442
+ name: "id";
443
+ tableName: "recurrence_rules";
444
+ dataType: "string";
445
+ columnType: "PgUUID";
446
+ data: string;
447
+ driverParam: string;
448
+ notNull: true;
449
+ hasDefault: true;
450
+ isPrimaryKey: true;
451
+ isAutoincrement: false;
452
+ hasRuntimeDefault: false;
453
+ enumValues: undefined;
454
+ baseColumn: never;
455
+ identity: undefined;
456
+ generated: undefined;
457
+ }, {}, {}>;
458
+ companyId: drizzle_orm_pg_core.PgColumn<{
459
+ name: "company_id";
460
+ tableName: "recurrence_rules";
461
+ dataType: "string";
462
+ columnType: "PgUUID";
463
+ data: string;
464
+ driverParam: string;
465
+ notNull: true;
466
+ hasDefault: false;
467
+ isPrimaryKey: false;
468
+ isAutoincrement: false;
469
+ hasRuntimeDefault: false;
470
+ enumValues: undefined;
471
+ baseColumn: never;
472
+ identity: undefined;
473
+ generated: undefined;
474
+ }, {}, {}>;
475
+ templateId: drizzle_orm_pg_core.PgColumn<{
476
+ name: "template_id";
477
+ tableName: "recurrence_rules";
478
+ dataType: "string";
479
+ columnType: "PgUUID";
480
+ data: string;
481
+ driverParam: string;
482
+ notNull: true;
483
+ hasDefault: false;
484
+ isPrimaryKey: false;
485
+ isAutoincrement: false;
486
+ hasRuntimeDefault: false;
487
+ enumValues: undefined;
488
+ baseColumn: never;
489
+ identity: undefined;
490
+ generated: undefined;
491
+ }, {}, {}>;
492
+ frequency: drizzle_orm_pg_core.PgColumn<{
493
+ name: "frequency";
494
+ tableName: "recurrence_rules";
495
+ dataType: "string";
496
+ columnType: "PgVarchar";
497
+ data: string;
498
+ driverParam: string;
499
+ notNull: true;
500
+ hasDefault: false;
501
+ isPrimaryKey: false;
502
+ isAutoincrement: false;
503
+ hasRuntimeDefault: false;
504
+ enumValues: [string, ...string[]];
505
+ baseColumn: never;
506
+ identity: undefined;
507
+ generated: undefined;
508
+ }, {}, {
509
+ length: 10;
510
+ }>;
511
+ anchorDay: drizzle_orm_pg_core.PgColumn<{
512
+ name: "anchor_day";
513
+ tableName: "recurrence_rules";
514
+ dataType: "number";
515
+ columnType: "PgInteger";
516
+ data: number;
517
+ driverParam: string | number;
518
+ notNull: true;
519
+ hasDefault: false;
520
+ isPrimaryKey: false;
521
+ isAutoincrement: false;
522
+ hasRuntimeDefault: false;
523
+ enumValues: undefined;
524
+ baseColumn: never;
525
+ identity: undefined;
526
+ generated: undefined;
527
+ }, {}, {}>;
528
+ isActive: drizzle_orm_pg_core.PgColumn<{
529
+ name: "is_active";
530
+ tableName: "recurrence_rules";
531
+ dataType: "boolean";
532
+ columnType: "PgBoolean";
533
+ data: boolean;
534
+ driverParam: boolean;
535
+ notNull: true;
536
+ hasDefault: true;
537
+ isPrimaryKey: false;
538
+ isAutoincrement: false;
539
+ hasRuntimeDefault: false;
540
+ enumValues: undefined;
541
+ baseColumn: never;
542
+ identity: undefined;
543
+ generated: undefined;
544
+ }, {}, {}>;
545
+ nextRunAt: drizzle_orm_pg_core.PgColumn<{
546
+ name: "next_run_at";
547
+ tableName: "recurrence_rules";
548
+ dataType: "date";
549
+ columnType: "PgTimestamp";
550
+ data: Date;
551
+ driverParam: string;
552
+ notNull: true;
553
+ hasDefault: false;
554
+ isPrimaryKey: false;
555
+ isAutoincrement: false;
556
+ hasRuntimeDefault: false;
557
+ enumValues: undefined;
558
+ baseColumn: never;
559
+ identity: undefined;
560
+ generated: undefined;
561
+ }, {}, {}>;
562
+ lastRunAt: drizzle_orm_pg_core.PgColumn<{
563
+ name: "last_run_at";
564
+ tableName: "recurrence_rules";
565
+ dataType: "date";
566
+ columnType: "PgTimestamp";
567
+ data: Date;
568
+ driverParam: string;
569
+ notNull: false;
570
+ hasDefault: false;
571
+ isPrimaryKey: false;
572
+ isAutoincrement: false;
573
+ hasRuntimeDefault: false;
574
+ enumValues: undefined;
575
+ baseColumn: never;
576
+ identity: undefined;
577
+ generated: undefined;
578
+ }, {}, {}>;
579
+ lastPostId: drizzle_orm_pg_core.PgColumn<{
580
+ name: "last_post_id";
581
+ tableName: "recurrence_rules";
582
+ dataType: "string";
583
+ columnType: "PgUUID";
584
+ data: string;
585
+ driverParam: string;
586
+ notNull: false;
587
+ hasDefault: false;
588
+ isPrimaryKey: false;
589
+ isAutoincrement: false;
590
+ hasRuntimeDefault: false;
591
+ enumValues: undefined;
592
+ baseColumn: never;
593
+ identity: undefined;
594
+ generated: undefined;
595
+ }, {}, {}>;
596
+ createdAt: drizzle_orm_pg_core.PgColumn<{
597
+ name: "created_at";
598
+ tableName: "recurrence_rules";
599
+ dataType: "date";
600
+ columnType: "PgTimestamp";
601
+ data: Date;
602
+ driverParam: string;
603
+ notNull: true;
604
+ hasDefault: true;
605
+ isPrimaryKey: false;
606
+ isAutoincrement: false;
607
+ hasRuntimeDefault: false;
608
+ enumValues: undefined;
609
+ baseColumn: never;
610
+ identity: undefined;
611
+ generated: undefined;
612
+ }, {}, {}>;
613
+ };
614
+ dialect: "pg";
615
+ }>;
616
+ type RecurrenceRow = typeof recurrenceRules.$inferSelect;
617
+ type NewRecurrenceRow = typeof recurrenceRules.$inferInsert;
618
+
619
+ /**
620
+ * Copyright (c) 2026 Ada Technology. MIT License.
621
+ */
622
+
623
+ type PostPage = {
624
+ readonly rows: readonly PostRow[];
625
+ readonly total: number;
626
+ };
627
+ type PostAdminListQuery = {
628
+ readonly companyId: string;
629
+ readonly page: number;
630
+ readonly pageSize: number;
631
+ readonly status?: PostStatus;
632
+ /** Basta o post ter UMA das tags. */
633
+ readonly tags?: readonly string[];
634
+ readonly search?: string;
635
+ readonly isTemplate?: boolean;
636
+ readonly sort?: PostSortField;
637
+ readonly order?: 'asc' | 'desc';
638
+ readonly now: Date;
639
+ };
640
+ type PostPublicListQuery = {
641
+ readonly companyId: string;
642
+ readonly now: Date;
643
+ readonly page: number;
644
+ readonly pageSize: number;
645
+ readonly tag?: string;
646
+ };
647
+ /**
648
+ * Porta de persistência dos use-cases. `PostRepository` é a implementação Drizzle; os testes usam
649
+ * o dublê em memória de `testing/`. Toda operação recebe `companyId` — não existe leitura sem empresa.
650
+ */
651
+ interface PostStorePort {
652
+ create(values: NewPostRow): Promise<PostRow>;
653
+ findById(params: {
654
+ readonly companyId: string;
655
+ readonly id: string;
656
+ }): Promise<PostRow | undefined>;
657
+ findBySlug(params: {
658
+ readonly companyId: string;
659
+ readonly slug: string;
660
+ }): Promise<PostRow | undefined>;
661
+ findByShortId(params: {
662
+ readonly companyId: string;
663
+ readonly shortId: string;
664
+ }): Promise<PostRow | undefined>;
665
+ findPublicByShortId(params: {
666
+ readonly companyId: string;
667
+ readonly shortId: string;
668
+ readonly now: Date;
669
+ }): Promise<PostRow | undefined>;
670
+ /** Post público que já teve este slug (link antigo). */
671
+ findPublicByFormerSlug(params: {
672
+ readonly companyId: string;
673
+ readonly slug: string;
674
+ readonly now: Date;
675
+ }): Promise<PostRow | undefined>;
676
+ recordFormerSlug(params: {
677
+ readonly companyId: string;
678
+ readonly postId: string;
679
+ readonly slug: string;
680
+ }): Promise<void>;
681
+ findPublicBySlug(params: {
682
+ readonly companyId: string;
683
+ readonly slug: string;
684
+ readonly now: Date;
685
+ }): Promise<PostRow | undefined>;
686
+ update(params: {
687
+ readonly companyId: string;
688
+ readonly id: string;
689
+ readonly values: Partial<NewPostRow>;
690
+ }): Promise<PostRow | undefined>;
691
+ listForAdmin(query: PostAdminListQuery): Promise<PostPage>;
692
+ listPublic(query: PostPublicListQuery): Promise<PostPage>;
693
+ countByStatus(params: {
694
+ readonly companyId: string;
695
+ readonly now: Date;
696
+ }): Promise<PostCounts>;
697
+ /**
698
+ * Marca como publicado (sem tocar `updated_at`) até `limit` posts agendados vencidos, de qualquer
699
+ * empresa, e devolve só o que ESTA chamada marcou. Atômico e seguro com execuções concorrentes
700
+ * (`FOR UPDATE SKIP LOCKED` no Postgres): dois ciclos nunca marcam nem notificam o mesmo post.
701
+ */
702
+ claimDueScheduled(params: {
703
+ readonly now: Date;
704
+ readonly limit: number;
705
+ }): Promise<readonly PostRow[]>;
706
+ listTags(params: {
707
+ readonly companyId: string;
708
+ readonly publicAt?: Date;
709
+ }): Promise<readonly TagCount[]>;
710
+ }
711
+ /** Persistência das regras de recorrência. Mesma regra: toda operação do painel recebe `companyId`. */
712
+ interface RecurrenceStorePort {
713
+ create(values: NewRecurrenceRow): Promise<RecurrenceRow>;
714
+ findById(params: {
715
+ readonly companyId: string;
716
+ readonly id: string;
717
+ }): Promise<RecurrenceRow | undefined>;
718
+ list(params: {
719
+ readonly companyId: string;
720
+ }): Promise<readonly RecurrenceRow[]>;
721
+ update(params: {
722
+ readonly companyId: string;
723
+ readonly id: string;
724
+ readonly values: Partial<NewRecurrenceRow>;
725
+ }): Promise<RecurrenceRow | undefined>;
726
+ remove(params: {
727
+ readonly companyId: string;
728
+ readonly id: string;
729
+ }): Promise<boolean>;
730
+ /**
731
+ * Trava (`FOR UPDATE SKIP LOCKED`) até `limit` regras ativas vencidas, de qualquer empresa, e roda
732
+ * `handle` para cada uma na mesma transação: o que `handle` devolver vira o novo estado da regra.
733
+ * Falha em `handle` desfaz só a regra dela e a deixa vencida para o próximo ciclo.
734
+ */
735
+ processDue(params: {
736
+ readonly now: Date;
737
+ readonly limit: number;
738
+ readonly handle: (rule: RecurrenceRow) => Promise<Partial<NewRecurrenceRow>>;
739
+ }): Promise<number>;
740
+ }
741
+ type ContentDependencies = {
742
+ readonly posts: PostStorePort;
743
+ readonly recurrences: RecurrenceStorePort;
744
+ readonly config: ContentModuleConfig;
745
+ readonly clock: ClockPort;
746
+ readonly hooks?: ContentHooks;
747
+ readonly imageStorage?: ContentImageStoragePort;
748
+ readonly logger?: LoggerPort;
749
+ };
750
+
751
+ /**
752
+ * Copyright (c) 2026 Ada Technology. MIT License.
753
+ *
754
+ * RSS, Atom e entradas de sitemap do site público, a partir de `config.feed`. Sem essa config os
755
+ * use-cases nem são construídos e as rotas não sobem.
756
+ */
757
+
758
+ declare const FEED_FORMAT: {
759
+ readonly RSS: "rss";
760
+ readonly ATOM: "atom";
761
+ };
762
+ type FeedFormat = (typeof FEED_FORMAT)[keyof typeof FEED_FORMAT];
763
+ declare class BuildFeedUseCase {
764
+ private readonly dependencies;
765
+ private readonly feed;
766
+ constructor(dependencies: ContentDependencies, feed: ContentFeedConfig);
767
+ execute(params: {
768
+ readonly companyId: string;
769
+ readonly format: FeedFormat;
770
+ readonly feedUrl?: string;
771
+ }): Promise<string>;
772
+ private toItem;
773
+ }
774
+ declare class ListSitemapEntriesUseCase {
775
+ private readonly dependencies;
776
+ private readonly feed;
777
+ constructor(dependencies: ContentDependencies, feed: ContentFeedConfig);
778
+ /** Entradas para o host juntar ao sitemap dele — o módulo não é dono do sitemap do site. */
779
+ execute(params: {
780
+ readonly companyId: string;
781
+ }): Promise<readonly SitemapEntry[]>;
782
+ }
783
+
784
+ /**
785
+ * Copyright (c) 2026 Ada Technology. MIT License.
786
+ *
787
+ * Casos de uso do painel: criar, editar, arquivar, publicar/agendar, despublicar, ler e listar.
788
+ * Todos validam a entrada com o schema do contracts de novo — o host pode chamar o use-case sem
789
+ * passar pela rota, e a regra não pode depender de quem chamou.
790
+ */
791
+
792
+ type PostReference = {
793
+ readonly companyId: string;
794
+ readonly id: string;
795
+ };
796
+ declare abstract class PostUseCaseBase {
797
+ protected readonly dependencies: ContentDependencies;
798
+ constructor(dependencies: ContentDependencies);
799
+ protected now(): Date;
800
+ protected findOrFail(reference: PostReference): Promise<PostRow>;
801
+ protected save(reference: PostReference, values: Partial<NewPostRow>, event: PostEventType): Promise<Post>;
802
+ /** Id curto livre na empresa; a colisão (~1 em 2 bilhões) só repete o sorteio. */
803
+ protected generateShortId(companyId: string): Promise<string>;
804
+ protected readingTime(body: string): number;
805
+ protected assertSlugAvailable(companyId: string, slug: string, ownId?: string): Promise<void>;
806
+ /** `titulo`, `titulo-2`, `titulo-3`… Sequencial de propósito: cada tentativa depende da anterior. */
807
+ protected generateSlug(companyId: string, title: string): Promise<string>;
808
+ protected uniqueSlug(companyId: string, base: string): Promise<string>;
809
+ }
810
+ declare class CreatePostUseCase extends PostUseCaseBase {
811
+ execute(params: {
812
+ readonly companyId: string;
813
+ readonly input: CreatePostInput;
814
+ }): Promise<Post>;
815
+ }
816
+ declare class UpdatePostUseCase extends PostUseCaseBase {
817
+ /** Trocar o título não muda o slug: o endereço já pode ter sido compartilhado. */
818
+ execute(params: PostReference & {
819
+ readonly input: UpdatePostInput;
820
+ }): Promise<Post>;
821
+ }
822
+ declare class PublishPostUseCase extends PostUseCaseBase {
823
+ /** Sem data: publica agora. Data futura: agenda. Data passada: publica com a data informada. */
824
+ execute(params: PostReference & {
825
+ readonly input?: PublishPostInput;
826
+ }): Promise<Post>;
827
+ }
828
+ declare class UnpublishPostUseCase extends PostUseCaseBase {
829
+ /** Volta a rascunho e tira do ar na hora, inclusive cancelando um agendamento. */
830
+ execute(params: PostReference): Promise<Post>;
831
+ }
832
+ declare class ArchivePostUseCase extends PostUseCaseBase {
833
+ /** "Excluir" no painel é arquivar: some do site, mas o conteúdo e o slug continuam guardados. */
834
+ execute(params: PostReference): Promise<Post>;
835
+ }
836
+ declare class GetPostUseCase extends PostUseCaseBase {
837
+ execute(params: PostReference): Promise<Post>;
838
+ }
839
+ declare class ListPostsUseCase extends PostUseCaseBase {
840
+ execute(params: {
841
+ readonly companyId: string;
842
+ } & Partial<ListPostsQuery>): Promise<Paginated<PostSummary>>;
843
+ }
844
+
845
+ /**
846
+ * Copyright (c) 2026 Ada Technology. MIT License.
847
+ *
848
+ * Leitura do site público. Só enxerga post publicado (ou agendado cuja hora chegou) da empresa
849
+ * resolvida pelo host — rascunho, arquivado e agendado futuro respondem 404, igual a inexistente.
850
+ */
851
+
852
+ declare class GetPublishedPostBySlugUseCase {
853
+ private readonly dependencies;
854
+ constructor(dependencies: ContentDependencies);
855
+ /**
856
+ * `slug` aceita o endereço canônico `<shortId>-<slug>`, o slug atual e slug antigo. O id curto
857
+ * manda: título/slug editado depois não quebra link compartilhado. O host compara `buildPostRef`
858
+ * do resultado com o pedido e redireciona (301) quando forem diferentes.
859
+ */
860
+ execute(params: {
861
+ readonly companyId: string;
862
+ readonly slug: string;
863
+ }): Promise<PublicPost>;
864
+ }
865
+ declare class ListPublishedPostsUseCase {
866
+ private readonly dependencies;
867
+ constructor(dependencies: ContentDependencies);
868
+ execute(params: {
869
+ readonly companyId: string;
870
+ } & Partial<ListPublishedPostsQuery>): Promise<Paginated<PublicPostSummary>>;
871
+ }
872
+ declare const TAG_SCOPE: {
873
+ readonly PUBLIC: "public";
874
+ readonly ADMIN: "admin";
875
+ };
876
+ type TagScope = (typeof TAG_SCOPE)[keyof typeof TAG_SCOPE];
877
+ declare class ListTagsUseCase {
878
+ private readonly dependencies;
879
+ constructor(dependencies: ContentDependencies);
880
+ /** `public` conta só posts no ar; `admin` conta todos, para o autor reaproveitar a tag. */
881
+ execute(params: {
882
+ readonly companyId: string;
883
+ readonly scope: TagScope;
884
+ }): Promise<readonly TagCount[]>;
885
+ }
886
+
887
+ /**
888
+ * Copyright (c) 2026 Ada Technology. MIT License.
889
+ *
890
+ * Regras de recorrência do painel: cada regra publica, na frequência escolhida, um post novo copiado
891
+ * de um modelo. Quem executa é o `publishDue`.
892
+ */
893
+
894
+ declare abstract class RecurrenceUseCaseBase {
895
+ protected readonly dependencies: ContentDependencies;
896
+ constructor(dependencies: ContentDependencies);
897
+ protected toRule(row: RecurrenceRow): Promise<RecurrenceRule>;
898
+ protected findOrFail(params: {
899
+ companyId: string;
900
+ id: string;
901
+ }): Promise<RecurrenceRow>;
902
+ }
903
+ declare class CreateRecurrenceUseCase extends RecurrenceUseCaseBase {
904
+ execute(params: {
905
+ readonly companyId: string;
906
+ readonly input: CreateRecurrenceInput;
907
+ }): Promise<RecurrenceRule>;
908
+ }
909
+ declare class ListRecurrencesUseCase extends RecurrenceUseCaseBase {
910
+ execute(params: {
911
+ readonly companyId: string;
912
+ }): Promise<readonly RecurrenceRule[]>;
913
+ }
914
+ declare class UpdateRecurrenceUseCase extends RecurrenceUseCaseBase {
915
+ /** Pausar/retomar e remarcar a próxima execução. */
916
+ execute(params: {
917
+ readonly companyId: string;
918
+ readonly id: string;
919
+ readonly input: UpdateRecurrenceInput;
920
+ }): Promise<RecurrenceRule>;
921
+ }
922
+ declare class RemoveRecurrenceUseCase extends RecurrenceUseCaseBase {
923
+ /** Apaga só a regra: os posts que ela já publicou continuam no ar. */
924
+ execute(params: {
925
+ readonly companyId: string;
926
+ readonly id: string;
927
+ }): Promise<void>;
928
+ }
929
+
930
+ /**
931
+ * Copyright (c) 2026 Ada Technology. MIT License.
932
+ *
933
+ * Republicar e publicar no horário. `publishDue` é o que o host chama num intervalo: marca como
934
+ * publicado o que estava agendado e já venceu, e materializa as recorrências vencidas.
935
+ */
936
+
937
+ declare class RepublishPostUseCase extends PostUseCaseBase {
938
+ /**
939
+ * Muda a data de um post JÁ publicado, mantendo o MESMO endereço. É a opção segura para SEO: o
940
+ * link antigo (compartilhado, indexado, com backlinks) continua valendo e não nasce conteúdo
941
+ * duplicado. Data futura é recusada — o post sairia do ar até lá e o leitor veria 404.
942
+ */
943
+ execute(params: PostReference & {
944
+ readonly input?: RepublishPostInput;
945
+ }): Promise<Post>;
946
+ }
947
+ type PublishDueResult = {
948
+ readonly published: number;
949
+ readonly materialized: number;
950
+ };
951
+ declare class PublishDueUseCase extends PostUseCaseBase {
952
+ /**
953
+ * Idempotente e seguro com várias instâncias chamando ao mesmo tempo: cada post/regra é reclamado
954
+ * por uma só execução. Sem trabalho vencido, não faz nada. `now` existe para teste e reprocesso.
955
+ */
956
+ execute(params?: {
957
+ readonly now?: Date;
958
+ readonly limit?: number;
959
+ }): Promise<PublishDueResult>;
960
+ private materializeRecurrences;
961
+ /** Um post publicado agora a partir do modelo; a regra avança para a próxima data futura. */
962
+ private materialize;
963
+ }
964
+
965
+ /**
966
+ * Copyright (c) 2026 Ada Technology. MIT License.
967
+ *
968
+ * Modelos de post: salvar um post como modelo e criar um post novo a partir de um modelo. Modelo é
969
+ * post com `isTemplate`: nunca vai ao ar, não aparece na lista de posts e não tem endereço público.
970
+ */
971
+
972
+ declare abstract class TemplateUseCaseBase extends PostUseCaseBase {
973
+ protected insertCopy(params: {
974
+ readonly companyId: string;
975
+ readonly slug: string;
976
+ readonly title: string;
977
+ readonly source: PostRow;
978
+ readonly isTemplate: boolean;
979
+ readonly status?: string;
980
+ readonly publishedAt?: Date;
981
+ }): Promise<Post>;
982
+ }
983
+ declare class SaveAsTemplateUseCase extends TemplateUseCaseBase {
984
+ /** Copia o post (qualquer status) para um modelo. O original não muda. */
985
+ execute(params: PostReference & {
986
+ readonly input?: SaveAsTemplateInput;
987
+ }): Promise<Post>;
988
+ }
989
+ declare class CreateFromTemplateUseCase extends TemplateUseCaseBase {
990
+ /** Cria um RASCUNHO novo com o conteúdo do modelo, pronto para editar e publicar. */
991
+ execute(params: PostReference & {
992
+ readonly input?: CreateFromTemplateInput;
993
+ }): Promise<Post>;
994
+ }
995
+ declare class CountPostsUseCase extends PostUseCaseBase {
996
+ /** Números das abas do painel, numa consulta só. */
997
+ execute(params: {
998
+ readonly companyId: string;
999
+ }): Promise<PostCounts>;
1000
+ }
1001
+
1002
+ /**
1003
+ * Copyright (c) 2026 Ada Technology. MIT License.
1004
+ *
1005
+ * Upload da capa. O bucket é do host (`ContentImageStoragePort`); aqui ficam as decisões que não
1006
+ * variam por instalação: formatos aceitos, teto de tamanho e forma da chave.
1007
+ */
1008
+
1009
+ type UploadCoverImageParams = {
1010
+ readonly companyId: string;
1011
+ readonly bytes: Uint8Array;
1012
+ readonly mimeType: string;
1013
+ };
1014
+ type UploadCoverImageResult = {
1015
+ readonly url: string;
1016
+ readonly key: string;
1017
+ };
1018
+ declare class UploadCoverImageUseCase {
1019
+ private readonly dependencies;
1020
+ constructor(dependencies: ContentDependencies);
1021
+ execute(params: UploadCoverImageParams): Promise<UploadCoverImageResult>;
1022
+ }
1023
+
1024
+ /**
1025
+ * Copyright (c) 2026 Ada Technology. MIT License.
1026
+ *
1027
+ * Composição raiz do módulo de conteúdo (blog, novidades, notícias). Recebe a conexão Drizzle do
1028
+ * host e devolve os use-cases; as rotas saem de `createContentRoutes` sobre este objeto.
1029
+ */
1030
+
1031
+ type ContentModuleProviders = {
1032
+ /** Sem storage, a capa é só por URL e a rota de upload não sobe. */
1033
+ readonly imageStorage?: ContentImageStoragePort;
1034
+ /** Padrão: relógio do sistema. Os testes injetam um fixo para provar o agendamento. */
1035
+ readonly clock?: ClockPort;
1036
+ readonly logger?: LoggerPort;
1037
+ /** Troca a persistência (ex.: dublê em memória num teste do host). Padrão: Drizzle sobre `db`. */
1038
+ readonly postStore?: PostStorePort;
1039
+ readonly recurrenceStore?: RecurrenceStorePort;
1040
+ };
1041
+ type CreateContentModuleParams = {
1042
+ readonly db?: ContentDatabase;
1043
+ readonly config?: ContentModuleConfig;
1044
+ readonly providers?: ContentModuleProviders;
1045
+ readonly hooks?: ContentHooks;
1046
+ };
1047
+ type ContentModule = {
1048
+ readonly useCases: {
1049
+ readonly createPost: CreatePostUseCase;
1050
+ readonly updatePost: UpdatePostUseCase;
1051
+ readonly archivePost: ArchivePostUseCase;
1052
+ readonly publishPost: PublishPostUseCase;
1053
+ readonly unpublishPost: UnpublishPostUseCase;
1054
+ readonly getPost: GetPostUseCase;
1055
+ readonly listPosts: ListPostsUseCase;
1056
+ readonly getPublishedPostBySlug: GetPublishedPostBySlugUseCase;
1057
+ readonly listPublishedPosts: ListPublishedPostsUseCase;
1058
+ readonly listTags: ListTagsUseCase;
1059
+ readonly countPosts: CountPostsUseCase;
1060
+ readonly saveAsTemplate: SaveAsTemplateUseCase;
1061
+ readonly createFromTemplate: CreateFromTemplateUseCase;
1062
+ readonly republishPost: RepublishPostUseCase;
1063
+ readonly createRecurrence: CreateRecurrenceUseCase;
1064
+ readonly listRecurrences: ListRecurrencesUseCase;
1065
+ readonly updateRecurrence: UpdateRecurrenceUseCase;
1066
+ readonly removeRecurrence: RemoveRecurrenceUseCase;
1067
+ /** O host chama num intervalo (ver `startContentScheduler`): publica o agendado vencido e as recorrências. */
1068
+ readonly publishDue: PublishDueUseCase;
1069
+ /** Capacidade por ausência: sem `providers.imageStorage`, não existe. */
1070
+ readonly uploadCoverImage?: UploadCoverImageUseCase;
1071
+ /** Sem `config.feed`, feed e sitemap não existem. */
1072
+ readonly buildFeed?: BuildFeedUseCase;
1073
+ readonly listSitemapEntries?: ListSitemapEntriesUseCase;
1074
+ };
1075
+ readonly config: ContentModuleConfig;
1076
+ };
1077
+ declare function createContentModule(params: CreateContentModuleParams): ContentModule;
1078
+
1079
+ /**
1080
+ * Copyright (c) 2026 Ada Technology. MIT License.
1081
+ *
1082
+ * Rotas do site público. Sem identidade: a empresa vem do `PublicCompanyResolverPort` do host
1083
+ * (domínio, cabeçalho, empresa fixa…). Resolver sem resposta = 404, igual a post inexistente.
1084
+ */
1085
+
1086
+ interface PublicCompanyResolverPort {
1087
+ resolve(params: {
1088
+ readonly headers: Readonly<Record<string, string>>;
1089
+ readonly query: Readonly<Record<string, string>>;
1090
+ }): Promise<string | undefined>;
1091
+ }
1092
+
1093
+ /**
1094
+ * Copyright (c) 2026 Ada Technology. MIT License.
1095
+ */
1096
+
1097
+ type CreateContentRoutesParams = {
1098
+ readonly module: ContentModule;
1099
+ /**
1100
+ * Como o site público diz de qual empresa é o blog (domínio, cabeçalho, valor fixo…). Ausente,
1101
+ * as rotas `/public/*` não sobem: o host que só tem painel não expõe leitura anônima.
1102
+ */
1103
+ readonly publicCompanyResolver?: PublicCompanyResolverPort;
1104
+ };
1105
+ declare function createContentRoutes(params: CreateContentRoutesParams): ModuleRouteTable;
1106
+
1107
+ /**
1108
+ * Copyright (c) 2026 Ada Technology. MIT License.
1109
+ */
1110
+
1111
+ declare const CONTENT_MIGRATIONS_TABLE = "content_migrations";
1112
+ /** Pasta no formato clássico (`meta/_journal.json`), lida pelos migrators do drizzle 0.x e 1.x. */
1113
+ declare function contentMigrationsFolder(): string;
1114
+ type RunContentMigrationsParams = {
1115
+ readonly db: ContentDatabase;
1116
+ /** O `migrate` do driver do host (`drizzle-orm/node-postgres/migrator`, `.../bun-sql/migrator`…). */
1117
+ readonly migrate: DrizzleMigrateFunction;
1118
+ };
1119
+ declare function runContentMigrations(params: RunContentMigrationsParams): Promise<void>;
1120
+
1121
+ /**
1122
+ * Copyright (c) 2026 Ada Technology. MIT License.
1123
+ */
1124
+
1125
+ declare class PostRepository implements PostStorePort {
1126
+ private readonly db;
1127
+ constructor(db: ContentDatabase);
1128
+ create(values: NewPostRow): Promise<PostRow>;
1129
+ findById(params: {
1130
+ companyId: string;
1131
+ id: string;
1132
+ }): Promise<PostRow | undefined>;
1133
+ findBySlug(params: {
1134
+ companyId: string;
1135
+ slug: string;
1136
+ }): Promise<PostRow | undefined>;
1137
+ findPublicBySlug(params: {
1138
+ companyId: string;
1139
+ slug: string;
1140
+ now: Date;
1141
+ }): Promise<PostRow | undefined>;
1142
+ findByShortId(params: {
1143
+ companyId: string;
1144
+ shortId: string;
1145
+ }): Promise<PostRow | undefined>;
1146
+ findPublicByShortId(params: {
1147
+ companyId: string;
1148
+ shortId: string;
1149
+ now: Date;
1150
+ }): Promise<PostRow | undefined>;
1151
+ findPublicByFormerSlug(params: {
1152
+ companyId: string;
1153
+ slug: string;
1154
+ now: Date;
1155
+ }): Promise<PostRow | undefined>;
1156
+ recordFormerSlug(params: {
1157
+ companyId: string;
1158
+ postId: string;
1159
+ slug: string;
1160
+ }): Promise<void>;
1161
+ update(params: {
1162
+ companyId: string;
1163
+ id: string;
1164
+ values: Partial<NewPostRow>;
1165
+ }): Promise<PostRow | undefined>;
1166
+ listForAdmin(query: PostAdminListQuery): Promise<PostPage>;
1167
+ listPublic(query: PostPublicListQuery): Promise<PostPage>;
1168
+ countByStatus(params: {
1169
+ companyId: string;
1170
+ now: Date;
1171
+ }): Promise<PostCounts>;
1172
+ claimDueScheduled(params: {
1173
+ now: Date;
1174
+ limit: number;
1175
+ }): Promise<readonly PostRow[]>;
1176
+ listTags(params: {
1177
+ companyId: string;
1178
+ publicAt?: Date;
1179
+ }): Promise<readonly TagCount[]>;
1180
+ }
1181
+
1182
+ declare class RecurrenceRepository implements RecurrenceStorePort {
1183
+ private readonly db;
1184
+ constructor(db: ContentDatabase);
1185
+ create(values: NewRecurrenceRow): Promise<RecurrenceRow>;
1186
+ findById(params: {
1187
+ companyId: string;
1188
+ id: string;
1189
+ }): Promise<RecurrenceRow | undefined>;
1190
+ list(params: {
1191
+ companyId: string;
1192
+ }): Promise<readonly RecurrenceRow[]>;
1193
+ update(params: {
1194
+ companyId: string;
1195
+ id: string;
1196
+ values: Partial<NewRecurrenceRow>;
1197
+ }): Promise<RecurrenceRow | undefined>;
1198
+ remove(params: {
1199
+ companyId: string;
1200
+ id: string;
1201
+ }): Promise<boolean>;
1202
+ processDue(params: {
1203
+ now: Date;
1204
+ limit: number;
1205
+ handle: (rule: RecurrenceRow) => Promise<Partial<NewRecurrenceRow>>;
1206
+ }): Promise<number>;
1207
+ }
1208
+
1209
+ /**
1210
+ * Copyright (c) 2026 Ada Technology. MIT License.
1211
+ */
1212
+ /**
1213
+ * 1 MiB é o teto de corpo do `module-http`: um limite maior aqui seria promessa que a rota não
1214
+ * cumpre. O `content-ui` avisa antes de enviar; o servidor recusa de novo porque o cliente não é
1215
+ * fonte de verdade.
1216
+ */
1217
+ declare const COVER_IMAGE: {
1218
+ readonly MAX_BYTES: number;
1219
+ readonly KEY_PREFIX: "content/posts";
1220
+ readonly EXTENSION_BY_MIME: Readonly<Record<string, string | undefined>>;
1221
+ };
1222
+
1223
+ /**
1224
+ * Copyright (c) 2026 Ada Technology. MIT License.
1225
+ *
1226
+ * Dublê em memória do `PostStorePort`, para a suíte de comportamento do módulo e para o teste do
1227
+ * host. O isolamento real (cláusula SQL) é provado em `repositories/isolation.test.ts`; aqui as
1228
+ * mesmas regras são reproduzidas em JavaScript, inclusive a violação de índice único do slug.
1229
+ */
1230
+
1231
+ declare function createInMemoryPostStore(seed?: PostRow[]): PostStorePort & {
1232
+ readonly rows: PostRow[];
1233
+ };
1234
+
1235
+ /**
1236
+ * Copyright (c) 2026 Ada Technology. MIT License.
1237
+ *
1238
+ * Datas da recorrência, sempre em UTC: o instante de cada execução não depende do fuso do servidor.
1239
+ */
1240
+
1241
+ declare function nextOccurrence(params: {
1242
+ frequency: RecurrenceFrequency;
1243
+ from: Date;
1244
+ anchorDay: number;
1245
+ }): Date;
1246
+ /**
1247
+ * Primeira ocorrência estritamente depois de `now`. Servidor parado três semanas publica UM post ao
1248
+ * voltar, não três: as ocorrências perdidas são puladas, nunca emitidas em rajada.
1249
+ */
1250
+ declare function nextOccurrenceAfter(params: {
1251
+ frequency: RecurrenceFrequency;
1252
+ from: Date;
1253
+ anchorDay: number;
1254
+ now: Date;
1255
+ }): Date;
1256
+
1257
+ /**
1258
+ * Copyright (c) 2026 Ada Technology. MIT License.
1259
+ */
1260
+
1261
+ declare const DEFAULT_SCHEDULER_INTERVAL_MS = 60000;
1262
+ type StartContentSchedulerParams = {
1263
+ readonly module: ContentModule;
1264
+ /** Padrão: 1 minuto. */
1265
+ readonly intervalMs?: number;
1266
+ readonly logger?: LoggerPort;
1267
+ };
1268
+ /**
1269
+ * Chama `publishDue` num intervalo, com guarda de execução única neste processo: se um ciclo ainda
1270
+ * está rodando, o próximo tick é pulado em vez de empilhar. Entre instâncias, quem garante é o
1271
+ * `FOR UPDATE SKIP LOCKED` do store. Erro de um ciclo é logado e o seguinte tenta de novo.
1272
+ * Devolve a função que para o agendador (chame no desligamento).
1273
+ */
1274
+ declare function startContentScheduler(params: StartContentSchedulerParams): () => void;
1275
+
1276
+ /**
1277
+ * Copyright (c) 2026 Ada Technology. MIT License.
1278
+ *
1279
+ * Dublê em memória do `RecurrenceStorePort`: mesmas regras, sem transação (o teste é de um processo só).
1280
+ */
1281
+
1282
+ declare function createInMemoryRecurrenceStore(): RecurrenceStorePort & {
1283
+ readonly rows: RecurrenceRow[];
1284
+ };
1285
+
1286
+ export { ArchivePostUseCase, BuildFeedUseCase, CONTENT_MIGRATIONS_TABLE, COVER_IMAGE, type ContentDatabase, type ContentDependencies, type ContentModule, type ContentModuleProviders, CountPostsUseCase, type CreateContentModuleParams, type CreateContentRoutesParams, CreateFromTemplateUseCase, CreatePostUseCase, CreateRecurrenceUseCase, DEFAULT_SCHEDULER_INTERVAL_MS, type DrizzleMigrateFunction, FEED_FORMAT, type FeedFormat, GetPostUseCase, GetPublishedPostBySlugUseCase, ListPostsUseCase, ListPublishedPostsUseCase, ListRecurrencesUseCase, ListSitemapEntriesUseCase, ListTagsUseCase, type NewPostRow, type NewRecurrenceRow, type PostAdminListQuery, type PostPage, type PostPublicListQuery, type PostReference, PostRepository, type PostRow, type PostStorePort, type PublicCompanyResolverPort, type PublishDueResult, PublishDueUseCase, PublishPostUseCase, RecurrenceRepository, type RecurrenceRow, type RecurrenceStorePort, RemoveRecurrenceUseCase, RepublishPostUseCase, type RunContentMigrationsParams, SaveAsTemplateUseCase, type StartContentSchedulerParams, TAG_SCOPE, type TagScope, UnpublishPostUseCase, UpdatePostUseCase, UpdateRecurrenceUseCase, type UploadCoverImageParams, type UploadCoverImageResult, UploadCoverImageUseCase, contentMigrationsFolder, contentSchema, createContentModule, createContentRoutes, createInMemoryPostStore, createInMemoryRecurrenceStore, nextOccurrence, nextOccurrenceAfter, posts, recurrenceRules, runContentMigrations, startContentScheduler };