@lwrjs/everywhere 0.10.0-alpha.2 → 0.10.0-alpha.20

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.
Files changed (41) hide show
  1. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/981eca8f72a57fecd21a35a5dfee2751/config.js +10 -0
  2. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_20/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +18 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{2_38_1/s/8cf6b94d9c0b398c70c97fdca2759caa → 2_50_0/s/b40440e2e29d782101f05d6085a324e9}/lwc.js +560 -584
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_10_0-alpha_2/s/c538071acf5bde58e816967a14c465c3 → 0_10_0-alpha_20/s/cb931ebef2b89dcf8ab51456e3a68864}/lwr_everywhereAmd.js +4 -4
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/0_10_0-alpha_20/s/5e6db37af51f0d23be4893abe5eeb913/lwr_init.js +163 -0
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_10_0-alpha_2/s/b9b0d37c87017e0845caa60b6f4b88f9 → 0_10_0-alpha_20/s/e768d044ed1b7b7babca2f39e1cbca58}/lwr_loader.js +105 -14
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_10_0-alpha_2/s/3426e42c3e22ce07ab2adc62c4c523a0 → 0_10_0-alpha_20/s/7a802ee7a2430244c1f66bce2c2eafef}/lwr_metrics.js +14 -2
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_10_0-alpha_20/s/a152b8d35f12ca1b5147c5cd1ee155fb/lwr_profiler.js +102 -0
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_10_0-alpha_2 → 0_10_0-alpha_20}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +2 -2
  10. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_10_0-alpha_2 → 0_10_0-alpha_20}/lwr-error-shim.js +2 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.bundle.js/v/{0_10_0-alpha_2 → 0_10_0-alpha_20}/lwr-loader-shim.bundle.js +583 -259
  12. package/build/assets/amd/lwr-everywhere-debug.js +536 -278
  13. package/build/assets/amd/lwr-everywhere-min.js +6 -1
  14. package/build/assets/amd/lwr-everywhere.js +536 -278
  15. package/build/assets/core/lwr-everywhere-debug.js +534 -276
  16. package/build/assets/core/lwr-everywhere-min.js +6 -1
  17. package/build/assets/core/lwr-everywhere.js +534 -276
  18. package/build/assets/esm/lwr-everywhere-debug.js +10 -3
  19. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  20. package/build/assets/esm/lwr-everywhere.js +10 -3
  21. package/build/generate.js +5 -10
  22. package/build/index.js +1 -1
  23. package/build/modules/lwr/everywhereAmd/everywhereAmd.d.ts +1 -1
  24. package/build/modules/lwr/host/host.html +1 -1
  25. package/build/modules/lwr/host/host.js +2 -2
  26. package/build/modules/lwr/setupLDS/setupLDS.js +8 -5
  27. package/build/modules/lwr/vault/vault.d.ts +1 -1
  28. package/build/utils.d.ts +1 -1
  29. package/package.json +15 -13
  30. package/src/generate.ts +7 -11
  31. package/src/index.ts +4 -1
  32. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/e8b5228f499eea69a8f669aada1f8042/config.js +0 -10
  33. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_10_0-alpha_2/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -18
  34. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/0_10_0-alpha_2/s/206e6e0af6f019fdfd86d87d56331bc2/lwr_init.js +0 -97
  35. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/0_10_0-alpha_2/s/e25f3b0b8b5c096acebf847d0a83ea62/lwr_profiler.js +0 -68
  36. package/build/modules/@salesforce/lds-default-luvio/lds-default-luvio.d.ts +0 -24
  37. package/build/modules/@salesforce/lds-default-luvio/lds-default-luvio.js +0 -60
  38. package/build/modules/lwr/setupNodeLDS/network.d.ts +0 -3
  39. package/build/modules/lwr/setupNodeLDS/network.js +0 -88
  40. package/build/modules/lwr/setupNodeLDS/setupNodeLDS.d.ts +0 -2
  41. package/build/modules/lwr/setupNodeLDS/setupNodeLDS.js +0 -14
