@salesforce/lds-runtime-aura 1.443.0 → 1.445.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.
@@ -1,11 +1,34 @@
1
1
  /**
2
2
  * Helpers for reaching the Aura framework from the LDS Aura runtime.
3
3
  *
4
- * `window.$A` is only present when the runtime is hosted inside LEX; in tests
5
- * and non-Aura runtimes it is absent. Centralizing the guarded access keeps the
6
- * `$A` lookup in one place instead of duplicating the `environmentHasAura`
7
- * check across modules.
4
+ * `window.$A` is only present when the runtime is hosted inside Aura (LEX or
5
+ * an Aura site); in tests and non-Aura runtimes it is absent. `getAura()`
6
+ * centralizes the guarded lookup so the `$A` access lives in one place instead
7
+ * of being duplicated across modules.
8
8
  */
9
+ import { dispatchGlobalEvent as auraDispatchGlobalEvent } from 'aura';
10
+ /**
11
+ * The subset of the Aura framework global (`window.$A`) that LDS reaches for.
12
+ * Members are optional/loosely typed because availability depends on the
13
+ * host's Aura version and the runtime context.
14
+ */
15
+ interface Aura {
16
+ clientService?: AuraClientService;
17
+ get?: (expression: string) => unknown;
18
+ }
19
+ /**
20
+ * Returns the Aura framework global (`window.$A`) when running inside Aura
21
+ * (LEX or an Aura site), or `undefined` in tests and non-Aura runtimes.
22
+ * Centralizes the guarded `$A` lookup so callers reach for it once and read
23
+ * intent instead of repeating `typeof window` / `$A` guards.
24
+ */
25
+ export declare function getAura(): Aura | undefined;
26
+ /**
27
+ * Fires an Aura application-level event (e.g. `aura:invalidSession`). Thin
28
+ * pass-through to the `aura` framework module so callers depend on this util
29
+ * rather than importing `aura` directly.
30
+ */
31
+ export declare function dispatchGlobalEvent(...args: Parameters<typeof auraDispatchGlobalEvent>): void;
9
32
  /**
10
33
  * The subset of the Aura client service LDS reaches for. Methods are optional
11
34
  * because availability depends on the host's Aura version and server gates.
@@ -19,3 +42,16 @@ export interface AuraClientService {
19
42
  * `undefined` otherwise. Defensive: never throws.
20
43
  */
21
44
  export declare function getAuraClientService(): AuraClientService | undefined;
45
+ /**
46
+ * Returns `true` when the Aura runtime is hosted inside an Aura/Experience
47
+ * site (Experience Builder / `communityApp`) rather than LEX (one.app).
48
+ * `$A.get('$Site')` is present and truthy on Aura sites and absent/falsy in
49
+ * LEX. A stable per-page signal, so it is safe to evaluate once at module
50
+ * load. Defensive: never throws.
51
+ *
52
+ * Used to keep the OneStore GraphQL adapter — and the HTTP UIAPI fetch path —
53
+ * on the Aura transport for sites, because the HTTP transport's CSRF handling
54
+ * does not work in the Aura Sites runtime (W-23092947).
55
+ */
56
+ export declare function isAuraSite(): boolean;
57
+ export {};
@@ -1,5 +1,8 @@
1
+ import { type JwtResolver } from '@conduit-client/jwt-manager';
1
2
  import { type FetchServiceDescriptor } from '@conduit-client/service-fetch-network/v1';
3
+ import { type ExtraInfo } from '../network-sfap';
2
4
  import { type LoggerService } from '@conduit-client/utils';
5
+ export declare function buildDispatchingSfapJwtResolver(legacyResolver: JwtResolver<ExtraInfo>, parameterizedResolver: JwtResolver<ExtraInfo>): JwtResolver<ExtraInfo>;
3
6
  export declare function prefetchSfapJwt(): Promise<undefined>;
4
7
  export declare function buildJwtAuthorizedSfapFetchServiceDescriptor(logger: LoggerService): FetchServiceDescriptor;
