@lwrjs/types 0.9.0-alpha.16 → 0.9.0-alpha.18

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/config.d.ts CHANGED
@@ -41,6 +41,9 @@ export interface LwrLockerConfig {
41
41
  trustedComponents?: string[];
42
42
  clientOnly?: boolean;
43
43
  }
44
+ export interface RouteHandlersConfig {
45
+ [id: string]: string;
46
+ }
44
47
  export interface LocalizedViewRequest extends ViewRequest {
45
48
  locale?: string;
46
49
  }
@@ -88,6 +91,7 @@ export interface LwrGlobalConfig {
88
91
  viewTransformers?: ServiceConfig[];
89
92
  routes?: LwrRoute[];
90
93
  errorRoutes?: LwrErrorRoute[];
94
+ routeHandlers?: RouteHandlersConfig;
91
95
  bundleConfig?: BundleConfig;
92
96
  serverType?: ServerTypes;
93
97
  staticSiteGenerator?: StaticSiteGenerator;
@@ -123,8 +127,7 @@ export interface ServerBuild {
123
127
  globalData: GlobalData;
124
128
  hooks: HooksPlugin[];
125
129
  services: Services;
126
- routes: Route<NormalizedLwrRoute>[];
127
- errorRoutes: Route<NormalizedLwrErrorRoute>[];
130
+ routeHandlers: RouteHandlers;
128
131
  }
129
132
  export interface Services {
130
133
  moduleProviders: ResolvedServiceEntry<ModuleProvider>[];
@@ -135,9 +138,9 @@ export interface Services {
135
138
  assetProviders: ResolvedServiceEntry<AssetProvider>[];
136
139
  assetTransformers: ResolvedServiceEntry<AssetTransformPlugin>[];
137
140
  }
138
- export declare type Route<T extends LwrBaseRoute> = (T extends LwrRoute ? Omit<NormalizedLwrRoute, 'routeHandler'> : Omit<NormalizedLwrErrorRoute, 'routeHandler'>) & {
139
- routeHandler?: RouteHandlerFunction;
140
- };
141
+ export interface RouteHandlers {
142
+ [id: string]: RouteHandlerFunction;
143
+ }
141
144
  interface AssetConfigCommon {
142
145
  urlPath: string;
143
146
  alias?: string;
package/build/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { WatchOptions } from 'chokidar';
6
6
  import { EventEmitter } from 'events';
7
7
  import fs from 'fs';
8
8
  import { Readable } from 'stream';
9
- import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, LwrRoute, LwrErrorRoute, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, Route, BundleConfigOverrides } from './config.js';
9
+ import { BundleConfig, EnvironmentConfig, HooksPlugin, LwrLockerConfig, NormalizedLwrErrorRoute, NormalizedLwrGlobalConfig, NormalizedLwrRoute, ResolverModuleRecord, BundleConfigOverrides, RouteHandlers } from './config.js';
10
10
  import { AssetReference, CompiledView, PublicViewRegistry, ViewProvider, ViewRegistry, ViewTransformPlugin } from './views.js';
11
11
  export * from './lwr-shim.js';
12
12
  export * from './config.js';
@@ -504,8 +504,7 @@ export interface ServerContext {
504
504
  siteMetadata?: SiteMetadata;
505
505
  appConfig: NormalizedLwrGlobalConfig;
506
506
  runtimeEnvironment: RuntimeEnvironment;
507
- routes: Route<LwrRoute>[];
508
- errorRoutes: Route<LwrErrorRoute>[];
507
+ routeHandlers: RouteHandlers;
509
508
  }
510
509
  export interface Observer<V> {
511
510
  next: (value: V) => void;
package/build/views.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { LwrErrorRoute, LwrRoute, Route, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
2
+ import { LwrErrorRoute, LwrRoute, RouteHandlerFunction, RouteHandlerView, View } from './config.js';
3
3
  import { AssetSource, AssetUri, Endpoints, FlattenedModuleGraphs, ImportMetadata, Json, LwrStringBuilder, ResourceDefinition, RuntimeEnvironment, RuntimeParams, Specifier, TransformPluginContext } from './index.js';
4
4
  export declare type ViewIdentity = Pick<View, 'rootComponent' | 'contentTemplate'>;
5
5
  export interface ViewSource {
@@ -185,9 +185,9 @@ export interface ViewRegistry {
185
185
  }
186
186
  export declare type PublicViewRegistry = Pick<ViewRegistry, 'getView' | 'getViewDefinition'>;
187
187
  export interface ViewHandler {
188
- getViewContent(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
189
- getViewJson(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
190
- getViewConfiguration(viewRequest: ViewRequest, route: Route<LwrRoute | LwrErrorRoute>, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse | undefined>;
188
+ getViewContent(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
189
+ getViewJson(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse>;
190
+ getViewConfiguration(viewRequest: ViewRequest, route: LwrRoute | LwrErrorRoute, runtimeEnvironment: RuntimeEnvironment, runtimeParams: RuntimeParams): Promise<ViewResponse | undefined>;
191
191
  }
192
192
  export interface SsrRequestContext {
193
193
  props: Json;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.9.0-alpha.16",
11
+ "version": "0.9.0-alpha.18",
12
12
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
13
13
  "repository": {
14
14
  "type": "git",
@@ -33,5 +33,5 @@
33
33
  "node": "14.19.1",
34
34
  "yarn": "1.22.19"
35
35
  },
36
- "gitHead": "03fe3982780e7c63b96ef0733b58529057db61fa"
36
+ "gitHead": "0d612ec0c74c679ce422f7bbae9fae14134f7d9f"
37
37
  }