@salesforce/platform-sdk 7.1.0 → 8.0.1
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/README.md +2 -2
- package/dist/core/data.d.ts +109 -12
- package/dist/core/data.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data/mosaic/index.d.ts +3 -2
- package/dist/data/mosaic/index.d.ts.map +1 -1
- package/dist/data/openai/index.d.ts +4 -2
- package/dist/data/openai/index.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/command.d.ts +1 -2
- package/dist/data/shared/graphql/cache/command.d.ts.map +1 -1
- package/dist/data/shared/graphql/cache/invoker.d.ts +4 -0
- package/dist/data/shared/graphql/cache/invoker.d.ts.map +1 -0
- package/dist/data/shared/graphql/cache/services.d.ts +22 -0
- package/dist/data/shared/graphql/cache/services.d.ts.map +1 -0
- package/dist/data/shared/graphql/cached-graphql.d.ts +16 -0
- package/dist/data/shared/graphql/cached-graphql.d.ts.map +1 -0
- package/dist/data/shared/graphql/graphql-parse.d.ts +16 -0
- package/dist/data/shared/graphql/graphql-parse.d.ts.map +1 -0
- package/dist/data/shared/graphql/uncached-graphql.d.ts +13 -0
- package/dist/data/shared/graphql/uncached-graphql.d.ts.map +1 -0
- package/dist/data/webapp/index.d.ts +9 -2
- package/dist/data/webapp/index.d.ts.map +1 -1
- package/dist/index.js +709 -402
- package/package.json +9 -9
- package/dist/data/shared/graphql/cache/index.d.ts +0 -7
- package/dist/data/shared/graphql/cache/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -21,9 +21,9 @@ Consumers that only use the chat, view, data, lightning, or core surfaces still
|
|
|
21
21
|
```ts
|
|
22
22
|
import { createDataSDK, gql } from "@salesforce/platform-sdk";
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const sdk = await createDataSDK();
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const result = await sdk.graphql?.query<GetAccountsQuery>({
|
|
27
27
|
query: gql`
|
|
28
28
|
query Accounts {
|
|
29
29
|
uiapi {
|
package/dist/core/data.d.ts
CHANGED
|
@@ -3,29 +3,126 @@
|
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
|
+
export interface GraphQLError {
|
|
7
|
+
message: string;
|
|
8
|
+
locations?: {
|
|
9
|
+
line: number;
|
|
10
|
+
column: number;
|
|
11
|
+
}[];
|
|
12
|
+
path?: string[];
|
|
13
|
+
}
|
|
6
14
|
export interface GraphQLResponse<T> {
|
|
7
15
|
data: T;
|
|
8
|
-
errors?:
|
|
9
|
-
message: string;
|
|
10
|
-
locations?: {
|
|
11
|
-
line: number;
|
|
12
|
-
column: number;
|
|
13
|
-
}[];
|
|
14
|
-
path?: string[];
|
|
15
|
-
}[];
|
|
16
|
+
errors?: GraphQLError[];
|
|
16
17
|
}
|
|
17
18
|
export interface GraphQLRequest<V = Record<string, unknown>> {
|
|
18
19
|
query: string;
|
|
19
20
|
variables?: V;
|
|
20
21
|
operationName?: string;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A GraphQL operation source string passed to {@link DataSDKGraphQL.query} or
|
|
25
|
+
* {@link DataSDKGraphQL.mutate}. Typically the identity output of `gql\`…\``.
|
|
26
|
+
* Surface implementations parse the string at call time.
|
|
27
|
+
*
|
|
28
|
+
* Aliased (rather than `string`) to leave room for accepting pre-parsed
|
|
29
|
+
* document nodes in a future revision without changing call sites.
|
|
30
|
+
*/
|
|
31
|
+
export type GraphQLRawDocument = string;
|
|
32
|
+
/**
|
|
33
|
+
* Unsubscribe handle returned from {@link QueryResult.subscribe}.
|
|
34
|
+
*/
|
|
35
|
+
export type Unsubscribe = () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Snapshot of a query's data + errors at a single point in time. Carried by
|
|
38
|
+
* the resolved {@link QueryResult} and pushed to subscribers on every
|
|
39
|
+
* subsequent resolution (cache update, stale-while-revalidate refresh,
|
|
40
|
+
* explicit `refresh()`).
|
|
41
|
+
*/
|
|
42
|
+
export interface QuerySnapshot<T> {
|
|
43
|
+
data: T | undefined;
|
|
44
|
+
errors?: GraphQLError[];
|
|
45
|
+
}
|
|
46
|
+
export type QuerySubscriber<T> = (snapshot: QuerySnapshot<T>) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Reactive query handle resolved by {@link DataSDKGraphQL.query}.
|
|
49
|
+
*
|
|
50
|
+
* `data` is the resolved snapshot at await-time — cached value if present
|
|
51
|
+
* (cached surfaces), otherwise the network response. `errors` carries any
|
|
52
|
+
* GraphQL or transport errors. `subscribe` streams subsequent snapshots;
|
|
53
|
+
* `refresh` re-issues the underlying request, bypassing the cache where one
|
|
54
|
+
* exists and propagating the result to subscribers.
|
|
55
|
+
*
|
|
56
|
+
* On uncached surfaces (Mosaic, OpenAI), `subscribe` only emits in response
|
|
57
|
+
* to `refresh()` — there is no cache to push background updates.
|
|
58
|
+
*/
|
|
59
|
+
export interface QueryResult<T> extends QuerySnapshot<T> {
|
|
60
|
+
subscribe(cb: QuerySubscriber<T>): Unsubscribe;
|
|
61
|
+
refresh(): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One-shot mutation result. Mutations are request/response — there is no
|
|
65
|
+
* `subscribe` / `refresh` (mutating a side effect on subscription is incoherent;
|
|
66
|
+
* re-running it on refresh is dangerous). Stale-after-mutation is handled by
|
|
67
|
+
* the caller holding query result references and calling `result.refresh()`.
|
|
68
|
+
*/
|
|
69
|
+
export interface MutationResult<T> {
|
|
70
|
+
data: T | undefined;
|
|
71
|
+
errors?: GraphQLError[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Options bag for {@link DataSDKGraphQL.query}.
|
|
75
|
+
*/
|
|
76
|
+
export interface QueryOptions<V = Record<string, unknown>> {
|
|
77
|
+
query: GraphQLRawDocument;
|
|
78
|
+
variables?: V;
|
|
79
|
+
operationName?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Options bag for {@link DataSDKGraphQL.mutate}.
|
|
83
|
+
*/
|
|
84
|
+
export interface MutateOptions<V = Record<string, unknown>> {
|
|
85
|
+
mutation: GraphQLRawDocument;
|
|
86
|
+
variables?: V;
|
|
87
|
+
operationName?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The `graphql` namespace on a {@link DataSDK}.
|
|
91
|
+
*
|
|
92
|
+
* Queries are reactive (cached on surfaces that cache, subscribable on every
|
|
93
|
+
* surface); mutations are request/response. Each method's return shape
|
|
94
|
+
* matches its semantics — no fakes, no noops.
|
|
95
|
+
*/
|
|
96
|
+
export interface DataSDKGraphQL {
|
|
23
97
|
/**
|
|
24
|
-
* Run a GraphQL query
|
|
98
|
+
* Run a GraphQL query.
|
|
99
|
+
*
|
|
100
|
+
* Resolves with `{ data, errors, subscribe, refresh }` once the
|
|
101
|
+
* underlying request settles — either from the cache (cached surfaces
|
|
102
|
+
* only) or from the network. `subscribe` streams subsequent snapshots;
|
|
103
|
+
* `refresh` re-issues the request, bypassing the cache where one exists
|
|
104
|
+
* and propagating the result to subscribers.
|
|
105
|
+
*
|
|
106
|
+
* On uncached surfaces (Mosaic, OpenAI), `subscribe` is real but only
|
|
107
|
+
* emits in response to `refresh()` — there is no cache to push background
|
|
108
|
+
* updates, so `refresh()` is the sole source of new snapshots and each
|
|
109
|
+
* call costs one network request.
|
|
25
110
|
*
|
|
26
|
-
*
|
|
111
|
+
* Mutations and subscriptions passed here are rejected via `result.errors`
|
|
112
|
+
* (the Promise still resolves — it does not reject). Parse failures are
|
|
113
|
+
* surfaced the same way.
|
|
27
114
|
*/
|
|
28
|
-
|
|
115
|
+
query<T, V = Record<string, unknown>>(options: QueryOptions<V>): Promise<QueryResult<T>>;
|
|
116
|
+
/**
|
|
117
|
+
* Run a GraphQL mutation. Pass-through to the underlying transport — does
|
|
118
|
+
* not read or write the cache. Queries and subscriptions passed here are
|
|
119
|
+
* rejected via the resolved `errors` field.
|
|
120
|
+
*/
|
|
121
|
+
mutate<T, V = Record<string, unknown>>(options: MutateOptions<V>): Promise<MutationResult<T>>;
|
|
122
|
+
}
|
|
123
|
+
export interface DataSDK {
|
|
124
|
+
/** GraphQL namespace. Present when the surface supports data operations. */
|
|
125
|
+
graphql?: DataSDKGraphQL;
|
|
29
126
|
/**
|
|
30
127
|
* Make a request using the Fetch API.
|
|
31
128
|
*
|
package/dist/core/data.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/core/data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/core/data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IA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WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzF;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9F;AAED,MAAM,WAAW,OAAO;IACvB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type { ACCConnection, ACCPanelCallbacks, ACCPreReceiveArgs } from './acc-
|
|
|
8
8
|
export type { SDKOptions } from './options';
|
|
9
9
|
export type { HostContext, HostStyles, ChatMessage, ChatSDK, DeviceCapabilities, DisplayMode, ResourceRequest, SafeAreaInsets, ToolCall, ToolState, } from './chat';
|
|
10
10
|
export type { AlertOptions, MessageLevel, ModalOptions, ToastOptions, Theme, ThemeMode, ViewSDK, } from './view';
|
|
11
|
-
export type { DataSDK, GraphQLRequest, GraphQLResponse } from './data';
|
|
11
|
+
export type { DataSDK, DataSDKGraphQL, GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLResponse, MutateOptions, MutationResult, QueryOptions, QueryResult, QuerySubscriber, Unsubscribe, } from './data';
|
|
12
12
|
export type { LightningSDK, LMSMessage, LMSSubscription, MessageChannel } from './lightning';
|
|
13
13
|
export type { OpenAISDK, SalesforceACCSDK } from './platforms';
|
|
14
14
|
export type { JsonRpcBase, JsonRpcRequest, JsonRpcError, JsonRpcSuccessResponse, JsonRpcErrorResponse, JsonRpcResponse, JsonRpcNotification, JsonRpcMessage, JsonRpcPendingRequest, JsonRpcPendingRequestMap, } from './jsonrpc';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGhD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGvF,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,QAAQ,EACR,SAAS,GACT,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,SAAS,EACT,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGhD,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGvF,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EACX,WAAW,EACX,UAAU,EACV,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,QAAQ,EACR,SAAS,GACT,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,SAAS,EACT,OAAO,GACP,MAAM,QAAQ,CAAC;AAGhB,YAAY,EACX,OAAO,EACP,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,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,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/D,YAAY,EACX,WAAW,EACX,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,GACxB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACN,aAAa,EACb,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EACN,uBAAuB,EACvB,KAAK,+BAA+B,GACpC,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSDK,
|
|
1
|
+
import { DataSDK, DataSDKGraphQL } from '../../core';
|
|
2
2
|
/**
|
|
3
3
|
* Options for creating a MosaicDataSDK
|
|
4
4
|
*/
|
|
@@ -16,7 +16,8 @@ export interface MosaicDataSDKOptions {
|
|
|
16
16
|
export declare class MosaicDataSDK implements DataSDK {
|
|
17
17
|
private readonly clientFetch;
|
|
18
18
|
private readonly pathData;
|
|
19
|
+
readonly graphql: DataSDKGraphQL;
|
|
19
20
|
constructor(options?: MosaicDataSDKOptions);
|
|
20
|
-
|
|
21
|
+
private executeRawGraphQL;
|
|
21
22
|
}
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,
|
|
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;AAI3F;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;YAa5B,iBAAiB;CAgB/B"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { DataSDK,
|
|
1
|
+
import { DataSDK, DataSDKGraphQL } from '../../core';
|
|
2
2
|
/**
|
|
3
3
|
* Data SDK implementation for the OpenAI surface, which delegates GraphQL
|
|
4
4
|
* queries to the Salesforce MCP server via the ChatGPT bridge.
|
|
5
5
|
*/
|
|
6
6
|
export declare class OpenAIDataSDK implements DataSDK {
|
|
7
|
-
graphql
|
|
7
|
+
readonly graphql: DataSDKGraphQL;
|
|
8
|
+
constructor();
|
|
9
|
+
private executeRawGraphQL;
|
|
8
10
|
}
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/openai/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/openai/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAK3F;;;GAGG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;;YAMnB,iBAAiB;CAa/B"}
|
|
@@ -32,8 +32,7 @@ type Services = NamedCacheControllerService & Partial<NamedPubSubService> & Name
|
|
|
32
32
|
* - Responses with a non-empty `errors` array are surfaced as a `UserVisibleError` and
|
|
33
33
|
* are NOT cached. Partial-data preservation (responses carrying both `data` and
|
|
34
34
|
* `errors`) is not implemented at this layer; callers requiring it should use a
|
|
35
|
-
* higher-level command that overrides `handleCacheControllerResult
|
|
36
|
-
* `HttpGraphQLNormalizedCacheControlCommand`).
|
|
35
|
+
* higher-level command that overrides `handleCacheControllerResult`.
|
|
37
36
|
* - Mutations and subscriptions ARE cached at this layer because operation kind is not
|
|
38
37
|
* inspected. Higher-level integrations that route mutations through this command MUST
|
|
39
38
|
* bypass it for non-query operations to avoid silent re-issue of cached mutation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/command.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kCAA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M,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC9D,SAAQ,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAQtE,OAAO,CAAC,QAAQ,CAAC,GAAG;IAPrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA0B;IAC9D,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAS;gBAGhD,MAAM,EAAE,4BAA4B,EACpC,QAAQ,EAAE,QAAQ,EACD,GAAG,EAAE,MAAM;IAW7B,SAAS,KAAK,WAAW,IAAI,UAAU,CAAC,YAAY,CAAC,CAapD;IAED,QAAQ,IAAI,MAAM;IAQlB;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAStE,YAAY,CACX,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAClD,WAAW,CAAC,IAAI,CAAC;IAqBpB,SAAS,KAAK,0BAA0B,IAAI,0BAA0B,CAMrE;IAED,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC;cAIrC,uBAAuB,CACzC,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,GAC1B,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CAMxC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HttpGraphQLResourceCacheControlCommand } from './command';
|
|
2
|
+
import { QueryResult } from '../../../../core/data';
|
|
3
|
+
export declare function invokeResourceGraphQL<T>(command: HttpGraphQLResourceCacheControlCommand<Record<string, unknown>>): Promise<QueryResult<T>>;
|
|
4
|
+
//# sourceMappingURL=invoker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoker.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/invoker.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,uBAAuB,CAAC;AAiB1E,wBAAsB,qBAAqB,CAAC,CAAC,EAC5C,OAAO,EAAE,sCAAsC,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAgCzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Cache } from '@conduit-client/service-cache/v1';
|
|
2
|
+
import { NamedCacheControllerService } from '@conduit-client/service-cache-control/v1';
|
|
3
|
+
import { FetchService, NamedFetchService } from '@conduit-client/service-fetch-network/v1';
|
|
4
|
+
import { NamedPubSubService } from '@conduit-client/service-pubsub/v1';
|
|
5
|
+
/**
|
|
6
|
+
* Aggregate of OneStore services required by the per-resource HTTP GraphQL
|
|
7
|
+
* cache-control command. Internal to WebAppDataSDK; not part of the public API.
|
|
8
|
+
*/
|
|
9
|
+
export type CacheServices = NamedCacheControllerService & NamedPubSubService & NamedFetchService;
|
|
10
|
+
export interface CacheBundle {
|
|
11
|
+
services: CacheServices;
|
|
12
|
+
cache: Cache;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds a fresh OneStore service set for one WebAppDataSDK instance. Each
|
|
16
|
+
* SDK instance owns its own services — no module-level singleton.
|
|
17
|
+
*
|
|
18
|
+
* The caller passes the SDK's own bound `fetch` so cache misses inherit
|
|
19
|
+
* CSRF retry, basePath application, and onStatus callbacks transparently.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildCacheServices(networkFetch: FetchService): CacheBundle;
|
|
22
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/services.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAG5F,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAG5E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,2BAA2B,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjG,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,WAAW,CAS1E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CacheBundle } from './cache/services';
|
|
2
|
+
import { RawGraphQLExecutor } from './graphql-parse';
|
|
3
|
+
import { DataSDKGraphQL } from '../../../core';
|
|
4
|
+
interface BuildCachedGraphQLOptions {
|
|
5
|
+
bundle: CacheBundle;
|
|
6
|
+
url: string;
|
|
7
|
+
executeRaw: RawGraphQLExecutor;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Build the `graphql` namespace for a webapp-surface DataSDK. Owns the cache
|
|
11
|
+
* bundle for the lifetime of the SDK instance; queries hit the OneStore
|
|
12
|
+
* cache, mutations bypass it via `executeRaw`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildCachedGraphQL({ bundle, url, executeRaw, }: BuildCachedGraphQLOptions): DataSDKGraphQL;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=cached-graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-graphql.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/cached-graphql.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAON,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAA2C,MAAM,eAAe,CAAC;AAE7F,UAAU,yBAAyB;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,kBAAkB,CAAC;CAC/B;AAWD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAClC,MAAM,EACN,GAAG,EACH,UAAU,GACV,EAAE,yBAAyB,GAAG,cAAc,CA0C5C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DocumentNode } from '@conduit-client/onestore-graphql-parser/v1';
|
|
2
|
+
import { Result } from '@conduit-client/utils';
|
|
3
|
+
import { GraphQLError, GraphQLRawDocument, GraphQLRequest, GraphQLResponse, MutateOptions, MutationResult, Unsubscribe } from '../../../core';
|
|
4
|
+
export declare const NOOP_UNSUB: Unsubscribe;
|
|
5
|
+
export declare const NOOP_REFRESH: () => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Parse an operation source string into a DocumentNode via the OneStore parser.
|
|
8
|
+
* Parse failures are returned as a structured error so callers can surface
|
|
9
|
+
* them through `result.errors` rather than throwing.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseToDocument(op: GraphQLRawDocument): Result<DocumentNode, GraphQLError[]>;
|
|
12
|
+
export declare function getOperationKind(document: DocumentNode, operationName?: string): "query" | "mutation" | "subscription" | "unknown";
|
|
13
|
+
export declare function toErrors(reason: unknown): GraphQLError[];
|
|
14
|
+
export type RawGraphQLExecutor = <T, V = Record<string, unknown>>(request: GraphQLRequest<V>) => Promise<GraphQLResponse<T>>;
|
|
15
|
+
export declare function executeMutate<T, V = Record<string, unknown>>(executeRaw: RawGraphQLExecutor, { mutation: op, variables, operationName: explicitName }: MutateOptions<V>): Promise<MutationResult<T>>;
|
|
16
|
+
//# sourceMappingURL=graphql-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-parse.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/graphql-parse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAGN,KAAK,YAAY,EAEjB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACX,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,UAAU,EAAE,WAExB,CAAC;AAEF,eAAO,MAAM,YAAY,QAAa,OAAO,CAAC,IAAI,CAEjD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,MAAM,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAM5F;AAED,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,YAAY,EACtB,aAAa,CAAC,EAAE,MAAM,GACpB,OAAO,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,CAanD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,EAAE,CAexD;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,KACtB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC,wBAAsB,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,EAAE,kBAAkB,EAC9B,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,GACxE,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CA6B5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RawGraphQLExecutor } from './graphql-parse';
|
|
2
|
+
import { DataSDKGraphQL } from '../../../core/data';
|
|
3
|
+
/**
|
|
4
|
+
* Build the `graphql` namespace for a surface with no cache. `query` returns
|
|
5
|
+
* a Promise that resolves with `{data, errors, subscribe, refresh}`
|
|
6
|
+
* once the first network response arrives. `subscribe` streams subsequent
|
|
7
|
+
* snapshots triggered by `refresh()` — there is no cache to push background
|
|
8
|
+
* updates. `mutate` is request/response.
|
|
9
|
+
*
|
|
10
|
+
* Lets caching and non-caching surfaces present the same call-site API.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildUncachedGraphQL(executeRaw: RawGraphQLExecutor): DataSDKGraphQL;
|
|
13
|
+
//# sourceMappingURL=uncached-graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uncached-graphql.d.ts","sourceRoot":"","sources":["../../../../src/data/shared/graphql/uncached-graphql.ts"],"names":[],"mappings":"AAMA,OAAO,EAON,KAAK,kBAAkB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACX,cAAc,EAKd,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,kBAAkB,GAAG,cAAc,CAyEnF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataSDK,
|
|
1
|
+
import { DataSDK, DataSDKGraphQL } from '../../core';
|
|
2
2
|
import { WebAppDataSDKOptions } from '../index';
|
|
3
3
|
/**
|
|
4
4
|
* Data SDK implementation for web apps, which is based on making `fetch` calls to REST endpoints
|
|
@@ -7,9 +7,16 @@ export declare class WebAppDataSDK implements DataSDK {
|
|
|
7
7
|
private readonly baseUrl;
|
|
8
8
|
private readonly clientFetch;
|
|
9
9
|
private readonly onStatus;
|
|
10
|
+
readonly graphql: DataSDKGraphQL;
|
|
10
11
|
constructor(options?: WebAppDataSDKOptions);
|
|
11
|
-
graphql<T, V>({ query, variables, operationName, }: GraphQLRequest<V>): Promise<GraphQLResponse<T>>;
|
|
12
12
|
fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
13
|
+
/**
|
|
14
|
+
* Raw GraphQL POST. Used internally by `graphql.mutate` (which has no
|
|
15
|
+
* cache concern) and transitively by `graphql.query` on cache miss
|
|
16
|
+
* (the OneStore cache command's fetch service is bound to this same
|
|
17
|
+
* SDK's `fetch`, which in turn calls this method's caller patterns).
|
|
18
|
+
*/
|
|
19
|
+
private executeRawGraphQL;
|
|
13
20
|
/**
|
|
14
21
|
* If the url is relative, convert to it to an absolute Salesforce URL. This is due to the way Code
|
|
15
22
|
* Builder deployments structure the url for Salesforce
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAcrD;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyD;IAClF,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;IA+BpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUjF;;;;;OAKG;YACW,iBAAiB;IAc/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAa3B"}
|