5
8
  /**
@@ -2,6 +2,7 @@ import type { FetchResponse, ResourceRequest, ResourceRequestContext } from '@lu
2
2
  import type { JwtResolver } from '@conduit-client/jwt-manager';
3
3
  export declare const SFAPController = "SalesforceApiPlatformController";
4
4
  export declare const SFAPJwtMethod = "getSFAPLightningJwtService";
5
+ export declare const SFAPJwtPostMethod = "postSFAPLightningJwtService";
5
6
  export type ExtraInfo = {
6
7
  baseUri: string;
7
8
  };
@@ -0,0 +1,34 @@
1
+ import type { JwtMintParams, JwtResolver } from '@conduit-client/jwt-manager';
2
+ import { type ParameterizedSfapExtraInfo } from './sfap-jwt-mint-params';
3
+ /**
4
+ * Parameterized SFAP JWT resolver that mints over **Aura transport** instead of a
5
+ * direct HTTP `fetch`.
6
+ *
7
+ * It dispatches the SFAP Lightning JWT Service's parameterized POST via its
8
+ * auto-generated Aura controller method
9
+ * `SalesforceApiPlatformController.postSFAPLightningJwtService` (generated by
10
+ * `@ConnectSignature(..., generateAuraMethod = true)` on the Connect resource).
11
+ * The mint inputs ride as the single `requestBody` named param, in the same
12
+ * `{ scopes, dynamicParameters: { items } }` shape the HTTP resolver POSTs — built
13
+ * by the shared {@link buildRequestBody}, so the two transports stay in lockstep.
14
+ *
15
+ * Why Aura (not the HTTP resolver): the mint endpoint is a same-origin core
16
+ * resource, and routing it over Aura keeps session/CSRF handling inside the Aura
17
+ * stack rather than issuing a credentialed cross-cutting `fetch` from the client.
18
+ * This mirrors the legacy parameterless `platformSfapJwtResolver` in
19
+ * `network-sfap.ts`, which already mints over Aura via the `getSFAPLightningJwtService`
20
+ * generated method — this is the parameterized sibling of that call.
21
+ *
22
+ * A `JwtResolver` is invoked directly by `JwtManager` (not through Luvio's
23
+ * `appRouter`/`ResourceRequest` pipeline), so the correct mechanism is a direct
24
+ * named-controller `dispatchAuraAction`, not the `auraNetworkAdapter`/connect-route
25
+ * table. The SFAP JWT endpoint is not registered as a connect-over-Aura route, and
26
+ * a resolver has no `ResourceRequest` for the router to look up.
27
+ */
28
+ export declare class ParameterizedSfapJwtAuraResolver implements JwtResolver<ParameterizedSfapExtraInfo> {
29
+ getJwt(params?: JwtMintParams): Promise<{
30
+ jwt: string;
31
+ extraInfo: ParameterizedSfapExtraInfo;
32
+ }>;
33
+ }
34
+ export declare function buildParameterizedSfapJwtAuraResolver(): ParameterizedSfapJwtAuraResolver;
@@ -0,0 +1,50 @@
1
+ import type { FetchParameters, RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
2
+ import { type JwtRequestModifier } from '@conduit-client/service-fetch-network/v1';
3
+ import type { JwtManager } from '@conduit-client/jwt-manager';
4
+ import type { ExtraInfo } from '../network-sfap';
5
+ /**
6
+ * The context-seed key under which a custom command forwards its JWT mint
7
+ * parameters. The framework's `buildServiceDescriptor` merges the request init's
8
+ * `__contextSeed` onto the per-request interceptor context, so this interceptor
9
+ * reads the params off `context[JWT_MINT_PARAMS_SEED_KEY]`.
10
+ *
11
+ * This is a cross-team contract: the custom command writes this key, this
12
+ * interceptor reads it. It is intentionally an opaque key — OneStore does not
13
+ * define it and never inspects the param shape; the typed shape lives in the
14
+ * resolver.
15
+ */
16
+ export declare const JWT_MINT_PARAMS_SEED_KEY = "jwtMintParams";
17
+ /**
18
+ * Returns `true` if the fetch arguments already carry an `Authorization` header,
19
+ * across the three shapes the framework's `setHeader` handles: a `Request`
20
+ * resource's own headers, an `options.headers` `Headers` instance, or a plain
21
+ * record. The descriptor's guarded legacy interceptor uses this to skip when the
22
+ * parameterized interceptor has already authorized the request — avoiding a second
23
+ * mint and the throw `setHeaderAuthorization` raises on an existing header.
24
+ */
25
+ export declare function hasAuthorizationHeader([resource, options]: FetchParameters): boolean;
26
+ /**
27
+ * Builds the request interceptor that bridges the per-request context seed to the
28
+ * dispatching SFAP JwtManager for the **parameterized** mint path.
29
+ *
30
+ * For a parameterized SFAP command, the context carries `jwtMintParams`. This
31
+ * interceptor reads them, calls `jwtManager.getJwt(params)` (which the dispatching
32
+ * resolver routes to the parameterized resolver), attaches the `Authorization`
33
+ * header, and rewrites the request URL via the minted `baseUri`. The presence of
34
+ * that `Authorization` header is the signal the descriptor's guarded legacy
35
+ * interceptor uses to skip — so the legacy path does not mint a second time.
36
+ *
37
+ * For a legacy parameterless command the context carries no `jwtMintParams`, so
38
+ * this interceptor **early-returns on its first line** and the request flows
39
+ * unchanged to the legacy `buildJwtRequestHeaderInterceptor` — guaranteeing zero
40
+ * behavior change for non-opted-in adapters.
41
+ *
42
+ * Lives in `lds-lightning-platform` (not OneStore) beside the existing SFAP/CSRF
43
+ * interceptors, per the JWT-parameterization ADR §5: OneStore provides only the
44
+ * generic interceptor mechanism and the opaque context-seed channel; the service-
45
+ * specific bridge is a runtime-layer concern.
46
+ *
47
+ * @param jwtManager - the dispatching SFAP JwtManager
48
+ * @param jwtRequestModifier - applies the minted `extraInfo.baseUri` to the request URL
49
+ */
50
+ export declare function buildJwtParameterizationInterceptor(jwtManager: JwtManager<unknown, ExtraInfo>, jwtRequestModifier?: JwtRequestModifier): RequestInterceptor;
@@ -1,5 +1,5 @@
1
1
  import type { LoggerService } from '@conduit-client/utils';
2
2
  import type { ResponseInterceptor } from '@conduit-client/service-fetch-network/v1';
3
3
  import type { ResponseInterceptor as LuvioResponseInterceptor } from '@salesforce/lds-network-fetch';
4
- export declare function buildLexRuntimeAuthExpirationRedirectResponseInterceptor(logger: LoggerService): ResponseInterceptor;
5
- export declare function buildLexRuntimeLuvioAuthExpirationRedirectResponseInterceptor(): LuvioResponseInterceptor;
4
+ export declare function buildLexRuntimeSessionExpirationResponseInterceptor(logger: LoggerService): ResponseInterceptor;
5
+ export declare function buildLexRuntimeLuvioSessionExpirationResponseInterceptor(): LuvioResponseInterceptor;
@@ -0,0 +1,80 @@
1
+ import type { JwtMintParams } from '@conduit-client/jwt-manager';
2
+ /**
3
+ * JSON-primitive value a dynamic mint parameter may take.
4
+ *
5
+ * Mirrors the SFAP Lightning JWT Service's own `validateValue`
6
+ * (`SFAPLightningJwtServiceResource.java`), which accepts native `Boolean`,
7
+ * `Number`, or `String` and lets the minted claim's type follow the JSON type.
8
+ * The resolver therefore forwards these primitives verbatim — it must NOT
9
+ * stringify booleans/numbers, because the `data_cloud_user_claims` handler gates
10
+ * on native `Boolean.TRUE.equals(...)` and silently drops a stringified `"true"`.
11
+ */
12
+ export type SfapDynamicParamValue = string | boolean | number;
13
+ /**
14
+ * Typed shape of the params the SFAP Lightning JWT Service understands.
15
+ * Lives in the resolver layer because OneStore is param-shape-agnostic; it
16
+ * sees only an opaque `JwtMintParams` bag and stable-JSON-stringifies it for
17
+ * cache keying.
18
+ */
19
+ export type SfapJwtMintParams = {
20
+ scopes?: string[];
21
+ dynamicParams?: Record<string, SfapDynamicParamValue>;
22
+ };
23
+ /**
24
+ * The `extraInfo` the SFAP JWT resolver returns alongside the minted token: the
25
+ * per-tenant base URI the downstream SFAP API request is rewritten to.
26
+ */
27
+ export type ParameterizedSfapExtraInfo = {
28
+ baseUri: string;
29
+ };
30
+ type DynamicParameterItem = {
31
+ name: string;
32
+ value: SfapDynamicParamValue;
33
+ };
34
+ /**
35
+ * The SFAP Lightning JWT Service mint request body. Sent as the `requestBody`
36
+ * named param of the `postSFAPLightningJwtService` Aura controller method.
37
+ * Matches the server's `SFAPLightningJwtServiceInputRepresentation`: `scopes` is
38
+ * a single space-delimited string; `dynamicParameters` is `{ items: [{ name, value }] }`.
39
+ */
40
+ export type SfapJwtRequestBody = {
41
+ scopes?: string;
42
+ dynamicParameters?: {
43
+ items: DynamicParameterItem[];
44
+ };
45
+ };
46
+ /**
47
+ * Normalize SFAP-shaped params into the opaque `JwtMintParams` bag that callers
48
+ * hand to `JwtManager.getJwt(params)`. Scopes are sorted because they are
49
+ * semantically a set — without this, `['a', 'b']` and `['b', 'a']` would cache
50
+ * as separate entries (OneStore treats arrays as ordered under stable-JSON
51
+ * serialization; see ADR "JWT Parameterization" §2).
52
+ *
53
+ * MANDATORY CONSUMER ENTRY POINT. Every consumer that mints a parameterized
54
+ * SFAP JWT MUST assemble its params through this function before calling the
55
+ * manager. The cache key is derived by `JwtManager` from the caller's params
56
+ * (`cacheKeyFor(params)`) *before* the resolver runs — so the resolver cannot
57
+ * normalize after the fact. Set-stable caching therefore depends on the caller
58
+ * routing params through here. Do NOT sort inside the resolver: that would only
59
+ * reorder the wire body, not the cache key, and mutating the caller's params
60
+ * mid-call would desync the in-flight-dedup key from the stored-token key.
61
+ */
62
+ export declare function buildSfapJwtMintParams(params: SfapJwtMintParams): JwtMintParams;
63
+ export type SfapParamsResult = {
64
+ params: SfapJwtMintParams;
65
+ } | {
66
+ error: string;
67
+ };
68
+ /**
69
+ * Validate and narrow an opaque `JwtMintParams` bag to the SFAP-shaped subset the
70
+ * resolver forwards. Returns `{ error }` (surfaced as a resolver rejection) for a
71
+ * malformed bag rather than throwing.
72
+ */
73
+ export declare function coerceToSfapParams(params: JwtMintParams): SfapParamsResult;
74
+ /**
75
+ * Build the SFAP mint request body from the coerced params: `scopes` joined into a
76
+ * single space-delimited string, `dynamicParams` mapped to `dynamicParameters.items`.
77
+ * Empty scopes / dynamic params are omitted.
78
+ */
79
+ export declare function buildRequestBody(params: SfapJwtMintParams): SfapJwtRequestBody;
80
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lds-runtime-aura",
3
- "version": "1.443.0",
3
+ "version": "1.445.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "LDS engine for Aura runtime.",
6
6
  "main": "dist/ldsEngineCreator.js",
@@ -34,61 +34,61 @@
34
34
  "release:corejar": "yarn build && ../core-build/scripts/core.js --name=lds-runtime-aura"
35
35
  },
