@01.software/sdk 0.2.6 → 0.2.7

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.
@@ -970,20 +970,6 @@ interface Product {
970
970
  hasNextPage?: boolean;
971
971
  totalDocs?: number;
972
972
  };
973
- meta?: {
974
- /**
975
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
976
- */
977
- title?: string | null;
978
- /**
979
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
980
- */
981
- description?: string | null;
982
- /**
983
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
984
- */
985
- image?: (string | null) | Media;
986
- };
987
973
  /**
988
974
  * When enabled, the slug will auto-generate from the title field on save and autosave.
989
975
  */
@@ -1877,20 +1863,6 @@ interface Post {
1877
1863
  };
1878
1864
  [k: string]: unknown;
1879
1865
  } | null;
1880
- meta?: {
1881
- /**
1882
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
1883
- */
1884
- title?: string | null;
1885
- /**
1886
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
1887
- */
1888
- description?: string | null;
1889
- /**
1890
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
1891
- */
1892
- image?: (string | null) | Media;
1893
- };
1894
1866
  thumbnail?: (string | null) | PostImage;
1895
1867
  images?: (string | PostImage)[] | null;
1896
1868
  /**
@@ -2074,20 +2046,6 @@ interface Document {
2074
2046
  * Changelog (differences from previous version)
2075
2047
  */
2076
2048
  changeLog?: string | null;
2077
- meta?: {
2078
- /**
2079
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
2080
- */
2081
- title?: string | null;
2082
- /**
2083
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
2084
- */
2085
- description?: string | null;
2086
- /**
2087
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
2088
- */
2089
- image?: (string | null) | Media;
2090
- };
2091
2049
  /**
2092
2050
  * When enabled, the slug will auto-generate from the title field on save and autosave.
2093
2051
  */
@@ -2233,20 +2191,6 @@ interface Playlist {
2233
2191
  hasNextPage?: boolean;
2234
2192
  totalDocs?: number;
2235
2193
  };
2236
- meta?: {
2237
- /**
2238
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
2239
- */
2240
- title?: string | null;
2241
- /**
2242
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
2243
- */
2244
- description?: string | null;
2245
- /**
2246
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
2247
- */
2248
- image?: (string | null) | Media;
2249
- };
2250
2194
  image?: (string | null) | PlaylistImage;
2251
2195
  /**
2252
2196
  * When enabled, the slug will auto-generate from the title field on save and autosave.
@@ -3139,11 +3083,6 @@ interface ProductsSelect<T extends boolean = true> {
3139
3083
  compareAtPrice?: T;
3140
3084
  variants?: T;
3141
3085
  options?: T;
3142
- meta?: T | {
3143
- title?: T;
3144
- description?: T;
3145
- image?: T;
3146
- };
3147
3086
  generateSlug?: T;
3148
3087
  slug?: T;
3149
3088
  sku?: T;
@@ -3815,11 +3754,6 @@ interface PostsSelect<T extends boolean = true> {
3815
3754
  subtitle?: T;
3816
3755
  excerpt?: T;
3817
3756
  content?: T;
3818
- meta?: T | {
3819
- title?: T;
3820
- description?: T;
3821
- image?: T;
3822
- };
3823
3757
  thumbnail?: T;
3824
3758
  images?: T;
3825
3759
  generateSlug?: T;
@@ -3958,11 +3892,6 @@ interface DocumentsSelect<T extends boolean = true> {
3958
3892
  id?: T;
3959
3893
  };
3960
3894
  changeLog?: T;
3961
- meta?: T | {
3962
- title?: T;
3963
- description?: T;
3964
- image?: T;
3965
- };
3966
3895
  generateSlug?: T;
3967
3896
  slug?: T;
3968
3897
  type?: T;
@@ -4077,11 +4006,6 @@ interface PlaylistsSelect<T extends boolean = true> {
4077
4006
  title?: T;
4078
4007
  description?: T;
4079
4008
  musics?: T;
4080
- meta?: T | {
4081
- title?: T;
4082
- description?: T;
4083
- image?: T;
4084
- };
4085
4009
  image?: T;
4086
4010
  generateSlug?: T;
4087
4011
  slug?: T;
@@ -970,20 +970,6 @@ interface Product {
970
970
  hasNextPage?: boolean;
971
971
  totalDocs?: number;
972
972
  };
973
- meta?: {
974
- /**
975
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
976
- */
977
- title?: string | null;
978
- /**
979
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
980
- */
981
- description?: string | null;
982
- /**
983
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
984
- */
985
- image?: (string | null) | Media;
986
- };
987
973
  /**
988
974
  * When enabled, the slug will auto-generate from the title field on save and autosave.
989
975
  */
