@amplifyup/sdk 0.1.44 → 0.1.45
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.d.mts +1 -1
- package/dist/AmplifyRenderer.d.ts +1 -1
- package/dist/AmplifyRenderer.js +8 -8
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +8 -8
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/{query-DhyG93JN.d.mts → query-2-zPPrMI.d.mts} +1 -1
- package/dist/{query-CMiGo_Kt.d.ts → query-CFpvzSZT.d.ts} +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +23 -23
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +23 -23
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +3 -3
- package/dist/server.d.ts +3 -3
- package/dist/{types-BjlTE_cW.d.mts → types-NdLzHxZo.d.mts} +2 -2
- package/dist/{types-BjlTE_cW.d.ts → types-NdLzHxZo.d.ts} +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -451,14 +451,14 @@ function applyPageContext(input, opts) {
|
|
|
451
451
|
log.warn("AmplifyUp: pageContext needs resourceType and key");
|
|
452
452
|
return null;
|
|
453
453
|
}
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
454
|
+
const resource = opts.pageData?.resources?.[0];
|
|
455
|
+
if (resource && resource.type && resource.type !== input.resourceType) {
|
|
456
456
|
log.warn(
|
|
457
|
-
`AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page
|
|
457
|
+
`AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
|
|
458
458
|
);
|
|
459
459
|
return null;
|
|
460
460
|
}
|
|
461
|
-
const fieldDefs =
|
|
461
|
+
const fieldDefs = resource?.fields || [];
|
|
462
462
|
const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
|
|
463
463
|
const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
|
|
464
464
|
const fields = {};
|
|
@@ -476,7 +476,7 @@ function applyPageContext(input, opts) {
|
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
478
|
const params = { ...opts.routeParams || {} };
|
|
479
|
-
const mapping =
|
|
479
|
+
const mapping = resource?.urlParamMapping;
|
|
480
480
|
let resourceKey = key;
|
|
481
481
|
if (mapping) {
|
|
482
482
|
const fromUrl = params[mapping.param];
|
|
@@ -494,7 +494,7 @@ function applyPageContext(input, opts) {
|
|
|
494
494
|
if (pf.value !== void 0) pageFields[pf.key] = pf.value;
|
|
495
495
|
continue;
|
|
496
496
|
}
|
|
497
|
-
if (pf.source === "mapped" && pf.
|
|
497
|
+
if (pf.source === "mapped" && pf.resource && pf.field) {
|
|
498
498
|
pageFields[pf.key] = fields[pf.field];
|
|
499
499
|
}
|
|
500
500
|
}
|
|
@@ -538,7 +538,7 @@ function mergeEventContext(properties, attached) {
|
|
|
538
538
|
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function setPageResourceFields(fields) {
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
// src/reservedRoutes.ts
|
|
@@ -1519,7 +1519,7 @@ var AmplifyUpSDK = class {
|
|
|
1519
1519
|
routeParams: this.resolvedRouteParams,
|
|
1520
1520
|
pageRoute: this.resolvedPageRoute
|
|
1521
1521
|
});
|
|
1522
|
-
|
|
1522
|
+
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1523
1523
|
}
|
|
1524
1524
|
getAttachedPageContext() {
|
|
1525
1525
|
return this.attachedPageContext;
|