36
36
  "devDependencies": {
37
- "@conduit-client/service-provisioner": "3.22.0",
38
- "@conduit-client/tools-core": "3.22.0",
39
- "@salesforce/lds-adapters-apex": "^1.443.0",
40
- "@salesforce/lds-adapters-uiapi": "^1.443.0",
41
- "@salesforce/lds-ads-bridge": "^1.443.0",
42
- "@salesforce/lds-aura-storage": "^1.443.0",
43
- "@salesforce/lds-bindings": "^1.443.0",
44
- "@salesforce/lds-instrumentation": "^1.443.0",
45
- "@salesforce/lds-network-adapter": "^1.443.0",
46
- "@salesforce/lds-network-aura": "^1.443.0",
47
- "@salesforce/lds-network-fetch": "^1.443.0",
37
+ "@conduit-client/service-provisioner": "3.24.0",
38
+ "@conduit-client/tools-core": "3.24.0",
39
+ "@salesforce/lds-adapters-apex": "^1.445.0",
40
+ "@salesforce/lds-adapters-uiapi": "^1.445.0",
41
+ "@salesforce/lds-ads-bridge": "^1.445.0",
42
+ "@salesforce/lds-aura-storage": "^1.445.0",
43
+ "@salesforce/lds-bindings": "^1.445.0",
44
+ "@salesforce/lds-instrumentation": "^1.445.0",
45
+ "@salesforce/lds-network-adapter": "^1.445.0",
46
+ "@salesforce/lds-network-aura": "^1.445.0",
47
+ "@salesforce/lds-network-fetch": "^1.445.0",
48
48
  "jwt-encode": "1.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@conduit-client/command-aura-graphql-normalized-cache-control": "3.22.0",
52
- "@conduit-client/command-aura-network": "3.22.0",
53
- "@conduit-client/command-aura-normalized-cache-control": "3.22.0",
54
- "@conduit-client/command-aura-resource-cache-control": "3.22.0",
55
- "@conduit-client/command-fetch-network": "3.22.0",
56
- "@conduit-client/command-http-graphql-normalized-cache-control": "3.22.0",
57
- "@conduit-client/command-http-normalized-cache-control": "3.22.0",
58
- "@conduit-client/command-ndjson": "3.22.0",
59
- "@conduit-client/command-network": "3.22.0",
60
- "@conduit-client/command-sse": "3.22.0",
61
- "@conduit-client/command-streaming": "3.22.0",
62
- "@conduit-client/service-aura-network": "3.22.0",
63
- "@conduit-client/service-bindings-imperative": "3.22.0",
64
- "@conduit-client/service-bindings-lwc": "3.22.0",
65
- "@conduit-client/service-cache": "3.22.0",
66
- "@conduit-client/service-cache-control": "3.22.0",
67
- "@conduit-client/service-cache-inclusion-policy": "3.22.0",
68
- "@conduit-client/service-config": "3.22.0",
69
- "@conduit-client/service-feature-flags": "3.22.0",
70
- "@conduit-client/service-fetch-network": "3.22.0",
71
- "@conduit-client/service-instrument-command": "3.22.0",
72
- "@conduit-client/service-pubsub": "3.22.0",
73
- "@conduit-client/service-renewable-resource-manager": "3.22.0",
74
- "@conduit-client/service-store": "3.22.0",
75
- "@conduit-client/utils": "3.22.0",
76
- "@luvio/network-adapter-composable": "0.160.5",
77
- "@luvio/network-adapter-fetch": "0.160.5",
51
+ "@conduit-client/command-aura-graphql-normalized-cache-control": "3.24.0",
52
+ "@conduit-client/command-aura-network": "3.24.0",
53
+ "@conduit-client/command-aura-normalized-cache-control": "3.24.0",
54
+ "@conduit-client/command-fetch-network": "3.24.0",
55
+ "@conduit-client/command-http-graphql-normalized-cache-control": "3.24.0",
56
+ "@conduit-client/command-http-normalized-cache-control": "3.24.0",
57
+ "@conduit-client/command-ndjson": "3.24.0",
58
+ "@conduit-client/command-network": "3.24.0",
59
+ "@conduit-client/command-sse": "3.24.0",
60
+ "@conduit-client/command-streaming": "3.24.0",
61
+ "@conduit-client/jwt-manager": "3.24.0",
62
+ "@conduit-client/service-aura-network": "3.24.0",
63
+ "@conduit-client/service-bindings-imperative": "3.24.0",
64
+ "@conduit-client/service-bindings-lwc": "3.24.0",
65
+ "@conduit-client/service-cache": "3.24.0",
66
+ "@conduit-client/service-cache-control": "3.24.0",
67
+ "@conduit-client/service-cache-inclusion-policy": "3.24.0",
68
+ "@conduit-client/service-config": "3.24.0",
69
+ "@conduit-client/service-feature-flags": "3.24.0",
70
+ "@conduit-client/service-fetch-network": "3.24.0",
71
+ "@conduit-client/service-instrument-command": "3.24.0",
72
+ "@conduit-client/service-pubsub": "3.24.0",
73
+ "@conduit-client/service-renewable-resource-manager": "3.24.0",
74
+ "@conduit-client/service-store": "3.24.0",
75
+ "@conduit-client/utils": "3.24.0",
76
+ "@luvio/network-adapter-composable": "0.161.0",
77
+ "@luvio/network-adapter-fetch": "0.161.0",
78
78
  "@lwc/state": "^0.29.0",
79
- "@salesforce/lds-adapters-onestore-graphql": "^1.443.0",
79
+ "@salesforce/lds-adapters-onestore-graphql": "^1.445.0",
80
80
  "@salesforce/lds-adapters-uiapi-lex": "^1.415.0",
81
- "@salesforce/lds-durable-storage": "^1.443.0",
82
- "@salesforce/lds-luvio-service": "^1.443.0",
83
- "@salesforce/lds-luvio-uiapi-records-service": "^1.443.0"
81
+ "@salesforce/lds-durable-storage": "^1.445.0",
82
+ "@salesforce/lds-luvio-service": "^1.445.0",
83
+ "@salesforce/lds-luvio-uiapi-records-service": "^1.445.0"
84
84
  },
85
85
  "luvioBundlesize": [
86
86
  {
87
87
  "path": "./dist/ldsEngineCreator.js",
88
88
  "maxSize": {
89
- "none": "390 kB",
89
+ "none": "410 kB",
90
90
  "min": "190 kB",
91
- "compressed": "65.5 kB"
91
+ "compressed": "71 kB"
92
92
  }
93
93
  }
94
94
  ],