@lwrjs/view-registry 0.17.2-alpha.28 → 0.17.2-alpha.29
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/build/cjs/index.cjs +6 -1
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +9 -1
- package/package.json +8 -8
package/build/cjs/index.cjs
CHANGED
|
@@ -226,9 +226,14 @@ var LwrViewRegistry = class {
|
|
|
226
226
|
throw new import_diagnostics.LwrServerError(import_diagnostics.descriptions.SERVER.UNEXPECTED_ERROR(message));
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
+
getLwrResourcesPlaceHolder(view, runtimeEnvironment, runtimeParams) {
|
|
230
|
+
const resourcesCacheKey = (0, import_utils.getViewDefCacheKey)(view, runtimeEnvironment, true, runtimeParams);
|
|
231
|
+
const resourcesCacheKeyHashed = (0, import_crypto.createHash)("md5").update(resourcesCacheKey).digest("hex");
|
|
232
|
+
return `__LWR_RESOURCES__${view.id}${resourcesCacheKeyHashed}`;
|
|
233
|
+
}
|
|
229
234
|
async renderView(view, viewParams, runtimeEnvironment, runtimeParams, viewCacheKey, renderOptions) {
|
|
230
235
|
const {id, contentTemplate, rootComponent, layoutTemplate} = view;
|
|
231
|
-
const lwrResourcesId =
|
|
236
|
+
const lwrResourcesId = this.getLwrResourcesPlaceHolder(view, runtimeEnvironment, runtimeParams);
|
|
232
237
|
const renderedContent = await this.render({id, contentTemplate, rootComponent}, {...viewParams, lwr_resources: lwrResourcesId}, runtimeParams, runtimeEnvironment);
|
|
233
238
|
let normalizedRenderOptions = (0, import_utils.normalizeRenderOptions)(this.runtimeEnvironment, renderedContent.options, renderOptions);
|
|
234
239
|
const layout = layoutTemplate || renderedContent.compiledView.layoutTemplate;
|
package/build/es/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export declare class LwrViewRegistry implements ViewRegistry {
|
|
|
45
45
|
getView(viewId: ViewIdentity): Promise<CompiledView>;
|
|
46
46
|
hasViewDefinition(view: View, viewParams: ViewParams, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): boolean;
|
|
47
47
|
getViewDefinition(view: View, viewParams: ViewParams, runtimeEnvironment: RuntimeEnvironment, runtimeParams?: RuntimeParams, renderOptions?: RenderOptions): Promise<LinkedViewDefinition>;
|
|
48
|
+
private getLwrResourcesPlaceHolder;
|
|
48
49
|
private renderView;
|
|
49
50
|
private render;
|
|
50
51
|
private metadataCache;
|
package/build/es/index.js
CHANGED
|
@@ -245,9 +245,17 @@ export class LwrViewRegistry {
|
|
|
245
245
|
throw new LwrServerError(descriptions.SERVER.UNEXPECTED_ERROR(message));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
+
getLwrResourcesPlaceHolder(view, runtimeEnvironment, runtimeParams) {
|
|
249
|
+
// Unlike the view definiton cache key which is a lot more open ended, we only
|
|
250
|
+
// need this cache key to vary for critical items like ?debug, locale, basePath, etc
|
|
251
|
+
// Note: hardcoding freeze assets here because it shouldn't matter for this key.
|
|
252
|
+
const resourcesCacheKey = getViewDefCacheKey(view, runtimeEnvironment, true, runtimeParams);
|
|
253
|
+
const resourcesCacheKeyHashed = createHash('md5').update(resourcesCacheKey).digest('hex');
|
|
254
|
+
return `__LWR_RESOURCES__${view.id}${resourcesCacheKeyHashed}`;
|
|
255
|
+
}
|
|
248
256
|
async renderView(view, viewParams, runtimeEnvironment, runtimeParams, viewCacheKey, renderOptions) {
|
|
249
257
|
const { id, contentTemplate, rootComponent, layoutTemplate } = view;
|
|
250
|
-
const lwrResourcesId =
|
|
258
|
+
const lwrResourcesId = this.getLwrResourcesPlaceHolder(view, runtimeEnvironment, runtimeParams);
|
|
251
259
|
const renderedContent = await this.render({ id, contentTemplate, rootComponent }, { ...viewParams, lwr_resources: lwrResourcesId }, runtimeParams, runtimeEnvironment);
|
|
252
260
|
// normalize the renderOptions provided by the CompiledView content with the request options.
|
|
253
261
|
let normalizedRenderOptions = normalizeRenderOptions(this.runtimeEnvironment, renderedContent.options, renderOptions);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.17.2-alpha.
|
|
7
|
+
"version": "0.17.2-alpha.29",
|
|
8
8
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"build": "tsc -b"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lwrjs/app-service": "0.17.2-alpha.
|
|
37
|
-
"@lwrjs/config": "0.17.2-alpha.
|
|
38
|
-
"@lwrjs/diagnostics": "0.17.2-alpha.
|
|
39
|
-
"@lwrjs/instrumentation": "0.17.2-alpha.
|
|
40
|
-
"@lwrjs/shared-utils": "0.17.2-alpha.
|
|
36
|
+
"@lwrjs/app-service": "0.17.2-alpha.29",
|
|
37
|
+
"@lwrjs/config": "0.17.2-alpha.29",
|
|
38
|
+
"@lwrjs/diagnostics": "0.17.2-alpha.29",
|
|
39
|
+
"@lwrjs/instrumentation": "0.17.2-alpha.29",
|
|
40
|
+
"@lwrjs/shared-utils": "0.17.2-alpha.29",
|
|
41
41
|
"lru-cache": "^10.4.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@lwrjs/types": "0.17.2-alpha.
|
|
44
|
+
"@lwrjs/types": "0.17.2-alpha.29"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=20.0.0"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"volta": {
|
|
50
50
|
"extends": "../../../package.json"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "c5d23a5a170bb906f66fc3fcbadf1648e87dcf1b"
|
|
53
53
|
}
|