@cedarjs/web 6.0.0-canary.2661 → 6.0.0-canary.2663
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/apollo/ApolloProviderWithFetchConfig.d.ts +15 -0
- package/dist/apollo/ApolloProviderWithFetchConfig.d.ts.map +1 -0
- package/dist/apollo/ApolloProviderWithFetchConfig.js +134 -0
- package/dist/apollo/CedarApolloProvider.d.ts +14 -0
- package/dist/apollo/CedarApolloProvider.d.ts.map +1 -0
- package/dist/apollo/CedarApolloProvider.js +35 -0
- package/dist/apollo/ErrorBoundary.d.ts +13 -0
- package/dist/apollo/ErrorBoundary.d.ts.map +1 -0
- package/dist/apollo/ErrorBoundary.js +13 -0
- package/dist/apollo/apolloLinkTypes.d.ts +60 -0
- package/dist/apollo/apolloLinkTypes.d.ts.map +1 -0
- package/dist/apollo/apolloLinkTypes.js +0 -0
- package/dist/apollo/index.d.ts +50 -69
- package/dist/apollo/index.d.ts.map +1 -1
- package/dist/apollo/index.js +2 -163
- package/dist/apollo/suspense.d.ts +16 -6
- package/dist/apollo/suspense.d.ts.map +1 -1
- package/dist/apollo/suspense.js +4 -2
- package/dist/cjs/apollo/ApolloProviderWithFetchConfig.d.ts +15 -0
- package/dist/cjs/apollo/ApolloProviderWithFetchConfig.d.ts.map +1 -0
- package/dist/cjs/apollo/ApolloProviderWithFetchConfig.js +165 -0
- package/dist/cjs/apollo/CedarApolloProvider.d.ts +14 -0
- package/dist/cjs/apollo/CedarApolloProvider.d.ts.map +1 -0
- package/dist/cjs/apollo/CedarApolloProvider.js +69 -0
- package/dist/cjs/apollo/ErrorBoundary.d.ts +13 -0
- package/dist/cjs/apollo/ErrorBoundary.d.ts.map +1 -0
- package/dist/cjs/apollo/ErrorBoundary.js +47 -0
- package/dist/cjs/apollo/apolloLinkTypes.d.ts +60 -0
- package/dist/cjs/apollo/apolloLinkTypes.d.ts.map +1 -0
- package/dist/cjs/apollo/apolloLinkTypes.js +16 -0
- package/dist/cjs/apollo/index.d.ts +50 -69
- package/dist/cjs/apollo/index.d.ts.map +1 -1
- package/dist/cjs/apollo/index.js +2 -167
- package/dist/cjs/apollo/suspense.d.ts +16 -6
- package/dist/cjs/apollo/suspense.d.ts.map +1 -1
- package/dist/cjs/apollo/suspense.js +5 -2
- package/dist/cjs/components/FetchConfigProvider.d.ts +3 -2
- package/dist/cjs/components/FetchConfigProvider.d.ts.map +1 -1
- package/dist/components/FetchConfigProvider.d.ts +3 -2
- package/dist/components/FetchConfigProvider.d.ts.map +1 -1
- package/package.json +15 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/apollo/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/apollo/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EACV,uBAAuB,IAAI,4BAA4B,EACvD,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,IAAI,4BAA4B,EACxD,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,YAAY,EACV,QAAQ,EACR,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,QAAQ,EAAE,CAAA;AAEnB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAA;AAEhE;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,CAAA;AAElE;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,CAAA;AAElE;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAA;AAEvD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAC3B,IAAI,SAAS,mBAAmB,EAChC,IAAI,SAAS,UAAU,GAAG,UAAU,IAClC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAE/B;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAA;AAEjD;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,sBAAsB,CAAA;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,4BAAsB,CAAA"}
|
package/dist/cjs/apollo/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var apollo_exports = {};
|
|
30
20
|
__export(apollo_exports, {
|
|
@@ -35,165 +25,10 @@ __export(apollo_exports, {
|
|
|
35
25
|
useCache: () => import_useCache.useCache
|
|
36
26
|
});
|
|
37
27
|
module.exports = __toCommonJS(apollo_exports);
|
|
38
|
-
var
|
|
39
|
-
var import_cache = require("@apollo/client/cache/cache.cjs");
|
|
40
|
-
var import_core = require("@apollo/client/core/core.cjs");
|
|
41
|
-
var import_context = require("@apollo/client/link/context/context.cjs");
|
|
42
|
-
var import_core2 = require("@apollo/client/link/core/core.cjs");
|
|
43
|
-
var import_persisted_queries = require("@apollo/client/link/persisted-queries/persisted-queries.cjs");
|
|
44
|
-
var import_react2 = require("@apollo/client/react/react.cjs");
|
|
45
|
-
var import_utilities = require("@apollo/client/utilities/utilities.cjs");
|
|
46
|
-
var import_printer = require("graphql/language/printer.js");
|
|
47
|
-
var import_auth = require("@cedarjs/auth");
|
|
48
|
-
var import_apollo_upload_client = require("../bundled/apollo-upload-client.js");
|
|
49
|
-
var import_FetchConfigProvider = require("../components/FetchConfigProvider.js");
|
|
28
|
+
var import_CedarApolloProvider = require("./CedarApolloProvider.js");
|
|
50
29
|
var import_fragmentRegistry = require("./fragmentRegistry.js");
|
|
51
|
-
var SSELinkExports = __toESM(require("./sseLink.js"), 1);
|
|
52
30
|
var import_useCache = require("./useCache.js");
|
|
53
|
-
const
|
|
54
|
-
const ApolloProviderWithFetchConfig = ({ config, children, useAuth = import_auth.useNoAuth, logLevel }) => {
|
|
55
|
-
(0, import_core.setLogVerbosity)(logLevel);
|
|
56
|
-
const { getToken, type: authProviderType } = useAuth();
|
|
57
|
-
const data = {
|
|
58
|
-
mostRecentRequest: void 0,
|
|
59
|
-
mostRecentResponse: void 0
|
|
60
|
-
};
|
|
61
|
-
const updateDataApolloLink = new import_core2.ApolloLink((operation, forward) => {
|
|
62
|
-
const { operationName, query, variables } = operation;
|
|
63
|
-
data.mostRecentRequest = {};
|
|
64
|
-
data.mostRecentRequest.operationName = operationName;
|
|
65
|
-
data.mostRecentRequest.operationKind = query?.kind.toString();
|
|
66
|
-
data.mostRecentRequest.variables = variables;
|
|
67
|
-
data.mostRecentRequest.query = query && (0, import_printer.print)(operation.query);
|
|
68
|
-
return forward(operation).map((result) => {
|
|
69
|
-
data.mostRecentResponse = result;
|
|
70
|
-
return result;
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
const withToken = (0, import_context.setContext)(async () => {
|
|
74
|
-
const token = await getToken();
|
|
75
|
-
return { token };
|
|
76
|
-
});
|
|
77
|
-
const { headers, uri } = (0, import_FetchConfigProvider.useFetchConfig)();
|
|
78
|
-
const authMiddleware = new import_core2.ApolloLink((operation, forward) => {
|
|
79
|
-
const { token } = operation.getContext();
|
|
80
|
-
const authHeaders = token ? {
|
|
81
|
-
"auth-provider": authProviderType,
|
|
82
|
-
authorization: `Bearer ${token}`
|
|
83
|
-
} : {};
|
|
84
|
-
operation.setContext(() => ({
|
|
85
|
-
headers: {
|
|
86
|
-
...operation.getContext().headers,
|
|
87
|
-
...headers,
|
|
88
|
-
// Duped auth headers, because we may remove the `FetchConfigProvider` at a later date.
|
|
89
|
-
...authHeaders
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
return forward(operation);
|
|
93
|
-
});
|
|
94
|
-
const { httpLinkConfig, link: redwoodApolloLink, ...rest } = config ?? {};
|
|
95
|
-
const uploadLink = (0, import_apollo_upload_client.createUploadLink)({
|
|
96
|
-
uri,
|
|
97
|
-
...httpLinkConfig
|
|
98
|
-
// The upload link types don't match the ApolloLink types, even though it comes from Apollo
|
|
99
|
-
// because they use ESM imports and we're using the default ones.
|
|
100
|
-
});
|
|
101
|
-
const uploadOrSSELink = typeof SSELink !== "undefined" ? (0, import_core2.split)(
|
|
102
|
-
({ query }) => {
|
|
103
|
-
const definition = (0, import_utilities.getMainDefinition)(query);
|
|
104
|
-
return isSubscription(definition) || isLiveQuery(definition);
|
|
105
|
-
},
|
|
106
|
-
new SSELink({
|
|
107
|
-
url: uri,
|
|
108
|
-
auth: { authProviderType, tokenFn: getToken },
|
|
109
|
-
httpLinkConfig,
|
|
110
|
-
headers
|
|
111
|
-
}),
|
|
112
|
-
uploadLink
|
|
113
|
-
) : uploadLink;
|
|
114
|
-
const terminatingLink = (0, import_core2.split)(
|
|
115
|
-
({ query }) => {
|
|
116
|
-
const documentQuery = query;
|
|
117
|
-
return documentQuery?.["__meta__"]?.["hash"] !== void 0;
|
|
118
|
-
},
|
|
119
|
-
(0, import_persisted_queries.createPersistedQueryLink)({
|
|
120
|
-
generateHash: (document) => document["__meta__"]["hash"]
|
|
121
|
-
}).concat(uploadOrSSELink),
|
|
122
|
-
uploadOrSSELink
|
|
123
|
-
);
|
|
124
|
-
const redwoodApolloLinks = [
|
|
125
|
-
{ name: "withToken", link: withToken },
|
|
126
|
-
{ name: "authMiddleware", link: authMiddleware },
|
|
127
|
-
{ name: "updateDataApolloLink", link: updateDataApolloLink },
|
|
128
|
-
{ name: "httpLink", link: terminatingLink }
|
|
129
|
-
];
|
|
130
|
-
let link = redwoodApolloLink;
|
|
131
|
-
link ??= import_core2.ApolloLink.from(redwoodApolloLinks.map((l) => l.link));
|
|
132
|
-
if (typeof link === "function") {
|
|
133
|
-
link = link(redwoodApolloLinks);
|
|
134
|
-
}
|
|
135
|
-
const client = new import_core.ApolloClient({
|
|
136
|
-
// Default options for every Cell. Better to specify them here than in `beforeQuery` where it's too easy to overwrite them.
|
|
137
|
-
// See https://www.apollographql.com/docs/react/api/core/ApolloClient/#example-defaultoptions-object.
|
|
138
|
-
defaultOptions: {
|
|
139
|
-
watchQuery: {
|
|
140
|
-
// The `fetchPolicy` we expect:
|
|
141
|
-
//
|
|
142
|
-
// > Apollo Client executes the full query against both the cache and your GraphQL server.
|
|
143
|
-
// > The query automatically updates if the result of the server-side query modifies cached fields.
|
|
144
|
-
//
|
|
145
|
-
// See https://www.apollographql.com/docs/react/data/queries/#cache-and-network.
|
|
146
|
-
fetchPolicy: "cache-and-network",
|
|
147
|
-
// So that Cells rerender when refetching.
|
|
148
|
-
// See https://www.apollographql.com/docs/react/data/queries/#inspecting-loading-states.
|
|
149
|
-
notifyOnNetworkStatusChange: true
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
link,
|
|
153
|
-
...rest
|
|
154
|
-
});
|
|
155
|
-
const extendErrorAndRethrow = (error, _errorInfo) => {
|
|
156
|
-
error["mostRecentRequest"] = data.mostRecentRequest;
|
|
157
|
-
error["mostRecentResponse"] = data.mostRecentResponse;
|
|
158
|
-
throw error;
|
|
159
|
-
};
|
|
160
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react2.ApolloProvider, { client }, /* @__PURE__ */ import_react.default.createElement(ErrorBoundary, { onError: extendErrorAndRethrow }, children));
|
|
161
|
-
};
|
|
162
|
-
class ErrorBoundary extends import_react.default.Component {
|
|
163
|
-
componentDidCatch(...args) {
|
|
164
|
-
this.setState({});
|
|
165
|
-
this.props.onError(...args);
|
|
166
|
-
}
|
|
167
|
-
render() {
|
|
168
|
-
return this.props.children;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
const RedwoodApolloProvider = ({
|
|
172
|
-
graphQLClientConfig,
|
|
173
|
-
fragments,
|
|
174
|
-
useAuth = import_auth.useNoAuth,
|
|
175
|
-
logLevel = "debug",
|
|
176
|
-
children
|
|
177
|
-
}) => {
|
|
178
|
-
const { cacheConfig, ...config } = graphQLClientConfig ?? {};
|
|
179
|
-
if (fragments) {
|
|
180
|
-
import_fragmentRegistry.fragmentRegistry.register(...fragments);
|
|
181
|
-
}
|
|
182
|
-
const cache = new import_cache.InMemoryCache({
|
|
183
|
-
fragments: import_fragmentRegistry.fragmentRegistry,
|
|
184
|
-
possibleTypes: cacheConfig?.possibleTypes,
|
|
185
|
-
...cacheConfig
|
|
186
|
-
}).restore(globalThis?.__REDWOOD__APOLLO_STATE ?? {});
|
|
187
|
-
return /* @__PURE__ */ import_react.default.createElement(import_FetchConfigProvider.FetchConfigProvider, { useAuth }, /* @__PURE__ */ import_react.default.createElement(
|
|
188
|
-
ApolloProviderWithFetchConfig,
|
|
189
|
-
{
|
|
190
|
-
config: { cache, ...config },
|
|
191
|
-
useAuth,
|
|
192
|
-
logLevel
|
|
193
|
-
},
|
|
194
|
-
children
|
|
195
|
-
));
|
|
196
|
-
};
|
|
31
|
+
const RedwoodApolloProvider = import_CedarApolloProvider.CedarApolloProvider;
|
|
197
32
|
// Annotate the CommonJS export names for ESM import in node:
|
|
198
33
|
0 && (module.exports = {
|
|
199
34
|
RedwoodApolloProvider,
|
|
@@ -19,28 +19,28 @@ export type GraphQLClientConfigProp = Omit<ApolloClientOptions<unknown>, 'cache'
|
|
|
19
19
|
* For example, you can use this prop to set the credentials policy so that cookies can be sent to other domains:
|
|
20
20
|
*
|
|
21
21
|
* ```js
|
|
22
|
-
* <
|
|
22
|
+
* <CedarApolloProvider graphQLClientConfig={{
|
|
23
23
|
* httpLinkConfig: { credentials: 'include' }
|
|
24
24
|
* }}>
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
httpLinkConfig?: HttpOptions;
|
|
28
28
|
/**
|
|
29
|
-
* Extend or overwrite `
|
|
29
|
+
* Extend or overwrite `CedarApolloProvider`'s Apollo Link.
|
|
30
30
|
*
|
|
31
|
-
* To overwrite
|
|
31
|
+
* To overwrite Cedar's Apollo Link, just provide your own `ApolloLink`.
|
|
32
32
|
*
|
|
33
|
-
* To extend
|
|
33
|
+
* To extend Cedar's Apollo Link, provide a function—it'll get passed an array of Cedar's Apollo Links
|
|
34
34
|
* which are objects with a name and link property:
|
|
35
35
|
*
|
|
36
36
|
* ```js
|
|
37
|
-
* const link = (
|
|
37
|
+
* const link = (cedarApolloLinks) => {
|
|
38
38
|
* const consoleLink = new ApolloLink((operation, forward) => {
|
|
39
39
|
* console.log(operation.operationName)
|
|
40
40
|
* return forward(operation)
|
|
41
41
|
* })
|
|
42
42
|
*
|
|
43
|
-
* return ApolloLink.from([consoleLink, ...
|
|
43
|
+
* return ApolloLink.from([consoleLink, ...cedarApolloLinks.map(({ link }) => link)])
|
|
44
44
|
* }
|
|
45
45
|
* ```
|
|
46
46
|
*
|
|
@@ -50,6 +50,16 @@ export type GraphQLClientConfigProp = Omit<ApolloClientOptions<unknown>, 'cache'
|
|
|
50
50
|
*/
|
|
51
51
|
link?: ApolloLink | RedwoodApolloLinkFactory;
|
|
52
52
|
};
|
|
53
|
+
export declare const CedarApolloProvider: React.FunctionComponent<{
|
|
54
|
+
graphQLClientConfig?: GraphQLClientConfigProp;
|
|
55
|
+
useAuth?: UseAuth;
|
|
56
|
+
logLevel?: ReturnType<typeof setLogVerbosity>;
|
|
57
|
+
children: React.ReactNode;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Use `CedarApolloProvider` instead. `RedwoodApolloProvider` will
|
|
61
|
+
* be removed in a future release.
|
|
62
|
+
*/
|
|
53
63
|
export declare const RedwoodApolloProvider: React.FunctionComponent<{
|
|
54
64
|
graphQLClientConfig?: GraphQLClientConfigProp;
|
|
55
65
|
useAuth?: UseAuth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suspense.d.ts","sourceRoot":"","sources":["../../../src/apollo/suspense.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,eAAe,EAChB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAEL,aAAa,EAEd,MAAM,gCAAgC,CAAA;AAGvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAW5C,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AASnB,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAA;AAEzD,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,GACnB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,mBAAmB,CAAC,OAAO,CAAC,EAC5B,OAAO,GAAG,MAAM,CACjB,GAAG;IACF,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,uBAAuB,CAAA;IACrC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,WAAW,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,wBAAwB,CAAA;CAC7C,CAAA;AAkFD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"suspense.d.ts","sourceRoot":"","sources":["../../../src/apollo/suspense.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,eAAe,EAChB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAEL,aAAa,EAEd,MAAM,gCAAgC,CAAA;AAGvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAW5C,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AASnB,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAA;AAEzD,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,GACnB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,mBAAmB,CAAC,OAAO,CAAC,EAC5B,OAAO,GAAG,MAAM,CACjB,GAAG;IACF,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,uBAAuB,CAAA;IACrC;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,WAAW,CAAA;IAC5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,wBAAwB,CAAA;CAC7C,CAAA;AAkFD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACxD,mBAAmB,CAAC,EAAE,uBAAuB,CAAA;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CA4BA,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB;0BAtCV,uBAAuB;cACnC,OAAO;eACN,UAAU,CAAC,OAAO,eAAe,CAAC;cACnC,KAAK,CAAC,SAAS;EAmC6B,CAAA"}
|
|
@@ -29,6 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
30
|
var suspense_exports = {};
|
|
31
31
|
__export(suspense_exports, {
|
|
32
|
+
CedarApolloProvider: () => CedarApolloProvider,
|
|
32
33
|
RedwoodApolloProvider: () => RedwoodApolloProvider
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(suspense_exports);
|
|
@@ -88,7 +89,7 @@ const ApolloProviderWithFetchConfig = ({ config, children, logLevel, useAuth = i
|
|
|
88
89
|
}
|
|
89
90
|
return /* @__PURE__ */ import_react.default.createElement(WrappedApolloProvider, { makeClient }, children);
|
|
90
91
|
};
|
|
91
|
-
const
|
|
92
|
+
const CedarApolloProvider = ({
|
|
92
93
|
graphQLClientConfig,
|
|
93
94
|
useAuth = import_auth.useNoAuth,
|
|
94
95
|
logLevel = "debug",
|
|
@@ -98,7 +99,7 @@ const RedwoodApolloProvider = ({
|
|
|
98
99
|
const cache = new import_client_react_streaming.InMemoryCache({
|
|
99
100
|
fragments: import_fragmentRegistry.fragmentRegistry,
|
|
100
101
|
...cacheConfig
|
|
101
|
-
}).restore(globalThis?.
|
|
102
|
+
}).restore(globalThis?.__CEDAR__APOLLO_STATE ?? {});
|
|
102
103
|
return /* @__PURE__ */ import_react.default.createElement(import_FetchConfigProvider.FetchConfigProvider, { useAuth }, /* @__PURE__ */ import_react.default.createElement(
|
|
103
104
|
ApolloProviderWithFetchConfig,
|
|
104
105
|
{
|
|
@@ -109,7 +110,9 @@ const RedwoodApolloProvider = ({
|
|
|
109
110
|
children
|
|
110
111
|
));
|
|
111
112
|
};
|
|
113
|
+
const RedwoodApolloProvider = CedarApolloProvider;
|
|
112
114
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
115
|
0 && (module.exports = {
|
|
116
|
+
CedarApolloProvider,
|
|
114
117
|
RedwoodApolloProvider
|
|
115
118
|
});
|
|
@@ -16,8 +16,9 @@ interface Props {
|
|
|
16
16
|
/**
|
|
17
17
|
* The `FetchConfigProvider` understands Redwood's Auth and determines the
|
|
18
18
|
* correct request-headers based on a user's authentication state.
|
|
19
|
-
* Note that the auth bearer token is now passed in
|
|
20
|
-
* as the token is
|
|
19
|
+
* Note that the auth bearer token is now passed in
|
|
20
|
+
* packages/web/src/apollo/ApolloProviderWithFetchConfig.tsx as the token is
|
|
21
|
+
* retrieved async
|
|
21
22
|
*/
|
|
22
23
|
export declare const FetchConfigProvider: React.FC<Props>;
|
|
23
24
|
export declare const useFetchConfig: () => FetchConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+B/C,CAAA;AAED,eAAO,MAAM,cAAc,mBAA6C,CAAA"}
|
|
@@ -16,8 +16,9 @@ interface Props {
|
|
|
16
16
|
/**
|
|
17
17
|
* The `FetchConfigProvider` understands Redwood's Auth and determines the
|
|
18
18
|
* correct request-headers based on a user's authentication state.
|
|
19
|
-
* Note that the auth bearer token is now passed in
|
|
20
|
-
* as the token is
|
|
19
|
+
* Note that the auth bearer token is now passed in
|
|
20
|
+
* packages/web/src/apollo/ApolloProviderWithFetchConfig.tsx as the token is
|
|
21
|
+
* retrieved async
|
|
21
22
|
*/
|
|
22
23
|
export declare const FetchConfigProvider: React.FC<Props>;
|
|
23
24
|
export declare const useFetchConfig: () => FetchConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"FetchConfigProvider.d.ts","sourceRoot":"","sources":["../../src/components/FetchConfigProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAG5C,eAAO,MAAM,gBAAgB,cAE5B,CAAA;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC/D;AAED,eAAO,MAAM,kBAAkB,4BAE7B,CAAA;AAEF,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA+B/C,CAAA;AAED,eAAO,MAAM,cAAc,mBAA6C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/web",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2663",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -103,6 +103,16 @@
|
|
|
103
103
|
"default": "./dist/cjs/apollo/index.js"
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
+
"./apollo/CedarApolloProvider": {
|
|
107
|
+
"import": {
|
|
108
|
+
"types": "./dist/apollo/CedarApolloProvider.d.ts",
|
|
109
|
+
"default": "./dist/apollo/CedarApolloProvider.js"
|
|
110
|
+
},
|
|
111
|
+
"require": {
|
|
112
|
+
"types": "./dist/cjs/apollo/CedarApolloProvider.d.ts",
|
|
113
|
+
"default": "./dist/cjs/apollo/CedarApolloProvider.js"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
106
116
|
"./forceEsmApollo": {
|
|
107
117
|
"require": "./dist/apollo/index.js",
|
|
108
118
|
"import": "./dist/apollo/index.js"
|
|
@@ -140,7 +150,7 @@
|
|
|
140
150
|
},
|
|
141
151
|
"dependencies": {
|
|
142
152
|
"@apollo/client": "3.14.1",
|
|
143
|
-
"@cedarjs/server-store": "6.0.0-canary.
|
|
153
|
+
"@cedarjs/server-store": "6.0.0-canary.2663",
|
|
144
154
|
"@dr.pogodin/react-helmet": "2.0.4",
|
|
145
155
|
"@whatwg-node/fetch": "0.10.13",
|
|
146
156
|
"apollo-upload-client": "18.0.1",
|
|
@@ -159,9 +169,9 @@
|
|
|
159
169
|
"@babel/core": "^7.26.10",
|
|
160
170
|
"@babel/plugin-transform-runtime": "7.29.7",
|
|
161
171
|
"@babel/runtime": "7.29.7",
|
|
162
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
163
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
164
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
172
|
+
"@cedarjs/auth": "6.0.0-canary.2663",
|
|
173
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2663",
|
|
174
|
+
"@cedarjs/internal": "6.0.0-canary.2663",
|
|
165
175
|
"@rollup/plugin-babel": "6.1.0",
|
|
166
176
|
"@testing-library/dom": "10.4.1",
|
|
167
177
|
"@testing-library/jest-dom": "6.9.1",
|