@salesforce/sf-embedding-bridge 2.2.1-rc.7 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap-envelope.d.ts.map +1 -0
- package/dist/bootstrap-listener.d.ts.map +1 -0
- package/dist/bootstrap-session.d.ts.map +1 -0
- package/dist/embedding-info.d.ts.map +1 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/host-meta-data.d.ts.map +1 -0
- package/dist/index.cjs.js +11 -91
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +4 -289
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +3 -73
- package/dist/index.esm.js.map +1 -0
- package/package.json +2 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-envelope.d.ts","sourceRoot":"","sources":["../src/bootstrap-envelope.ts"],"names":[],"mappings":"AAUA,OAAO,EAA2B,KAAK,iBAAiB,EAAiB,MAAM,mCAAmC,CAAC;AAEnH,MAAM,MAAM,kCAAkC,GACxC,eAAe,GACf,cAAc,GACd,oBAAoB,GACpB,kBAAkB,GAClB,sBAAsB,GACtB,oBAAoB,CAAC;AAE3B,MAAM,MAAM,iCAAiC,GACvC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAC5D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,kCAAkC,CAAA;CAAE,CAAC;AAEhE,MAAM,WAAW,gCAAgC;IAC7C,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC1C,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;CAC5B;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAQ9E;AAED,kGAAkG;AAClG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gCAAgC,GAAG,iCAAiC,CAYpH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-listener.d.ts","sourceRoot":"","sources":["../src/bootstrap-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAiB,MAAM,mCAAmC,CAAC;AAKrG,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC9B;AAED,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE7D,qBAAa,qBAAsB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;gBAC5B,MAAM,EAAE,sBAAsB;CAK7C;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAkDrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-session.d.ts","sourceRoot":"","sources":["../src/bootstrap-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAIH,KAAK,YAAY,EACpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,KAAK,sBAAsB,EAA4B,MAAM,sBAAsB,CAAC;AAG7F,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,sBAAsB,CAAC;CAC3C;AAED,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GAAG,SAAS,CAAC;AAEtE,qBAAa,mBAAoB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;gBAC1B,MAAM,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,OAAO;CAQ5D;AAED,MAAM,WAAW,uBAAuB;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACxB;AA+BD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,aAAa,CAAC,CA+B9F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-info.d.ts","sourceRoot":"","sources":["../src/embedding-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAKlE,oEAAoE;AACpE,eAAO,MAAM,cAAc,EAAE,QAG5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,KAAK,mBAAmB,EAG3B,MAAM,qBAAqB,CAAC;AAG7B,qFAAqF;AACrF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;CAGZ,CAAC;AAEX,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAExE,6IAA6I;AAC7I,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IACL,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;CAClB,GACP,mBAAmB,CAKrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-meta-data.d.ts","sourceRoot":"","sources":["../src/host-meta-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAmCpE"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,78 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var sfEmbeddingContract = require('@salesforce/sf-embedding-contract');
|
|
3
4
|
var jsonrpc = require('@salesforce/jsonrpc');
|
|
4
5
|
|
|
5
|
-
// Bootstrap envelope vocabulary. Spec: EMBEDDING-PROTOCOL.md §3.1, §3.1.1,
|
|
6
|
-
// MC-7/MC-8/MC-10 in §2.2.
|
|
7
|
-
/** Wire identifier for this protocol. Carried verbatim on every bootstrap envelope. */
|
|
8
|
-
const PROTOCOL_NAME = "sf-embedding";
|
|
9
|
-
/** Discriminator for the host → embedding bootstrap envelope. */
|
|
10
|
-
const BOOTSTRAP_ENVELOPE_TYPE = "sf-embedding.bootstrap";
|
|
11
|
-
/** Discriminator for the embedding → host content-free heartbeat. */
|
|
12
|
-
const HEARTBEAT_TYPE = "sf-embedding/ready";
|
|
13
|
-
/**
|
|
14
|
-
* Discriminator for the embedding → host fail-closed shutdown signal
|
|
15
|
-
* (e.g., duplicate-transfer detection). Posted via window-level postMessage,
|
|
16
|
-
* not over the JSON-RPC port.
|
|
17
|
-
*/
|
|
18
|
-
const SHUTDOWN_TYPE = "sf-embedding/shutdown";
|
|
19
|
-
|
|
20
|
-
// sf-embedding protocol-specific JSON-RPC error codes. Spec §8.2.
|
|
21
|
-
//
|
|
22
|
-
// Standard JSON-RPC codes (-32700, -32600..-32603) and transport-level codes
|
|
23
|
-
// (PORT_CLOSED, SERIALIZATION_FAILURE, REQUEST_TIMEOUT, BACKPRESSURE,
|
|
24
|
-
// REQUEST_CANCELLED) live in `@salesforce/jsonrpc`'s
|
|
25
|
-
// `StandardErrorCode` and are NOT re-exported here. Consumers that need the
|
|
26
|
-
// merged vocabulary compose them at the call site.
|
|
27
|
-
/** sf-embedding protocol-specific error codes (§8.2 numeric assignments). */
|
|
28
|
-
const SfEmbeddingErrorCode = {
|
|
29
|
-
/** Method exists at selected version but is not granted (§6.5). */
|
|
30
|
-
CAPABILITY_NOT_ALLOWED: -32010,
|
|
31
|
-
/** In-flight request gated on a capability that was just revoked (§6.6). */
|
|
32
|
-
CAPABILITY_REVOKED: -32011,
|
|
33
|
-
/** Frame arrived before the required handshake step completed (§5.2, §4.2). */
|
|
34
|
-
NOT_INITIALIZED: -32012,
|
|
35
|
-
/** Embedding's protocol version is not supported by the host (§4.2, §3.1.2). */
|
|
36
|
-
PROTOCOL_VERSION_MISMATCH: -32013,
|
|
37
|
-
/** Frame's origin does not match the bound peer origin (§3.1). */
|
|
38
|
-
ORIGIN_MISMATCH: -32014,
|
|
39
|
-
/** Catch-all — duplicate ui/select-version, duplicate ui/discover-capabilities, etc. */
|
|
40
|
-
PROTOCOL_VIOLATION: -32020,
|
|
41
|
-
/** Embedding observed a second valid bootstrap envelope and shut down (§3.1.2). */
|
|
42
|
-
BOOTSTRAP_DUPLICATE_TRANSFER: -32023,
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Codes that are non-retryable by default (§8.4). Consumers building error
|
|
46
|
-
* payloads SHOULD set `retryable: false` automatically for these.
|
|
47
|
-
*/
|
|
48
|
-
const NON_RETRYABLE_CODES = new Set([
|
|
49
|
-
SfEmbeddingErrorCode.CAPABILITY_NOT_ALLOWED,
|
|
50
|
-
SfEmbeddingErrorCode.CAPABILITY_REVOKED,
|
|
51
|
-
SfEmbeddingErrorCode.ORIGIN_MISMATCH,
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
// Host LWC reserved DOM event names and detail shapes. Spec §12.3.
|
|
55
|
-
//
|
|
56
|
-
// These are dispatched by the host LWC on its own element so application
|
|
57
|
-
// code on the page can react. The embedding never observes them.
|
|
58
|
-
/** Event names the host LWC dispatches on its own element. Reserved by the protocol. */
|
|
59
|
-
const HostLwcEvent = {
|
|
60
|
-
/** Synchronous with `ui/discover-capabilities` response; session reaches READY. */
|
|
61
|
-
READY: "sf-embedding.component.ready",
|
|
62
|
-
/** Misconfiguration, bootstrap failure, embedding-reported fatal, or protocol violation. */
|
|
63
|
-
ERROR: "sf-embedding.component.error",
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Host-supplied iframe URL metadata (per ADR 0029). Spec §3.1, MC-8/MC-10.
|
|
67
|
-
/** URL query-parameter name carrying the JSON-encoded `HostMetaData`. */
|
|
68
|
-
const HOST_META_DATA_PARAM = "hostMetaData";
|
|
69
|
-
|
|
70
|
-
// JSON-RPC method names on the wire today.
|
|
71
|
-
/** Host announces session identity to the embedding over the port. */
|
|
72
|
-
const HOST_INITIALIZED_METHOD = "ui/notifications/host-initialized";
|
|
73
|
-
/** Embedding acknowledges receipt of `host-initialized`. Fire-and-forget. */
|
|
74
|
-
const EMBEDDING_INITIALIZED_METHOD = "ui/notifications/embedding-initialized";
|
|
75
|
-
|
|
76
6
|
// Bootstrap envelope validator for the iframe (embedding) side of the
|
|
77
7
|
// sf-embedding handshake.
|
|
78
8
|
//
|
|
@@ -87,9 +17,9 @@ function isBootstrapEnvelope(value) {
|
|
|
87
17
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
88
18
|
return false;
|
|
89
19
|
const v = value;
|
|
90
|
-
if (v.type !== BOOTSTRAP_ENVELOPE_TYPE)
|
|
20
|
+
if (v.type !== sfEmbeddingContract.BOOTSTRAP_ENVELOPE_TYPE)
|
|
91
21
|
return false;
|
|
92
|
-
if (v.protocol !== PROTOCOL_NAME)
|
|
22
|
+
if (v.protocol !== sfEmbeddingContract.PROTOCOL_NAME)
|
|
93
23
|
return false;
|
|
94
24
|
if (typeof v.instanceId !== "string" || v.instanceId.length === 0)
|
|
95
25
|
return false;
|
|
@@ -129,7 +59,7 @@ function readHostMetaData(search) {
|
|
|
129
59
|
catch {
|
|
130
60
|
return null;
|
|
131
61
|
}
|
|
132
|
-
const raw = params.get(HOST_META_DATA_PARAM);
|
|
62
|
+
const raw = params.get(sfEmbeddingContract.HOST_META_DATA_PARAM);
|
|
133
63
|
if (!raw)
|
|
134
64
|
return null;
|
|
135
65
|
let parsed;
|
|
@@ -190,7 +120,7 @@ function installBootstrapListener() {
|
|
|
190
120
|
if (!result.ok) {
|
|
191
121
|
if (result.reason === "DUPLICATE_TRANSFER") {
|
|
192
122
|
try {
|
|
193
|
-
window.parent.postMessage({ type: SHUTDOWN_TYPE, reason: "DUPLICATE_PORT_TRANSFER" }, meta.hostAppOrigin);
|
|
123
|
+
window.parent.postMessage({ type: sfEmbeddingContract.SHUTDOWN_TYPE, reason: "DUPLICATE_PORT_TRANSFER" }, meta.hostAppOrigin);
|
|
194
124
|
}
|
|
195
125
|
catch {
|
|
196
126
|
// ignore
|
|
@@ -206,7 +136,7 @@ function installBootstrapListener() {
|
|
|
206
136
|
};
|
|
207
137
|
window.addEventListener("message", handler);
|
|
208
138
|
try {
|
|
209
|
-
window.parent.postMessage({ type: HEARTBEAT_TYPE, instanceId: meta.instanceId }, meta.hostAppOrigin);
|
|
139
|
+
window.parent.postMessage({ type: sfEmbeddingContract.HEARTBEAT_TYPE, instanceId: meta.instanceId }, meta.hostAppOrigin);
|
|
210
140
|
}
|
|
211
141
|
catch {
|
|
212
142
|
// ignore
|
|
@@ -217,7 +147,7 @@ function installBootstrapListener() {
|
|
|
217
147
|
/** Identity emitted on `ui/notifications/embedding-initialized`. */
|
|
218
148
|
const EMBEDDING_INFO = {
|
|
219
149
|
name: "@salesforce/sf-embedding-bridge",
|
|
220
|
-
version: "2.2.
|
|
150
|
+
version: "2.2.2",
|
|
221
151
|
};
|
|
222
152
|
|
|
223
153
|
class SessionFailureError extends Error {
|
|
@@ -234,7 +164,7 @@ class SessionFailureError extends Error {
|
|
|
234
164
|
class SessionClient extends jsonrpc.JsonRpcClient {
|
|
235
165
|
waitForHostInitialized() {
|
|
236
166
|
return new Promise((resolve) => {
|
|
237
|
-
this.registerNotificationHandler(HOST_INITIALIZED_METHOD, (params) => {
|
|
167
|
+
this.registerNotificationHandler(sfEmbeddingContract.HOST_INITIALIZED_METHOD, (params) => {
|
|
238
168
|
const payload = params && typeof params === "object" && !Array.isArray(params)
|
|
239
169
|
? params
|
|
240
170
|
: {};
|
|
@@ -244,7 +174,7 @@ class SessionClient extends jsonrpc.JsonRpcClient {
|
|
|
244
174
|
}
|
|
245
175
|
sendInitializedNotification() {
|
|
246
176
|
const params = { embeddingInfo: EMBEDDING_INFO };
|
|
247
|
-
this.sendNotification(EMBEDDING_INITIALIZED_METHOD, params);
|
|
177
|
+
this.sendNotification(sfEmbeddingContract.EMBEDDING_INITIALIZED_METHOD, params);
|
|
248
178
|
}
|
|
249
179
|
}
|
|
250
180
|
function rejectOnAbort(signal) {
|
|
@@ -301,29 +231,19 @@ function bootstrapSession(options = {}) {
|
|
|
301
231
|
/** Combined error vocabulary: standard + transport-level + sf-embedding-specific. */
|
|
302
232
|
const ErrorCode = {
|
|
303
233
|
...jsonrpc.StandardErrorCode,
|
|
304
|
-
...SfEmbeddingErrorCode,
|
|
234
|
+
...sfEmbeddingContract.SfEmbeddingErrorCode,
|
|
305
235
|
};
|
|
306
236
|
/** Builds a JSON-RPC error payload with sf-embedding-specific retryable defaults; falls through to @salesforce/jsonrpc for codes it owns. */
|
|
307
237
|
function makeJsonRpcError(code, options = {}) {
|
|
308
|
-
if (NON_RETRYABLE_CODES.has(code) && options.retryable === undefined) {
|
|
238
|
+
if (sfEmbeddingContract.NON_RETRYABLE_CODES.has(code) && options.retryable === undefined) {
|
|
309
239
|
return jsonrpc.makeJsonRpcError(code, { ...options, retryable: false });
|
|
310
240
|
}
|
|
311
241
|
return jsonrpc.makeJsonRpcError(code, options);
|
|
312
242
|
}
|
|
313
243
|
|
|
314
|
-
exports.BOOTSTRAP_ENVELOPE_TYPE = BOOTSTRAP_ENVELOPE_TYPE;
|
|
315
244
|
exports.BootstrapFailureError = BootstrapFailureError;
|
|
316
|
-
exports.EMBEDDING_INITIALIZED_METHOD = EMBEDDING_INITIALIZED_METHOD;
|
|
317
245
|
exports.ErrorCode = ErrorCode;
|
|
318
|
-
exports.HEARTBEAT_TYPE = HEARTBEAT_TYPE;
|
|
319
|
-
exports.HOST_INITIALIZED_METHOD = HOST_INITIALIZED_METHOD;
|
|
320
|
-
exports.HOST_META_DATA_PARAM = HOST_META_DATA_PARAM;
|
|
321
|
-
exports.HostLwcEvent = HostLwcEvent;
|
|
322
|
-
exports.NON_RETRYABLE_CODES = NON_RETRYABLE_CODES;
|
|
323
|
-
exports.PROTOCOL_NAME = PROTOCOL_NAME;
|
|
324
|
-
exports.SHUTDOWN_TYPE = SHUTDOWN_TYPE;
|
|
325
246
|
exports.SessionFailureError = SessionFailureError;
|
|
326
|
-
exports.SfEmbeddingErrorCode = SfEmbeddingErrorCode;
|
|
327
247
|
exports.bootstrapSession = bootstrapSession;
|
|
328
248
|
exports.isBootstrapEnvelope = isBootstrapEnvelope;
|
|
329
249
|
exports.makeJsonRpcError = makeJsonRpcError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/bootstrap-envelope.ts","../src/host-meta-data.ts","../src/bootstrap-listener.ts","../src/embedding-info.ts","../src/bootstrap-session.ts","../src/errors.ts"],"sourcesContent":[null,null,null,null,null,null],"names":["BOOTSTRAP_ENVELOPE_TYPE","PROTOCOL_NAME","HOST_META_DATA_PARAM","SHUTDOWN_TYPE","HEARTBEAT_TYPE","JsonRpcClient","HOST_INITIALIZED_METHOD","EMBEDDING_INITIALIZED_METHOD","MessageChannelTransport","StandardErrorCode","SfEmbeddingErrorCode","NON_RETRYABLE_CODES","makeStandardError"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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G,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACpE;AACA,IAAA,OAAOA,wBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3C;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,128 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** Discriminator for the host → embedding bootstrap envelope. */
|
|
4
|
-
declare const BOOTSTRAP_ENVELOPE_TYPE: "sf-embedding.bootstrap";
|
|
5
|
-
/** Discriminator for the embedding → host content-free heartbeat. */
|
|
6
|
-
declare const HEARTBEAT_TYPE: "sf-embedding/ready";
|
|
7
|
-
/**
|
|
8
|
-
* Discriminator for the embedding → host fail-closed shutdown signal
|
|
9
|
-
* (e.g., duplicate-transfer detection). Posted via window-level postMessage,
|
|
10
|
-
* not over the JSON-RPC port.
|
|
11
|
-
*/
|
|
12
|
-
declare const SHUTDOWN_TYPE: "sf-embedding/shutdown";
|
|
13
|
-
/** Bootstrap envelope the host transfers to the embedding alongside `port1`. */
|
|
14
|
-
interface BootstrapEnvelope {
|
|
15
|
-
type: typeof BOOTSTRAP_ENVELOPE_TYPE;
|
|
16
|
-
protocol: typeof PROTOCOL_NAME;
|
|
17
|
-
/** Host-minted; byte-for-byte identical to `hostMetaData.instanceId` (MC-10). */
|
|
18
|
-
instanceId: string;
|
|
19
|
-
/** Origins the host expects its wrapper chrome to load on; embedding reverse-checks. */
|
|
20
|
-
allowedOrigins: string[];
|
|
21
|
-
}
|
|
22
|
-
/** Heartbeat the embedding posts to `window.parent` before the port is transferred. */
|
|
23
|
-
interface HeartbeatEnvelope {
|
|
24
|
-
type: typeof HEARTBEAT_TYPE;
|
|
25
|
-
/** Mirrors the URL-supplied `hostMetaData.instanceId`; binds the heartbeat to this iframe instance. */
|
|
26
|
-
instanceId: string;
|
|
27
|
-
}
|
|
28
|
-
/** Embedding-initiated fail-closed shutdown payload (sibling-race detected, etc.). */
|
|
29
|
-
interface ShutdownEnvelope {
|
|
30
|
-
type: typeof SHUTDOWN_TYPE;
|
|
31
|
-
/** Free-form; common values: `"DUPLICATE_PORT_TRANSFER"`. */
|
|
32
|
-
reason?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** sf-embedding protocol-specific error codes (§8.2 numeric assignments). */
|
|
36
|
-
declare const SfEmbeddingErrorCode: {
|
|
37
|
-
/** Method exists at selected version but is not granted (§6.5). */
|
|
38
|
-
readonly CAPABILITY_NOT_ALLOWED: -32010;
|
|
39
|
-
/** In-flight request gated on a capability that was just revoked (§6.6). */
|
|
40
|
-
readonly CAPABILITY_REVOKED: -32011;
|
|
41
|
-
/** Frame arrived before the required handshake step completed (§5.2, §4.2). */
|
|
42
|
-
readonly NOT_INITIALIZED: -32012;
|
|
43
|
-
/** Embedding's protocol version is not supported by the host (§4.2, §3.1.2). */
|
|
44
|
-
readonly PROTOCOL_VERSION_MISMATCH: -32013;
|
|
45
|
-
/** Frame's origin does not match the bound peer origin (§3.1). */
|
|
46
|
-
readonly ORIGIN_MISMATCH: -32014;
|
|
47
|
-
/** Catch-all — duplicate ui/select-version, duplicate ui/discover-capabilities, etc. */
|
|
48
|
-
readonly PROTOCOL_VIOLATION: -32020;
|
|
49
|
-
/** Embedding observed a second valid bootstrap envelope and shut down (§3.1.2). */
|
|
50
|
-
readonly BOOTSTRAP_DUPLICATE_TRANSFER: -32023;
|
|
51
|
-
};
|
|
52
|
-
/** Numeric type of any value in `SfEmbeddingErrorCode`. */
|
|
53
|
-
type SfEmbeddingErrorCodeValue = (typeof SfEmbeddingErrorCode)[keyof typeof SfEmbeddingErrorCode];
|
|
54
|
-
/**
|
|
55
|
-
* Codes that are non-retryable by default (§8.4). Consumers building error
|
|
56
|
-
* payloads SHOULD set `retryable: false` automatically for these.
|
|
57
|
-
*/
|
|
58
|
-
declare const NON_RETRYABLE_CODES: ReadonlySet<number>;
|
|
59
|
-
|
|
60
|
-
/** Event names the host LWC dispatches on its own element. Reserved by the protocol. */
|
|
61
|
-
declare const HostLwcEvent: {
|
|
62
|
-
/** Synchronous with `ui/discover-capabilities` response; session reaches READY. */
|
|
63
|
-
readonly READY: "sf-embedding.component.ready";
|
|
64
|
-
/** Misconfiguration, bootstrap failure, embedding-reported fatal, or protocol violation. */
|
|
65
|
-
readonly ERROR: "sf-embedding.component.error";
|
|
66
|
-
};
|
|
67
|
-
/** Type-level union of the reserved event names. */
|
|
68
|
-
type HostLwcEventName = (typeof HostLwcEvent)[keyof typeof HostLwcEvent];
|
|
69
|
-
/** Detail of `sf-embedding.component.ready`. */
|
|
70
|
-
interface HostReadyEventDetail {
|
|
71
|
-
instanceId: string;
|
|
72
|
-
}
|
|
73
|
-
/** Detail of `sf-embedding.component.error` (§12.3). */
|
|
74
|
-
interface HostErrorEventDetail {
|
|
75
|
-
instanceId?: string;
|
|
76
|
-
/** Failure category — drives consumer reaction. */
|
|
77
|
-
phase: "configuration" | "bootstrap" | "session";
|
|
78
|
-
/** ErrorCode constant or a configuration-error string (e.g. `"SAME_ORIGIN_SRC"`). */
|
|
79
|
-
code: string;
|
|
80
|
-
message: string;
|
|
81
|
-
/**
|
|
82
|
-
* Whether remount is plausibly fruitful (per spec §12.3).
|
|
83
|
-
* `true` — transient failures where a fresh attempt may succeed: bootstrap
|
|
84
|
-
* handshake timeout, embedding-reported runtime error.
|
|
85
|
-
* `false` — fix the underlying problem first: configuration errors
|
|
86
|
-
* (same-origin src, allow-scripts stripped, malformed src) and protocol
|
|
87
|
-
* violations (duplicate port transfer).
|
|
88
|
-
*/
|
|
89
|
-
retryable: boolean;
|
|
90
|
-
cause?: unknown;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** URL query-parameter name carrying the JSON-encoded `HostMetaData`. */
|
|
94
|
-
declare const HOST_META_DATA_PARAM: "hostMetaData";
|
|
95
|
-
/**
|
|
96
|
-
* Shape of the JSON-encoded `hostMetaData` query parameter on the iframe URL.
|
|
97
|
-
*
|
|
98
|
-
* The host MUST write this onto `iframe.src` when assigning it; the embedding
|
|
99
|
-
* MUST read it before emitting the heartbeat. `hostAppOrigin` is the trust
|
|
100
|
-
* root for the embedding's inbound bootstrap envelope (MC-8). `instanceId`
|
|
101
|
-
* binds the inbound bootstrap envelope to this iframe instance (MC-10).
|
|
102
|
-
*/
|
|
103
|
-
interface HostMetaData {
|
|
104
|
-
hostAppOrigin: string;
|
|
105
|
-
instanceId: string;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Host announces session identity to the embedding over the port. */
|
|
109
|
-
declare const HOST_INITIALIZED_METHOD: "ui/notifications/host-initialized";
|
|
110
|
-
/** Embedding acknowledges receipt of `host-initialized`. Fire-and-forget. */
|
|
111
|
-
declare const EMBEDDING_INITIALIZED_METHOD: "ui/notifications/embedding-initialized";
|
|
112
|
-
/** Identity of the host or embedding product. */
|
|
113
|
-
interface PeerInfo {
|
|
114
|
-
name: string;
|
|
115
|
-
version: string;
|
|
116
|
-
}
|
|
117
|
-
/** Params for `ui/notifications/host-initialized`. */
|
|
118
|
-
interface HostInitializedParams {
|
|
119
|
-
instanceId: string;
|
|
120
|
-
hostInfo: PeerInfo;
|
|
121
|
-
}
|
|
122
|
-
/** Params for `ui/notifications/embedding-initialized`. */
|
|
123
|
-
interface EmbeddingInitializedParams {
|
|
124
|
-
embeddingInfo: PeerInfo;
|
|
125
|
-
}
|
|
1
|
+
import { BootstrapEnvelope, HostMetaData } from '@salesforce/sf-embedding-contract';
|
|
2
|
+
import { JsonRpcClient, JsonRpcErrorPayload } from '@salesforce/jsonrpc';
|
|
126
3
|
|
|
127
4
|
type BootstrapEnvelopeValidationFailure = "INVALID_SHAPE" | "WRONG_SOURCE" | "ORIGIN_NOT_ALLOWED" | "WRONG_PORT_COUNT" | "INSTANCE_ID_MISMATCH" | "DUPLICATE_TRANSFER";
|
|
128
5
|
type BootstrapEnvelopeValidationResult = {
|
|
@@ -154,168 +31,6 @@ declare class BootstrapFailureError extends Error {
|
|
|
154
31
|
constructor(reason: BootstrapFailureReason);
|
|
155
32
|
}
|
|
156
33
|
|
|
157
|
-
/**
|
|
158
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
159
|
-
* All rights reserved.
|
|
160
|
-
* For full license text, see the LICENSE.txt file
|
|
161
|
-
*/
|
|
162
|
-
/**
|
|
163
|
-
* Abstract transport for a JSON-RPC 2.0 client.
|
|
164
|
-
*
|
|
165
|
-
* A `Transport` is a bidirectional, structured-message pipe. The
|
|
166
|
-
* `JsonRpcClient` uses it to send JSON-RPC messages (`post`) and subscribe
|
|
167
|
-
* to inbound ones (`onMessage`). The transport itself is agnostic to the
|
|
168
|
-
* JSON-RPC framing — it simply moves `unknown` payloads between two
|
|
169
|
-
* endpoints.
|
|
170
|
-
*
|
|
171
|
-
* Concrete transports plug into the same shape:
|
|
172
|
-
* - `WindowPostMessageTransport` (window.parent.postMessage; used by
|
|
173
|
-
* MCP Apps)
|
|
174
|
-
* - `MessageChannelTransport` (a transferred `MessagePort`; used by
|
|
175
|
-
* sf-embedding and any future surface that bootstraps with a
|
|
176
|
-
* dedicated channel)
|
|
177
|
-
*/
|
|
178
|
-
interface Transport {
|
|
179
|
-
/**
|
|
180
|
-
* Deliver a single structured message to the peer. Implementations MUST
|
|
181
|
-
* NOT throw on transient conditions (closed port, missing parent
|
|
182
|
-
* window, etc.) — drop the message silently instead, matching the
|
|
183
|
-
* prior `window.parent?.postMessage` behaviour.
|
|
184
|
-
*/
|
|
185
|
-
post(message: unknown): void;
|
|
186
|
-
/**
|
|
187
|
-
* Subscribe to inbound structured messages from the peer. The callback
|
|
188
|
-
* receives the already-unwrapped message payload (never a
|
|
189
|
-
* `MessageEvent`).
|
|
190
|
-
*
|
|
191
|
-
* @returns an unsubscribe function that removes this listener.
|
|
192
|
-
*/
|
|
193
|
-
onMessage(callback: (message: unknown) => void): () => void;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Base class for JSON-RPC 2.0 clients.
|
|
198
|
-
*
|
|
199
|
-
* This class provides core JSON-RPC client functionality for any cross-realm
|
|
200
|
-
* surface that speaks JSON-RPC 2.0 (MCP Apps, sf-embedding, future
|
|
201
|
-
* surfaces). It handles request/response correlation, message validation,
|
|
202
|
-
* and notification dispatch.
|
|
203
|
-
*
|
|
204
|
-
* The transport layer is pluggable via the `Transport` interface and is
|
|
205
|
-
* REQUIRED at construction. There is no default transport — wildcard-targeted
|
|
206
|
-
* `window.postMessage` is structurally unsafe, so callers must construct a
|
|
207
|
-
* transport with an explicit origin (`WindowPostMessageTransport`) or a
|
|
208
|
-
* port-bound transport (`MessageChannelTransport`).
|
|
209
|
-
*
|
|
210
|
-
* Subclasses should extend this class and use the protected `request()`
|
|
211
|
-
* method to send JSON-RPC requests to the peer.
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* export class MCPAppsViewSDK extends JsonRpcClient implements ViewSDK {
|
|
215
|
-
* async displayAlert(options: AlertOptions): Promise<void> {
|
|
216
|
-
* await this.request("ui/message", {
|
|
217
|
-
* role: "user",
|
|
218
|
-
* content: { type: "text", text: options.message }
|
|
219
|
-
* });
|
|
220
|
-
* }
|
|
221
|
-
* }
|
|
222
|
-
*
|
|
223
|
-
* @example
|
|
224
|
-
* // Injecting a transport (window.parent.postMessage to a known origin).
|
|
225
|
-
* class MyClient extends JsonRpcClient {
|
|
226
|
-
* constructor(targetOrigin: string) {
|
|
227
|
-
* super(new WindowPostMessageTransport(targetOrigin));
|
|
228
|
-
* }
|
|
229
|
-
* }
|
|
230
|
-
*/
|
|
231
|
-
declare class JsonRpcClient {
|
|
232
|
-
private nextRequestId;
|
|
233
|
-
private pending;
|
|
234
|
-
private notificationHandlers;
|
|
235
|
-
private readonly transport;
|
|
236
|
-
/**
|
|
237
|
-
* Construct a JSON-RPC client bound to the given transport.
|
|
238
|
-
*
|
|
239
|
-
* @param transport - the transport to use.
|
|
240
|
-
*/
|
|
241
|
-
constructor(transport: Transport);
|
|
242
|
-
/**
|
|
243
|
-
* Register a handler for a specific JSON-RPC notification method.
|
|
244
|
-
*
|
|
245
|
-
* Subclasses can register handlers to process specific notification
|
|
246
|
-
* types. When a notification with the registered method is received,
|
|
247
|
-
* the handler will be invoked with the notification params.
|
|
248
|
-
*
|
|
249
|
-
* @param method - The notification method to handle (e.g.
|
|
250
|
-
* "ui/notifications/host-context-changed")
|
|
251
|
-
* @param handler - Callback function to process the notification params
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* this.registerNotificationHandler("ui/notifications/host-context-changed", (params) => {
|
|
255
|
-
* this.handleHostContextChanged(params);
|
|
256
|
-
* });
|
|
257
|
-
*/
|
|
258
|
-
protected registerNotificationHandler(method: string, handler: (params: unknown) => void): void;
|
|
259
|
-
/**
|
|
260
|
-
* Handle inbound JSON-RPC messages from the transport.
|
|
261
|
-
*
|
|
262
|
-
* Processes both responses (for requests) and notifications.
|
|
263
|
-
* Non-JSON-RPC payloads are silently ignored so that a shared transport
|
|
264
|
-
* can be used for multiple protocols without cross-talk.
|
|
265
|
-
*/
|
|
266
|
-
private onMessage;
|
|
267
|
-
/**
|
|
268
|
-
* Send a JSON-RPC request to the peer.
|
|
269
|
-
*
|
|
270
|
-
* @param method - The JSON-RPC method name
|
|
271
|
-
* @param params - The method parameters
|
|
272
|
-
* @returns Promise that resolves with the result or rejects with error
|
|
273
|
-
*
|
|
274
|
-
* @example
|
|
275
|
-
* const result = await this.request("ui/message", {
|
|
276
|
-
* role: "user",
|
|
277
|
-
* content: { type: "text", text: "Hello" }
|
|
278
|
-
* });
|
|
279
|
-
*/
|
|
280
|
-
protected request<TParams = unknown, TResult = unknown>(method: string, params: TParams): Promise<TResult>;
|
|
281
|
-
/**
|
|
282
|
-
* Send a JSON-RPC notification to the peer.
|
|
283
|
-
*
|
|
284
|
-
* Notifications are one-way messages that do not expect a response.
|
|
285
|
-
* Use notifications for:
|
|
286
|
-
* - Informing the host of state changes
|
|
287
|
-
* - Fire-and-forget operations
|
|
288
|
-
* - Events that don't require confirmation
|
|
289
|
-
*
|
|
290
|
-
* Use request() instead when you need:
|
|
291
|
-
* - A response from the host
|
|
292
|
-
* - Confirmation of success/failure
|
|
293
|
-
* - Return values from the operation
|
|
294
|
-
*
|
|
295
|
-
* @param method - The JSON-RPC method name
|
|
296
|
-
* @param params - Optional method parameters
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* this.sendNotification("ui/notifications/size-changed", {
|
|
300
|
-
* width: 800,
|
|
301
|
-
* height: 600
|
|
302
|
-
* });
|
|
303
|
-
*/
|
|
304
|
-
protected sendNotification<TParams = unknown>(method: string, params?: TParams): void;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/** Structure of the `data` field on a JSON-RPC error payload. */
|
|
308
|
-
interface JsonRpcErrorData {
|
|
309
|
-
retryable?: boolean;
|
|
310
|
-
details?: Record<string, unknown>;
|
|
311
|
-
}
|
|
312
|
-
/** Shape of a JSON-RPC error payload (the value under `error` on an error response). */
|
|
313
|
-
interface JsonRpcErrorPayload {
|
|
314
|
-
code: number;
|
|
315
|
-
message?: string;
|
|
316
|
-
data?: JsonRpcErrorData;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
34
|
type HostInitializedPayload = Record<string, unknown>;
|
|
320
35
|
interface SessionHandle {
|
|
321
36
|
client: JsonRpcClient;
|
|
@@ -378,5 +93,5 @@ declare function makeJsonRpcError(code: number, options?: {
|
|
|
378
93
|
*/
|
|
379
94
|
declare function readHostMetaData(search: string): HostMetaData | null;
|
|
380
95
|
|
|
381
|
-
export {
|
|
382
|
-
export type {
|
|
96
|
+
export { BootstrapFailureError, ErrorCode, SessionFailureError, bootstrapSession, isBootstrapEnvelope, makeJsonRpcError, readHostMetaData, validateBootstrapEnvelope };
|
|
97
|
+
export type { BootstrapEnvelopeValidationFailure, BootstrapEnvelopeValidationInput, BootstrapEnvelopeValidationResult, BootstrapFailureReason, BootstrapSessionOptions, ErrorCodeValue, HostInitializedPayload, SessionFailureReason, SessionHandle };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,KAAK,kCAAkC,EACvC,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,mBAAmB,EACnB,yBAAyB,GAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EACH,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,76 +1,6 @@
|
|
|
1
|
+
import { BOOTSTRAP_ENVELOPE_TYPE, PROTOCOL_NAME, HOST_META_DATA_PARAM, HEARTBEAT_TYPE, SHUTDOWN_TYPE, HOST_INITIALIZED_METHOD, EMBEDDING_INITIALIZED_METHOD, SfEmbeddingErrorCode, NON_RETRYABLE_CODES } from '@salesforce/sf-embedding-contract';
|
|
1
2
|
import { MessageChannelTransport, JsonRpcClient, StandardErrorCode, makeJsonRpcError as makeJsonRpcError$1 } from '@salesforce/jsonrpc';
|
|
2
3
|
|
|
3
|
-
// Bootstrap envelope vocabulary. Spec: EMBEDDING-PROTOCOL.md §3.1, §3.1.1,
|
|
4
|
-
// MC-7/MC-8/MC-10 in §2.2.
|
|
5
|
-
/** Wire identifier for this protocol. Carried verbatim on every bootstrap envelope. */
|
|
6
|
-
const PROTOCOL_NAME = "sf-embedding";
|
|
7
|
-
/** Discriminator for the host → embedding bootstrap envelope. */
|
|
8
|
-
const BOOTSTRAP_ENVELOPE_TYPE = "sf-embedding.bootstrap";
|
|
9
|
-
/** Discriminator for the embedding → host content-free heartbeat. */
|
|
10
|
-
const HEARTBEAT_TYPE = "sf-embedding/ready";
|
|
11
|
-
/**
|
|
12
|
-
* Discriminator for the embedding → host fail-closed shutdown signal
|
|
13
|
-
* (e.g., duplicate-transfer detection). Posted via window-level postMessage,
|
|
14
|
-
* not over the JSON-RPC port.
|
|
15
|
-
*/
|
|
16
|
-
const SHUTDOWN_TYPE = "sf-embedding/shutdown";
|
|
17
|
-
|
|
18
|
-
// sf-embedding protocol-specific JSON-RPC error codes. Spec §8.2.
|
|
19
|
-
//
|
|
20
|
-
// Standard JSON-RPC codes (-32700, -32600..-32603) and transport-level codes
|
|
21
|
-
// (PORT_CLOSED, SERIALIZATION_FAILURE, REQUEST_TIMEOUT, BACKPRESSURE,
|
|
22
|
-
// REQUEST_CANCELLED) live in `@salesforce/jsonrpc`'s
|
|
23
|
-
// `StandardErrorCode` and are NOT re-exported here. Consumers that need the
|
|
24
|
-
// merged vocabulary compose them at the call site.
|
|
25
|
-
/** sf-embedding protocol-specific error codes (§8.2 numeric assignments). */
|
|
26
|
-
const SfEmbeddingErrorCode = {
|
|
27
|
-
/** Method exists at selected version but is not granted (§6.5). */
|
|
28
|
-
CAPABILITY_NOT_ALLOWED: -32010,
|
|
29
|
-
/** In-flight request gated on a capability that was just revoked (§6.6). */
|
|
30
|
-
CAPABILITY_REVOKED: -32011,
|
|
31
|
-
/** Frame arrived before the required handshake step completed (§5.2, §4.2). */
|
|
32
|
-
NOT_INITIALIZED: -32012,
|
|
33
|
-
/** Embedding's protocol version is not supported by the host (§4.2, §3.1.2). */
|
|
34
|
-
PROTOCOL_VERSION_MISMATCH: -32013,
|
|
35
|
-
/** Frame's origin does not match the bound peer origin (§3.1). */
|
|
36
|
-
ORIGIN_MISMATCH: -32014,
|
|
37
|
-
/** Catch-all — duplicate ui/select-version, duplicate ui/discover-capabilities, etc. */
|
|
38
|
-
PROTOCOL_VIOLATION: -32020,
|
|
39
|
-
/** Embedding observed a second valid bootstrap envelope and shut down (§3.1.2). */
|
|
40
|
-
BOOTSTRAP_DUPLICATE_TRANSFER: -32023,
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Codes that are non-retryable by default (§8.4). Consumers building error
|
|
44
|
-
* payloads SHOULD set `retryable: false` automatically for these.
|
|
45
|
-
*/
|
|
46
|
-
const NON_RETRYABLE_CODES = new Set([
|
|
47
|
-
SfEmbeddingErrorCode.CAPABILITY_NOT_ALLOWED,
|
|
48
|
-
SfEmbeddingErrorCode.CAPABILITY_REVOKED,
|
|
49
|
-
SfEmbeddingErrorCode.ORIGIN_MISMATCH,
|
|
50
|
-
]);
|
|
51
|
-
|
|
52
|
-
// Host LWC reserved DOM event names and detail shapes. Spec §12.3.
|
|
53
|
-
//
|
|
54
|
-
// These are dispatched by the host LWC on its own element so application
|
|
55
|
-
// code on the page can react. The embedding never observes them.
|
|
56
|
-
/** Event names the host LWC dispatches on its own element. Reserved by the protocol. */
|
|
57
|
-
const HostLwcEvent = {
|
|
58
|
-
/** Synchronous with `ui/discover-capabilities` response; session reaches READY. */
|
|
59
|
-
READY: "sf-embedding.component.ready",
|
|
60
|
-
/** Misconfiguration, bootstrap failure, embedding-reported fatal, or protocol violation. */
|
|
61
|
-
ERROR: "sf-embedding.component.error",
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// Host-supplied iframe URL metadata (per ADR 0029). Spec §3.1, MC-8/MC-10.
|
|
65
|
-
/** URL query-parameter name carrying the JSON-encoded `HostMetaData`. */
|
|
66
|
-
const HOST_META_DATA_PARAM = "hostMetaData";
|
|
67
|
-
|
|
68
|
-
// JSON-RPC method names on the wire today.
|
|
69
|
-
/** Host announces session identity to the embedding over the port. */
|
|
70
|
-
const HOST_INITIALIZED_METHOD = "ui/notifications/host-initialized";
|
|
71
|
-
/** Embedding acknowledges receipt of `host-initialized`. Fire-and-forget. */
|
|
72
|
-
const EMBEDDING_INITIALIZED_METHOD = "ui/notifications/embedding-initialized";
|
|
73
|
-
|
|
74
4
|
// Bootstrap envelope validator for the iframe (embedding) side of the
|
|
75
5
|
// sf-embedding handshake.
|
|
76
6
|
//
|
|
@@ -215,7 +145,7 @@ function installBootstrapListener() {
|
|
|
215
145
|
/** Identity emitted on `ui/notifications/embedding-initialized`. */
|
|
216
146
|
const EMBEDDING_INFO = {
|
|
217
147
|
name: "@salesforce/sf-embedding-bridge",
|
|
218
|
-
version: "2.2.
|
|
148
|
+
version: "2.2.2",
|
|
219
149
|
};
|
|
220
150
|
|
|
221
151
|
class SessionFailureError extends Error {
|
|
@@ -309,5 +239,5 @@ function makeJsonRpcError(code, options = {}) {
|
|
|
309
239
|
return makeJsonRpcError$1(code, options);
|
|
310
240
|
}
|
|
311
241
|
|
|
312
|
-
export {
|
|
242
|
+
export { BootstrapFailureError, ErrorCode, SessionFailureError, bootstrapSession, isBootstrapEnvelope, makeJsonRpcError, readHostMetaData, validateBootstrapEnvelope };
|
|
313
243
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/bootstrap-envelope.ts","../src/host-meta-data.ts","../src/bootstrap-listener.ts","../src/embedding-info.ts","../src/bootstrap-session.ts","../src/errors.ts"],"sourcesContent":[null,null,null,null,null,null],"names":["makeStandardError"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BA;AACM,SAAU,mBAAmB,CAAC,KAAc,EAAA;AAC9C,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;IACrF,MAAM,CAAC,GAAG,KAAgC;AAC1C,IAAA,IAAI,CAAC,CAAC,IAAI,KAAK,uBAAuB;AAAE,QAAA,OAAO,KAAK;AACpD,IAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,aAAa;AAAE,QAAA,OAAO,K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AO,CAAC,MAAM,CAAC;AAChC,SAAA,CAAC;QACF,MAAM,CAAC,2BAA2B,EAAE;QACpC,OAAO;YACH,MAAM;YACN,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,eAAe;SAClB;AACL,IAAA,CAAC;AACA,SAAA,KAAK,CAAC,CAAC,GAAG,KAAI;QACX,IAAI,GAAG,YAAY,mBAAmB;AAAE,YAAA,MAAM,GAAG;QACjD,IAAI,GAAG,YAAY,KAAK,IAAI,QAAQ,IAAI,GAAG,EAAE;YACzC,MAAM,IAAI,mBAAmB,CAAE,GAA0C,CAAC,MAAM,EAAE,GAAG,CAAC;QAC1F;AACA,QAAA,MAAM,GAAG;AACb,IAAA,CAAC,CAAC;AAEN,IAAA,cAAc,CAAC,KAAK,CAAC,MAAK;;AAE1B,IAAA,CAAC,CAAC;AAEF,IAAA,OAAO,cAAc;AACzB;;AC3GA;AACA;AACA;AACA;AASA;AACO,MAAM,SAAS,GAAG;AACrB,IAAA,GAAG,iBAAiB;AACpB,IAAA,GAAG,oBAAoB;;AAM3B;SACgB,gBAAgB,CAC5B,IAAY,EACZ,UAII,EAAE,EAAA;AAEN,IAAA,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE;AAClE,QAAA,OAAOA,kBAAiB,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACpE;AACA,IAAA,OAAOA,kBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3C;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/sf-embedding-bridge",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "JSON-RPC 2.0 bridge for the sf-embedding host ↔ embedding protocol",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -21,17 +21,11 @@
|
|
|
21
21
|
"test": "jest --passWithNoTests"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@salesforce/sf-embedding-contract": "2.2.2",
|
|
24
25
|
"@salesforce/jsonrpc": "^9.13.0"
|
|
25
26
|
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@salesforce/sf-embedding-contract": "2.2.1-rc.7"
|
|
28
|
-
},
|
|
29
27
|
"files": [
|
|
30
28
|
"dist/",
|
|
31
|
-
"!dist/__tests__/",
|
|
32
|
-
"!dist/__mocks__/",
|
|
33
|
-
"!dist/*.test.js",
|
|
34
|
-
"!dist/*.map",
|
|
35
29
|
"README.md",
|
|
36
30
|
"LICENSE.txt"
|
|
37
31
|
],
|