@amplifyup/sdk 0.1.62 → 0.1.63
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 +401 -12
- package/dist/{AmplifyRenderer-BQ8-H2H4.d.ts → AmplifyRenderer-Bwob7ICJ.d.ts} +23 -4
- package/dist/{AmplifyRenderer-W7eqltSj.d.mts → AmplifyRenderer-TawbUIKZ.d.mts} +23 -4
- package/dist/AmplifyRenderer.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +70 -0
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +70 -0
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +45 -11
- package/dist/react.d.ts +45 -11
- package/dist/react.js +310 -75
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +310 -76
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +37 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +37 -0
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -417,6 +417,21 @@ function isPortableImageShape(value) {
|
|
|
417
417
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
418
418
|
return "url" in value;
|
|
419
419
|
}
|
|
420
|
+
function isEntryRefItem(value) {
|
|
421
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
422
|
+
const rec = value;
|
|
423
|
+
return typeof rec.id === "string" && rec.id.trim().length > 0 || typeof rec._id === "string" && rec._id.trim().length > 0 || typeof rec.docId === "string" && rec.docId.trim().length > 0;
|
|
424
|
+
}
|
|
425
|
+
function isRepeaterArray(value) {
|
|
426
|
+
if (!Array.isArray(value) || value.length === 0) return false;
|
|
427
|
+
const sample = value.find((item) => item != null);
|
|
428
|
+
if (sample === void 0) return false;
|
|
429
|
+
if (typeof sample !== "object" || Array.isArray(sample)) return false;
|
|
430
|
+
if (isPortableImageShape(sample)) return false;
|
|
431
|
+
if (isEntryRefItem(sample)) return false;
|
|
432
|
+
if (sample.$$typeof) return false;
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
420
435
|
function joinPath(prefix, key) {
|
|
421
436
|
return prefix ? `${prefix}.${key}` : key;
|
|
422
437
|
}
|
|
@@ -433,9 +448,21 @@ function toFieldEnvelopes(source, prefix = "") {
|
|
|
433
448
|
for (const [key, raw] of Object.entries(input)) {
|
|
434
449
|
const path = joinPath(prefix, key);
|
|
435
450
|
if (isFieldEnvelope(raw)) {
|
|
451
|
+
const inner = raw.value;
|
|
452
|
+
if (isRepeaterArray(inner)) {
|
|
453
|
+
out[key] = {
|
|
454
|
+
value: envelopeRepeaterItems(inner, raw.name || path),
|
|
455
|
+
name: raw.name || path
|
|
456
|
+
};
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
436
459
|
out[key] = { value: raw.value ?? null, name: raw.name || path };
|
|
437
460
|
continue;
|
|
438
461
|
}
|
|
462
|
+
if (isRepeaterArray(raw)) {
|
|
463
|
+
out[key] = { value: envelopeRepeaterItems(raw, path), name: path };
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
439
466
|
if (raw && typeof raw === "object" && !Array.isArray(raw) && !isPortableImageShape(raw) && !raw.$$typeof) {
|
|
440
467
|
out[key] = toFieldEnvelopes(raw, path);
|
|
441
468
|
continue;
|
|
@@ -444,6 +471,16 @@ function toFieldEnvelopes(source, prefix = "") {
|
|
|
444
471
|
}
|
|
445
472
|
return brandFields(out);
|
|
446
473
|
}
|
|
474
|
+
function envelopeRepeaterItems(items, prefix) {
|
|
475
|
+
return items.map((item, i) => {
|
|
476
|
+
const path = joinPath(prefix, String(i));
|
|
477
|
+
if (isBrandedFields(item)) return item;
|
|
478
|
+
if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
479
|
+
return toFieldEnvelopes(item, path);
|
|
480
|
+
}
|
|
481
|
+
return toFieldEnvelopes({}, path);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
447
484
|
function attachFieldEnvelopes(props) {
|
|
448
485
|
const raw = props && typeof props === "object" ? { ...props } : {};
|
|
449
486
|
if (isBrandedFields(raw.fields)) return raw;
|