@ic-reactor/react 3.11.0 → 3.12.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 +35 -4
- package/dist/auth/authentication-manager.d.ts +15 -0
- package/dist/auth/authentication-manager.d.ts.map +1 -1
- package/dist/auth/authentication-manager.js +84 -16
- package/dist/auth/authentication-manager.js.map +1 -1
- package/dist/auth/constants.d.ts +7 -1
- package/dist/auth/constants.d.ts.map +1 -1
- package/dist/auth/constants.js +7 -1
- package/dist/auth/constants.js.map +1 -1
- package/dist/auth/identity-attributes-manager.d.ts.map +1 -1
- package/dist/auth/identity-attributes-manager.js +13 -14
- package/dist/auth/identity-attributes-manager.js.map +1 -1
- package/dist/auth/local-ii-probe.d.ts +46 -0
- package/dist/auth/local-ii-probe.d.ts.map +1 -0
- package/dist/auth/local-ii-probe.js +102 -0
- package/dist/auth/local-ii-probe.js.map +1 -0
- package/dist/auth/types.d.ts +3 -6
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/defineReactor.d.ts +2 -1
- package/dist/defineReactor.d.ts.map +1 -1
- package/dist/defineReactor.js +22 -1
- package/dist/defineReactor.js.map +1 -1
- package/llms.txt +7 -1
- package/package.json +12 -12
- package/src/auth/authentication-manager.ts +102 -20
- package/src/auth/constants.ts +9 -2
- package/src/auth/identity-attributes-manager.ts +13 -18
- package/src/auth/local-ii-probe.ts +147 -0
- package/src/auth/types.ts +5 -9
- package/src/defineReactor.ts +30 -1
package/src/defineReactor.ts
CHANGED
|
@@ -87,7 +87,8 @@ export interface DefineReactorSharedParameters
|
|
|
87
87
|
* When omitted, a ClientManager is created from the agent options below.
|
|
88
88
|
*
|
|
89
89
|
* A supplied or adopted manager brings its own agent and QueryClient, so
|
|
90
|
-
* `agentOptions` and `
|
|
90
|
+
* `agentOptions`, `queryClient` and `allowEnvConfig` apply only when this
|
|
91
|
+
* call creates one.
|
|
91
92
|
*/
|
|
92
93
|
clientManager?: ClientManager
|
|
93
94
|
/**
|
|
@@ -183,6 +184,8 @@ export function defineReactor<Service = BaseActor>(
|
|
|
183
184
|
auth,
|
|
184
185
|
display,
|
|
185
186
|
agentOptions,
|
|
187
|
+
allowEnvConfig,
|
|
188
|
+
allowEnvRootKey,
|
|
186
189
|
name,
|
|
187
190
|
idlFactory,
|
|
188
191
|
canisterId,
|
|
@@ -215,12 +218,38 @@ export function defineReactor<Service = BaseActor>(
|
|
|
215
218
|
)
|
|
216
219
|
}
|
|
217
220
|
|
|
221
|
+
// Same reasoning as `auth`, and it matters more here: an ignored
|
|
222
|
+
// `allowEnvConfig: false` reads as "I locked the cookie out" while the
|
|
223
|
+
// supplied manager carries whatever decision it was built with.
|
|
224
|
+
if (
|
|
225
|
+
(providedClientManager || providedAuthentication) &&
|
|
226
|
+
(allowEnvConfig !== undefined || allowEnvRootKey !== undefined)
|
|
227
|
+
) {
|
|
228
|
+
const passed = [
|
|
229
|
+
allowEnvConfig !== undefined && "allowEnvConfig",
|
|
230
|
+
allowEnvRootKey !== undefined && "allowEnvRootKey",
|
|
231
|
+
]
|
|
232
|
+
.filter(Boolean)
|
|
233
|
+
.join(", ")
|
|
234
|
+
throw new Error(
|
|
235
|
+
`[ic-reactor] defineReactor("${name}") received both a ClientManager and \`${passed}\`. ` +
|
|
236
|
+
`That option is resolved when a ClientManager is constructed, so the supplied one already carries its own ` +
|
|
237
|
+
`decision and this would be ignored — silently changing nothing about whether the ic_env cookie is trusted. ` +
|
|
238
|
+
`Pass it where that ClientManager is created, or drop \`clientManager\` to build one here.`
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
|
|
218
242
|
const clientManager =
|
|
219
243
|
providedClientManager ??
|
|
220
244
|
providedAuthentication?.clientManager ??
|
|
221
245
|
new ClientManager({
|
|
222
246
|
queryClient: providedQueryClient ?? createDefaultQueryClient(),
|
|
223
247
|
agentOptions,
|
|
248
|
+
// Forwarded, not dropped: the type has always accepted these (it extends
|
|
249
|
+
// ClientManagerParameters) while the call ignored them, so the one
|
|
250
|
+
// documented setup path silently discarded the ic_env opt-in it advertised.
|
|
251
|
+
allowEnvConfig,
|
|
252
|
+
allowEnvRootKey,
|
|
224
253
|
})
|
|
225
254
|
|
|
226
255
|
// Always report the QueryClient actually in use: when a ClientManager is
|