@squiz/render-runtime-lib 1.73.0 → 1.74.0

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.
@@ -9,6 +9,6 @@ export declare class ContentRuntimeService {
9
9
  dynamicContentItemService: DynamicContentItemService;
10
10
  previewResolver: ComponentContentUriResolverForPreview;
11
11
  constructor(contentServiceUrl: string, manifest: ManifestModel, manifestPath?: string | undefined);
12
- getContentItemProduction(uri: string, dxpApiKey: string): Promise<UriResource | undefined>;
12
+ getContentItemProduction(uri: string, dxpApiKey: string, context?: string): Promise<UriResource | undefined>;
13
13
  getContentItemPreview(uri: string): Promise<UriResource | undefined>;
14
14
  }
package/lib/index.js CHANGED
@@ -2147,14 +2147,9 @@ var RenderInputService = class {
2147
2147
  };
2148
2148
  }
2149
2149
  getQueryParametersFromRequest(request, componentFunction) {
2150
- if (!componentFunction.queryParameters) {
2151
- return {};
2152
- }
2153
2150
  const queryParameters = {};
2154
- for (const parameter of Object.keys(componentFunction.queryParameters)) {
2155
- if (componentFunction.queryParameters[parameter].required && request.expressRequest.query[parameter] === void 0) {
2156
- throw new import_dx_common_lib9.BadRequestError(`Required query parameter '${parameter}' is missing`);
2157
- }
2151
+ const whitelistQueryParameters = ["_contentContext"];
2152
+ for (const parameter of whitelistQueryParameters) {
2158
2153
  if (request.expressRequest.query[parameter] === void 0) {
2159
2154
  continue;
2160
2155
  }
@@ -2163,6 +2158,20 @@ var RenderInputService = class {
2163
2158
  }
2164
2159
  queryParameters[parameter] = request.expressRequest.query[parameter];
2165
2160
  }
2161
+ if (componentFunction.queryParameters) {
2162
+ for (const parameter of Object.keys(componentFunction.queryParameters)) {
2163
+ if (componentFunction.queryParameters[parameter].required && request.expressRequest.query[parameter] === void 0) {
2164
+ throw new import_dx_common_lib9.BadRequestError(`Required query parameter '${parameter}' is missing`);
2165
+ }
2166
+ if (request.expressRequest.query[parameter] === void 0) {
2167
+ continue;
2168
+ }
2169
+ if (typeof request.expressRequest.query[parameter] !== "string") {
2170
+ throw new import_dx_common_lib9.BadRequestError(`Value for query parameter '${parameter}' must be a string`);
2171
+ }
2172
+ queryParameters[parameter] = request.expressRequest.query[parameter];
2173
+ }
2174
+ }
2166
2175
  return queryParameters;
2167
2176
  }
2168
2177
  getPreviewRuntimeSet(manifest, previewEnvVars) {
@@ -2763,6 +2772,17 @@ var MockedComponentSetServiceForProduction = class extends import_component_lib4
2763
2772
  type: "server"
2764
2773
  }
2765
2774
  ],
2775
+ "unit-test-components/test-component-query-parameters": [
2776
+ {
2777
+ version: "1.0.0",
2778
+ environmentVariables: { "some-var": "test-component-query-parameters v1.0.0 value" },
2779
+ displayName: setName,
2780
+ description: "some-description",
2781
+ icon: void 0,
2782
+ editable: true,
2783
+ type: "server"
2784
+ }
2785
+ ],
2766
2786
  "unit-test-components/test-npm-modules": [
2767
2787
  {
2768
2788
  version: "1.0.0",