@structured-id/ui-core 3.0.0 → 3.1.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@structured-id/ui-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
|
43
43
|
"@protobuf-ts/runtime": "^2.11.1",
|
|
44
44
|
"@protobuf-ts/runtime-rpc": "^2.11.1",
|
|
45
|
-
"@structured-id/proto": "^0.
|
|
45
|
+
"@structured-id/proto": "^0.3.0",
|
|
46
46
|
"libphonenumber-js": "^1.13.15"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -280,9 +280,9 @@ const props = withDefaults(
|
|
|
280
280
|
/** Pre-filled invite code (e.g. from URL) */
|
|
281
281
|
initialInviteCode?: string;
|
|
282
282
|
/**
|
|
283
|
-
* The installation
|
|
284
|
-
* then asks for the claim token and the new account becomes
|
|
285
|
-
* the invite code is not asked for.
|
|
283
|
+
* The installation's local claim is open (GetInstanceStatus `OPEN`). The
|
|
284
|
+
* form then asks for the claim token and the new account becomes
|
|
285
|
+
* administrator; the invite code is not asked for.
|
|
286
286
|
*/
|
|
287
287
|
claimRequired?: boolean;
|
|
288
288
|
/** Claim token input label */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
|
-
import { getInstanceStatus } from "./useEnrollmentApi";
|
|
2
|
+
import { AdministratorClaim, getInstanceStatus } from "./useEnrollmentApi";
|
|
3
3
|
|
|
4
4
|
const mockGetInstanceStatus = vi.fn();
|
|
5
5
|
|
|
@@ -22,12 +22,14 @@ describe("getInstanceStatus", () => {
|
|
|
22
22
|
// The registration page asks before anyone signs in, so the call must
|
|
23
23
|
// carry no credentials and return the server's answer as is.
|
|
24
24
|
it("asks without credentials and returns the status", async () => {
|
|
25
|
-
mockGetInstanceStatus.mockResolvedValue({
|
|
25
|
+
mockGetInstanceStatus.mockResolvedValue({
|
|
26
|
+
response: { claim: AdministratorClaim.OPEN },
|
|
27
|
+
});
|
|
26
28
|
|
|
27
29
|
const status = await getInstanceStatus();
|
|
28
30
|
|
|
29
31
|
expect(mockGetInstanceStatus).toHaveBeenCalledWith({});
|
|
30
|
-
expect(status).toEqual({
|
|
32
|
+
expect(status).toEqual({ claim: AdministratorClaim.OPEN });
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
it("propagates gRPC errors", async () => {
|
|
@@ -6,17 +6,22 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { getTransport } from "../../index";
|
|
8
8
|
import { EnrollmentServiceClient } from "@structured-id/proto/sid/v1/admin/enrollment.client";
|
|
9
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
AdministratorClaim,
|
|
11
|
+
type InstanceStatus,
|
|
12
|
+
} from "@structured-id/proto/sid/v1/admin/enrollment";
|
|
10
13
|
|
|
11
14
|
function client(): EnrollmentServiceClient {
|
|
12
15
|
return new EnrollmentServiceClient(getTransport());
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
export { AdministratorClaim };
|
|
15
19
|
export type { InstanceStatus };
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
|
-
*
|
|
19
|
-
* registration accepts only the claim token from the service log
|
|
22
|
+
* The installation's local administrator claim (`claim`). While it is
|
|
23
|
+
* `OPEN`, registration accepts only the claim token from the service log; a
|
|
24
|
+
* centrally managed installation reports `UNAVAILABLE` and takes no token.
|
|
20
25
|
*/
|
|
21
26
|
export async function getInstanceStatus(): Promise<InstanceStatus> {
|
|
22
27
|
const { response } = await client().getInstanceStatus({});
|