@cms0/cms0 0.2.6 → 0.2.8

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/README.md CHANGED
@@ -11,11 +11,15 @@ pnpm add @cms0/cms0
11
11
  ## Usage
12
12
 
13
13
  ```ts
14
- import { cms0 } from "@cms0/cms0";
15
- import type { Image } from "@cms0/cms0/custom-types";
14
+ import { cms0, toNextMetadata } from "@cms0/cms0";
15
+ import type { Metadata } from "next";
16
+ import type { Image, Seo } from "@cms0/cms0/custom-types";
16
17
 
17
18
  type RootSchema = {
18
- images: Image[];
19
+ homePage: {
20
+ heroImage: Image;
21
+ seo: Seo;
22
+ };
19
23
  };
20
24
 
21
25
  export const data = cms0<RootSchema>({
@@ -24,6 +28,9 @@ export const data = cms0<RootSchema>({
24
28
  key: import.meta.env.VITE_CMS0_API_KEY,
25
29
  },
26
30
  });
31
+
32
+ const page = await data.homePage();
33
+ const metadata = toNextMetadata<Metadata>(page.seo, { locale: "en" });
27
34
  ```
28
35
 
29
36
  ## Custom Types
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.customInlineTypeNames = exports.customModelTypeNames = exports.customTypeNames = exports.customTypeDescriptors = exports.customInlineTypeMetadata = exports.customInlineDescriptors = exports.customModelDescriptors = void 0;
4
4
  exports.getCustomInlineTypeMetadata = getCustomInlineTypeMetadata;
5
5
  exports.resolveCustomTypeDependencies = resolveCustomTypeDependencies;
