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