@amplifyup/sdk 0.1.44 → 0.1.46

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.
@@ -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 slot = opts.pageData?.slots?.[0];
466
- if (slot && slot.type && slot.type !== input.resourceType) {
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 slot "${slot.type}"`
468
+ `AmplifyUp: pageContext resourceType "${input.resourceType}" does not match page resource "${resource.type}"`
469
469
  );
470
470
  return null;
471
471
  }
472
- const fieldDefs = slot?.fields || [];
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 = {};
@@ -482,12 +482,16 @@ function applyPageContext(input, opts) {
482
482
  log.warn(`AmplifyUp: unknown resource field "${k}" dropped`);
483
483
  continue;
484
484
  }
485
+ if (def.passThrough) {
486
+ if (v != null) fields[k] = v;
487
+ continue;
488
+ }
485
489
  const coerced = coerceField(def, v, log);
486
490
  if (coerced !== void 0) fields[k] = coerced;
487
491
  }
488
492
  }
489
493
  const params = { ...opts.routeParams || {} };
490
- const mapping = slot?.urlParamMapping;
494
+ const mapping = resource?.urlParamMapping;
491
495
  let resourceKey = key;
492
496
  if (mapping) {
493
497
  const fromUrl = params[mapping.param];
@@ -505,7 +509,7 @@ function applyPageContext(input, opts) {
505
509
  if (pf.value !== void 0) pageFields[pf.key] = pf.value;
506
510
  continue;
507
511
  }
508
- if (pf.source === "mapped" && pf.slot && pf.field) {
512
+ if (pf.source === "mapped" && pf.resource && pf.field) {
509
513
  pageFields[pf.key] = fields[pf.field];
510
514
  }
511
515
  }
@@ -549,7 +553,7 @@ function mergeEventContext(properties, attached) {
549
553
  ...attached.pageRoute ? { pageRoute: attached.pageRoute } : {}
550
554
  };
551
555
  }
552
- function setPageSlotFields(fields) {
556
+ function setPageResourceFields(fields) {
553
557
  }
554
558
 
555
559
  // src/index.ts
@@ -1182,7 +1186,7 @@ var AmplifyUpSDK = class {
1182
1186
  routeParams: this.resolvedRouteParams,
1183
1187
  pageRoute: this.resolvedPageRoute
1184
1188
  });
1185
- setPageSlotFields(this.attachedPageContext?.resource?.fields || null);
1189
+ setPageResourceFields(this.attachedPageContext?.resource?.fields || null);
1186
1190
  }
1187
1191
  getAttachedPageContext() {
1188
1192
  return this.attachedPageContext;