6
+ const shared_1 = require("@cms0/shared");
6
7
  const primitive = (type) => ({
7
8
  kind: "primitive",
8
9
  type,
@@ -54,6 +55,237 @@ const localizedRichTextDescriptor = {
54
55
  type: "json",
55
56
  customType: "LocalizedRichText",
56
57
  };
58
+ function createUnionDescriptor(branches) {
59
+ return {
60
+ kind: "union",
61
+ anyOf: branches,
62
+ branchKeys: (0, shared_1.computeUnionBranchKeys)(branches),
63
+ };
64
+ }
65
+ const localizedOrStringDescriptor = createUnionDescriptor([
66
+ localizedStringDescriptor,
67
+ {
68
+ kind: "primitive",
69
+ type: "string",
70
+ },
71
+ ]);
72
+ const keywordsDescriptor = createUnionDescriptor([
73
+ localizedStringDescriptor,
74
+ {
75
+ type: "array",
76
+ items: {
77
+ kind: "primitive",
78
+ type: "string",
79
+ },
80
+ },
81
+ ]);
82
+ const robotsDescriptor = createUnionDescriptor([
83
+ {
84
+ kind: "primitive",
85
+ type: "boolean",
86
+ },
87
+ {
88
+ type: "object",
89
+ properties: {
90
+ index: {
91
+ kind: "primitive",
92
+ type: "boolean",
93
+ optional: true,
94
+ nullable: false,
95
+ },
96
+ follow: {
97
+ kind: "primitive",
98
+ type: "boolean",
99
+ optional: true,
100
+ nullable: false,
101
+ },
102
+ nocache: {
103
+ kind: "primitive",
104
+ type: "boolean",
105
+ optional: true,
106
+ nullable: false,
107
+ },
108
+ },
109
+ },
110
+ ]);
111
+ const alternatesDescriptor = {
112
+ type: "object",
113
+ properties: {
114
+ canonical: {
115
+ kind: "primitive",
116
+ type: "string",
117
+ optional: true,
118
+ nullable: false,
119
+ },
120
+ languages: {
121
+ kind: "primitive",
122
+ type: "json",
123
+ optional: true,
124
+ nullable: false,
125
+ },
126
+ },
127
+ };
128
+ const imageOrStringDescriptor = createUnionDescriptor([
129
+ {
130
+ kind: "modelRef",
131
+ model: "Image",
132
+ },
133
+ {
134
+ kind: "primitive",
135
+ type: "string",
136
+ },
137
+ ]);
138
+ const openGraphDescriptor = {
139
+ type: "object",
140
+ properties: {
141
+ type: {
142
+ kind: "enum",
143
+ valueType: "string",
144
+ values: ["website", "article", "profile"],
145
+ optional: true,
146
+ nullable: false,
147
+ },
148
+ url: {
149
+ kind: "primitive",
150
+ type: "string",
151
+ optional: true,
152
+ nullable: false,
153
+ },
154
+ siteName: {
155
+ kind: "primitive",
156
+ type: "string",
157
+ optional: true,
158
+ nullable: false,
159
+ },
160
+ title: {
161
+ ...localizedOrStringDescriptor,
162
+ optional: true,
163
+ nullable: false,
164
+ },
165
+ description: {
166
+ ...localizedOrStringDescriptor,
167
+ optional: true,
168
+ nullable: false,
169
+ },
170
+ images: {
171
+ type: "array",
172
+ items: imageOrStringDescriptor,
173
+ optional: true,
174
+ nullable: false,
175
+ },
176
+ locale: {
177
+ kind: "primitive",
178
+ type: "string",
179
+ optional: true,
180
+ nullable: false,
181
+ },
182
+ alternateLocale: {
183
+ type: "array",
184
+ items: {
185
+ kind: "primitive",
186
+ type: "string",
187
+ },
188
+ optional: true,
189
+ nullable: false,
190
+ },
191
+ },
192
+ };
193
+ const twitterDescriptor = {
194
+ type: "object",
195
+ properties: {
196
+ card: {
197
+ kind: "enum",
198
+ valueType: "string",
199
+ values: ["summary", "summary_large_image", "app", "player"],
200
+ optional: true,
201
+ nullable: false,
202
+ },
203
+ site: {
204
+ kind: "primitive",
205
+ type: "string",
206
+ optional: true,
207
+ nullable: false,
208
+ },
209
+ creator: {
210
+ kind: "primitive",
211
+ type: "string",
212
+ optional: true,
213
+ nullable: false,
214
+ },
215
+ title: {
216
+ ...localizedOrStringDescriptor,
217
+ optional: true,
218
+ nullable: false,
219
+ },
220
+ description: {
221
+ ...localizedOrStringDescriptor,
222
+ optional: true,
223
+ nullable: false,
224
+ },
225
+ images: {
226
+ type: "array",
227
+ items: imageOrStringDescriptor,
228
+ optional: true,
229
+ nullable: false,
230
+ },
231
+ },
232
+ };
233
+ const seoDescriptor = {
234
+ type: "object",
235
+ customType: "Seo",
236
+ properties: {
237
+ title: {
238
+ ...localizedOrStringDescriptor,
239
+ optional: true,
240
+ nullable: false,
241
+ },
242
+ description: {
243
+ ...localizedOrStringDescriptor,
244
+ optional: true,
245
+ nullable: false,
246
+ },
247
+ keywords: {
248
+ ...keywordsDescriptor,
249
+ optional: true,
250
+ nullable: false,
251
+ },
252
+ canonical: {
253
+ kind: "primitive",
254
+ type: "string",
255
+ optional: true,
256
+ nullable: false,
257
+ },
258
+ robots: {
259
+ ...robotsDescriptor,
260
+ optional: true,
261
+ nullable: false,
262
+ },
263
+ alternates: {
264
+ ...alternatesDescriptor,
265
+ optional: true,
266
+ nullable: false,
267
+ },
268
+ openGraph: {
269
+ ...openGraphDescriptor,
270
+ optional: true,
271
+ nullable: false,
272
+ },
273
+ twitter: {
274
+ ...twitterDescriptor,
275
+ optional: true,
276
+ nullable: false,
277
+ },
278
+ jsonLd: {
279
+ type: "array",
280
+ items: {
281
+ kind: "primitive",
282
+ type: "json",
283
+ },
284
+ optional: true,
285
+ nullable: false,
286
+ },
287
+ },
288
+ };
57
289
  exports.customModelDescriptors = {
58
290
  File: fileDescriptor,
59
291
  Image: imageDescriptor,
@@ -63,6 +295,7 @@ exports.customInlineDescriptors = {
63
295
  RichText: richTextDescriptor,
64
296
  LocalizedString: localizedStringDescriptor,
65
297
  LocalizedRichText: localizedRichTextDescriptor,
298
+ Seo: seoDescriptor,
66
299
  };
67
300
  exports.customInlineTypeMetadata = {
68
301
  RichText: {},
@@ -72,6 +305,7 @@ exports.customInlineTypeMetadata = {
72
305
  LocalizedRichText: {
73
306
  includeId: { mapLikeFields: ["locales"] },
74
307
  },
308
+ Seo: {},
75
309
  };
76
310
  exports.customTypeDescriptors = {
77
311
  ...exports.customModelDescriptors,
@@ -90,13 +324,20 @@ function resolveCustomTypeDependencies(names) {
90
324
  const name = queue.shift();
91
325
  if (!name || resolved.has(name))
92
326
  continue;
93
- const descriptor = exports.customModelDescriptors[name];
327
+ const modelDescriptor = exports.customModelDescriptors[name];
328
+ const inlineDescriptor = exports.customInlineDescriptors[name];
329
+ const descriptor = modelDescriptor ?? inlineDescriptor;
94
330
  if (!descriptor)
95
331
  continue;
96
332
  resolved.add(name);
97
333
  const refs = new Set();
98
- for (const prop of Object.values(descriptor.properties)) {
99
- collectModelRefs(prop, refs);
334
+ if (modelDescriptor) {
335
+ for (const prop of Object.values(modelDescriptor.properties)) {
336
+ collectModelRefs(prop, refs);
337
+ }
338
+ }
339
+ else {
340
+ collectModelRefs(inlineDescriptor, refs);
100
341
  }
101
342
  refs.forEach((ref) => {
102
343
  if (exports.customTypeDescriptors[ref] && !resolved.has(ref)) {
@@ -111,11 +352,15 @@ function collectModelRefs(desc, out) {
111
352
  out.add(desc.model);
112
353
  return;
113
354
  }
114
- if (desc.type === "array") {
355
+ if ("type" in desc && desc.type === "array") {
115
356
  collectModelRefs(desc.items, out);
116
357
  return;
117
358
  }
118
- if (desc.type === "object") {
359
+ if ("type" in desc && desc.type === "object") {
119
360
  Object.values(desc.properties).forEach((child) => collectModelRefs(child, out));
361
+ return;
362
+ }
363
+ if (desc.kind === "union") {
364
+ desc.anyOf.forEach((branch) => collectModelRefs(branch, out));
120
365
  }
121
366
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toTwitter = exports.toOpenGraph = exports.toNextMetadata = exports.resolveLocalized = void 0;
3
4
  exports.createCmsClient = createCmsClient;
4
5
  exports.cms0 = cms0;
5
6
  const schema_descriptors_1 = require("@cms0/cms0/schema-descriptors");
@@ -109,6 +110,9 @@ function snakeCaseModelIdKey(modelName) {
109
110
  .toLowerCase();
110
111
  return `${snake}_id`;
111
112
  }
113
+ function isUuidLikeId(value) {
114
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
115
+ }
112
116
  function extractModelRefId(raw, modelName, options) {
113
117
  if (typeof raw === "string")
114
118
  return raw;
@@ -149,6 +153,15 @@ function extractModelRefId(raw, modelName, options) {
149
153
  function isPrimitiveDescriptor(desc) {
150
154
  return desc.kind === "primitive";
151
155
  }
156
+ function isEnumDescriptor(desc) {
157
+ return desc.kind === "enum" && Array.isArray(desc.values);
158
+ }
159
+ function isUnionDescriptor(desc) {
160
+ return desc.kind === "union" && Array.isArray(desc.anyOf);
161
+ }
162
+ function isScalarDescriptor(desc) {
163
+ return isPrimitiveDescriptor(desc) || isEnumDescriptor(desc) || isUnionDescriptor(desc);
164
+ }
152
165
  function isModelRefDescriptor(desc) {
153
166
  return desc.kind === "modelRef";
154
167
  }
@@ -166,7 +179,7 @@ function attachIdIfObject(value, id) {
166
179
  }
167
180
  return value;
168
181
  }
169
- function attachIdForPrimitiveDescriptor(descriptor, value, id) {
182
+ function attachIdForScalarDescriptor(descriptor, value, id) {
170
183
  const withId = attachIdIfObject(value, id);
171
184
  if (!withId || typeof withId !== "object" || Array.isArray(withId)) {
172
185
  return withId;
@@ -362,6 +375,23 @@ function coerceLocalizedRichTextValue(value, locale, defaultLocale) {
362
375
  }
363
376
  return projectLocalizedByLocale(normalized, locale);
364
377
  }
378
+ function coerceSeoValue(value) {
379
+ if (value == null)
380
+ return value;
381
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
382
+ return {};
383
+ }
384
+ const source = value;
385
+ const keys = Object.keys(source).filter((key) => key !== "id");
386
+ if (keys.length === 1 &&
387
+ keys[0] === "value" &&
388
+ source.value &&
389
+ typeof source.value === "object" &&
390
+ !Array.isArray(source.value)) {
391
+ return source.value;
392
+ }
393
+ return source;
394
+ }
365
395
  function coerceCustomTypeValue(descriptor, value, options) {
366
396
  const customType = descriptor.customType;
367
397
  if (!customType)
@@ -377,8 +407,81 @@ function coerceCustomTypeValue(descriptor, value, options) {
377
407
  if (customType === "LocalizedRichText") {
378
408
  return coerceLocalizedRichTextValue(value, options?.locale, options?.defaultLocale);
379
409
  }
410
+ if (customType === "Seo") {
411
+ return coerceSeoValue(value);
412
+ }
380
413
  return value;
381
414
  }
415
+ function coercePrimitiveValueByType(type, value) {
416
+ if (type === "string") {
417
+ if (value == null)
418
+ return "";
419
+ return typeof value === "string" ? value : String(value);
420
+ }
421
+ if (type === "number") {
422
+ if (typeof value === "number")
423
+ return Number.isFinite(value) ? value : null;
424
+ const parsed = Number(value);
425
+ return Number.isFinite(parsed) ? parsed : null;
426
+ }
427
+ if (type === "boolean") {
428
+ if (typeof value === "boolean")
429
+ return value;
430
+ if (value === "true" || value === "1" || value === 1)
431
+ return true;
432
+ if (value === "false" || value === "0" || value === 0)
433
+ return false;
434
+ return Boolean(value);
435
+ }
436
+ return value;
437
+ }
438
+ function coerceEnumValue(descriptor, value) {
439
+ const valueType = (descriptor.valueType ?? "string");
440
+ const coerced = coercePrimitiveValueByType(valueType, value);
441
+ const values = Array.isArray(descriptor.values)
442
+ ? descriptor.values
443
+ : [];
444
+ if (!values.length)
445
+ return coerced;
446
+ if (values.some((entry) => Object.is(entry, coerced))) {
447
+ return coerced;
448
+ }
449
+ return values[0];
450
+ }
451
+ function decodeUnionEnvelope(descriptor, raw) {
452
+ const decoded = (0, shared_1.decodeTaggedUnionValue)(raw);
453
+ if (!decoded)
454
+ return null;
455
+ const branches = Array.isArray(descriptor.anyOf)
456
+ ? descriptor.anyOf
457
+ : [];
458
+ if (!branches.length)
459
+ return null;
460
+ const branchKeys = (0, shared_1.getUnionBranchKeys)(descriptor);
461
+ const branchIndex = branchKeys.findIndex((key) => key === decoded.branchKey);
462
+ if (branchIndex < 0 || branchIndex >= branches.length)
463
+ return null;
464
+ const branchDescriptor = branches[branchIndex];
465
+ if (!branchDescriptor)
466
+ return null;
467
+ return {
468
+ branchDescriptor,
469
+ branchValue: decoded.value,
470
+ };
471
+ }
472
+ function decodeUnionValueFromRawField(descriptor, raw) {
473
+ const direct = decodeUnionEnvelope(descriptor, raw);
474
+ if (direct) {
475
+ return { ...direct, rowId: extractId(raw) };
476
+ }
477
+ if (raw && typeof raw === "object" && !Array.isArray(raw) && "value" in raw) {
478
+ const nested = decodeUnionEnvelope(descriptor, raw.value);
479
+ if (nested) {
480
+ return { ...nested, rowId: extractId(raw) };
481
+ }
482
+ }
483
+ return null;
484
+ }
382
485
  function ensureCollectionEnvelope(data, path) {
383
486
  if (Array.isArray(data)) {
384
487
  return { items: data, total: data.length };
@@ -450,12 +553,8 @@ async function normalizeObjectField(descriptor, path, raw, context, trail, isCol
450
553
  const source = raw && typeof raw === "object" ? raw : {};
451
554
  const output = {};
452
555
  for (const [propertyName, propertyDescriptor] of Object.entries(descriptor.properties)) {
453
- if (isPrimitiveDescriptor(propertyDescriptor)) {
454
- output[propertyName] = coerceCustomTypeValue(propertyDescriptor, source[propertyName], {
455
- locale: context.options.locale,
456
- defaultLocale: context.options.defaultLocale,
457
- assetUrlBuilder: context.options.assetUrlBuilder,
458
- });
556
+ if (isScalarDescriptor(propertyDescriptor)) {
557
+ output[propertyName] = await normalizeField(propertyDescriptor, `${path}/${propertyName}`, source[propertyName], context, trail, false);
459
558
  continue;
460
559
  }
461
560
  if (isModelRefDescriptor(propertyDescriptor)) {
@@ -543,16 +642,14 @@ async function normalizeObjectField(descriptor, path, raw, context, trail, isCol
543
642
  async function normalizeArrayField(descriptor, path, raw, context, trail) {
544
643
  const envelope = ensureCollectionEnvelope(raw, path);
545
644
  const itemDescriptor = descriptor.items;
546
- if (isPrimitiveDescriptor(itemDescriptor)) {
547
- return envelope.items.map((row) => {
548
- const value = row && typeof row === "object" && "value" in row
549
- ? row.value
550
- : row;
645
+ if (isScalarDescriptor(itemDescriptor)) {
646
+ return mapWithConcurrency(envelope.items, context.options.modelNormalizationConcurrency, async (row) => {
647
+ const normalizedValue = await normalizeField(itemDescriptor, path, row, context, trail, true);
551
648
  if (context.options.includeIdMode !== "all") {
552
- return value;
649
+ return normalizedValue;
553
650
  }
554
651
  const id = extractId(row);
555
- const valueWithId = attachIdForPrimitiveDescriptor(itemDescriptor, value, id);
652
+ const valueWithId = attachIdForScalarDescriptor(itemDescriptor, normalizedValue, id);
556
653
  const isObjectValue = valueWithId && typeof valueWithId === "object" && !Array.isArray(valueWithId);
557
654
  if (!id) {
558
655
  return valueWithId;
@@ -583,6 +680,60 @@ async function normalizeArrayField(descriptor, path, raw, context, trail) {
583
680
  }
584
681
  return envelope.items;
585
682
  }
683
+ async function normalizeInlineField(descriptor, raw, context, trail, isCollectionItem) {
684
+ if (isPrimitiveDescriptor(descriptor)) {
685
+ return coerceCustomTypeValue(descriptor, raw, {
686
+ locale: context.options.locale,
687
+ defaultLocale: context.options.defaultLocale,
688
+ assetUrlBuilder: context.options.assetUrlBuilder,
689
+ });
690
+ }
691
+ if (isEnumDescriptor(descriptor)) {
692
+ return coerceEnumValue(descriptor, raw);
693
+ }
694
+ if (isUnionDescriptor(descriptor)) {
695
+ if (raw == null)
696
+ return raw;
697
+ const decoded = decodeUnionEnvelope(descriptor, raw);
698
+ if (!decoded) {
699
+ return null;
700
+ }
701
+ return normalizeInlineField(decoded.branchDescriptor, decoded.branchValue, context, trail, isCollectionItem);
702
+ }
703
+ if (isModelRefDescriptor(descriptor)) {
704
+ const refId = extractModelRefId(raw, descriptor.model, {
705
+ allowObjectIdFallback: true,
706
+ });
707
+ if (!refId) {
708
+ return missingModelRefValue(descriptor);
709
+ }
710
+ return normalizeModelRef(descriptor.model, refId, context, trail, isCollectionItem, raw);
711
+ }
712
+ if (isArrayDescriptor(descriptor)) {
713
+ const source = Array.isArray(raw) ? raw : [];
714
+ const normalized = await mapWithConcurrency(source, context.options.modelNormalizationConcurrency, async (entry) => normalizeInlineField(descriptor.items, entry, context, trail, true));
715
+ return coerceCustomTypeValue(descriptor, normalized, {
716
+ locale: context.options.locale,
717
+ defaultLocale: context.options.defaultLocale,
718
+ assetUrlBuilder: context.options.assetUrlBuilder,
719
+ });
720
+ }
721
+ if (isObjectDescriptor(descriptor)) {
722
+ const source = raw && typeof raw === "object" && !Array.isArray(raw)
723
+ ? raw
724
+ : {};
725
+ const output = {};
726
+ for (const [propertyName, propertyDescriptor] of Object.entries(descriptor.properties)) {
727
+ output[propertyName] = await normalizeInlineField(propertyDescriptor, source[propertyName], context, trail, false);
728
+ }
729
+ return coerceCustomTypeValue(descriptor, output, {
730
+ locale: context.options.locale,
731
+ defaultLocale: context.options.defaultLocale,
732
+ assetUrlBuilder: context.options.assetUrlBuilder,
733
+ });
734
+ }
735
+ return raw;
736
+ }
586
737
  async function normalizeField(descriptor, path, raw, context, trail, isCollectionItem) {
587
738
  if (isPrimitiveDescriptor(descriptor)) {
588
739
  const value = raw && typeof raw === "object" && "value" in raw
@@ -595,10 +746,33 @@ async function normalizeField(descriptor, path, raw, context, trail, isCollectio
595
746
  });
596
747
  if (shouldIncludeObjectId(context.options.includeIdMode, isCollectionItem)) {
597
748
  const id = extractId(raw);
598
- coerced = attachIdForPrimitiveDescriptor(descriptor, coerced, id);
749
+ coerced = attachIdForScalarDescriptor(descriptor, coerced, id);
599
750
  }
600
751
  return coerced;
601
752
  }
753
+ if (isEnumDescriptor(descriptor)) {
754
+ const value = raw && typeof raw === "object" && "value" in raw
755
+ ? raw.value
756
+ : raw;
757
+ let coerced = coerceEnumValue(descriptor, value);
758
+ if (shouldIncludeObjectId(context.options.includeIdMode, isCollectionItem)) {
759
+ const id = extractId(raw);
760
+ coerced = attachIdForScalarDescriptor(descriptor, coerced, id);
761
+ }
762
+ return coerced;
763
+ }
764
+ if (isUnionDescriptor(descriptor)) {
765
+ const decoded = decodeUnionValueFromRawField(descriptor, raw);
766
+ if (!decoded) {
767
+ return null;
768
+ }
769
+ let normalized = await normalizeInlineField(decoded.branchDescriptor, decoded.branchValue, context, trail, isCollectionItem);
770
+ if (shouldIncludeObjectId(context.options.includeIdMode, isCollectionItem)) {
771
+ const id = decoded.rowId ?? extractId(raw);
772
+ normalized = attachIdForScalarDescriptor(descriptor, normalized, id);
773
+ }
774
+ return normalized;
775
+ }
602
776
  if (isModelRefDescriptor(descriptor)) {
603
777
  const inlineModelDescriptor = context.modelDescriptors.get(descriptor.model);
604
778
  const inlineModel = inlineModelDescriptor
@@ -885,14 +1059,25 @@ function createCmsClient(descriptor, config) {
885
1059
  return buildModelAccessor(modelEntry);
886
1060
  },
887
1061
  });
888
- const rootProxy = new Proxy({}, {
889
- get(_target, property) {
890
- if (typeof property !== "string")
891
- return undefined;
1062
+ const clientMeta = {
1063
+ locales: config.locales ?? [],
1064
+ defaultLocale: config.defaultLocale,
1065
+ includeIdDefault: !!config.includeId,
1066
+ };
1067
+ const rootProxyTarget = {
1068
+ models: modelsProxy,
1069
+ meta: clientMeta,
1070
+ };
1071
+ const rootProxy = new Proxy(rootProxyTarget, {
1072
+ get(target, property, receiver) {
1073
+ if (typeof property !== "string") {
1074
+ return Reflect.get(target, property, receiver);
1075
+ }
892
1076
  if (property === "then")
893
1077
  return undefined;
894
- if (property === "models")
895
- return modelsProxy;
1078
+ if (Reflect.has(target, property)) {
1079
+ return Reflect.get(target, property, receiver);
1080
+ }
896
1081
  const entry = registry.roots.get(property) ??
897
1082
  registry.rootsCaseInsensitive.get(property.toLowerCase());
898
1083
  if (!entry) {
@@ -901,14 +1086,13 @@ function createCmsClient(descriptor, config) {
901
1086
  return async (options) => runResource(entry, descriptor, baseUrl, apiKey, config.defaultLocale, assetUrlBuilder, zodSchemas, modelZodSchemas, globalIncludeId, sharedModelInflightCache, options);
902
1087
  },
903
1088
  });
904
- const client = Object.assign(rootProxy, {
905
- models: modelsProxy,
906
- locales: config.locales ?? [],
907
- defaultLocale: config.defaultLocale,
908
- includeIdDefault: !!config.includeId,
909
- });
910
- return client;
1089
+ return rootProxy;
911
1090
  }
912
1091
  function cms0(config) {
913
1092
  return createCmsClient(schema_descriptors_1.schemaDescriptor, config);
914
1093
  }
1094
+ var seo_js_1 = require("./seo.cjs");
1095
+ Object.defineProperty(exports, "resolveLocalized", { enumerable: true, get: function () { return seo_js_1.resolveLocalized; } });
1096
+ Object.defineProperty(exports, "toNextMetadata", { enumerable: true, get: function () { return seo_js_1.toNextMetadata; } });
1097
+ Object.defineProperty(exports, "toOpenGraph", { enumerable: true, get: function () { return seo_js_1.toOpenGraph; } });
1098
+ Object.defineProperty(exports, "toTwitter", { enumerable: true, get: function () { return seo_js_1.toTwitter; } });