@@ -1877,20 +1863,6 @@ interface Post {
1877
1863
  };
1878
1864
  [k: string]: unknown;
1879
1865
  } | null;
1880
- meta?: {
1881
- /**
1882
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
1883
- */
1884
- title?: string | null;
1885
- /**
1886
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
1887
- */
1888
- description?: string | null;
1889
- /**
1890
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
1891
- */
1892
- image?: (string | null) | Media;
1893
- };
1894
1866
  thumbnail?: (string | null) | PostImage;
1895
1867
  images?: (string | PostImage)[] | null;
1896
1868
  /**
@@ -2074,20 +2046,6 @@ interface Document {
2074
2046
  * Changelog (differences from previous version)
2075
2047
  */
2076
2048
  changeLog?: string | null;
2077
- meta?: {
2078
- /**
2079
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
2080
- */
2081
- title?: string | null;
2082
- /**
2083
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
2084
- */
2085
- description?: string | null;
2086
- /**
2087
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
2088
- */
2089
- image?: (string | null) | Media;
2090
- };
2091
2049
  /**
2092
2050
  * When enabled, the slug will auto-generate from the title field on save and autosave.
2093
2051
  */
@@ -2233,20 +2191,6 @@ interface Playlist {
2233
2191
  hasNextPage?: boolean;
2234
2192
  totalDocs?: number;
2235
2193
  };
2236
- meta?: {
2237
- /**
2238
- * 검색엔진에 표시되는 제목입니다. 한글 기준 30자, 영문 기준 60자 이내를 권장합니다.
2239
- */
2240
- title?: string | null;
2241
- /**
2242
- * 검색엔진에 표시되는 설명입니다. 한글 기준 80자, 영문 기준 160자 이내를 권장합니다.
2243
- */
2244
- description?: string | null;
2245
- /**
2246
- * SNS 공유 시 표시되는 이미지입니다. 1200x630px 권장.
2247
- */
2248
- image?: (string | null) | Media;
2249
- };
2250
2194
  image?: (string | null) | PlaylistImage;
