@salesforce/webapp-experimental 0.2.1 → 0.3.0

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.
@@ -9,6 +9,11 @@ export interface GraphQLResponse<T> {
9
9
  path?: string[];
10
10
  }[];
11
11
  }
12
+ export type NodeOfConnection<T> = T extends {
13
+ edges?: (infer E)[] | null;
14
+ } | null ? E extends {
15
+ node?: infer N;
16
+ } | null ? N : never : never;
12
17
  /**
13
18
  * Execute a GraphQL query against the Salesforce GraphQL API
14
19
  *
@@ -16,5 +21,5 @@ export interface GraphQLResponse<T> {
16
21
  * @param variables - Optional variables for the query
17
22
  * @returns The GraphQL response data
18
23
  */
19
- export declare function executeGraphQL<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
24
+ export declare function executeGraphQL<T, InputVariables = Record<string, unknown>>(query: string, variables?: InputVariables): Promise<T>;
20
25
  //# sourceMappingURL=graphql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/api/graphql.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB,EAAE,CAAC;CACJ;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACrC,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,CAaZ"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../src/api/graphql.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB,EAAE,CAAC;CACJ;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAC3C,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;CAC3B,GAAG,IAAI,GACL,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,GAClC,CAAC,GACD,KAAK,GACN,KAAK,CAAC;AAET;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/E,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,CAAC,CAAC,CAaZ"}
@@ -7,26 +7,31 @@
7
7
  * 3. Use executeGraphQL<T>() with proper typing
8
8
  * 4. Extract and return the relevant data from the response
9
9
  */
10
+ /** Variables for the GetHighRevenueAccounts query */
11
+ export type GetHighRevenueAccountsVariables = {
12
+ minRevenue?: number | null;
13
+ };
14
+ /** Shape of an Account node returned by the query */
10
15
  export interface Account {
11
16
  Id: string;
12
- Name: {
13
- value: string;
14
- };
15
- AnnualRevenue: {
16
- value: number | null;
17
- };
18
- Industry: {
19
- value: string | null;
20
- };
21
- Website: {
22
- value: string | null;
23
- };
17
+ Name?: {
18
+ value?: string | null;
19
+ } | null;
20
+ AnnualRevenue?: {
21
+ value?: number | null;
22
+ } | null;
23
+ Industry?: {
24
+ value?: string | null;
25
+ } | null;
26
+ Website?: {
27
+ value?: string | null;
28
+ } | null;
24
29
  }
25
30
  /**
26
31
  * Fetch accounts with annual revenue greater than the specified amount
27
32
  *
28
- * @param minRevenue - Minimum annual revenue threshold (default: 100000)
33
+ * @param variables - Query variables including minRevenue threshold
29
34
  * @returns Array of accounts matching the criteria
30
35
  */
31
- export declare function getHighRevenueAccounts(minRevenue?: number): Promise<Account[]>;
36
+ export declare function getHighRevenueAccounts(variables: GetHighRevenueAccountsVariables): Promise<(Account | null | undefined)[]>;
32
37
  //# sourceMappingURL=accounts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/api/utils/accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACxC,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACnC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAClC;AAsCD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,UAAU,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAMpF"}
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/api/utils/accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,qDAAqD;AAErD,MAAM,MAAM,+BAA+B,GAAG;IAC7C,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,qDAAqD;AACrD,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAC3C;AA6CD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC3C,SAAS,EAAE,+BAA+B,GACxC,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC,CAOzC"}
@@ -8,38 +8,44 @@
8
8
  * 4. Extract and return the relevant data from the response
9
9
  */
10
10
  import { executeGraphQL } from "../graphql.js";
