@seed-hypermedia/client 0.0.57 → 0.0.58

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.
@@ -280,7 +280,7 @@ var HMDocumentMetadataSchema = z.object({
280
280
  // Import taxonomy fields (comma-separated values from external sources like WordPress)
281
281
  importCategories: z.string().optional(),
282
282
  importTags: z.string().optional()
283
- });
283
+ }).passthrough();
284
284
  function hmMetadataJsonCorrection(metadata) {
285
285
  if (typeof metadata.theme === "string") {
286
286
  return {
@@ -290,6 +290,17 @@ function hmMetadataJsonCorrection(metadata) {
290
290
  }
291
291
  return metadata;
292
292
  }
293
+ var BUILTIN_METADATA_KEYS = new Set(Object.keys(HMDocumentMetadataSchema.shape));
294
+ function countCustomMetadataFields(metadata) {
295
+ if (!metadata) return 0;
296
+ let count = 0;
297
+ for (const [key, value] of Object.entries(metadata)) {
298
+ if (BUILTIN_METADATA_KEYS.has(key)) continue;
299
+ if (value === void 0 || value === null) continue;
300
+ count++;
301
+ }
302
+ return count;
303
+ }
293
304
  var visibilityMap = {
294
305
  0: "PUBLIC",
295
306
  1: "PUBLIC",
@@ -1368,6 +1379,8 @@ export {
1368
1379
  HMBlockNodeSchema,
1369
1380
  HMDocumentMetadataSchema,
1370
1381
  hmMetadataJsonCorrection,
1382
+ BUILTIN_METADATA_KEYS,
1383
+ countCustomMetadataFields,
1371
1384
  HMResourceVisibilitySchema,
1372
1385
  HMCommentSchema,
1373
1386
  HMBreadcrumbSchema,