@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.
- package/dist/AmplifyRenderer.js +15 -6
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +15 -6
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +60 -12
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +60 -12
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +10 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +10 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/AmplifyRenderer.mjs
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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 (!
|
|
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:
|
|
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] =
|
|
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 (
|
|
878
|
+
if (isPageResourceSentinel2(val)) {
|
|
870
879
|
out[key] = hydratePageResourceValue(val, fields);
|
|
871
880
|
}
|
|
872
881
|
}
|