@01.software/sdk 0.29.0 → 0.31.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.
Files changed (78) hide show
  1. package/README.md +331 -77
  2. package/dist/analytics/react.cjs +4 -1
  3. package/dist/analytics/react.cjs.map +1 -1
  4. package/dist/analytics/react.js +4 -1
  5. package/dist/analytics/react.js.map +1 -1
  6. package/dist/analytics.cjs +4 -1
  7. package/dist/analytics.cjs.map +1 -1
  8. package/dist/analytics.js +4 -1
  9. package/dist/analytics.js.map +1 -1
  10. package/dist/client.cjs +1541 -0
  11. package/dist/client.cjs.map +1 -0
  12. package/dist/client.d.cts +28 -0
  13. package/dist/client.d.ts +28 -0
  14. package/dist/client.js +1518 -0
  15. package/dist/client.js.map +1 -0
  16. package/dist/collection-client-ByzY3hWK.d.ts +218 -0
  17. package/dist/collection-client-DFXXz0vk.d.cts +218 -0
  18. package/dist/{const-DAjQYNuM.d.ts → const-AytzliEu.d.cts} +5 -7
  19. package/dist/{const-Dsixdi6z.d.cts → const-BGCP-OJL.d.ts} +5 -7
  20. package/dist/index-BGEhoDUs.d.cts +106 -0
  21. package/dist/index-BGEhoDUs.d.ts +106 -0
  22. package/dist/index.cjs +1006 -1615
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +11 -115
  25. package/dist/index.d.ts +11 -115
  26. package/dist/index.js +932 -1559
  27. package/dist/index.js.map +1 -1
  28. package/dist/metadata.cjs +91 -0
  29. package/dist/metadata.cjs.map +1 -0
  30. package/dist/metadata.d.cts +58 -0
  31. package/dist/metadata.d.ts +58 -0
  32. package/dist/metadata.js +68 -0
  33. package/dist/metadata.js.map +1 -0
  34. package/dist/{payload-types-Ci-ZA7aM.d.cts → payload-types-Wa4-eC6x.d.cts} +794 -532
  35. package/dist/{payload-types-Ci-ZA7aM.d.ts → payload-types-Wa4-eC6x.d.ts} +794 -532
  36. package/dist/query.cjs +1841 -0
  37. package/dist/query.cjs.map +1 -0
  38. package/dist/query.d.cts +244 -0
  39. package/dist/query.d.ts +244 -0
  40. package/dist/query.js +1836 -0
  41. package/dist/query.js.map +1 -0
  42. package/dist/realtime.cjs +4 -1
  43. package/dist/realtime.cjs.map +1 -1
  44. package/dist/realtime.d.cts +2 -2
  45. package/dist/realtime.d.ts +2 -2
  46. package/dist/realtime.js +4 -1
  47. package/dist/realtime.js.map +1 -1
  48. package/dist/{server-BINWywT8.d.cts → server-CrsPyqEc.d.cts} +14 -31
  49. package/dist/{server-BINWywT8.d.ts → server-CrsPyqEc.d.ts} +14 -31
  50. package/dist/server.cjs +430 -846
  51. package/dist/server.cjs.map +1 -1
  52. package/dist/server.d.cts +137 -7
  53. package/dist/server.d.ts +137 -7
  54. package/dist/server.js +430 -864
  55. package/dist/server.js.map +1 -1
  56. package/dist/{server-Cv0Q4dPQ.d.ts → types-BX2mqDf6.d.ts} +270 -743
  57. package/dist/{types-BWq_WlbB.d.ts → types-CVA10VC-.d.ts} +6 -2
  58. package/dist/{types-zKjATmDK.d.cts → types-CmLG-7RL.d.cts} +6 -2
  59. package/dist/{server-C0C8dtms.d.cts → types-DChFjQGz.d.cts} +270 -743
  60. package/dist/ui/canvas/server.cjs +7 -6
  61. package/dist/ui/canvas/server.cjs.map +1 -1
  62. package/dist/ui/canvas/server.d.cts +1 -3
  63. package/dist/ui/canvas/server.d.ts +1 -3
  64. package/dist/ui/canvas/server.js +7 -6
  65. package/dist/ui/canvas/server.js.map +1 -1
  66. package/dist/ui/canvas.cjs +11 -10
  67. package/dist/ui/canvas.cjs.map +1 -1
  68. package/dist/ui/canvas.d.cts +29 -6
  69. package/dist/ui/canvas.d.ts +29 -6
  70. package/dist/ui/canvas.js +11 -10
  71. package/dist/ui/canvas.js.map +1 -1
  72. package/dist/ui/form.d.cts +1 -1
  73. package/dist/ui/form.d.ts +1 -1
  74. package/dist/ui/video.d.cts +1 -1
  75. package/dist/ui/video.d.ts +1 -1
  76. package/dist/webhook.d.cts +3 -3
  77. package/dist/webhook.d.ts +3 -3
  78. package/package.json +84 -15
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/core/metadata/index.ts
21
+ var metadata_exports = {};
22
+ __export(metadata_exports, {
23
+ extractSeo: () => extractSeo,
24
+ generateMetadata: () => generateMetadata
25
+ });
26
+ module.exports = __toCommonJS(metadata_exports);
27
+
28
+ // src/utils/types.ts
29
+ var resolveRelation = (ref) => {
30
+ if (typeof ref === "string" || typeof ref === "number" || ref === null || ref === void 0)
31
+ return null;
32
+ return ref;
33
+ };
34
+
35
+ // src/core/metadata/index.ts
36
+ function extractSeo(doc) {
37
+ const seo = doc.seo ?? {};
38
+ const og = seo.openGraph ?? {};
39
+ return {
40
+ title: seo.title ?? doc.title ?? null,
41
+ description: seo.description ?? null,
42
+ noIndex: seo.noIndex ?? null,
43
+ canonical: seo.canonical ?? null,
44
+ openGraph: {
45
+ title: og.title ?? null,
46
+ description: og.description ?? null,
47
+ image: og.image ?? null
48
+ }
49
+ };
50
+ }
51
+ function generateMetadata(input, options) {
52
+ const title = input.title ?? void 0;
53
+ const description = input.description ?? void 0;
54
+ const ogTitle = input.openGraph?.title ?? title;
55
+ const ogDescription = input.openGraph?.description ?? description;
56
+ const image = resolveMetaImage(input.openGraph?.image);
57
+ return {
58
+ title,
59
+ description,
60
+ ...input.noIndex && { robots: { index: false, follow: false } },
61
+ ...input.canonical && { alternates: { canonical: input.canonical } },
62
+ openGraph: {
63
+ ...ogTitle && { title: ogTitle },
64
+ ...ogDescription && { description: ogDescription },
65
+ ...options?.siteName && { siteName: options.siteName },
66
+ ...image && { images: [image] }
67
+ },
68
+ twitter: {
69
+ card: image ? "summary_large_image" : "summary",
70
+ ...ogTitle && { title: ogTitle },
71
+ ...ogDescription && { description: ogDescription },
72
+ ...image && { images: [image.url] }
73
+ }
74
+ };
75
+ }
76
+ function resolveMetaImage(ref) {
77
+ const image = resolveRelation(ref);
78
+ if (!image) return null;
79
+ const sized = image.sizes?.["1536"];
80
+ const url = sized?.url || image.url;
81
+ if (!url) return null;
82
+ const width = sized?.url ? sized.width : image.width;
83
+ const height = sized?.url ? sized.height : image.height;
84
+ return {
85
+ url,
86
+ ...width && { width },
87
+ ...height && { height },
88
+ ...image.alt && { alt: image.alt }
89
+ };
90
+ }
91
+ //# sourceMappingURL=metadata.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/metadata/index.ts","../src/utils/types.ts"],"sourcesContent":["import { resolveRelation } from '../../utils/types'\n\nexport interface MetadataImage {\n url: string\n width?: number\n height?: number\n alt?: string\n}\n\nexport interface Metadata {\n title?: string\n description?: string\n robots?: {\n index?: boolean\n follow?: boolean\n }\n alternates?: {\n canonical?: string\n }\n openGraph?: {\n title?: string\n description?: string\n siteName?: string\n images?: MetadataImage[]\n }\n twitter?: {\n card?: 'summary' | 'summary_large_image'\n title?: string\n description?: string\n images?: string[]\n }\n}\n\nexport interface ImageLike {\n url?: string | null\n width?: number | null\n height?: number | null\n alt?: string | null\n sizes?: Record<\n string,\n | { url?: string | null; width?: number | null; height?: number | null }\n | undefined\n >\n}\n\nexport interface SeoInput {\n title?: string | null\n description?: string | null\n noIndex?: boolean | null\n canonical?: string | null\n openGraph?: {\n title?: string | null\n description?: string | null\n image?: ImageLike | string | null\n } | null\n}\n\nexport interface GenerateMetadataOptions {\n siteName?: string\n}\n\nexport function extractSeo(doc: Record<string, unknown>): SeoInput {\n const seo = (doc.seo ?? {}) as Record<string, unknown>\n const og = (seo.openGraph ?? {}) as Record<string, unknown>\n\n return {\n title: (seo.title as string) ?? (doc.title as string) ?? null,\n description: (seo.description as string) ?? null,\n noIndex: (seo.noIndex as boolean) ?? null,\n canonical: (seo.canonical as string) ?? null,\n openGraph: {\n title: (og.title as string) ?? null,\n description: (og.description as string) ?? null,\n image: (og.image as ImageLike | string | null) ?? null,\n },\n }\n}\n\nexport function generateMetadata(\n input: SeoInput,\n options?: GenerateMetadataOptions,\n): Metadata {\n const title = input.title ?? undefined\n const description = input.description ?? undefined\n\n const ogTitle = input.openGraph?.title ?? title\n const ogDescription = input.openGraph?.description ?? description\n const image = resolveMetaImage(input.openGraph?.image)\n\n return {\n title,\n description,\n ...(input.noIndex && { robots: { index: false, follow: false } }),\n ...(input.canonical && { alternates: { canonical: input.canonical } }),\n openGraph: {\n ...(ogTitle && { title: ogTitle }),\n ...(ogDescription && { description: ogDescription }),\n ...(options?.siteName && { siteName: options.siteName }),\n ...(image && { images: [image] }),\n },\n twitter: {\n card: image ? 'summary_large_image' : 'summary',\n ...(ogTitle && { title: ogTitle }),\n ...(ogDescription && { description: ogDescription }),\n ...(image && { images: [image.url] }),\n },\n }\n}\n\nfunction resolveMetaImage(\n ref: ImageLike | string | null | undefined,\n): MetadataImage | null {\n const image = resolveRelation<ImageLike>(ref)\n if (!image) return null\n\n // Prefer sizes['1536'] (closest to OG 1200px standard), fallback to original url\n const sized = image.sizes?.['1536']\n const url = sized?.url || image.url\n if (!url) return null\n\n const width = sized?.url ? sized.width : image.width\n const height = sized?.url ? sized.height : image.height\n\n return {\n url,\n ...(width && { width }),\n ...(height && { height }),\n ...(image.alt && { alt: image.alt }),\n }\n}\n","/**\n * Resolves a Payload CMS relation field value.\n * When depth is 0, relation fields return just the ID (string or number).\n * When depth > 0, they return the full document object (T).\n * This utility normalizes both cases to T | null.\n *\n * @param ref - The relation field value (T, string, number, null, or undefined)\n * @returns The resolved document object, or null if not populated\n */\nexport const resolveRelation = <T>(\n ref: T | string | number | null | undefined,\n): T | null => {\n if (\n typeof ref === 'string' ||\n typeof ref === 'number' ||\n ref === null ||\n ref === undefined\n )\n return null\n return ref\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,kBAAkB,CAC7B,QACa;AACb,MACE,OAAO,QAAQ,YACf,OAAO,QAAQ,YACf,QAAQ,QACR,QAAQ;AAER,WAAO;AACT,SAAO;AACT;;;ADyCO,SAAS,WAAW,KAAwC;AACjE,QAAM,MAAO,IAAI,OAAO,CAAC;AACzB,QAAM,KAAM,IAAI,aAAa,CAAC;AAE9B,SAAO;AAAA,IACL,OAAQ,IAAI,SAAqB,IAAI,SAAoB;AAAA,IACzD,aAAc,IAAI,eAA0B;AAAA,IAC5C,SAAU,IAAI,WAAuB;AAAA,IACrC,WAAY,IAAI,aAAwB;AAAA,IACxC,WAAW;AAAA,MACT,OAAQ,GAAG,SAAoB;AAAA,MAC/B,aAAc,GAAG,eAA0B;AAAA,MAC3C,OAAQ,GAAG,SAAuC;AAAA,IACpD;AAAA,EACF;AACF;AAEO,SAAS,iBACd,OACA,SACU;AACV,QAAM,QAAQ,MAAM,SAAS;AAC7B,QAAM,cAAc,MAAM,eAAe;AAEzC,QAAM,UAAU,MAAM,WAAW,SAAS;AAC1C,QAAM,gBAAgB,MAAM,WAAW,eAAe;AACtD,QAAM,QAAQ,iBAAiB,MAAM,WAAW,KAAK;AAErD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,GAAI,MAAM,WAAW,EAAE,QAAQ,EAAE,OAAO,OAAO,QAAQ,MAAM,EAAE;AAAA,IAC/D,GAAI,MAAM,aAAa,EAAE,YAAY,EAAE,WAAW,MAAM,UAAU,EAAE;AAAA,IACpE,WAAW;AAAA,MACT,GAAI,WAAW,EAAE,OAAO,QAAQ;AAAA,MAChC,GAAI,iBAAiB,EAAE,aAAa,cAAc;AAAA,MAClD,GAAI,SAAS,YAAY,EAAE,UAAU,QAAQ,SAAS;AAAA,MACtD,GAAI,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE;AAAA,IACjC;AAAA,IACA,SAAS;AAAA,MACP,MAAM,QAAQ,wBAAwB;AAAA,MACtC,GAAI,WAAW,EAAE,OAAO,QAAQ;AAAA,MAChC,GAAI,iBAAiB,EAAE,aAAa,cAAc;AAAA,MAClD,GAAI,SAAS,EAAE,QAAQ,CAAC,MAAM,GAAG,EAAE;AAAA,IACrC;AAAA,EACF;AACF;AAEA,SAAS,iBACP,KACsB;AACtB,QAAM,QAAQ,gBAA2B,GAAG;AAC5C,MAAI,CAAC,MAAO,QAAO;AAGnB,QAAM,QAAQ,MAAM,QAAQ,MAAM;AAClC,QAAM,MAAM,OAAO,OAAO,MAAM;AAChC,MAAI,CAAC,IAAK,QAAO;AAEjB,QAAM,QAAQ,OAAO,MAAM,MAAM,QAAQ,MAAM;AAC/C,QAAM,SAAS,OAAO,MAAM,MAAM,SAAS,MAAM;AAEjD,SAAO;AAAA,IACL;AAAA,IACA,GAAI,SAAS,EAAE,MAAM;AAAA,IACrB,GAAI,UAAU,EAAE,OAAO;AAAA,IACvB,GAAI,MAAM,OAAO,EAAE,KAAK,MAAM,IAAI;AAAA,EACpC;AACF;","names":[]}
@@ -0,0 +1,58 @@
1
+ interface MetadataImage {
2
+ url: string;
3
+ width?: number;
4
+ height?: number;
5
+ alt?: string;
6
+ }
7
+ interface Metadata {
8
+ title?: string;
9
+ description?: string;
10
+ robots?: {
11
+ index?: boolean;
12
+ follow?: boolean;
13
+ };
14
+ alternates?: {
15
+ canonical?: string;
16
+ };
17
+ openGraph?: {
18
+ title?: string;
19
+ description?: string;
20
+ siteName?: string;
21
+ images?: MetadataImage[];
22
+ };
23
+ twitter?: {
24
+ card?: 'summary' | 'summary_large_image';
25
+ title?: string;
26
+ description?: string;
27
+ images?: string[];
28
+ };
29
+ }
30
+ interface ImageLike {
31
+ url?: string | null;
32
+ width?: number | null;
33
+ height?: number | null;
34
+ alt?: string | null;
35
+ sizes?: Record<string, {
36
+ url?: string | null;
37
+ width?: number | null;
38
+ height?: number | null;
39
+ } | undefined>;
40
+ }
41
+ interface SeoInput {
42
+ title?: string | null;
43
+ description?: string | null;
44
+ noIndex?: boolean | null;
45
+ canonical?: string | null;
46
+ openGraph?: {
47
+ title?: string | null;
48
+ description?: string | null;
49
+ image?: ImageLike | string | null;
50
+ } | null;
51
+ }
52
+ interface GenerateMetadataOptions {
53
+ siteName?: string;
54
+ }
55
+ declare function extractSeo(doc: Record<string, unknown>): SeoInput;
56
+ declare function generateMetadata(input: SeoInput, options?: GenerateMetadataOptions): Metadata;
57
+
58
+ export { type GenerateMetadataOptions, type ImageLike, type Metadata, type MetadataImage, type SeoInput, extractSeo, generateMetadata };
@@ -0,0 +1,58 @@
1
+ interface MetadataImage {
2
+ url: string;
3
+ width?: number;
4
+ height?: number;
5
+ alt?: string;
6
+ }
7
+ interface Metadata {
8
+ title?: string;
9
+ description?: string;
10
+ robots?: {
11
+ index?: boolean;
12
+ follow?: boolean;
13
+ };
14
+ alternates?: {
15
+ canonical?: string;
16
+ };
17
+ openGraph?: {
18
+ title?: string;
19
+ description?: string;
20
+ siteName?: string;
21
+ images?: MetadataImage[];
22
+ };
23
+ twitter?: {
24
+ card?: 'summary' | 'summary_large_image';
25
+ title?: string;
26
+ description?: string;
27
+ images?: string[];
28
+ };
29
+ }
30
+ interface ImageLike {
31
+ url?: string | null;
32
+ width?: number | null;
33
+ height?: number | null;
34
+ alt?: string | null;
35
+ sizes?: Record<string, {
36
+ url?: string | null;
37
+ width?: number | null;
38
+ height?: number | null;
39
+ } | undefined>;
40
+ }
41
+ interface SeoInput {
42
+ title?: string | null;
43
+ description?: string | null;
44
+ noIndex?: boolean | null;
45
+ canonical?: string | null;
46
+ openGraph?: {
47
+ title?: string | null;
48
+ description?: string | null;
49
+ image?: ImageLike | string | null;
50
+ } | null;
51
+ }
52
+ interface GenerateMetadataOptions {
53
+ siteName?: string;
54
+ }
55
+ declare function extractSeo(doc: Record<string, unknown>): SeoInput;
56
+ declare function generateMetadata(input: SeoInput, options?: GenerateMetadataOptions): Metadata;
57
+
58
+ export { type GenerateMetadataOptions, type ImageLike, type Metadata, type MetadataImage, type SeoInput, extractSeo, generateMetadata };
@@ -0,0 +1,68 @@
1
+ // src/utils/types.ts
2
+ var resolveRelation = (ref) => {
3
+ if (typeof ref === "string" || typeof ref === "number" || ref === null || ref === void 0)
4
+ return null;
5
+ return ref;
6
+ };
7
+
8
+ // src/core/metadata/index.ts
9
+ function extractSeo(doc) {
10
+ const seo = doc.seo ?? {};
11
+ const og = seo.openGraph ?? {};
12
+ return {
13
+ title: seo.title ?? doc.title ?? null,
14
+ description: seo.description ?? null,
15
+ noIndex: seo.noIndex ?? null,
16
+ canonical: seo.canonical ?? null,
17
+ openGraph: {
18
+ title: og.title ?? null,
19
+ description: og.description ?? null,
20
+ image: og.image ?? null
21
+ }
22
+ };
23
+ }
24
+ function generateMetadata(input, options) {
25
+ const title = input.title ?? void 0;
26
+ const description = input.description ?? void 0;
27
+ const ogTitle = input.openGraph?.title ?? title;
28
+ const ogDescription = input.openGraph?.description ?? description;
29
+ const image = resolveMetaImage(input.openGraph?.image);
30
+ return {
31
+ title,
32
+ description,
33
+ ...input.noIndex && { robots: { index: false, follow: false } },
34
+ ...input.canonical && { alternates: { canonical: input.canonical } },
35
+ openGraph: {
36
+ ...ogTitle && { title: ogTitle },
37
+ ...ogDescription && { description: ogDescription },
38
+ ...options?.siteName && { siteName: options.siteName },
39
+ ...image && { images: [image] }
40
+ },
41
+ twitter: {
42
+ card: image ? "summary_large_image" : "summary",
43
+ ...ogTitle && { title: ogTitle },
44
+ ...ogDescription && { description: ogDescription },
45
+ ...image && { images: [image.url] }
46
+ }
47
+ };
48
+ }
49
+ function resolveMetaImage(ref) {
50
+ const image = resolveRelation(ref);
51
+ if (!image) return null;
52
+ const sized = image.sizes?.["1536"];
53
+ const url = sized?.url || image.url;
54
+ if (!url) return null;
55
+ const width = sized?.url ? sized.width : image.width;
56
+ const height = sized?.url ? sized.height : image.height;
57
+ return {
58
+ url,
59
+ ...width && { width },
60
+ ...height && { height },
61
+ ...image.alt && { alt: image.alt }
62
+ };
63
+ }
64
+ export {
65
+ extractSeo,
66
+ generateMetadata
67
+ };
68
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/types.ts","../src/core/metadata/index.ts"],"sourcesContent":["/**\n * Resolves a Payload CMS relation field value.\n * When depth is 0, relation fields return just the ID (string or number).\n * When depth > 0, they return the full document object (T).\n * This utility normalizes both cases to T | null.\n *\n * @param ref - The relation field value (T, string, number, null, or undefined)\n * @returns The resolved document object, or null if not populated\n */\nexport const resolveRelation = <T>(\n ref: T | string | number | null | undefined,\n): T | null => {\n if (\n typeof ref === 'string' ||\n typeof ref === 'number' ||\n ref === null ||\n ref === undefined\n )\n return null\n return ref\n}\n","import { resolveRelation } from '../../utils/types'\n\nexport interface MetadataImage {\n url: string\n width?: number\n height?: number\n alt?: string\n}\n\nexport interface Metadata {\n title?: string\n description?: string\n robots?: {\n index?: boolean\n follow?: boolean\n }\n alternates?: {\n canonical?: string\n }\n openGraph?: {\n title?: string\n description?: string\n siteName?: string\n images?: MetadataImage[]\n }\n twitter?: {\n card?: 'summary' | 'summary_large_image'\n title?: string\n description?: string\n images?: string[]\n }\n}\n\nexport interface ImageLike {\n url?: string | null\n width?: number | null\n height?: number | null\n alt?: string | null\n sizes?: Record<\n string,\n | { url?: string | null; width?: number | null; height?: number | null }\n | undefined\n >\n}\n\nexport interface SeoInput {\n title?: string | null\n description?: string | null\n noIndex?: boolean | null\n canonical?: string | null\n openGraph?: {\n title?: string | null\n description?: string | null\n image?: ImageLike | string | null\n } | null\n}\n\nexport interface GenerateMetadataOptions {\n siteName?: string\n}\n\nexport function extractSeo(doc: Record<string, unknown>): SeoInput {\n const seo = (doc.seo ?? {}) as Record<string, unknown>\n const og = (seo.openGraph ?? {}) as Record<string, unknown>\n\n return {\n title: (seo.title as string) ?? (doc.title as string) ?? null,\n description: (seo.description as string) ?? null,\n noIndex: (seo.noIndex as boolean) ?? null,\n canonical: (seo.canonical as string) ?? null,\n openGraph: {\n title: (og.title as string) ?? null,\n description: (og.description as string) ?? null,\n image: (og.image as ImageLike | string | null) ?? null,\n },\n }\n}\n\nexport function generateMetadata(\n input: SeoInput,\n options?: GenerateMetadataOptions,\n): Metadata {\n const title = input.title ?? undefined\n const description = input.description ?? undefined\n\n const ogTitle = input.openGraph?.title ?? title\n const ogDescription = input.openGraph?.description ?? description\n const image = resolveMetaImage(input.openGraph?.image)\n\n return {\n title,\n description,\n ...(input.noIndex && { robots: { index: false, follow: false } }),\n ...(input.canonical && { alternates: { canonical: input.canonical } }),\n openGraph: {\n ...(ogTitle && { title: ogTitle }),\n ...(ogDescription && { description: ogDescription }),\n ...(options?.siteName && { siteName: options.siteName }),\n ...(image && { images: [image] }),\n },\n twitter: {\n card: image ? 'summary_large_image' : 'summary',\n ...(ogTitle && { title: ogTitle }),\n ...(ogDescription && { description: ogDescription }),\n ...(image && { images: [image.url] }),\n },\n }\n}\n\nfunction resolveMetaImage(\n ref: ImageLike | string | null | undefined,\n): MetadataImage | null {\n const image = resolveRelation<ImageLike>(ref)\n if (!image) return null\n\n // Prefer sizes['1536'] (closest to OG 1200px standard), fallback to original url\n const sized = image.sizes?.['1536']\n const url = sized?.url || image.url\n if (!url) return null\n\n const width = sized?.url ? sized.width : image.width\n const height = sized?.url ? sized.height : image.height\n\n return {\n url,\n ...(width && { width }),\n ...(height && { height }),\n ...(image.alt && { alt: image.alt }),\n }\n}\n"],"mappings":";AASO,IAAM,kBAAkB,CAC7B,QACa;AACb,MACE,OAAO,QAAQ,YACf,OAAO,QAAQ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