@amplifyup/sdk 0.1.64 → 0.1.66
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 +85 -35
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +85 -35
- 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.js
CHANGED
|
@@ -436,9 +436,14 @@ function isFieldEnvelope(value) {
|
|
|
436
436
|
const rec = value;
|
|
437
437
|
return typeof rec.name === "string" && "value" in rec && !("url" in rec);
|
|
438
438
|
}
|
|
439
|
+
function isPageResourceSentinel(value) {
|
|
440
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && typeof value.__amplifyupPageResource === "string";
|
|
441
|
+
}
|
|
439
442
|
function isPortableImageShape(value) {
|
|
440
443
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
441
|
-
|
|
444
|
+
if ("url" in value) return true;
|
|
445
|
+
const rec = value;
|
|
446
|
+
return rec._type === "image" || rec.asset != null;
|
|
442
447
|
}
|
|
443
448
|
function isIdentifierKey(key) {
|
|
444
449
|
return IDENTIFIER_KEYS.has(key);
|
|
@@ -542,6 +547,10 @@ function toFieldEnvelopes(source, prefix = "", scope) {
|
|
|
542
547
|
continue;
|
|
543
548
|
}
|
|
544
549
|
const path = joinPath(prefix, key);
|
|
550
|
+
if (isPageResourceSentinel(raw)) {
|
|
551
|
+
out[key] = withLeaf({ value: raw, name: path }, ctx);
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
545
554
|
if (isFieldEnvelope(raw)) {
|
|
546
555
|
const inner = raw.value;
|
|
547
556
|
if (isRecordList(inner)) {
|
|
@@ -819,7 +828,7 @@ function mergeEventContext(properties, attached) {
|
|
|
819
828
|
};
|
|
820
829
|
}
|
|
821
830
|
var PAGE_RESOURCE_MARKER = "__amplifyupPageResource";
|
|
822
|
-
function
|
|
831
|
+
function isPageResourceSentinel2(value) {
|
|
823
832
|
return !!value && typeof value === "object" && !Array.isArray(value) && typeof value[PAGE_RESOURCE_MARKER] === "string";
|
|
824
833
|
}
|
|
825
834
|
function getByDotPath(source, path) {
|
|
@@ -835,7 +844,7 @@ function getByDotPath(source, path) {
|
|
|
835
844
|
return cur;
|
|
836
845
|
}
|
|
837
846
|
function hydratePageResourceValue(value, fields) {
|
|
838
|
-
if (!
|
|
847
|
+
if (!isPageResourceSentinel2(value)) return value;
|
|
839
848
|
if (!fields) return null;
|
|
840
849
|
if (value.path) return getByDotPath(fields, value.path) ?? null;
|
|
841
850
|
return fields;
|
|
@@ -847,7 +856,7 @@ function hydrateFieldsBag(bag, fields) {
|
|
|
847
856
|
const env = val;
|
|
848
857
|
out[key] = {
|
|
849
858
|
name: env.name,
|
|
850
|
-
value:
|
|
859
|
+
value: isPageResourceSentinel2(env.value) ? hydratePageResourceValue(env.value, fields) : env.value
|
|
851
860
|
};
|
|
852
861
|
continue;
|
|
853
862
|
}
|
|
@@ -855,7 +864,7 @@ function hydrateFieldsBag(bag, fields) {
|
|
|
855
864
|
out[key] = hydrateFieldsBag(val, fields);
|
|
856
865
|
continue;
|
|
857
866
|
}
|
|
858
|
-
out[key] =
|
|
867
|
+
out[key] = isPageResourceSentinel2(val) ? hydratePageResourceValue(val, fields) : val;
|
|
859
868
|
}
|
|
860
869
|
return out;
|
|
861
870
|
}
|
|
@@ -868,7 +877,7 @@ function hydratePageResourceProps(props, fields) {
|
|
|
868
877
|
}
|
|
869
878
|
for (const [key, val] of Object.entries(out)) {
|
|
870
879
|
if (key === "fields") continue;
|
|
871
|
-
if (
|
|
880
|
+
if (isPageResourceSentinel2(val)) {
|
|
872
881
|
out[key] = hydratePageResourceValue(val, fields);
|
|
873
882
|
}
|
|
874
883
|
}
|