@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/AmplifyRenderer.js
CHANGED
|
@@ -464,14 +464,14 @@ function applyPageContext(input, opts) {
|
|
|
464
464
|
log.warn("AmplifyUp: pageContext needs resourceType and key");
|
|
465
465
|
return null;
|
|
466
466
|
}
|
|
467
|
-
const
|
|
468
|
-
if (
|
|
467
|
+
const resource = opts.pageData?.resources?.[0];
|
|
468
|
+
if (resource && resource.type && resource.type !== input.resourceType) {
|
|
469
469
|
log.warn(
|
|
470
|
-
`AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page
|
|
470
|
+
`AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
|
|
471
471
|
);
|
|
472
472
|
return null;
|
|
473
473
|
}
|
|
474
|
-
const fieldDefs =
|
|
474
|
+
const fieldDefs = resource?.fields || [];
|
|
475
475
|
const defByKey = new Map(fieldDefs.map((f) => [f.key, f]));
|
|
476
476
|
const rawFields = input.fields && typeof input.fields === "object" ? input.fields : {};
|
|
477
477
|
const fields = {};
|
|
@@ -489,7 +489,7 @@ function applyPageContext(input, opts) {
|
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
const params = { ...opts.routeParams || {} };
|
|
492
|
-
const mapping =
|
|
492
|
+
const mapping = resource?.urlParamMapping;
|
|
493
493
|
let resourceKey = key;
|
|
494
494
|
if (mapping) {
|
|
495
495
|
const fromUrl = params[mapping.param];
|
|
@@ -507,7 +507,7 @@ function applyPageContext(input, opts) {
|
|
|
507
507
|
if (pf.value !== void 0) pageFields[pf.key] = pf.value;
|
|
508
508
|
continue;
|
|
509
509
|
}
|
|
510
|
-
if (pf.source === "mapped" && pf.
|
|
510
|
+
if (pf.source === "mapped" && pf.resource && pf.field) {
|
|
511
511
|
pageFields[pf.key] = fields[pf.field];
|
|
512
512
|
}
|
|
513
513
|
}
|
|
@@ -551,7 +551,7 @@ function mergeEventContext(properties, attached) {
|
|
|
551
551
|
...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function setPageResourceFields(fields) {
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
// src/index.ts
|
|
@@ -1184,7 +1184,7 @@ var AmplifyUpSDK = class {
|
|
|
1184
1184
|
routeParams: this.resolvedRouteParams,
|
|
1185
1185
|
pageRoute: this.resolvedPageRoute
|
|
1186
1186
|
});
|
|
1187
|
-
|
|
1187
|
+
setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
|
|
1188
1188
|
}
|
|
1189
1189
|
getAttachedPageContext() {
|
|
1190
1190
|
return this.attachedPageContext;
|