@salesforce/platform-sdk 11.54.0 → 11.55.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.
@@ -18,5 +18,5 @@ export { getSurfaceCapabilities } from './capabilities';
18
18
  export type { SurfaceCapabilities } from './capabilities';
19
19
  export { wrapSDKPromise } from './sdk-promise';
20
20
  export { createPluginFactory } from './plugin-factory';
21
- export type { Plugin, AnyPlugin, PluginsFor, PluginEntry, ExtendedSDK, LiteralName, UniquePluginNames, } from './plugin-types';
21
+ export type { Plugin, AnyPlugin, AliasedPlugin, PluginsFor, PluginEntry, ExtendedSDK, LiteralName, UniquePluginNames, ValidAliasNames, } from './plugin-types';
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACN,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,YAAY,GACZ,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGrD,YAAY,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,QAAQ,EACR,SAAS,GACT,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd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AGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,WAAW,GACX,MAAM,QAAQ,CAAC;AAGhB,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7F,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAO/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EACX,MAAM,EACN,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,eAAe,GACf,MAAM,gBAAgB,CAAC"}
@@ -1,9 +1,16 @@
1
1
  import { ExtendedSDK, PluginsFor } from './plugin-types';
2
2
  /**
3
3
  * Run each plugin's `setup` in array order and mount the returned namespace
4
- * under the plugin's `name`. `setup` may be sync or async; each is `await`ed
4
+ * under the entry's effective mount name its `name`, or its `as` alias when
5
+ * the entry is `{ plugin, as }`. `setup` may be sync or async; each is `await`ed
5
6
  * before the next runs, so the ordering is deterministic.
6
7
  *
8
+ * Aliasing rebinds only the mount key: `setup` still runs on the underlying
9
+ * plugin, so two plugins that both declare `name: "labels"` can attach under
10
+ * distinct keys (`{ plugin: a, as: "x" }`, `{ plugin: b, as: "y" }`). See
11
+ * {@link resolveEntry} for the bare-vs-aliased narrowing and the loud guard
12
+ * against a malformed entry from untyped JavaScript.
13
+ *
7
14
  * Each `setup` receives the base SDK, and that is all the type promises it:
8
15
  * `setup(sdk)` is typed as `Base`, never the accumulating shape. Because every
9
16
  * namespace mounts onto one shared object (below), a later plugin *can* reach
@@ -28,7 +35,8 @@ import { ExtendedSDK, PluginsFor } from './plugin-types';
28
35
  * base type may attach. The returned type is {@link ExtendedSDK}<Base, Plugins>
29
36
  * — the base plus each plugin's resolved namespace under its own key.
30
37
  *
31
- * Fail-loud: a name in `reservedNames` (names the caller declares off-limits),
38
+ * Fail-loud: a malformed entry (no `setup`, or a non-string/empty mount name),
39
+ * a mount name in `reservedNames` (names the caller declares off-limits),
32
40
  * already present on the base (own or inherited), or mounted earlier in this
33
41
  * same call throws before setup runs, and a `setup` that throws or rejects
34
42
  * surfaces as an error naming the plugin, chaining the original error via
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-attach.d.ts","sourceRoot":"","sources":["../../src/core/plugin-attach.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,aAAa,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,OAAO,SAAS,UAAU,CAAC,IAAI,CAAC,EAC9F,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAIhB,aAAa,GAAE,WAAW,CAAC,MAAM,CAAqB,GACpD,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CA0DrC"}
1
+ {"version":3,"file":"plugin-attach.d.ts","sourceRoot":"","sources":["../../src/core/plugin-attach.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAiB,WAAW,EAAU,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA0CrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,aAAa,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,OAAO,SAAS,UAAU,CAAC,IAAI,CAAC,EAC9F,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAIhB,aAAa,GAAE,WAAW,CAAC,MAAM,CAAqB,GACpD,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAoErC"}
@@ -71,37 +71,74 @@ export type LiteralName<Name extends string> = string extends Name ? never : IsU
71
71
  */
72
72
  export type AnyPlugin = Plugin<never, string, unknown>;
73
73
  /**
74
- * The `plugins: []` array constraint that enforces a concrete base SDK. A
75
- * `Plugin<Sdk, Name, Api>` is a member iff a `Base` value is assignable
76
- * to its `setup` parameter i.e. the plugin asks for no more than `Base`
77
- * provides (a plugin that ignores the SDK, `Sdk = unknown`, is universally
78
- * attachable). `createDataSDK` binds `Base = DataSDK`; that is where
79
- * DataSDK-specific enforcement occurs.
74
+ * Rebind a plugin's mount point: attach `plugin` under `as` instead of its own
75
+ * `name`. This is the consumer's recourse for a collision they didn't cause —
76
+ * two uneditable third-party plugins that both mount `sdk.labels` can each be
77
+ * aliased to a distinct key. Aliasing rebinds the mount *key* only, never the
78
+ * plugin's identity, which is what keeps identity-based dependency resolution
79
+ * (a later WI) robust to it.
80
+ *
81
+ * `As` is intentionally the raw alias literal, NOT `LiteralName<As>`: pinning
82
+ * `LiteralName` here would collapse the constraint form `AliasedPlugin<_,
83
+ * string>` (used in {@link PluginsFor}) to `as: never` and reject every alias.
84
+ * The widened/union-`as` guard is instead applied at the call boundary by
85
+ * {@link ValidAliasNames}, exactly as {@link UniquePluginNames} guards mount
86
+ * uniqueness there — the entry type stays permissive; the boundary validates.
87
+ *
88
+ * `name?: never; setup?: never` reject the mixed shape structurally, mirroring
89
+ * the runtime discriminator. An object carrying a bare plugin's defining
90
+ * members *and* `{ plugin, as }` satisfies both arms of {@link PluginEntry};
91
+ * without these guards {@link MountName} (which tests the aliased arm first)
92
+ * would key it under `as`, while `attach` — discriminating on `"setup" in
93
+ * entry` — mounts the bare plugin under `name`. The `never` fields fail the
94
+ * aliased arm for such an object, so it matches only {@link Plugin} and both
95
+ * sides agree on `name`. Unlike the `LiteralName` case above, these are fixed
96
+ * optional-never fields independent of `P`/`As`, so a real `{ plugin, as }`
97
+ * entry (which omits them) leaves the `PluginsFor` constraint form intact.
98
+ */
99
+ export interface AliasedPlugin<P extends AnyPlugin, As extends string> {
100
+ plugin: P;
101
+ as: As;
102
+ name?: never;
103
+ setup?: never;
104
+ }
105
+ /** Any aliased entry, for use in unions/constraints (cf. {@link AnyPlugin}). */
106
+ type AnyAliasedPlugin = AliasedPlugin<AnyPlugin, string>;
107
+ /**
108
+ * The `plugins: []` array constraint that enforces a concrete base SDK. A bare
109
+ * `Plugin<Sdk, Name, Api>` — or an {@link AliasedPlugin} wrapping one — is a
110
+ * member iff a `Base` value is assignable to the (inner) plugin's `setup`
111
+ * parameter, i.e. the plugin asks for no more than `Base` provides (a plugin
112
+ * that ignores the SDK, `Sdk = unknown`, is universally attachable).
113
+ * `createDataSDK` binds `Base = DataSDK`; that is where DataSDK-specific
114
+ * enforcement occurs.
80
115
  */
