@amplifyup/sdk 0.1.64 → 0.1.65

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.
@@ -434,9 +434,14 @@ function isFieldEnvelope(value) {
434
434
  const rec = value;
435
435
  return typeof rec.name === "string" && "value" in rec && !("url" in rec);
436
436
  }
437
+ function isPageResourceSentinel(value) {
438
+ return !!value && typeof value === "object" && !Array.isArray(value) && typeof value.__amplifyupPageResource === "string";
439
+ }
437
440
  function isPortableImageShape(value) {
438
441
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
439
- return "url" in value;
442
+ if ("url" in value) return true;
443
+ const rec = value;
444
+ return rec._type === "image" || rec.asset != null;
440
445
  }
441
446
  function isIdentifierKey(key) {
442
447
  return IDENTIFIER_KEYS.has(key);
@@ -540,6 +545,10 @@ function toFieldEnvelopes(source, prefix = "", scope) {
540
545
  continue;
541
546
  }
542
547
  const path = joinPath(prefix, key);
548
+ if (isPageResourceSentinel(raw)) {
549
+ out[key] = withLeaf({ value: raw, name: path }, ctx);
550
+ continue;
551
+ }
543
552
  if (isFieldEnvelope(raw)) {
544
553
  const inner = raw.value;
545
554
  if (isRecordList(inner)) {
@@ -817,7 +826,7 @@ function mergeEventContext(properties, attached) {
817
826
  };
818
827
  }
819
828
  var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
820
- function isPageResourceSentinel(value) {
829
+ function isPageResourceSentinel2(value) {
821
830
  return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_RESOURCE_MARKER] === "string";
822
831
  }
823
832
  function getByDotPath(source, path) {
@@ -833,7 +842,7 @@ function getByDotPath(source, path) {
833
842
  return cur;
834
843
  }
835
844
  function hydratePageResourceValue(value, fields) {
836
- if (!isPageResourceSentinel(value)) return value;
845
+ if (!isPageResourceSentinel2(value)) return value;
837
846
  if (!fields) return null;
838
847
  if (value.path) return getByDotPath(fields, value.path) ?? null;
839
848
  return fields;
@@ -845,7 +854,7 @@ function hydrateFieldsBag(bag, fields) {
845
854
  const env = val;
846
855
  out[key] = {
847
856
  name: env.name,
848
- value: isPageResourceSentinel(env.value) ? hydratePageResourceValue(env.value, fields) : env.value
857
+ value: isPageResourceSentinel2(env.value) ? hydratePageResourceValue(env.value, fields) : env.value
849
858
  };
850
859
  continue;
851
860
  }
@@ -853,7 +862,7 @@ function hydrateFieldsBag(bag, fields) {
853
862
  out[key] = hydrateFieldsBag(val, fields);
854
863
  continue;
855
864
  }
856
- out[key] = isPageResourceSentinel(val) ? hydratePageResourceValue(val, fields) : val;
865
+ out[key] = isPageResourceSentinel2(val) ? hydratePageResourceValue(val, fields) : val;
857
866
  }
858
867
  return out;
859
868
  }
@@ -866,7 +875,7 @@ function hydratePageResourceProps(props, fields) {
866
875
  }
867
876
  for (const [key, val] of Object.entries(out)) {
868
877
  if (key === "fields") continue;
869
- if (isPageResourceSentinel(val)) {
878
+ if (isPageResourceSentinel2(val)) {
870
879
  out[key] = hydratePageResourceValue(val, fields);
871
880
  }
872
881
  }