@salesforce/vite-plugin-lwc-ui-bundle 9.17.0 → 9.18.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.
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/lds/adapters.d.ts +76 -0
- package/dist/providers/lds/adapters.d.ts.map +1 -0
- package/dist/providers/lds/common-mcp-tooling.d.ts +37 -0
- package/dist/providers/lds/common-mcp-tooling.d.ts.map +1 -0
- package/dist/providers/lds/index.d.ts +5 -142
- package/dist/providers/lds/index.d.ts.map +1 -1
- package/dist/providers/lds/index.js +52 -52
- package/dist/providers/lds/index.js.map +1 -1
- package/dist/providers/lds/runtime.js.map +1 -1
- package/dist/providers/lds/state-managers.d.ts +71 -0
- package/dist/providers/lds/state-managers.d.ts.map +1 -0
- package/dist/providers/lds/util.d.ts +12 -0
- package/dist/providers/lds/util.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -12,5 +12,5 @@ export { primitiveUtils } from './primitive-utils';
|
|
|
12
12
|
export { lds } from './lds/index';
|
|
13
13
|
export { labelsGraphql } from './labels-graphql/index';
|
|
14
14
|
export type { LabelsGraphqlOptions } from './labels-graphql/index';
|
|
15
|
-
export type {
|
|
15
|
+
export type { LdsGraphqlImperativeReadAdapterConfig, LdsGraphqlImperativeReadInvokerShape, LdsGraphqlMutationAdapterConfig, LdsGraphqlWireAdapterConfig, LdsImperativeMutationAdapterConfig, LdsImperativeReadAdapterConfig, LdsImperativeReadInvokerShape, LdsRegistry, LdsRegistryEntry, LdsWireAdapterConfig, } from './lds/index';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EACX,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,YAAY,EACX,qCAAqC,EACrC,oCAAoC,EACpC,+BAA+B,EAC/B,2BAA2B,EAC3B,kCAAkC,EAClC,8BAA8B,EAC9B,6BAA6B,EAC7B,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LdsRegistryEntry, LdsRegistryEntryBase, LdsSchemaValidatedEntry } from './common-mcp-tooling';
|
|
2
|
+
import { ReadInvokerShape } from './types';
|
|
3
|
+
export interface LdsWireAdapterConfig extends LdsSchemaValidatedEntry {
|
|
4
|
+
type: "wire";
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Imperative **mutation** adapter. Always an async
|
|
8
|
+
* `(config) => Promise<Data>` that throws on validation or tool error —
|
|
9
|
+
* matching OneStore's `DefaultImperativeBindingsService`, the only service a
|
|
10
|
+
* mutation ever uses on platform. Mutations do not carry an `invokerShape`:
|
|
11
|
+
* `subscribe`/`refresh` make no sense on write, and allowing them here
|
|
12
|
+
* would drift off-platform from on-platform semantics.
|
|
13
|
+
*/
|
|
14
|
+
export interface LdsImperativeMutationAdapterConfig extends LdsSchemaValidatedEntry {
|
|
15
|
+
type: "imperative-mutation";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Public alias for the read-shape union defined in `runtime.ts`. Re-exported
|
|
19
|
+
* from this module so consumers don't have to import from the runtime entry
|
|
20
|
+
* point, while keeping the union pinned to one source of truth.
|
|
21
|
+
*
|
|
22
|
+
* Off-platform there is no store, so `subscribe` is a deliberate no-op
|
|
23
|
+
* (callback never fires, returned unsubscribe is idempotent) and `refresh`
|
|
24
|
+
* re-executes the underlying MCP tool. This preserves the OneStore API
|
|
25
|
+
* surface for code ported verbatim.
|
|
26
|
+
*/
|
|
27
|
+
export type LdsImperativeReadInvokerShape = ReadInvokerShape;
|
|
28
|
+
export interface LdsImperativeReadAdapterConfig extends LdsSchemaValidatedEntry {
|
|
29
|
+
type: "imperative-read";
|
|
30
|
+
invokerShape: LdsImperativeReadInvokerShape;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* GraphQL wire adapter. Emits `{ data, errors, refresh }` (distinct from the
|
|
34
|
+
* base wire `{ data, error }`). No `configJsonSchema` — the adapter passes
|
|
35
|
+
* `{ query, variables }` through to the configured MCP tool.
|
|
36
|
+
*/
|
|
37
|
+
export interface LdsGraphqlWireAdapterConfig extends LdsRegistryEntryBase {
|
|
38
|
+
type: "graphql-wire";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Imperative GraphQL mutation — `(config) => Promise<{ data, errors }>`.
|
|
42
|
+
* Errors are routed in-band to the `errors[]` envelope rather than thrown,
|
|
43
|
+
* matching on-platform `toGraphQLResponseFromFailure`.
|
|
44
|
+
*/
|
|
45
|
+
export interface LdsGraphqlMutationAdapterConfig extends LdsRegistryEntryBase {
|
|
46
|
+
type: "graphql-mutation";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Read-shape discriminator for imperative GraphQL adapters. Mirrors the
|
|
50
|
+
* `imperative-read` `invokerShape` field so the two families share a pattern:
|
|
51
|
+
* one `type` discriminator + a shape field that selects the return surface.
|
|
52
|
+
*
|
|
53
|
+
* - `query` — `Promise<{ data, errors, subscribe }>` (on-platform
|
|
54
|
+
* `GraphQLImperativeBindingsService` without `exposeRefresh`).
|
|
55
|
+
* - `query-refreshable` — `Promise<{ data, errors, subscribe, refresh }>`
|
|
56
|
+
* (same service with `exposeRefresh: true`).
|
|
57
|
+
* - `legacy` — `{ invoke(config, context, callback),
|
|
58
|
+
* subscribe(config, context, callback): Unsubscribe }`, the older callback
|
|
59
|
+
* surface served by `GraphQLLegacyImperativeBindingsService`.
|
|
60
|
+
*
|
|
61
|
+
* `subscribe` is a deliberate no-op off-platform (no reactive store).
|
|
62
|
+
*/
|
|
63
|
+
export type LdsGraphqlImperativeReadInvokerShape = "query" | "query-refreshable" | "legacy";
|
|
64
|
+
/**
|
|
65
|
+
* Imperative GraphQL read adapter. The `invokerShape` picks the return
|
|
66
|
+
* surface — see {@link LdsGraphqlImperativeReadInvokerShape}. Errors are
|
|
67
|
+
* routed in-band to `errors[]` (for `query`/`query-refreshable`) or into the
|
|
68
|
+
* callback payload (for `legacy`); no shape throws on tool errors.
|
|
69
|
+
*/
|
|
70
|
+
export interface LdsGraphqlImperativeReadAdapterConfig extends LdsRegistryEntryBase {
|
|
71
|
+
type: "graphql-imperative-read";
|
|
72
|
+
invokerShape: LdsGraphqlImperativeReadInvokerShape;
|
|
73
|
+
}
|
|
74
|
+
/** True when any entry in a module's registry map is a `graphql-*` type. */
|
|
75
|
+
export declare function isGraphqlSpecifier(moduleAdapters: Record<string, LdsRegistryEntry>): boolean;
|
|
76
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../../src/providers/lds/adapters.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACX,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;IACpE,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kCAAmC,SAAQ,uBAAuB;IAClF,IAAI,EAAE,qBAAqB,CAAC;CAC5B;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,6BAA6B,GAAG,gBAAgB,CAAC;AAE7D,MAAM,WAAW,8BAA+B,SAAQ,uBAAuB;IAC9E,IAAI,EAAE,iBAAiB,CAAC;IACxB,YAAY,EAAE,6BAA6B,CAAC;CAC5C;AAID;;;;GAIG;AACH,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;IACxE,IAAI,EAAE,cAAc,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,+BAAgC,SAAQ,oBAAoB;IAC5E,IAAI,EAAE,kBAAkB,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,oCAAoC,GAAG,OAAO,GAAG,mBAAmB,GAAG,QAAQ,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,WAAW,qCAAsC,SAAQ,oBAAoB;IAClF,IAAI,EAAE,yBAAyB,CAAC;IAChC,YAAY,EAAE,oCAAoC,CAAC;CACnD;AAID,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,OAAO,CAO5F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { JSONSchema } from '@conduit-client/jsonschema-validate';
|
|
2
|
+
import { LdsGraphqlImperativeReadAdapterConfig, LdsGraphqlMutationAdapterConfig, LdsGraphqlWireAdapterConfig, LdsImperativeMutationAdapterConfig, LdsImperativeReadAdapterConfig, LdsWireAdapterConfig } from './adapters';
|
|
3
|
+
import { LdsStateManagerConfig } from './state-managers';
|
|
4
|
+
/**
|
|
5
|
+
* MCP dispatch descriptor. Nested under `mcp` on every registry entry so
|
|
6
|
+
* additional MCP-specific fields (auth, transport, retry policy) can join
|
|
7
|
+
* later without reshaping every consumer entry.
|
|
8
|
+
*/
|
|
9
|
+
export interface LdsMcpDispatch {
|
|
10
|
+
toolName: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Base shape every LDS registry entry extends. Holds the dispatch surface in
|
|
14
|
+
* one place so new backings (e.g. `http`) can land as sibling optional fields
|
|
15
|
+
* without forking each entry interface. Dual registration is supported at
|
|
16
|
+
* the type level — runtime execution still targets a single backing per call.
|
|
17
|
+
*/
|
|
18
|
+
export interface LdsRegistryEntryBase {
|
|
19
|
+
mcp?: LdsMcpDispatch;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* LDS registry entries whose input is validated against a JSON Schema at
|
|
23
|
+
* invoke time — wire, imperative-mutation, imperative-read. GraphQL variants
|
|
24
|
+
* skip this base because they pass `{ query, variables }` through to the
|
|
25
|
+
* configured MCP tool with no schema check.
|
|
26
|
+
*/
|
|
27
|
+
export interface LdsSchemaValidatedEntry extends LdsRegistryEntryBase {
|
|
28
|
+
configJsonSchema: JSONSchema;
|
|
29
|
+
}
|
|
30
|
+
export type LdsRegistryEntry = LdsWireAdapterConfig | LdsImperativeMutationAdapterConfig | LdsImperativeReadAdapterConfig | LdsGraphqlWireAdapterConfig | LdsGraphqlMutationAdapterConfig | LdsGraphqlImperativeReadAdapterConfig | LdsStateManagerConfig;
|
|
31
|
+
export type LdsRegistry = Record<string, Record<string, LdsRegistryEntry>>;
|
|
32
|
+
export declare const RECORD_TOOL = "getRecordMcpTool";
|
|
33
|
+
export declare const RECORD_SCHEMA: JSONSchema;
|
|
34
|
+
export declare const OBJECT_INFO_TOOL = "getObjectInfoMcpTool";
|
|
35
|
+
export declare const OBJECT_INFO_SCHEMA: JSONSchema;
|
|
36
|
+
export declare const GRAPHQL_TOOL = "graphqlQuery";
|
|
37
|
+
//# sourceMappingURL=common-mcp-tooling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-mcp-tooling.d.ts","sourceRoot":"","sources":["../../../src/providers/lds/common-mcp-tooling.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,EACX,qCAAqC,EACrC,+BAA+B,EAC/B,2BAA2B,EAC3B,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAI9D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACpE,gBAAgB,EAAE,UAAU,CAAC;CAC7B;AASD,MAAM,MAAM,gBAAgB,GACzB,oBAAoB,GACpB,kCAAkC,GAClC,8BAA8B,GAC9B,2BAA2B,GAC3B,+BAA+B,GAC/B,qCAAqC,GACrC,qBAAqB,CAAC;AAEzB,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAQ3E,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,aAAa,EAAE,UAmC3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,kBAAkB,EAAE,UAOhC,CAAC;AAEF,eAAO,MAAM,YAAY,iBAAiB,CAAC"}
|
|
@@ -1,146 +1,9 @@
|
|
|
1
|
-
import { JSONSchema } from '@conduit-client/jsonschema-validate';
|
|
2
1
|
import { Plugin } from 'vite';
|
|
3
|
-
import {
|
|
2
|
+
import { LdsRegistry } from './common-mcp-tooling';
|
|
4
3
|
import { PassthroughRule } from '../../types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* later without reshaping every consumer entry.
|
|
9
|
-
*/
|
|
10
|
-
export interface LdsAdapterMcpDispatch {
|
|
11
|
-
toolName: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Base shape every LDS adapter config extends. Holds the dispatch surface in
|
|
15
|
-
* one place so new backings (e.g. `http`) can land as sibling optional fields
|
|
16
|
-
* without forking each adapter interface. Dual registration is supported at
|
|
17
|
-
* the type level — runtime execution still targets a single backing per call.
|
|
18
|
-
*/
|
|
19
|
-
export interface LdsAdapterConfigBase {
|
|
20
|
-
mcp?: LdsAdapterMcpDispatch;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* LDS adapter configs whose input is validated against a JSON Schema at
|
|
24
|
-
* invoke time — wire, imperative-mutation, imperative-read. GraphQL variants
|
|
25
|
-
* skip this base because they pass `{ query, variables }` through to the
|
|
26
|
-
* configured MCP tool with no schema check.
|
|
27
|
-
*/
|
|
28
|
-
export interface LdsSchemaValidatedAdapterConfig extends LdsAdapterConfigBase {
|
|
29
|
-
configJsonSchema: JSONSchema;
|
|
30
|
-
}
|
|
31
|
-
export interface LdsWireAdapterConfig extends LdsSchemaValidatedAdapterConfig {
|
|
32
|
-
type: "wire";
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Imperative **mutation** adapter. Always an async
|
|
36
|
-
* `(config) => Promise<Data>` that throws on validation or tool error —
|
|
37
|
-
* matching OneStore's `DefaultImperativeBindingsService`, the only service a
|
|
38
|
-
* mutation ever uses on platform. Mutations do not carry an `invokerShape`:
|
|
39
|
-
* `subscribe`/`refresh` make no sense on write, and allowing them here
|
|
40
|
-
* would drift off-platform from on-platform semantics.
|
|
41
|
-
*/
|
|
42
|
-
export interface LdsImperativeMutationAdapterConfig extends LdsSchemaValidatedAdapterConfig {
|
|
43
|
-
type: "imperative-mutation";
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Public alias for the read-shape union defined in `runtime.ts`. Re-exported
|
|
47
|
-
* from this module so consumers don't have to import from the runtime entry
|
|
48
|
-
* point, while keeping the union pinned to one source of truth.
|
|
49
|
-
*
|
|
50
|
-
* Off-platform there is no store, so `subscribe` is a deliberate no-op
|
|
51
|
-
* (callback never fires, returned unsubscribe is idempotent) and `refresh`
|
|
52
|
-
* re-executes the underlying MCP tool. This preserves the OneStore API
|
|
53
|
-
* surface for code ported verbatim.
|
|
54
|
-
*/
|
|
55
|
-
export type LdsImperativeReadInvokerShape = ReadInvokerShape;
|
|
56
|
-
export interface LdsImperativeReadAdapterConfig extends LdsSchemaValidatedAdapterConfig {
|
|
57
|
-
type: "imperative-read";
|
|
58
|
-
invokerShape: LdsImperativeReadInvokerShape;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* GraphQL wire adapter. Emits `{ data, errors, refresh }` (distinct from the
|
|
62
|
-
* base wire `{ data, error }`). No `configJsonSchema` — the adapter passes
|
|
63
|
-
* `{ query, variables }` through to the configured MCP tool.
|
|
64
|
-
*/
|
|
65
|
-
export interface LdsGraphqlWireAdapterConfig extends LdsAdapterConfigBase {
|
|
66
|
-
type: "graphql-wire";
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Imperative GraphQL mutation — `(config) => Promise<{ data, errors }>`.
|
|
70
|
-
* Errors are routed in-band to the `errors[]` envelope rather than thrown,
|
|
71
|
-
* matching on-platform `toGraphQLResponseFromFailure`.
|
|
72
|
-
*/
|
|
73
|
-
export interface LdsGraphqlMutationAdapterConfig extends LdsAdapterConfigBase {
|
|
74
|
-
type: "graphql-mutation";
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Read-shape discriminator for imperative GraphQL adapters. Mirrors the
|
|
78
|
-
* `imperative-read` `invokerShape` field so the two families share a pattern:
|
|
79
|
-
* one `type` discriminator + a shape field that selects the return surface.
|
|
80
|
-
*
|
|
81
|
-
* - `query` — `Promise<{ data, errors, subscribe }>` (on-platform
|
|
82
|
-
* `GraphQLImperativeBindingsService` without `exposeRefresh`).
|
|
83
|
-
* - `query-refreshable` — `Promise<{ data, errors, subscribe, refresh }>`
|
|
84
|
-
* (same service with `exposeRefresh: true`).
|
|
85
|
-
* - `legacy` — `{ invoke(config, context, callback),
|
|
86
|
-
* subscribe(config, context, callback): Unsubscribe }`, the older callback
|
|
87
|
-
* surface served by `GraphQLLegacyImperativeBindingsService`.
|
|
88
|
-
*
|
|
89
|
-
* `subscribe` is a deliberate no-op off-platform (no reactive store).
|
|
90
|
-
*/
|
|
91
|
-
export type LdsGraphqlImperativeReadInvokerShape = "query" | "query-refreshable" | "legacy";
|
|
92
|
-
/**
|
|
93
|
-
* Imperative GraphQL read adapter. The `invokerShape` picks the return
|
|
94
|
-
* surface — see {@link LdsGraphqlImperativeReadInvokerShape}. Errors are
|
|
95
|
-
* routed in-band to `errors[]` (for `query`/`query-refreshable`) or into the
|
|
96
|
-
* callback payload (for `legacy`); no shape throws on tool errors.
|
|
97
|
-
*/
|
|
98
|
-
export interface LdsGraphqlImperativeReadAdapterConfig extends LdsAdapterConfigBase {
|
|
99
|
-
type: "graphql-imperative-read";
|
|
100
|
-
invokerShape: LdsGraphqlImperativeReadInvokerShape;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* State-manager adapter config. The lds plugin's load hook emits a
|
|
104
|
-
* factory-composition body for each state-manager registry entry — see
|
|
105
|
-
* `buildStateManagerCompositionBody`. Two emit shapes:
|
|
106
|
-
*
|
|
107
|
-
* - **UIAPI** (`lightning/stateManagerRecord`, `…ObjectInfo`) — synthesizes
|
|
108
|
-
* a legacy-shape imperative-read adapter inline via `createReadAdapter`
|
|
109
|
-
* and feeds it into the upstream per-state-manager factory
|
|
110
|
-
* (`createSmRecord` / `createSmObjectInfo`) re-exported from
|
|
111
|
-
* `@salesforce/state-managers-uiapi/factory`.
|
|
112
|
-
*
|
|
113
|
-
* - **GraphQL** (`lightning/stateManagerGraphQL`) — calls the upstream
|
|
114
|
-
* per-state-manager factory `createSmGraphQL` re-exported from
|
|
115
|
-
* `@salesforce/lds-adapters-onestore-graphql/factory` with an MCP-backed
|
|
116
|
-
* `getCommand` synthesized via `createGraphqlStateManagerCommand` (a
|
|
117
|
-
* `runtime.ts` helper). The required / optional config keys
|
|
118
|
-
* (`['query']`, `['variables', 'operationName']`) live in the upstream
|
|
119
|
-
* factory — a fixed contract of `lightning/stateManagerGraphQL` — so the
|
|
120
|
-
* load-hook emit doesn't pass them. Mirrors the UIAPI shape (one
|
|
121
|
-
* factory call, adapter argument only).
|
|
122
|
-
*
|
|
123
|
-
* Per-state-manager metadata (definedBy, requiredKeys, optionalKeys,
|
|
124
|
-
* predicate) lives in the upstream factory — not here. See spec §8.4 / §10.4.
|
|
125
|
-
*
|
|
126
|
-
* `configJsonSchema` is optional: UIAPI state managers supply it (the
|
|
127
|
-
* load hook embeds it in the synthesized imperative-read adapter), but
|
|
128
|
-
* the graphql state-manager path doesn't read it (off-core graphql
|
|
129
|
-
* forgoes the on-core `assertIsValid` / `resolveAndValidateGraphQLConfig`
|
|
130
|
-
* validation layer; spec §4 Non-goal 9 — malformed configs surface as
|
|
131
|
-
* MCP tool errors at execute time instead).
|
|
132
|
-
*/
|
|
133
|
-
export interface LdsStateManagerAdapterConfig extends LdsAdapterConfigBase {
|
|
134
|
-
type: "state-manager";
|
|
135
|
-
/** Upstream factory specifier — e.g. '@salesforce/state-managers-uiapi/factory'. */
|
|
136
|
-
factoryModule: string;
|
|
137
|
-
/** Named export within `factoryModule` — e.g. 'createSmRecord' (UIAPI), 'createSmGraphQL' (graphql). */
|
|
138
|
-
factoryName: string;
|
|
139
|
-
/** JSON Schema for the config object — required for UIAPI state managers, omitted for graphql. */
|
|
140
|
-
configJsonSchema?: JSONSchema;
|
|
141
|
-
}
|
|
142
|
-
export type LdsAdapterConfig = LdsWireAdapterConfig | LdsImperativeMutationAdapterConfig | LdsImperativeReadAdapterConfig | LdsGraphqlWireAdapterConfig | LdsGraphqlMutationAdapterConfig | LdsGraphqlImperativeReadAdapterConfig | LdsStateManagerAdapterConfig;
|
|
143
|
-
export type LdsAdapterRegistry = Record<string, Record<string, LdsAdapterConfig>>;
|
|
4
|
+
export type { LdsMcpDispatch, LdsRegistry, LdsRegistryEntry, LdsRegistryEntryBase, LdsSchemaValidatedEntry, } from './common-mcp-tooling';
|
|
5
|
+
export type { LdsGraphqlImperativeReadAdapterConfig, LdsGraphqlImperativeReadInvokerShape, LdsGraphqlMutationAdapterConfig, LdsGraphqlWireAdapterConfig, LdsImperativeMutationAdapterConfig, LdsImperativeReadAdapterConfig, LdsImperativeReadInvokerShape, LdsWireAdapterConfig, } from './adapters';
|
|
6
|
+
export type { LdsStateManagerConfig } from './state-managers';
|
|
144
7
|
/**
|
|
145
8
|
* LDS provider — rewrites registered `lightning/*` imports (e.g.
|
|
146
9
|
* `lightning/uiRecordApi`) to MCP-tool-backed virtual modules. Unregistered
|
|
@@ -164,7 +27,7 @@ export type LdsAdapterRegistry = Record<string, Record<string, LdsAdapterConfig>
|
|
|
164
27
|
* Only specifiers present in the `adapters` registry are intercepted; imports from
|
|
165
28
|
* unregistered specifiers pass through unchanged.
|
|
166
29
|
*/
|
|
167
|
-
export declare function lds(overrides?:
|
|
30
|
+
export declare function lds(overrides?: LdsRegistry): Plugin & {
|
|
168
31
|
passthroughRules: PassthroughRule[];
|
|
169
32
|
};
|
|
170
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/lds/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/lds/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,EAEN,KAAK,WAAW,EAMhB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,YAAY,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,qCAAqC,EACrC,oCAAoC,EACpC,+BAA+B,EAC/B,2BAA2B,EAC3B,kCAAkC,EAClC,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,GACpB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAkL9D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,GAAG,CAAC,SAAS,GAAE,WAAgB,GAAG,MAAM,GAAG;IAAE,gBAAgB,EAAE,eAAe,EAAE,CAAA;CAAE,CAiKjG"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
+
import { init, parse } from "es-module-lexer";
|
|
2
|
+
import MagicString from "magic-string";
|
|
1
3
|
import { readFileSync } from "node:fs";
|
|
2
4
|
import { join, dirname } from "node:path";
|
|
3
5
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const adapterBaseSource = stripTopLevelExports(
|
|
9
|
-
readFileSync(join(dirname(fileURLToPath(import.meta.url)), "runtime.js"), "utf-8")
|
|
10
|
-
);
|
|
11
|
-
function stripTopLevelExports(source) {
|
|
12
|
-
return source.replace(/^export\s+(?=(?:async\s+)?function\s)/gm, "").replace(/^export\s*\{[^}]*};?\s*$/gm, "");
|
|
6
|
+
function isGraphqlSpecifier(moduleAdapters) {
|
|
7
|
+
return Object.values(moduleAdapters).some(
|
|
8
|
+
(entry) => entry.type === "graphql-wire" || entry.type === "graphql-mutation" || entry.type === "graphql-imperative-read"
|
|
9
|
+
);
|
|
13
10
|
}
|
|
14
11
|
const RECORD_TOOL = "getRecordMcpTool";
|
|
15
12
|
const RECORD_SCHEMA = {
|
|
@@ -58,7 +55,50 @@ const OBJECT_INFO_SCHEMA = {
|
|
|
58
55
|
additionalProperties: false
|
|
59
56
|
};
|
|
60
57
|
const GRAPHQL_TOOL = "graphqlQuery";
|
|
61
|
-
|
|
58
|
+
function isStateManagerSpecifier(moduleAdapters) {
|
|
59
|
+
return Object.values(moduleAdapters).some((entry) => entry.type === "state-manager");
|
|
60
|
+
}
|
|
61
|
+
function isGraphqlStateManagerSpecifier(specifier) {
|
|
62
|
+
return specifier === "lightning/stateManagerGraphQL";
|
|
63
|
+
}
|
|
64
|
+
function buildStateManagerCompositionBody(name, cfg, specifier) {
|
|
65
|
+
if (isGraphqlStateManagerSpecifier(specifier)) {
|
|
66
|
+
const graphqlCfg = { mcp: { toolName: cfg.mcp?.toolName } };
|
|
67
|
+
return [
|
|
68
|
+
`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,
|
|
69
|
+
`const __getCommand_${name} = createGraphqlStateManagerCommand(${JSON.stringify(name)}, ${JSON.stringify(graphqlCfg)});`,
|
|
70
|
+
`export default ${cfg.factoryName}(__getCommand_${name});`
|
|
71
|
+
].join("\n");
|
|
72
|
+
}
|
|
73
|
+
const synthesizedCfg = {
|
|
74
|
+
type: "imperative-read",
|
|
75
|
+
invokerShape: "legacy",
|
|
76
|
+
mcp: { toolName: cfg.mcp?.toolName },
|
|
77
|
+
configJsonSchema: cfg.configJsonSchema
|
|
78
|
+
};
|
|
79
|
+
return [
|
|
80
|
+
`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,
|
|
81
|
+
`const __cfg_${name} = ${JSON.stringify(synthesizedCfg)};`,
|
|
82
|
+
`const __imperativeAdapter_${name} = createReadAdapter(${JSON.stringify(name)}, __cfg_${name});`,
|
|
83
|
+
`export default ${cfg.factoryName}(__imperativeAdapter_${name});`
|
|
84
|
+
].join("\n");
|
|
85
|
+
}
|
|
86
|
+
function parseImportSpecifiers(bracesContent) {
|
|
87
|
+
return bracesContent.split(",").map((s) => s.trim()).filter(Boolean).map((entry) => {
|
|
88
|
+
const asIdx = entry.indexOf(" as ");
|
|
89
|
+
const original = asIdx !== -1 ? entry.slice(0, asIdx).trim() : entry.trim();
|
|
90
|
+
return { original, full: entry };
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function stripTopLevelExports(source) {
|
|
94
|
+
return source.replace(/^export\s+(?=(?:async\s+)?function\s)/gm, "").replace(/^export\s*\{[^}]*};?\s*$/gm, "");
|
|
95
|
+
}
|
|
96
|
+
const adapterBaseSource = stripTopLevelExports(
|
|
97
|
+
readFileSync(join(dirname(fileURLToPath(import.meta.url)), "runtime.js"), "utf-8")
|
|
98
|
+
);
|
|
99
|
+
const ADAPTER_PREFIX = "sf-lds-adapter:";
|
|
100
|
+
const ADAPTER_ID_PREFIX = "\0" + ADAPTER_PREFIX;
|
|
101
|
+
const DEFAULT_REGISTRY = {
|
|
62
102
|
"lightning/uiRecordApi": {
|
|
63
103
|
getRecord: {
|
|
64
104
|
type: "wire",
|
|
@@ -182,39 +222,6 @@ const DEFAULT_ADAPTERS = {
|
|
|
182
222
|
}
|
|
183
223
|
}
|
|
184
224
|
};
|
|
185
|
-
function isGraphqlSpecifier(moduleAdapters) {
|
|
186
|
-
return Object.values(moduleAdapters).some(
|
|
187
|
-
(entry) => entry.type === "graphql-wire" || entry.type === "graphql-mutation" || entry.type === "graphql-imperative-read"
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
function isStateManagerSpecifier(moduleAdapters) {
|
|
191
|
-
return Object.values(moduleAdapters).some((entry) => entry.type === "state-manager");
|
|
192
|
-
}
|
|
193
|
-
function isGraphqlStateManagerSpecifier(specifier) {
|
|
194
|
-
return specifier === "lightning/stateManagerGraphQL";
|
|
195
|
-
}
|
|
196
|
-
function buildStateManagerCompositionBody(name, cfg, specifier) {
|
|
197
|
-
if (isGraphqlStateManagerSpecifier(specifier)) {
|
|
198
|
-
const graphqlCfg = { mcp: { toolName: cfg.mcp?.toolName } };
|
|
199
|
-
return [
|
|
200
|
-
`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,
|
|
201
|
-
`const __getCommand_${name} = createGraphqlStateManagerCommand(${JSON.stringify(name)}, ${JSON.stringify(graphqlCfg)});`,
|
|
202
|
-
`export default ${cfg.factoryName}(__getCommand_${name});`
|
|
203
|
-
].join("\n");
|
|
204
|
-
}
|
|
205
|
-
const synthesizedCfg = {
|
|
206
|
-
type: "imperative-read",
|
|
207
|
-
invokerShape: "legacy",
|
|
208
|
-
mcp: { toolName: cfg.mcp?.toolName },
|
|
209
|
-
configJsonSchema: cfg.configJsonSchema
|
|
210
|
-
};
|
|
211
|
-
return [
|
|
212
|
-
`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,
|
|
213
|
-
`const __cfg_${name} = ${JSON.stringify(synthesizedCfg)};`,
|
|
214
|
-
`const __imperativeAdapter_${name} = createReadAdapter(${JSON.stringify(name)}, __cfg_${name});`,
|
|
215
|
-
`export default ${cfg.factoryName}(__imperativeAdapter_${name});`
|
|
216
|
-
].join("\n");
|
|
217
|
-
}
|
|
218
225
|
function factoryFor(type) {
|
|
219
226
|
switch (type) {
|
|
220
227
|
case "wire":
|
|
@@ -233,17 +240,10 @@ function factoryFor(type) {
|
|
|
233
240
|
return "createStateManagerComposition";
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
|
-
function parseImportSpecifiers(bracesContent) {
|
|
237
|
-
return bracesContent.split(",").map((s) => s.trim()).filter(Boolean).map((entry) => {
|
|
238
|
-
const asIdx = entry.indexOf(" as ");
|
|
239
|
-
const original = asIdx !== -1 ? entry.slice(0, asIdx).trim() : entry.trim();
|
|
240
|
-
return { original, full: entry };
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
243
|
function mergeWithDefaults(overrides) {
|
|
244
|
-
const merged = { ...
|
|
244
|
+
const merged = { ...DEFAULT_REGISTRY };
|
|
245
245
|
for (const [specifier, entries] of Object.entries(overrides)) {
|
|
246
|
-
merged[specifier] = { ...
|
|
246
|
+
merged[specifier] = { ...DEFAULT_REGISTRY[specifier] ?? {}, ...entries };
|
|
247
247
|
}
|
|
248
248
|
return merged;
|
|
249
249
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/providers/lds/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { JSONSchema } from \"@conduit-client/jsonschema-validate\";\nimport { init, parse } from \"es-module-lexer\";\nimport MagicString from \"magic-string\";\nimport type { Plugin } from \"vite\";\nimport type { ReadInvokerShape } from \"./types\";\nimport type { PassthroughRule } from \"../../types\";\n\n// prefix to write into transformed source code\nconst ADAPTER_PREFIX = \"sf-lds-adapter:\";\n// prefix used to ID the adapter when loading the virtual module\nconst ADAPTER_ID_PREFIX = \"\\0\" + ADAPTER_PREFIX;\n\n// the source of the adapter base module — reused across virtual modules so\n// each generated specifier emits the factories once.\n//\n// Top-level exports from the runtime module are stripped so every factory and\n// `gql` becomes a private binding inside the virtual module. The load hook\n// then controls exactly which names are exported per specifier: adapter\n// entries from the registry, plus `gql` for graphql specifiers. Without this,\n// the built `runtime.js` (trailing `export { …, gql, createWireAdapter, … }`)\n// and the source `runtime.ts` (per-declaration `export function gql …`) both\n// produce a `SyntaxError: Duplicate export of 'gql'` when the load hook also\n// appends `export { gql };`. They also leak the factory names as exports on\n// every LDS virtual module, which isn't a public contract we want.\nconst adapterBaseSource = stripTopLevelExports(\n\treadFileSync(join(dirname(fileURLToPath(import.meta.url)), \"runtime.js\"), \"utf-8\"),\n);\n\n/**\n * Removes top-level ES-module `export` keywords from the embedded runtime\n * source so its declarations survive as private bindings inside the virtual\n * module. Handles two shapes:\n * 1. Per-declaration: `export function foo …` / `export async function foo`\n * → the `export ` prefix is dropped.\n * 2. Trailing re-export clause: `export { foo, bar };` → deleted entirely.\n * Inner occurrences (inside function bodies, comments, strings) are not\n * affected because the source is a flat module with exports only at column 0.\n */\nfunction stripTopLevelExports(source: string): string {\n\treturn source\n\t\t.replace(/^export\\s+(?=(?:async\\s+)?function\\s)/gm, \"\")\n\t\t.replace(/^export\\s*\\{[^}]*};?\\s*$/gm, \"\");\n}\n\n/**\n * MCP dispatch descriptor. Nested under `mcp` on every adapter config so\n * additional MCP-specific fields (auth, transport, retry policy) can join\n * later without reshaping every consumer entry.\n */\nexport interface LdsAdapterMcpDispatch {\n\ttoolName: string;\n}\n\n/**\n * Base shape every LDS adapter config extends. Holds the dispatch surface in\n * one place so new backings (e.g. `http`) can land as sibling optional fields\n * without forking each adapter interface. Dual registration is supported at\n * the type level — runtime execution still targets a single backing per call.\n */\nexport interface LdsAdapterConfigBase {\n\tmcp?: LdsAdapterMcpDispatch;\n}\n\n/**\n * LDS adapter configs whose input is validated against a JSON Schema at\n * invoke time — wire, imperative-mutation, imperative-read. GraphQL variants\n * skip this base because they pass `{ query, variables }` through to the\n * configured MCP tool with no schema check.\n */\nexport interface LdsSchemaValidatedAdapterConfig extends LdsAdapterConfigBase {\n\tconfigJsonSchema: JSONSchema;\n}\n\nexport interface LdsWireAdapterConfig extends LdsSchemaValidatedAdapterConfig {\n\ttype: \"wire\";\n}\n\n/**\n * Imperative **mutation** adapter. Always an async\n * `(config) => Promise<Data>` that throws on validation or tool error —\n * matching OneStore's `DefaultImperativeBindingsService`, the only service a\n * mutation ever uses on platform. Mutations do not carry an `invokerShape`:\n * `subscribe`/`refresh` make no sense on write, and allowing them here\n * would drift off-platform from on-platform semantics.\n */\nexport interface LdsImperativeMutationAdapterConfig extends LdsSchemaValidatedAdapterConfig {\n\ttype: \"imperative-mutation\";\n}\n\n/**\n * Public alias for the read-shape union defined in `runtime.ts`. Re-exported\n * from this module so consumers don't have to import from the runtime entry\n * point, while keeping the union pinned to one source of truth.\n *\n * Off-platform there is no store, so `subscribe` is a deliberate no-op\n * (callback never fires, returned unsubscribe is idempotent) and `refresh`\n * re-executes the underlying MCP tool. This preserves the OneStore API\n * surface for code ported verbatim.\n */\nexport type LdsImperativeReadInvokerShape = ReadInvokerShape;\n\nexport interface LdsImperativeReadAdapterConfig extends LdsSchemaValidatedAdapterConfig {\n\ttype: \"imperative-read\";\n\tinvokerShape: LdsImperativeReadInvokerShape;\n}\n\n/**\n * GraphQL wire adapter. Emits `{ data, errors, refresh }` (distinct from the\n * base wire `{ data, error }`). No `configJsonSchema` — the adapter passes\n * `{ query, variables }` through to the configured MCP tool.\n */\nexport interface LdsGraphqlWireAdapterConfig extends LdsAdapterConfigBase {\n\ttype: \"graphql-wire\";\n}\n\n/**\n * Imperative GraphQL mutation — `(config) => Promise<{ data, errors }>`.\n * Errors are routed in-band to the `errors[]` envelope rather than thrown,\n * matching on-platform `toGraphQLResponseFromFailure`.\n */\nexport interface LdsGraphqlMutationAdapterConfig extends LdsAdapterConfigBase {\n\ttype: \"graphql-mutation\";\n}\n\n/**\n * Read-shape discriminator for imperative GraphQL adapters. Mirrors the\n * `imperative-read` `invokerShape` field so the two families share a pattern:\n * one `type` discriminator + a shape field that selects the return surface.\n *\n * - `query` — `Promise<{ data, errors, subscribe }>` (on-platform\n * `GraphQLImperativeBindingsService` without `exposeRefresh`).\n * - `query-refreshable` — `Promise<{ data, errors, subscribe, refresh }>`\n * (same service with `exposeRefresh: true`).\n * - `legacy` — `{ invoke(config, context, callback),\n * subscribe(config, context, callback): Unsubscribe }`, the older callback\n * surface served by `GraphQLLegacyImperativeBindingsService`.\n *\n * `subscribe` is a deliberate no-op off-platform (no reactive store).\n */\nexport type LdsGraphqlImperativeReadInvokerShape = \"query\" | \"query-refreshable\" | \"legacy\";\n\n/**\n * Imperative GraphQL read adapter. The `invokerShape` picks the return\n * surface — see {@link LdsGraphqlImperativeReadInvokerShape}. Errors are\n * routed in-band to `errors[]` (for `query`/`query-refreshable`) or into the\n * callback payload (for `legacy`); no shape throws on tool errors.\n */\nexport interface LdsGraphqlImperativeReadAdapterConfig extends LdsAdapterConfigBase {\n\ttype: \"graphql-imperative-read\";\n\tinvokerShape: LdsGraphqlImperativeReadInvokerShape;\n}\n\n/**\n * State-manager adapter config. The lds plugin's load hook emits a\n * factory-composition body for each state-manager registry entry — see\n * `buildStateManagerCompositionBody`. Two emit shapes:\n *\n * - **UIAPI** (`lightning/stateManagerRecord`, `…ObjectInfo`) — synthesizes\n * a legacy-shape imperative-read adapter inline via `createReadAdapter`\n * and feeds it into the upstream per-state-manager factory\n * (`createSmRecord` / `createSmObjectInfo`) re-exported from\n * `@salesforce/state-managers-uiapi/factory`.\n *\n * - **GraphQL** (`lightning/stateManagerGraphQL`) — calls the upstream\n * per-state-manager factory `createSmGraphQL` re-exported from\n * `@salesforce/lds-adapters-onestore-graphql/factory` with an MCP-backed\n * `getCommand` synthesized via `createGraphqlStateManagerCommand` (a\n * `runtime.ts` helper). The required / optional config keys\n * (`['query']`, `['variables', 'operationName']`) live in the upstream\n * factory — a fixed contract of `lightning/stateManagerGraphQL` — so the\n * load-hook emit doesn't pass them. Mirrors the UIAPI shape (one\n * factory call, adapter argument only).\n *\n * Per-state-manager metadata (definedBy, requiredKeys, optionalKeys,\n * predicate) lives in the upstream factory — not here. See spec §8.4 / §10.4.\n *\n * `configJsonSchema` is optional: UIAPI state managers supply it (the\n * load hook embeds it in the synthesized imperative-read adapter), but\n * the graphql state-manager path doesn't read it (off-core graphql\n * forgoes the on-core `assertIsValid` / `resolveAndValidateGraphQLConfig`\n * validation layer; spec §4 Non-goal 9 — malformed configs surface as\n * MCP tool errors at execute time instead).\n */\nexport interface LdsStateManagerAdapterConfig extends LdsAdapterConfigBase {\n\ttype: \"state-manager\";\n\t/** Upstream factory specifier — e.g. '@salesforce/state-managers-uiapi/factory'. */\n\tfactoryModule: string;\n\t/** Named export within `factoryModule` — e.g. 'createSmRecord' (UIAPI), 'createSmGraphQL' (graphql). */\n\tfactoryName: string;\n\t/** JSON Schema for the config object — required for UIAPI state managers, omitted for graphql. */\n\tconfigJsonSchema?: JSONSchema;\n}\n\nexport type LdsAdapterConfig =\n\t| LdsWireAdapterConfig\n\t| LdsImperativeMutationAdapterConfig\n\t| LdsImperativeReadAdapterConfig\n\t| LdsGraphqlWireAdapterConfig\n\t| LdsGraphqlMutationAdapterConfig\n\t| LdsGraphqlImperativeReadAdapterConfig\n\t| LdsStateManagerAdapterConfig;\n\nexport type LdsAdapterRegistry = Record<string, Record<string, LdsAdapterConfig>>;\n\n// ─── Per-resource shared constants ────────────────────────────────────────────\n// Tool names and JSON Schemas extracted from the registry so wire / imperative\n// siblings backed by the same MCP tool reference one source of truth. Mutation\n// adapters keep their own dedicated tools and schemas because their dispatch\n// surface is distinct (different tool name, different validated input).\n\nconst RECORD_TOOL = \"getRecordMcpTool\";\nconst RECORD_SCHEMA: JSONSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\trecordId: { type: \"string\" },\n\t\tlayoutTypes: {\n\t\t\tanyOf: [{ type: \"array\", items: { type: \"string\" } }, { type: \"null\" }],\n\t\t},\n\t\tfields: {\n\t\t\tanyOf: [{ type: \"array\", items: { type: \"string\" } }, { type: \"null\" }],\n\t\t},\n\t},\n\trequired: [\"recordId\"],\n\tadditionalProperties: false,\n\tanyOf: [\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tfields: { type: \"array\", items: { type: \"string\" }, minItems: 1 },\n\t\t\t},\n\t\t\trequired: [\"fields\"],\n\t\t\tadditionalProperties: true,\n\t\t},\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tlayoutTypes: {\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: { type: \"string\" },\n\t\t\t\t\tminItems: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"layoutTypes\"],\n\t\t\tadditionalProperties: true,\n\t\t},\n\t],\n};\n\nconst OBJECT_INFO_TOOL = \"getObjectInfoMcpTool\";\nconst OBJECT_INFO_SCHEMA: JSONSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tobjectApiName: { type: \"string\" },\n\t},\n\trequired: [\"objectApiName\"],\n\tadditionalProperties: false,\n};\n\nconst GRAPHQL_TOOL = \"graphqlQuery\";\n\n/**\n * Default adapter registry.\n * Maps LDS module specifiers to MCP tool-backed implementations. Entries can be\n * wire adapters (`type: 'wire'`), imperative mutations (`type: 'imperative-mutation'`),\n * or imperative reads (`type: 'imperative-read'` + `invokerShape`).\n * Add entries here to support additional lightning/* exports.\n */\nconst DEFAULT_ADAPTERS: LdsAdapterRegistry = {\n\t\"lightning/uiRecordApi\": {\n\t\tgetRecord: {\n\t\t\ttype: \"wire\",\n\t\t\tmcp: { toolName: RECORD_TOOL },\n\t\t\tconfigJsonSchema: RECORD_SCHEMA,\n\t\t},\n\t\tcreateRecord: {\n\t\t\ttype: \"imperative-mutation\",\n\t\t\tmcp: { toolName: \"createRecordMcpTool\" },\n\t\t\tconfigJsonSchema: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tapiName: { type: \"string\" },\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\trequired: [],\n\t\t\t\t\t\tadditionalProperties: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trequired: [\"apiName\", \"fields\"],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t},\n\t\tupdateRecord: {\n\t\t\ttype: \"imperative-mutation\",\n\t\t\tmcp: { toolName: \"updateRecordMcpTool\" },\n\t\t\tconfigJsonSchema: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\trecordId: { type: \"string\" },\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\trequired: [],\n\t\t\t\t\t\tadditionalProperties: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trequired: [\"recordId\", \"fields\"],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t},\n\t},\n\t\"lightning/uiObjectInfoApi\": {\n\t\t// On-platform this is a `{ invoke, subscribe }` callback surface\n\t\t// emitting `{ data, error }`. The legacy invoker shape preserves that\n\t\t// contract verbatim, so ported consumers keep their call sites.\n\t\tgetObjectInfo_imperative: {\n\t\t\ttype: \"imperative-read\",\n\t\t\tinvokerShape: \"legacy\",\n\t\t\tmcp: { toolName: OBJECT_INFO_TOOL },\n\t\t\tconfigJsonSchema: OBJECT_INFO_SCHEMA,\n\t\t},\n\t},\n\t// `lightning/graphql` — on-platform exports `gql`, the `graphql` wire\n\t// adapter, and `executeMutation`. Only `graphql` and `executeMutation`\n\t// are registry entries; `gql` rides along automatically for any specifier\n\t// that has at least one graphql-typed entry (emitted by the load hook).\n\t\"lightning/graphql\": {\n\t\tgraphql: { type: \"graphql-wire\", mcp: { toolName: GRAPHQL_TOOL } },\n\t\texecuteMutation: { type: \"graphql-mutation\", mcp: { toolName: GRAPHQL_TOOL } },\n\t},\n\t// `lightning/stateManagerGraphQL` — externalized graphql state manager.\n\t// The load hook imports `createSmGraphQL` from the upstream\n\t// `@salesforce/lds-adapters-onestore-graphql/factory` barrel — a thin\n\t// per-state-manager wrapper around `createStateManager` that bakes in\n\t// the required (`['query']`) / optional (`['variables', 'operationName']`)\n\t// config keys, mirroring `createSmRecord` / `createSmObjectInfo`. The\n\t// same factory wraps the call site on-core via `bindings/bindings.ts`,\n\t// so off-core composition fidelity is preserved without on-core service\n\t// plumbing leaking into this side.\n\t//\n\t// Per §10.3 the registry only ever has `default` as its key — the\n\t// `createSmGraphQL` return value is itself the `default` export of\n\t// the virtual module.\n\t//\n\t// `configJsonSchema` is omitted: off-core graphql forgoes the on-core\n\t// `assertIsValid` / `resolveAndValidateGraphQLConfig` validation layer\n\t// (§4 Non-goal 9), and the load-hook graphql path doesn't read the\n\t// field anyway — malformed configs surface as MCP tool errors at\n\t// execute time instead.\n\t\"lightning/stateManagerGraphQL\": {\n\t\tdefault: {\n\t\t\ttype: \"state-manager\",\n\t\t\tfactoryModule: \"@salesforce/lds-adapters-onestore-graphql/factory\",\n\t\t\tfactoryName: \"createSmGraphQL\",\n\t\t\tmcp: { toolName: GRAPHQL_TOOL },\n\t\t},\n\t},\n\t// State-manager specifier for ObjectInfo (spec §8.3 / §10.3). The load hook\n\t// synthesizes a legacy-shape imperative-read adapter inline from\n\t// (mcp.toolName, configJsonSchema) and feeds it to the upstream\n\t// `createSmObjectInfo` factory. Reuses the shared `OBJECT_INFO_TOOL` /\n\t// `OBJECT_INFO_SCHEMA` so this entry stays in lock-step with the\n\t// `lightning/uiObjectInfoApi.getObjectInfo_imperative` entry above —\n\t// both back the same UIAPI ObjectInfo MCP tool.\n\t\"lightning/stateManagerObjectInfo\": {\n\t\tdefault: {\n\t\t\ttype: \"state-manager\",\n\t\t\tfactoryModule: \"@salesforce/state-managers-uiapi/factory\",\n\t\t\tfactoryName: \"createSmObjectInfo\",\n\t\t\tmcp: { toolName: OBJECT_INFO_TOOL },\n\t\t\tconfigJsonSchema: OBJECT_INFO_SCHEMA,\n\t\t},\n\t},\n\t// `lightning/stateManagerRecord` — UIAPI Record state-manager. Per spec\n\t// §10.3 the registry only ever has a single `default` key; the load hook\n\t// synthesizes a legacy-shape imperative-read adapter from\n\t// (mcp.toolName, configJsonSchema) and feeds it into the upstream\n\t// `createSmRecord` factory to produce the externalized state manager.\n\t// Reuses the shared `RECORD_TOOL` / `RECORD_SCHEMA` so the wire and\n\t// state-manager paths stay anchored to a single MCP-tool / config\n\t// contract.\n\t\"lightning/stateManagerRecord\": {\n\t\tdefault: {\n\t\t\ttype: \"state-manager\",\n\t\t\tfactoryModule: \"@salesforce/state-managers-uiapi/factory\",\n\t\t\tfactoryName: \"createSmRecord\",\n\t\t\tmcp: { toolName: RECORD_TOOL },\n\t\t\tconfigJsonSchema: RECORD_SCHEMA,\n\t\t},\n\t},\n};\n\n/** True when any entry in a module's adapter map is a `graphql-*` type. */\nfunction isGraphqlSpecifier(moduleAdapters: Record<string, LdsAdapterConfig>): boolean {\n\treturn Object.values(moduleAdapters).some(\n\t\t(entry) =>\n\t\t\tentry.type === \"graphql-wire\" ||\n\t\t\tentry.type === \"graphql-mutation\" ||\n\t\t\tentry.type === \"graphql-imperative-read\",\n\t);\n}\n\n/** True when any entry in a module's adapter map is a `state-manager` type. */\nfunction isStateManagerSpecifier(moduleAdapters: Record<string, LdsAdapterConfig>): boolean {\n\treturn Object.values(moduleAdapters).some((entry) => entry.type === \"state-manager\");\n}\n\n/**\n * True when a state-manager specifier resolves to the graphql state manager\n * (`lightning/stateManagerGraphQL`). Used by `buildStateManagerCompositionBody`\n * to pick which emit shape to use:\n *\n * - GraphQL — call upstream `createSmGraphQL` with an MCP-backed\n * `getCommand` from `createGraphqlStateManagerCommand`. Required/optional\n * key sets (`['query']` / `['variables', 'operationName']`) live in the\n * upstream factory; the load-hook emit doesn't pass them.\n * - UIAPI — synthesize a legacy-shape imperative-read adapter inline via\n * `createReadAdapter` and feed it into the per-state-manager wrapper\n * (`createSmRecord` / `createSmObjectInfo`).\n *\n * Selecting on the specifier (rather than the registry entry's `type`)\n * mirrors §8.4 of the spec and keeps the `LdsStateManagerAdapterConfig`\n * surface free of an inner discriminator — consumers add a state-manager\n * registry entry once and the plugin picks the right emit shape.\n */\nfunction isGraphqlStateManagerSpecifier(specifier: string): boolean {\n\treturn specifier === \"lightning/stateManagerGraphQL\";\n}\n\n/**\n * Builds the §8.4 factory-composition body for a single `state-manager`\n * registry entry. Two emit shapes, gated by `isGraphqlStateManagerSpecifier`:\n *\n * **UIAPI shape** — `lightning/stateManagerRecord`, `…ObjectInfo`:\n *\n * import { <factoryName> } from \"<factoryModule>\";\n * const __cfg_<name> = { type: 'imperative-read', invokerShape: 'legacy', mcp, configJsonSchema };\n * const __imperativeAdapter_<name> = createReadAdapter(<name>, __cfg_<name>);\n * export default <factoryName>(__imperativeAdapter_<name>);\n *\n * Synthesizes a legacy-shape imperative-read adapter inline (private binding\n * in scope via `adapterBaseSource`), then default-exports the upstream\n * per-state-manager wrapper (`createSmRecord` / `createSmObjectInfo`)\n * applied to it.\n *\n * **GraphQL shape** — `lightning/stateManagerGraphQL`:\n *\n * import { createSmGraphQL } from \"@salesforce/lds-adapters-onestore-graphql/factory\";\n * const __getCommand_<name> = createGraphqlStateManagerCommand(<name>, { mcp });\n * export default createSmGraphQL(__getCommand_<name>);\n *\n * Calls upstream `createSmGraphQL` (re-exported from\n * `bindings/graphql.factory.ts` — the same factory on-core composition\n * wraps internally) with an MCP-backed `getCommand` from\n * `createGraphqlStateManagerCommand` (a `runtime.ts` helper, in scope as a\n * private binding). Required / optional config keys are baked into the\n * upstream factory — they're a fixed contract of\n * `lightning/stateManagerGraphQL`, not a per-registry-entry parameter, so\n * the load-hook emit doesn't carry them. `configJsonSchema` is ignored on\n * this path (graphql off-core forgoes the on-core `assertIsValid` /\n * `resolveAndValidateGraphQLConfig` validation layer; spec §4 Non-goal 9).\n *\n * Only `default` is exported in either shape. The upstream `<name>_internal`\n * named export (used internally by `state-managers-uiapi` for\n * cross-state-manager wiring and tests) is deliberately not re-exported —\n * uplifted customer LWCs only consume the default. See spec §8.4 / §10.4.\n */\nfunction buildStateManagerCompositionBody(\n\tname: string,\n\tcfg: LdsStateManagerAdapterConfig,\n\tspecifier: string,\n): string {\n\tif (isGraphqlStateManagerSpecifier(specifier)) {\n\t\tconst graphqlCfg = { mcp: { toolName: cfg.mcp?.toolName } };\n\t\treturn [\n\t\t\t`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,\n\t\t\t`const __getCommand_${name} = createGraphqlStateManagerCommand(${JSON.stringify(name)}, ${JSON.stringify(graphqlCfg)});`,\n\t\t\t`export default ${cfg.factoryName}(__getCommand_${name});`,\n\t\t].join(\"\\n\");\n\t}\n\tconst synthesizedCfg = {\n\t\ttype: \"imperative-read\" as const,\n\t\tinvokerShape: \"legacy\" as const,\n\t\tmcp: { toolName: cfg.mcp?.toolName },\n\t\tconfigJsonSchema: cfg.configJsonSchema,\n\t};\n\treturn [\n\t\t`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,\n\t\t`const __cfg_${name} = ${JSON.stringify(synthesizedCfg)};`,\n\t\t`const __imperativeAdapter_${name} = createReadAdapter(${JSON.stringify(name)}, __cfg_${name});`,\n\t\t`export default ${cfg.factoryName}(__imperativeAdapter_${name});`,\n\t].join(\"\\n\");\n}\n\n/** Maps a config discriminator to the factory name emitted in the virtual module. */\nfunction factoryFor(type: LdsAdapterConfig[\"type\"]): string {\n\tswitch (type) {\n\t\tcase \"wire\":\n\t\t\treturn \"createWireAdapter\";\n\t\tcase \"imperative-mutation\":\n\t\t\treturn \"createMutationAdapter\";\n\t\tcase \"imperative-read\":\n\t\t\treturn \"createReadAdapter\";\n\t\tcase \"graphql-wire\":\n\t\t\treturn \"createGraphQLWireAdapter\";\n\t\tcase \"graphql-mutation\":\n\t\t\treturn \"createGraphQLMutationAdapter\";\n\t\tcase \"graphql-imperative-read\":\n\t\t\treturn \"createGraphQLImperativeReadAdapter\";\n\t\tcase \"state-manager\":\n\t\t\t// Load-hook directive name (consumed in W-05), not a runtime-import\n\t\t\t// factory: the load hook synthesizes an adapter inline and calls\n\t\t\t// the upstream factoryModule/factoryName to compose the state manager.\n\t\t\treturn \"createStateManagerComposition\";\n\t}\n}\n\nfunction parseImportSpecifiers(bracesContent: string): { original: string; full: string }[] {\n\treturn bracesContent\n\t\t.split(\",\")\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean)\n\t\t.map((entry) => {\n\t\t\tconst asIdx = entry.indexOf(\" as \");\n\t\t\tconst original = asIdx !== -1 ? entry.slice(0, asIdx).trim() : entry.trim();\n\t\t\treturn { original, full: entry };\n\t\t});\n}\n\n/**\n * Deep-merges user overrides onto the default registry: every specifier from\n * both sides is preserved, and per-specifier entries are merged so a consumer\n * can override `getRecord` without losing `createRecord`, or register a new\n * entry on `lightning/graphql` without losing `graphql` / `executeMutation`.\n * Pass an empty object to get just the defaults. To opt out of a default\n * entry, pass the same specifier with a different entry of the same key.\n */\nfunction mergeWithDefaults(overrides: LdsAdapterRegistry): LdsAdapterRegistry {\n\tconst merged: LdsAdapterRegistry = { ...DEFAULT_ADAPTERS };\n\tfor (const [specifier, entries] of Object.entries(overrides)) {\n\t\tmerged[specifier] = { ...(DEFAULT_ADAPTERS[specifier] ?? {}), ...entries };\n\t}\n\treturn merged;\n}\n\n/**\n * LDS provider — rewrites registered `lightning/*` imports (e.g.\n * `lightning/uiRecordApi`) to MCP-tool-backed virtual modules. Unregistered\n * exports pass through to the normal `lightning/*` resolution.\n *\n * Three Vite hooks do the work:\n *\n * - **`transform`** — parses each `.js` / `.ts` file with `es-module-lexer`,\n * finds named imports from registered specifiers, and rewrites them to pull\n * registered names from `sf-lds-adapter:<specifier>` while leaving\n * unregistered names pointing at the original specifier.\n *\n * - **`resolveId`** — maps `sf-lds-adapter:<specifier>` to a `\\0`-prefixed\n * virtual module ID, preventing Rollup from attempting a filesystem lookup.\n *\n * - **`load`** — generates the virtual module, emitting an MCP-backed\n * `createWireAdapter(...)` class for every `type: 'wire'` entry,\n * `createMutationAdapter(...)` for every `type: 'imperative-mutation'` entry,\n * and `createReadAdapter(...)` for every `type: 'imperative-read'` entry.\n *\n * Only specifiers present in the `adapters` registry are intercepted; imports from\n * unregistered specifiers pass through unchanged.\n */\nexport function lds(\n\toverrides: LdsAdapterRegistry = {},\n): Plugin & { passthroughRules: PassthroughRule[] } {\n\tconst adapters = mergeWithDefaults(overrides);\n\t// Graphql specifiers are owned whole by the virtual module — every export\n\t// (adapters + `gql`) lives there, so the transform hook should not split\n\t// their imports. Non-graphql specifiers still go through transform so\n\t// unregistered names pass through to the real `lightning/*` module.\n\tconst graphqlSpecifiers = new Set<string>(\n\t\tObject.entries(adapters)\n\t\t\t.filter(([, moduleAdapters]) => isGraphqlSpecifier(moduleAdapters))\n\t\t\t.map(([specifier]) => specifier),\n\t);\n\t// State-manager specifiers (`lightning/stateManager*`) are also owned\n\t// whole by the virtual module: their load-hook body emits `export default\n\t// <factory>(...)` per §10.4, so the public consumer surface is a default\n\t// import. The transform hook only rewrites brace-style named imports, so\n\t// state-manager specifiers are excluded from `transformSpecifiers` and\n\t// claimed in `resolveId` directly — same pattern as graphql specifiers.\n\tconst stateManagerSpecifiers = new Set<string>(\n\t\tObject.entries(adapters)\n\t\t\t.filter(([, moduleAdapters]) => isStateManagerSpecifier(moduleAdapters))\n\t\t\t.map(([specifier]) => specifier),\n\t);\n\tconst transformSpecifiers = Object.keys(adapters).filter(\n\t\t(s) => !graphqlSpecifiers.has(s) && !stateManagerSpecifiers.has(s),\n\t);\n\tconst specifierSnippets = transformSpecifiers.flatMap((s) => [`'${s}'`, `\"${s}\"`]);\n\n\t// State-manager `factoryModule` specifiers (e.g.\n\t// `@salesforce/state-managers-uiapi/factory`) are imported from inside the\n\t// emitted virtual module and must reach their real npm package — not the\n\t// scoped-providers fallback. The fallback would otherwise claim them via\n\t// any broad `@salesforce/` interceptPrefix derived from co-installed\n\t// providers (i18n / label / gate). Surface them as passthroughRules so the\n\t// main plugin can hand them to scopedProviders, which short-circuits when\n\t// the importer is one of our `sf-lds-adapter:` virtual modules.\n\tconst factoryModuleSpecifiers = new Set<string>();\n\tfor (const moduleAdapters of Object.values(adapters)) {\n\t\tfor (const entry of Object.values(moduleAdapters)) {\n\t\t\tif (entry.type === \"state-manager\") {\n\t\t\t\tfactoryModuleSpecifiers.add(entry.factoryModule);\n\t\t\t}\n\t\t}\n\t}\n\tconst passthroughRules: PassthroughRule[] = [...factoryModuleSpecifiers].map((specifier) => ({\n\t\tspecifierPrefix: specifier,\n\t\timporterPattern: ADAPTER_PREFIX,\n\t}));\n\n\tconst plugin: Plugin = {\n\t\tname: \"vite-plugin-lds\",\n\t\tenforce: \"pre\",\n\n\t\tasync transform(code, id) {\n\t\t\tconst cleanId = id.split(\"?\")[0] ?? id;\n\t\t\tif (!cleanId.endsWith(\".js\") && !cleanId.endsWith(\".ts\")) return null;\n\t\t\tif (cleanId.includes(\"/node_modules/\")) return null;\n\t\t\tif (!specifierSnippets.some((snippet) => code.includes(snippet))) return null;\n\n\t\t\tawait init;\n\n\t\t\tlet imports: ReturnType<typeof parse>[0];\n\t\t\ttry {\n\t\t\t\t[imports] = parse(code);\n\t\t\t} catch {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst relevant = imports.filter(\n\t\t\t\t(imp) =>\n\t\t\t\t\timp.d === -1 && imp.n !== undefined && imp.n in adapters && !graphqlSpecifiers.has(imp.n),\n\t\t\t);\n\t\t\tif (relevant.length === 0) return null;\n\n\t\t\tconst s = new MagicString(code);\n\t\t\tlet changed = false;\n\n\t\t\tfor (const imp of relevant) {\n\t\t\t\tconst { ss: start, se: end, n: specifier } = imp;\n\t\t\t\tconst statement = code.slice(start, end);\n\n\t\t\t\tconst openBrace = statement.indexOf(\"{\");\n\t\t\t\tconst closeBrace = statement.indexOf(\"}\");\n\t\t\t\tif (openBrace === -1 || closeBrace === -1) continue;\n\n\t\t\t\tconst bracesContent = statement.slice(openBrace + 1, closeBrace);\n\t\t\t\tconst moduleAdapters = adapters[specifier!]!;\n\t\t\t\tconst parsedImport = parseImportSpecifiers(bracesContent);\n\t\t\t\tconst registered = parsedImport.filter((p) => p.original in moduleAdapters);\n\t\t\t\tconst unregistered = parsedImport.filter((p) => !(p.original in moduleAdapters));\n\n\t\t\t\tif (registered.length === 0) continue;\n\n\t\t\t\tconst parts: string[] = [\n\t\t\t\t\t`import { ${registered.map((p) => p.full).join(\", \")} } from '${ADAPTER_PREFIX}${specifier}';`,\n\t\t\t\t];\n\n\t\t\t\tif (unregistered.length > 0) {\n\t\t\t\t\tparts.push(\n\t\t\t\t\t\t`import { ${unregistered.map((p) => p.full).join(\", \")} } from '${specifier}';`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\ts.overwrite(start, end, parts.join(\"\\n\"));\n\t\t\t\tchanged = true;\n\t\t\t}\n\n\t\t\tif (!changed) return null;\n\t\t\treturn { code: s.toString(), map: s.generateMap({ hires: true }) };\n\t\t},\n\n\t\tresolveId(id) {\n\t\t\t// Graphql + state-manager specifiers are intercepted raw — no\n\t\t\t// transform hook split — and mapped into the same\n\t\t\t// `\\0sf-lds-adapter:` virtual namespace so the load hook emits one\n\t\t\t// module per specifier. State-manager modules expose `default` as\n\t\t\t// their only public export (§10.4), so default imports of\n\t\t\t// `lightning/stateManager*` need this interception to reach the\n\t\t\t// virtual module body.\n\t\t\tif (graphqlSpecifiers.has(id) || stateManagerSpecifiers.has(id)) {\n\t\t\t\treturn ADAPTER_ID_PREFIX + id;\n\t\t\t}\n\t\t\tif (id.startsWith(ADAPTER_PREFIX)) return ADAPTER_ID_PREFIX + id.slice(ADAPTER_PREFIX.length);\n\t\t\treturn null;\n\t\t},\n\n\t\tload(id) {\n\t\t\tif (!id.startsWith(ADAPTER_ID_PREFIX)) return null;\n\n\t\t\tconst specifier = id.slice(ADAPTER_ID_PREFIX.length);\n\t\t\tconst moduleAdapters = adapters[specifier];\n\t\t\tif (!moduleAdapters) return null;\n\n\t\t\t// create lines of code used to create MCP tool based adapters\n\t\t\tconst lines: string[] = [adapterBaseSource];\n\t\t\tfor (const [name, entry] of Object.entries(moduleAdapters)) {\n\t\t\t\tif (entry.type === \"state-manager\") {\n\t\t\t\t\t// State-manager entries do not call a runtime factory like\n\t\t\t\t\t// the other types. Per spec §8.4 / §10.4, the load hook\n\t\t\t\t\t// emits a small composition block that synthesizes a\n\t\t\t\t\t// legacy-shape imperative adapter inline and feeds it into\n\t\t\t\t\t// the upstream `<factoryName>` from `<factoryModule>`.\n\t\t\t\t\tlines.push(buildStateManagerCompositionBody(name, entry, specifier));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst { type, ...cfg } = entry;\n\t\t\t\tlines.push(\n\t\t\t\t\t`export const ${name} = ${factoryFor(type)}(${JSON.stringify(name)}, ${JSON.stringify(cfg)});`,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// `gql` rides along with any specifier that declares a graphql\n\t\t\t// adapter, so `import { gql } from 'lightning/graphql'` (or any\n\t\t\t// aliased form) keeps resolving even when no adapters are\n\t\t\t// imported alongside it. The binding itself is a private function\n\t\t\t// inside `adapterBaseSource` after `stripTopLevelExports`.\n\t\t\tif (graphqlSpecifiers.has(specifier)) {\n\t\t\t\tlines.push(\"export { gql };\");\n\t\t\t}\n\t\t\treturn lines.join(\"\\n\");\n\t\t},\n\t};\n\treturn Object.assign(plugin, { passthroughRules });\n}\n"],"names":[],"mappings":";;;;;AAgBA,MAAM,iBAAiB;AAEvB,MAAM,oBAAoB,OAAO;AAcjC,MAAM,oBAAoB;AAAA,EACzB,aAAa,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,YAAY,GAAG,OAAO;AAClF;AAYA,SAAS,qBAAqB,QAAwB;AACrD,SAAO,OACL,QAAQ,2CAA2C,EAAE,EACrD,QAAQ,8BAA8B,EAAE;AAC3C;AAwKA,MAAM,cAAc;AACpB,MAAM,gBAA4B;AAAA,EACjC,MAAM;AAAA,EACN,YAAY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src/providers/lds/adapters.ts","../../../src/providers/lds/common-mcp-tooling.ts","../../../src/providers/lds/state-managers.ts","../../../src/providers/lds/util.ts","../../../src/providers/lds/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type {\n\tLdsRegistryEntry,\n\tLdsRegistryEntryBase,\n\tLdsSchemaValidatedEntry,\n} from \"./common-mcp-tooling\";\nimport type { ReadInvokerShape } from \"./types\";\n\n// ─── Wire + imperative adapter configs ───────────────────────────────────────\n\nexport interface LdsWireAdapterConfig extends LdsSchemaValidatedEntry {\n\ttype: \"wire\";\n}\n\n/**\n * Imperative **mutation** adapter. Always an async\n * `(config) => Promise<Data>` that throws on validation or tool error —\n * matching OneStore's `DefaultImperativeBindingsService`, the only service a\n * mutation ever uses on platform. Mutations do not carry an `invokerShape`:\n * `subscribe`/`refresh` make no sense on write, and allowing them here\n * would drift off-platform from on-platform semantics.\n */\nexport interface LdsImperativeMutationAdapterConfig extends LdsSchemaValidatedEntry {\n\ttype: \"imperative-mutation\";\n}\n\n/**\n * Public alias for the read-shape union defined in `runtime.ts`. Re-exported\n * from this module so consumers don't have to import from the runtime entry\n * point, while keeping the union pinned to one source of truth.\n *\n * Off-platform there is no store, so `subscribe` is a deliberate no-op\n * (callback never fires, returned unsubscribe is idempotent) and `refresh`\n * re-executes the underlying MCP tool. This preserves the OneStore API\n * surface for code ported verbatim.\n */\nexport type LdsImperativeReadInvokerShape = ReadInvokerShape;\n\nexport interface LdsImperativeReadAdapterConfig extends LdsSchemaValidatedEntry {\n\ttype: \"imperative-read\";\n\tinvokerShape: LdsImperativeReadInvokerShape;\n}\n\n// ─── GraphQL adapter configs ─────────────────────────────────────────────────\n\n/**\n * GraphQL wire adapter. Emits `{ data, errors, refresh }` (distinct from the\n * base wire `{ data, error }`). No `configJsonSchema` — the adapter passes\n * `{ query, variables }` through to the configured MCP tool.\n */\nexport interface LdsGraphqlWireAdapterConfig extends LdsRegistryEntryBase {\n\ttype: \"graphql-wire\";\n}\n\n/**\n * Imperative GraphQL mutation — `(config) => Promise<{ data, errors }>`.\n * Errors are routed in-band to the `errors[]` envelope rather than thrown,\n * matching on-platform `toGraphQLResponseFromFailure`.\n */\nexport interface LdsGraphqlMutationAdapterConfig extends LdsRegistryEntryBase {\n\ttype: \"graphql-mutation\";\n}\n\n/**\n * Read-shape discriminator for imperative GraphQL adapters. Mirrors the\n * `imperative-read` `invokerShape` field so the two families share a pattern:\n * one `type` discriminator + a shape field that selects the return surface.\n *\n * - `query` — `Promise<{ data, errors, subscribe }>` (on-platform\n * `GraphQLImperativeBindingsService` without `exposeRefresh`).\n * - `query-refreshable` — `Promise<{ data, errors, subscribe, refresh }>`\n * (same service with `exposeRefresh: true`).\n * - `legacy` — `{ invoke(config, context, callback),\n * subscribe(config, context, callback): Unsubscribe }`, the older callback\n * surface served by `GraphQLLegacyImperativeBindingsService`.\n *\n * `subscribe` is a deliberate no-op off-platform (no reactive store).\n */\nexport type LdsGraphqlImperativeReadInvokerShape = \"query\" | \"query-refreshable\" | \"legacy\";\n\n/**\n * Imperative GraphQL read adapter. The `invokerShape` picks the return\n * surface — see {@link LdsGraphqlImperativeReadInvokerShape}. Errors are\n * routed in-band to `errors[]` (for `query`/`query-refreshable`) or into the\n * callback payload (for `legacy`); no shape throws on tool errors.\n */\nexport interface LdsGraphqlImperativeReadAdapterConfig extends LdsRegistryEntryBase {\n\ttype: \"graphql-imperative-read\";\n\tinvokerShape: LdsGraphqlImperativeReadInvokerShape;\n}\n\n// ─── Load-hook helpers (non-state-manager paths) ─────────────────────────────\n\n/** True when any entry in a module's registry map is a `graphql-*` type. */\nexport function isGraphqlSpecifier(moduleAdapters: Record<string, LdsRegistryEntry>): boolean {\n\treturn Object.values(moduleAdapters).some(\n\t\t(entry) =>\n\t\t\tentry.type === \"graphql-wire\" ||\n\t\t\tentry.type === \"graphql-mutation\" ||\n\t\t\tentry.type === \"graphql-imperative-read\",\n\t);\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { JSONSchema } from \"@conduit-client/jsonschema-validate\";\nimport type {\n\tLdsGraphqlImperativeReadAdapterConfig,\n\tLdsGraphqlMutationAdapterConfig,\n\tLdsGraphqlWireAdapterConfig,\n\tLdsImperativeMutationAdapterConfig,\n\tLdsImperativeReadAdapterConfig,\n\tLdsWireAdapterConfig,\n} from \"./adapters\";\nimport type { LdsStateManagerConfig } from \"./state-managers\";\n\n// ─── Base shapes shared by every MCP-backed registry entry ───────────────────\n\n/**\n * MCP dispatch descriptor. Nested under `mcp` on every registry entry so\n * additional MCP-specific fields (auth, transport, retry policy) can join\n * later without reshaping every consumer entry.\n */\nexport interface LdsMcpDispatch {\n\ttoolName: string;\n}\n\n/**\n * Base shape every LDS registry entry extends. Holds the dispatch surface in\n * one place so new backings (e.g. `http`) can land as sibling optional fields\n * without forking each entry interface. Dual registration is supported at\n * the type level — runtime execution still targets a single backing per call.\n */\nexport interface LdsRegistryEntryBase {\n\tmcp?: LdsMcpDispatch;\n}\n\n/**\n * LDS registry entries whose input is validated against a JSON Schema at\n * invoke time — wire, imperative-mutation, imperative-read. GraphQL variants\n * skip this base because they pass `{ query, variables }` through to the\n * configured MCP tool with no schema check.\n */\nexport interface LdsSchemaValidatedEntry extends LdsRegistryEntryBase {\n\tconfigJsonSchema: JSONSchema;\n}\n\n// ─── Public union + registry surface ─────────────────────────────────────────\n// Lives in `common-mcp-tooling` because the union is the \"what kinds of\n// MCP-backed things exist\" summary every consumer reaches for. The union\n// spans both adapter variants (wire / imperative / graphql) and the\n// state-manager variant since they share the same registry slot — even\n// though state managers aren't technically adapters.\n\nexport type LdsRegistryEntry =\n\t| LdsWireAdapterConfig\n\t| LdsImperativeMutationAdapterConfig\n\t| LdsImperativeReadAdapterConfig\n\t| LdsGraphqlWireAdapterConfig\n\t| LdsGraphqlMutationAdapterConfig\n\t| LdsGraphqlImperativeReadAdapterConfig\n\t| LdsStateManagerConfig;\n\nexport type LdsRegistry = Record<string, Record<string, LdsRegistryEntry>>;\n\n// ─── Per-resource shared MCP-tool constants ──────────────────────────────────\n// Tool names and JSON Schemas extracted from the registry so wire / imperative\n// siblings backed by the same MCP tool reference one source of truth. Mutation\n// adapters keep their own dedicated tools and schemas because their dispatch\n// surface is distinct (different tool name, different validated input).\n\nexport const RECORD_TOOL = \"getRecordMcpTool\";\nexport const RECORD_SCHEMA: JSONSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\trecordId: { type: \"string\" },\n\t\tlayoutTypes: {\n\t\t\tanyOf: [{ type: \"array\", items: { type: \"string\" } }, { type: \"null\" }],\n\t\t},\n\t\tfields: {\n\t\t\tanyOf: [{ type: \"array\", items: { type: \"string\" } }, { type: \"null\" }],\n\t\t},\n\t},\n\trequired: [\"recordId\"],\n\tadditionalProperties: false,\n\tanyOf: [\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tfields: { type: \"array\", items: { type: \"string\" }, minItems: 1 },\n\t\t\t},\n\t\t\trequired: [\"fields\"],\n\t\t\tadditionalProperties: true,\n\t\t},\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tlayoutTypes: {\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: { type: \"string\" },\n\t\t\t\t\tminItems: 1,\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"layoutTypes\"],\n\t\t\tadditionalProperties: true,\n\t\t},\n\t],\n};\n\nexport const OBJECT_INFO_TOOL = \"getObjectInfoMcpTool\";\nexport const OBJECT_INFO_SCHEMA: JSONSchema = {\n\ttype: \"object\",\n\tproperties: {\n\t\tobjectApiName: { type: \"string\" },\n\t},\n\trequired: [\"objectApiName\"],\n\tadditionalProperties: false,\n};\n\nexport const GRAPHQL_TOOL = \"graphqlQuery\";\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { JSONSchema } from \"@conduit-client/jsonschema-validate\";\nimport type { LdsRegistryEntry, LdsRegistryEntryBase } from \"./common-mcp-tooling\";\n\n/**\n * State-manager registry entry. The lds plugin's load hook emits a\n * factory-composition body for each state-manager entry — see\n * `buildStateManagerCompositionBody` below. Two emit shapes:\n *\n * - **UIAPI** (`lightning/stateManagerRecord`, `…ObjectInfo`) — synthesizes\n * a legacy-shape imperative-read adapter inline via `createReadAdapter`\n * and feeds it into the upstream per-state-manager factory\n * (`createSmRecord` / `createSmObjectInfo`) re-exported from\n * `@salesforce/state-managers-uiapi/factory`.\n *\n * - **GraphQL** (`lightning/stateManagerGraphQL`) — calls the upstream\n * per-state-manager factory `createSmGraphQL` re-exported from\n * `@salesforce/lds-adapters-onestore-graphql/factory` with an MCP-backed\n * `getCommand` synthesized via `createGraphqlStateManagerCommand`\n * (a `runtime.ts` helper). The required / optional config keys\n * (`['query']`, `['variables', 'operationName']`) live in the upstream\n * factory — a fixed contract of `lightning/stateManagerGraphQL` — so the\n * load-hook emit doesn't pass them. Mirrors the UIAPI shape (one\n * factory call, adapter argument only).\n *\n * Per-state-manager metadata (definedBy, requiredKeys, optionalKeys,\n * predicate) lives in the upstream factory — not here. See spec §8.4 / §10.4.\n *\n * `configJsonSchema` is optional: UIAPI state managers supply it (the\n * load hook embeds it in the synthesized imperative-read adapter), but\n * the graphql state-manager path doesn't read it (off-core graphql\n * forgoes the on-core `assertIsValid` / `resolveAndValidateGraphQLConfig`\n * validation layer; spec §4 Non-goal 9 — malformed configs surface as\n * MCP tool errors at execute time instead).\n */\nexport interface LdsStateManagerConfig extends LdsRegistryEntryBase {\n\ttype: \"state-manager\";\n\t/** Upstream factory specifier — e.g. '@salesforce/state-managers-uiapi/factory'. */\n\tfactoryModule: string;\n\t/** Named export within `factoryModule` — e.g. 'createSmRecord' (UIAPI), 'createSmGraphQL' (graphql). */\n\tfactoryName: string;\n\t/** JSON Schema for the config object — required for UIAPI state managers, omitted for graphql. */\n\tconfigJsonSchema?: JSONSchema;\n}\n\n/** True when any entry in a module's registry map is a `state-manager` type. */\nexport function isStateManagerSpecifier(moduleAdapters: Record<string, LdsRegistryEntry>): boolean {\n\treturn Object.values(moduleAdapters).some((entry) => entry.type === \"state-manager\");\n}\n\n/**\n * True when a state-manager specifier resolves to the graphql state manager\n * (`lightning/stateManagerGraphQL`). Used by `buildStateManagerCompositionBody`\n * to pick which emit shape to use:\n *\n * - GraphQL — call upstream `createSmGraphQL` with an MCP-backed\n * `getCommand` from `createGraphqlStateManagerCommand`. Required/optional\n * key sets (`['query']` / `['variables', 'operationName']`) live in the\n * upstream factory; the load-hook emit doesn't pass them.\n * - UIAPI — synthesize a legacy-shape imperative-read adapter inline via\n * `createReadAdapter` and feed it into the per-state-manager wrapper\n * (`createSmRecord` / `createSmObjectInfo`).\n *\n * Selecting on the specifier (rather than the registry entry's `type`)\n * mirrors §8.4 of the spec and keeps the `LdsStateManagerConfig` surface\n * free of an inner discriminator — consumers add a state-manager registry\n * entry once and the plugin picks the right emit shape.\n */\nfunction isGraphqlStateManagerSpecifier(specifier: string): boolean {\n\treturn specifier === \"lightning/stateManagerGraphQL\";\n}\n\n/**\n * Builds the §8.4 factory-composition body for a single `state-manager`\n * registry entry. Two emit shapes, gated by `isGraphqlStateManagerSpecifier`:\n *\n * **UIAPI shape** — `lightning/stateManagerRecord`, `…ObjectInfo`:\n * 1. Imports `<factoryName>` (e.g. `createSmRecord`) from the registry's\n * `factoryModule` (e.g. `@salesforce/state-managers-uiapi/factory`).\n * 2. Builds a legacy-shape imperative-read config and synthesizes the\n * adapter inline via `createReadAdapter` — a private binding pulled\n * into scope by `adapterBaseSource`.\n * 3. Default-exports `<factoryName>(synthesizedAdapter)`.\n *\n * **GraphQL shape** — `lightning/stateManagerGraphQL`:\n * 1. Imports `<factoryName>` (`createSmGraphQL`) from the registry's\n * `factoryModule` (`@salesforce/lds-adapters-onestore-graphql/factory`).\n * 2. Synthesizes an MCP-backed `getCommand` via `createGraphqlStateManagerCommand`\n * (a `runtime.ts` helper, in scope as a private binding).\n * 3. Default-exports `<factoryName>(getCommand)`. The required / optional\n * config keys are baked into the upstream factory, not passed here.\n *\n * Only `default` is exported in either shape. The upstream `<name>_internal`\n * named export (used internally by `state-managers-uiapi` for\n * cross-state-manager wiring and tests) is deliberately not re-exported —\n * uplifted customer LWCs only consume the default. See spec §8.4 / §10.4.\n */\nexport function buildStateManagerCompositionBody(\n\tname: string,\n\tcfg: LdsStateManagerConfig,\n\tspecifier: string,\n): string {\n\tif (isGraphqlStateManagerSpecifier(specifier)) {\n\t\tconst graphqlCfg = { mcp: { toolName: cfg.mcp?.toolName } };\n\t\treturn [\n\t\t\t`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,\n\t\t\t`const __getCommand_${name} = createGraphqlStateManagerCommand(${JSON.stringify(name)}, ${JSON.stringify(graphqlCfg)});`,\n\t\t\t`export default ${cfg.factoryName}(__getCommand_${name});`,\n\t\t].join(\"\\n\");\n\t}\n\tconst synthesizedCfg = {\n\t\ttype: \"imperative-read\" as const,\n\t\tinvokerShape: \"legacy\" as const,\n\t\tmcp: { toolName: cfg.mcp?.toolName },\n\t\tconfigJsonSchema: cfg.configJsonSchema,\n\t};\n\treturn [\n\t\t`import { ${cfg.factoryName} } from ${JSON.stringify(cfg.factoryModule)};`,\n\t\t`const __cfg_${name} = ${JSON.stringify(synthesizedCfg)};`,\n\t\t`const __imperativeAdapter_${name} = createReadAdapter(${JSON.stringify(name)}, __cfg_${name});`,\n\t\t`export default ${cfg.factoryName}(__imperativeAdapter_${name});`,\n\t].join(\"\\n\");\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Splits the brace-content of a named-import statement into its individual\n * specifiers, surfacing both the original (pre-`as`) name and the full\n * `<original> as <local>` form. Used by the lds plugin's transform hook to\n * decide which names to rewrite to the virtual module.\n */\nexport function parseImportSpecifiers(bracesContent: string): { original: string; full: string }[] {\n\treturn bracesContent\n\t\t.split(\",\")\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean)\n\t\t.map((entry) => {\n\t\t\tconst asIdx = entry.indexOf(\" as \");\n\t\t\tconst original = asIdx !== -1 ? entry.slice(0, asIdx).trim() : entry.trim();\n\t\t\treturn { original, full: entry };\n\t\t});\n}\n\n/**\n * Removes top-level ES-module `export` keywords from the embedded runtime\n * source so its declarations survive as private bindings inside the virtual\n * module. Handles two shapes:\n * 1. Per-declaration: `export function foo …` / `export async function foo`\n * → the `export ` prefix is dropped.\n * 2. Trailing re-export clause: `export { foo, bar };` → deleted entirely.\n * Inner occurrences (inside function bodies, comments, strings) are not\n * affected because the source is a flat module with exports only at column 0.\n *\n * Internal: only `adapterBaseSource` is on the public deep-import surface;\n * the strip itself is an implementation detail.\n */\nfunction stripTopLevelExports(source: string): string {\n\treturn source\n\t\t.replace(/^export\\s+(?=(?:async\\s+)?function\\s)/gm, \"\")\n\t\t.replace(/^export\\s*\\{[^}]*};?\\s*$/gm, \"\");\n}\n\n// the source of the adapter base module — reused across virtual modules so\n// each generated specifier emits the factories once.\n//\n// Top-level exports from the runtime module are stripped so every factory and\n// `gql` becomes a private binding inside the virtual module. The load hook\n// then controls exactly which names are exported per specifier: adapter\n// entries from the registry, plus `gql` for graphql specifiers. Without this,\n// the built `runtime.js` (trailing `export { …, gql, createWireAdapter, … }`)\n// and the source `runtime.ts` (per-declaration `export function gql …`) both\n// produce a `SyntaxError: Duplicate export of 'gql'` when the load hook also\n// appends `export { gql };`. They also leak the factory names as exports on\n// every LDS virtual module, which isn't a public contract we want.\nexport const adapterBaseSource = stripTopLevelExports(\n\treadFileSync(join(dirname(fileURLToPath(import.meta.url)), \"runtime.js\"), \"utf-8\"),\n);\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport { init, parse } from \"es-module-lexer\";\nimport MagicString from \"magic-string\";\nimport type { Plugin } from \"vite\";\nimport { isGraphqlSpecifier } from \"./adapters\";\nimport {\n\tGRAPHQL_TOOL,\n\ttype LdsRegistry,\n\ttype LdsRegistryEntry,\n\tOBJECT_INFO_SCHEMA,\n\tOBJECT_INFO_TOOL,\n\tRECORD_SCHEMA,\n\tRECORD_TOOL,\n} from \"./common-mcp-tooling\";\nimport { buildStateManagerCompositionBody, isStateManagerSpecifier } from \"./state-managers\";\nimport { adapterBaseSource, parseImportSpecifiers } from \"./util\";\nimport type { PassthroughRule } from \"../../types\";\n\n// Re-export the public type surface. Consumers (and `providers/index.ts`)\n// continue to import every registry-entry type from `./lds/index`.\nexport type {\n\tLdsMcpDispatch,\n\tLdsRegistry,\n\tLdsRegistryEntry,\n\tLdsRegistryEntryBase,\n\tLdsSchemaValidatedEntry,\n} from \"./common-mcp-tooling\";\nexport type {\n\tLdsGraphqlImperativeReadAdapterConfig,\n\tLdsGraphqlImperativeReadInvokerShape,\n\tLdsGraphqlMutationAdapterConfig,\n\tLdsGraphqlWireAdapterConfig,\n\tLdsImperativeMutationAdapterConfig,\n\tLdsImperativeReadAdapterConfig,\n\tLdsImperativeReadInvokerShape,\n\tLdsWireAdapterConfig,\n} from \"./adapters\";\nexport type { LdsStateManagerConfig } from \"./state-managers\";\n\n// prefix to write into transformed source code\nconst ADAPTER_PREFIX = \"sf-lds-adapter:\";\n// prefix used to ID the adapter when loading the virtual module\nconst ADAPTER_ID_PREFIX = \"\\0\" + ADAPTER_PREFIX;\n\n/**\n * Default registry.\n * Maps LDS module specifiers to MCP tool-backed implementations. Entries can be\n * wire adapters (`type: 'wire'`), imperative mutations (`type: 'imperative-mutation'`),\n * imperative reads (`type: 'imperative-read'` + `invokerShape`), GraphQL variants,\n * or state managers. Add entries here to support additional lightning/* exports.\n */\nconst DEFAULT_REGISTRY: LdsRegistry = {\n\t\"lightning/uiRecordApi\": {\n\t\tgetRecord: {\n\t\t\ttype: \"wire\",\n\t\t\tmcp: { toolName: RECORD_TOOL },\n\t\t\tconfigJsonSchema: RECORD_SCHEMA,\n\t\t},\n\t\tcreateRecord: {\n\t\t\ttype: \"imperative-mutation\",\n\t\t\tmcp: { toolName: \"createRecordMcpTool\" },\n\t\t\tconfigJsonSchema: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tapiName: { type: \"string\" },\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\trequired: [],\n\t\t\t\t\t\tadditionalProperties: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trequired: [\"apiName\", \"fields\"],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t},\n\t\tupdateRecord: {\n\t\t\ttype: \"imperative-mutation\",\n\t\t\tmcp: { toolName: \"updateRecordMcpTool\" },\n\t\t\tconfigJsonSchema: {\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\trecordId: { type: \"string\" },\n\t\t\t\t\tfields: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\tproperties: {},\n\t\t\t\t\t\trequired: [],\n\t\t\t\t\t\tadditionalProperties: true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trequired: [\"recordId\", \"fields\"],\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t},\n\t},\n\t\"lightning/uiObjectInfoApi\": {\n\t\t// On-platform this is a `{ invoke, subscribe }` callback surface\n\t\t// emitting `{ data, error }`. The legacy invoker shape preserves that\n\t\t// contract verbatim, so ported consumers keep their call sites.\n\t\tgetObjectInfo_imperative: {\n\t\t\ttype: \"imperative-read\",\n\t\t\tinvokerShape: \"legacy\",\n\t\t\tmcp: { toolName: OBJECT_INFO_TOOL },\n\t\t\tconfigJsonSchema: OBJECT_INFO_SCHEMA,\n\t\t},\n\t},\n\t// `lightning/graphql` — on-platform exports `gql`, the `graphql` wire\n\t// adapter, and `executeMutation`. Only `graphql` and `executeMutation`\n\t// are registry entries; `gql` rides along automatically for any specifier\n\t// that has at least one graphql-typed entry (emitted by the load hook).\n\t\"lightning/graphql\": {\n\t\tgraphql: { type: \"graphql-wire\", mcp: { toolName: GRAPHQL_TOOL } },\n\t\texecuteMutation: { type: \"graphql-mutation\", mcp: { toolName: GRAPHQL_TOOL } },\n\t},\n\t// `lightning/stateManagerGraphQL` — externalized graphql state manager.\n\t// The load hook imports `createSmGraphQL` from the upstream\n\t// `@salesforce/lds-adapters-onestore-graphql/factory` barrel — a thin\n\t// per-state-manager wrapper around `createStateManager` that bakes in\n\t// the required (`['query']`) / optional (`['variables', 'operationName']`)\n\t// config keys, mirroring `createSmRecord` / `createSmObjectInfo`. The\n\t// same factory wraps the call site on-core via `bindings/bindings.ts`,\n\t// so off-core composition fidelity is preserved without on-core service\n\t// plumbing leaking into this side.\n\t//\n\t// Per §10.3 the registry only ever has `default` as its key — the\n\t// `createSmGraphQL` return value is itself the `default` export of\n\t// the virtual module.\n\t//\n\t// `configJsonSchema` is omitted: off-core graphql forgoes the on-core\n\t// `assertIsValid` / `resolveAndValidateGraphQLConfig` validation layer\n\t// (§4 Non-goal 9), and the load-hook graphql path doesn't read the\n\t// field anyway — malformed configs surface as MCP tool errors at\n\t// execute time instead.\n\t\"lightning/stateManagerGraphQL\": {\n\t\tdefault: {\n\t\t\ttype: \"state-manager\",\n\t\t\tfactoryModule: \"@salesforce/lds-adapters-onestore-graphql/factory\",\n\t\t\tfactoryName: \"createSmGraphQL\",\n\t\t\tmcp: { toolName: GRAPHQL_TOOL },\n\t\t},\n\t},\n\t// State-manager specifier for ObjectInfo (spec §8.3 / §10.3). The load hook\n\t// synthesizes a legacy-shape imperative-read adapter inline from\n\t// (mcp.toolName, configJsonSchema) and feeds it to the upstream\n\t// `createSmObjectInfo` factory. Reuses the shared `OBJECT_INFO_TOOL` /\n\t// `OBJECT_INFO_SCHEMA` so this entry stays in lock-step with the\n\t// `lightning/uiObjectInfoApi.getObjectInfo_imperative` entry above —\n\t// both back the same UIAPI ObjectInfo MCP tool.\n\t\"lightning/stateManagerObjectInfo\": {\n\t\tdefault: {\n\t\t\ttype: \"state-manager\",\n\t\t\tfactoryModule: \"@salesforce/state-managers-uiapi/factory\",\n\t\t\tfactoryName: \"createSmObjectInfo\",\n\t\t\tmcp: { toolName: OBJECT_INFO_TOOL },\n\t\t\tconfigJsonSchema: OBJECT_INFO_SCHEMA,\n\t\t},\n\t},\n\t// `lightning/stateManagerRecord` — UIAPI Record state-manager. Per spec\n\t// §10.3 the registry only ever has a single `default` key; the load hook\n\t// synthesizes a legacy-shape imperative-read adapter from\n\t// (mcp.toolName, configJsonSchema) and feeds it into the upstream\n\t// `createSmRecord` factory to produce the externalized state manager.\n\t// Reuses the shared `RECORD_TOOL` / `RECORD_SCHEMA` so the wire and\n\t// state-manager paths stay anchored to a single MCP-tool / config\n\t// contract.\n\t\"lightning/stateManagerRecord\": {\n\t\tdefault: {\n\t\t\ttype: \"state-manager\",\n\t\t\tfactoryModule: \"@salesforce/state-managers-uiapi/factory\",\n\t\t\tfactoryName: \"createSmRecord\",\n\t\t\tmcp: { toolName: RECORD_TOOL },\n\t\t\tconfigJsonSchema: RECORD_SCHEMA,\n\t\t},\n\t},\n};\n\n/** Maps an entry discriminator to the factory name emitted in the virtual module. */\nfunction factoryFor(type: LdsRegistryEntry[\"type\"]): string {\n\tswitch (type) {\n\t\tcase \"wire\":\n\t\t\treturn \"createWireAdapter\";\n\t\tcase \"imperative-mutation\":\n\t\t\treturn \"createMutationAdapter\";\n\t\tcase \"imperative-read\":\n\t\t\treturn \"createReadAdapter\";\n\t\tcase \"graphql-wire\":\n\t\t\treturn \"createGraphQLWireAdapter\";\n\t\tcase \"graphql-mutation\":\n\t\t\treturn \"createGraphQLMutationAdapter\";\n\t\tcase \"graphql-imperative-read\":\n\t\t\treturn \"createGraphQLImperativeReadAdapter\";\n\t\tcase \"state-manager\":\n\t\t\t// Load-hook directive name (consumed in W-05), not a runtime-import\n\t\t\t// factory: the load hook synthesizes an adapter inline and calls\n\t\t\t// the upstream factoryModule/factoryName to compose the state manager.\n\t\t\treturn \"createStateManagerComposition\";\n\t}\n}\n\n/**\n * Deep-merges user overrides onto the default registry: every specifier from\n * both sides is preserved, and per-specifier entries are merged so a consumer\n * can override `getRecord` without losing `createRecord`, or register a new\n * entry on `lightning/graphql` without losing `graphql` / `executeMutation`.\n * Pass an empty object to get just the defaults. To opt out of a default\n * entry, pass the same specifier with a different entry of the same key.\n */\nfunction mergeWithDefaults(overrides: LdsRegistry): LdsRegistry {\n\tconst merged: LdsRegistry = { ...DEFAULT_REGISTRY };\n\tfor (const [specifier, entries] of Object.entries(overrides)) {\n\t\tmerged[specifier] = { ...(DEFAULT_REGISTRY[specifier] ?? {}), ...entries };\n\t}\n\treturn merged;\n}\n\n/**\n * LDS provider — rewrites registered `lightning/*` imports (e.g.\n * `lightning/uiRecordApi`) to MCP-tool-backed virtual modules. Unregistered\n * exports pass through to the normal `lightning/*` resolution.\n *\n * Three Vite hooks do the work:\n *\n * - **`transform`** — parses each `.js` / `.ts` file with `es-module-lexer`,\n * finds named imports from registered specifiers, and rewrites them to pull\n * registered names from `sf-lds-adapter:<specifier>` while leaving\n * unregistered names pointing at the original specifier.\n *\n * - **`resolveId`** — maps `sf-lds-adapter:<specifier>` to a `\\0`-prefixed\n * virtual module ID, preventing Rollup from attempting a filesystem lookup.\n *\n * - **`load`** — generates the virtual module, emitting an MCP-backed\n * `createWireAdapter(...)` class for every `type: 'wire'` entry,\n * `createMutationAdapter(...)` for every `type: 'imperative-mutation'` entry,\n * and `createReadAdapter(...)` for every `type: 'imperative-read'` entry.\n *\n * Only specifiers present in the `adapters` registry are intercepted; imports from\n * unregistered specifiers pass through unchanged.\n */\nexport function lds(overrides: LdsRegistry = {}): Plugin & { passthroughRules: PassthroughRule[] } {\n\tconst adapters = mergeWithDefaults(overrides);\n\t// Graphql specifiers are owned whole by the virtual module — every export\n\t// (adapters + `gql`) lives there, so the transform hook should not split\n\t// their imports. Non-graphql specifiers still go through transform so\n\t// unregistered names pass through to the real `lightning/*` module.\n\tconst graphqlSpecifiers = new Set<string>(\n\t\tObject.entries(adapters)\n\t\t\t.filter(([, moduleAdapters]) => isGraphqlSpecifier(moduleAdapters))\n\t\t\t.map(([specifier]) => specifier),\n\t);\n\t// State-manager specifiers (`lightning/stateManager*`) are also owned\n\t// whole by the virtual module: their load-hook body emits `export default\n\t// <factory>(...)` per §10.4, so the public consumer surface is a default\n\t// import. The transform hook only rewrites brace-style named imports, so\n\t// state-manager specifiers are excluded from `transformSpecifiers` and\n\t// claimed in `resolveId` directly — same pattern as graphql specifiers.\n\tconst stateManagerSpecifiers = new Set<string>(\n\t\tObject.entries(adapters)\n\t\t\t.filter(([, moduleAdapters]) => isStateManagerSpecifier(moduleAdapters))\n\t\t\t.map(([specifier]) => specifier),\n\t);\n\tconst transformSpecifiers = Object.keys(adapters).filter(\n\t\t(s) => !graphqlSpecifiers.has(s) && !stateManagerSpecifiers.has(s),\n\t);\n\tconst specifierSnippets = transformSpecifiers.flatMap((s) => [`'${s}'`, `\"${s}\"`]);\n\n\t// State-manager `factoryModule` specifiers (e.g.\n\t// `@salesforce/state-managers-uiapi/factory`) are imported from inside the\n\t// emitted virtual module and must reach their real npm package — not the\n\t// scoped-providers fallback. The fallback would otherwise claim them via\n\t// any broad `@salesforce/` interceptPrefix derived from co-installed\n\t// providers (i18n / label / gate). Surface them as passthroughRules so the\n\t// main plugin can hand them to scopedProviders, which short-circuits when\n\t// the importer is one of our `sf-lds-adapter:` virtual modules.\n\tconst factoryModuleSpecifiers = new Set<string>();\n\tfor (const moduleAdapters of Object.values(adapters)) {\n\t\tfor (const entry of Object.values(moduleAdapters)) {\n\t\t\tif (entry.type === \"state-manager\") {\n\t\t\t\tfactoryModuleSpecifiers.add(entry.factoryModule);\n\t\t\t}\n\t\t}\n\t}\n\tconst passthroughRules: PassthroughRule[] = [...factoryModuleSpecifiers].map((specifier) => ({\n\t\tspecifierPrefix: specifier,\n\t\timporterPattern: ADAPTER_PREFIX,\n\t}));\n\n\tconst plugin: Plugin = {\n\t\tname: \"vite-plugin-lds\",\n\t\tenforce: \"pre\",\n\n\t\tasync transform(code, id) {\n\t\t\tconst cleanId = id.split(\"?\")[0] ?? id;\n\t\t\tif (!cleanId.endsWith(\".js\") && !cleanId.endsWith(\".ts\")) return null;\n\t\t\tif (cleanId.includes(\"/node_modules/\")) return null;\n\t\t\tif (!specifierSnippets.some((snippet) => code.includes(snippet))) return null;\n\n\t\t\tawait init;\n\n\t\t\tlet imports: ReturnType<typeof parse>[0];\n\t\t\ttry {\n\t\t\t\t[imports] = parse(code);\n\t\t\t} catch {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst relevant = imports.filter(\n\t\t\t\t(imp) =>\n\t\t\t\t\timp.d === -1 && imp.n !== undefined && imp.n in adapters && !graphqlSpecifiers.has(imp.n),\n\t\t\t);\n\t\t\tif (relevant.length === 0) return null;\n\n\t\t\tconst s = new MagicString(code);\n\t\t\tlet changed = false;\n\n\t\t\tfor (const imp of relevant) {\n\t\t\t\tconst { ss: start, se: end, n: specifier } = imp;\n\t\t\t\tconst statement = code.slice(start, end);\n\n\t\t\t\tconst openBrace = statement.indexOf(\"{\");\n\t\t\t\tconst closeBrace = statement.indexOf(\"}\");\n\t\t\t\tif (openBrace === -1 || closeBrace === -1) continue;\n\n\t\t\t\tconst bracesContent = statement.slice(openBrace + 1, closeBrace);\n\t\t\t\tconst moduleAdapters = adapters[specifier!]!;\n\t\t\t\tconst parsedImport = parseImportSpecifiers(bracesContent);\n\t\t\t\tconst registered = parsedImport.filter((p) => p.original in moduleAdapters);\n\t\t\t\tconst unregistered = parsedImport.filter((p) => !(p.original in moduleAdapters));\n\n\t\t\t\tif (registered.length === 0) continue;\n\n\t\t\t\tconst parts: string[] = [\n\t\t\t\t\t`import { ${registered.map((p) => p.full).join(\", \")} } from '${ADAPTER_PREFIX}${specifier}';`,\n\t\t\t\t];\n\n\t\t\t\tif (unregistered.length > 0) {\n\t\t\t\t\tparts.push(\n\t\t\t\t\t\t`import { ${unregistered.map((p) => p.full).join(\", \")} } from '${specifier}';`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\ts.overwrite(start, end, parts.join(\"\\n\"));\n\t\t\t\tchanged = true;\n\t\t\t}\n\n\t\t\tif (!changed) return null;\n\t\t\treturn { code: s.toString(), map: s.generateMap({ hires: true }) };\n\t\t},\n\n\t\tresolveId(id) {\n\t\t\t// Graphql + state-manager specifiers are intercepted raw — no\n\t\t\t// transform hook split — and mapped into the same\n\t\t\t// `\\0sf-lds-adapter:` virtual namespace so the load hook emits one\n\t\t\t// module per specifier. State-manager modules expose `default` as\n\t\t\t// their only public export (§10.4), so default imports of\n\t\t\t// `lightning/stateManager*` need this interception to reach the\n\t\t\t// virtual module body.\n\t\t\tif (graphqlSpecifiers.has(id) || stateManagerSpecifiers.has(id)) {\n\t\t\t\treturn ADAPTER_ID_PREFIX + id;\n\t\t\t}\n\t\t\tif (id.startsWith(ADAPTER_PREFIX)) return ADAPTER_ID_PREFIX + id.slice(ADAPTER_PREFIX.length);\n\t\t\treturn null;\n\t\t},\n\n\t\tload(id) {\n\t\t\tif (!id.startsWith(ADAPTER_ID_PREFIX)) return null;\n\n\t\t\tconst specifier = id.slice(ADAPTER_ID_PREFIX.length);\n\t\t\tconst moduleAdapters = adapters[specifier];\n\t\t\tif (!moduleAdapters) return null;\n\n\t\t\t// create lines of code used to create MCP tool based adapters\n\t\t\tconst lines: string[] = [adapterBaseSource];\n\t\t\tfor (const [name, entry] of Object.entries(moduleAdapters)) {\n\t\t\t\tif (entry.type === \"state-manager\") {\n\t\t\t\t\t// State-manager entries do not call a runtime factory like\n\t\t\t\t\t// the other types. Per spec §8.4 / §10.4, the load hook\n\t\t\t\t\t// emits a small composition block that synthesizes a\n\t\t\t\t\t// legacy-shape imperative adapter inline and feeds it into\n\t\t\t\t\t// the upstream `<factoryName>` from `<factoryModule>`.\n\t\t\t\t\tlines.push(buildStateManagerCompositionBody(name, entry, specifier));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst { type, ...cfg } = entry;\n\t\t\t\tlines.push(\n\t\t\t\t\t`export const ${name} = ${factoryFor(type)}(${JSON.stringify(name)}, ${JSON.stringify(cfg)});`,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// `gql` rides along with any specifier that declares a graphql\n\t\t\t// adapter, so `import { gql } from 'lightning/graphql'` (or any\n\t\t\t// aliased form) keeps resolving even when no adapters are\n\t\t\t// imported alongside it. The binding itself is a private function\n\t\t\t// inside `adapterBaseSource` after `stripTopLevelExports`.\n\t\t\tif (graphqlSpecifiers.has(specifier)) {\n\t\t\t\tlines.push(\"export { gql };\");\n\t\t\t}\n\t\t\treturn lines.join(\"\\n\");\n\t\t},\n\t};\n\treturn Object.assign(plugin, { passthroughRules });\n}\n"],"names":[],"mappings":";;;;;AAkGO,SAAS,mBAAmB,gBAA2D;AAC7F,SAAO,OAAO,OAAO,cAAc,EAAE;AAAA,IACpC,CAAC,UACA,MAAM,SAAS,kBACf,MAAM,SAAS,sBACf,MAAM,SAAS;AAAA,EAAA;AAElB;AClCO,MAAM,cAAc;AACpB,MAAM,gBAA4B;AAAA,EACxC,MAAM;AAAA,EACN,YAAY;AAAA,IACX,UAAU,EAAE,MAAM,SAAA;AAAA,IAClB,aAAa;AAAA,MACZ,OAAO,CAAC,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAA,EAAS,GAAK,EAAE,MAAM,QAAQ;AAAA,IAAA;AAAA,IAEvE,QAAQ;AAAA,MACP,OAAO,CAAC,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAA,EAAS,GAAK,EAAE,MAAM,QAAQ;AAAA,IAAA;AAAA,EACvE;AAAA,EAED,UAAU,CAAC,UAAU;AAAA,EACrB,sBAAsB;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,UAAI,kBAAkB,IAAI,EAAE,KAAK,uBAAuB,IAAI,EAAE,GAAG;AAChE,eAAO,oBAAoB;AAAA,MAC5B;AACA,UAAI,GAAG,WAAW,cAAc,UAAU,oBAAoB,GAAG,MAAM,eAAe,MAAM;AAC5F,aAAO;AAAA,IACR;AAAA,IAEA,KAAK,IAAI;AACR,UAAI,CAAC,GAAG,WAAW,iBAAiB,EAAG,QAAO;AAE9C,YAAM,YAAY,GAAG,MAAM,kBAAkB,MAAM;AACnD,YAAM,iBAAiB,SAAS,SAAS;AACzC,UAAI,CAAC,eAAgB,QAAO;AAG5B,YAAM,QAAkB,CAAC,iBAAiB;AAC1C,iBAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,cAAc,GAAG;AAC3D,YAAI,MAAM,SAAS,iBAAiB;AAMnC,gBAAM,KAAK,iCAAiC,MAAM,OAAO,SAAS,CAAC;AACnE;AAAA,QACD;AACA,cAAM,EAAE,MAAM,GAAG,IAAA,IAAQ;AACzB,cAAM;AAAA,UACL,gBAAgB,IAAI,MAAM,WAAW,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,KAAK,KAAK,UAAU,GAAG,CAAC;AAAA,QAAA;AAAA,MAE5F;AAMA,UAAI,kBAAkB,IAAI,SAAS,GAAG;AACrC,cAAM,KAAK,iBAAiB;AAAA,MAC7B;AACA,aAAO,MAAM,KAAK,IAAI;AAAA,IACvB;AAAA,EAAA;AAED,SAAO,OAAO,OAAO,QAAQ,EAAE,kBAAkB;AAClD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sources":["../../../src/providers/shared/normalize-mcp-response.ts","../../../src/providers/lds/runtime.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\n\n/**\n * Unwraps the MCP tool transport envelope and returns the tool's payload as-is.\n *\n * Handles the three surface shapes `sdk.callTool()` can resolve with:\n * - MCP Apps surface: `{ structuredContent, content }`\n * - OpenAI surface: `{ result: \"<JSON string>\" }`, where the JSON may itself be\n * an MCP content array (`[{ type: 'text', text: \"<JSON string>\" }, ...]`)\n * - Fallback: the raw value returned by `callTool`\n *\n * The shape of the unwrapped payload is the tool's responsibility — this helper\n * does not project out `data` / `error` / `errors`. Callers read whichever keys\n * their tool contract defines.\n */\nexport function normalizeMcpResponse(raw: unknown): unknown {\n\tif (raw && typeof raw === \"object\" && \"structuredContent\" in raw) {\n\t\treturn (raw as { structuredContent: unknown }).structuredContent;\n\t}\n\n\tif (raw && typeof raw === \"object\" && typeof (raw as { result?: unknown }).result === \"string\") {\n\t\tconst parsed = JSON.parse((raw as { result: string }).result);\n\t\tif (Array.isArray(parsed)) {\n\t\t\tconst textBlock = parsed.find(\n\t\t\t\t(b: { type?: string; text?: string }) =>\n\t\t\t\t\tb && b.type === \"text\" && typeof b.text === \"string\",\n\t\t\t);\n\t\t\tconst text = textBlock ? textBlock.text : null;\n\t\t\tif (text) {\n\t\t\t\treturn JSON.parse(text);\n\t\t\t}\n\t\t\treturn {};\n\t\t}\n\t\treturn parsed;\n\t}\n\n\treturn raw ?? {};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { ResultCommand, SubscribableResultCommand } from \"@conduit-client/bindings-utils/v1\";\nimport type { assertIsValid, JSONSchema } from \"@conduit-client/jsonschema-validate\";\nimport {\n\tbuildDefaultImperativeBindingsServiceDescriptor,\n\tbuildLegacyImperativeBindingsServiceDescriptor,\n\tbuildQueryImperativeBindingsServiceDescriptor,\n\tbuildSubscribableImperativeBindingsServiceDescriptor,\n} from \"@conduit-client/service-bindings-imperative/v1\";\nimport { buildLWCWireBindingsServiceDescriptor } from \"@conduit-client/service-bindings-lwc/v1\";\nimport {\n\tbuildSubscribableResult,\n\terr,\n\tok,\n\ttoError,\n\tUserVisibleError,\n\ttype Callback,\n\ttype Result,\n\ttype Unsubscribe,\n} from \"@conduit-client/utils\";\nimport { getChatSDK } from \"@salesforce/platform-sdk\";\nimport type { ReadInvokerShape } from \"./types\";\nimport { normalizeMcpResponse } from \"../shared/normalize-mcp-response\";\n\n/**\n * Runtime mirror of the public `LdsAdapterConfigBase` — adapters dispatch\n * through `cfg.mcp?.toolName`. Kept nominal-free so the virtual module can\n * cheaply deserialize the JSON-stringified config written by the load hook.\n */\ninterface McpBackedAdapterConfig {\n\tmcp?: { toolName: string };\n}\n\n/**\n * LDS adapter configs whose input is validated against a JSON Schema at\n * invoke time. Wire, mutation, and read factories all consume this shape;\n * graphql factories skip the schema layer entirely.\n */\ninterface SchemaValidatedAdapterConfig extends McpBackedAdapterConfig {\n\tconfigJsonSchema: JSONSchema;\n}\n\ntype WireAdapterConfig = SchemaValidatedAdapterConfig;\n\ntype MutationAdapterConfig = SchemaValidatedAdapterConfig;\n\ninterface ReadAdapterConfig extends SchemaValidatedAdapterConfig {\n\tinvokerShape: ReadInvokerShape;\n}\n\n/**\n * Resolves the MCP tool name for an adapter config, or throws if none of the\n * supported backings are set. Today only `mcp` is wired up; future backings\n * (e.g. `http`) will be resolved in the same choke point.\n */\nfunction resolveMcpToolName(adapterName: string, cfg: McpBackedAdapterConfig): string {\n\tconst toolName = cfg.mcp?.toolName;\n\tif (!toolName) {\n\t\tthrow new Error(`[${adapterName}] no dispatch backing configured — expected \\`mcp.toolName\\`.`);\n\t}\n\treturn toolName;\n}\n\n/**\n * Optional envelope splitter. Converts the normalized MCP payload into a\n * `Result<Data, Error>` — used by the wire adapter so tools that return\n * `{ data, error }` land on OneStore's Err branch when `error` is set.\n * Imperative callers leave this unset and get the raw payload wrapped in\n * `ok(...)`.\n */\ntype UnwrapEnvelope<Data> = (payload: unknown) => Result<Data, Error>;\n\n/**\n * Resolves the MCP chat SDK and returns its `callTool` function, or throws a\n * consistent \"[adapter] sdk.callTool is not available\" error. Shared by the\n * LDS `McpToolCommand` and the graphql `runGraphqlQuery` — the check and\n * message are identical on both paths.\n */\nasync function getCallTool(\n\tadapterName: string,\n): Promise<(args: { toolName: string; params?: Record<string, unknown> }) => Promise<unknown>> {\n\tconst sdk = await getChatSDK();\n\tif (typeof sdk.callTool !== \"function\") {\n\t\tthrow new Error(\n\t\t\t`[${adapterName}] sdk.callTool is not available on this surface. ` +\n\t\t\t\t\"Make sure window.openai is configured or the component is running \" +\n\t\t\t\t\"in an MCP Apps / OpenAI chat context.\",\n\t\t);\n\t}\n\treturn sdk.callTool.bind(sdk);\n}\n\n/**\n * Pulls a human-readable message out of an MCP error response\n * (`{ isError: true, content: [{ type: 'text', text: ... }, ...] }`).\n * Returns an empty string if no text content is present so the caller can\n * supply a fallback.\n */\nfunction extractToolErrorText(raw: unknown): string {\n\tconst content = (raw as { content?: unknown }).content;\n\tif (!Array.isArray(content)) return \"\";\n\treturn content\n\t\t.map((c) => {\n\t\t\tif (c && typeof c === \"object\" && (c as { type?: string }).type === \"text\") {\n\t\t\t\treturn (c as { text?: string }).text ?? \"\";\n\t\t\t}\n\t\t\treturn \"\";\n\t\t})\n\t\t.join(\" \")\n\t\t.trim();\n}\n\n/**\n * `Command` implementation that calls the configured MCP tool. One class,\n * reused across imperative and wire adapters.\n *\n * `execute()` returns a `Result<Data, unknown>`:\n * - `ok(data)` when the tool resolves — `data` is the unwrapped payload from\n * `normalizeMcpResponse` (or the result of the optional `unwrap` hook).\n * - `err(error)` when the tool rejects, when `sdk.callTool` is unavailable,\n * or when the `unwrap` hook returns `err(...)`.\n *\n * OneStore's `DefaultImperativeBindingsService` wraps this: on `ok(v)` it\n * deep-freezes and returns `v`; on `err(e)` it re-throws via `toError`. Sync\n * throws from `assertIsValid` in the `getCommand` factory are funneled through\n * `throwUserlandError`. `LWCWireBindingsService` wraps the same command\n * differently — it emits `{ data, error }` to the wire callback and attaches\n * freeze / race-guard / incomplete-config behavior.\n */\nclass McpToolCommand<Data> implements ResultCommand<Data, Error> {\n\tconstructor(\n\t\tprivate readonly adapterName: string,\n\t\tprivate readonly toolName: string,\n\t\tprivate readonly params: unknown,\n\t\tprivate readonly unwrap?: UnwrapEnvelope<Data>,\n\t) {}\n\n\tasync execute(): Promise<Result<Data, Error>> {\n\t\ttry {\n\t\t\tconst callTool = await getCallTool(this.adapterName);\n\t\t\tconst raw = await callTool({\n\t\t\t\ttoolName: this.toolName,\n\t\t\t\tparams: (this.params as Record<string, unknown>) ?? undefined,\n\t\t\t});\n\t\t\t// The MCP SDK converts handler throws into a resolved tool response\n\t\t\t// with `{ isError: true, content: [...] }` — not a transport\n\t\t\t// rejection. Surface it as an Err here so the default invoker\n\t\t\t// re-throws and the wire/legacy adapters route it through their\n\t\t\t// error channel.\n\t\t\tif (raw && typeof raw === \"object\" && (raw as { isError?: boolean }).isError) {\n\t\t\t\treturn err(new Error(extractToolErrorText(raw) || \"MCP tool error\"));\n\t\t\t}\n\t\t\tconst payload = normalizeMcpResponse(raw);\n\t\t\treturn this.unwrap ? this.unwrap(payload) : ok(payload as Data);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e : new Error(String(e)));\n\t\t}\n\t}\n}\n\n// Off-platform has no store to observe. For shapes that have no `refresh`,\n// nothing can ever trigger a post-initial update, so `subscribe` is a\n// deliberate no-op: the callback never fires and the returned unsubscribe is\n// idempotent. Shapes that *do* expose `refresh` wire subscribers into the\n// refresh path instead (see `McpToolSubscribableCommand` and the\n// `query-refreshable` graphql shape).\nconst noopUnsubscribe: Unsubscribe = () => {\n\t// no store to unsubscribe from off-platform\n};\nconst noopSubscribe = (_cb: unknown): Unsubscribe => noopUnsubscribe;\n\n/**\n * Adapts `McpToolCommand` into a `SubscribableResultCommand`. Wraps the\n * command's `Result` with `buildSubscribableResult`, supplying:\n * - `subscribe`: per-execution subscriber set. Each `execute()` call has\n * its own set so sibling invocations don't cross-pollinate. Returned\n * unsubscribe removes the callback and is idempotent.\n * - `refresh`: builds a fresh `McpToolCommand`, re-executes it, and\n * broadcasts the fresh `Result` to every registered subscriber before\n * resolving. Returns `Result<void, Error>` (ok → undefined; err → the\n * error from the fresh execute).\n *\n * Wiring subscribers into refresh mirrors on-platform behavior, where the\n * reactive store fans `refresh` results out to every listener. Off-platform\n * there is no store, so the subscriber set lives on the command itself. This\n * shim is what lets OneStore's Subscribable and Legacy services run verbatim\n * against MCP: their invokers gate on `isSubscribableResult`, which requires\n * the command's `execute()` to resolve a `SubscribableResult` (not a plain\n * `Result`).\n */\nclass McpToolSubscribableCommand<Data> implements SubscribableResultCommand<Data, Error> {\n\tconstructor(\n\t\tprivate readonly adapterName: string,\n\t\tprivate readonly toolName: string,\n\t\tprivate readonly params: unknown,\n\t\tprivate readonly unwrap?: UnwrapEnvelope<Data>,\n\t) {}\n\n\tasync execute() {\n\t\tconst base = new McpToolCommand<Data>(\n\t\t\tthis.adapterName,\n\t\t\tthis.toolName,\n\t\t\tthis.params,\n\t\t\tthis.unwrap,\n\t\t);\n\t\tconst result = await base.execute();\n\t\tconst subscribers = new Set<Callback<Result<Data, Error>>>();\n\t\tconst subscribe = (cb: Callback<Result<Data, Error>>): Unsubscribe => {\n\t\t\tsubscribers.add(cb);\n\t\t\treturn () => {\n\t\t\t\tsubscribers.delete(cb);\n\t\t\t};\n\t\t};\n\t\tconst refresh = async () => {\n\t\t\tconst next = await new McpToolCommand<Data>(\n\t\t\t\tthis.adapterName,\n\t\t\t\tthis.toolName,\n\t\t\t\tthis.params,\n\t\t\t\tthis.unwrap,\n\t\t\t).execute();\n\t\t\tsubscribers.forEach((cb) => cb(next));\n\t\t\treturn next.isOk() ? ok<void, Error>(undefined) : err(next.error);\n\t\t};\n\t\treturn buildSubscribableResult(result, subscribe, refresh);\n\t}\n}\n\n/**\n * Off-core graphql state-manager command factory. Returned function feeds\n * `createSmGraphQL(getCommand)` from\n * `@salesforce/lds-adapters-onestore-graphql/factory` — i.e. it intentionally\n * bypasses on-core's `_conduit_client_service_provisioner_v1` services\n * pipeline (instrumentation, normalized cache control, type registry,\n * `assertIsValid`, `resolveAndValidateGraphQLConfig`) and dispatches the\n * graphql query as a plain MCP tool call.\n *\n * The returned per-config command's `execute()` resolves a `Result` whose\n * shape matches what `createStateManager`'s `processQueuedConfig` expects\n * (the upstream `createSmGraphQL` wraps `createStateManager`):\n *\n * - `ok({ data: { data: <payload> }, subscribe, refresh })` — `processQueuedConfig`\n * reads `result.value.data.data` (the payload) and binds\n * `result.value.refresh` for the outer `refresh()` action.\n * - `err({ failure: UserVisibleError-with-{data: GraphQLResponse} })` —\n * `processQueuedConfig` calls `toGraphQLResponseFromFailure(result.error.failure)`\n * which extracts `.data.errors` from the `UserVisibleError`'s data field.\n *\n * `subscribe` and `refresh` are inherited verbatim from\n * `McpToolSubscribableCommand` (per-execution subscriber set, refresh\n * re-executes the tool and broadcasts to subscribers — matches the\n * on-platform contract from a state-manager-consumer perspective).\n *\n * @param name - State-manager name (`'default'` for `lightning/stateManagerGraphQL`).\n * @param cfg - Carries `mcp.toolName`. No `configJsonSchema`: this path\n * deliberately forgoes the on-core schema/`assertIsValid`/\n * `resolveAndValidateGraphQLConfig` validation layer for now;\n * malformed configs surface as MCP tool errors at execute time.\n */\nexport function createGraphqlStateManagerCommand(name: string, cfg: McpBackedAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn (config: GraphqlConfig) => ({\n\t\tasync execute() {\n\t\t\tconst base = new McpToolSubscribableCommand<GraphqlResult>(name, toolName, {\n\t\t\t\tquery: config.query,\n\t\t\t\tvariables: config.variables ?? {},\n\t\t\t\t...(config.operationName !== undefined && { operationName: config.operationName }),\n\t\t\t});\n\t\t\tconst subscribable = await base.execute();\n\t\t\tif (subscribable.isOk()) {\n\t\t\t\treturn ok(subscribable.value);\n\t\t\t}\n\t\t\t// Reshape inner `failure: Error` → `failure: UserVisibleError-with-data`\n\t\t\t// so upstream `toGraphQLResponseFromFailure(result.error.failure)`\n\t\t\t// pulls the MCP error message into `errors[0].message`. Keep the\n\t\t\t// surrounding subscribe/refresh envelope intact so the error value\n\t\t\t// is still a valid `SubscribableBase & { failure }`.\n\t\t\tconst innerError = subscribable.error.failure;\n\t\t\tconst message = innerError.message;\n\t\t\tconst userVisible = new UserVisibleError<GraphqlResult>({\n\t\t\t\tdata: undefined,\n\t\t\t\terrors: [{ message }],\n\t\t\t});\n\t\t\tuserVisible.message = message;\n\t\t\treturn err({ ...subscribable.error, failure: userVisible });\n\t\t},\n\t});\n}\n\nconst defaultImperativeService = buildDefaultImperativeBindingsServiceDescriptor().service;\nconst queryImperativeService = buildQueryImperativeBindingsServiceDescriptor().service;\nconst subscribableImperativeService =\n\tbuildSubscribableImperativeBindingsServiceDescriptor().service;\nconst legacyImperativeService = buildLegacyImperativeBindingsServiceDescriptor().service;\n\n/**\n * Mutation-shape factory. Builds an async `(config) => Promise<Data>` via\n * OneStore's `DefaultImperativeBindingsService`. Throws on validation error\n * (`throwUserlandError`) or tool error (`toError`). This is the only shape a\n * mutation ever takes on platform — mutation adapters do not carry an\n * `invokerShape` at all.\n */\nexport function createMutationAdapter(name: string, cfg: MutationAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\tconst getCommand = (options: { params: unknown[]; assertIsValid: typeof assertIsValid }) => {\n\t\toptions.assertIsValid(options.params[0], cfg.configJsonSchema);\n\t\treturn new McpToolCommand<unknown>(name, toolName, options.params[0]);\n\t};\n\tconst invoker = defaultImperativeService.bind<unknown[], unknown>(getCommand);\n\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n}\n\n/**\n * Read-shape factory. Dispatches on `cfg.invokerShape`:\n *\n * - `legacy` — `{ invoke, subscribe }` callback surface with `{ data, error }`.\n * `subscribe` fires the callback once from the initial execute's `data`,\n * returns a no-op unsubscribe, and never fires again off-platform.\n * - `query` — `(config) => Promise<{ data }>`; one-shot read.\n * - `subscribable` — `(config) => Promise<{ data, subscribe }>`. Callback\n * passed to `subscribe` never fires; unsubscribe is a no-op.\n * - `subscribable-refreshable` — `(config) => Promise<{ data, subscribe, refresh }>`.\n * `refresh()` re-executes the MCP tool; `subscribe` is still a no-op.\n *\n * All four delegate to an OneStore service (Query / Subscribable / Legacy)\n * over `McpToolSubscribableCommand`, which preserves OneStore's deep-freeze\n * and error-funnel semantics end-to-end.\n */\nexport function createReadAdapter(name: string, cfg: ReadAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\tconst getSubscribableCommand = (options: {\n\t\tparams: unknown[];\n\t\tassertIsValid: typeof assertIsValid;\n\t}) => {\n\t\toptions.assertIsValid(options.params[0], cfg.configJsonSchema);\n\t\treturn new McpToolSubscribableCommand<unknown>(name, toolName, options.params[0]);\n\t};\n\n\tswitch (cfg.invokerShape) {\n\t\tcase \"query\": {\n\t\t\tconst getCommand = (options: { params: unknown[]; assertIsValid: typeof assertIsValid }) => {\n\t\t\t\toptions.assertIsValid(options.params[0], cfg.configJsonSchema);\n\t\t\t\treturn new McpToolCommand<unknown>(name, toolName, options.params[0]);\n\t\t\t};\n\t\t\tconst invoker = queryImperativeService.bind<unknown[], unknown>(getCommand);\n\t\t\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n\t\t}\n\t\tcase \"subscribable\": {\n\t\t\tconst invoker = subscribableImperativeService.bind<unknown[], unknown>(\n\t\t\t\tgetSubscribableCommand,\n\t\t\t\tfalse,\n\t\t\t);\n\t\t\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n\t\t}\n\t\tcase \"subscribable-refreshable\": {\n\t\t\tconst invoker = subscribableImperativeService.bind<unknown[], unknown>(\n\t\t\t\tgetSubscribableCommand,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n\t\t}\n\t\tcase \"legacy\": {\n\t\t\t// Legacy service passes `{ config, assertIsValid }`, not `{ params, ... }`.\n\t\t\tconst getLegacyCommand = (options: {\n\t\t\t\tconfig: unknown;\n\t\t\t\tassertIsValid: typeof assertIsValid;\n\t\t\t}) => {\n\t\t\t\toptions.assertIsValid(options.config, cfg.configJsonSchema);\n\t\t\t\treturn new McpToolSubscribableCommand<unknown>(name, toolName, options.config);\n\t\t\t};\n\t\t\treturn legacyImperativeService.bind<unknown, unknown>(getLegacyCommand);\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t`[${name}] unsupported invokerShape: ${String((cfg as { invokerShape: unknown }).invokerShape)}. ` +\n\t\t\t\t\t`Expected 'legacy' | 'query' | 'subscribable' | 'subscribable-refreshable'.`,\n\t\t\t);\n\t}\n}\n\nconst lwcWireBindingsService = buildLWCWireBindingsServiceDescriptor().service;\n\n/**\n * Splits the MCP tool's `{ data, error }` envelope into a `Result`. Used as\n * the `unwrap` hook on `McpToolCommand` so OneStore's wire invoker sees the\n * error branch directly instead of receiving an envelope wrapped in `ok(...)`.\n *\n * Tools that don't emit the envelope (e.g. imperative) never go through this\n * path — the default imperative invoker doesn't pass `unwrap`.\n */\nfunction unwrapWireEnvelope<Data>(payload: unknown): Result<Data, Error> {\n\tconst envelope = payload as { data?: unknown; error?: unknown } | null | undefined;\n\tif (envelope && envelope.error !== undefined && envelope.error !== null) {\n\t\treturn err(toError(envelope.error));\n\t}\n\treturn ok(envelope?.data as Data);\n}\n\n/**\n * Creates an LWC wire adapter class that calls an MCP tool. Delegates to\n * OneStore's `LWCWireBindingsService`, so the returned class inherits the\n * full `CommandWireAdapterConstructor` contract: initial empty emit, config\n * `sanitize()`, `MissingRequiredPropertyError` → wait-for-next-config gating,\n * deep-freeze on success, race guard on stale resolves, and unsubscriber\n * management on disconnect.\n *\n * The `McpToolCommand` class is reused verbatim — the wire call-site only\n * supplies an `unwrap` hook so the tool's `{ data, error }` envelope lands\n * on OneStore's Err branch rather than being leaked through as an `ok(...)`\n * envelope.\n *\n * @param name - Wire adapter export name, used in MCP error messages.\n * @param cfg - MCP tool name and JSON Schema for valid wire configs.\n */\nexport function createWireAdapter(name: string, cfg: WireAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn lwcWireBindingsService.bind<unknown>(\n\t\t(config) => new McpToolCommand(name, toolName, config, unwrapWireEnvelope),\n\t\tcfg.configJsonSchema,\n\t);\n}\n\n// ─── GraphQL adapters ─────────────────────────────────────────────────────────\n\n/**\n * GraphQL adapters diverge from the base wire / mutation shapes in two ways:\n *\n * 1. Envelope is `{ data, errors[] }` instead of `{ data, error }`. Errors\n * are collected; an empty array collapses to `undefined`.\n * 2. The `_fetch` path routes thrown errors **into** the `errors[]`\n * envelope on the wire callback (never throws to the LWC host). Mutation\n * likewise resolves with `{ data, errors }` rather than rejecting.\n *\n * Dispatch is MCP-only: `getChatSDK().callTool({ toolName, params })` with\n * `normalizeMcpResponse` unwrapping. No `globalThis.__sfdc_sdk__` shortcut —\n * the on-platform behaviour is already covered by real `lightning/graphql`,\n * and every off-platform caller routes through an MCP tool like every other\n * LDS adapter.\n */\ntype GraphqlAdapterConfig = McpBackedAdapterConfig;\n\ninterface GraphqlConfig {\n\tquery: string;\n\tvariables?: Record<string, unknown>;\n\toperationName?: string;\n}\n\ninterface GraphqlResult {\n\tdata?: unknown;\n\terrors?: { message: string }[];\n}\n\ntype GraphqlWireCallback = (result: {\n\tdata: unknown;\n\terrors: { message: string }[] | undefined;\n\trefresh: () => Promise<void>;\n}) => void;\n\n/**\n * Template-literal tag that stitches the string into a plain `query` string.\n * Deliberately minimal — no AST parsing, no fragment substitution, no opaque\n * doc emulation. Matches the shape used by today's off-platform `gql`.\n */\nexport function gql(strings: TemplateStringsArray, ...values: unknown[]): string {\n\tlet result = \"\";\n\tstrings.forEach((string, i) => {\n\t\tresult += string;\n\t\tif (i < values.length) result += String(values[i]);\n\t});\n\treturn result.trim();\n}\n\nasync function runGraphqlQuery(\n\tadapterName: string,\n\ttoolName: string,\n\tconfig: GraphqlConfig,\n): Promise<GraphqlResult> {\n\tconst { query, variables, operationName } = config;\n\tif (!query) return { data: undefined, errors: undefined };\n\n\tconst callTool = await getCallTool(adapterName);\n\tconst raw = await callTool({\n\t\ttoolName,\n\t\tparams: {\n\t\t\tquery,\n\t\t\tvariables: variables ?? {},\n\t\t\t...(operationName !== undefined && { operationName }),\n\t\t},\n\t});\n\n\treturn (normalizeMcpResponse(raw) as GraphqlResult) ?? {};\n}\n\n/** Wraps a thrown Error into the graphql `{ data, errors[] }` envelope. */\nfunction toGraphqlErrorResult(error: unknown): GraphqlResult {\n\treturn { data: undefined, errors: [{ message: (error as Error).message }] };\n}\n\n/**\n * `runGraphqlQuery` wrapped in try/catch so thrown errors land on `errors[]`\n * instead of rejecting. Used by every graphql shape that routes errors\n * in-band (wire, mutation, imperative-read query/query-refreshable, legacy).\n */\nasync function runGraphqlQuerySafe(\n\tadapterName: string,\n\ttoolName: string,\n\tconfig: GraphqlConfig,\n): Promise<GraphqlResult> {\n\ttry {\n\t\treturn await runGraphqlQuery(adapterName, toolName, config);\n\t} catch (error) {\n\t\treturn toGraphqlErrorResult(error);\n\t}\n}\n\n/**\n * GraphQL wire adapter factory. Emits `{ data, errors, refresh }` to the wire\n * callback. Mirrors the `constructor(callback)` → `connect` / `disconnect` /\n * `update(config)` / `refresh()` contract used by the LWC wire service.\n * Thrown fetch errors are routed into `errors[0].message`.\n *\n * `_fetch` is gated on `_connected` so that the common wire lifecycle\n * (`constructor` → `update(config)` → `connect`) doesn't fire two requests:\n * the initial `update(config)` arrives before `connect()`, stores the config,\n * and waits. `connect()` does the one fetch; later `update(config)` while\n * connected re-fetches. This matches luvio's `LWCLuvioWireAdapter`, which\n * gates on the same flag to prevent duplicate endpoint calls.\n */\nexport function createGraphQLWireAdapter(name: string, cfg: GraphqlAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn class {\n\t\t_dataCallback: GraphqlWireCallback;\n\t\t_config: GraphqlConfig | undefined;\n\t\t_connected = false;\n\n\t\tconstructor(dataCallback: GraphqlWireCallback) {\n\t\t\tthis._dataCallback = dataCallback;\n\t\t}\n\n\t\tconnect() {\n\t\t\tthis._connected = true;\n\t\t\tvoid this._fetch();\n\t\t}\n\n\t\tdisconnect() {\n\t\t\tthis._connected = false;\n\t\t}\n\n\t\tupdate(config: GraphqlConfig | undefined) {\n\t\t\tthis._config = config;\n\n\t\t\tif (!this._connected || this._config === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvoid this._fetch();\n\t\t}\n\n\t\trefresh() {\n\t\t\treturn this._fetch();\n\t\t}\n\n\t\tasync _fetch() {\n\t\t\tthis._emit(await runGraphqlQuerySafe(name, toolName, this._config ?? { query: \"\" }));\n\t\t}\n\n\t\t_emit({ data, errors }: GraphqlResult) {\n\t\t\tthis._dataCallback({\n\t\t\t\tdata,\n\t\t\t\terrors: errors?.length ? errors : undefined,\n\t\t\t\trefresh: () => this.refresh(),\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * GraphQL mutation factory. Returns `async (config) => Promise<{ data, errors }>`.\n * Empty-query guard short-circuits with\n * `{ data: undefined, errors: [{ message: \"No query provided\" }] }`.\n * All other errors are routed in-band to the `errors[]` envelope — the\n * function never rejects.\n */\nexport function createGraphQLMutationAdapter(name: string, cfg: GraphqlAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn async (config: GraphqlConfig): Promise<GraphqlResult> => {\n\t\tif (!config?.query) return { data: undefined, errors: [{ message: \"No query provided\" }] };\n\t\treturn runGraphqlQuerySafe(name, toolName, config);\n\t};\n}\n\ntype GraphqlImperativeReadInvokerShape = \"query\" | \"query-refreshable\" | \"legacy\";\n\ninterface GraphqlImperativeReadAdapterConfig extends GraphqlAdapterConfig {\n\tinvokerShape: GraphqlImperativeReadInvokerShape;\n}\n\ntype GraphqlImperativeResult = GraphqlResult & {\n\tsubscribe?: (cb: (result: GraphqlResult) => void) => Unsubscribe;\n\trefresh?: () => Promise<void>;\n};\n\ntype LegacyGraphqlCallback = (result: GraphqlResult) => void;\n\n/**\n * Imperative GraphQL read factory — single entry point for all imperative\n * graphql read shapes, mirroring the LDS `createReadAdapter` pattern. The\n * `invokerShape` selects the return surface:\n *\n * - `query` — `async (config) => Promise<{ data, errors, subscribe }>`.\n * Mirrors on-platform `GraphQLImperativeBindingsService` without\n * `exposeRefresh`. Errors are routed in-band; the function never throws.\n * - `query-refreshable` — same as `query` plus `refresh()` that re-runs the\n * underlying MCP tool. Mirrors the same service with `exposeRefresh: true`.\n * - `legacy` — `{ invoke(config, context, callback),\n * subscribe(config, context, callback): Unsubscribe }`. The callback\n * always receives `{ data, errors }`; neither method throws. `context` is\n * accepted but ignored.\n *\n * In every shape `subscribe` is a deliberate no-op off-platform (no reactive\n * store); returned unsubscribes are idempotent.\n */\nexport function createGraphQLImperativeReadAdapter(\n\tname: string,\n\tcfg: GraphqlImperativeReadAdapterConfig,\n) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\tif (cfg.invokerShape === \"legacy\") {\n\t\tasync function run(\n\t\t\tconfig: GraphqlConfig | undefined,\n\t\t\tcallback: LegacyGraphqlCallback,\n\t\t): Promise<void> {\n\t\t\tif (!config?.query) {\n\t\t\t\tcallback({ data: undefined, errors: undefined });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await runGraphqlQuerySafe(name, toolName, config);\n\t\t\tcallback({\n\t\t\t\tdata: result.data,\n\t\t\t\terrors: result.errors?.length ? result.errors : undefined,\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tinvoke(\n\t\t\t\tconfig: GraphqlConfig | undefined,\n\t\t\t\t_context: unknown,\n\t\t\t\tcallback: LegacyGraphqlCallback,\n\t\t\t): void {\n\t\t\t\tvoid run(config, callback);\n\t\t\t},\n\t\t\tsubscribe(\n\t\t\t\tconfig: GraphqlConfig | undefined,\n\t\t\t\t_context: unknown,\n\t\t\t\tcallback: LegacyGraphqlCallback,\n\t\t\t): Unsubscribe {\n\t\t\t\tvoid run(config, callback);\n\t\t\t\treturn noopUnsubscribe;\n\t\t\t},\n\t\t};\n\t}\n\n\tif (cfg.invokerShape === \"query-refreshable\") {\n\t\t// Per-invocation subscriber set: each call to the returned function\n\t\t// gets its own adapter instance with an isolated subscriber list.\n\t\t// `refresh()` re-runs the MCP tool and broadcasts the fresh\n\t\t// `{ data, errors }` to every registered callback, which mirrors the\n\t\t// on-platform contract where `refresh` causes store updates that fan\n\t\t// out through the `subscribe` fan-in. Without this wiring, `refresh`\n\t\t// would re-run the query off-platform but nothing could observe the\n\t\t// new payload (no store, noop subscribe).\n\t\treturn async (config: GraphqlConfig): Promise<GraphqlImperativeResult> => {\n\t\t\tconst result = await runGraphqlQuerySafe(name, toolName, config);\n\t\t\tif (result.errors?.length) {\n\t\t\t\treturn { data: undefined, errors: result.errors };\n\t\t\t}\n\t\t\tconst subscribers = new Set<(result: GraphqlResult) => void>();\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\terrors: undefined,\n\t\t\t\tsubscribe: (cb) => {\n\t\t\t\t\tsubscribers.add(cb);\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tsubscribers.delete(cb);\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\trefresh: async () => {\n\t\t\t\t\tconst fresh = await runGraphqlQuerySafe(name, toolName, config);\n\t\t\t\t\tconst payload: GraphqlResult = {\n\t\t\t\t\t\tdata: fresh.data,\n\t\t\t\t\t\terrors: fresh.errors?.length ? fresh.errors : undefined,\n\t\t\t\t\t};\n\t\t\t\t\tsubscribers.forEach((cb) => cb(payload));\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\t}\n\n\t// `query` shape: no refresh → nothing can trigger a post-initial update\n\t// off-platform, so `subscribe` stays a noop. The on-platform contract\n\t// allows subscribe callbacks to fire from unrelated store writes; off-\n\t// platform there is no store, so the callback is correctly unreachable.\n\treturn async (config: GraphqlConfig): Promise<GraphqlImperativeResult> => {\n\t\tconst result = await runGraphqlQuerySafe(name, toolName, config);\n\t\tif (result.errors?.length) {\n\t\t\treturn { data: undefined, errors: result.errors };\n\t\t}\n\t\treturn {\n\t\t\tdata: result.data,\n\t\t\terrors: undefined,\n\t\t\tsubscribe: noopSubscribe,\n\t\t};\n\t};\n}\n"],"names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AAS,MAAM,SAAS;AAAA,UAAA;AAE/C,sBAAY,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAAA,QACxC;AAAA,MAAA;AAAA,IAEF;AAAA,EACD;AAMA,SAAO,OAAO,WAA4D;AACzE,UAAM,SAAS,MAAM,oBAAoB,MAAM,UAAU,MAAM;AAC/D,QAAI,OAAO,QAAQ,QAAQ;AAC1B,aAAO,EAAE,MAAM,QAAW,QAAQ,OAAO,OAAA;AAAA,IAC1C;AACA,WAAO;AAAA,MACN,MAAM,OAAO;AAAA,MACb,QAAQ;AAAA,MACR,WAAW;AAAA,IAAA;AAAA,EAEb;AACD;"}
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../../../src/providers/shared/normalize-mcp-response.ts","../../../src/providers/lds/runtime.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\n\n/**\n * Unwraps the MCP tool transport envelope and returns the tool's payload as-is.\n *\n * Handles the three surface shapes `sdk.callTool()` can resolve with:\n * - MCP Apps surface: `{ structuredContent, content }`\n * - OpenAI surface: `{ result: \"<JSON string>\" }`, where the JSON may itself be\n * an MCP content array (`[{ type: 'text', text: \"<JSON string>\" }, ...]`)\n * - Fallback: the raw value returned by `callTool`\n *\n * The shape of the unwrapped payload is the tool's responsibility — this helper\n * does not project out `data` / `error` / `errors`. Callers read whichever keys\n * their tool contract defines.\n */\nexport function normalizeMcpResponse(raw: unknown): unknown {\n\tif (raw && typeof raw === \"object\" && \"structuredContent\" in raw) {\n\t\treturn (raw as { structuredContent: unknown }).structuredContent;\n\t}\n\n\tif (raw && typeof raw === \"object\" && typeof (raw as { result?: unknown }).result === \"string\") {\n\t\tconst parsed = JSON.parse((raw as { result: string }).result);\n\t\tif (Array.isArray(parsed)) {\n\t\t\tconst textBlock = parsed.find(\n\t\t\t\t(b: { type?: string; text?: string }) =>\n\t\t\t\t\tb && b.type === \"text\" && typeof b.text === \"string\",\n\t\t\t);\n\t\t\tconst text = textBlock ? textBlock.text : null;\n\t\t\tif (text) {\n\t\t\t\treturn JSON.parse(text);\n\t\t\t}\n\t\t\treturn {};\n\t\t}\n\t\treturn parsed;\n\t}\n\n\treturn raw ?? {};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { ResultCommand, SubscribableResultCommand } from \"@conduit-client/bindings-utils/v1\";\nimport type { assertIsValid, JSONSchema } from \"@conduit-client/jsonschema-validate\";\nimport {\n\tbuildDefaultImperativeBindingsServiceDescriptor,\n\tbuildLegacyImperativeBindingsServiceDescriptor,\n\tbuildQueryImperativeBindingsServiceDescriptor,\n\tbuildSubscribableImperativeBindingsServiceDescriptor,\n} from \"@conduit-client/service-bindings-imperative/v1\";\nimport { buildLWCWireBindingsServiceDescriptor } from \"@conduit-client/service-bindings-lwc/v1\";\nimport {\n\tbuildSubscribableResult,\n\terr,\n\tok,\n\ttoError,\n\tUserVisibleError,\n\ttype Callback,\n\ttype Result,\n\ttype Unsubscribe,\n} from \"@conduit-client/utils\";\nimport { getChatSDK } from \"@salesforce/platform-sdk\";\nimport type { ReadInvokerShape } from \"./types\";\nimport { normalizeMcpResponse } from \"../shared/normalize-mcp-response\";\n\n/**\n * Runtime mirror of the public `LdsRegistryEntryBase` — adapters dispatch\n * through `cfg.mcp?.toolName`. Kept nominal-free so the virtual module can\n * cheaply deserialize the JSON-stringified config written by the load hook.\n */\ninterface McpBackedAdapterConfig {\n\tmcp?: { toolName: string };\n}\n\n/**\n * LDS adapter configs whose input is validated against a JSON Schema at\n * invoke time. Wire, mutation, and read factories all consume this shape;\n * graphql factories skip the schema layer entirely.\n */\ninterface SchemaValidatedAdapterConfig extends McpBackedAdapterConfig {\n\tconfigJsonSchema: JSONSchema;\n}\n\ntype WireAdapterConfig = SchemaValidatedAdapterConfig;\n\ntype MutationAdapterConfig = SchemaValidatedAdapterConfig;\n\ninterface ReadAdapterConfig extends SchemaValidatedAdapterConfig {\n\tinvokerShape: ReadInvokerShape;\n}\n\n/**\n * Resolves the MCP tool name for an adapter config, or throws if none of the\n * supported backings are set. Today only `mcp` is wired up; future backings\n * (e.g. `http`) will be resolved in the same choke point.\n */\nfunction resolveMcpToolName(adapterName: string, cfg: McpBackedAdapterConfig): string {\n\tconst toolName = cfg.mcp?.toolName;\n\tif (!toolName) {\n\t\tthrow new Error(`[${adapterName}] no dispatch backing configured — expected \\`mcp.toolName\\`.`);\n\t}\n\treturn toolName;\n}\n\n/**\n * Optional envelope splitter. Converts the normalized MCP payload into a\n * `Result<Data, Error>` — used by the wire adapter so tools that return\n * `{ data, error }` land on OneStore's Err branch when `error` is set.\n * Imperative callers leave this unset and get the raw payload wrapped in\n * `ok(...)`.\n */\ntype UnwrapEnvelope<Data> = (payload: unknown) => Result<Data, Error>;\n\n/**\n * Resolves the MCP chat SDK and returns its `callTool` function, or throws a\n * consistent \"[adapter] sdk.callTool is not available\" error. Shared by the\n * LDS `McpToolCommand` and the graphql `runGraphqlQuery` — the check and\n * message are identical on both paths.\n */\nasync function getCallTool(\n\tadapterName: string,\n): Promise<(args: { toolName: string; params?: Record<string, unknown> }) => Promise<unknown>> {\n\tconst sdk = await getChatSDK();\n\tif (typeof sdk.callTool !== \"function\") {\n\t\tthrow new Error(\n\t\t\t`[${adapterName}] sdk.callTool is not available on this surface. ` +\n\t\t\t\t\"Make sure window.openai is configured or the component is running \" +\n\t\t\t\t\"in an MCP Apps / OpenAI chat context.\",\n\t\t);\n\t}\n\treturn sdk.callTool.bind(sdk);\n}\n\n/**\n * Pulls a human-readable message out of an MCP error response\n * (`{ isError: true, content: [{ type: 'text', text: ... }, ...] }`).\n * Returns an empty string if no text content is present so the caller can\n * supply a fallback.\n */\nfunction extractToolErrorText(raw: unknown): string {\n\tconst content = (raw as { content?: unknown }).content;\n\tif (!Array.isArray(content)) return \"\";\n\treturn content\n\t\t.map((c) => {\n\t\t\tif (c && typeof c === \"object\" && (c as { type?: string }).type === \"text\") {\n\t\t\t\treturn (c as { text?: string }).text ?? \"\";\n\t\t\t}\n\t\t\treturn \"\";\n\t\t})\n\t\t.join(\" \")\n\t\t.trim();\n}\n\n/**\n * `Command` implementation that calls the configured MCP tool. One class,\n * reused across imperative and wire adapters.\n *\n * `execute()` returns a `Result<Data, unknown>`:\n * - `ok(data)` when the tool resolves — `data` is the unwrapped payload from\n * `normalizeMcpResponse` (or the result of the optional `unwrap` hook).\n * - `err(error)` when the tool rejects, when `sdk.callTool` is unavailable,\n * or when the `unwrap` hook returns `err(...)`.\n *\n * OneStore's `DefaultImperativeBindingsService` wraps this: on `ok(v)` it\n * deep-freezes and returns `v`; on `err(e)` it re-throws via `toError`. Sync\n * throws from `assertIsValid` in the `getCommand` factory are funneled through\n * `throwUserlandError`. `LWCWireBindingsService` wraps the same command\n * differently — it emits `{ data, error }` to the wire callback and attaches\n * freeze / race-guard / incomplete-config behavior.\n */\nclass McpToolCommand<Data> implements ResultCommand<Data, Error> {\n\tconstructor(\n\t\tprivate readonly adapterName: string,\n\t\tprivate readonly toolName: string,\n\t\tprivate readonly params: unknown,\n\t\tprivate readonly unwrap?: UnwrapEnvelope<Data>,\n\t) {}\n\n\tasync execute(): Promise<Result<Data, Error>> {\n\t\ttry {\n\t\t\tconst callTool = await getCallTool(this.adapterName);\n\t\t\tconst raw = await callTool({\n\t\t\t\ttoolName: this.toolName,\n\t\t\t\tparams: (this.params as Record<string, unknown>) ?? undefined,\n\t\t\t});\n\t\t\t// The MCP SDK converts handler throws into a resolved tool response\n\t\t\t// with `{ isError: true, content: [...] }` — not a transport\n\t\t\t// rejection. Surface it as an Err here so the default invoker\n\t\t\t// re-throws and the wire/legacy adapters route it through their\n\t\t\t// error channel.\n\t\t\tif (raw && typeof raw === \"object\" && (raw as { isError?: boolean }).isError) {\n\t\t\t\treturn err(new Error(extractToolErrorText(raw) || \"MCP tool error\"));\n\t\t\t}\n\t\t\tconst payload = normalizeMcpResponse(raw);\n\t\t\treturn this.unwrap ? this.unwrap(payload) : ok(payload as Data);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e : new Error(String(e)));\n\t\t}\n\t}\n}\n\n// Off-platform has no store to observe. For shapes that have no `refresh`,\n// nothing can ever trigger a post-initial update, so `subscribe` is a\n// deliberate no-op: the callback never fires and the returned unsubscribe is\n// idempotent. Shapes that *do* expose `refresh` wire subscribers into the\n// refresh path instead (see `McpToolSubscribableCommand` and the\n// `query-refreshable` graphql shape).\nconst noopUnsubscribe: Unsubscribe = () => {\n\t// no store to unsubscribe from off-platform\n};\nconst noopSubscribe = (_cb: unknown): Unsubscribe => noopUnsubscribe;\n\n/**\n * Adapts `McpToolCommand` into a `SubscribableResultCommand`. Wraps the\n * command's `Result` with `buildSubscribableResult`, supplying:\n * - `subscribe`: per-execution subscriber set. Each `execute()` call has\n * its own set so sibling invocations don't cross-pollinate. Returned\n * unsubscribe removes the callback and is idempotent.\n * - `refresh`: builds a fresh `McpToolCommand`, re-executes it, and\n * broadcasts the fresh `Result` to every registered subscriber before\n * resolving. Returns `Result<void, Error>` (ok → undefined; err → the\n * error from the fresh execute).\n *\n * Wiring subscribers into refresh mirrors on-platform behavior, where the\n * reactive store fans `refresh` results out to every listener. Off-platform\n * there is no store, so the subscriber set lives on the command itself. This\n * shim is what lets OneStore's Subscribable and Legacy services run verbatim\n * against MCP: their invokers gate on `isSubscribableResult`, which requires\n * the command's `execute()` to resolve a `SubscribableResult` (not a plain\n * `Result`).\n */\nclass McpToolSubscribableCommand<Data> implements SubscribableResultCommand<Data, Error> {\n\tconstructor(\n\t\tprivate readonly adapterName: string,\n\t\tprivate readonly toolName: string,\n\t\tprivate readonly params: unknown,\n\t\tprivate readonly unwrap?: UnwrapEnvelope<Data>,\n\t) {}\n\n\tasync execute() {\n\t\tconst base = new McpToolCommand<Data>(\n\t\t\tthis.adapterName,\n\t\t\tthis.toolName,\n\t\t\tthis.params,\n\t\t\tthis.unwrap,\n\t\t);\n\t\tconst result = await base.execute();\n\t\tconst subscribers = new Set<Callback<Result<Data, Error>>>();\n\t\tconst subscribe = (cb: Callback<Result<Data, Error>>): Unsubscribe => {\n\t\t\tsubscribers.add(cb);\n\t\t\treturn () => {\n\t\t\t\tsubscribers.delete(cb);\n\t\t\t};\n\t\t};\n\t\tconst refresh = async () => {\n\t\t\tconst next = await new McpToolCommand<Data>(\n\t\t\t\tthis.adapterName,\n\t\t\t\tthis.toolName,\n\t\t\t\tthis.params,\n\t\t\t\tthis.unwrap,\n\t\t\t).execute();\n\t\t\tsubscribers.forEach((cb) => cb(next));\n\t\t\treturn next.isOk() ? ok<void, Error>(undefined) : err(next.error);\n\t\t};\n\t\treturn buildSubscribableResult(result, subscribe, refresh);\n\t}\n}\n\n/**\n * Off-core graphql state-manager command factory. Returned function feeds\n * `createSmGraphQL(getCommand)` from\n * `@salesforce/lds-adapters-onestore-graphql/factory` — i.e. it intentionally\n * bypasses on-core's `_conduit_client_service_provisioner_v1` services\n * pipeline (instrumentation, normalized cache control, type registry,\n * `assertIsValid`, `resolveAndValidateGraphQLConfig`) and dispatches the\n * graphql query as a plain MCP tool call.\n *\n * The returned per-config command's `execute()` resolves a `Result` whose\n * shape matches what `createStateManager`'s `processQueuedConfig` expects\n * (the upstream `createSmGraphQL` wraps `createStateManager`):\n *\n * - `ok({ data: { data: <payload> }, subscribe, refresh })` — `processQueuedConfig`\n * reads `result.value.data.data` (the payload) and binds\n * `result.value.refresh` for the outer `refresh()` action.\n * - `err({ failure: UserVisibleError-with-{data: GraphQLResponse} })` —\n * `processQueuedConfig` calls `toGraphQLResponseFromFailure(result.error.failure)`\n * which extracts `.data.errors` from the `UserVisibleError`'s data field.\n *\n * `subscribe` and `refresh` are inherited verbatim from\n * `McpToolSubscribableCommand` (per-execution subscriber set, refresh\n * re-executes the tool and broadcasts to subscribers — matches the\n * on-platform contract from a state-manager-consumer perspective).\n *\n * @param name - State-manager name (`'default'` for `lightning/stateManagerGraphQL`).\n * @param cfg - Carries `mcp.toolName`. No `configJsonSchema`: this path\n * deliberately forgoes the on-core schema/`assertIsValid`/\n * `resolveAndValidateGraphQLConfig` validation layer for now;\n * malformed configs surface as MCP tool errors at execute time.\n */\nexport function createGraphqlStateManagerCommand(name: string, cfg: McpBackedAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn (config: GraphqlConfig) => ({\n\t\tasync execute() {\n\t\t\tconst base = new McpToolSubscribableCommand<GraphqlResult>(name, toolName, {\n\t\t\t\tquery: config.query,\n\t\t\t\tvariables: config.variables ?? {},\n\t\t\t\t...(config.operationName !== undefined && { operationName: config.operationName }),\n\t\t\t});\n\t\t\tconst subscribable = await base.execute();\n\t\t\tif (subscribable.isOk()) {\n\t\t\t\treturn ok(subscribable.value);\n\t\t\t}\n\t\t\t// Reshape inner `failure: Error` → `failure: UserVisibleError-with-data`\n\t\t\t// so upstream `toGraphQLResponseFromFailure(result.error.failure)`\n\t\t\t// pulls the MCP error message into `errors[0].message`. Keep the\n\t\t\t// surrounding subscribe/refresh envelope intact so the error value\n\t\t\t// is still a valid `SubscribableBase & { failure }`.\n\t\t\tconst innerError = subscribable.error.failure;\n\t\t\tconst message = innerError.message;\n\t\t\tconst userVisible = new UserVisibleError<GraphqlResult>({\n\t\t\t\tdata: undefined,\n\t\t\t\terrors: [{ message }],\n\t\t\t});\n\t\t\tuserVisible.message = message;\n\t\t\treturn err({ ...subscribable.error, failure: userVisible });\n\t\t},\n\t});\n}\n\nconst defaultImperativeService = buildDefaultImperativeBindingsServiceDescriptor().service;\nconst queryImperativeService = buildQueryImperativeBindingsServiceDescriptor().service;\nconst subscribableImperativeService =\n\tbuildSubscribableImperativeBindingsServiceDescriptor().service;\nconst legacyImperativeService = buildLegacyImperativeBindingsServiceDescriptor().service;\n\n/**\n * Mutation-shape factory. Builds an async `(config) => Promise<Data>` via\n * OneStore's `DefaultImperativeBindingsService`. Throws on validation error\n * (`throwUserlandError`) or tool error (`toError`). This is the only shape a\n * mutation ever takes on platform — mutation adapters do not carry an\n * `invokerShape` at all.\n */\nexport function createMutationAdapter(name: string, cfg: MutationAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\tconst getCommand = (options: { params: unknown[]; assertIsValid: typeof assertIsValid }) => {\n\t\toptions.assertIsValid(options.params[0], cfg.configJsonSchema);\n\t\treturn new McpToolCommand<unknown>(name, toolName, options.params[0]);\n\t};\n\tconst invoker = defaultImperativeService.bind<unknown[], unknown>(getCommand);\n\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n}\n\n/**\n * Read-shape factory. Dispatches on `cfg.invokerShape`:\n *\n * - `legacy` — `{ invoke, subscribe }` callback surface with `{ data, error }`.\n * `subscribe` fires the callback once from the initial execute's `data`,\n * returns a no-op unsubscribe, and never fires again off-platform.\n * - `query` — `(config) => Promise<{ data }>`; one-shot read.\n * - `subscribable` — `(config) => Promise<{ data, subscribe }>`. Callback\n * passed to `subscribe` never fires; unsubscribe is a no-op.\n * - `subscribable-refreshable` — `(config) => Promise<{ data, subscribe, refresh }>`.\n * `refresh()` re-executes the MCP tool; `subscribe` is still a no-op.\n *\n * All four delegate to an OneStore service (Query / Subscribable / Legacy)\n * over `McpToolSubscribableCommand`, which preserves OneStore's deep-freeze\n * and error-funnel semantics end-to-end.\n */\nexport function createReadAdapter(name: string, cfg: ReadAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\tconst getSubscribableCommand = (options: {\n\t\tparams: unknown[];\n\t\tassertIsValid: typeof assertIsValid;\n\t}) => {\n\t\toptions.assertIsValid(options.params[0], cfg.configJsonSchema);\n\t\treturn new McpToolSubscribableCommand<unknown>(name, toolName, options.params[0]);\n\t};\n\n\tswitch (cfg.invokerShape) {\n\t\tcase \"query\": {\n\t\t\tconst getCommand = (options: { params: unknown[]; assertIsValid: typeof assertIsValid }) => {\n\t\t\t\toptions.assertIsValid(options.params[0], cfg.configJsonSchema);\n\t\t\t\treturn new McpToolCommand<unknown>(name, toolName, options.params[0]);\n\t\t\t};\n\t\t\tconst invoker = queryImperativeService.bind<unknown[], unknown>(getCommand);\n\t\t\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n\t\t}\n\t\tcase \"subscribable\": {\n\t\t\tconst invoker = subscribableImperativeService.bind<unknown[], unknown>(\n\t\t\t\tgetSubscribableCommand,\n\t\t\t\tfalse,\n\t\t\t);\n\t\t\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n\t\t}\n\t\tcase \"subscribable-refreshable\": {\n\t\t\tconst invoker = subscribableImperativeService.bind<unknown[], unknown>(\n\t\t\t\tgetSubscribableCommand,\n\t\t\t\ttrue,\n\t\t\t);\n\t\t\treturn (...params: unknown[]) => Promise.resolve(invoker(...params));\n\t\t}\n\t\tcase \"legacy\": {\n\t\t\t// Legacy service passes `{ config, assertIsValid }`, not `{ params, ... }`.\n\t\t\tconst getLegacyCommand = (options: {\n\t\t\t\tconfig: unknown;\n\t\t\t\tassertIsValid: typeof assertIsValid;\n\t\t\t}) => {\n\t\t\t\toptions.assertIsValid(options.config, cfg.configJsonSchema);\n\t\t\t\treturn new McpToolSubscribableCommand<unknown>(name, toolName, options.config);\n\t\t\t};\n\t\t\treturn legacyImperativeService.bind<unknown, unknown>(getLegacyCommand);\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t`[${name}] unsupported invokerShape: ${String((cfg as { invokerShape: unknown }).invokerShape)}. ` +\n\t\t\t\t\t`Expected 'legacy' | 'query' | 'subscribable' | 'subscribable-refreshable'.`,\n\t\t\t);\n\t}\n}\n\nconst lwcWireBindingsService = buildLWCWireBindingsServiceDescriptor().service;\n\n/**\n * Splits the MCP tool's `{ data, error }` envelope into a `Result`. Used as\n * the `unwrap` hook on `McpToolCommand` so OneStore's wire invoker sees the\n * error branch directly instead of receiving an envelope wrapped in `ok(...)`.\n *\n * Tools that don't emit the envelope (e.g. imperative) never go through this\n * path — the default imperative invoker doesn't pass `unwrap`.\n */\nfunction unwrapWireEnvelope<Data>(payload: unknown): Result<Data, Error> {\n\tconst envelope = payload as { data?: unknown; error?: unknown } | null | undefined;\n\tif (envelope && envelope.error !== undefined && envelope.error !== null) {\n\t\treturn err(toError(envelope.error));\n\t}\n\treturn ok(envelope?.data as Data);\n}\n\n/**\n * Creates an LWC wire adapter class that calls an MCP tool. Delegates to\n * OneStore's `LWCWireBindingsService`, so the returned class inherits the\n * full `CommandWireAdapterConstructor` contract: initial empty emit, config\n * `sanitize()`, `MissingRequiredPropertyError` → wait-for-next-config gating,\n * deep-freeze on success, race guard on stale resolves, and unsubscriber\n * management on disconnect.\n *\n * The `McpToolCommand` class is reused verbatim — the wire call-site only\n * supplies an `unwrap` hook so the tool's `{ data, error }` envelope lands\n * on OneStore's Err branch rather than being leaked through as an `ok(...)`\n * envelope.\n *\n * @param name - Wire adapter export name, used in MCP error messages.\n * @param cfg - MCP tool name and JSON Schema for valid wire configs.\n */\nexport function createWireAdapter(name: string, cfg: WireAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn lwcWireBindingsService.bind<unknown>(\n\t\t(config) => new McpToolCommand(name, toolName, config, unwrapWireEnvelope),\n\t\tcfg.configJsonSchema,\n\t);\n}\n\n// ─── GraphQL adapters ─────────────────────────────────────────────────────────\n\n/**\n * GraphQL adapters diverge from the base wire / mutation shapes in two ways:\n *\n * 1. Envelope is `{ data, errors[] }` instead of `{ data, error }`. Errors\n * are collected; an empty array collapses to `undefined`.\n * 2. The `_fetch` path routes thrown errors **into** the `errors[]`\n * envelope on the wire callback (never throws to the LWC host). Mutation\n * likewise resolves with `{ data, errors }` rather than rejecting.\n *\n * Dispatch is MCP-only: `getChatSDK().callTool({ toolName, params })` with\n * `normalizeMcpResponse` unwrapping. No `globalThis.__sfdc_sdk__` shortcut —\n * the on-platform behaviour is already covered by real `lightning/graphql`,\n * and every off-platform caller routes through an MCP tool like every other\n * LDS adapter.\n */\ntype GraphqlAdapterConfig = McpBackedAdapterConfig;\n\ninterface GraphqlConfig {\n\tquery: string;\n\tvariables?: Record<string, unknown>;\n\toperationName?: string;\n}\n\ninterface GraphqlResult {\n\tdata?: unknown;\n\terrors?: { message: string }[];\n}\n\ntype GraphqlWireCallback = (result: {\n\tdata: unknown;\n\terrors: { message: string }[] | undefined;\n\trefresh: () => Promise<void>;\n}) => void;\n\n/**\n * Template-literal tag that stitches the string into a plain `query` string.\n * Deliberately minimal — no AST parsing, no fragment substitution, no opaque\n * doc emulation. Matches the shape used by today's off-platform `gql`.\n */\nexport function gql(strings: TemplateStringsArray, ...values: unknown[]): string {\n\tlet result = \"\";\n\tstrings.forEach((string, i) => {\n\t\tresult += string;\n\t\tif (i < values.length) result += String(values[i]);\n\t});\n\treturn result.trim();\n}\n\nasync function runGraphqlQuery(\n\tadapterName: string,\n\ttoolName: string,\n\tconfig: GraphqlConfig,\n): Promise<GraphqlResult> {\n\tconst { query, variables, operationName } = config;\n\tif (!query) return { data: undefined, errors: undefined };\n\n\tconst callTool = await getCallTool(adapterName);\n\tconst raw = await callTool({\n\t\ttoolName,\n\t\tparams: {\n\t\t\tquery,\n\t\t\tvariables: variables ?? {},\n\t\t\t...(operationName !== undefined && { operationName }),\n\t\t},\n\t});\n\n\treturn (normalizeMcpResponse(raw) as GraphqlResult) ?? {};\n}\n\n/** Wraps a thrown Error into the graphql `{ data, errors[] }` envelope. */\nfunction toGraphqlErrorResult(error: unknown): GraphqlResult {\n\treturn { data: undefined, errors: [{ message: (error as Error).message }] };\n}\n\n/**\n * `runGraphqlQuery` wrapped in try/catch so thrown errors land on `errors[]`\n * instead of rejecting. Used by every graphql shape that routes errors\n * in-band (wire, mutation, imperative-read query/query-refreshable, legacy).\n */\nasync function runGraphqlQuerySafe(\n\tadapterName: string,\n\ttoolName: string,\n\tconfig: GraphqlConfig,\n): Promise<GraphqlResult> {\n\ttry {\n\t\treturn await runGraphqlQuery(adapterName, toolName, config);\n\t} catch (error) {\n\t\treturn toGraphqlErrorResult(error);\n\t}\n}\n\n/**\n * GraphQL wire adapter factory. Emits `{ data, errors, refresh }` to the wire\n * callback. Mirrors the `constructor(callback)` → `connect` / `disconnect` /\n * `update(config)` / `refresh()` contract used by the LWC wire service.\n * Thrown fetch errors are routed into `errors[0].message`.\n *\n * `_fetch` is gated on `_connected` so that the common wire lifecycle\n * (`constructor` → `update(config)` → `connect`) doesn't fire two requests:\n * the initial `update(config)` arrives before `connect()`, stores the config,\n * and waits. `connect()` does the one fetch; later `update(config)` while\n * connected re-fetches. This matches luvio's `LWCLuvioWireAdapter`, which\n * gates on the same flag to prevent duplicate endpoint calls.\n */\nexport function createGraphQLWireAdapter(name: string, cfg: GraphqlAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn class {\n\t\t_dataCallback: GraphqlWireCallback;\n\t\t_config: GraphqlConfig | undefined;\n\t\t_connected = false;\n\n\t\tconstructor(dataCallback: GraphqlWireCallback) {\n\t\t\tthis._dataCallback = dataCallback;\n\t\t}\n\n\t\tconnect() {\n\t\t\tthis._connected = true;\n\t\t\tvoid this._fetch();\n\t\t}\n\n\t\tdisconnect() {\n\t\t\tthis._connected = false;\n\t\t}\n\n\t\tupdate(config: GraphqlConfig | undefined) {\n\t\t\tthis._config = config;\n\n\t\t\tif (!this._connected || this._config === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvoid this._fetch();\n\t\t}\n\n\t\trefresh() {\n\t\t\treturn this._fetch();\n\t\t}\n\n\t\tasync _fetch() {\n\t\t\tthis._emit(await runGraphqlQuerySafe(name, toolName, this._config ?? { query: \"\" }));\n\t\t}\n\n\t\t_emit({ data, errors }: GraphqlResult) {\n\t\t\tthis._dataCallback({\n\t\t\t\tdata,\n\t\t\t\terrors: errors?.length ? errors : undefined,\n\t\t\t\trefresh: () => this.refresh(),\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * GraphQL mutation factory. Returns `async (config) => Promise<{ data, errors }>`.\n * Empty-query guard short-circuits with\n * `{ data: undefined, errors: [{ message: \"No query provided\" }] }`.\n * All other errors are routed in-band to the `errors[]` envelope — the\n * function never rejects.\n */\nexport function createGraphQLMutationAdapter(name: string, cfg: GraphqlAdapterConfig) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\treturn async (config: GraphqlConfig): Promise<GraphqlResult> => {\n\t\tif (!config?.query) return { data: undefined, errors: [{ message: \"No query provided\" }] };\n\t\treturn runGraphqlQuerySafe(name, toolName, config);\n\t};\n}\n\ntype GraphqlImperativeReadInvokerShape = \"query\" | \"query-refreshable\" | \"legacy\";\n\ninterface GraphqlImperativeReadAdapterConfig extends GraphqlAdapterConfig {\n\tinvokerShape: GraphqlImperativeReadInvokerShape;\n}\n\ntype GraphqlImperativeResult = GraphqlResult & {\n\tsubscribe?: (cb: (result: GraphqlResult) => void) => Unsubscribe;\n\trefresh?: () => Promise<void>;\n};\n\ntype LegacyGraphqlCallback = (result: GraphqlResult) => void;\n\n/**\n * Imperative GraphQL read factory — single entry point for all imperative\n * graphql read shapes, mirroring the LDS `createReadAdapter` pattern. The\n * `invokerShape` selects the return surface:\n *\n * - `query` — `async (config) => Promise<{ data, errors, subscribe }>`.\n * Mirrors on-platform `GraphQLImperativeBindingsService` without\n * `exposeRefresh`. Errors are routed in-band; the function never throws.\n * - `query-refreshable` — same as `query` plus `refresh()` that re-runs the\n * underlying MCP tool. Mirrors the same service with `exposeRefresh: true`.\n * - `legacy` — `{ invoke(config, context, callback),\n * subscribe(config, context, callback): Unsubscribe }`. The callback\n * always receives `{ data, errors }`; neither method throws. `context` is\n * accepted but ignored.\n *\n * In every shape `subscribe` is a deliberate no-op off-platform (no reactive\n * store); returned unsubscribes are idempotent.\n */\nexport function createGraphQLImperativeReadAdapter(\n\tname: string,\n\tcfg: GraphqlImperativeReadAdapterConfig,\n) {\n\tconst toolName = resolveMcpToolName(name, cfg);\n\tif (cfg.invokerShape === \"legacy\") {\n\t\tasync function run(\n\t\t\tconfig: GraphqlConfig | undefined,\n\t\t\tcallback: LegacyGraphqlCallback,\n\t\t): Promise<void> {\n\t\t\tif (!config?.query) {\n\t\t\t\tcallback({ data: undefined, errors: undefined });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst result = await runGraphqlQuerySafe(name, toolName, config);\n\t\t\tcallback({\n\t\t\t\tdata: result.data,\n\t\t\t\terrors: result.errors?.length ? result.errors : undefined,\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tinvoke(\n\t\t\t\tconfig: GraphqlConfig | undefined,\n\t\t\t\t_context: unknown,\n\t\t\t\tcallback: LegacyGraphqlCallback,\n\t\t\t): void {\n\t\t\t\tvoid run(config, callback);\n\t\t\t},\n\t\t\tsubscribe(\n\t\t\t\tconfig: GraphqlConfig | undefined,\n\t\t\t\t_context: unknown,\n\t\t\t\tcallback: LegacyGraphqlCallback,\n\t\t\t): Unsubscribe {\n\t\t\t\tvoid run(config, callback);\n\t\t\t\treturn noopUnsubscribe;\n\t\t\t},\n\t\t};\n\t}\n\n\tif (cfg.invokerShape === \"query-refreshable\") {\n\t\t// Per-invocation subscriber set: each call to the returned function\n\t\t// gets its own adapter instance with an isolated subscriber list.\n\t\t// `refresh()` re-runs the MCP tool and broadcasts the fresh\n\t\t// `{ data, errors }` to every registered callback, which mirrors the\n\t\t// on-platform contract where `refresh` causes store updates that fan\n\t\t// out through the `subscribe` fan-in. Without this wiring, `refresh`\n\t\t// would re-run the query off-platform but nothing could observe the\n\t\t// new payload (no store, noop subscribe).\n\t\treturn async (config: GraphqlConfig): Promise<GraphqlImperativeResult> => {\n\t\t\tconst result = await runGraphqlQuerySafe(name, toolName, config);\n\t\t\tif (result.errors?.length) {\n\t\t\t\treturn { data: undefined, errors: result.errors };\n\t\t\t}\n\t\t\tconst subscribers = new Set<(result: GraphqlResult) => void>();\n\t\t\treturn {\n\t\t\t\tdata: result.data,\n\t\t\t\terrors: undefined,\n\t\t\t\tsubscribe: (cb) => {\n\t\t\t\t\tsubscribers.add(cb);\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tsubscribers.delete(cb);\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\trefresh: async () => {\n\t\t\t\t\tconst fresh = await runGraphqlQuerySafe(name, toolName, config);\n\t\t\t\t\tconst payload: GraphqlResult = {\n\t\t\t\t\t\tdata: fresh.data,\n\t\t\t\t\t\terrors: fresh.errors?.length ? fresh.errors : undefined,\n\t\t\t\t\t};\n\t\t\t\t\tsubscribers.forEach((cb) => cb(payload));\n\t\t\t\t},\n\t\t\t};\n\t\t};\n\t}\n\n\t// `query` shape: no refresh → nothing can trigger a post-initial update\n\t// off-platform, so `subscribe` stays a noop. The on-platform contract\n\t// allows subscribe callbacks to fire from unrelated store writes; off-\n\t// platform there is no store, so the callback is correctly unreachable.\n\treturn async (config: GraphqlConfig): Promise<GraphqlImperativeResult> => {\n\t\tconst result = await runGraphqlQuerySafe(name, toolName, config);\n\t\tif (result.errors?.length) {\n\t\t\treturn { data: undefined, errors: result.errors };\n\t\t}\n\t\treturn {\n\t\t\tdata: result.data,\n\t\t\terrors: undefined,\n\t\t\tsubscribe: noopSubscribe,\n\t\t};\n\t};\n}\n"],"names":[],"mappings":";;;;AAmBO,SAAS,qBAAqB,KAAuB;AAC3D,MAAI,OAAO,OAAO,QAAQ,YAAY,uBAAuB,KAAK;AACjE,WAAQ,IAAuC;AAAA,EAChD;AAEA,MAAI,OAAO,OAAO,QAAQ,YAAY,OAAQ,IAA6B,WAAW,UAAU;AAC/F,UAAM,SAAS,KAAK,MAAO,IAA2B,MAAM;AAC5D,QAAI,MAAM,QAAQ,MAAM,GAAG;AAC1B,YAAM,YAAY,OAAO;AAAA,QACxB,CAAC,MACA,KAAK,EAAE,SAAS,UAAU,OAAO,EAAE,SAAS;AAAA,MAAA;AAE9C,YAAM,OAAO,YAAY,UAAU,OAAO;AAC1C,UAAI,MAAM;AACT,eAAO,KAAK,MAAM,IAAI;AAAA,MACvB;AACA,aAAO,CAAA;AAAA,IACR;AACA,WAAO;AAAA,EACR;AAEA,SAAO,OAAO,CAAA;AACf;ACkBA,SAA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manager registry entry. The lds plugin's load hook emits a
|
|
5
|
+
* factory-composition body for each state-manager entry — see
|
|
6
|
+
* `buildStateManagerCompositionBody` below. Two emit shapes:
|
|
7
|
+
*
|
|
8
|
+
* - **UIAPI** (`lightning/stateManagerRecord`, `…ObjectInfo`) — synthesizes
|
|
9
|
+
* a legacy-shape imperative-read adapter inline via `createReadAdapter`
|
|
10
|
+
* and feeds it into the upstream per-state-manager factory
|
|
11
|
+
* (`createSmRecord` / `createSmObjectInfo`) re-exported from
|
|
12
|
+
* `@salesforce/state-managers-uiapi/factory`.
|
|
13
|
+
*
|
|
14
|
+
* - **GraphQL** (`lightning/stateManagerGraphQL`) — calls the upstream
|
|
15
|
+
* per-state-manager factory `createSmGraphQL` re-exported from
|
|
16
|
+
* `@salesforce/lds-adapters-onestore-graphql/factory` with an MCP-backed
|
|
17
|
+
* `getCommand` synthesized via `createGraphqlStateManagerCommand`
|
|
18
|
+
* (a `runtime.ts` helper). The required / optional config keys
|
|
19
|
+
* (`['query']`, `['variables', 'operationName']`) live in the upstream
|
|
20
|
+
* factory — a fixed contract of `lightning/stateManagerGraphQL` — so the
|
|
21
|
+
* load-hook emit doesn't pass them. Mirrors the UIAPI shape (one
|
|
22
|
+
* factory call, adapter argument only).
|
|
23
|
+
*
|
|
24
|
+
* Per-state-manager metadata (definedBy, requiredKeys, optionalKeys,
|
|
25
|
+
* predicate) lives in the upstream factory — not here. See spec §8.4 / §10.4.
|
|
26
|
+
*
|
|
27
|
+
* `configJsonSchema` is optional: UIAPI state managers supply it (the
|
|
28
|
+
* load hook embeds it in the synthesized imperative-read adapter), but
|
|
29
|
+
* the graphql state-manager path doesn't read it (off-core graphql
|
|
30
|
+
* forgoes the on-core `assertIsValid` / `resolveAndValidateGraphQLConfig`
|
|
31
|
+
* validation layer; spec §4 Non-goal 9 — malformed configs surface as
|
|
32
|
+
* MCP tool errors at execute time instead).
|
|
33
|
+
*/
|
|
34
|
+
export interface LdsStateManagerConfig extends LdsRegistryEntryBase {
|
|
35
|
+
type: "state-manager";
|
|
36
|
+
/** Upstream factory specifier — e.g. '@salesforce/state-managers-uiapi/factory'. */
|
|
37
|
+
factoryModule: string;
|
|
38
|
+
/** Named export within `factoryModule` — e.g. 'createSmRecord' (UIAPI), 'createSmGraphQL' (graphql). */
|
|
39
|
+
factoryName: string;
|
|
40
|
+
/** JSON Schema for the config object — required for UIAPI state managers, omitted for graphql. */
|
|
41
|
+
configJsonSchema?: JSONSchema;
|
|
42
|
+
}
|
|
43
|
+
/** True when any entry in a module's registry map is a `state-manager` type. */
|
|
44
|
+
export declare function isStateManagerSpecifier(moduleAdapters: Record<string, LdsRegistryEntry>): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Builds the §8.4 factory-composition body for a single `state-manager`
|
|
47
|
+
* registry entry. Two emit shapes, gated by `isGraphqlStateManagerSpecifier`:
|
|
48
|
+
*
|
|
49
|
+
* **UIAPI shape** — `lightning/stateManagerRecord`, `…ObjectInfo`:
|
|
50
|
+
* 1. Imports `<factoryName>` (e.g. `createSmRecord`) from the registry's
|
|
51
|
+
* `factoryModule` (e.g. `@salesforce/state-managers-uiapi/factory`).
|
|
52
|
+
* 2. Builds a legacy-shape imperative-read config and synthesizes the
|
|
53
|
+
* adapter inline via `createReadAdapter` — a private binding pulled
|
|
54
|
+
* into scope by `adapterBaseSource`.
|
|
55
|
+
* 3. Default-exports `<factoryName>(synthesizedAdapter)`.
|
|
56
|
+
*
|
|
57
|
+
* **GraphQL shape** — `lightning/stateManagerGraphQL`:
|
|
58
|
+
* 1. Imports `<factoryName>` (`createSmGraphQL`) from the registry's
|
|
59
|
+
* `factoryModule` (`@salesforce/lds-adapters-onestore-graphql/factory`).
|
|
60
|
+
* 2. Synthesizes an MCP-backed `getCommand` via `createGraphqlStateManagerCommand`
|
|
61
|
+
* (a `runtime.ts` helper, in scope as a private binding).
|
|
62
|
+
* 3. Default-exports `<factoryName>(getCommand)`. The required / optional
|
|
63
|
+
* config keys are baked into the upstream factory, not passed here.
|
|
64
|
+
*
|
|
65
|
+
* Only `default` is exported in either shape. The upstream `<name>_internal`
|
|
66
|
+
* named export (used internally by `state-managers-uiapi` for
|
|
67
|
+
* cross-state-manager wiring and tests) is deliberately not re-exported —
|
|
68
|
+
* uplifted customer LWCs only consume the default. See spec §8.4 / §10.4.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildStateManagerCompositionBody(name: string, cfg: LdsStateManagerConfig, specifier: string): string;
|
|
71
|
+
//# sourceMappingURL=state-managers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-managers.d.ts","sourceRoot":"","sources":["../../../src/providers/lds/state-managers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IAClE,IAAI,EAAE,eAAe,CAAC;IACtB,oFAAoF;IACpF,aAAa,EAAE,MAAM,CAAC;IACtB,wGAAwG;IACxG,WAAW,EAAE,MAAM,CAAC;IACpB,kGAAkG;IAClG,gBAAgB,CAAC,EAAE,UAAU,CAAC;CAC9B;AAED,gFAAgF;AAChF,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,OAAO,CAEjG;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gCAAgC,CAC/C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,qBAAqB,EAC1B,SAAS,EAAE,MAAM,GACf,MAAM,CAqBR"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits the brace-content of a named-import statement into its individual
|
|
3
|
+
* specifiers, surfacing both the original (pre-`as`) name and the full
|
|
4
|
+
* `<original> as <local>` form. Used by the lds plugin's transform hook to
|
|
5
|
+
* decide which names to rewrite to the virtual module.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseImportSpecifiers(bracesContent: string): {
|
|
8
|
+
original: string;
|
|
9
|
+
full: string;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const adapterBaseSource: string;
|
|
12
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/providers/lds/util.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAUjG;AAiCD,eAAO,MAAM,iBAAiB,QAE7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/vite-plugin-lwc-ui-bundle",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.0",
|
|
4
4
|
"description": "Vite plugin for compiling LWC components into static bundles for off-platform and MCP use",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Salesforce",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@lwc/rollup-plugin": "^9.0.0",
|
|
61
61
|
"@salesforce/lds-adapters-onestore-graphql": "^1.440.0",
|
|
62
|
-
"@salesforce/platform-sdk": "^9.
|
|
62
|
+
"@salesforce/platform-sdk": "^9.18.0",
|
|
63
63
|
"@salesforce/state-managers-uiapi": "^0.30.0",
|
|
64
|
-
"@salesforce/ui-bundle": "^9.
|
|
64
|
+
"@salesforce/ui-bundle": "^9.18.0",
|
|
65
65
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
66
66
|
"zod": "^3.23.8"
|
|
67
67
|
},
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@conduit-client/bindings-utils": "3.19.6",
|
|
89
89
|
"@conduit-client/command-base": "3.19.6",
|
|
90
|
-
"@salesforce/platform-sdk": "^9.
|
|
90
|
+
"@salesforce/platform-sdk": "^9.18.0",
|
|
91
91
|
"typescript": "^5.9.3",
|
|
92
92
|
"vite": "^7.0.0",
|
|
93
93
|
"vite-plugin-dts": "^4.5.4",
|