81
- export type PluginsFor<Base> = readonly Plugin<Base, string, unknown>[];
116
+ export type PluginsFor<Base> = readonly (Plugin<Base, string, unknown> | AliasedPlugin<Plugin<Base, string, unknown>, string>)[];
82
117
  /**
83
- * What may appear in the `plugins: []` array. A one-member alias today bare
84
- * plugins only and deliberately the seam for WI-5 aliasing: that WI widens it
85
- * to `AnyPlugin | AnyAliasedPlugin` so two uneditable third-party plugins that
86
- * both want the same namespace (e.g. `sdk.labels`) each get a mount recourse.
87
- * Everything downstream ({@link Accumulate}, {@link ExtendedSDK}) is written
88
- * against `PluginEntry`, so the union lands here and nowhere else.
118
+ * What may appear in the `plugins: []` array: a bare plugin, or a bare plugin
119
+ * wrapped with an `{ as }` alias. Everything downstream ({@link Accumulate},
120
+ * {@link DuplicateMountName}, {@link ExtendedSDK}) is written against
121
+ * `PluginEntry` and routes through {@link PluginOf}/{@link MountName}, so the
122
+ * bare-vs-aliased distinction is resolved in exactly those two helpers and
123
+ * nowhere else.
89
124
  */
90
- export type PluginEntry = AnyPlugin;
125
+ export type PluginEntry = AnyPlugin | AnyAliasedPlugin;
126
+ /** The underlying plugin of an entry, whether it was passed bare or aliased. */
127
+ type PluginOf<E extends PluginEntry> = E extends AnyAliasedPlugin ? E["plugin"] : E;
91
128
  /**
92
- * The literal key a plugin mounts under. Today that is exactly its `name`;
93
- * WI-5 aliasing resolves an entry's `as` over `name` here, so this stays the
94
- * single place the effective mount key is computed. All mount-name-keyed logic
95
- * ({@link Accumulate}, {@link DuplicateMountName}) routes through this rather
96
- * than reading `name` directly, so aliased entries resolve correctly for free
97
- * once WI-5 lands.
129
+ * The literal key an entry mounts under: its alias `as` when aliased, else the
130
+ * plugin's own `name`. This is the single place the effective mount key is
131
+ * computed all mount-name-keyed logic ({@link Accumulate},
132
+ * {@link DuplicateMountName}) routes through it, so aliasing is transparent to
133
+ * them: `[a, a]` (both mount `"labels"`) collides, but `[{ plugin: a, as: "x"
134
+ * }, { plugin: a, as: "y" }]` resolves to distinct keys and does not.
98
135
  */
99
- type MountName<P extends AnyPlugin> = P["name"];
136
+ type MountName<E extends PluginEntry> = E extends AnyAliasedPlugin ? E["as"] : PluginOf<E>["name"];
100
137
  /**
101
- * The resolved API a plugin's `setup` returns. `Awaited` unwraps the async
102
- * case so the mounted namespace is the settled value, never a promise.
138
+ * The resolved API an entry's plugin `setup` returns. `Awaited` unwraps the
139
+ * async case so the mounted namespace is the settled value, never a promise.
103
140
  */
104
- type ApiOf<P extends AnyPlugin> = Awaited<ReturnType<P["setup"]>>;
141
+ type ApiOf<E extends PluginEntry> = Awaited<ReturnType<PluginOf<E>["setup"]>>;
105
142
  /**
106
143
  * Walk the plugin tuple left→right, intersecting `{ [name]: namespace }` per
107
144
  * entry. Namespaces are non-optional: presence is a static attach fact.
@@ -121,10 +158,8 @@ type Accumulate<Plugins extends readonly PluginEntry[]> = Plugins extends readon
121
158
  /**
122
159
  * The first mount name that repeats in the tuple, or `never` if all are
123
160
  * distinct. Walks left→right accumulating seen names in `Seen`; the first
124
- * {@link MountName} already in `Seen` is the duplicate. Keyed on `MountName`,
125
- * not raw `name`, so WI-5 aliasing is a valid recourse: `[a, a]` (both mount
126
- * `"labels"`) reports `"labels"`, but `[{ plugin: a, as: "x" }, { plugin: a, as:
127
- * "y" }]` resolves to distinct mount names and reports `never`.
161
+ * {@link MountName} already in `Seen` is the duplicate. Keyed on
162
+ * {@link MountName}, so aliasing a clash apart is a valid recourse (see there).
128
163
  */
