@adatechnology/content-contracts 0.3.0 → 0.5.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/index.cjs +349 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +393 -2
- package/dist/index.d.ts +393 -2
- package/dist/index.js +314 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -16,10 +16,42 @@ declare const POST_STATUS: {
|
|
|
16
16
|
readonly SCHEDULED: "scheduled";
|
|
17
17
|
readonly PUBLISHED: "published";
|
|
18
18
|
readonly ARCHIVED: "archived";
|
|
19
|
+
/** Post da comunidade enviado e aguardando a equipe (moderação `before`). */
|
|
20
|
+
readonly PENDING_REVIEW: "pending_review";
|
|
21
|
+
/** Post da comunidade recusado ou despublicado pela equipe; o autor pode editar e reenviar. */
|
|
22
|
+
readonly REJECTED: "rejected";
|
|
19
23
|
};
|
|
20
24
|
type PostStatus = (typeof POST_STATUS)[keyof typeof POST_STATUS];
|
|
21
25
|
declare const POST_STATUSES: readonly PostStatus[];
|
|
22
26
|
declare function isPostStatus(value: unknown): value is PostStatus;
|
|
27
|
+
/** Quem escreveu: a equipe (painel) ou um hóspede/cliente (comunidade). */
|
|
28
|
+
declare const POST_ORIGIN: {
|
|
29
|
+
readonly STAFF: "staff";
|
|
30
|
+
readonly COMMUNITY: "community";
|
|
31
|
+
};
|
|
32
|
+
type PostOrigin = (typeof POST_ORIGIN)[keyof typeof POST_ORIGIN];
|
|
33
|
+
declare const POST_ORIGINS: readonly PostOrigin[];
|
|
34
|
+
/** `before`: o post só vai ao ar depois de aprovado. `after`: vai ao ar no envio e a equipe modera depois. */
|
|
35
|
+
declare const COMMUNITY_MODERATION: {
|
|
36
|
+
readonly BEFORE: "before";
|
|
37
|
+
readonly AFTER: "after";
|
|
38
|
+
};
|
|
39
|
+
type CommunityModeration = (typeof COMMUNITY_MODERATION)[keyof typeof COMMUNITY_MODERATION];
|
|
40
|
+
declare const COMMUNITY_MODERATIONS: readonly CommunityModeration[];
|
|
41
|
+
declare const COMMUNITY_REVISION_STATE: {
|
|
42
|
+
readonly PENDING: "pending";
|
|
43
|
+
readonly REJECTED: "rejected";
|
|
44
|
+
};
|
|
45
|
+
type CommunityRevisionState = (typeof COMMUNITY_REVISION_STATE)[keyof typeof COMMUNITY_REVISION_STATE];
|
|
46
|
+
/** Edição de um post da comunidade já publicado: fica à parte até a aprovação e o texto no ar continua o anterior. */
|
|
47
|
+
type CommunityRevision = {
|
|
48
|
+
readonly title: string;
|
|
49
|
+
readonly excerpt: string | null;
|
|
50
|
+
readonly body: string;
|
|
51
|
+
readonly state: CommunityRevisionState;
|
|
52
|
+
/** ISO 8601. */
|
|
53
|
+
readonly submittedAt: string;
|
|
54
|
+
};
|
|
23
55
|
/** Visão do painel: tudo, inclusive rascunho e campos de operação. */
|
|
24
56
|
type Post = {
|
|
25
57
|
readonly id: string;
|
|
@@ -48,6 +80,17 @@ type Post = {
|
|
|
48
80
|
readonly readingTimeMinutes: number;
|
|
49
81
|
readonly createdAt: string;
|
|
50
82
|
readonly updatedAt: string;
|
|
83
|
+
readonly origin: PostOrigin;
|
|
84
|
+
/** Só post da comunidade; `null` na equipe. Identificador opaco da conta do autor no host. */
|
|
85
|
+
readonly authorAccountId: string | null;
|
|
86
|
+
readonly authorDisplayName: string | null;
|
|
87
|
+
/** `YYYY-MM`: mês da estadia/compra que habilitou o autor, no primeiro envio. */
|
|
88
|
+
readonly authorReferenceMonth: string | null;
|
|
89
|
+
readonly reviewNote: string | null;
|
|
90
|
+
readonly termsAcceptedAt: string | null;
|
|
91
|
+
readonly submittedAt: string | null;
|
|
92
|
+
readonly pendingRevision: CommunityRevision | null;
|
|
93
|
+
readonly openReportCount: number;
|
|
51
94
|
};
|
|
52
95
|
/** Item de listagem do painel: sem o corpo, que pode ter dezenas de KB por post. */
|
|
53
96
|
type PostSummary = Omit<Post, 'body'>;
|
|
@@ -75,6 +118,12 @@ type PublicPost = {
|
|
|
75
118
|
readonly seoDescription: string | null;
|
|
76
119
|
readonly canonicalUrl: string | null;
|
|
77
120
|
readonly readingTimeMinutes: number;
|
|
121
|
+
readonly origin: PostOrigin;
|
|
122
|
+
/** Só post da comunidade. Nunca expõe a conta do autor, a nota da equipe nem revisão pendente. */
|
|
123
|
+
readonly communityAuthor: {
|
|
124
|
+
readonly displayName: string;
|
|
125
|
+
readonly referenceMonth: string | null;
|
|
126
|
+
} | null;
|
|
78
127
|
};
|
|
79
128
|
type PublicPostSummary = Omit<PublicPost, 'body'>;
|
|
80
129
|
type TagCount = {
|
|
@@ -98,6 +147,53 @@ type PostCounts = {
|
|
|
98
147
|
readonly draft: number;
|
|
99
148
|
readonly archived: number;
|
|
100
149
|
readonly templates: number;
|
|
150
|
+
/** Post da comunidade esperando moderação, mais as revisões abertas de posts já publicados. */
|
|
151
|
+
readonly pendingReview: number;
|
|
152
|
+
readonly rejected: number;
|
|
153
|
+
};
|
|
154
|
+
/** Visão do próprio autor sobre o seu post da comunidade. Nunca inclui `archived` nem dados de operação. */
|
|
155
|
+
type CommunityPostStatus = 'draft' | 'pending_review' | 'published' | 'rejected';
|
|
156
|
+
type CommunityPost = {
|
|
157
|
+
readonly id: string;
|
|
158
|
+
readonly shortId: string;
|
|
159
|
+
readonly slug: string;
|
|
160
|
+
readonly title: string;
|
|
161
|
+
readonly excerpt: string | null;
|
|
162
|
+
readonly body: string;
|
|
163
|
+
readonly coverImageUrl: string | null;
|
|
164
|
+
readonly status: CommunityPostStatus;
|
|
165
|
+
readonly displayName: string;
|
|
166
|
+
readonly reviewNote: string | null;
|
|
167
|
+
readonly pendingRevision: CommunityRevision | null;
|
|
168
|
+
readonly publishedAt: string | null;
|
|
169
|
+
readonly createdAt: string;
|
|
170
|
+
readonly updatedAt: string;
|
|
171
|
+
};
|
|
172
|
+
type ContentSettings = {
|
|
173
|
+
readonly communityModeration: CommunityModeration;
|
|
174
|
+
/** Posts novos por conta numa janela móvel de 24 h. */
|
|
175
|
+
readonly communityDailyLimit: number;
|
|
176
|
+
/** Fotos por post da comunidade. */
|
|
177
|
+
readonly maxImagesPerPost: number;
|
|
178
|
+
};
|
|
179
|
+
/** Sem linha em `content_settings`, a empresa usa este padrão. */
|
|
180
|
+
declare const DEFAULT_CONTENT_SETTINGS: ContentSettings;
|
|
181
|
+
type BulkModerationResult = {
|
|
182
|
+
readonly succeeded: readonly string[];
|
|
183
|
+
readonly failed: readonly {
|
|
184
|
+
readonly id: string;
|
|
185
|
+
readonly code: string;
|
|
186
|
+
readonly message: string;
|
|
187
|
+
}[];
|
|
188
|
+
};
|
|
189
|
+
/** Denúncia de leitor: sem IP e sem identidade de quem denunciou, de propósito. */
|
|
190
|
+
type PostReport = {
|
|
191
|
+
readonly id: string;
|
|
192
|
+
readonly postId: string;
|
|
193
|
+
readonly reason: string;
|
|
194
|
+
readonly createdAt: string;
|
|
195
|
+
readonly resolvedAt: string | null;
|
|
196
|
+
readonly resolvedBy: string | null;
|
|
101
197
|
};
|
|
102
198
|
declare const RECURRENCE_FREQUENCY: {
|
|
103
199
|
readonly WEEKLY: "weekly";
|
|
@@ -130,7 +226,11 @@ declare class ContentError extends Error {
|
|
|
130
226
|
readonly statusCode: number;
|
|
131
227
|
readonly code: string;
|
|
132
228
|
readonly details?: Record<string, unknown> | undefined;
|
|
133
|
-
|
|
229
|
+
/** Vai na resposta HTTP (`details` não vai): só valores que o cliente pode ver, nunca ids de conta. */
|
|
230
|
+
readonly publicDetails?: Record<string, unknown> | undefined;
|
|
231
|
+
constructor(message: string, statusCode: number, code: string, details?: Record<string, unknown> | undefined,
|
|
232
|
+
/** Vai na resposta HTTP (`details` não vai): só valores que o cliente pode ver, nunca ids de conta. */
|
|
233
|
+
publicDetails?: Record<string, unknown> | undefined);
|
|
134
234
|
}
|
|
135
235
|
declare const CONTENT_ERROR_CODES: {
|
|
136
236
|
readonly POST_NOT_FOUND: "CONTENT_POST_NOT_FOUND";
|
|
@@ -144,6 +244,17 @@ declare const CONTENT_ERROR_CODES: {
|
|
|
144
244
|
readonly NOT_PUBLISHED: "CONTENT_NOT_PUBLISHED";
|
|
145
245
|
readonly REPUBLISH_DATE_IN_FUTURE: "CONTENT_REPUBLISH_DATE_IN_FUTURE";
|
|
146
246
|
readonly RECURRENCE_NOT_FOUND: "CONTENT_RECURRENCE_NOT_FOUND";
|
|
247
|
+
readonly COMMUNITY_UNAUTHENTICATED: "CONTENT_COMMUNITY_UNAUTHENTICATED";
|
|
248
|
+
readonly COMMUNITY_AUTHOR_NOT_ELIGIBLE: "CONTENT_COMMUNITY_AUTHOR_NOT_ELIGIBLE";
|
|
249
|
+
readonly COMMUNITY_DAILY_LIMIT: "CONTENT_COMMUNITY_DAILY_LIMIT";
|
|
250
|
+
readonly COMMUNITY_TERMS_REQUIRED: "CONTENT_COMMUNITY_TERMS_REQUIRED";
|
|
251
|
+
readonly COMMUNITY_TOO_MANY_IMAGES: "CONTENT_COMMUNITY_TOO_MANY_IMAGES";
|
|
252
|
+
readonly COMMUNITY_IMAGE_NOT_ALLOWED: "CONTENT_COMMUNITY_IMAGE_NOT_ALLOWED";
|
|
253
|
+
readonly INVALID_TRANSITION: "CONTENT_INVALID_TRANSITION";
|
|
254
|
+
readonly POST_STATE_CHANGED: "CONTENT_POST_STATE_CHANGED";
|
|
255
|
+
readonly ACTOR_REQUIRED: "CONTENT_ACTOR_REQUIRED";
|
|
256
|
+
readonly COMMUNITY_POST_READ_ONLY: "CONTENT_COMMUNITY_POST_READ_ONLY";
|
|
257
|
+
readonly REPORT_NOT_FOUND: "CONTENT_REPORT_NOT_FOUND";
|
|
147
258
|
};
|
|
148
259
|
type ContentErrorCode = (typeof CONTENT_ERROR_CODES)[keyof typeof CONTENT_ERROR_CODES];
|
|
149
260
|
/** 404 também para post de outra empresa: confirmar a existência já seria vazamento. */
|
|
@@ -195,6 +306,51 @@ declare class RecurrenceNotFoundError extends ContentError {
|
|
|
195
306
|
readonly reference: string;
|
|
196
307
|
constructor(reference: string);
|
|
197
308
|
}
|
|
309
|
+
declare class CommunityUnauthenticatedError extends ContentError {
|
|
310
|
+
constructor();
|
|
311
|
+
}
|
|
312
|
+
declare class CommunityAuthorNotEligibleError extends ContentError {
|
|
313
|
+
constructor();
|
|
314
|
+
}
|
|
315
|
+
declare class CommunityDailyLimitError extends ContentError {
|
|
316
|
+
readonly limit: number;
|
|
317
|
+
readonly retryAfterSeconds: number;
|
|
318
|
+
constructor(limit: number, retryAfterSeconds: number);
|
|
319
|
+
}
|
|
320
|
+
declare class CommunityTermsRequiredError extends ContentError {
|
|
321
|
+
constructor();
|
|
322
|
+
}
|
|
323
|
+
declare class CommunityTooManyImagesError extends ContentError {
|
|
324
|
+
readonly max: number;
|
|
325
|
+
constructor(max: number);
|
|
326
|
+
}
|
|
327
|
+
/** Só foto enviada pela própria conta, pelo módulo, entra no corpo: URL externa seria rastreador ou conteúdo sem moderação. */
|
|
328
|
+
declare class CommunityImageNotAllowedError extends ContentError {
|
|
329
|
+
constructor();
|
|
330
|
+
}
|
|
331
|
+
declare class InvalidPostTransitionError extends ContentError {
|
|
332
|
+
readonly from: string;
|
|
333
|
+
readonly action: string;
|
|
334
|
+
constructor(from: string, action: string);
|
|
335
|
+
}
|
|
336
|
+
/** Moderar post da comunidade grava quem decidiu: credencial de máquina (sem usuário) não decide. */
|
|
337
|
+
declare class ActorRequiredError extends ContentError {
|
|
338
|
+
constructor();
|
|
339
|
+
}
|
|
340
|
+
/** Outra requisição mexeu no post entre a leitura e a gravação: quem decidiu viu um texto que já não é o atual. */
|
|
341
|
+
declare class PostStateChangedError extends ContentError {
|
|
342
|
+
readonly postId: string;
|
|
343
|
+
constructor(postId: string);
|
|
344
|
+
}
|
|
345
|
+
/** A equipe modera post da comunidade, não o reescreve: editar, agendar ou virar modelo é recusado. */
|
|
346
|
+
declare class CommunityPostReadOnlyError extends ContentError {
|
|
347
|
+
readonly postId: string;
|
|
348
|
+
constructor(postId: string);
|
|
349
|
+
}
|
|
350
|
+
declare class ReportNotFoundError extends ContentError {
|
|
351
|
+
readonly reference: string;
|
|
352
|
+
constructor(reference: string);
|
|
353
|
+
}
|
|
198
354
|
|
|
199
355
|
/**
|
|
200
356
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
@@ -215,7 +371,15 @@ declare const POST_LIMITS: {
|
|
|
215
371
|
readonly SEARCH: 120;
|
|
216
372
|
readonly ADMIN_PAGE_SIZE: 100;
|
|
217
373
|
readonly PUBLIC_PAGE_SIZE: 50;
|
|
374
|
+
readonly DISPLAY_NAME_MIN: 2;
|
|
375
|
+
readonly DISPLAY_NAME_MAX: 40;
|
|
376
|
+
readonly REVIEW_NOTE: 500;
|
|
377
|
+
readonly REPORT_REASON_MIN: 3;
|
|
378
|
+
readonly REPORT_REASON_MAX: 300;
|
|
379
|
+
readonly BULK_IDS: 100;
|
|
218
380
|
};
|
|
381
|
+
declare const POST_ORIGIN_FILTERS: readonly ["staff", "community", "all"];
|
|
382
|
+
type PostOriginFilter = (typeof POST_ORIGIN_FILTERS)[number];
|
|
219
383
|
declare const slugSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
220
384
|
/** Só http(s): `javascript:` numa capa ou no canonical viraria `<a href>` ou `<link>` no site. */
|
|
221
385
|
declare const httpUrlSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -366,7 +530,9 @@ declare const listPostsQuerySchema: z.ZodObject<{
|
|
|
366
530
|
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
367
531
|
/** `true`: só modelos. Ausente/`false`: só posts (modelo nunca aparece misturado na lista). */
|
|
368
532
|
isTemplate: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodBoolean, z.ZodEnum<["true", "false"]>]>, boolean, boolean | "true" | "false">>;
|
|
533
|
+
origin: z.ZodDefault<z.ZodEnum<["staff", "community", "all"]>>;
|
|
369
534
|
}, "strip", z.ZodTypeAny, {
|
|
535
|
+
origin: "staff" | "community" | "all";
|
|
370
536
|
sort: "title" | "status" | "publishedAt" | "updatedAt";
|
|
371
537
|
page: number;
|
|
372
538
|
pageSize: number;
|
|
@@ -378,6 +544,7 @@ declare const listPostsQuerySchema: z.ZodObject<{
|
|
|
378
544
|
}, {
|
|
379
545
|
status?: PostStatus | undefined;
|
|
380
546
|
isTemplate?: boolean | "true" | "false" | undefined;
|
|
547
|
+
origin?: "staff" | "community" | "all" | undefined;
|
|
381
548
|
sort?: "title" | "status" | "publishedAt" | "updatedAt" | undefined;
|
|
382
549
|
page?: number | undefined;
|
|
383
550
|
pageSize?: number | undefined;
|
|
@@ -390,11 +557,14 @@ declare const listPublishedPostsQuerySchema: z.ZodObject<{
|
|
|
390
557
|
page: z.ZodDefault<z.ZodNumber>;
|
|
391
558
|
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
392
559
|
tag: z.ZodOptional<z.ZodString>;
|
|
560
|
+
origin: z.ZodDefault<z.ZodEnum<["staff", "community", "all"]>>;
|
|
393
561
|
}, "strip", z.ZodTypeAny, {
|
|
562
|
+
origin: "staff" | "community" | "all";
|
|
394
563
|
page: number;
|
|
395
564
|
pageSize: number;
|
|
396
565
|
tag?: string | undefined;
|
|
397
566
|
}, {
|
|
567
|
+
origin?: "staff" | "community" | "all" | undefined;
|
|
398
568
|
page?: number | undefined;
|
|
399
569
|
pageSize?: number | undefined;
|
|
400
570
|
tag?: string | undefined;
|
|
@@ -455,6 +625,156 @@ declare const updateRecurrenceSchema: z.ZodObject<{
|
|
|
455
625
|
nextRunAt?: string | undefined;
|
|
456
626
|
}>;
|
|
457
627
|
type UpdateRecurrenceInput = z.input<typeof updateRecurrenceSchema>;
|
|
628
|
+
/** Nome exibido no post: sem contato nem link, que expõem o hóspede e viram spam. */
|
|
629
|
+
declare const communityDisplayNameSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
630
|
+
/** Sem capa, slug, tags nem status: a capa é a 1ª imagem do corpo e o resto é decisão da equipe. */
|
|
631
|
+
declare const createCommunityPostSchema: z.ZodObject<{
|
|
632
|
+
title: z.ZodString;
|
|
633
|
+
body: z.ZodString;
|
|
634
|
+
excerpt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
635
|
+
displayName: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
636
|
+
}, "strict", z.ZodTypeAny, {
|
|
637
|
+
body: string;
|
|
638
|
+
title: string;
|
|
639
|
+
excerpt?: string | null | undefined;
|
|
640
|
+
displayName?: string | undefined;
|
|
641
|
+
}, {
|
|
642
|
+
body: string;
|
|
643
|
+
title: string;
|
|
644
|
+
excerpt?: string | null | undefined;
|
|
645
|
+
displayName?: string | undefined;
|
|
646
|
+
}>;
|
|
647
|
+
type CreateCommunityPostInput = z.input<typeof createCommunityPostSchema>;
|
|
648
|
+
declare const updateCommunityPostSchema: z.ZodObject<{
|
|
649
|
+
title: z.ZodOptional<z.ZodString>;
|
|
650
|
+
body: z.ZodOptional<z.ZodString>;
|
|
651
|
+
excerpt: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
652
|
+
displayName: z.ZodOptional<z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>>;
|
|
653
|
+
}, "strict", z.ZodTypeAny, {
|
|
654
|
+
body?: string | undefined;
|
|
655
|
+
title?: string | undefined;
|
|
656
|
+
excerpt?: string | null | undefined;
|
|
657
|
+
displayName?: string | undefined;
|
|
658
|
+
}, {
|
|
659
|
+
body?: string | undefined;
|
|
660
|
+
title?: string | undefined;
|
|
661
|
+
excerpt?: string | null | undefined;
|
|
662
|
+
displayName?: string | undefined;
|
|
663
|
+
}>;
|
|
664
|
+
type UpdateCommunityPostInput = z.input<typeof updateCommunityPostSchema>;
|
|
665
|
+
declare const submitCommunityPostSchema: z.ZodObject<{
|
|
666
|
+
termsAccepted: z.ZodBoolean;
|
|
667
|
+
}, "strict", z.ZodTypeAny, {
|
|
668
|
+
termsAccepted: boolean;
|
|
669
|
+
}, {
|
|
670
|
+
termsAccepted: boolean;
|
|
671
|
+
}>;
|
|
672
|
+
type SubmitCommunityPostInput = z.input<typeof submitCommunityPostSchema>;
|
|
673
|
+
declare const approvePostSchema: z.ZodObject<{
|
|
674
|
+
expectedUpdatedAt: z.ZodOptional<z.ZodString>;
|
|
675
|
+
}, "strict", z.ZodTypeAny, {
|
|
676
|
+
expectedUpdatedAt?: string | undefined;
|
|
677
|
+
}, {
|
|
678
|
+
expectedUpdatedAt?: string | undefined;
|
|
679
|
+
}>;
|
|
680
|
+
type ApprovePostInput = z.input<typeof approvePostSchema>;
|
|
681
|
+
declare const rejectPostSchema: z.ZodObject<{
|
|
682
|
+
note: z.ZodString;
|
|
683
|
+
expectedUpdatedAt: z.ZodOptional<z.ZodString>;
|
|
684
|
+
}, "strict", z.ZodTypeAny, {
|
|
685
|
+
note: string;
|
|
686
|
+
expectedUpdatedAt?: string | undefined;
|
|
687
|
+
}, {
|
|
688
|
+
note: string;
|
|
689
|
+
expectedUpdatedAt?: string | undefined;
|
|
690
|
+
}>;
|
|
691
|
+
type RejectPostInput = z.input<typeof rejectPostSchema>;
|
|
692
|
+
declare const unpublishCommunityPostSchema: z.ZodObject<{
|
|
693
|
+
note: z.ZodOptional<z.ZodString>;
|
|
694
|
+
}, "strict", z.ZodTypeAny, {
|
|
695
|
+
note?: string | undefined;
|
|
696
|
+
}, {
|
|
697
|
+
note?: string | undefined;
|
|
698
|
+
}>;
|
|
699
|
+
type UnpublishCommunityPostInput = z.input<typeof unpublishCommunityPostSchema>;
|
|
700
|
+
declare const BULK_MODERATION_ACTIONS: readonly ["approve", "reject", "unpublish", "archive"];
|
|
701
|
+
type BulkModerationAction = (typeof BULK_MODERATION_ACTIONS)[number];
|
|
702
|
+
declare const bulkModerationSchema: z.ZodObject<{
|
|
703
|
+
action: z.ZodEnum<["approve", "reject", "unpublish", "archive"]>;
|
|
704
|
+
ids: z.ZodArray<z.ZodString, "many">;
|
|
705
|
+
note: z.ZodOptional<z.ZodString>;
|
|
706
|
+
/** Por id: o `updatedAt` que a tela leu. Id sem entrada decide sem a checagem. */
|
|
707
|
+
expectedUpdatedAt: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
708
|
+
}, "strict", z.ZodTypeAny, {
|
|
709
|
+
action: "approve" | "reject" | "unpublish" | "archive";
|
|
710
|
+
ids: string[];
|
|
711
|
+
expectedUpdatedAt?: Record<string, string> | undefined;
|
|
712
|
+
note?: string | undefined;
|
|
713
|
+
}, {
|
|
714
|
+
action: "approve" | "reject" | "unpublish" | "archive";
|
|
715
|
+
ids: string[];
|
|
716
|
+
expectedUpdatedAt?: Record<string, string> | undefined;
|
|
717
|
+
note?: string | undefined;
|
|
718
|
+
}>;
|
|
719
|
+
type BulkModerationInput = z.input<typeof bulkModerationSchema>;
|
|
720
|
+
declare const contentSettingsSchema: z.ZodObject<{
|
|
721
|
+
communityModeration: z.ZodEnum<[CommunityModeration, ...CommunityModeration[]]>;
|
|
722
|
+
communityDailyLimit: z.ZodNumber;
|
|
723
|
+
maxImagesPerPost: z.ZodNumber;
|
|
724
|
+
}, "strict", z.ZodTypeAny, {
|
|
725
|
+
communityModeration: CommunityModeration;
|
|
726
|
+
communityDailyLimit: number;
|
|
727
|
+
maxImagesPerPost: number;
|
|
728
|
+
}, {
|
|
729
|
+
communityModeration: CommunityModeration;
|
|
730
|
+
communityDailyLimit: number;
|
|
731
|
+
maxImagesPerPost: number;
|
|
732
|
+
}>;
|
|
733
|
+
type ContentSettingsInput = z.input<typeof contentSettingsSchema>;
|
|
734
|
+
declare const createPostReportSchema: z.ZodObject<{
|
|
735
|
+
reason: z.ZodString;
|
|
736
|
+
}, "strict", z.ZodTypeAny, {
|
|
737
|
+
reason: string;
|
|
738
|
+
}, {
|
|
739
|
+
reason: string;
|
|
740
|
+
}>;
|
|
741
|
+
type CreatePostReportInput = z.input<typeof createPostReportSchema>;
|
|
742
|
+
declare const REPORT_STATUSES: readonly ["open", "resolved"];
|
|
743
|
+
type ReportStatus = (typeof REPORT_STATUSES)[number];
|
|
744
|
+
declare const listPostReportsQuerySchema: z.ZodObject<{
|
|
745
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
746
|
+
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
747
|
+
status: z.ZodDefault<z.ZodEnum<["open", "resolved"]>>;
|
|
748
|
+
}, "strip", z.ZodTypeAny, {
|
|
749
|
+
status: "open" | "resolved";
|
|
750
|
+
page: number;
|
|
751
|
+
pageSize: number;
|
|
752
|
+
}, {
|
|
753
|
+
status?: "open" | "resolved" | undefined;
|
|
754
|
+
page?: number | undefined;
|
|
755
|
+
pageSize?: number | undefined;
|
|
756
|
+
}>;
|
|
757
|
+
type ListPostReportsQuery = z.output<typeof listPostReportsQuerySchema>;
|
|
758
|
+
/** Lida do jsonb `pending_revision`: valida na leitura porque a coluna não tem forma garantida pelo banco. */
|
|
759
|
+
declare const communityRevisionSchema: z.ZodObject<{
|
|
760
|
+
title: z.ZodString;
|
|
761
|
+
excerpt: z.ZodNullable<z.ZodString>;
|
|
762
|
+
body: z.ZodString;
|
|
763
|
+
state: z.ZodEnum<["pending", "rejected"]>;
|
|
764
|
+
submittedAt: z.ZodString;
|
|
765
|
+
}, "strip", z.ZodTypeAny, {
|
|
766
|
+
body: string;
|
|
767
|
+
title: string;
|
|
768
|
+
excerpt: string | null;
|
|
769
|
+
submittedAt: string;
|
|
770
|
+
state: "rejected" | "pending";
|
|
771
|
+
}, {
|
|
772
|
+
body: string;
|
|
773
|
+
title: string;
|
|
774
|
+
excerpt: string | null;
|
|
775
|
+
submittedAt: string;
|
|
776
|
+
state: "rejected" | "pending";
|
|
777
|
+
}>;
|
|
458
778
|
|
|
459
779
|
/**
|
|
460
780
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
@@ -501,13 +821,71 @@ type PostChangedEvent = {
|
|
|
501
821
|
readonly type: PostEventType;
|
|
502
822
|
readonly post: Post;
|
|
503
823
|
};
|
|
824
|
+
type CommunitySubmissionKind = 'new' | 'revision';
|
|
825
|
+
/** Só ids e enums: nunca nome exibido, título ou corpo (vão para sino, e-mail e log do host). */
|
|
826
|
+
type CommunityPostSubmittedEvent = {
|
|
827
|
+
readonly companyId: string;
|
|
828
|
+
readonly postId: string;
|
|
829
|
+
readonly authorAccountId: string;
|
|
830
|
+
readonly kind: CommunitySubmissionKind;
|
|
831
|
+
readonly moderation: CommunityModeration;
|
|
832
|
+
/** Versão dos termos aceita neste envio (`ContentModuleConfig.termsVersion`), para a auditoria do host. */
|
|
833
|
+
readonly termsVersion?: string;
|
|
834
|
+
};
|
|
835
|
+
type CommunityReviewDecision = 'approved' | 'rejected' | 'unpublished' | 'archived';
|
|
836
|
+
type CommunityReviewTarget = 'post' | 'revision';
|
|
837
|
+
type CommunityPostReviewedEvent = {
|
|
838
|
+
readonly companyId: string;
|
|
839
|
+
readonly postId: string;
|
|
840
|
+
readonly authorAccountId: string;
|
|
841
|
+
readonly decision: CommunityReviewDecision;
|
|
842
|
+
readonly target: CommunityReviewTarget;
|
|
843
|
+
readonly actorUserId: string;
|
|
844
|
+
readonly statusBefore: PostStatus;
|
|
845
|
+
readonly statusAfter: PostStatus;
|
|
846
|
+
};
|
|
847
|
+
type PostReportedEvent = {
|
|
848
|
+
readonly companyId: string;
|
|
849
|
+
readonly postId: string;
|
|
850
|
+
readonly reportId: string;
|
|
851
|
+
};
|
|
504
852
|
type ContentHooks = {
|
|
505
853
|
/**
|
|
506
854
|
* Depois de cada escrita. Uso típico: purgar cache de CDN, revalidar a página estática do post,
|
|
507
855
|
* avisar assinantes. Erro aqui é logado e não desfaz a escrita.
|
|
508
856
|
*/
|
|
509
857
|
readonly onPostChanged?: (event: PostChangedEvent) => void | Promise<void>;
|
|
858
|
+
/** Envio ou reenvio de post da comunidade. Uso típico: avisar a equipe (sino). */
|
|
859
|
+
readonly onCommunityPostSubmitted?: (event: CommunityPostSubmittedEvent) => void | Promise<void>;
|
|
860
|
+
/** Decisão da equipe. Uso típico: e-mail ao autor e auditoria com origem painel. */
|
|
861
|
+
readonly onCommunityPostReviewed?: (event: CommunityPostReviewedEvent) => void | Promise<void>;
|
|
862
|
+
readonly onPostReported?: (event: PostReportedEvent) => void | Promise<void>;
|
|
863
|
+
};
|
|
864
|
+
/** Quem está logado no host e de que empresa; o módulo nunca vê credencial nem sessão. */
|
|
865
|
+
type CommunityAuthorIdentity = {
|
|
866
|
+
readonly companyId: string;
|
|
867
|
+
readonly accountId: string;
|
|
868
|
+
/** Nome sugerido ao autor; ele pode trocar por outro ao escrever. */
|
|
869
|
+
readonly defaultDisplayName: string;
|
|
510
870
|
};
|
|
871
|
+
/** `referenceMonth` (`YYYY-MM`) é o mês da estadia/compra que habilitou o autor, quando o host sabe. */
|
|
872
|
+
type CommunityEligibility = {
|
|
873
|
+
readonly eligible: false;
|
|
874
|
+
} | {
|
|
875
|
+
readonly eligible: true;
|
|
876
|
+
readonly referenceMonth?: string;
|
|
877
|
+
};
|
|
878
|
+
/** O handler só recebe cabeçalhos (`RequestContext`): a porta resolve a sessão a partir deles. */
|
|
879
|
+
interface CommunityAuthorPort {
|
|
880
|
+
resolveAuthor(params: {
|
|
881
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
882
|
+
}): Promise<CommunityAuthorIdentity | undefined>;
|
|
883
|
+
/** Chamada em toda requisição de comunidade, não só na criação: elegibilidade pode ser perdida. */
|
|
884
|
+
checkEligibility(params: {
|
|
885
|
+
readonly companyId: string;
|
|
886
|
+
readonly accountId: string;
|
|
887
|
+
}): Promise<CommunityEligibility>;
|
|
888
|
+
}
|
|
511
889
|
type ContentFeedConfig = {
|
|
512
890
|
/** Endereço público do site, absoluto (`https://exemplo.com`). */
|
|
513
891
|
readonly siteUrl: string;
|
|
@@ -531,6 +909,8 @@ type ContentModuleConfig = {
|
|
|
531
909
|
readonly publicCacheControl?: string;
|
|
532
910
|
readonly feed?: ContentFeedConfig;
|
|
533
911
|
readonly wordsPerMinute?: number;
|
|
912
|
+
/** Versão dos termos de uso da comunidade, gravada em cada envio. Padrão: `'2'`. Mude ao reescrever os termos. */
|
|
913
|
+
readonly termsVersion?: string;
|
|
534
914
|
/** Slug automático (quando o autor não informa). Padrão: até 60 caracteres, sem palavras de ligação do pt-BR. */
|
|
535
915
|
readonly slug?: {
|
|
536
916
|
readonly maxLength?: number;
|
|
@@ -785,6 +1165,8 @@ type MarkdownRenderOptions = {
|
|
|
785
1165
|
readonly linkRel?: string;
|
|
786
1166
|
};
|
|
787
1167
|
declare const DEFAULT_LINK_REL = "noopener noreferrer";
|
|
1168
|
+
/** Texto de hóspede: sem herdar reputação de busca e marcado como conteúdo gerado por usuário. */
|
|
1169
|
+
declare const COMMUNITY_LINK_REL = "noopener noreferrer nofollow ugc";
|
|
788
1170
|
declare function escapeHtml(value: string): string;
|
|
789
1171
|
declare function resolveHeadingLevel(level: number, offset?: number): 1 | 2 | 3 | 4 | 5 | 6;
|
|
790
1172
|
declare function renderMarkdownDocument(document: MarkdownDocument, options?: MarkdownRenderOptions): string;
|
|
@@ -810,8 +1192,17 @@ declare function markdownToPlainText(markdown: string): string;
|
|
|
810
1192
|
declare function sanitizeLinkUrl(url: string): string | undefined;
|
|
811
1193
|
/** Imagem só por http(s) ou caminho relativo: `data:` permitiria SVG com script embutido. */
|
|
812
1194
|
declare function sanitizeImageUrl(url: string): string | undefined;
|
|
1195
|
+
/** `//host` e `/\host`: o navegador resolve como outro site; num texto de hóspede não é "caminho relativo". */
|
|
1196
|
+
declare function isProtocolRelativeUrl(url: string): boolean;
|
|
813
1197
|
declare function isAbsoluteHttpUrl(url: string): boolean;
|
|
814
1198
|
|
|
1199
|
+
/**
|
|
1200
|
+
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
1201
|
+
*/
|
|
1202
|
+
|
|
1203
|
+
/** Endereço de toda imagem do corpo (inline, figura e galeria), na ordem do texto: base do limite e da lista permitida. */
|
|
1204
|
+
declare function collectImageSources(document: MarkdownDocument): string[];
|
|
1205
|
+
|
|
815
1206
|
/**
|
|
816
1207
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
817
1208
|
*/
|
|
@@ -873,4 +1264,4 @@ declare function buildAtomFeed(params: {
|
|
|
873
1264
|
}): string;
|
|
874
1265
|
declare function buildSitemapXml(entries: readonly SitemapEntry[]): string;
|
|
875
1266
|
|
|
876
|
-
export { CONTENT_ERROR_CODES, type ClockPort, ConfigMissingError, ContentError, type ContentErrorCode, type ContentFeedConfig, type ContentHooks, type ContentImageStoragePort, type ContentModuleConfig, type CreateFromTemplateInput, type CreatePostInput, type CreateRecurrenceInput, DEFAULT_ADMIN_SCOPES, DEFAULT_LINK_REL, DEFAULT_POST_PATH_TEMPLATE, DEFAULT_PUBLIC_CACHE_CONTROL, DEFAULT_SHORT_SLUG_LENGTH, DEFAULT_WORDS_PER_MINUTE, DuplicateSlugError, type FeedChannel, type FeedItem, ImageStorageDisabledError, InvalidCoverImageError, type InvalidImageReason, InvalidSlugError, type ListPostsQuery, type ListPublishedPostsQuery, type LogMeta, type LoggerPort, type MarkdownBlock, type MarkdownDocument, type MarkdownFigureImage, type MarkdownGalleryImage, type MarkdownInline, type MarkdownRenderOptions, NotATemplateError, POST_EVENT, POST_LIMITS, POST_SORT_FIELDS, POST_STATUS, POST_STATUSES, PT_BR_STOP_WORDS, type Paginated, type Pagination, type ParsedPostRef, type Post, type PostChangedEvent, type PostCounts, type PostEventType, PostNotFoundError, PostNotPublishedError, type PostSortField, type PostStatus, type PostSummary, type PublicPost, type PublicPostSummary, type PublishPostInput, RECURRENCE_FREQUENCIES, RECURRENCE_FREQUENCY, type RecurrenceFrequency, RecurrenceNotFoundError, type RecurrenceRule, RepublishDateInFutureError, type RepublishPostInput, SHORT_ID_LENGTH, SLUG_MAX_LENGTH, type SaveAsTemplateInput, type ShortSlugOptions, type SitemapEntry, TAGS_MAX_COUNT, TAG_MAX_LENGTH, type TagCount, type TagLabels, TemplateNotPublishableError, type UpdatePostInput, type UpdateRecurrenceInput, buildAtomFeed, buildExcerpt, buildPostPath, buildPostRef, buildPostUrl, buildRssFeed, buildShortSlug, buildSitemapXml, buildTagLabels, countWords, createFromTemplateSchema, createHeadingIdGenerator, createPostSchema, createRecurrenceSchema, documentToPlainText, escapeHtml, escapeXml, estimateReadingTimeMinutes, formatTagLabel, httpUrlSchema, inlineToPlainText, isAbsoluteHttpUrl, isCanonicalPostRef, isPostStatus, isShortId, isValidSlug, listPostsQuerySchema, listPublishedPostsQuerySchema, markdownToPlainText, normalizeTag, normalizeTags, parseInline, parseMarkdown, parsePostPath, parsePostRef, postFieldsSchema, publishPostSchema, renderMarkdownDocument, renderMarkdownToHtml, republishPostSchema, resolveHeadingLevel, sanitizeImageUrl, sanitizeLinkUrl, saveAsTemplateSchema, slugSchema, slugify, updatePostSchema, updateRecurrenceSchema, withSlugSuffix };
|
|
1267
|
+
export { ActorRequiredError, type ApprovePostInput, BULK_MODERATION_ACTIONS, type BulkModerationAction, type BulkModerationInput, type BulkModerationResult, COMMUNITY_LINK_REL, COMMUNITY_MODERATION, COMMUNITY_MODERATIONS, COMMUNITY_REVISION_STATE, CONTENT_ERROR_CODES, type ClockPort, type CommunityAuthorIdentity, CommunityAuthorNotEligibleError, type CommunityAuthorPort, CommunityDailyLimitError, type CommunityEligibility, CommunityImageNotAllowedError, type CommunityModeration, type CommunityPost, CommunityPostReadOnlyError, type CommunityPostReviewedEvent, type CommunityPostStatus, type CommunityPostSubmittedEvent, type CommunityReviewDecision, type CommunityReviewTarget, type CommunityRevision, type CommunityRevisionState, type CommunitySubmissionKind, CommunityTermsRequiredError, CommunityTooManyImagesError, CommunityUnauthenticatedError, ConfigMissingError, ContentError, type ContentErrorCode, type ContentFeedConfig, type ContentHooks, type ContentImageStoragePort, type ContentModuleConfig, type ContentSettings, type ContentSettingsInput, type CreateCommunityPostInput, type CreateFromTemplateInput, type CreatePostInput, type CreatePostReportInput, type CreateRecurrenceInput, DEFAULT_ADMIN_SCOPES, DEFAULT_CONTENT_SETTINGS, DEFAULT_LINK_REL, DEFAULT_POST_PATH_TEMPLATE, DEFAULT_PUBLIC_CACHE_CONTROL, DEFAULT_SHORT_SLUG_LENGTH, DEFAULT_WORDS_PER_MINUTE, DuplicateSlugError, type FeedChannel, type FeedItem, ImageStorageDisabledError, InvalidCoverImageError, type InvalidImageReason, InvalidPostTransitionError, InvalidSlugError, type ListPostReportsQuery, type ListPostsQuery, type ListPublishedPostsQuery, type LogMeta, type LoggerPort, type MarkdownBlock, type MarkdownDocument, type MarkdownFigureImage, type MarkdownGalleryImage, type MarkdownInline, type MarkdownRenderOptions, NotATemplateError, POST_EVENT, POST_LIMITS, POST_ORIGIN, POST_ORIGINS, POST_ORIGIN_FILTERS, POST_SORT_FIELDS, POST_STATUS, POST_STATUSES, PT_BR_STOP_WORDS, type Paginated, type Pagination, type ParsedPostRef, type Post, type PostChangedEvent, type PostCounts, type PostEventType, PostNotFoundError, PostNotPublishedError, type PostOrigin, type PostOriginFilter, type PostReport, type PostReportedEvent, type PostSortField, PostStateChangedError, type PostStatus, type PostSummary, type PublicPost, type PublicPostSummary, type PublishPostInput, RECURRENCE_FREQUENCIES, RECURRENCE_FREQUENCY, REPORT_STATUSES, type RecurrenceFrequency, RecurrenceNotFoundError, type RecurrenceRule, type RejectPostInput, ReportNotFoundError, type ReportStatus, RepublishDateInFutureError, type RepublishPostInput, SHORT_ID_LENGTH, SLUG_MAX_LENGTH, type SaveAsTemplateInput, type ShortSlugOptions, type SitemapEntry, type SubmitCommunityPostInput, TAGS_MAX_COUNT, TAG_MAX_LENGTH, type TagCount, type TagLabels, TemplateNotPublishableError, type UnpublishCommunityPostInput, type UpdateCommunityPostInput, type UpdatePostInput, type UpdateRecurrenceInput, approvePostSchema, buildAtomFeed, buildExcerpt, buildPostPath, buildPostRef, buildPostUrl, buildRssFeed, buildShortSlug, buildSitemapXml, buildTagLabels, bulkModerationSchema, collectImageSources, communityDisplayNameSchema, communityRevisionSchema, contentSettingsSchema, countWords, createCommunityPostSchema, createFromTemplateSchema, createHeadingIdGenerator, createPostReportSchema, createPostSchema, createRecurrenceSchema, documentToPlainText, escapeHtml, escapeXml, estimateReadingTimeMinutes, formatTagLabel, httpUrlSchema, inlineToPlainText, isAbsoluteHttpUrl, isCanonicalPostRef, isPostStatus, isProtocolRelativeUrl, isShortId, isValidSlug, listPostReportsQuerySchema, listPostsQuerySchema, listPublishedPostsQuerySchema, markdownToPlainText, normalizeTag, normalizeTags, parseInline, parseMarkdown, parsePostPath, parsePostRef, postFieldsSchema, publishPostSchema, rejectPostSchema, renderMarkdownDocument, renderMarkdownToHtml, republishPostSchema, resolveHeadingLevel, sanitizeImageUrl, sanitizeLinkUrl, saveAsTemplateSchema, slugSchema, slugify, submitCommunityPostSchema, unpublishCommunityPostSchema, updateCommunityPostSchema, updatePostSchema, updateRecurrenceSchema, withSlugSuffix };
|