11
- const HIGH_REVENUE_ACCOUNTS_QUERY = `
12
- query GetHighRevenueAccounts($minRevenue: Currency) {
13
- uiapi {
14
- query {
15
- Account(
16
- where: { AnnualRevenue: { gt: $minRevenue } }
17
- orderBy: { AnnualRevenue: { order: DESC } }
18
- first: 50
19
- ) {
20
- edges {
21
- node {
22
- Id
23
- Name { value }
24
- AnnualRevenue { value }
25
- Industry { value }
26
- Website { value }
27
- }
28
- }
29
- }
30
- }
31
- }
32
- }
11
+ const HIGH_REVENUE_ACCOUNTS_QUERY = /* GraphQL */ `
12
+ query GetHighRevenueAccounts($minRevenue: Currency) {
13
+ uiapi {
14
+ query {
15
+ Account(
16
+ where: { AnnualRevenue: { gt: $minRevenue } }
17
+ orderBy: { AnnualRevenue: { order: DESC } }
18
+ first: 50
19
+ ) {
20
+ edges {
21
+ node {
22
+ Id
23
+ Name {
24
+ value
25
+ }
26
+ AnnualRevenue {
27
+ value
28
+ }
29
+ Industry {
30
+ value
31
+ }
32
+ Website {
33
+ value
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
33
41
  `;
34
42
  /**
35
43
  * Fetch accounts with annual revenue greater than the specified amount
36
44
  *
37
- * @param minRevenue - Minimum annual revenue threshold (default: 100000)
45
+ * @param variables - Query variables including minRevenue threshold
38
46
  * @returns Array of accounts matching the criteria
39
47
  */
40
- export async function getHighRevenueAccounts(minRevenue = 100000) {
41
- const response = await executeGraphQL(HIGH_REVENUE_ACCOUNTS_QUERY, {
42
- minRevenue,
43
- });
44
- return response.uiapi.query.Account.edges.map((edge) => edge.node);
48
+ export async function getHighRevenueAccounts(variables) {
49
+ const response = await executeGraphQL(HIGH_REVENUE_ACCOUNTS_QUERY, variables);
50
+ return response.uiapi?.query?.Account?.edges?.map((edge) => edge?.node) || [];
45
51
  }
package/dist/app/org.d.ts CHANGED
@@ -2,6 +2,7 @@ export interface OrgInfo {
2
2
  orgId: string;
3
3
  apiVersion: string;
4
4
  instanceUrl: string;
5
+ rawInstanceUrl: string;
5
6
  username: string;
6
7
  accessToken: string;
7
8
  orgAlias?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/app/org.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAkBhF;AAcD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,gCAKpD"}
1
+ {"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/app/org.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAmBhF;AAcD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,gCAKpD"}
package/dist/app/org.js CHANGED
@@ -17,6 +17,7 @@ export async function getOrgInfo(orgAlias) {
17
17
  apiVersion: connection.getApiVersion(),
18
18
  orgId: authFields.orgId ?? "",
19
19
  instanceUrl: toLightningDomain(connection.instanceUrl),
20
+ rawInstanceUrl: connection.instanceUrl,
20
21
  username: authFields.username ?? "",
21
22
  accessToken: connection.accessToken ?? "",
22
23
  orgAlias,
@@ -5,6 +5,7 @@ import type { OrgInfo, WebAppManifest } from "../app/index.js";
5
5
  */
6
6
  export interface ProxyOptions {
7
7
  debug?: boolean;
8
+ onTokenRefresh?: (updatedOrgInfo: OrgInfo) => void;
8
9
  }
9
10
  /**
10
11
  * Proxy handler function type
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/proxy/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG/D;;GAEG;AACH,MAAM,WAAW,YAAY;IAE5B,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,CAAC,EAAE,MAAM,IAAI,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;AA8MnB;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,OAAO,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,YAAY,GACpB,YAAY,CAGd"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/proxy/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG/D;;GAEG;AACH,MAAM,WAAW,YAAY;IAE5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,cAAc,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,IAAI,CAAC,EAAE,MAAM,IAAI,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;AA+SnB;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,OAAO,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,YAAY,GACpB,YAAY,CAGd"}
@@ -29,6 +29,10 @@ class WebAppProxyHandler {
29
29
  await this.handleSalesforceApi(req, res);
30
30
  return;
31
31
  }
32
+ if (match.type === "gql") {
33
+ await this.handleGraphQL(req, res);
34
+ return;
35
+ }
32
36
  if (match.type === "redirect" && match.target && match.statusCode) {
33
37
  this.handleRedirect(res, match.target, match.statusCode);
34
38
  return;
@@ -52,14 +56,17 @@ class WebAppProxyHandler {
52
56
  res.writeHead(statusCode, { Location: location });
53
57
  res.end();
54
58
  }
59
+ sendNoOrgError(res) {
60
+ res.writeHead(401, { "Content-Type": "application/json" });
61
+ res.end(JSON.stringify({
62
+ error: "NO_ORG_FOUND",
63
+ message: "No default Salesforce org found. Run 'sf org login web --set-default' to authenticate.",
64
+ }));
65
+ }
55
66
  async handleSalesforceApi(req, res) {
56
67
  try {
57
68
  if (!this.orgInfo) {
58
- res.writeHead(401, { "Content-Type": "application/json" });
59
- res.end(JSON.stringify({
60
- error: "NO_ORG_FOUND",
61
- message: "No default Salesforce org found. Run 'sf org login web --set-default' to authenticate.",
62
- }));
69
+ this.sendNoOrgError(res);
63
70
  return;
64
71
  }
65
72
  const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
@@ -89,26 +96,96 @@ class WebAppProxyHandler {
89
96
  });
90
97
  if (response.status === 401 || response.status === 403) {
91
98
  console.warn(`[webapps-proxy] Received ${response.status}, refreshing token...`);
92
- // Use the orgAlias from the current orgInfo to maintain consistency
93
- const updatedOrgInfo = await refreshOrgAuth(this.orgInfo.orgAlias);
94
- if (!updatedOrgInfo) {
99
+ const updatedOrgInfo = await this.refreshToken();
100
+ if (updatedOrgInfo === undefined) {
95
101
  throw new Error("Failed to refresh token");
96
102
  }
97
- this.orgInfo = updatedOrgInfo;
98
- if (this.orgInfo) {
103
+ if (this.options?.debug) {
104
+ console.log("[webapps-proxy] Token refreshed, retrying request");
105
+ }
106
+ // Update target URL with refreshed org info (instance URL may have changed)
107
+ targetUrl = `${updatedOrgInfo.instanceUrl}${url.pathname}${url.search}`;
108
+ // Retry with the same buffered body
109
+ response = await fetch(targetUrl, {
110
+ method: req.method,
111
+ headers: {
112
+ ...getFilteredHeaders(req.headers),
113
+ Cookie: `sid=${updatedOrgInfo.accessToken}`,
114
+ Accept: req.headers.accept ?? "application/json",
115
+ },
116
+ body: body,
117
+ });
118
+ }
119
+ await this.sendResponse(res, response);
120
+ }
121
+ catch (error) {
122
+ console.error("[webapps-proxy] Salesforce API request failed:", error);
123
+ res.writeHead(502, { "Content-Type": "application/json" });
124
+ res.end(JSON.stringify({
125
+ error: "GATEWAY_ERROR",
126
+ message: "Failed to forward request to Salesforce",
127
+ }));
128
+ }
129
+ }
130
+ async refreshToken() {
131
+ if (!this.orgInfo) {
132
+ return undefined;
133
+ }
134
+ // Use orgAlias if available, otherwise fall back to username
135
+ // This handles cases where orgInfo was created without an explicit alias
136
+ const refreshIdentifier = this.orgInfo.orgAlias || this.orgInfo.username;
137
+ if (!refreshIdentifier) {
138
+ throw new Error("Cannot refresh token: no org alias or username available");
139
+ }
140
+ const updatedOrgInfo = await refreshOrgAuth(refreshIdentifier);
141
+ if (!updatedOrgInfo) {
142
+ return undefined;
143
+ }
144
+ this.orgInfo = updatedOrgInfo;
145
+ // Notify plugin of token refresh so it can sync its orgInfo
146
+ if (this.options?.onTokenRefresh) {
147
+ this.options.onTokenRefresh(updatedOrgInfo);
148
+ }
149
+ return updatedOrgInfo;
150
+ }
151
+ async handleGraphQL(req, res) {
152
+ try {
153
+ if (!this.orgInfo) {
154
+ this.sendNoOrgError(res);
155
+ return;
156
+ }
157
+ const { rawInstanceUrl, apiVersion, accessToken } = this.orgInfo;
158
+ let targetUrl = `${rawInstanceUrl}/services/data/v${apiVersion}/graphql`;
159
+ if (this.options?.debug) {
160
+ console.log(`[webapps-proxy] Forwarding GraphQL to Salesforce: ${targetUrl}`);
161
+ }
162
+ // Buffer the request body before sending. This allows us to retry requests
163
+ // with the same body in case of authentication failures (401/403).
164
+ const body = await getBody(req);
165
+ const headers = {
166
+ "Content-Type": "application/json",
167
+ Accept: "application/json",
168
+ Authorization: `Bearer ${accessToken}`,
169
+ "X-Chatter-Entity-Encoding": "false",
170
+ };
171
+ let response = await fetch(targetUrl, {
172
+ method: "POST",
173
+ headers,
174
+ body: body,
175
+ });
176
+ if (response.status === 401 || response.status === 403) {
177
+ console.warn(`[webapps-proxy] Received ${response.status}, refreshing token...`);
178
+ const updatedOrgInfo = await this.refreshToken();
179
+ if (updatedOrgInfo !== undefined) {
99
180
  if (this.options?.debug) {
100
181
  console.log("[webapps-proxy] Token refreshed, retrying request");
101
182
  }
102
- // Update target URL with refreshed org info (instance URL may have changed)
103
- targetUrl = `${this.orgInfo.instanceUrl}${url.pathname}${url.search}`;
104
- // Retry with the same buffered body
183
+ const { rawInstanceUrl, apiVersion, accessToken } = updatedOrgInfo;
184
+ targetUrl = `${rawInstanceUrl}/services/data/v${apiVersion}/graphql`;
185
+ headers.Authorization = `Bearer ${accessToken}`;
105
186
  response = await fetch(targetUrl, {
106
- method: req.method,
107
- headers: {
108
- ...getFilteredHeaders(req.headers),
109
- Cookie: `sid=${this.orgInfo.accessToken}`,
110
- Accept: req.headers.accept ?? "application/json",
111
- },
187
+ method: "POST",
188
+ headers,
112
189
  body: body,
113
190
  });
114
191
  }
@@ -116,11 +193,11 @@ class WebAppProxyHandler {
116
193
  await this.sendResponse(res, response);
117
194
  }
118
195
  catch (error) {
119
- console.error("[webapps-proxy] Salesforce API request failed:", error);
196
+ console.error("[webapps-proxy] GraphQL request failed:", error);
120
197
  res.writeHead(502, { "Content-Type": "application/json" });
121
198
  res.end(JSON.stringify({
122
199
  error: "GATEWAY_ERROR",
123
- message: "Failed to forward request to Salesforce",
200
+ message: "Failed to forward GraphQL request to Salesforce",
124
201
  }));
125
202
  }
126
203
  }
@@ -1,6 +1,6 @@
1
1
  import type { RedirectRule, RewriteRule } from "../app/index.js";
2
2
  export interface RouteMatch {
3
- type: "rewrite" | "redirect" | "api";
3
+ type: "rewrite" | "redirect" | "api" | "gql";
4
4
  target?: string;
5
5
  statusCode?: number;
6
6
  params?: Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/proxy/routing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AASD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,WAAW,EAAE,EACxB,SAAS,CAAC,EAAE,YAAY,EAAE,GACxB,UAAU,GAAG,IAAI,CA2DnB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAMpF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GACzC,MAAM,CAiBR"}
1
+ {"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/proxy/routing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AASD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,WAAW,EAAE,EACxB,SAAS,CAAC,EAAE,YAAY,EAAE,GACxB,UAAU,GAAG,IAAI,CA+DnB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAMpF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,GACzC,MAAM,CAiBR"}
@@ -19,6 +19,9 @@ export function matchRoute(pathname, basePath, rewrites, redirects) {
19
19
  pathname.startsWith(`${basePath || ""}/lwr/apex/v`)) {
20
20
  return { type: "api" };
21
21
  }
22
+ if (pathname.startsWith(`${basePath || ""}/gql/endpoint`)) {
23
+ return { type: "gql" };
24
+ }
22
25
  if (redirects) {
23
26
  for (const redirect of redirects) {
24
27
  const normalizedRoute = normalizeRoute(redirect.route);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-experimental",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "07bc96134fbeeaaaecf9ab6aec0fd50c35ad9fe3"
52
+ "gitHead": "71c692b2785b9c7d9ebf6638753ec8a527d979be"
53
53
  }