@lwrjs/types 0.13.0-alpha.0 → 0.13.0-alpha.10

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/index.d.ts CHANGED
@@ -365,6 +365,7 @@ export interface ResourceDefinition {
365
365
  specifier?: string;
366
366
  type: ResourceType;
367
367
  src?: string;
368
+ entry?: string;
368
369
  inline?: boolean;
369
370
  async?: boolean;
370
371
  defer?: boolean;
@@ -372,6 +373,7 @@ export interface ResourceDefinition {
372
373
  content?: string;
373
374
  stream?: () => Readable;
374
375
  isPreload?: boolean;
376
+ version?: string;
375
377
  }
376
378
  export interface AssetMetadata {
377
379
  assetReferences?: AssetReference[];
@@ -623,6 +625,16 @@ export interface LwrStringBuilder {
623
625
  toString(): string;
624
626
  original: string;
625
627
  }
628
+ export interface DecisionTree<Artifact extends SiteArtifact> {
629
+ /**
630
+ * Insert an artifact into the tree based on a path of decisions
631
+ */
632
+ insert(siteArtifactId: string, artifact: Artifact, debug?: boolean, localeFallbacks?: Record<string, string[]>): void;
633
+ /**
634
+ * Retrieve an artifact from the tree based on a path of decisions
635
+ */
636
+ find(siteArtifactId: string | Partial<AbstractModuleId>, debug?: boolean, localeId?: string): Artifact | undefined;
637
+ }
626
638
  export interface SiteMetadata {
627
639
  /**
628
640
  * Get the path that all site metadata is relative to
@@ -654,6 +666,14 @@ export interface SiteMetadata {
654
666
  * @returns
655
667
  */
656
668
  persistSiteMetadata(): Promise<void>;
669
+ /**
670
+ * Get get decision tree to figure out the best site bundle to use.
671
+ */
672
+ getSiteBundlesDecisionTree(): DecisionTree<SiteBundle>;
673
+ /**
674
+ * Get get decision tree to figure out the best site resource to use.
675
+ */
676
+ getSiteResourcesDecisionTree(): DecisionTree<SiteResource>;
657
677
  }
658
678
  export interface SiteBundles {
659
679
  bundles: Record<string, SiteBundle>;
@@ -2,15 +2,27 @@ import type { ServerData } from '../index';
2
2
  import type { RegisterLoaderHooks } from './loaderPlugins/loaderPlugins';
3
3
  import type { RegisterHandleStaleModuleHook } from './handleStaleModule/handleStaleModule';
4
4
  import type { AppMetadata } from './appMetadata/appMetadata';
5
- export interface DataServiceAPI {
5
+ export type ServerDataCallbackParams = {
6
6
  serverData: ServerData;
7
+ };
8
+ export interface ServerDataCallback {
9
+ (params: ServerDataCallbackParams): void | null;
7
10
  }
8
- export interface ServiceAPI extends DataServiceAPI {
11
+ interface RegisterServerDataCallback {
12
+ (hook: ServerDataCallback): void;
13
+ }
14
+ export interface ServiceAPI {
9
15
  addLoaderPlugin: NoOp | RegisterLoaderHooks;
10
16
  handleStaleModule: RegisterHandleStaleModuleHook;
17
+ addServerDataCallback: RegisterServerDataCallback;
11
18
  appMetadata: AppMetadata;
12
19
  }
20
+ export interface ServerServiceAPI {
21
+ addLoaderPlugin: NoOp | RegisterLoaderHooks;
22
+ addServerDataCallback: RegisterServerDataCallback;
23
+ }
13
24
  export interface NoOp {
14
25
  (): void;
15
26
  }
27
+ export {};
16
28
  //# sourceMappingURL=serviceAPI.d.ts.map
package/build/views.d.ts CHANGED
@@ -85,6 +85,7 @@ export interface LinkedViewDefinition {
85
85
  viewRecord: RenderedViewRecord;
86
86
  immutable: boolean;
87
87
  cache?: CacheResponse;
88
+ nonce?: string;
88
89
  }
89
90
  export interface ViewRequestQs {
90
91
  [key: string]: undefined | string | string[];
@@ -109,6 +110,7 @@ export interface ViewResponse {
109
110
  metadata?: {
110
111
  viewDefinition?: LinkedViewDefinition;
111
112
  };
113
+ locale?: string;
112
114
  }
113
115
  export type RouteHandlerViewResponse = ViewDefinitionResponse | ViewResponse;
114
116
  export interface ViewDefinitionResponse {
@@ -119,6 +121,7 @@ export interface ViewDefinitionResponse {
119
121
  cache?: CacheResponse;
120
122
  headers?: Record<string, string>;
121
123
  cookie?: 'wip';
124
+ locale?: string;
122
125
  }
123
126
  export interface ViewProvider {
124
127
  name: string;
@@ -175,11 +178,13 @@ export interface ViewPageContext {
175
178
  url: string;
176
179
  basePath?: string;
177
180
  locale?: string;
181
+ nonce?: string;
178
182
  }
179
183
  export type ViewModuleResourceContext = {
180
184
  isPreload?: boolean;
181
185
  isSSR?: boolean;
182
186
  async?: boolean;
187
+ nonce?: string;
183
188
  };
184
189
  export interface ViewRegistry {
185
190
  addViewProviders(providers: ViewProvider[]): void;
@@ -212,17 +217,28 @@ export interface SsrRequestOptions {
212
217
  host?: string;
213
218
  requestDepth?: number;
214
219
  }
220
+ export type MetaTag = {
221
+ name?: string;
222
+ httpEquiv?: string;
223
+ content?: string;
224
+ };
225
+ export type LinkTag = {
226
+ href: string;
227
+ as?: string;
228
+ rel?: string;
229
+ fetchpriority?: 'high' | 'low' | 'auto';
230
+ };
215
231
  export interface SsrDataResponse {
216
232
  props?: {
217
233
  [prop: string]: Json;
218
234
  };
219
235
  markup?: {
220
- links?: {
221
- href: string;
222
- as?: string;
223
- rel?: string;
224
- fetchpriority?: 'high' | 'low' | 'auto';
236
+ title?: string;
237
+ meta?: MetaTag[];
238
+ scripts?: {
239
+ body: string;
225
240
  }[];
241
+ links?: LinkTag[];
226
242
  };
227
243
  cache?: CacheResponse;
228
244
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "build": "tsc -b"
9
9
  },
10
10
  "type": "module",
11
- "version": "0.13.0-alpha.0",
11
+ "version": "0.13.0-alpha.10",
12
12
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
13
13
  "repository": {
14
14
  "type": "git",
@@ -29,5 +29,5 @@
29
29
  "engines": {
30
30
  "node": ">=18.0.0"
31
31
  },
32
- "gitHead": "c5fe8db55c74513dbb0937d1b4568109715a13fb"
32
+ "gitHead": "53e2a825868b4c9b1662419b531c80be13afd779"
33
33
  }