129
164
  type DuplicateMountName<Plugins extends readonly PluginEntry[], Seen = never> = Plugins extends readonly [
130
165
  infer Head extends PluginEntry,
@@ -148,6 +183,21 @@ export type UniquePluginNames<Plugins extends readonly PluginEntry[]> = [
148
183
  ] extends [never] ? unknown : {
149
184
  plugins: `Two plugins mount under "${DuplicateMountName<Plugins> & string}"; mount names must be unique.`;
150
185
  };
186
+ /**
187
+ * A constraint intersected into the `plugins` option to reject an aliased entry
188
+ * whose `as` is not a single string literal — the same soundness bar
189
+ * {@link LiteralName} applies to a plugin's `name` (see there for why a widened
190
+ * or union `as` would mount a phantom namespace). Applied at the boundary rather
191
+ * than on {@link AliasedPlugin} for the reason that type documents. Resolves to
192
+ * `unknown` or an inassignable `{ plugins }` error exactly as
193
+ * {@link UniquePluginNames} does.
194
+ */
195
+ export type ValidAliasNames<Plugins extends readonly PluginEntry[]> = Plugins extends readonly [
196
+ infer Head extends PluginEntry,
197
+ ...infer Tail extends readonly PluginEntry[]
198
+ ] ? Head extends AnyAliasedPlugin ? [LiteralName<Head["as"]>] extends [never] ? {
199
+ plugins: `An alias "as" must be a single string literal, not a widened or union type.`;
200
+ } : ValidAliasNames<Tail> : ValidAliasNames<Tail> : unknown;
151
201
  /** Collapse an intersection into a single flat object type for readable hovers. */
152
202
  type Flatten<T> = {
153
203
  [K in keyof T]: T[K];
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-types.d.ts","sourceRoot":"","sources":["../../src/core/plugin-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,MAAM,CAAC,GAAG,EAAE,IAAI,SAAS,MAAM,EAAE,GAAG,EAAE,IAAI,SAAS,SAAS,SAAS,EAAE,GAAG,EAAE;IAC5F,yEAAyE;IACzE,IAAI,EAAE,IAAI,CAAC;IACX;;;;;;;;;OASG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;CAC/D;AAED,sDAAsD;AACtD,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,WAAW,CAAC,IAAI,SAAS,MAAM,IAAI,MAAM,SAAS,IAAI,GAC/D,KAAK,GACL,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,GACzB,KAAK,GACL,IAAI,CAAC;AAET;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CAAC,IAAI,IAAI,SAAS,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,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CAAC,GACtB,eAAe,CAAC,IAAI,CAAC,GACtB,OAAO,CAAC;AAEX,mFAAmF;AACnF,KAAK,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,EAAE,CAAC;AAEhD,2DAA2D;AAC3D,MAAM,MAAM,WAAW,CAAC,IAAI,EAAE,OAAO,SAAS,SAAS,WAAW,EAAE,IAAI,OAAO,CAC9E,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAC1B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { DataSDK, ExtendedSDK, Plugin, SDKOptions, UniquePluginNames } from '../core';
1
+ import { DataSDK, ExtendedSDK, Plugin, PluginsFor, SDKOptions, UniquePluginNames, ValidAliasNames } from '../core';
2
2
  import { MosaicDataSDKOptions } from './mosaic';
3
3
  /**
4
4
  * A callback the host invokes for a given HTTP status (see {@link WebAppDataSDKOptions.onStatus}).
@@ -38,8 +38,12 @@ export type DataSDKPlugin<Name extends string = string, Api = unknown> = Plugin<
38
38
  * see {@link createPluginFactory} for the underlying mechanism.
39
39
  */
40
40
  export declare const defineDataPlugin: <const Name extends string, Api>(plugin: Plugin<DataSDK, import('..').LiteralName<Name>, Api, []>) => Plugin<DataSDK, Name, Api, []>;
41
- /** A DataSDK carrying every namespace contributed by an ordered plugin tuple. */
42
- export type DataSDKWithPlugins<Plugins extends readonly DataSDKPlugin[]> = ExtendedSDK<DataSDK, Plugins>;
41
+ /**
42
+ * A DataSDK carrying every namespace contributed by an ordered plugin tuple.
43
+ * Entries may be bare plugins or `{ plugin, as }` aliases; each mounts under its
44
+ * effective key (the alias when present), so aliasing is reflected here for free.
45
+ */
46
+ export type DataSDKWithPlugins<Plugins extends PluginsFor<DataSDK>> = ExtendedSDK<DataSDK, Plugins>;
43
47
  /**
44
48
  * Options for creating a DataSDK instance.
45
49
  */
@@ -54,7 +58,13 @@ export interface DataSDKOptions extends SDKOptions {
54
58
  * @example { instanceUrl: "https://my.salesforce.com", accessToken: "00D..." }
55
59
  */
56
60
  mosaic?: MosaicDataSDKOptions;
57
- plugins?: readonly DataSDKPlugin[];
61
+ /**
62
+ * Plugins to attach. Each entry is a bare {@link DataSDKPlugin} (mounts under
63
+ * its own `name`) or a `{ plugin, as }` alias (mounts under `as`). Aliasing
64
+ * is the recourse when two plugins want the same key — e.g. two third-party
65
+ * labels plugins the consumer can't edit.
66
+ */
67
+ plugins?: PluginsFor<DataSDK>;
58
68
  }
59
69
  /**
60
70
  * Create and initialize a DataSDK instance based on the detected surface.
@@ -94,9 +104,9 @@ export interface DataSDKOptions extends SDKOptions {
94
104
  * }
95
105
  * ```
96
106
  */
97
- export declare function createDataSDK<const Plugins extends readonly DataSDKPlugin[] = []>(options?: Omit<DataSDKOptions, "plugins"> & {
107
+ export declare function createDataSDK<const Plugins extends PluginsFor<DataSDK> = []>(options?: Omit<DataSDKOptions, "plugins"> & {
98
108
  plugins?: Plugins;
99
- } & UniquePluginNames<Plugins>): Promise<DataSDKWithPlugins<Plugins>>;
109
+ } & UniquePluginNames<Plugins> & ValidAliasNames<Plugins>): Promise<DataSDKWithPlugins<Plugins>>;
100
110
  export { gql } from './gql';
101
111
  export type { CacheControl, DataSDK, DataSDKGraphQL, GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLRequestHeaders, GraphQLResponse, MutateOptions, MutationResult, QueryOptions, QueryResult, QuerySubscriber, SDKOptions, Unsubscribe, } from '../core';
102
112
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAMpE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,O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AAM,CAAC,CAAA;CAAE,GAAG,IAAI,GAClC,CAAC,GACD,KAAK,GACN,KAAK,CAAC"}
@@ -1,32 +1,32 @@
1
1
  import { g as V, S as y } from "../surface-Dd2tqrPi.js";
2
2
  import { w as x } from "../sdk-promise-D0sy7OW1.js";
3
3
  import { c as G } from "../plugin-factory-BC3b3BOy.js";
4
- import { buildServiceDescriptor as M, setHeader as b } from "@conduit-client/service-fetch-network/v1";
5
- import { resolvedPromiseLike as u, ok as C, err as D, stableJSONStringify as Q, DataNotFoundError as j, UserVisibleError as z, deepFreeze as S, isUserVisibleError as W } from "@conduit-client/utils";
4
+ import { buildServiceDescriptor as $, setHeader as b } from "@conduit-client/service-fetch-network/v1";
5
+ import { resolvedPromiseLike as u, ok as C, err as D, stableJSONStringify as Q, DataNotFoundError as j, UserVisibleError as z, deepFreeze as g, isUserVisibleError as W } from "@conduit-client/utils";
6
6
  import { print as P, parse as B } from "@conduit-client/onestore-graphql-parser/v1";
7
7
  import { RetryPolicy as J, buildServiceDescriptor as X } from "@conduit-client/service-retry/v1";
8
8
  import { buildServiceDescriptor as Y } from "@conduit-client/service-cache/v1";
9
9
  import { buildServiceDescriptor as Z } from "@conduit-client/service-cache-control/v1";
10
10
  import { buildInMemoryCacheInclusionPolicyService as ee } from "@conduit-client/service-cache-inclusion-policy/v1";
11
- import { buildServiceDescriptor as re } from "@conduit-client/service-pubsub/v1";
12
- import { HttpCacheControlCommand as te } from "@conduit-client/command-http-cache-control/v1";
13
- function ne(r) {
11
+ import { buildServiceDescriptor as te } from "@conduit-client/service-pubsub/v1";
12
+ import { HttpCacheControlCommand as re } from "@conduit-client/command-http-cache-control/v1";
13
+ function ne(t) {
14
14
  return (e) => {
15
- const [t, n] = e;
16
- if (typeof t == "string" && !t.startsWith("http")) {
17
- const s = t.startsWith("/") ? t : `/${t}`;
18
- return u([`${r}${s}`, n]);
15
+ const [r, n] = e;
16
+ if (typeof r == "string" && !r.startsWith("http")) {
17
+ const s = r.startsWith("/") ? r : `/${r}`;
18
+ return u([`${t}${s}`, n]);
19
19
  }
20
20
  return u(e);
21
21
  };
22
22
  }
23
- function se(r) {
24
- return (e) => u(b("Authorization", `Bearer ${r}`, e));
23
+ function se(t) {
24
+ return (e) => u(b("Authorization", `Bearer ${t}`, e));
25
25
  }
26
- function ae(r, e) {
27
- const t = [];
28
- return r && t.push(ne(r)), e && t.push(se(e)), M({
29
- request: t
26
+ function ae(t, e) {
27
+ const r = [];
28
+ return t && r.push(ne(t)), e && r.push(se(e)), $({
29
+ request: r
30
30
  }).service;
31
31
  }
32
32
  const oe = {
@@ -34,59 +34,59 @@ const oe = {
34
34
  Accept: "application/json",
35
35
  "X-Chatter-Entity-Encoding": "false"
36
36
  };
37
- function ie(r) {
38
- if (r instanceof Headers) {
37
+ function ie(t) {
38
+ if (t instanceof Headers) {
39
39
  const e = [];
40
- return r.forEach((t, n) => e.push([n, t])), e;
40
+ return t.forEach((r, n) => e.push([n, r])), e;
41
41
  }
42
- return Array.isArray(r) ? r.map(([e, t]) => [e, t]) : Object.entries(r);
42
+ return Array.isArray(t) ? t.map(([e, r]) => [e, r]) : Object.entries(t);
43
43
  }
44
- function $(r, e) {
45
- if (e === void 0) return { ...r };
46
- const t = { ...r }, n = /* @__PURE__ */ new Map();
47
- for (const a of Object.keys(t)) n.set(a.toLowerCase(), a);
44
+ function M(t, e) {
45
+ if (e === void 0) return { ...t };
46
+ const r = { ...t }, n = /* @__PURE__ */ new Map();
47
+ for (const a of Object.keys(r)) n.set(a.toLowerCase(), a);
48
48
  const s = /* @__PURE__ */ new Set();
49
49
  for (const [a, i] of ie(e)) {
50
50
  const o = a.toLowerCase(), c = n.get(o);
51
- c === void 0 ? (t[a] = i, n.set(o, a), s.add(o)) : s.has(o) ? t[c] = `${t[c]}, ${i}` : (t[c] = i, s.add(o));
51
+ c === void 0 ? (r[a] = i, n.set(o, a), s.add(o)) : s.has(o) ? r[c] = `${r[c]}, ${i}` : (r[c] = i, s.add(o));
52
52
  }
53
- return t;
53
+ return r;
54
54
  }
55
- function L(r) {
56
- return $(oe, r);
55
+ function L(t) {
56
+ return M(oe, t);
57
57
  }
58
- function ce(r) {
59
- if (r === void 0) return;
58
+ function ce(t) {
59
+ if (t === void 0) return;
60
60
  const e = {};
61
- return new Headers(r).forEach((t, n) => {
62
- e[n] = t;
61
+ return new Headers(t).forEach((r, n) => {
62
+ e[n] = r;
63
63
  }), Object.keys(e).length > 0 ? e : void 0;
64
64
  }
65
- const v = () => {
65
+ const S = () => {
66
66
  }, A = async () => {
67
67
  };
68
- function _(r) {
68
+ function _(t) {
69
69
  try {
70
- return C(B(r));
70
+ return C(B(t));
71
71
  } catch (e) {
72
- return D(d(e));
72
+ return D(f(e));
73
73
  }
74
74
  }
75
- function k(r, e) {
76
- const t = r.definitions.filter(
75
+ function k(t, e) {
76
+ const r = t.definitions.filter(
77
77
  (n) => n.kind === "OperationDefinition"
78
78
  );
79
- return t.length === 0 ? "unknown" : t.length === 1 ? e === void 0 || t[0].name?.value === e ? t[0].operation : "unknown" : e === void 0 ? "unknown" : t.find((n) => n.name?.value === e)?.operation ?? "unknown";
79
+ return r.length === 0 ? "unknown" : r.length === 1 ? e === void 0 || r[0].name?.value === e ? r[0].operation : "unknown" : e === void 0 ? "unknown" : r.find((n) => n.name?.value === e)?.operation ?? "unknown";
80
80
  }
81
- function d(r) {
82
- if (r && typeof r == "object" && "data" in r) {
83
- const e = r.data;
81
+ function f(t) {
82
+ if (t && typeof t == "object" && "data" in t) {
83
+ const e = t.data;
84
84
  if (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors))
85
85
  return e.errors;
86
86
  }
87
- return r instanceof Error ? [{ message: r.message }] : typeof r == "string" ? [{ message: r }] : [{ message: "Unknown error" }];
87
+ return t instanceof Error ? [{ message: t.message }] : typeof t == "string" ? [{ message: t }] : [{ message: "Unknown error" }];
88
88
  }
89
- async function H(r, { mutation: e, variables: t, operationName: n, headers: s }) {
89
+ async function H(t, { mutation: e, variables: r, operationName: n, headers: s }) {
90
90
  const a = _(e);
91
91
  if (a.isErr()) return { data: void 0, errors: a.error };
92
92
  const i = a.value, o = k(i, n);
@@ -100,9 +100,9 @@ async function H(r, { mutation: e, variables: t, operationName: n, headers: s })
100
100
  ]
101
101
  };
102
102
  try {
103
- const c = await r({
103
+ const c = await t({
104
104
  query: P(i),
105
- variables: t,
105
+ variables: r,
106
106
  operationName: n,
107
107
  headers: s
108
108
  });
@@ -111,12 +111,12 @@ async function H(r, { mutation: e, variables: t, operationName: n, headers: s })
111
111
  errors: c.errors
112
112
  };
113
113
  } catch (c) {
114
- return { data: void 0, errors: d(c) };
114
+ return { data: void 0, errors: f(c) };
115
115
  }
116
116
  }
117
- function I(r) {
117
+ function I(t) {
118
118
  function e(n, s, a, i) {
119
- return r({
119
+ return t({
120
120
  query: P(n),
121
121
  variables: s,
122
122
  operationName: a,
@@ -126,10 +126,10 @@ function I(r) {
126
126
  data: o.data ?? void 0,
127
127
  errors: o.errors
128
128
  }),
129
- (o) => ({ data: void 0, errors: d(o) })
129
+ (o) => ({ data: void 0, errors: f(o) })
130
130
  );
131
131
  }
132
- async function t({
132
+ async function r({
133
133
  query: n,
134
134
  variables: s,
135
135
  operationName: a,
@@ -140,44 +140,44 @@ function I(r) {
140
140
  return {
141
141
  data: void 0,
142
142
  errors: o.error,
143
- subscribe: () => v,
143
+ subscribe: () => S,
144
144
  refresh: A
145
145
  };
146
- const c = o.value, f = k(c, a);
147
- if (f !== "query")
146
+ const c = o.value, l = k(c, a);
147
+ if (l !== "query")
148
148
  return {
149
149
  data: void 0,
150
150
  errors: [
151
151
  {
152
- message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
152
+ message: `DataSDK.graphql.query() requires a GraphQL query, received ${l}.`
153
153
  }
154
154
  ],
155
- subscribe: () => v,
155
+ subscribe: () => S,
156
156
  refresh: A
157
157
  };
158
158
  const h = /* @__PURE__ */ new Set(), p = s, m = await e(c, p, a, i);
159
159
  return {
160
160
  data: m.data,
161
161
  errors: m.errors,
162
- subscribe(l) {
163
- return h.add(l), () => {
164
- h.delete(l);
162
+ subscribe(d) {
163
+ return h.add(d), () => {
164
+ h.delete(d);
165
165
  };
166
166
  },
167
167
  async refresh() {
168
- const l = await e(c, p, a, i);
169
- for (const g of h) g(l);
168
+ const d = await e(c, p, a, i);
169
+ for (const v of h) v(d);
170
170
  }
171
171
  };
172
172
  }
173
173
  return {
174
- query: t,
175
- mutate: (n) => H(r, n)
174
+ query: r,
175
+ mutate: (n) => H(t, n)
176
176
  };
177
177
  }
178
178
  const ue = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
179
- function F(r = ue) {
180
- return `/services/data/v${r}`;
179
+ function F(t = ue) {
180
+ return `/services/data/v${t}`;
181
181
  }
182
182
  const he = {
183
183
  "Content-Type": "application/json",
@@ -188,33 +188,33 @@ class le {
188
188
  pathData;
189
189
  graphql;
190
190
  constructor(e) {
191
- const t = de(), n = fe(e?.instanceUrl ?? t.instanceUrl), s = e?.accessToken ?? t.accessToken;
192
- this.pathData = F(e?.apiVersion ?? t.apiVersion), this.clientFetch = ae(n || void 0, s), this.graphql = I(this.executeRawGraphQL.bind(this));
191
+ const r = de(), n = fe(e?.instanceUrl ?? r.instanceUrl), s = e?.accessToken ?? r.accessToken;
192
+ this.pathData = F(e?.apiVersion ?? r.apiVersion), this.clientFetch = ae(n || void 0, s), this.graphql = I(this.executeRawGraphQL.bind(this));
193
193
  }
194
194
  async executeRawGraphQL({
195
195
  query: e,
196
- variables: t,
196
+ variables: r,
197
197
  operationName: n,
198
198
  headers: s
199
199
  }) {
200
200
  return (await this.clientFetch(`${this.pathData}/graphql`, {
201
201
  method: "POST",
202
- body: JSON.stringify({ query: e, variables: t, operationName: n }),
203
- headers: $(he, s)
202
+ body: JSON.stringify({ query: e, variables: r, operationName: n }),
203
+ headers: M(he, s)
204
204
  })).json();
205
205
  }
206
206
  }
207
207
  function de() {
208
- const r = globalThis.MOSAIC_ENV;
208
+ const t = globalThis.MOSAIC_ENV;
209
209
  return {
210
- instanceUrl: r?.instanceUrl,
211
- accessToken: r?.accessToken,
212
- apiVersion: r?.apiVersion
210
+ instanceUrl: t?.instanceUrl,
211
+ accessToken: t?.accessToken,
212
+ apiVersion: t?.apiVersion
213
213
  };
214
214
  }
215
- function fe(r) {
216
- if (!r || r === "/") return "";
217
- let e = r;
215
+ function fe(t) {
216
+ if (!t || t === "/") return "";
217
+ let e = t;
218
218
  return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
219
219
  }
220
220
  const pe = "graphqlQuery";
@@ -230,12 +230,12 @@ class me {
230
230
  */
231
231
  async executeRawGraphQL({
232
232
  query: e,
233
- variables: t,
233
+ variables: r,
234
234
  operationName: n
235
235
  }) {
236
236
  return (await window.openai.callTool(pe, {
237
237
  query: e,
238
- ...t != null ? { variables: t } : {},
238
+ ...r != null ? { variables: r } : {},
239
239
  ...n != null ? { operationName: n } : {}
240
240
  })).structuredContent;
241
241
  }
@@ -243,39 +243,39 @@ class me {
243
243
  const ye = {
244
244
  graphql: !0,
245
245
  fetch: !0
246
- }, be = new Set(Object.keys(ye)), w = "Accept-Language", Se = (r) => {
246
+ }, be = new Set(Object.keys(ye)), w = "Accept-Language", ge = (t) => {
247
247
  const e = globalThis.SFDC_ENV?.language;
248
248
  if (!e)
249
- return u(r);
250
- const [t, n] = r;
251
- return (t instanceof Request && !n?.headers ? t.headers.has(w) : new Headers(n?.headers).has(w)) ? u(r) : u(b(w, e, r));
252
- }, ve = "X-SFDC-Client-Name", ge = "X-SFDC-Client-Version", we = "@salesforce/platform-sdk", Ee = "11.54.0", Ce = (r) => {
253
- let e = b(ve, we, r);
254
- return e = b(ge, Ee, e), u(e);
249
+ return u(t);
250
+ const [r, n] = t;
251
+ return (r instanceof Request && !n?.headers ? r.headers.has(w) : new Headers(n?.headers).has(w)) ? u(t) : u(b(w, e, t));
252
+ }, Se = "X-SFDC-Client-Name", ve = "X-SFDC-Client-Version", we = "@salesforce/platform-sdk", Ee = "11.55.0", Ce = (t) => {
253
+ let e = b(Se, we, t);
254
+ return e = b(ve, Ee, e), u(e);
255
255
  }, De = "X-CSRF-Token";
256
- function Ae(r, e = {}) {
257
- const { protectedUrls: t = [], alwaysProtectedUrls: n = [] } = e;
256
+ function Ae(t, e = {}) {
257
+ const { protectedUrls: r = [], alwaysProtectedUrls: n = [] } = e;
258
258
  return async (s) => {
259
259
  const [a, i] = s, o = a instanceof Request ? a.url : a instanceof URL ? a.href : a, c = i?.method ?? (a instanceof Request ? a.method : void 0) ?? "GET";
260
- if (R(n, o) || Pe(c) && R(t, o)) {
261
- const h = await r.getToken();
260
+ if (R(n, o) || Pe(c) && R(r, o)) {
261
+ const h = await t.getToken();
262
262
  s = b(De, h, s);
263
263
  }
264
264
  return u(s);
265
265
  };
266
266
  }
267
- function Pe(r) {
268
- const e = r.toLowerCase();
267
+ function Pe(t) {
268
+ const e = t.toLowerCase();
269
269
  return e === "post" || e === "put" || e === "patch" || e === "delete";
270
270
  }
271
- function R(r, e) {
272
- const t = new URL(e, globalThis.location?.href ?? "http://localhost");
273
- return r.some((n) => t.pathname.includes(n));
271
+ function R(t, e) {
272
+ const r = new URL(e, globalThis.location?.href ?? "http://localhost");
273
+ return t.some((n) => r.pathname.includes(n));
274
274
  }
275
- function _e(r, e = {}) {
276
- const t = Ae(r, e);
275
+ function _e(t, e = {}) {
276
+ const r = Ae(t, e);
277
277
  async function n(s) {
278
- const a = await t(s);
278
+ const a = await r(s);
279
279
  return fetch(a[0], a[1]);
280
280
  }
281
281
  return (s, a) => a ? a.applyRetry(async () => n(s)) : n(s);
@@ -288,13 +288,13 @@ class Re extends J {
288
288
  /**
289
289
  * Determines if a failed request should be retried due to CSRF token issues.
290
290
  */
291
- async shouldRetry(e, t) {
292
- return t.attempt >= 1 ? !1 : ke.includes(e.status);
291
+ async shouldRetry(e, r) {
292
+ return r.attempt >= 1 ? !1 : ke.includes(e.status);
293
293
  }
294
294
  /**
295
295
  * CSRF token refresh should happen immediately with no delay.
296
296
  */
297
- async calculateDelay(e, t) {
297
+ async calculateDelay(e, r) {
298
298
  return 0;
299
299
  }
300
300
  /**
@@ -303,13 +303,13 @@ class Re extends J {
303
303
  * @param _result - The failed response that triggered the retry (unused, already validated)
304
304
  * @param _context - Current retry context (unused but part of interface)
305
305
  */
306
- async prepareRetry(e, t) {
306
+ async prepareRetry(e, r) {
307
307
  await this.csrfTokenManager.refreshToken();
308
308
  }
309
309
  }
310
310
  class qe {
311
- constructor(e, t) {
312
- this.endpoint = e, this.cacheName = t, this.tokenPromise = this.obtainToken();
311
+ constructor(e, r) {
312
+ this.endpoint = e, this.cacheName = r, this.tokenPromise = this.obtainToken();
313
313
  }
314
314
  tokenPromise;
315
315
  refreshPromise;
@@ -336,10 +336,10 @@ class qe {
336
336
  * @returns Promise that resolves to the CSRF token string
337
337
  */
338
338
  async obtainToken() {
339
- let e = await this.withCache((s) => s.match(this.endpoint)), t = !1;
340
- e || (e = await fetch(this.endpoint, { method: "get" }), t = !0);
339
+ let e = await this.withCache((s) => s.match(this.endpoint)), r = !1;
340
+ e || (e = await fetch(this.endpoint, { method: "get" }), r = !0);
341
341
  const n = (await e.clone().json()).csrfToken;
342
- return t && await this.withCache((s) => s.put(this.endpoint, e)), n;
342
+ return r && await this.withCache((s) => s.put(this.endpoint, e)), n;
343
343
  }
344
344
  /**
345
345
  * Provides a safe way to interact with the Cache API with fallback for unsupported environments.
@@ -349,68 +349,68 @@ class qe {
349
349
  */
350
350
  async withCache(e) {
351
351
  if (this.cacheName && caches) {
352
- const t = await caches.open(this.cacheName);
353
- return e(t);
352
+ const r = await caches.open(this.cacheName);
353
+ return e(r);
354
354
  } else
355
355
  return;
356
356
  }
357
357
  }
358
358
  const q = /* @__PURE__ */ new Map();
359
- function Oe(r) {
360
- const { endpoint: e, cacheName: t, ...n } = r.csrf;
359
+ function Oe(t) {
360
+ const { endpoint: e, cacheName: r, ...n } = t.csrf;
361
361
  let s = q.get(e);
362
- return s || (s = new qe(e, t), q.set(e, s)), M(
362
+ return s || (s = new qe(e, r), q.set(e, s)), $(
363
363
  {
364
364
  retry: _e(s, n),
365
- request: [Ce, Se]
365
+ request: [Ce, ge]
366
366
  },
367
367
  X(new Re(s)).service
368
368
  ).service;
369
369
  }
370
370
  const O = /* @__PURE__ */ new Map();
371
- function Te(r) {
372
- let e = O.get(r);
371
+ function Te(t) {
372
+ let e = O.get(t);
373
373
  if (!e) {
374
- const t = Y().service, n = ee(t).service, s = Z(t, n).service, a = re().service;
375
- e = { cache: t, cacheController: s, pubSub: a }, O.set(r, e);
374
+ const r = Y().service, n = ee(r).service, s = Z(r, n).service, a = te().service;
375
+ e = { cache: r, cacheController: s, pubSub: a }, O.set(t, e);
376
376
  }
377
377
  return e;
378
378
  }
379
- function Ne(r, e) {
380
- const t = Te(r);
379
+ function Ne(t, e) {
380
+ const r = Te(t);
381
381
  return {
382
- shared: t,
382
+ shared: r,
383
383
  services: {
384
- cacheController: t.cacheController,
385
- pubSub: t.pubSub,
384
+ cacheController: r.cacheController,
385
+ pubSub: r.pubSub,
386
386
  fetch: e
387
387
  }
388
388
  };
389
389
  }
390
390
  const T = 300;
391
- function Me(r, e) {
391
+ function $e(t, e) {
392
392
  try {
393
- return JSON.parse(JSON.stringify(r));
394
- } catch (t) {
393
+ return JSON.parse(JSON.stringify(t));
394
+ } catch (r) {
395
395
  const n = e || "(anonymous)", s = new TypeError(
396
- `HttpGraphQLResourceCacheControlCommand: variables for operation "${n}" must be JSON-serializable. ${t.message}`
396
+ `HttpGraphQLResourceCacheControlCommand: variables for operation "${n}" must be JSON-serializable. ${r.message}`
397
397
  );
398
- throw s.cause = t, s;
398
+ throw s.cause = r, s;
399
399
  }
400
400
  }
401
- function $e(r) {
402
- if (typeof r == "object" && r.type === "max-age") {
403
- const e = r.maxAge;
401
+ function Me(t) {
402
+ if (typeof t == "object" && t.type === "max-age") {
403
+ const e = t.maxAge;
404
404
  return Number.isFinite(e) && e >= 0 ? e : T;
405
405
  }
406
406
  return T;
407
407
  }
408
- class Le extends te {
409
- constructor(e, t, n) {
410
- super(t), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = Me(
408
+ class Le extends re {
409
+ constructor(e, r, n) {
410
+ super(r), this.url = n, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = $e(
411
411
  e.variables ?? {},
412
412
  this.normalizedOperationName
413
- ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = $e(e.cacheControl), this.headers = e.headers, this.headersKey = ce(e.headers);
413
+ ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Me(e.cacheControl), this.headers = e.headers, this.headersKey = ce(e.headers);
414
414
  }
415
415
  query;
416
416
  normalizedVariables;
@@ -455,14 +455,14 @@ class Le extends te {
455
455
  * @returns result or error from the cache
456
456
  */
457
457
  readFromCache(e) {
458
- const t = this.buildKey(), n = e.get(t)?.value;
458
+ const r = this.buildKey(), n = e.get(r)?.value;
459
459
  return n === void 0 ? u(D(new j())) : u(C(n));
460
460
  }
461
- writeToCache(e, t) {
462
- if (t.isOk() && t.value.data != null && Object.keys(t.value.data).length > 0) {
461
+ writeToCache(e, r) {
462
+ if (r.isOk() && r.value.data != null && Object.keys(r.value.data).length > 0) {
463
463
  const n = Math.floor(Date.now() / 1e3);
464
464
  e.set(this.buildKey(), {
465
- value: t.value.data,
465
+ value: r.value.data,
466
466
  metadata: {
467
467
  cacheControl: {
468
468
  type: "max-age",
@@ -489,63 +489,63 @@ class Le extends te {
489
489
  return this.responseHasErrors(e) ? D(new z(e)) : C(e);
490
490
  }
491
491
  }
492
- function K(r) {
493
- if (W(r) && r.data && typeof r.data == "object") {
494
- const e = r.data;
492
+ function K(t) {
493
+ if (W(t) && t.data && typeof t.data == "object") {
494
+ const e = t.data;
495
495
  if (e.data != null)
496
496
  return e.data;
497
497
  }
498
498
  }
499
- function He(r) {
499
+ function He(t) {
500
500
  return (e) => {
501
501
  if (e.isOk()) {
502
- const t = e.value;
503
- S(t), r({ data: t, errors: void 0 });
502
+ const r = e.value;
503
+ g(r), t({ data: r, errors: void 0 });
504
504
  } else {
505
- const t = K(e.error);
506
- t && S(t), r({ data: t, errors: d(e.error) });
505
+ const r = K(e.error);
506
+ r && g(r), t({ data: r, errors: f(e.error) });
507
507
  }
508
508
  };
509
509
  }
510
- async function Ie(r) {
511
- let e, t, n;
510
+ async function Ie(t) {
511
+ let e, r, n;
512
512
  try {
513
- const s = await r.execute();
514
- s.isOk() ? (e = s.value.data, S(e), n = (a) => s.value.subscribe(a)) : (e = K(s.error.failure), e && S(e), t = d(s.error.failure), n = (a) => s.error.subscribe(a));
513
+ const s = await t.execute();
514
+ s.isOk() ? (e = s.value.data, g(e), n = (a) => s.value.subscribe(a)) : (e = K(s.error.failure), e && g(e), r = f(s.error.failure), n = (a) => s.error.subscribe(a));
515
515
  } catch (s) {
516
- t = d(s);
516
+ r = f(s);
517
517
  }
518
518
  return {
519
519
  data: e,
520
- errors: t,
520
+ errors: r,
521
521
  subscribe(s) {
522
- return n ? n(He(s)) : v;
522
+ return n ? n(He(s)) : S;
523
523
  },
524
524
  async refresh() {
525
- await r.refresh();
525
+ await t.refresh();
526
526
  }
527
527
  };
528
528
  }
529
- function E(r) {
529
+ function E(t) {
530
530
  return {
531
531
  data: void 0,
532
- errors: r,
533
- subscribe: () => v,
532
+ errors: t,
533
+ subscribe: () => S,
534
534
  refresh: A
535
535
  };
536
536
  }
537
537
  function Fe({
538
- bundle: r,
538
+ bundle: t,
539
539
  url: e,
540
- executeRaw: t
540
+ executeRaw: r
541
541
  }) {
542
- const { services: n } = r;
542
+ const { services: n } = t;
543
543
  async function s({
544
544
  query: a,
545
545
  variables: i,
546
546
  operationName: o,
547
547
  cacheControl: c,
548
- headers: f
548
+ headers: l
549
549
  }) {
550
550
  const h = _(a);
551
551
  if (h.isErr()) return E(h.error);
@@ -556,27 +556,27 @@ function Fe({
556
556
  message: `DataSDK.graphql.query() requires a GraphQL query, received ${m}.`
557
557
  }
558
558
  ]);
559
- let l;
559
+ let d;
560
560
  try {
561
- l = new Le(
561
+ d = new Le(
562
562
  {
563
563
  query: P(p),
564
564
  variables: i,
565
565
  operationName: o,
566
566
  cacheControl: c,
567
- headers: f
567
+ headers: l
568
568
  },
569
569
  n,
570
570
  e
571
571
  );
572
- } catch (g) {
573
- return E(d(g));
572
+ } catch (v) {
573
+ return E(f(v));
574
574
  }
575
- return Ie(l);
575
+ return Ie(d);
576
576
  }
577
577
  return {
578
578
  query: s,
579
- mutate: (a) => H(t, a)
579
+ mutate: (a) => H(r, a)
580
580
  };
581
581
  }
582
582
  const Ke = 1, Ue = `@salesforce/platform-sdk-data_v${Ke}`, U = F(), Ve = `${U}/ui-api`, N = `${U}/graphql`;
@@ -586,8 +586,8 @@ class xe {
586
586
  onStatus;
587
587
  graphql;
588
588
  constructor(e) {
589
- const t = Ge();
590
- this.baseUrl = Qe(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = Oe({
589
+ const r = Ge();
590
+ this.baseUrl = Qe(e?.basePath ?? r.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = Oe({
591
591
  csrf: {
592
592
  endpoint: `${this.baseUrl}${Ve}/session/csrf`,
593
593
  cacheName: Ue,
@@ -602,8 +602,8 @@ class xe {
602
602
  executeRaw: this.executeRawGraphQL.bind(this)
603
603
  });
604
604
  }
605
- async fetch(e, t) {
606
- const n = this.applySalesforceBase(e), s = await this.clientFetch(n, t);
605
+ async fetch(e, r) {
606
+ const n = this.applySalesforceBase(e), s = await this.clientFetch(n, r);
607
607
  return await this.onStatus[s.status]?.(), s;
608
608
  }
609
609
  /**
@@ -614,13 +614,13 @@ class xe {
614
614
  */
615
615
  async executeRawGraphQL({
616
616
  query: e,
617
- variables: t,
617
+ variables: r,
618
618
  operationName: n,
619
619
  headers: s
620
620
  }) {
621
621
  return (await this.fetch(N, {
622
622
  method: "POST",
623
- body: JSON.stringify({ query: e, variables: t, operationName: n }),
623
+ body: JSON.stringify({ query: e, variables: r, operationName: n }),
624
624
  headers: L(s)
625
625
  })).json();
626
626
  }
@@ -632,8 +632,8 @@ class xe {
632
632
  if (typeof e == "string") {
633
633
  if (e.startsWith("http"))
634
634
  return e;
635
- const t = e.startsWith("/") ? e : `/${e}`;
636
- return `${this.baseUrl}${t}`;
635
+ const r = e.startsWith("/") ? e : `/${e}`;
636
+ return `${this.baseUrl}${r}`;
637
637
  }
638
638
  return e;
639
639
  }
@@ -643,32 +643,41 @@ function Ge() {
643
643
  apiPath: globalThis.SFDC_ENV?.apiPath
644
644
  };
645
645
  }
646
- function Qe(r) {
647
- if (!r || r === "/") return "";
648
- let e = r;
646
+ function Qe(t) {
647
+ if (!t || t === "/") return "";
648
+ let e = t;
649
649
  return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
650
650
  }
651
- async function je(r, e, t = /* @__PURE__ */ new Set()) {
651
+ function je(t) {
652
+ const e = typeof t == "object" && t !== null && "setup" in t, r = e ? t : t.plugin, n = e ? r?.name : t.as;
653
+ if (typeof r?.setup != "function")
654
+ throw new Error("Plugin entry cannot attach: it is missing a setup function.");
655
+ if (typeof n != "string" || n.length === 0)
656
+ throw new Error(
657
+ e ? 'Plugin entry cannot attach: "name" must be a non-empty string.' : 'Plugin entry cannot attach: alias "as" must be a non-empty string.'
658
+ );
659
+ return { plugin: r, mountName: n };
660
+ }
661
+ async function ze(t, e, r = /* @__PURE__ */ new Set()) {
652
662
  if (e.length === 0)
653
- return r;
654
- const n = Object.create(r);
663
+ return t;
664
+ const n = Object.create(t);
655
665
  for (const s of e) {
656
- if (t.has(s.name))
657
- throw new Error(
658
- `Plugin "${s.name}" cannot attach: "${s.name}" is a reserved SDK name.`
659
- );
660
- if (s.name in n)
666
+ const { plugin: a, mountName: i } = je(s), o = i === a.name ? `"${a.name}"` : `"${a.name}" (aliased as "${i}")`;
667
+ if (r.has(i))
668
+ throw new Error(`Plugin ${o} cannot attach: "${i}" is a reserved SDK name.`);
669
+ if (i in n)
661
670
  throw new Error(
662
- `Plugin "${s.name}" cannot attach: "${s.name}" is already defined on the SDK.`
671
+ `Plugin ${o} cannot attach: "${i}" is already defined on the SDK.`
663
672
  );
664
- let a;
673
+ let c;
665
674
  try {
666
- a = await s.setup(n);
667
- } catch (i) {
668
- throw new Error(`Plugin "${s.name}" failed during setup.`, { cause: i });
675
+ c = await a.setup(n);
676
+ } catch (l) {
677
+ throw new Error(`Plugin ${o} failed during setup.`, { cause: l });
669
678
  }
670
- Object.defineProperty(n, s.name, {
671
- value: a,
679
+ Object.defineProperty(n, i, {
680
+ value: c,
672
681
  enumerable: !0,
673
682
  writable: !0,
674
683
  configurable: !0
@@ -676,23 +685,23 @@ async function je(r, e, t = /* @__PURE__ */ new Set()) {
676
685
  }
677
686
  return n;
678
687
  }
679
- function or(r, ...e) {
680
- let t = r[0] ?? "";
688
+ function it(t, ...e) {
689
+ let r = t[0] ?? "";
681
690
  for (let n = 0; n < e.length; n += 1)
682
- t += String(e[n]) + (r[n + 1] ?? "");
683
- return t;
691
+ r += String(e[n]) + (t[n + 1] ?? "");
692
+ return r;
684
693
  }
685
- const ir = G();
686
- async function ze(r) {
694
+ const ct = G();
695
+ async function We(t) {
687
696
  try {
688
- switch (await V(r?.surface)) {
697
+ switch (await V(t?.surface)) {
689
698
  case y.OpenAI:
690
699
  return new me();
691
700
  case y.WebApp:
692
701
  case y.MicroFrontend:
693
- return new xe(r?.webapp);
702
+ return new xe(t?.webapp);
694
703
  case y.Mosaic:
695
- return new le(r?.mosaic);
704
+ return new le(t?.mosaic);
696
705
  case y.MCPApps:
697
706
  return {};
698
707
  default:
@@ -702,17 +711,17 @@ async function ze(r) {
702
711
  return {};
703
712
  }
704
713
  }
705
- function cr(r) {
714
+ function ut(t) {
706
715
  return x(
707
716
  (async () => {
708
- const e = await ze(r);
709
- return je(e, r?.plugins ?? [], be);
717
+ const e = await We(t);
718
+ return ze(e, t?.plugins ?? [], be);
710
719
  })(),
711
720
  "createDataSDK"
712
721
  );
713
722
  }
714
723
  export {
715
- cr as createDataSDK,
716
- ir as defineDataPlugin,
717
- or as gql
724
+ ut as createDataSDK,
725
+ ct as defineDataPlugin,
726
+ it as gql
718
727
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.54.0",
3
+ "version": "11.55.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -126,7 +126,7 @@
126
126
  "@conduit-client/service-pubsub": "3.19.6",
127
127
  "@conduit-client/service-retry": "3.19.6",
128
128
  "@conduit-client/utils": "3.19.6",
129
- "@salesforce/jsonrpc": "^11.54.0",
129
+ "@salesforce/jsonrpc": "^11.55.0",
130
130
  "@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
131
131
  },
132
132
  "peerDependencies": {