@memberjunction/graphql-dataprovider 6.2.0-edge.1 → 6.2.0-edge.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/README.md +26 -0
- package/dist/index.cjs +123 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +364 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +364 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +137 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -63,6 +63,32 @@ const dataProvider = new GraphQLDataProvider();
|
|
|
63
63
|
await dataProvider.Config(config);
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
### Connect-only boot for embeds
|
|
67
|
+
|
|
68
|
+
`setupGraphQLClient` performs the full boot: it connects, downloads the entire entity metadata graph, loads the current user and starts the registered startup engines. An anonymous embed (for example a widget that only needs to run a realtime voice session) needs none of that, and the metadata download dominates the cost. For that case use `ConnectGraphQLClient`, which connects and registers the provider globally (`Metadata.Provider` is set) and stops there.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { ConnectGraphQLClient, GraphQLProviderConfigData } from '@memberjunction/graphql-dataprovider';
|
|
72
|
+
|
|
73
|
+
const config = new GraphQLProviderConfigData(token, 'https://api.example.com/graphql', 'wss://api.example.com/graphql', refreshToken);
|
|
74
|
+
const provider = await ConnectGraphQLClient(config);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
| | `ConnectGraphQLClient` | `setupGraphQLClient` |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| Client, session id, token, `ConfigData` | Yes | Yes |
|
|
80
|
+
| `Metadata.Provider` set | Yes | Yes |
|
|
81
|
+
| `ExecuteGQL`, subscriptions, the realtime runtime | Works | Works |
|
|
82
|
+
| Entity metadata, `RunView`, `GetEntityObject`, engines, `CurrentUser` | Not available | Available |
|
|
83
|
+
|
|
84
|
+
`ConnectGraphQLClient` raises no `LoggedIn` event, so nothing that waits for a login (engine pre-warming, for example) starts.
|
|
85
|
+
|
|
86
|
+
Calling `ConnectGraphQLClient` on a provider that is already fully booted is a no-op that returns it; it never drops loaded metadata or recreates the client. Calling it again on a connected but unbooted provider replaces `ConfigData` and keeps the session id. If the URL, token or API keys differ from the ones the current client was built with, the client is rebuilt so requests carry the new identity; with the same credentials the existing client is reused. For routine token expiry, keep using `RefreshTokenFunction` / `OnAuthenticationError`.
|
|
87
|
+
|
|
88
|
+
You can finish the boot later on the same instance by calling `setupGraphQLClient(config)`; it then performs the full metadata load, current-user fetch and startup engines. This is also how an anonymous connection becomes a signed-in one: pass the login's config, and the client is rebuilt with the new token before the metadata download. An already-open subscription socket keeps the identity it connected with until it reconnects.
|
|
89
|
+
|
|
90
|
+
`setupGraphQLClient` now rejects when the boot loaded no entity metadata (before the current user is loaded or any startup engine runs), instead of resolving with an empty provider. If you only want a connection, call `ConnectGraphQLClient`.
|
|
91
|
+
|
|
66
92
|
### Working with Entities
|
|
67
93
|
|
|
68
94
|
```typescript
|