@lwrjs/tools 0.21.8 → 0.22.2

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.
@@ -41,11 +41,34 @@ function getHandlerFunction() {
41
41
  if (!input) {
42
42
  input = DEFAULT_INPUT;
43
43
  }
44
+ // Normalize to API Gateway V1-style event (required by pwa-kit-runtime @h4ad/serverless-adapter in 3.16+)
45
+ const httpMethod = input.httpMethod || input.method || 'GET';
46
+ const path = input.path || '/';
47
+ const headers = input.headers || {};
48
+ const event = {
49
+ resource: path,
50
+ path,
51
+ httpMethod,
52
+ headers,
53
+ multiValueHeaders: Object.fromEntries(Object.entries(headers).map(([k, v]) => [k, [].concat(v)])),
54
+ queryStringParameters: input.queryStringParameters || null,
55
+ multiValueQueryStringParameters: null,
56
+ requestContext: input.requestContext || {
57
+ requestId: 'test-request-id',
58
+ httpMethod,
59
+ path,
60
+ stage: '$default',
61
+ },
62
+ pathParameters: null,
63
+ stageVariables: null,
64
+ body: input.body || null,
65
+ isBase64Encoded: false,
66
+ };
44
67
 
45
68
  // Import the SSR module
46
69
  const ssr = require('./ssr.js');
47
70
  return new Promise((resolve, reject) => {
48
- ssr.get(input, DEFAULT_CONTEXT, (error, result) => {
71
+ ssr.get(event, DEFAULT_CONTEXT, (error, result) => {
49
72
  if (error) {
50
73
  return reject(error);
51
74
  } else {
@@ -36,11 +36,34 @@ function getHandlerFunction() {
36
36
  if (!input) {
37
37
  input = DEFAULT_INPUT;
38
38
  }
39
+ // Normalize to API Gateway V1-style event (required by pwa-kit-runtime @h4ad/serverless-adapter in 3.16+)
40
+ const httpMethod = input.httpMethod || input.method || 'GET';
41
+ const path = input.path || '/';
42
+ const headers = input.headers || {};
43
+ const event = {
44
+ resource: path,
45
+ path,
46
+ httpMethod,
47
+ headers,
48
+ multiValueHeaders: Object.fromEntries(Object.entries(headers).map(([k, v]) => [k, [].concat(v)])),
49
+ queryStringParameters: input.queryStringParameters || null,
50
+ multiValueQueryStringParameters: null,
51
+ requestContext: input.requestContext || {
52
+ requestId: 'test-request-id',
53
+ httpMethod,
54
+ path,
55
+ stage: '$default',
56
+ },
57
+ pathParameters: null,
58
+ stageVariables: null,
59
+ body: input.body || null,
60
+ isBase64Encoded: false,
61
+ };
39
62
 
40
63
  // Import the SSR module
41
64
  const ssr = require('./ssr.js');
42
65
  return new Promise((resolve, reject) => {
43
- ssr.get(input, DEFAULT_CONTEXT, (error, result) => {
66
+ ssr.get(event, DEFAULT_CONTEXT, (error, result) => {
44
67
  if (error) {
45
68
  return reject(error);
46
69
  } else {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.21.8",
7
+ "version": "0.22.2",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -34,16 +34,16 @@
34
34
  "package.cjs"
35
35
  ],
36
36
  "dependencies": {
37
- "@lwrjs/config": "0.21.8",
38
- "@lwrjs/core": "0.21.8",
39
- "@lwrjs/diagnostics": "0.21.8",
40
- "@lwrjs/shared-utils": "0.21.8",
41
- "@lwrjs/static": "0.21.8",
37
+ "@lwrjs/config": "0.22.2",
38
+ "@lwrjs/core": "0.22.2",
39
+ "@lwrjs/diagnostics": "0.22.2",
40
+ "@lwrjs/shared-utils": "0.22.2",
41
+ "@lwrjs/static": "0.22.2",
42
42
  "esbuild": "^0.25.2",
43
43
  "fs-extra": "^11.2.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@lwrjs/types": "0.21.8",
46
+ "@lwrjs/types": "0.22.2",
47
47
  "jest": "29.7.0",
48
48
  "ts-jest": "^29.2.6"
49
49
  },
@@ -51,10 +51,10 @@
51
51
  "lwc": ">= 2.x"
52
52
  },
53
53
  "engines": {
54
- "node": ">=20.0.0"
54
+ "node": ">=22.0.0"
55
55
  },
56
56
  "volta": {
57
57
  "extends": "../../../package.json"
58
58
  },
59
- "gitHead": "3665b85aad9402b59812e67570c0c6e3be093c00"
59
+ "gitHead": "30870e466e15e6691d238e75836e9266a45203e3"
60
60
  }