@mitralab.io/platform-sdk 1.1.3 → 1.2.0-beta.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/CHANGELOG.md +17 -0
- package/README.md +22 -5
- package/dist/index.cjs +11 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +11 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -40,6 +40,23 @@ All notable changes to this project are documented in this file.
|
|
|
40
40
|
is lost beyond that one attempt, and only for redirects in flight during the upgrade.
|
|
41
41
|
- Give each provider its own popup window name.
|
|
42
42
|
- Point the deprecated `signIn` and `signUp` failures at `signInWithEmail()`.
|
|
43
|
+
- Add `mitra.emailLoginEnabled`, read from `/info` during `init()` next to `allowSignup`, so an
|
|
44
|
+
application only offers "sign in with email" when this app is inside the platform's rollout.
|
|
45
|
+
A Code Studio older than the field answers without it, and any value that is not a boolean is
|
|
46
|
+
read as `false`, so `init()` keeps working and an app that cannot prove it is enabled stops
|
|
47
|
+
offering the option.
|
|
48
|
+
|
|
49
|
+
## 1.1.2
|
|
50
|
+
|
|
51
|
+
- Move the `@mitralab.io/sdk-core` pin from `0.2.1` to `0.2.2`: same surface, published with the
|
|
52
|
+
contract corpus that consumers pin, so every SDK released that day sits on the same core.
|
|
53
|
+
|
|
54
|
+
## 1.1.1
|
|
55
|
+
|
|
56
|
+
- Depend on `@mitralab.io/sdk-core@0.2.1`, which replays `textChunk` and late deltas after an
|
|
57
|
+
interrupted turn.
|
|
58
|
+
- Serve the Agent chat from the T3 box over the direct channel when the Copilot offers it.
|
|
59
|
+
- Treat a half-open Agent session channel as a disconnect instead of a live one.
|
|
43
60
|
|
|
44
61
|
## 1.1.0-beta.2
|
|
45
62
|
|
package/README.md
CHANGED
|
@@ -30,10 +30,10 @@ await mitra.init()
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
`init()` resolves the application's public Code Studio configuration, including nullable
|
|
33
|
-
`dataSourceId` and `
|
|
34
|
-
compatibility flow; native Entities and Custom Queries resolve the current app through
|
|
35
|
-
authenticated request. Call `init()` during application startup before the compatibility
|
|
36
|
-
method needs `allowSignup`.
|
|
33
|
+
`dataSourceId`, `allowSignup`, and `emailLoginEnabled`. The Data Source value remains part of the
|
|
34
|
+
Platform 1.x compatibility flow; native Entities and Custom Queries resolve the current app through
|
|
35
|
+
the authenticated request. Call `init()` during application startup before the compatibility
|
|
36
|
+
sign-up method needs `allowSignup` or the login screen needs `emailLoginEnabled`.
|
|
37
37
|
|
|
38
38
|
## Configuration
|
|
39
39
|
|
|
@@ -169,6 +169,23 @@ the app session SSO already returns, persisted and refreshed the same way:
|
|
|
169
169
|
const user = await mitra.auth.signInWithEmail()
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
+
Not every app is in the rollout. `mitra.emailLoginEnabled` is this app's own verdict, read from
|
|
173
|
+
`/info` during `init()`, and it is what a login screen should offer the option on:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
await mitra.init()
|
|
177
|
+
|
|
178
|
+
if (mitra.emailLoginEnabled) {
|
|
179
|
+
// render "sign in with email"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
It is `false` before `init()` runs, `false` when the server answers without the field or with
|
|
184
|
+
something that is not a boolean, and `false` is the safe answer: the app is outside the rollout,
|
|
185
|
+
IAM answers a request neutrally without sending anything, and the person would wait for a message
|
|
186
|
+
that never arrives. Calling `signInWithEmail()` anyway is not blocked by the SDK; the verdict is
|
|
187
|
+
there so the application does not offer a door that does not open.
|
|
188
|
+
|
|
172
189
|
Redirect mode navigates the current page instead of opening a popup, and is completed during
|
|
173
190
|
startup like the SSO redirect:
|
|
174
191
|
|
|
@@ -392,7 +409,7 @@ await loginWithGoogleMitra()
|
|
|
392
409
|
console.log(mitra.auth.accessToken)
|
|
393
410
|
```
|
|
394
411
|
|
|
395
|
-
Google
|
|
412
|
+
Google, Microsoft and e-mail sign-in have native replacements: `mitra.auth.signInWithGoogle`, `mitra.auth.signInWithMicrosoft` and `mitra.auth.signInWithEmail`, each with its `complete...SignInRedirect` counterpart. Agent tasks, Agent credentials, public Functions, entities, custom queries, Function execution, and integrations also have native replacements. Only `loginMitra('mitra')` still has no native equivalent and remains available through the deprecated re-export surface.
|
|
396
413
|
|
|
397
414
|
`createClient` configures the legacy SDK with both `baseURL` and `authUrl` set to `${apiUrl}/legacy`, after removing trailing slashes, plus `projectId: appId`. This keeps deprecated calls and legacy login routed through the BFF while the new modules call their native APIs directly. Its `authPageUrl` uses the same precedence as native Google SSO: explicit client config, `window.__mitraEnv.authPageUrl`, then `/sdk-auth.html` on the `apiUrl` origin. Existing query parameters are preserved.
|
|
398
415
|
|
package/dist/index.cjs
CHANGED
|
@@ -2377,7 +2377,12 @@ function expectAppInfoResponse(value) {
|
|
|
2377
2377
|
}
|
|
2378
2378
|
return {
|
|
2379
2379
|
dataSourceId: response.dataSourceId,
|
|
2380
|
-
allowSignup: response.allowSignup
|
|
2380
|
+
allowSignup: response.allowSignup,
|
|
2381
|
+
// Unlike the fields above, a missing or non-boolean value is read as `false`
|
|
2382
|
+
// instead of failing `init()`: a Code Studio older than the email login gate
|
|
2383
|
+
// answers without this field, and an app that cannot prove it is enabled
|
|
2384
|
+
// should stop offering the option, not stop starting.
|
|
2385
|
+
emailLoginEnabled: response.emailLoginEnabled === true
|
|
2381
2386
|
};
|
|
2382
2387
|
}
|
|
2383
2388
|
function createClient(config) {
|
|
@@ -2445,6 +2450,7 @@ function createClient(config) {
|
|
|
2445
2450
|
legacyBridge.connect();
|
|
2446
2451
|
let initialized = false;
|
|
2447
2452
|
let allowSignup = true;
|
|
2453
|
+
let emailLoginEnabled = false;
|
|
2448
2454
|
async function init() {
|
|
2449
2455
|
if (initialized) return;
|
|
2450
2456
|
const publicClient = new HttpClient({
|
|
@@ -2460,6 +2466,7 @@ function createClient(config) {
|
|
|
2460
2466
|
entitiesModule.setDataSourceId(appInfo.dataSourceId);
|
|
2461
2467
|
}
|
|
2462
2468
|
allowSignup = appInfo.allowSignup;
|
|
2469
|
+
emailLoginEnabled = appInfo.emailLoginEnabled;
|
|
2463
2470
|
initialized = true;
|
|
2464
2471
|
}
|
|
2465
2472
|
return {
|
|
@@ -2475,6 +2482,9 @@ function createClient(config) {
|
|
|
2475
2482
|
get allowSignup() {
|
|
2476
2483
|
return allowSignup;
|
|
2477
2484
|
},
|
|
2485
|
+
get emailLoginEnabled() {
|
|
2486
|
+
return emailLoginEnabled;
|
|
2487
|
+
},
|
|
2478
2488
|
config
|
|
2479
2489
|
};
|
|
2480
2490
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -741,7 +741,8 @@ interface MitraClient {
|
|
|
741
741
|
/**
|
|
742
742
|
* Initializes the client by resolving app config from the server.
|
|
743
743
|
*
|
|
744
|
-
* Fetches the compatibility dataSourceId
|
|
744
|
+
* Fetches the compatibility dataSourceId, allowSignup, and emailLoginEnabled
|
|
745
|
+
* from the public app info endpoint.
|
|
745
746
|
*
|
|
746
747
|
* Safe to call multiple times. Subsequent calls are no-ops.
|
|
747
748
|
*
|
|
@@ -827,6 +828,13 @@ interface MitraClient {
|
|
|
827
828
|
* Defaults to `true` before `init()` is called.
|
|
828
829
|
*/
|
|
829
830
|
readonly allowSignup: boolean;
|
|
831
|
+
/**
|
|
832
|
+
* Whether this app offers sign-in by email, so the application can hide the
|
|
833
|
+
* option instead of sending people to a request IAM would answer neutrally.
|
|
834
|
+
* Defaults to `false` before `init()` is called, and stays `false` when the
|
|
835
|
+
* server does not answer the field.
|
|
836
|
+
*/
|
|
837
|
+
readonly emailLoginEnabled: boolean;
|
|
830
838
|
/**
|
|
831
839
|
* The configuration used to create this client.
|
|
832
840
|
*/
|
|
@@ -842,8 +850,8 @@ interface MitraClient {
|
|
|
842
850
|
* - **integration**: Proxy HTTP requests to external APIs
|
|
843
851
|
* - **queries**: Custom query management and execution
|
|
844
852
|
*
|
|
845
|
-
* After creating the client, call `init()` to resolve the app's
|
|
846
|
-
* (dataSourceId, allowSignup) automatically from the server.
|
|
853
|
+
* After creating the client, call `init()` to resolve the app's public config
|
|
854
|
+
* (dataSourceId, allowSignup, emailLoginEnabled) automatically from the server.
|
|
847
855
|
*
|
|
848
856
|
* @param config - Configuration options for the client.
|
|
849
857
|
* @returns A configured MitraClient instance.
|
|
@@ -895,8 +903,10 @@ declare function createClient(config: MitraClientConfig): MitraClient;
|
|
|
895
903
|
*/
|
|
896
904
|
|
|
897
905
|
/**
|
|
898
|
-
* @deprecated Use `mitra.auth.signInWithGoogle()` when `method` is
|
|
899
|
-
*
|
|
906
|
+
* @deprecated Use `mitra.auth.signInWithGoogle()` when `method` is `google`,
|
|
907
|
+
* `mitra.auth.signInWithMicrosoft()` when it is `microsoft`, and
|
|
908
|
+
* `mitra.auth.signInWithEmail()` when it is `email`. Only `mitra` has no native
|
|
909
|
+
* equivalent yet and remains supported through this surface.
|
|
900
910
|
*/
|
|
901
911
|
declare const loginMitra: typeof loginMitra$1;
|
|
902
912
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -741,7 +741,8 @@ interface MitraClient {
|
|
|
741
741
|
/**
|
|
742
742
|
* Initializes the client by resolving app config from the server.
|
|
743
743
|
*
|
|
744
|
-
* Fetches the compatibility dataSourceId
|
|
744
|
+
* Fetches the compatibility dataSourceId, allowSignup, and emailLoginEnabled
|
|
745
|
+
* from the public app info endpoint.
|
|
745
746
|
*
|
|
746
747
|
* Safe to call multiple times. Subsequent calls are no-ops.
|
|
747
748
|
*
|
|
@@ -827,6 +828,13 @@ interface MitraClient {
|
|
|
827
828
|
* Defaults to `true` before `init()` is called.
|
|
828
829
|
*/
|
|
829
830
|
readonly allowSignup: boolean;
|
|
831
|
+
/**
|
|
832
|
+
* Whether this app offers sign-in by email, so the application can hide the
|
|
833
|
+
* option instead of sending people to a request IAM would answer neutrally.
|
|
834
|
+
* Defaults to `false` before `init()` is called, and stays `false` when the
|
|
835
|
+
* server does not answer the field.
|
|
836
|
+
*/
|
|
837
|
+
readonly emailLoginEnabled: boolean;
|
|
830
838
|
/**
|
|
831
839
|
* The configuration used to create this client.
|
|
832
840
|
*/
|
|
@@ -842,8 +850,8 @@ interface MitraClient {
|
|
|
842
850
|
* - **integration**: Proxy HTTP requests to external APIs
|
|
843
851
|
* - **queries**: Custom query management and execution
|
|
844
852
|
*
|
|
845
|
-
* After creating the client, call `init()` to resolve the app's
|
|
846
|
-
* (dataSourceId, allowSignup) automatically from the server.
|
|
853
|
+
* After creating the client, call `init()` to resolve the app's public config
|
|
854
|
+
* (dataSourceId, allowSignup, emailLoginEnabled) automatically from the server.
|
|
847
855
|
*
|
|
848
856
|
* @param config - Configuration options for the client.
|
|
849
857
|
* @returns A configured MitraClient instance.
|
|
@@ -895,8 +903,10 @@ declare function createClient(config: MitraClientConfig): MitraClient;
|
|
|
895
903
|
*/
|
|
896
904
|
|
|
897
905
|
/**
|
|
898
|
-
* @deprecated Use `mitra.auth.signInWithGoogle()` when `method` is
|
|
899
|
-
*
|
|
906
|
+
* @deprecated Use `mitra.auth.signInWithGoogle()` when `method` is `google`,
|
|
907
|
+
* `mitra.auth.signInWithMicrosoft()` when it is `microsoft`, and
|
|
908
|
+
* `mitra.auth.signInWithEmail()` when it is `email`. Only `mitra` has no native
|
|
909
|
+
* equivalent yet and remains supported through this surface.
|
|
900
910
|
*/
|
|
901
911
|
declare const loginMitra: typeof loginMitra$1;
|
|
902
912
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2342,7 +2342,12 @@ function expectAppInfoResponse(value) {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
return {
|
|
2344
2344
|
dataSourceId: response.dataSourceId,
|
|
2345
|
-
allowSignup: response.allowSignup
|
|
2345
|
+
allowSignup: response.allowSignup,
|
|
2346
|
+
// Unlike the fields above, a missing or non-boolean value is read as `false`
|
|
2347
|
+
// instead of failing `init()`: a Code Studio older than the email login gate
|
|
2348
|
+
// answers without this field, and an app that cannot prove it is enabled
|
|
2349
|
+
// should stop offering the option, not stop starting.
|
|
2350
|
+
emailLoginEnabled: response.emailLoginEnabled === true
|
|
2346
2351
|
};
|
|
2347
2352
|
}
|
|
2348
2353
|
function createClient(config) {
|
|
@@ -2410,6 +2415,7 @@ function createClient(config) {
|
|
|
2410
2415
|
legacyBridge.connect();
|
|
2411
2416
|
let initialized = false;
|
|
2412
2417
|
let allowSignup = true;
|
|
2418
|
+
let emailLoginEnabled = false;
|
|
2413
2419
|
async function init() {
|
|
2414
2420
|
if (initialized) return;
|
|
2415
2421
|
const publicClient = new HttpClient({
|
|
@@ -2425,6 +2431,7 @@ function createClient(config) {
|
|
|
2425
2431
|
entitiesModule.setDataSourceId(appInfo.dataSourceId);
|
|
2426
2432
|
}
|
|
2427
2433
|
allowSignup = appInfo.allowSignup;
|
|
2434
|
+
emailLoginEnabled = appInfo.emailLoginEnabled;
|
|
2428
2435
|
initialized = true;
|
|
2429
2436
|
}
|
|
2430
2437
|
return {
|
|
@@ -2440,6 +2447,9 @@ function createClient(config) {
|
|
|
2440
2447
|
get allowSignup() {
|
|
2441
2448
|
return allowSignup;
|
|
2442
2449
|
},
|
|
2450
|
+
get emailLoginEnabled() {
|
|
2451
|
+
return emailLoginEnabled;
|
|
2452
|
+
},
|
|
2443
2453
|
config
|
|
2444
2454
|
};
|
|
2445
2455
|
}
|