@adatechnology/content-module 0.0.0-stage → 0.1.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,743 @@
1
+ import { PostStatus, TagCount, ContentModuleConfig, ClockPort, ContentHooks, ContentImageStoragePort, LoggerPort, ContentFeedConfig, SitemapEntry, PostEventType, Post, CreatePostInput, UpdatePostInput, PublishPostInput, ListPostsQuery, Paginated, PostSummary, PublicPost, ListPublishedPostsQuery, PublicPostSummary } 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
+ title: drizzle_orm_pg_core.PgColumn<{
79
+ name: "title";
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: 200;
96
+ }>;
97
+ excerpt: drizzle_orm_pg_core.PgColumn<{
98
+ name: "excerpt";
99
+ tableName: "posts";
100
+ dataType: "string";
101
+ columnType: "PgVarchar";
102
+ data: string;
103
+ driverParam: string;
104
+ notNull: false;
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: 500;
115
+ }>;
116
+ body: drizzle_orm_pg_core.PgColumn<{
117
+ name: "body";
118
+ tableName: "posts";
119
+ dataType: "string";
120
+ columnType: "PgText";
121
+ data: string;
122
+ driverParam: string;
123
+ notNull: true;
124
+ hasDefault: true;
125
+ isPrimaryKey: false;
126
+ isAutoincrement: false;
127
+ hasRuntimeDefault: false;
128
+ enumValues: [string, ...string[]];
129
+ baseColumn: never;
130
+ identity: undefined;
131
+ generated: undefined;
132
+ }, {}, {}>;
133
+ coverImageUrl: drizzle_orm_pg_core.PgColumn<{
134
+ name: "cover_image_url";
135
+ tableName: "posts";
136
+ dataType: "string";
137
+ columnType: "PgVarchar";
138
+ data: string;
139
+ driverParam: string;
140
+ notNull: false;
141
+ hasDefault: false;
142
+ isPrimaryKey: false;
143
+ isAutoincrement: false;
144
+ hasRuntimeDefault: false;
145
+ enumValues: [string, ...string[]];
146
+ baseColumn: never;
147
+ identity: undefined;
148
+ generated: undefined;
149
+ }, {}, {
150
+ length: 2048;
151
+ }>;
152
+ coverImageAlt: drizzle_orm_pg_core.PgColumn<{
153
+ name: "cover_image_alt";
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: 300;
170
+ }>;
171
+ tags: drizzle_orm_pg_core.PgColumn<{
172
+ name: "tags";
173
+ tableName: "posts";
174
+ dataType: "array";
175
+ columnType: "PgArray";
176
+ data: string[];
177
+ driverParam: string | string[];
178
+ notNull: true;
179
+ hasDefault: true;
180
+ isPrimaryKey: false;
181
+ isAutoincrement: false;
182
+ hasRuntimeDefault: false;
183
+ enumValues: [string, ...string[]];
184
+ baseColumn: drizzle_orm.Column<{
185
+ name: "tags";
186
+ tableName: "posts";
187
+ dataType: "string";
188
+ columnType: "PgText";
189
+ data: string;
190
+ driverParam: string;
191
+ notNull: false;
192
+ hasDefault: false;
193
+ isPrimaryKey: false;
194
+ isAutoincrement: false;
195
+ hasRuntimeDefault: false;
196
+ enumValues: [string, ...string[]];
197
+ baseColumn: never;
198
+ identity: undefined;
199
+ generated: undefined;
200
+ }, {}, {}>;
201
+ identity: undefined;
202
+ generated: undefined;
203
+ }, {}, {
204
+ baseBuilder: drizzle_orm_pg_core.PgColumnBuilder<{
205
+ name: "tags";
206
+ dataType: "string";
207
+ columnType: "PgText";
208
+ data: string;
209
+ enumValues: [string, ...string[]];
210
+ driverParam: string;
211
+ }, {}, {}, drizzle_orm.ColumnBuilderExtraConfig>;
212
+ size: undefined;
213
+ }>;
214
+ status: drizzle_orm_pg_core.PgColumn<{
215
+ name: "status";
216
+ tableName: "posts";
217
+ dataType: "string";
218
+ columnType: "PgVarchar";
219
+ data: string;
220
+ driverParam: string;
221
+ notNull: true;
222
+ hasDefault: true;
223
+ isPrimaryKey: false;
224
+ isAutoincrement: false;
225
+ hasRuntimeDefault: false;
226
+ enumValues: [string, ...string[]];
227
+ baseColumn: never;
228
+ identity: undefined;
229
+ generated: undefined;
230
+ }, {}, {
231
+ length: 12;
232
+ }>;
233
+ publishedAt: drizzle_orm_pg_core.PgColumn<{
234
+ name: "published_at";
235
+ tableName: "posts";
236
+ dataType: "date";
237
+ columnType: "PgTimestamp";
238
+ data: Date;
239
+ driverParam: string;
240
+ notNull: false;
241
+ hasDefault: false;
242
+ isPrimaryKey: false;
243
+ isAutoincrement: false;
244
+ hasRuntimeDefault: false;
245
+ enumValues: undefined;
246
+ baseColumn: never;
247
+ identity: undefined;
248
+ generated: undefined;
249
+ }, {}, {}>;
250
+ authorName: drizzle_orm_pg_core.PgColumn<{
251
+ name: "author_name";
252
+ tableName: "posts";
253
+ dataType: "string";
254
+ columnType: "PgVarchar";
255
+ data: string;
256
+ driverParam: string;
257
+ notNull: false;
258
+ hasDefault: false;
259
+ isPrimaryKey: false;
260
+ isAutoincrement: false;
261
+ hasRuntimeDefault: false;
262
+ enumValues: [string, ...string[]];
263
+ baseColumn: never;
264
+ identity: undefined;
265
+ generated: undefined;
266
+ }, {}, {
267
+ length: 120;
268
+ }>;
269
+ seoTitle: drizzle_orm_pg_core.PgColumn<{
270
+ name: "seo_title";
271
+ tableName: "posts";
272
+ dataType: "string";
273
+ columnType: "PgVarchar";
274
+ data: string;
275
+ driverParam: string;
276
+ notNull: false;
277
+ hasDefault: false;
278
+ isPrimaryKey: false;
279
+ isAutoincrement: false;
280
+ hasRuntimeDefault: false;
281
+ enumValues: [string, ...string[]];
282
+ baseColumn: never;
283
+ identity: undefined;
284
+ generated: undefined;
285
+ }, {}, {
286
+ length: 200;
287
+ }>;
288
+ seoDescription: drizzle_orm_pg_core.PgColumn<{
289
+ name: "seo_description";
290
+ tableName: "posts";
291
+ dataType: "string";
292
+ columnType: "PgVarchar";
293
+ data: string;
294
+ driverParam: string;
295
+ notNull: false;
296
+ hasDefault: false;
297
+ isPrimaryKey: false;
298
+ isAutoincrement: false;
299
+ hasRuntimeDefault: false;
300
+ enumValues: [string, ...string[]];
301
+ baseColumn: never;
302
+ identity: undefined;
303
+ generated: undefined;
304
+ }, {}, {
305
+ length: 320;
306
+ }>;
307
+ canonicalUrl: drizzle_orm_pg_core.PgColumn<{
308
+ name: "canonical_url";
309
+ tableName: "posts";
310
+ dataType: "string";
311
+ columnType: "PgVarchar";
312
+ data: string;
313
+ driverParam: string;
314
+ notNull: false;
315
+ hasDefault: false;
316
+ isPrimaryKey: false;
317
+ isAutoincrement: false;
318
+ hasRuntimeDefault: false;
319
+ enumValues: [string, ...string[]];
320
+ baseColumn: never;
321
+ identity: undefined;
322
+ generated: undefined;
323
+ }, {}, {
324
+ length: 2048;
325
+ }>;
326
+ readingTimeMinutes: drizzle_orm_pg_core.PgColumn<{
327
+ name: "reading_time_minutes";
328
+ tableName: "posts";
329
+ dataType: "number";
330
+ columnType: "PgInteger";
331
+ data: number;
332
+ driverParam: string | number;
333
+ notNull: true;
334
+ hasDefault: true;
335
+ isPrimaryKey: false;
336
+ isAutoincrement: false;
337
+ hasRuntimeDefault: false;
338
+ enumValues: undefined;
339
+ baseColumn: never;
340
+ identity: undefined;
341
+ generated: undefined;
342
+ }, {}, {}>;
343
+ createdAt: drizzle_orm_pg_core.PgColumn<{
344
+ name: "created_at";
345
+ tableName: "posts";
346
+ dataType: "date";
347
+ columnType: "PgTimestamp";
348
+ data: Date;
349
+ driverParam: string;
350
+ notNull: true;
351
+ hasDefault: true;
352
+ isPrimaryKey: false;
353
+ isAutoincrement: false;
354
+ hasRuntimeDefault: false;
355
+ enumValues: undefined;
356
+ baseColumn: never;
357
+ identity: undefined;
358
+ generated: undefined;
359
+ }, {}, {}>;
360
+ updatedAt: drizzle_orm_pg_core.PgColumn<{
361
+ name: "updated_at";
362
+ tableName: "posts";
363
+ dataType: "date";
364
+ columnType: "PgTimestamp";
365
+ data: Date;
366
+ driverParam: string;
367
+ notNull: true;
368
+ hasDefault: true;
369
+ isPrimaryKey: false;
370
+ isAutoincrement: false;
371
+ hasRuntimeDefault: false;
372
+ enumValues: undefined;
373
+ baseColumn: never;
374
+ identity: undefined;
375
+ generated: undefined;
376
+ }, {}, {}>;
377
+ };
378
+ dialect: "pg";
379
+ }>;
380
+ type PostRow = typeof posts.$inferSelect;
381
+ type NewPostRow = typeof posts.$inferInsert;
382
+
383
+ /**
384
+ * Copyright (c) 2026 Ada Technology. MIT License.
385
+ */
386
+
387
+ type PostPage = {
388
+ readonly rows: readonly PostRow[];
389
+ readonly total: number;
390
+ };
391
+ type PostAdminListQuery = {
392
+ readonly companyId: string;
393
+ readonly page: number;
394
+ readonly pageSize: number;
395
+ readonly status?: PostStatus;
396
+ readonly tag?: string;
397
+ readonly search?: string;
398
+ readonly now: Date;
399
+ };
400
+ type PostPublicListQuery = {
401
+ readonly companyId: string;
402
+ readonly now: Date;
403
+ readonly page: number;
404
+ readonly pageSize: number;
405
+ readonly tag?: string;
406
+ };
407
+ /**
408
+ * Porta de persistência dos use-cases. `PostRepository` é a implementação Drizzle; os testes usam
409
+ * o dublê em memória de `testing/`. Toda operação recebe `companyId` — não existe leitura sem empresa.
410
+ */
411
+ interface PostStorePort {
412
+ create(values: NewPostRow): Promise<PostRow>;
413
+ findById(params: {
414
+ readonly companyId: string;
415
+ readonly id: string;
416
+ }): Promise<PostRow | undefined>;
417
+ findBySlug(params: {
418
+ readonly companyId: string;
419
+ readonly slug: string;
420
+ }): Promise<PostRow | undefined>;
421
+ findPublicBySlug(params: {
422
+ readonly companyId: string;
423
+ readonly slug: string;
424
+ readonly now: Date;
425
+ }): Promise<PostRow | undefined>;
426
+ update(params: {
427
+ readonly companyId: string;
428
+ readonly id: string;
429
+ readonly values: Partial<NewPostRow>;
430
+ }): Promise<PostRow | undefined>;
431
+ listForAdmin(query: PostAdminListQuery): Promise<PostPage>;
432
+ listPublic(query: PostPublicListQuery): Promise<PostPage>;
433
+ listTags(params: {
434
+ readonly companyId: string;
435
+ readonly publicAt?: Date;
436
+ }): Promise<readonly TagCount[]>;
437
+ }
438
+ type ContentDependencies = {
439
+ readonly posts: PostStorePort;
440
+ readonly config: ContentModuleConfig;
441
+ readonly clock: ClockPort;
442
+ readonly hooks?: ContentHooks;
443
+ readonly imageStorage?: ContentImageStoragePort;
444
+ readonly logger?: LoggerPort;
445
+ };
446
+
447
+ /**
448
+ * Copyright (c) 2026 Ada Technology. MIT License.
449
+ *
450
+ * RSS, Atom e entradas de sitemap do site público, a partir de `config.feed`. Sem essa config os
451
+ * use-cases nem são construídos e as rotas não sobem.
452
+ */
453
+
454
+ declare const FEED_FORMAT: {
455
+ readonly RSS: "rss";
456
+ readonly ATOM: "atom";
457
+ };
458
+ type FeedFormat = (typeof FEED_FORMAT)[keyof typeof FEED_FORMAT];
459
+ declare class BuildFeedUseCase {
460
+ private readonly dependencies;
461
+ private readonly feed;
462
+ constructor(dependencies: ContentDependencies, feed: ContentFeedConfig);
463
+ execute(params: {
464
+ readonly companyId: string;
465
+ readonly format: FeedFormat;
466
+ readonly feedUrl?: string;
467
+ }): Promise<string>;
468
+ private toItem;
469
+ }
470
+ declare class ListSitemapEntriesUseCase {
471
+ private readonly dependencies;
472
+ private readonly feed;
473
+ constructor(dependencies: ContentDependencies, feed: ContentFeedConfig);
474
+ /** Entradas para o host juntar ao sitemap dele — o módulo não é dono do sitemap do site. */
475
+ execute(params: {
476
+ readonly companyId: string;
477
+ }): Promise<readonly SitemapEntry[]>;
478
+ }
479
+
480
+ /**
481
+ * Copyright (c) 2026 Ada Technology. MIT License.
482
+ *
483
+ * Casos de uso do painel: criar, editar, arquivar, publicar/agendar, despublicar, ler e listar.
484
+ * Todos validam a entrada com o schema do contracts de novo — o host pode chamar o use-case sem
485
+ * passar pela rota, e a regra não pode depender de quem chamou.
486
+ */
487
+
488
+ type PostReference = {
489
+ readonly companyId: string;
490
+ readonly id: string;
491
+ };
492
+ declare abstract class PostUseCaseBase {
493
+ protected readonly dependencies: ContentDependencies;
494
+ constructor(dependencies: ContentDependencies);
495
+ protected now(): Date;
496
+ protected findOrFail(reference: PostReference): Promise<PostRow>;
497
+ protected save(reference: PostReference, values: Partial<NewPostRow>, event: PostEventType): Promise<Post>;
498
+ protected readingTime(body: string): number;
499
+ protected assertSlugAvailable(companyId: string, slug: string, ownId?: string): Promise<void>;
500
+ /** `titulo`, `titulo-2`, `titulo-3`… Sequencial de propósito: cada tentativa depende da anterior. */
501
+ protected generateSlug(companyId: string, title: string): Promise<string>;
502
+ }
503
+ declare class CreatePostUseCase extends PostUseCaseBase {
504
+ execute(params: {
505
+ readonly companyId: string;
506
+ readonly input: CreatePostInput;
507
+ }): Promise<Post>;
508
+ }
509
+ declare class UpdatePostUseCase extends PostUseCaseBase {
510
+ /** Trocar o título não muda o slug: o endereço já pode ter sido compartilhado. */
511
+ execute(params: PostReference & {
512
+ readonly input: UpdatePostInput;
513
+ }): Promise<Post>;
514
+ }
515
+ declare class PublishPostUseCase extends PostUseCaseBase {
516
+ /** Sem data: publica agora. Data futura: agenda. Data passada: publica com a data informada. */
517
+ execute(params: PostReference & {
518
+ readonly input?: PublishPostInput;
519
+ }): Promise<Post>;
520
+ }
521
+ declare class UnpublishPostUseCase extends PostUseCaseBase {
522
+ /** Volta a rascunho e tira do ar na hora, inclusive cancelando um agendamento. */
523
+ execute(params: PostReference): Promise<Post>;
524
+ }
525
+ declare class ArchivePostUseCase extends PostUseCaseBase {
526
+ /** "Excluir" no painel é arquivar: some do site, mas o conteúdo e o slug continuam guardados. */
527
+ execute(params: PostReference): Promise<Post>;
528
+ }
529
+ declare class GetPostUseCase extends PostUseCaseBase {
530
+ execute(params: PostReference): Promise<Post>;
531
+ }
532
+ declare class ListPostsUseCase extends PostUseCaseBase {
533
+ execute(params: {
534
+ readonly companyId: string;
535
+ } & Partial<ListPostsQuery>): Promise<Paginated<PostSummary>>;
536
+ }
537
+
538
+ /**
539
+ * Copyright (c) 2026 Ada Technology. MIT License.
540
+ *
541
+ * Leitura do site público. Só enxerga post publicado (ou agendado cuja hora chegou) da empresa
542
+ * resolvida pelo host — rascunho, arquivado e agendado futuro respondem 404, igual a inexistente.
543
+ */
544
+
545
+ declare class GetPublishedPostBySlugUseCase {
546
+ private readonly dependencies;
547
+ constructor(dependencies: ContentDependencies);
548
+ execute(params: {
549
+ readonly companyId: string;
550
+ readonly slug: string;
551
+ }): Promise<PublicPost>;
552
+ }
553
+ declare class ListPublishedPostsUseCase {
554
+ private readonly dependencies;
555
+ constructor(dependencies: ContentDependencies);
556
+ execute(params: {
557
+ readonly companyId: string;
558
+ } & Partial<ListPublishedPostsQuery>): Promise<Paginated<PublicPostSummary>>;
559
+ }
560
+ declare const TAG_SCOPE: {
561
+ readonly PUBLIC: "public";
562
+ readonly ADMIN: "admin";
563
+ };
564
+ type TagScope = (typeof TAG_SCOPE)[keyof typeof TAG_SCOPE];
565
+ declare class ListTagsUseCase {
566
+ private readonly dependencies;
567
+ constructor(dependencies: ContentDependencies);
568
+ /** `public` conta só posts no ar; `admin` conta todos, para o autor reaproveitar a tag. */
569
+ execute(params: {
570
+ readonly companyId: string;
571
+ readonly scope: TagScope;
572
+ }): Promise<readonly TagCount[]>;
573
+ }
574
+
575
+ /**
576
+ * Copyright (c) 2026 Ada Technology. MIT License.
577
+ *
578
+ * Upload da capa. O bucket é do host (`ContentImageStoragePort`); aqui ficam as decisões que não
579
+ * variam por instalação: formatos aceitos, teto de tamanho e forma da chave.
580
+ */
581
+
582
+ type UploadCoverImageParams = {
583
+ readonly companyId: string;
584
+ readonly bytes: Uint8Array;
585
+ readonly mimeType: string;
586
+ };
587
+ type UploadCoverImageResult = {
588
+ readonly url: string;
589
+ readonly key: string;
590
+ };
591
+ declare class UploadCoverImageUseCase {
592
+ private readonly dependencies;
593
+ constructor(dependencies: ContentDependencies);
594
+ execute(params: UploadCoverImageParams): Promise<UploadCoverImageResult>;
595
+ }
596
+
597
+ /**
598
+ * Copyright (c) 2026 Ada Technology. MIT License.
599
+ *
600
+ * Composição raiz do módulo de conteúdo (blog, novidades, notícias). Recebe a conexão Drizzle do
601
+ * host e devolve os use-cases; as rotas saem de `createContentRoutes` sobre este objeto.
602
+ */
603
+
604
+ type ContentModuleProviders = {
605
+ /** Sem storage, a capa é só por URL e a rota de upload não sobe. */
606
+ readonly imageStorage?: ContentImageStoragePort;
607
+ /** Padrão: relógio do sistema. Os testes injetam um fixo para provar o agendamento. */
608
+ readonly clock?: ClockPort;
609
+ readonly logger?: LoggerPort;
610
+ /** Troca a persistência (ex.: dublê em memória num teste do host). Padrão: Drizzle sobre `db`. */
611
+ readonly postStore?: PostStorePort;
612
+ };
613
+ type CreateContentModuleParams = {
614
+ readonly db?: ContentDatabase;
615
+ readonly config?: ContentModuleConfig;
616
+ readonly providers?: ContentModuleProviders;
617
+ readonly hooks?: ContentHooks;
618
+ };
619
+ type ContentModule = {
620
+ readonly useCases: {
621
+ readonly createPost: CreatePostUseCase;
622
+ readonly updatePost: UpdatePostUseCase;
623
+ readonly archivePost: ArchivePostUseCase;
624
+ readonly publishPost: PublishPostUseCase;
625
+ readonly unpublishPost: UnpublishPostUseCase;
626
+ readonly getPost: GetPostUseCase;
627
+ readonly listPosts: ListPostsUseCase;
628
+ readonly getPublishedPostBySlug: GetPublishedPostBySlugUseCase;
629
+ readonly listPublishedPosts: ListPublishedPostsUseCase;
630
+ readonly listTags: ListTagsUseCase;
631
+ /** Capacidade por ausência: sem `providers.imageStorage`, não existe. */
632
+ readonly uploadCoverImage?: UploadCoverImageUseCase;
633
+ /** Sem `config.feed`, feed e sitemap não existem. */
634
+ readonly buildFeed?: BuildFeedUseCase;
635
+ readonly listSitemapEntries?: ListSitemapEntriesUseCase;
636
+ };
637
+ readonly config: ContentModuleConfig;
638
+ };
639
+ declare function createContentModule(params: CreateContentModuleParams): ContentModule;
640
+
641
+ /**
642
+ * Copyright (c) 2026 Ada Technology. MIT License.
643
+ *
644
+ * Rotas do site público. Sem identidade: a empresa vem do `PublicCompanyResolverPort` do host
645
+ * (domínio, cabeçalho, empresa fixa…). Resolver sem resposta = 404, igual a post inexistente.
646
+ */
647
+
648
+ interface PublicCompanyResolverPort {
649
+ resolve(params: {
650
+ readonly headers: Readonly<Record<string, string>>;
651
+ readonly query: Readonly<Record<string, string>>;
652
+ }): Promise<string | undefined>;
653
+ }
654
+
655
+ /**
656
+ * Copyright (c) 2026 Ada Technology. MIT License.
657
+ */
658
+
659
+ type CreateContentRoutesParams = {
660
+ readonly module: ContentModule;
661
+ /**
662
+ * Como o site público diz de qual empresa é o blog (domínio, cabeçalho, valor fixo…). Ausente,
663
+ * as rotas `/public/*` não sobem: o host que só tem painel não expõe leitura anônima.
664
+ */
665
+ readonly publicCompanyResolver?: PublicCompanyResolverPort;
666
+ };
667
+ declare function createContentRoutes(params: CreateContentRoutesParams): ModuleRouteTable;
668
+
669
+ /**
670
+ * Copyright (c) 2026 Ada Technology. MIT License.
671
+ */
672
+
673
+ declare const CONTENT_MIGRATIONS_TABLE = "content_migrations";
674
+ /** Pasta no formato clássico (`meta/_journal.json`), lida pelos migrators do drizzle 0.x e 1.x. */
675
+ declare function contentMigrationsFolder(): string;
676
+ type RunContentMigrationsParams = {
677
+ readonly db: ContentDatabase;
678
+ /** O `migrate` do driver do host (`drizzle-orm/node-postgres/migrator`, `.../bun-sql/migrator`…). */
679
+ readonly migrate: DrizzleMigrateFunction;
680
+ };
681
+ declare function runContentMigrations(params: RunContentMigrationsParams): Promise<void>;
682
+
683
+ /**
684
+ * Copyright (c) 2026 Ada Technology. MIT License.
685
+ */
686
+
687
+ declare class PostRepository implements PostStorePort {
688
+ private readonly db;
689
+ constructor(db: ContentDatabase);
690
+ create(values: NewPostRow): Promise<PostRow>;
691
+ findById(params: {
692
+ companyId: string;
693
+ id: string;
694
+ }): Promise<PostRow | undefined>;
695
+ findBySlug(params: {
696
+ companyId: string;
697
+ slug: string;
698
+ }): Promise<PostRow | undefined>;
699
+ findPublicBySlug(params: {
700
+ companyId: string;
701
+ slug: string;
702
+ now: Date;
703
+ }): Promise<PostRow | undefined>;
704
+ update(params: {
705
+ companyId: string;
706
+ id: string;
707
+ values: Partial<NewPostRow>;
708
+ }): Promise<PostRow | undefined>;
709
+ listForAdmin(query: PostAdminListQuery): Promise<PostPage>;
710
+ listPublic(query: PostPublicListQuery): Promise<PostPage>;
711
+ listTags(params: {
712
+ companyId: string;
713
+ publicAt?: Date;
714
+ }): Promise<readonly TagCount[]>;
715
+ }
716
+
717
+ /**
718
+ * Copyright (c) 2026 Ada Technology. MIT License.
719
+ */
720
+ /**
721
+ * 1 MiB é o teto de corpo do `module-http`: um limite maior aqui seria promessa que a rota não
722
+ * cumpre. O `content-ui` avisa antes de enviar; o servidor recusa de novo porque o cliente não é
723
+ * fonte de verdade.
724
+ */
725
+ declare const COVER_IMAGE: {
726
+ readonly MAX_BYTES: number;
727
+ readonly KEY_PREFIX: "content/posts";
728
+ readonly EXTENSION_BY_MIME: Readonly<Record<string, string | undefined>>;
729
+ };
730
+
731
+ /**
732
+ * Copyright (c) 2026 Ada Technology. MIT License.
733
+ *
734
+ * Dublê em memória do `PostStorePort`, para a suíte de comportamento do módulo e para o teste do
735
+ * host. O isolamento real (cláusula SQL) é provado em `repositories/isolation.test.ts`; aqui as
736
+ * mesmas regras são reproduzidas em JavaScript, inclusive a violação de índice único do slug.
737
+ */
738
+
739
+ declare function createInMemoryPostStore(seed?: PostRow[]): PostStorePort & {
740
+ readonly rows: PostRow[];
741
+ };
742
+
743
+ export { ArchivePostUseCase, BuildFeedUseCase, CONTENT_MIGRATIONS_TABLE, COVER_IMAGE, type ContentDatabase, type ContentDependencies, type ContentModule, type ContentModuleProviders, type CreateContentModuleParams, type CreateContentRoutesParams, CreatePostUseCase, type DrizzleMigrateFunction, FEED_FORMAT, type FeedFormat, GetPostUseCase, GetPublishedPostBySlugUseCase, ListPostsUseCase, ListPublishedPostsUseCase, ListSitemapEntriesUseCase, ListTagsUseCase, type NewPostRow, type PostAdminListQuery, type PostPage, type PostPublicListQuery, type PostReference, PostRepository, type PostRow, type PostStorePort, type PublicCompanyResolverPort, PublishPostUseCase, type RunContentMigrationsParams, TAG_SCOPE, type TagScope, UnpublishPostUseCase, UpdatePostUseCase, type UploadCoverImageParams, type UploadCoverImageResult, UploadCoverImageUseCase, contentMigrationsFolder, contentSchema, createContentModule, createContentRoutes, createInMemoryPostStore, posts, runContentMigrations };