@adatechnology/content-contracts 0.1.0 → 0.3.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 CHANGED
@@ -28,35 +28,55 @@ __export(index_exports, {
28
28
  DEFAULT_LINK_REL: () => DEFAULT_LINK_REL,
29
29
  DEFAULT_POST_PATH_TEMPLATE: () => DEFAULT_POST_PATH_TEMPLATE,
30
30
  DEFAULT_PUBLIC_CACHE_CONTROL: () => DEFAULT_PUBLIC_CACHE_CONTROL,
31
+ DEFAULT_SHORT_SLUG_LENGTH: () => DEFAULT_SHORT_SLUG_LENGTH,
31
32
  DEFAULT_WORDS_PER_MINUTE: () => DEFAULT_WORDS_PER_MINUTE,
32
33
  DuplicateSlugError: () => DuplicateSlugError,
33
34
  ImageStorageDisabledError: () => ImageStorageDisabledError,
34
35
  InvalidCoverImageError: () => InvalidCoverImageError,
35
36
  InvalidSlugError: () => InvalidSlugError,
37
+ NotATemplateError: () => NotATemplateError,
36
38
  POST_EVENT: () => POST_EVENT,
37
39
  POST_LIMITS: () => POST_LIMITS,
40
+ POST_SORT_FIELDS: () => POST_SORT_FIELDS,
38
41
  POST_STATUS: () => POST_STATUS,
39
42
  POST_STATUSES: () => POST_STATUSES,
43
+ PT_BR_STOP_WORDS: () => PT_BR_STOP_WORDS,
40
44
  PostNotFoundError: () => PostNotFoundError,
45
+ PostNotPublishedError: () => PostNotPublishedError,
46
+ RECURRENCE_FREQUENCIES: () => RECURRENCE_FREQUENCIES,
47
+ RECURRENCE_FREQUENCY: () => RECURRENCE_FREQUENCY,
48
+ RecurrenceNotFoundError: () => RecurrenceNotFoundError,
49
+ RepublishDateInFutureError: () => RepublishDateInFutureError,
50
+ SHORT_ID_LENGTH: () => SHORT_ID_LENGTH,
41
51
  SLUG_MAX_LENGTH: () => SLUG_MAX_LENGTH,
42
52
  TAGS_MAX_COUNT: () => TAGS_MAX_COUNT,
43
53
  TAG_MAX_LENGTH: () => TAG_MAX_LENGTH,
54
+ TemplateNotPublishableError: () => TemplateNotPublishableError,
44
55
  buildAtomFeed: () => buildAtomFeed,
45
56
  buildExcerpt: () => buildExcerpt,
57
+ buildPostPath: () => buildPostPath,
58
+ buildPostRef: () => buildPostRef,
46
59
  buildPostUrl: () => buildPostUrl,
47
60
  buildRssFeed: () => buildRssFeed,
61
+ buildShortSlug: () => buildShortSlug,
48
62
  buildSitemapXml: () => buildSitemapXml,
63
+ buildTagLabels: () => buildTagLabels,
49
64
  countWords: () => countWords,
65
+ createFromTemplateSchema: () => createFromTemplateSchema,
50
66
  createHeadingIdGenerator: () => createHeadingIdGenerator,
51
67
  createPostSchema: () => createPostSchema,
68
+ createRecurrenceSchema: () => createRecurrenceSchema,
52
69
  documentToPlainText: () => documentToPlainText,
53
70
  escapeHtml: () => escapeHtml,
54
71
  escapeXml: () => escapeXml,
55
72
  estimateReadingTimeMinutes: () => estimateReadingTimeMinutes,
73
+ formatTagLabel: () => formatTagLabel,
56
74
  httpUrlSchema: () => httpUrlSchema,
57
75
  inlineToPlainText: () => inlineToPlainText,
58
76
  isAbsoluteHttpUrl: () => isAbsoluteHttpUrl,
77
+ isCanonicalPostRef: () => isCanonicalPostRef,
59
78
  isPostStatus: () => isPostStatus,
79
+ isShortId: () => isShortId,
60
80
  isValidSlug: () => isValidSlug,
61
81
  listPostsQuerySchema: () => listPostsQuerySchema,
62
82
  listPublishedPostsQuerySchema: () => listPublishedPostsQuerySchema,
@@ -65,16 +85,21 @@ __export(index_exports, {
65
85
  normalizeTags: () => normalizeTags,
66
86
  parseInline: () => parseInline,
67
87
  parseMarkdown: () => parseMarkdown,
88
+ parsePostPath: () => parsePostPath,
89
+ parsePostRef: () => parsePostRef,
68
90
  postFieldsSchema: () => postFieldsSchema,
69
91
  publishPostSchema: () => publishPostSchema,
70
92
  renderMarkdownDocument: () => renderMarkdownDocument,
71
93
  renderMarkdownToHtml: () => renderMarkdownToHtml,
94
+ republishPostSchema: () => republishPostSchema,
72
95
  resolveHeadingLevel: () => resolveHeadingLevel,
73
96
  sanitizeImageUrl: () => sanitizeImageUrl,
74
97
  sanitizeLinkUrl: () => sanitizeLinkUrl,
98
+ saveAsTemplateSchema: () => saveAsTemplateSchema,
75
99
  slugSchema: () => slugSchema,
76
100
  slugify: () => slugify,
77
101
  updatePostSchema: () => updatePostSchema,
102
+ updateRecurrenceSchema: () => updateRecurrenceSchema,
78
103
  withSlugSuffix: () => withSlugSuffix
79
104
  });
80
105
  module.exports = __toCommonJS(index_exports);
@@ -91,6 +116,11 @@ function isPostStatus(value) {
91
116
  return typeof value === "string" && POST_STATUSES.includes(value);
92
117
  }
93
118
  __name(isPostStatus, "isPostStatus");
119
+ var RECURRENCE_FREQUENCY = {
120
+ WEEKLY: "weekly",
121
+ MONTHLY: "monthly"
122
+ };
123
+ var RECURRENCE_FREQUENCIES = Object.values(RECURRENCE_FREQUENCY);
94
124
 
95
125
  // src/errors.ts
96
126
  var ContentError = class extends Error {
@@ -111,7 +141,12 @@ var CONTENT_ERROR_CODES = {
111
141
  INVALID_SLUG: "CONTENT_INVALID_SLUG",
112
142
  CONFIG_MISSING: "CONTENT_CONFIG_MISSING",
113
143
  INVALID_IMAGE: "CONTENT_INVALID_IMAGE",
114
- IMAGE_STORAGE_DISABLED: "CONTENT_IMAGE_STORAGE_DISABLED"
144
+ IMAGE_STORAGE_DISABLED: "CONTENT_IMAGE_STORAGE_DISABLED",
145
+ NOT_A_TEMPLATE: "CONTENT_NOT_A_TEMPLATE",
146
+ TEMPLATE_NOT_PUBLISHABLE: "CONTENT_TEMPLATE_NOT_PUBLISHABLE",
147
+ NOT_PUBLISHED: "CONTENT_NOT_PUBLISHED",
148
+ REPUBLISH_DATE_IN_FUTURE: "CONTENT_REPUBLISH_DATE_IN_FUTURE",
149
+ RECURRENCE_NOT_FOUND: "CONTENT_RECURRENCE_NOT_FOUND"
115
150
  };
116
151
  var PostNotFoundError = class extends ContentError {
117
152
  static {
@@ -176,6 +211,58 @@ var ImageStorageDisabledError = class extends ContentError {
176
211
  super("Envio de imagem n\xE3o configurado.", 501, CONTENT_ERROR_CODES.IMAGE_STORAGE_DISABLED);
177
212
  }
178
213
  };
214
+ var NotATemplateError = class extends ContentError {
215
+ static {
216
+ __name(this, "NotATemplateError");
217
+ }
218
+ postId;
219
+ constructor(postId) {
220
+ super("Este post n\xE3o \xE9 um modelo.", 422, CONTENT_ERROR_CODES.NOT_A_TEMPLATE, {
221
+ postId
222
+ }), this.postId = postId;
223
+ }
224
+ };
225
+ var TemplateNotPublishableError = class extends ContentError {
226
+ static {
227
+ __name(this, "TemplateNotPublishableError");
228
+ }
229
+ postId;
230
+ constructor(postId) {
231
+ super("Modelo n\xE3o pode ser publicado: crie um post a partir dele.", 422, CONTENT_ERROR_CODES.TEMPLATE_NOT_PUBLISHABLE, {
232
+ postId
233
+ }), this.postId = postId;
234
+ }
235
+ };
236
+ var PostNotPublishedError = class extends ContentError {
237
+ static {
238
+ __name(this, "PostNotPublishedError");
239
+ }
240
+ postId;
241
+ constructor(postId) {
242
+ super("S\xF3 post publicado pode ser republicado.", 422, CONTENT_ERROR_CODES.NOT_PUBLISHED, {
243
+ postId
244
+ }), this.postId = postId;
245
+ }
246
+ };
247
+ var RepublishDateInFutureError = class extends ContentError {
248
+ static {
249
+ __name(this, "RepublishDateInFutureError");
250
+ }
251
+ constructor() {
252
+ super("A nova data n\xE3o pode ser futura: o post sairia do ar at\xE9 l\xE1.", 422, CONTENT_ERROR_CODES.REPUBLISH_DATE_IN_FUTURE);
253
+ }
254
+ };
255
+ var RecurrenceNotFoundError = class extends ContentError {
256
+ static {
257
+ __name(this, "RecurrenceNotFoundError");
258
+ }
259
+ reference;
260
+ constructor(reference) {
261
+ super("Recorr\xEAncia n\xE3o encontrada.", 404, CONTENT_ERROR_CODES.RECURRENCE_NOT_FOUND, {
262
+ reference
263
+ }), this.reference = reference;
264
+ }
265
+ };
179
266
 
180
267
  // src/schemas.ts
181
268
  var import_zod = require("zod");
@@ -201,6 +288,58 @@ function withSlugSuffix(slug, attempt) {
201
288
  return `${slug.slice(0, SLUG_MAX_LENGTH - suffix.length).replace(/-+$/g, "")}${suffix}`;
202
289
  }
203
290
  __name(withSlugSuffix, "withSlugSuffix");
291
+ var DEFAULT_SHORT_SLUG_LENGTH = 60;
292
+ var PT_BR_STOP_WORDS = [
293
+ "a",
294
+ "as",
295
+ "o",
296
+ "os",
297
+ "um",
298
+ "uma",
299
+ "uns",
300
+ "umas",
301
+ "de",
302
+ "da",
303
+ "das",
304
+ "do",
305
+ "dos",
306
+ "em",
307
+ "na",
308
+ "nas",
309
+ "no",
310
+ "nos",
311
+ "e",
312
+ "ou",
313
+ "para",
314
+ "pra",
315
+ "pro",
316
+ "por",
317
+ "pelo",
318
+ "pela",
319
+ "pelos",
320
+ "pelas",
321
+ "com",
322
+ "sem",
323
+ "ao",
324
+ "aos",
325
+ "que",
326
+ "se"
327
+ ];
328
+ function buildShortSlug(title, options = {}) {
329
+ const maxLength = Math.min(options.maxLength ?? DEFAULT_SHORT_SLUG_LENGTH, SLUG_MAX_LENGTH);
330
+ const words = slugify(title).split("-").filter(Boolean);
331
+ const stop = new Set(options.stopWords === false ? [] : options.stopWords ?? PT_BR_STOP_WORDS);
332
+ const meaningful = words.filter((word) => !stop.has(word));
333
+ const kept = meaningful.length > 0 ? meaningful : words;
334
+ let slug = "";
335
+ for (const word of kept) {
336
+ const next = slug ? `${slug}-${word}` : word;
337
+ if (next.length > maxLength) break;
338
+ slug = next;
339
+ }
340
+ return slug || (kept[0] ?? "").slice(0, maxLength).replace(/-+$/g, "");
341
+ }
342
+ __name(buildShortSlug, "buildShortSlug");
204
343
 
205
344
  // src/tags.ts
206
345
  var TAG_MAX_LENGTH = 40;
@@ -221,6 +360,25 @@ function normalizeTags(values) {
221
360
  return result.slice(0, TAGS_MAX_COUNT);
222
361
  }
223
362
  __name(normalizeTags, "normalizeTags");
363
+ function buildTagLabels(params) {
364
+ const labels = {};
365
+ for (const value of params.typed) {
366
+ const tag = normalizeTag(value);
367
+ if (!tag) continue;
368
+ const typed = value.trim().replace(/\s+/g, " ").slice(0, TAG_MAX_LENGTH);
369
+ const label = params.explicit?.[tag]?.trim() || (typed !== tag ? typed : void 0) || params.previous?.[tag];
370
+ if (label && label !== tag) labels[tag] = label;
371
+ }
372
+ return labels;
373
+ }
374
+ __name(buildTagLabels, "buildTagLabels");
375
+ function formatTagLabel(tag, labels) {
376
+ const stored = labels?.[tag];
377
+ if (stored) return stored;
378
+ const spaced = tag.replace(/-+/g, " ").trim();
379
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
380
+ }
381
+ __name(formatTagLabel, "formatTagLabel");
224
382
 
225
383
  // src/schemas.ts
226
384
  var POST_LIMITS = {
@@ -251,6 +409,8 @@ var postFieldsSchema = import_zod.z.object({
251
409
  coverImageUrl: httpUrlSchema.nullable().optional(),
252
410
  coverImageAlt: optionalText(POST_LIMITS.IMAGE_ALT),
253
411
  tags: import_zod.z.array(import_zod.z.string().trim().min(1).max(TAG_MAX_LENGTH)).max(TAGS_MAX_COUNT).optional(),
412
+ /** Rótulo de exibição por tag (chave = tag normalizada). Sem rótulo, vale o texto digitado. */
413
+ tagLabels: import_zod.z.record(import_zod.z.string().trim().min(1).max(TAG_MAX_LENGTH)).optional(),
254
414
  authorName: optionalText(POST_LIMITS.AUTHOR_NAME),
255
415
  seoTitle: optionalText(POST_LIMITS.SEO_TITLE),
256
416
  seoDescription: optionalText(POST_LIMITS.SEO_DESCRIPTION),
@@ -266,18 +426,62 @@ var publishPostSchema = import_zod.z.object({
266
426
  }).optional()
267
427
  }).strict();
268
428
  var pageSchema = import_zod.z.coerce.number().int().min(1).max(1e4).default(1);
429
+ var POST_SORT_FIELDS = [
430
+ "title",
431
+ "status",
432
+ "publishedAt",
433
+ "updatedAt"
434
+ ];
269
435
  var listPostsQuerySchema = import_zod.z.object({
270
436
  page: pageSchema,
271
437
  pageSize: import_zod.z.coerce.number().int().min(1).max(POST_LIMITS.ADMIN_PAGE_SIZE).default(20),
272
438
  status: import_zod.z.enum(POST_STATUSES).optional(),
273
- tag: import_zod.z.string().trim().min(1).max(TAG_MAX_LENGTH).optional(),
274
- search: import_zod.z.string().trim().min(1).max(POST_LIMITS.SEARCH).optional()
439
+ /** Uma tag, ou várias separadas por vírgula (basta ter UMA delas). */
440
+ tag: import_zod.z.string().trim().min(1).max(TAG_MAX_LENGTH * TAGS_MAX_COUNT).optional(),
441
+ search: import_zod.z.string().trim().min(1).max(POST_LIMITS.SEARCH).optional(),
442
+ /** Padrão: `updatedAt` (o que o painel mexeu por último). */
443
+ sort: import_zod.z.enum(POST_SORT_FIELDS).default("updatedAt"),
444
+ order: import_zod.z.enum([
445
+ "asc",
446
+ "desc"
447
+ ]).default("desc"),
448
+ /** `true`: só modelos. Ausente/`false`: só posts (modelo nunca aparece misturado na lista). */
449
+ isTemplate: import_zod.z.union([
450
+ import_zod.z.boolean(),
451
+ import_zod.z.enum([
452
+ "true",
453
+ "false"
454
+ ])
455
+ ]).transform((value) => value === true || value === "true").optional()
275
456
  });
276
457
  var listPublishedPostsQuerySchema = import_zod.z.object({
277
458
  page: pageSchema,
278
459
  pageSize: import_zod.z.coerce.number().int().min(1).max(POST_LIMITS.PUBLIC_PAGE_SIZE).default(10),
279
460
  tag: import_zod.z.string().trim().min(1).max(TAG_MAX_LENGTH).optional()
280
461
  });
462
+ var isoInstant = import_zod.z.string().datetime({
463
+ offset: true
464
+ });
465
+ var saveAsTemplateSchema = import_zod.z.object({
466
+ title: import_zod.z.string().trim().min(1).max(POST_LIMITS.TITLE).optional()
467
+ }).strict();
468
+ var createFromTemplateSchema = import_zod.z.object({
469
+ title: import_zod.z.string().trim().min(1).max(POST_LIMITS.TITLE).optional(),
470
+ slug: slugSchema.optional()
471
+ }).strict();
472
+ var republishPostSchema = import_zod.z.object({
473
+ publishedAt: isoInstant.optional()
474
+ }).strict();
475
+ var createRecurrenceSchema = import_zod.z.object({
476
+ templateId: import_zod.z.string().uuid(),
477
+ frequency: import_zod.z.enum(RECURRENCE_FREQUENCIES),
478
+ /** Primeira publicação automática. */
479
+ startsAt: isoInstant
480
+ }).strict();
481
+ var updateRecurrenceSchema = import_zod.z.object({
482
+ isActive: import_zod.z.boolean().optional(),
483
+ nextRunAt: isoInstant.optional()
484
+ }).strict();
281
485
 
282
486
  // src/providers.ts
283
487
  var POST_EVENT = {
@@ -285,13 +489,60 @@ var POST_EVENT = {
285
489
  UPDATED: "updated",
286
490
  PUBLISHED: "published",
287
491
  UNPUBLISHED: "unpublished",
288
- ARCHIVED: "archived"
492
+ ARCHIVED: "archived",
493
+ REPUBLISHED: "republished"
289
494
  };
290
495
  var DEFAULT_ADMIN_SCOPES = [
291
496
  "content:admin"
292
497
  ];
293
498
  var DEFAULT_PUBLIC_CACHE_CONTROL = "public, max-age=60, s-maxage=300, stale-while-revalidate=600";
294
499
 
500
+ // src/postPath.ts
501
+ var SHORT_ID_LENGTH = 6;
502
+ var SHORT_ID_PATTERN = /^[0-9a-z]{6}$/;
503
+ var REF_PATTERN = /^([0-9a-z]{6})-(.+)$/;
504
+ function isShortId(value) {
505
+ return SHORT_ID_PATTERN.test(value);
506
+ }
507
+ __name(isShortId, "isShortId");
508
+ function buildPostRef(params) {
509
+ return `${params.shortId}-${params.slug}`;
510
+ }
511
+ __name(buildPostRef, "buildPostRef");
512
+ function buildPostPath(params) {
513
+ const base = params.basePath.replace(/\/+$/g, "");
514
+ return `${base}/${encodeURIComponent(buildPostRef(params))}`;
515
+ }
516
+ __name(buildPostPath, "buildPostPath");
517
+ function parsePostRef(ref) {
518
+ const slug = ref.trim().toLowerCase();
519
+ const match = REF_PATTERN.exec(slug);
520
+ return match?.[1] ? {
521
+ shortId: match[1],
522
+ slug
523
+ } : {
524
+ slug
525
+ };
526
+ }
527
+ __name(parsePostRef, "parsePostRef");
528
+ function parsePostPath(params) {
529
+ const base = params.basePath.replace(/\/+$/g, "");
530
+ const clean = params.path.split(/[?#]/)[0] ?? "";
531
+ if (!clean.startsWith(`${base}/`)) return void 0;
532
+ const rest = clean.slice(base.length + 1).replace(/\/+$/g, "");
533
+ if (!rest || rest.includes("/")) return void 0;
534
+ try {
535
+ return parsePostRef(decodeURIComponent(rest));
536
+ } catch {
537
+ return void 0;
538
+ }
539
+ }
540
+ __name(parsePostPath, "parsePostPath");
541
+ function isCanonicalPostRef(params) {
542
+ return params.ref.trim().toLowerCase() === buildPostRef(params);
543
+ }
544
+ __name(isCanonicalPostRef, "isCanonicalPostRef");
545
+
295
546
  // src/markdown/sanitizeUrl.ts
296
547
  var LINK_SCHEMES = /* @__PURE__ */ new Set([
297
548
  "http",
@@ -649,6 +900,47 @@ function parseDestination(text, start) {
649
900
  }
650
901
  __name(parseDestination, "parseDestination");
651
902
 
903
+ // src/markdown/paragraphToBlock.ts
904
+ function isFiller(node) {
905
+ return node.type === "break" || node.type === "text" && !node.value.trim();
906
+ }
907
+ __name(isFiller, "isFiller");
908
+ function paragraphToBlock(children) {
909
+ const meaningful = children.filter((node) => !isFiller(node));
910
+ const images = meaningful.filter((node) => node.type === "image");
911
+ if (images.length === 0 || images.length !== meaningful.length) return {
912
+ type: "paragraph",
913
+ children
914
+ };
915
+ const [only] = images;
916
+ if (images.length === 1 && only?.title) {
917
+ return {
918
+ type: "figure",
919
+ image: {
920
+ src: only.src,
921
+ alt: only.alt
922
+ },
923
+ caption: only.title
924
+ };
925
+ }
926
+ if (images.length < 2) return {
927
+ type: "paragraph",
928
+ children
929
+ };
930
+ const gallery = images.map((image) => ({
931
+ src: image.src,
932
+ alt: image.alt,
933
+ ...image.title ? {
934
+ caption: image.title
935
+ } : {}
936
+ }));
937
+ return {
938
+ type: "gallery",
939
+ images: gallery
940
+ };
941
+ }
942
+ __name(paragraphToBlock, "paragraphToBlock");
943
+
652
944
  // src/markdown/parseMarkdown.ts
653
945
  var MAX_BLOCK_DEPTH = 6;
654
946
  var FENCE_PATTERN = /^ {0,3}(`{3,}|~{3,})\s*([^\s`]*)[^`]*$/;
@@ -770,10 +1062,7 @@ function parseParagraph(lines, index, depth) {
770
1062
  cursor += 1;
771
1063
  }
772
1064
  return {
773
- block: {
774
- type: "paragraph",
775
- children: parseInline(content.join("\n").trimEnd())
776
- },
1065
+ block: paragraphToBlock(parseInline(content.join("\n").trimEnd())),
777
1066
  next: cursor
778
1067
  };
779
1068
  }
@@ -885,7 +1174,10 @@ function blockToPlainText(block) {
885
1174
  return block.children.map(blockToPlainText).join("\n\n");
886
1175
  case "list":
887
1176
  return block.items.map((item) => item.map(blockToPlainText).join("\n")).join("\n");
1177
+ case "figure":
1178
+ return block.caption;
888
1179
  case "thematicBreak":
1180
+ case "gallery":
889
1181
  return "";
890
1182
  }
891
1183
  }
@@ -981,6 +1273,12 @@ function renderInlineNode(node, context) {
981
1273
  }
982
1274
  }
983
1275
  __name(renderInlineNode, "renderInlineNode");
1276
+ function renderFigure(image, caption) {
1277
+ const img = `<img src="${escapeHtml(image.src)}" alt="${escapeHtml(image.alt)}" loading="lazy" decoding="async">`;
1278
+ const figcaption = caption ? `<figcaption>${escapeHtml(caption)}</figcaption>` : "";
1279
+ return `<figure class="adc-figure">${img}${figcaption}</figure>`;
1280
+ }
1281
+ __name(renderFigure, "renderFigure");
984
1282
  function renderBlock(block, context, tight = false) {
985
1283
  switch (block.type) {
986
1284
  case "heading": {
@@ -998,6 +1296,10 @@ function renderBlock(block, context, tight = false) {
998
1296
  }
999
1297
  case "thematicBreak":
1000
1298
  return "<hr>";
1299
+ case "figure":
1300
+ return renderFigure(block.image, block.caption);
1301
+ case "gallery":
1302
+ return `<div class="adc-gallery" data-count="${block.images.length}">${block.images.map((image) => renderFigure(image, image.caption)).join("")}</div>`;
1001
1303
  case "list": {
1002
1304
  const tag = block.ordered ? "ol" : "ul";
1003
1305
  const start = block.ordered && block.start !== void 0 && block.start !== 1 ? ` start="${block.start}"` : "";
@@ -1035,7 +1337,7 @@ function escapeXml(value) {
1035
1337
  __name(escapeXml, "escapeXml");
1036
1338
  function buildPostUrl(params) {
1037
1339
  const base = params.siteUrl.replace(/\/+$/, "");
1038
- const path = (params.postPathTemplate ?? DEFAULT_POST_PATH_TEMPLATE).replace("{slug}", encodeURIComponent(params.slug));
1340
+ const path = (params.postPathTemplate ?? DEFAULT_POST_PATH_TEMPLATE).replace("{shortId}", encodeURIComponent(params.shortId ?? "")).replace("{slug}", encodeURIComponent(params.slug));
1039
1341
  return `${base}${path.startsWith("/") ? path : `/${path}`}`;
1040
1342
  }
1041
1343
  __name(buildPostUrl, "buildPostUrl");
@@ -1123,35 +1425,55 @@ __name(buildSitemapXml, "buildSitemapXml");
1123
1425
  DEFAULT_LINK_REL,
1124
1426
  DEFAULT_POST_PATH_TEMPLATE,
1125
1427
  DEFAULT_PUBLIC_CACHE_CONTROL,
1428
+ DEFAULT_SHORT_SLUG_LENGTH,
1126
1429
  DEFAULT_WORDS_PER_MINUTE,
1127
1430
  DuplicateSlugError,
1128
1431
  ImageStorageDisabledError,
1129
1432
  InvalidCoverImageError,
1130
1433
  InvalidSlugError,
1434
+ NotATemplateError,
1131
1435
  POST_EVENT,
1132
1436
  POST_LIMITS,
1437
+ POST_SORT_FIELDS,
1133
1438
  POST_STATUS,
1134
1439
  POST_STATUSES,
1440
+ PT_BR_STOP_WORDS,
1135
1441
  PostNotFoundError,
1442
+ PostNotPublishedError,
1443
+ RECURRENCE_FREQUENCIES,
1444
+ RECURRENCE_FREQUENCY,
1445
+ RecurrenceNotFoundError,
1446
+ RepublishDateInFutureError,
1447
+ SHORT_ID_LENGTH,
1136
1448
  SLUG_MAX_LENGTH,
1137
1449
  TAGS_MAX_COUNT,
1138
1450
  TAG_MAX_LENGTH,
1451
+ TemplateNotPublishableError,
1139
1452
  buildAtomFeed,
1140
1453
  buildExcerpt,
1454
+ buildPostPath,
1455
+ buildPostRef,
1141
1456
  buildPostUrl,
1142
1457
  buildRssFeed,
1458
+ buildShortSlug,
1143
1459
  buildSitemapXml,
1460
+ buildTagLabels,
1144
1461
  countWords,
1462
+ createFromTemplateSchema,
1145
1463
  createHeadingIdGenerator,
1146
1464
  createPostSchema,
1465
+ createRecurrenceSchema,
1147
1466
  documentToPlainText,
1148
1467
  escapeHtml,
1149
1468
  escapeXml,
1150
1469
  estimateReadingTimeMinutes,
1470
+ formatTagLabel,
1151
1471
  httpUrlSchema,
1152
1472
  inlineToPlainText,
1153
1473
  isAbsoluteHttpUrl,
1474
+ isCanonicalPostRef,
1154
1475
  isPostStatus,
1476
+ isShortId,
1155
1477
  isValidSlug,
1156
1478
  listPostsQuerySchema,
1157
1479
  listPublishedPostsQuerySchema,
@@ -1160,16 +1482,21 @@ __name(buildSitemapXml, "buildSitemapXml");
1160
1482
  normalizeTags,
1161
1483
  parseInline,
1162
1484
  parseMarkdown,
1485
+ parsePostPath,
1486
+ parsePostRef,
1163
1487
  postFieldsSchema,
1164
1488
  publishPostSchema,
1165
1489
  renderMarkdownDocument,
1166
1490
  renderMarkdownToHtml,
1491
+ republishPostSchema,
1167
1492
  resolveHeadingLevel,
1168
1493
  sanitizeImageUrl,
1169
1494
  sanitizeLinkUrl,
1495
+ saveAsTemplateSchema,
1170
1496
  slugSchema,
1171
1497
  slugify,
1172
1498
  updatePostSchema,
1499
+ updateRecurrenceSchema,
1173
1500
  withSlugSuffix
1174
1501
  });
1175
1502
  //# sourceMappingURL=index.cjs.map