2251
2195
  /**
2252
2196
  * When enabled, the slug will auto-generate from the title field on save and autosave.
@@ -3139,11 +3083,6 @@ interface ProductsSelect<T extends boolean = true> {
3139
3083
  compareAtPrice?: T;
3140
3084
  variants?: T;
3141
3085
  options?: T;
3142
- meta?: T | {
3143
- title?: T;
3144
- description?: T;
3145
- image?: T;
3146
- };
3147
3086
  generateSlug?: T;
3148
3087
  slug?: T;
3149
3088
  sku?: T;
@@ -3815,11 +3754,6 @@ interface PostsSelect<T extends boolean = true> {
3815
3754
  subtitle?: T;
3816
3755
  excerpt?: T;
3817
3756
  content?: T;
3818
- meta?: T | {
3819
- title?: T;
3820
- description?: T;
3821
- image?: T;
3822
- };
3823
3757
  thumbnail?: T;
3824
3758
  images?: T;
3825
3759
  generateSlug?: T;
@@ -3958,11 +3892,6 @@ interface DocumentsSelect<T extends boolean = true> {
3958
3892
  id?: T;
3959
3893
  };
3960
3894
  changeLog?: T;
3961
- meta?: T | {
3962
- title?: T;
3963
- description?: T;
3964
- image?: T;
3965
- };
3966
3895
  generateSlug?: T;
3967
3896
  slug?: T;
3968
3897
  type?: T;
@@ -4077,11 +4006,6 @@ interface PlaylistsSelect<T extends boolean = true> {
4077
4006
  title?: T;
4078
4007
  description?: T;
4079
4008
  musics?: T;
4080
- meta?: T | {
4081
- title?: T;
4082
- description?: T;
4083
- image?: T;
4084
- };
4085
4009
  image?: T;
4086
4010
  generateSlug?: T;
4087
4011
  slug?: T;
@@ -1,4 +1,4 @@
1
- import { c as Config } from './payload-types-D0px2DCK.js';
1
+ import { c as Config } from './payload-types-CRSz8jfP.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -1,4 +1,4 @@
1
- import { c as Config } from './payload-types-D0px2DCK.cjs';
1
+ import { c as Config } from './payload-types-CRSz8jfP.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -1,2 +1,2 @@
1
- export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook--_n7O-Ed.cjs';
2
- import './payload-types-D0px2DCK.cjs';
1
+ export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Dn5o0LXq.cjs';
2
+ import './payload-types-CRSz8jfP.cjs';
package/dist/webhook.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-vrlAV1K7.js';
2
- import './payload-types-D0px2DCK.js';
1
+ export { c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-C_DHB0Sw.js';
2
+ import './payload-types-CRSz8jfP.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@01.software/sdk",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "01.software SDK",
5
5
  "author": "<office@01.works>",
6
6
  "keywords": [],
@@ -49,16 +49,6 @@
49
49
  "default": "./dist/components.cjs"
50
50
  }
51
51
  },
52
- "./metadata": {
53
- "import": {
54
- "types": "./dist/metadata.d.ts",
55
- "default": "./dist/metadata.js"
56
- },
57
- "require": {
58
- "types": "./dist/metadata.d.cts",
59
- "default": "./dist/metadata.cjs"
60
- }
61
- },
62
52
  "./package.json": "./package.json"
63
53
  },
64
54
  "sideEffects": false,
package/dist/metadata.cjs DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, { get: all[name], enumerable: true });
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
-
34
- // src/metadata.ts
35
- var metadata_exports = {};
36
- __export(metadata_exports, {
37
- generateMetadata: () => generateMetadata
38
- });
39
- module.exports = __toCommonJS(metadata_exports);
40
-
41
- // src/utils/types.ts
42
- var resolveRelation = (ref) => {
43
- if (typeof ref === "string" || typeof ref === "number" || ref === null || ref === void 0)
44
- return null;
45
- return ref;
46
- };
47
-
48
- // src/core/metadata/index.ts
49
- function generateMetadata(doc, options) {
50
- var _a, _b, _c, _d;
51
- const meta = doc == null ? void 0 : doc.meta;
52
- const title = (_b = (_a = meta == null ? void 0 : meta.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
53
- const description = (_d = (_c = meta == null ? void 0 : meta.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
54
- const image = resolveMetaImage(meta == null ? void 0 : meta.image);
55
- return {
56
- title,
57
- description,
58
- openGraph: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, title && { title }), description && { description }), (options == null ? void 0 : options.siteName) && { siteName: options.siteName }), image && { images: [image] }),
59
- twitter: __spreadValues(__spreadValues(__spreadValues({
60
- card: image ? "summary_large_image" : "summary"
61
- }, title && { title }), description && { description }), image && { images: [image.url] })
62
- };
63
- }
64
- function resolveMetaImage(ref) {
65
- const media = resolveRelation(ref);
66
- if (!(media == null ? void 0 : media.url)) return null;
67
- return __spreadValues(__spreadValues(__spreadValues({
68
- url: media.url
69
- }, media.width && { width: media.width }), media.height && { height: media.height }), media.alt && { alt: media.alt });
70
- }
71
- //# sourceMappingURL=metadata.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/metadata.ts","../src/utils/types.ts","../src/core/metadata/index.ts"],"sourcesContent":["export { generateMetadata } from './core/metadata'\nexport type { GenerateMetadataOptions } from './core/metadata'\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>(ref: T | string | number | null | undefined): T | null => {\n if (typeof ref === 'string' || typeof ref === 'number' || ref === null || ref === undefined)\n return null\n return ref\n}\n\n/** @deprecated Use `resolveRelation` instead */\nexport const objectFor = resolveRelation\n","import type { Metadata } from 'next'\nimport type { Media } from '../../payload-types'\nimport { resolveRelation } from '../../utils/types'\n\ninterface MetaField {\n title?: string | null\n description?: string | null\n image?: (number | null) | Media\n}\n\nexport interface GenerateMetadataOptions {\n title?: string\n description?: string\n siteName?: string\n}\n\nexport function generateMetadata(\n doc: { meta?: MetaField | null },\n options?: GenerateMetadataOptions,\n): Metadata {\n const meta = doc?.meta\n const title = meta?.title ?? options?.title ?? undefined\n const description = meta?.description ?? options?.description ?? undefined\n const image = resolveMetaImage(meta?.image)\n\n return {\n title,\n description,\n openGraph: {\n ...(title && { title }),\n ...(description && { description }),\n ...(options?.siteName && { siteName: options.siteName }),\n ...(image && { images: [image] }),\n },\n twitter: {\n card: image ? 'summary_large_image' : 'summary',\n ...(title && { title }),\n ...(description && { description }),\n ...(image && { images: [image.url] }),\n },\n }\n}\n\nfunction resolveMetaImage(\n ref: (number | null) | Media | undefined,\n): { url: string; width?: number; height?: number; alt?: string } | null {\n const media = resolveRelation<Media>(ref)\n if (!media?.url) return null\n return {\n url: media.url,\n ...(media.width && { width: media.width }),\n ...(media.height && { height: media.height }),\n ...(media.alt && { alt: media.alt }),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,kBAAkB,CAAI,QAA0D;AAC3F,MAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,YAAY,QAAQ,QAAQ,QAAQ;AAChF,WAAO;AACT,SAAO;AACT;;;ACGO,SAAS,iBACd,KACA,SACU;AAnBZ;AAoBE,QAAM,OAAO,2BAAK;AAClB,QAAM,SAAQ,wCAAM,UAAN,YAAe,mCAAS,UAAxB,YAAiC;AAC/C,QAAM,eAAc,wCAAM,gBAAN,YAAqB,mCAAS,gBAA9B,YAA6C;AACjE,QAAM,QAAQ,iBAAiB,6BAAM,KAAK;AAE1C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW,gEACL,SAAS,EAAE,MAAM,IACjB,eAAe,EAAE,YAAY,KAC7B,mCAAS,aAAY,EAAE,UAAU,QAAQ,SAAS,IAClD,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE;AAAA,IAEjC,SAAS;AAAA,MACP,MAAM,QAAQ,wBAAwB;AAAA,OAClC,SAAS,EAAE,MAAM,IACjB,eAAe,EAAE,YAAY,IAC7B,SAAS,EAAE,QAAQ,CAAC,MAAM,GAAG,EAAE;AAAA,EAEvC;AACF;AAEA,SAAS,iBACP,KACuE;AACvE,QAAM,QAAQ,gBAAuB,GAAG;AACxC,MAAI,EAAC,+BAAO,KAAK,QAAO;AACxB,SAAO;AAAA,IACL,KAAK,MAAM;AAAA,KACP,MAAM,SAAS,EAAE,OAAO,MAAM,MAAM,IACpC,MAAM,UAAU,EAAE,QAAQ,MAAM,OAAO,IACvC,MAAM,OAAO,EAAE,KAAK,MAAM,IAAI;AAEtC;","names":[]}
@@ -1,18 +0,0 @@
1
- import { Metadata } from 'next';
2
- import { M as Media } from './payload-types-D0px2DCK.cjs';
3
-
4
- interface MetaField {
5
- title?: string | null;
6
- description?: string | null;
7
- image?: (number | null) | Media;
8
- }
9
- interface GenerateMetadataOptions {
10
- title?: string;
11
- description?: string;
12
- siteName?: string;
13
- }
14
- declare function generateMetadata(doc: {
15
- meta?: MetaField | null;
16
- }, options?: GenerateMetadataOptions): Metadata;
17
-
18
- export { type GenerateMetadataOptions, generateMetadata };
@@ -1,18 +0,0 @@
1
- import { Metadata } from 'next';
2
- import { M as Media } from './payload-types-D0px2DCK.js';
3
-
4
- interface MetaField {
5
- title?: string | null;
6
- description?: string | null;
7
- image?: (number | null) | Media;
8
- }
9
- interface GenerateMetadataOptions {
10
- title?: string;
11
- description?: string;
12
- siteName?: string;
13
- }
14
- declare function generateMetadata(doc: {
15
- meta?: MetaField | null;
16
- }, options?: GenerateMetadataOptions): Metadata;
17
-
18
- export { type GenerateMetadataOptions, generateMetadata };
package/dist/metadata.js DELETED
@@ -1,51 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
-
18
- // src/utils/types.ts
19
- var resolveRelation = (ref) => {
20
- if (typeof ref === "string" || typeof ref === "number" || ref === null || ref === void 0)
21
- return null;
22
- return ref;
23
- };
24
-
25
- // src/core/metadata/index.ts
26
- function generateMetadata(doc, options) {
27
- var _a, _b, _c, _d;
28
- const meta = doc == null ? void 0 : doc.meta;
29
- const title = (_b = (_a = meta == null ? void 0 : meta.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
30
- const description = (_d = (_c = meta == null ? void 0 : meta.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
31
- const image = resolveMetaImage(meta == null ? void 0 : meta.image);
32
- return {
33
- title,
34
- description,
35
- openGraph: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, title && { title }), description && { description }), (options == null ? void 0 : options.siteName) && { siteName: options.siteName }), image && { images: [image] }),
36
- twitter: __spreadValues(__spreadValues(__spreadValues({
37
- card: image ? "summary_large_image" : "summary"
38
- }, title && { title }), description && { description }), image && { images: [image.url] })
39
- };
40
- }
41
- function resolveMetaImage(ref) {
42
- const media = resolveRelation(ref);
43
- if (!(media == null ? void 0 : media.url)) return null;
44
- return __spreadValues(__spreadValues(__spreadValues({
45
- url: media.url
46
- }, media.width && { width: media.width }), media.height && { height: media.height }), media.alt && { alt: media.alt });
47
- }
48
- export {
49
- generateMetadata
50
- };
51
- //# sourceMappingURL=metadata.js.map
@@ -1 +0,0 @@
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>(ref: T | string | number | null | undefined): T | null => {\n if (typeof ref === 'string' || typeof ref === 'number' || ref === null || ref === undefined)\n return null\n return ref\n}\n\n/** @deprecated Use `resolveRelation` instead */\nexport const objectFor = resolveRelation\n","import type { Metadata } from 'next'\nimport type { Media } from '../../payload-types'\nimport { resolveRelation } from '../../utils/types'\n\ninterface MetaField {\n title?: string | null\n description?: string | null\n image?: (number | null) | Media\n}\n\nexport interface GenerateMetadataOptions {\n title?: string\n description?: string\n siteName?: string\n}\n\nexport function generateMetadata(\n doc: { meta?: MetaField | null },\n options?: GenerateMetadataOptions,\n): Metadata {\n const meta = doc?.meta\n const title = meta?.title ?? options?.title ?? undefined\n const description = meta?.description ?? options?.description ?? undefined\n const image = resolveMetaImage(meta?.image)\n\n return {\n title,\n description,\n openGraph: {\n ...(title && { title }),\n ...(description && { description }),\n ...(options?.siteName && { siteName: options.siteName }),\n ...(image && { images: [image] }),\n },\n twitter: {\n card: image ? 'summary_large_image' : 'summary',\n ...(title && { title }),\n ...(description && { description }),\n ...(image && { images: [image.url] }),\n },\n }\n}\n\nfunction resolveMetaImage(\n ref: (number | null) | Media | undefined,\n): { url: string; width?: number; height?: number; alt?: string } | null {\n const media = resolveRelation<Media>(ref)\n if (!media?.url) return null\n return {\n url: media.url,\n ...(media.width && { width: media.width }),\n ...(media.height && { height: media.height }),\n ...(media.alt && { alt: media.alt }),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AASO,IAAM,kBAAkB,CAAI,QAA0D;AAC3F,MAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,YAAY,QAAQ,QAAQ,QAAQ;AAChF,WAAO;AACT,SAAO;AACT;;;ACGO,SAAS,iBACd,KACA,SACU;AAnBZ;AAoBE,QAAM,OAAO,2BAAK;AAClB,QAAM,SAAQ,wCAAM,UAAN,YAAe,mCAAS,UAAxB,YAAiC;AAC/C,QAAM,eAAc,wCAAM,gBAAN,YAAqB,mCAAS,gBAA9B,YAA6C;AACjE,QAAM,QAAQ,iBAAiB,6BAAM,KAAK;AAE1C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW,gEACL,SAAS,EAAE,MAAM,IACjB,eAAe,EAAE,YAAY,KAC7B,mCAAS,aAAY,EAAE,UAAU,QAAQ,SAAS,IAClD,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE;AAAA,IAEjC,SAAS;AAAA,MACP,MAAM,QAAQ,wBAAwB;AAAA,OAClC,SAAS,EAAE,MAAM,IACjB,eAAe,EAAE,YAAY,IAC7B,SAAS,EAAE,QAAQ,CAAC,MAAM,GAAG,EAAE;AAAA,EAEvC;AACF;AAEA,SAAS,iBACP,KACuE;AACvE,QAAM,QAAQ,gBAAuB,GAAG;AACxC,MAAI,EAAC,+BAAO,KAAK,QAAO;AACxB,SAAO;AAAA,IACL,KAAK,MAAM;AAAA,KACP,MAAM,SAAS,EAAE,OAAO,MAAM,MAAM,IACpC,MAAM,UAAU,EAAE,QAAQ,MAAM,OAAO,IACvC,MAAM,OAAO,EAAE,KAAK,MAAM,IAAI;AAEtC;","names":[]}