@@ -1,3 +0,0 @@
1
- import type { FetchResponse, ResourceRequest } from '@luvio/engine';
2
- export declare function networkAdapter(req: ResourceRequest): Promise<FetchResponse<any>>;
3
- //# sourceMappingURL=network.d.ts.map
@@ -1,88 +0,0 @@
1
- import { getAuthInfo } from 'lwr/vault';
2
-
3
- /**
4
- * Authenticated UI API Luvio Network Adapter
5
- * See LDS error handling: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.data_error
6
- */
7
-
8
- class RecordError extends Error {
9
- constructor(message, status = 404) {
10
- super(message);
11
- this.body = {
12
- message
13
- };
14
- this.ok = false;
15
- this.status = status;
16
- this.statusText = message;
17
- }
18
- }
19
-
20
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
- export async function networkAdapter(req) {
22
- const authInfo = getAuthInfo();
23
- if (authInfo) {
24
- const {
25
- instance_url,
26
- access_token
27
- } = authInfo;
28
- const {
29
- baseUri,
30
- basePath,
31
- body,
32
- queryParams,
33
- method,
34
- headers
35
- } = req;
36
- const path = `${instance_url}${baseUri}${basePath}${generateQueryString(queryParams)}`;
37
- try {
38
- const res = await fetch(path, {
39
- method: method.toUpperCase(),
40
- headers: access_token ? generateHeaders({
41
- ...headers,
42
- Authorization: `Bearer ${access_token}`
43
- }) : generateHeaders(headers),
44
- body: body === null ? null : JSON.stringify(body)
45
- });
46
- if (res.ok) {
47
- return {
48
- body: res.status === 204 ? undefined : await res.json(),
49
- // HTTP 204 = No Content
50
- status: res.status,
51
- statusText: res.statusText,
52
- ok: res.ok,
53
- headers: {}
54
- };
55
- }
56
- // Request goes through but returns HTTP errors
57
- throw new RecordError(res.statusText, res.status);
58
- } catch (e) {
59
- // Return the failure; no response status => 401
60
- const error = e;
61
- throw new RecordError(error.message, error.status >= 0 ? error.status : 401);
62
- }
63
- } else {
64
- // There is no authentication data available to make this request
65
- throw new RecordError('You are not authenticated.', 401);
66
- }
67
- }
68
-
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
- function generateQueryString(params) {
71
- const queryStrings = [];
72
- for (const key of Object.keys(params)) {
73
- const value = Array.isArray(params[key]) ? params[key].join(',') : params[key];
74
- if (value) {
75
- queryStrings.push(`${key}=${value}`);
76
- }
77
- }
78
- return queryStrings.length > 0 ? `?${queryStrings.join('&')}` : '';
79
- }
80
- function generateHeaders(headers) {
81
- const fetchHeaders = new globalThis.Headers();
82
- for (const key of Object.keys(headers)) {
83
- fetchHeaders.set(key, headers[key]);
84
- }
85
- fetchHeaders.set('Accept', 'application/json');
86
- fetchHeaders.set('Content-Type', 'application/json');
87
- return fetchHeaders;
88
- }
@@ -1,2 +0,0 @@
1
- export default function (): void;
2
- //# sourceMappingURL=setupNodeLDS.d.ts.map
@@ -1,14 +0,0 @@
1
- import { Luvio, Store, Environment } from '@luvio/engine';
2
- import { setDefaultLuvio } from '@salesforce/lds-default-luvio';
3
- import { networkAdapter } from './network';
4
-
5
- // This module is used with LWR Node.js apps, it's aliased as "lwr/setupLDS" in package.json
6
- // Set the default Luvio instance for LWR Everywhere
7
- // It uses a fetch-based "web" network adapter with OAuth headers
8
-
9
- export default function () {
10
- const luvio = new Luvio(new Environment(new Store(), networkAdapter));
11
- setDefaultLuvio({
12
- luvio
13
- });
14
- }