@salesforce/platform-sdk 12.13.0 → 12.14.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/data/index.d.ts +5 -2
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +309 -306
- package/dist/data/mosaic/fetch.d.ts +13 -33
- package/dist/data/mosaic/fetch.d.ts.map +1 -1
- package/dist/data/mosaic/index.d.ts +0 -14
- package/dist/data/mosaic/index.d.ts.map +1 -1
- package/dist/data/shared/graphql/parse-response.d.ts +4 -36
- package/dist/data/shared/graphql/parse-response.d.ts.map +1 -1
- package/dist/data/webapp/csrf/token-manager.d.ts +14 -1
- package/dist/data/webapp/csrf/token-manager.d.ts.map +1 -1
- package/dist/observability/vendor/index.d.ts +17 -0
- package/dist/observability/vendor/index.d.ts.map +1 -0
- package/dist/observability/vendor/names.d.ts +11 -0
- package/dist/observability/vendor/names.d.ts.map +1 -0
- package/dist/observability/vendor/protocol.d.ts +25 -0
- package/dist/observability/vendor/protocol.d.ts.map +1 -0
- package/dist/observability/vendor/queue.d.ts +16 -0
- package/dist/observability/vendor/queue.d.ts.map +1 -0
- package/dist/observability/vendor/verbs.d.ts +19 -0
- package/dist/observability/vendor/verbs.d.ts.map +1 -0
- package/docs/data/04-surfaces-and-guards.md +25 -2
- package/package.json +2 -2
|
@@ -1,41 +1,21 @@
|
|
|
1
1
|
import { FetchService, RequestInterceptor } from '@conduit-client/service-fetch-network/v1';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a request interceptor that prepends a base URL to relative string URLs.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
6
|
-
* A request pivots only when the widget is trusted (`isInternal`), a
|
|
7
|
-
* `lightningDomain` is configured, and the request carries the first-party
|
|
8
|
-
* header. When the result is `true`, the call site narrows `lightningDomain`
|
|
9
|
-
* to `string`.
|
|
5
|
+
* @param baseUrl - The base URL to prepend (e.g. "https://myorg.salesforce.com")
|
|
10
6
|
*/
|
|
11
|
-
export declare function
|
|
12
|
-
/** The configuration for the Mosaic fetch transport. */
|
|
13
|
-
interface MosaicFetchConfig {
|
|
14
|
-
/**
|
|
15
|
-
* The my-domain base URL for resolving relative paths, for example
|
|
16
|
-
* "https://myorg.salesforce.com".
|
|
17
|
-
*/
|
|
18
|
-
baseUrl?: string;
|
|
19
|
-
/** The access token, sent as a Bearer header or as the sid cookie on a lightning pivot. */
|
|
20
|
-
accessToken?: string;
|
|
21
|
-
/** The lightning-domain base URL for UITier (first-party) requests. */
|
|
22
|
-
lightningDomain?: string;
|
|
23
|
-
/** True when this widget is trusted to pivot first-party requests to the lightning domain. */
|
|
24
|
-
isInternal?: boolean;
|
|
25
|
-
}
|
|
7
|
+
export declare function createBaseUrlInterceptor(baseUrl: string): RequestInterceptor;
|
|
26
8
|
/**
|
|
27
|
-
*
|
|
9
|
+
* Creates a request interceptor that adds an Authorization Bearer header.
|
|
28
10
|
*
|
|
29
|
-
* @
|
|
30
|
-
* The interceptor resolves routing and authentication together, so they cannot
|
|
31
|
-
* diverge: it routes a first-party request from a trusted widget to the lightning
|
|
32
|
-
* domain with sid-cookie authentication, and sends everything else to my-domain
|
|
33
|
-
* with Bearer authentication. The pivot fires only for a relative URL that the
|
|
34
|
-
* interceptor rewrites against `baseUrl`, so the sid cookie can never attach
|
|
35
|
-
* unless the request is bound for the lightning domain.
|
|
11
|
+
* @param accessToken - The access token to use for authentication
|
|
36
12
|
*/
|
|
37
|
-
export declare function
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
13
|
+
export declare function createAuthInterceptor(accessToken: string): RequestInterceptor;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a fetch service configured with optional base URL and auth interceptors.
|
|
16
|
+
*
|
|
17
|
+
* @param baseUrl - Optional base URL for resolving relative paths
|
|
18
|
+
* @param accessToken - Optional access token for Bearer authentication
|
|
19
|
+
*/
|
|
20
|
+
export declare function createMosaicFetchService(baseUrl?: string, accessToken?: string): FetchService;
|
|
41
21
|
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIN,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,MAAM,0CAA0C,CAAC;AAGlD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAS5E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,kBAAkB,CAI7E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,CAY7F"}
|
|
@@ -23,17 +23,6 @@ export interface MosaicDataSDKOptions {
|
|
|
23
23
|
* @example "64.0"
|
|
24
24
|
*/
|
|
25
25
|
apiVersion?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The lightning-domain base URL for UITier (first-party) requests when this
|
|
28
|
-
* widget is trusted as internal.
|
|
29
|
-
* @example "https://my-domain.lightning.force.com"
|
|
30
|
-
*/
|
|
31
|
-
lightningDomain?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Marks this widget as internal and trusted, which enables the
|
|
34
|
-
* lightning-domain pivot for first-party (UITier) requests. Defaults to `false`.
|
|
35
|
-
*/
|
|
36
|
-
isInternal?: boolean;
|
|
37
26
|
}
|
|
38
27
|
/**
|
|
39
28
|
* The data SDK implementation for the Mosaic surface (Node.js, server-side).
|
|
@@ -46,9 +35,6 @@ export interface MosaicDataSDKOptions {
|
|
|
46
35
|
export declare class MosaicDataSDK implements DataSDK {
|
|
47
36
|
private readonly clientFetch;
|
|
48
37
|
private readonly pathData;
|
|
49
|
-
private readonly baseUrl;
|
|
50
|
-
private readonly lightningDomain;
|
|
51
|
-
private readonly isInternal;
|
|
52
38
|
readonly apiVersion: string;
|
|
53
39
|
readonly graphql: DataSDKGraphQL;
|
|
54
40
|
constructor(options?: MosaicDataSDKOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAkB3F;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/mosaic/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAkB3F;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;YAc5B,iBAAiB;CAe/B"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { GraphQLResponse } from '../../../core';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* as
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* A raw `JSON.parse` failure, for example "Unexpected end of JSON input" or
|
|
8
|
-
* "Unexpected token < in JSON at position 0", is a bare engine message with
|
|
9
|
-
* no transport context. A caller who surfaces that message — with
|
|
10
|
-
* `toErrors` in `../graphql-parse`, into `result.errors` — has nothing to
|
|
11
|
-
* act on. This error keeps the surface, request URL, HTTP status, and a
|
|
12
|
-
* bounded body snippet on the message, and keeps the original parse failure
|
|
13
|
-
* as `cause`. So the failure is diagnosable from the error text alone.
|
|
3
|
+
* Thrown when a transport body isn't a JSON GraphQL object. Raw `JSON.parse` errors carry no
|
|
4
|
+
* context, so this adds surface, URL, status, and a body snippet; keeps the original as `cause`.
|
|
14
5
|
*/
|
|
15
6
|
export declare class GraphQLTransportError extends Error {
|
|
16
7
|
readonly status: number;
|
|
@@ -24,31 +15,8 @@ export declare class GraphQLTransportError extends Error {
|
|
|
24
15
|
});
|
|
25
16
|
}
|
|
26
17
|
/**
|
|
27
|
-
* Parses a
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* A non-2xx response can still carry a valid GraphQL error body (`{ errors:
|
|
32
|
-
* [...] }`). So this function does not gate on `res.ok`: it reads and parses
|
|
33
|
-
* the body regardless of status, and returns a successfully parsed body
|
|
34
|
-
* as-is.
|
|
35
|
-
*
|
|
36
|
-
* This function throws a {@link GraphQLTransportError} only when the body
|
|
37
|
-
* is empty, is not valid JSON, or is valid JSON that is not an object (a
|
|
38
|
-
* bare scalar or `null`). Otherwise, one of those cases would surface
|
|
39
|
-
* downstream as the contextless "Unexpected end of JSON input" message, or
|
|
40
|
-
* escape as a `TypeError` when a caller reads `.data` or `.errors` off a
|
|
41
|
-
* non-object value. The thrown error carries the surface, URL, status, and
|
|
42
|
-
* a body snippet.
|
|
43
|
-
*
|
|
44
|
-
* This function reads the body once with `res.text()`, instead of
|
|
45
|
-
* `res.json()`, so the raw text is available for the diagnostic snippet if
|
|
46
|
-
* parsing fails.
|
|
47
|
-
*
|
|
48
|
-
* @param res - The fetch response for a GraphQL POST request.
|
|
49
|
-
* @param surface - The human-readable transport surface, for example
|
|
50
|
-
* `"WebApp"` or `"Mosaic"`.
|
|
51
|
-
* @param url - The request URL, for the diagnostic message.
|
|
18
|
+
* Parses a GraphQL {@link Response}. No `res.ok` gate: non-2xx can still carry valid `{ errors }`.
|
|
19
|
+
* Reads via `text()` so the raw body is available for the {@link GraphQLTransportError} snippet.
|
|
52
20
|
*/
|
|
53
21
|
export declare function parseGraphQLResponse<T>(res: Response, surface: string, url: string): Promise<GraphQLResponse<T>>;
|
|
54
22
|
//# sourceMappingURL=parse-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-response.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/parse-response.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-response.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/parse-response.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAgBrD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,IAAI,EAAE;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,CAAC;KACf;CAeD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC3C,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACT,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAkB7B"}
|
|
@@ -19,7 +19,8 @@ declare class CsrfTokenManager {
|
|
|
19
19
|
* Returns the current CSRF token.
|
|
20
20
|
*
|
|
21
21
|
* @remarks
|
|
22
|
-
* The
|
|
22
|
+
* The token loads from the cache or with a fetch request. When the last attempt failed, this
|
|
23
|
+
* call starts a new attempt, so a transient failure does not block later requests.
|
|
23
24
|
*/
|
|
24
25
|
getToken(): Promise<string>;
|
|
25
26
|
/**
|
|
@@ -30,9 +31,21 @@ declare class CsrfTokenManager {
|
|
|
30
31
|
* every caller shares the same in-flight promise.
|
|
31
32
|
*/
|
|
32
33
|
refreshToken(): Promise<string | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Starts a token attempt that is forgotten when it fails.
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* The manager lives for the page lifetime. If it kept a rejected promise, every later protected
|
|
39
|
+
* request would fail without a network call until the page reloads.
|
|
40
|
+
*/
|
|
41
|
+
private startObtainToken;
|
|
33
42
|
/**
|
|
34
43
|
* Returns a CSRF token from the cache, or fetches a new one when the cache has none.
|
|
35
44
|
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Only a response that contains a token goes into the cache. The cache persists across page
|
|
47
|
+
* loads, so a cached error response would otherwise fail every attempt.
|
|
48
|
+
*
|
|
36
49
|
* @returns The CSRF token.
|
|
37
50
|
*/
|
|
38
51
|
private obtainToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-manager.d.ts","sourceRoot":"","sources":["../../../../src/data/webapp/csrf/token-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,cAAM,gBAAgB;IAKpB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS,CAAC;IALnB,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"token-manager.d.ts","sourceRoot":"","sources":["../../../../src/data/webapp/csrf/token-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,cAAM,gBAAgB;IAKpB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS,CAAC;IALnB,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,cAAc,CAA8B;gBAG3C,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,YAAA;IAK3B;;;;;;OAMG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAKjC;;;;;;OAMG;IACH,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAmB3C;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAWxB;;;;;;;;OAQG;YACW,WAAW;IA6BzB;;;;;OAKG;YACW,SAAS;CASvB;AAuBD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Instrumentation } from './verbs';
|
|
2
|
+
/**
|
|
3
|
+
* Public entry point. Returns a verb surface bound to `name` — the logger/app
|
|
4
|
+
* identity the o11y-client drain dispatches on (getInstrumentation(name)).
|
|
5
|
+
*
|
|
6
|
+
* `name` is validated eagerly: o11y-client's `isValidQueueEvent` silently drops
|
|
7
|
+
* events whose name is empty or longer than {@link MAX_NAME_LENGTH}, so an
|
|
8
|
+
* invalid name would lose ALL telemetry from that logger with zero feedback.
|
|
9
|
+
* We fail fast here instead of emitting silently-discarded events.
|
|
10
|
+
*
|
|
11
|
+
* @throws {TypeError} if `name` is not a non-empty string of at most
|
|
12
|
+
* {@link MAX_NAME_LENGTH} characters.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getInstrumentation(name: string): Instrumentation;
|
|
15
|
+
export type { Instrumentation } from './verbs';
|
|
16
|
+
export type { QueueVerb, QueueEventV1 } from './protocol';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/observability/vendor/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAOhE;AAED,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* PLACEHOLDER names (owned by Platform SDK, WI-16 §8). Single source of truth —
|
|
8
|
+
* a later name freeze is a one-line change here.
|
|
9
|
+
*/
|
|
10
|
+
export declare const QUEUE_KEY_1P: "__SF_O11Y_QUEUE_1P__";
|
|
11
|
+
//# sourceMappingURL=names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../../src/observability/vendor/names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAG,sBAA+B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* FROZEN vendored copy of the o11y-client queue protocol contract.
|
|
8
|
+
* SOURCE OF TRUTH: instrumentation/o11y-client
|
|
9
|
+
* packages/o11y/src/queue/types.ts (QueueEventV1, QueueVerb, MAX_* limits)
|
|
10
|
+
* packages/o11y/src/queue/drain.ts (isValidQueueEvent, MAX_SUPPORTED_VERSION)
|
|
11
|
+
* Kept in sync MANUALLY. Do not diverge without a matching change there.
|
|
12
|
+
*/
|
|
13
|
+
/** The only verbs the o11y-client drain will replay. Anything else is dropped. */
|
|
14
|
+
export type QueueVerb = "log" | "error" | "incrementCounter" | "trackValue" | "bucketValue";
|
|
15
|
+
/** Wire event, version 1 — exactly these four fields. */
|
|
16
|
+
export interface QueueEventV1 {
|
|
17
|
+
version: 1;
|
|
18
|
+
name: string;
|
|
19
|
+
verb: QueueVerb;
|
|
20
|
+
args: unknown[];
|
|
21
|
+
}
|
|
22
|
+
export declare const PROTOCOL_VERSION: 1;
|
|
23
|
+
export declare const MAX_NAME_LENGTH = 256;
|
|
24
|
+
export declare const MAX_ARGS_LENGTH = 10;
|
|
25
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/observability/vendor/protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AAEH,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,kBAAkB,GAAG,YAAY,GAAG,aAAa,CAAC;AAE5F,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,EAAE,CAAC;CAChB;AAED,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAC3C,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QueueVerb } from './protocol';
|
|
2
|
+
/**
|
|
3
|
+
* Max events buffered on the 1P global BEFORE o11y-client's orchestrator installs
|
|
4
|
+
* its drain. If the drop-in never loads (not installed, or init throws), this cap
|
|
5
|
+
* bounds memory: the oldest events are dropped first and tallied in `droppedCount`,
|
|
6
|
+
* which o11y-client's drain reads (QueueBufferStub contract) to report the loss.
|
|
7
|
+
*/
|
|
8
|
+
export declare const MAX_PENDING_EVENTS = 1000;
|
|
9
|
+
/**
|
|
10
|
+
* Enqueue one event onto the 1P queue global. Correct BOTH before drain (we
|
|
11
|
+
* lazily create a bounded, drop-oldest buffer) and after drain (the global is
|
|
12
|
+
* o11y-client's DirectDispatchProxy, which also exposes `.push`).
|
|
13
|
+
* Fire-and-forget: browser-only, never throws, never emits console output.
|
|
14
|
+
*/
|
|
15
|
+
export declare function emit(name: string, verb: QueueVerb, args: unknown[]): void;
|
|
16
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/observability/vendor/queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAoB,KAAK,SAAS,EAAqB,MAAM,YAAY,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAoCvC;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAYzE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The 1P producer verb surface — mirrors o11y-client's Instrumentation 1:1 for
|
|
8
|
+
* the five queue-drainable verbs. Each call enqueues a positional-args event.
|
|
9
|
+
*/
|
|
10
|
+
export interface Instrumentation {
|
|
11
|
+
log(schemaOrText: unknown, data?: unknown, options?: unknown): void;
|
|
12
|
+
error(error: unknown, schemaOrText?: unknown, data?: unknown, options?: unknown): void;
|
|
13
|
+
incrementCounter(operation: string, increment?: number, hasError?: boolean, tags?: Record<string, unknown>): void;
|
|
14
|
+
trackValue(operation: string, value: number, hasError?: boolean, tags?: Record<string, unknown>): void;
|
|
15
|
+
bucketValue(operation: string, value: number, buckets?: number[], hasError?: boolean, tags?: Record<string, unknown>): void;
|
|
16
|
+
}
|
|
17
|
+
/** Build a verb surface bound to a logger `name`. Arg order matches o11y-client. */
|
|
18
|
+
export declare function createInstrumentation(name: string): Instrumentation;
|
|
19
|
+
//# sourceMappingURL=verbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verbs.d.ts","sourceRoot":"","sources":["../../../src/observability/vendor/verbs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACpE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACvF,gBAAgB,CACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,IAAI,CAAC;IACR,UAAU,CACT,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,IAAI,CAAC;IACR,WAAW,CACV,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAAE,EAClB,QAAQ,CAAC,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,IAAI,CAAC;CACR;AAED,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAkBnE"}
|
|
@@ -19,6 +19,29 @@ resolves to a bare `{}` rather than throwing (see `DataSDK` in `dist/core/data.d
|
|
|
19
19
|
the residue: how to guard that optionality, what `.fetch` is and how it differs from `.graphql`, how
|
|
20
20
|
to read `errors`, the resolved `apiVersion`, and the per-surface options.
|
|
21
21
|
|
|
22
|
+
## Microfrontend Data SDK selection
|
|
23
|
+
|
|
24
|
+
For a microfrontend (MFE), `createDataSDK()` checks `globalThis.SFDC_ENV`:
|
|
25
|
+
|
|
26
|
+
| Runtime value | Base Data SDK |
|
|
27
|
+
| ------------------------------------------ | --------------- |
|
|
28
|
+
| Non-null object, including an empty object | `WebAppDataSDK` |
|
|
29
|
+
| Absent, `null`, or any other type | `{}` |
|
|
30
|
+
|
|
31
|
+
Selection does not check individual fields. The object check selects an implementation;
|
|
32
|
+
it does not grant API access or guarantee successful requests. The server authenticates
|
|
33
|
+
and authorizes each request.
|
|
34
|
+
|
|
35
|
+
An MFE with this runtime signal uses `options.webapp`, the existing `SFDC_ENV.apiPath`
|
|
36
|
+
handling, caching, and cookie-based authentication. Explicit `options.webapp.basePath`
|
|
37
|
+
takes precedence over `SFDC_ENV.apiPath`. Data calls go directly to the API and do not
|
|
38
|
+
use the embedding bridge. MFE surface detection and supported bridge capabilities do
|
|
39
|
+
not change.
|
|
40
|
+
|
|
41
|
+
Check `sdk.graphql` and `sdk.fetch` before use, as shown below. Extensions still attach
|
|
42
|
+
to the selected base SDK, including an empty base. External Client App authentication
|
|
43
|
+
support and deployed validation are separate work.
|
|
44
|
+
|
|
22
45
|
## `apiVersion` — the resolved adapter version
|
|
23
46
|
|
|
24
47
|
`sdk.apiVersion` is the optional, read-only Salesforce API version selected by the resolved surface
|
|
@@ -62,7 +85,7 @@ route for everything that has no GraphQL representation.
|
|
|
62
85
|
|
|
63
86
|
What it carries, per surface:
|
|
64
87
|
|
|
65
|
-
- **WebApp** — CSRF token handling with automatic retry on token rejection, the `Accept-Language`
|
|
88
|
+
- **WebApp / MFE with a non-null `SFDC_ENV` object** — CSRF token handling with automatic retry on token rejection, the `Accept-Language`
|
|
66
89
|
and client-context headers the platform expects, and relative URLs resolved against the app's API
|
|
67
90
|
base path. Your `onStatus` callbacks fire on `.fetch` responses too, so a `401` handler
|
|
68
91
|
re-authenticates for `.fetch` and `.graphql` alike. On this surface `.graphql` is itself built on
|
|
@@ -141,7 +164,7 @@ if (!result.data && result.errors?.length) {
|
|
|
141
164
|
`createDataSDK(options)` takes a `DataSDKOptions` bag; the fields you set depend on the surface. The
|
|
142
165
|
declarations own the field lists — this is just the routing:
|
|
143
166
|
|
|
144
|
-
- **WebApp** — `WebAppDataSDKOptions` (`options.webapp`): `basePath`, `apiVersion`, and `onStatus`
|
|
167
|
+
- **WebApp / MFE with a non-null `SFDC_ENV` object** — `WebAppDataSDKOptions` (`options.webapp`): `basePath`, `apiVersion`, and `onStatus`
|
|
145
168
|
per-HTTP-status callbacks (each a `StatusCallback`) for cases like re-authenticating on a `401`.
|
|
146
169
|
This is the cached surface — see [02-caching-and-freshness.md](./02-caching-and-freshness.md).
|
|
147
170
|
- **Mosaic** — `MosaicDataSDKOptions` (`options.mosaic`): server-side (Node) auth via `instanceUrl` /
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.14.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"@conduit-client/service-pubsub": "3.19.6",
|
|
148
148
|
"@conduit-client/service-retry": "3.19.6",
|
|
149
149
|
"@conduit-client/utils": "3.19.6",
|
|
150
|
-
"@salesforce/jsonrpc": "^12.
|
|
150
|
+
"@salesforce/jsonrpc": "^12.14.0",
|
|
151
151
|
"@salesforce/sf-embedding-bridge": "2.3.0-rc.3"
|
|
152
152
|
},
|
|
153
153
|
"peerDependencies": {
|