@fireproof/core-protocols-dashboard 0.23.15 → 0.24.2-dev-cloud-api
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/dashboard-api.d.ts +32 -0
- package/dashboard-api.js +92 -0
- package/dashboard-api.js.map +1 -0
- package/index.d.ts +26 -0
- package/index.js +21 -0
- package/index.js.map +1 -1
- package/msg-is.d.ts +3 -1
- package/msg-is.js +3 -0
- package/msg-is.js.map +1 -1
- package/msg-types.d.ts +56 -25
- package/msg-types.js.map +1 -1
- package/package.json +8 -6
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Result } from "@adviser/cement";
|
|
2
|
+
import { DashAuthType, ReqEnsureUser, ResEnsureUser, ReqFindUser, ResFindUser, ReqCreateTenant, ResCreateTenant, ReqUpdateTenant, ResUpdateTenant, ReqDeleteTenant, ResDeleteTenant, ReqRedeemInvite, ResRedeemInvite, ReqListTenantsByUser, ResListTenantsByUser, ReqInviteUser, ResInviteUser, ReqListInvites, ResListInvites, ReqDeleteInvite, ResDeleteInvite, ReqUpdateUserTenant, ResUpdateUserTenant, ReqCreateLedger, ResCreateLedger, ReqUpdateLedger, ResUpdateLedger, ReqDeleteLedger, ResDeleteLedger, ReqListLedgersByUser, ResListLedgersByUser, ReqCloudSessionToken, ResCloudSessionToken, ReqCertFromCsr, ResCertFromCsr } from "./msg-types.js";
|
|
3
|
+
import { Falsy } from "@fireproof/core-types-base";
|
|
4
|
+
export type WithoutTypeAndAuth<T> = Omit<T, "type" | "auth">;
|
|
5
|
+
export interface DashboardApiConfig {
|
|
6
|
+
readonly apiUrl: string;
|
|
7
|
+
getToken(): Promise<DashAuthType | Falsy>;
|
|
8
|
+
fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
9
|
+
}
|
|
10
|
+
export declare class DashboardApi {
|
|
11
|
+
private readonly cfg;
|
|
12
|
+
constructor(cfg: DashboardApiConfig);
|
|
13
|
+
private getAuth;
|
|
14
|
+
private request;
|
|
15
|
+
ensureUser(req: WithoutTypeAndAuth<ReqEnsureUser>): Promise<Result<ResEnsureUser>>;
|
|
16
|
+
findUser(req: WithoutTypeAndAuth<ReqFindUser>): Promise<Result<ResFindUser>>;
|
|
17
|
+
createTenant(req: WithoutTypeAndAuth<ReqCreateTenant>): Promise<Result<ResCreateTenant>>;
|
|
18
|
+
updateTenant(req: WithoutTypeAndAuth<ReqUpdateTenant>): Promise<Result<ResUpdateTenant>>;
|
|
19
|
+
deleteTenant(req: WithoutTypeAndAuth<ReqDeleteTenant>): Promise<Result<ResDeleteTenant>>;
|
|
20
|
+
connectUserToTenant(req: WithoutTypeAndAuth<ReqRedeemInvite>): Promise<Result<ResRedeemInvite>>;
|
|
21
|
+
listTenantsByUser(req: WithoutTypeAndAuth<ReqListTenantsByUser>): Promise<Result<ResListTenantsByUser>>;
|
|
22
|
+
inviteUser(req: WithoutTypeAndAuth<ReqInviteUser>): Promise<Result<ResInviteUser>>;
|
|
23
|
+
listInvites(req: WithoutTypeAndAuth<ReqListInvites>): Promise<Result<ResListInvites>>;
|
|
24
|
+
deleteInvite(req: WithoutTypeAndAuth<ReqDeleteInvite>): Promise<Result<ResDeleteInvite>>;
|
|
25
|
+
updateUserTenant(req: WithoutTypeAndAuth<ReqUpdateUserTenant>): Promise<Result<ResUpdateUserTenant>>;
|
|
26
|
+
createLedger(req: WithoutTypeAndAuth<ReqCreateLedger>): Promise<Result<ResCreateLedger>>;
|
|
27
|
+
updateLedger(req: WithoutTypeAndAuth<ReqUpdateLedger>): Promise<Result<ResUpdateLedger>>;
|
|
28
|
+
deleteLedger(req: WithoutTypeAndAuth<ReqDeleteLedger>): Promise<Result<ResDeleteLedger>>;
|
|
29
|
+
listLedgersByUser(req: WithoutTypeAndAuth<ReqListLedgersByUser>): Promise<Result<ResListLedgersByUser>>;
|
|
30
|
+
getCloudSessionToken(req: WithoutTypeAndAuth<ReqCloudSessionToken>): Promise<Result<ResCloudSessionToken>>;
|
|
31
|
+
getCertFromCsr(req: WithoutTypeAndAuth<ReqCertFromCsr>): Promise<Result<ResCertFromCsr>>;
|
|
32
|
+
}
|
package/dashboard-api.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { exception2Result, Result } from "@adviser/cement";
|
|
2
|
+
export class DashboardApi {
|
|
3
|
+
cfg;
|
|
4
|
+
constructor(cfg) {
|
|
5
|
+
this.cfg = cfg;
|
|
6
|
+
}
|
|
7
|
+
async getAuth() {
|
|
8
|
+
return exception2Result(() => {
|
|
9
|
+
return this.cfg.getToken()?.then((token) => {
|
|
10
|
+
if (!token)
|
|
11
|
+
throw new Error("No token available");
|
|
12
|
+
return token;
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async request(req) {
|
|
17
|
+
const rAuth = await this.getAuth();
|
|
18
|
+
if (rAuth.isErr()) {
|
|
19
|
+
return Result.Err(rAuth.Err());
|
|
20
|
+
}
|
|
21
|
+
const reqBody = JSON.stringify({
|
|
22
|
+
...req,
|
|
23
|
+
auth: rAuth.Ok(),
|
|
24
|
+
});
|
|
25
|
+
const res = await this.cfg.fetch(this.cfg.apiUrl, {
|
|
26
|
+
method: "PUT",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
Accept: "application/json",
|
|
30
|
+
},
|
|
31
|
+
body: reqBody,
|
|
32
|
+
});
|
|
33
|
+
if (res.ok) {
|
|
34
|
+
const jso = await res.json();
|
|
35
|
+
return Result.Ok(jso);
|
|
36
|
+
}
|
|
37
|
+
const body = await res.text();
|
|
38
|
+
return Result.Err(`HTTP: ${res.status} ${res.statusText}: ${body}`);
|
|
39
|
+
}
|
|
40
|
+
ensureUser(req) {
|
|
41
|
+
return this.request({ ...req, type: "reqEnsureUser" });
|
|
42
|
+
}
|
|
43
|
+
findUser(req) {
|
|
44
|
+
return this.request({ ...req, type: "reqFindUser" });
|
|
45
|
+
}
|
|
46
|
+
createTenant(req) {
|
|
47
|
+
return this.request({ ...req, type: "reqCreateTenant" });
|
|
48
|
+
}
|
|
49
|
+
updateTenant(req) {
|
|
50
|
+
return this.request({ ...req, type: "reqUpdateTenant" });
|
|
51
|
+
}
|
|
52
|
+
deleteTenant(req) {
|
|
53
|
+
return this.request({ ...req, type: "reqDeleteTenant" });
|
|
54
|
+
}
|
|
55
|
+
connectUserToTenant(req) {
|
|
56
|
+
return this.request({ ...req, type: "reqRedeemInvite" });
|
|
57
|
+
}
|
|
58
|
+
listTenantsByUser(req) {
|
|
59
|
+
return this.request({ ...req, type: "reqListTenantsByUser" });
|
|
60
|
+
}
|
|
61
|
+
inviteUser(req) {
|
|
62
|
+
return this.request({ ...req, type: "reqInviteUser" });
|
|
63
|
+
}
|
|
64
|
+
listInvites(req) {
|
|
65
|
+
return this.request({ ...req, type: "reqListInvites" });
|
|
66
|
+
}
|
|
67
|
+
deleteInvite(req) {
|
|
68
|
+
return this.request({ ...req, type: "reqDeleteInvite" });
|
|
69
|
+
}
|
|
70
|
+
updateUserTenant(req) {
|
|
71
|
+
return this.request({ ...req, type: "reqUpdateUserTenant" });
|
|
72
|
+
}
|
|
73
|
+
createLedger(req) {
|
|
74
|
+
return this.request({ ...req, type: "reqCreateLedger" });
|
|
75
|
+
}
|
|
76
|
+
updateLedger(req) {
|
|
77
|
+
return this.request({ ...req, type: "reqUpdateLedger" });
|
|
78
|
+
}
|
|
79
|
+
deleteLedger(req) {
|
|
80
|
+
return this.request({ ...req, type: "reqDeleteLedger" });
|
|
81
|
+
}
|
|
82
|
+
listLedgersByUser(req) {
|
|
83
|
+
return this.request({ ...req, type: "reqListLedgersByUser" });
|
|
84
|
+
}
|
|
85
|
+
getCloudSessionToken(req) {
|
|
86
|
+
return this.request({ ...req, type: "reqCloudSessionToken" });
|
|
87
|
+
}
|
|
88
|
+
getCertFromCsr(req) {
|
|
89
|
+
return this.request({ ...req, type: "reqCertFromCsr" });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# source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OAAO,CAA6C,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAAA,CAC3G;IACD,oBAAoB,CAAC,GAA6C,EAAyC;QACzG,OAAO,IAAI,CAAC,OAAO,CAA6C,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAAA,CAC3G;IACD,cAAc,CAAC,GAAuC,EAAmC;QACvF,OAAO,IAAI,CAAC,OAAO,CAAiC,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAAA,CACzF;CACF"}
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
export * from "./msg-types.js";
|
|
2
3
|
export * from "./msg-is.js";
|
|
3
4
|
export * from "./msg-api.js";
|
|
5
|
+
export * from "./dashboard-api.js";
|
|
6
|
+
export declare const FPClerkClaimSchema: z.ZodReadonly<z.ZodObject<{
|
|
7
|
+
azp: z.ZodOptional<z.ZodString>;
|
|
8
|
+
iss: z.ZodOptional<z.ZodString>;
|
|
9
|
+
aud: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
10
|
+
exp: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
nbf: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
iat: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
jti: z.ZodOptional<z.ZodString>;
|
|
14
|
+
app_metadata: z.ZodUnknown;
|
|
15
|
+
role: z.ZodString;
|
|
16
|
+
userId: z.ZodString;
|
|
17
|
+
sub: z.ZodString;
|
|
18
|
+
params: z.ZodObject<{
|
|
19
|
+
last: z.ZodOptional<z.ZodString>;
|
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
|
21
|
+
email: z.ZodOptional<z.ZodString>;
|
|
22
|
+
first: z.ZodOptional<z.ZodString>;
|
|
23
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
24
|
+
external_id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
25
|
+
public_meta: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
|
|
26
|
+
email_verified: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
export type FPClerkClaim = z.infer<typeof FPClerkClaimSchema>;
|
package/index.js
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
|
+
import { JWTPayloadSchema } from "@fireproof/core-types-base";
|
|
2
|
+
import { z } from "zod";
|
|
1
3
|
export * from "./msg-types.js";
|
|
2
4
|
export * from "./msg-is.js";
|
|
3
5
|
export * from "./msg-api.js";
|
|
6
|
+
export * from "./dashboard-api.js";
|
|
7
|
+
export const FPClerkClaimSchema = JWTPayloadSchema.extend({
|
|
8
|
+
app_metadata: z.unknown(),
|
|
9
|
+
role: z.string(),
|
|
10
|
+
userId: z.string(),
|
|
11
|
+
sub: z.string(),
|
|
12
|
+
params: z
|
|
13
|
+
.object({
|
|
14
|
+
last: z.string(),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
email: z.string(),
|
|
17
|
+
first: z.string(),
|
|
18
|
+
image_url: z.string(),
|
|
19
|
+
external_id: z.string().nullable().optional(),
|
|
20
|
+
public_meta: z.any().optional(),
|
|
21
|
+
email_verified: z.boolean().optional(),
|
|
22
|
+
})
|
|
23
|
+
.partial(),
|
|
24
|
+
}).readonly();
|
|
4
25
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AAEnC,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACxD,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC7C,WAAW,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QAC/B,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACvC,CAAC;SACD,OAAO,EAAE;CACb,CAAC,CAAC,QAAQ,EAAE,CAAC"}
|
package/msg-is.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReqDeleteTenant, ReqUpdateTenant, ReqCreateTenant, ReqDeleteInvite, ReqListInvites, ReqInviteUser, ReqFindUser, ReqRedeemInvite, ReqEnsureUser, ReqListTenantsByUser, ReqUpdateUserTenant, ReqCloudSessionToken, ReqTokenByResultId, ReqListLedgersByUser, ReqCreateLedger, ReqUpdateLedger, ReqDeleteLedger, ResTokenByResultId, ReqExtendToken } from "./msg-types.js";
|
|
1
|
+
import { ReqDeleteTenant, ReqUpdateTenant, ReqCreateTenant, ReqDeleteInvite, ReqListInvites, ReqInviteUser, ReqFindUser, ReqRedeemInvite, ReqEnsureUser, ReqListTenantsByUser, ReqUpdateUserTenant, ReqCloudSessionToken, ReqTokenByResultId, ReqListLedgersByUser, ReqCreateLedger, ReqUpdateLedger, ReqDeleteLedger, ResTokenByResultId, ReqExtendToken, ReqCertFromCsr } from "./msg-types.js";
|
|
2
2
|
interface FPApiMsgInterface {
|
|
3
3
|
isDeleteTenant(jso: unknown): jso is ReqDeleteTenant;
|
|
4
4
|
isUpdateTenant(jso: unknown): jso is ReqUpdateTenant;
|
|
@@ -19,6 +19,7 @@ interface FPApiMsgInterface {
|
|
|
19
19
|
isUpdateLedger(jso: unknown): jso is ReqUpdateLedger;
|
|
20
20
|
isDeleteLedger(jso: unknown): jso is ReqDeleteLedger;
|
|
21
21
|
isReqExtendToken(jso: unknown): jso is ReqExtendToken;
|
|
22
|
+
isReqCertFromCsr(jso: unknown): jso is ReqCertFromCsr;
|
|
22
23
|
}
|
|
23
24
|
export declare class FAPIMsgImpl implements FPApiMsgInterface {
|
|
24
25
|
isDeleteTenant(jso: unknown): jso is ReqDeleteTenant;
|
|
@@ -40,5 +41,6 @@ export declare class FAPIMsgImpl implements FPApiMsgInterface {
|
|
|
40
41
|
isReqTokenByResultId(jso: unknown): jso is ReqTokenByResultId;
|
|
41
42
|
isResTokenByResultId(jso: unknown): jso is ResTokenByResultId;
|
|
42
43
|
isReqExtendToken(jso: unknown): jso is ReqExtendToken;
|
|
44
|
+
isReqCertFromCsr(jso: unknown): jso is ReqCertFromCsr;
|
|
43
45
|
}
|
|
44
46
|
export {};
|
package/msg-is.js
CHANGED
package/msg-is.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msg-is.js","sourceRoot":"","sources":["../jsr/msg-is.ts"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G,EAAE,sBAAsB,CAAC,CAAC;IAAA,CAC7C;IACD,kBAAkB,CAAC,GAAY,EAA8B;QAC3D,OAAO,OAAO,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;IAAA,CAC5C;IACD,mBAAmB,CAAC,GAAY,EAA+B;QAC7D,OAAO,OAAO,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IAAA,CAC7C;IACD,cAAc,CAAC,GAAY,EAA0B;QACnD,OAAO,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAAA,CACxC;IACD,cAAc,CAAC,GAAY,EAA0B;QACnD,OAAO,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAAA,CACxC;IACD,cAAc,CAAC,GAAY,EAA0B;QACnD,OAAO,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAAA,CACxC;IACD,mBAAmB,CAAC,GAAY,EAA+B;QAC7D,OAAO,OAAO,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IAAA,CAC7C;IACD,oBAAoB,CAAC,GAAY,EAA6B;QAC5D,OAAO,OAAO,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAAA,CAC3C;IACD,oBAAoB,CAAC,GAAY,EAA6B;QAC5D,OAAO,OAAO,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAAA,CAC3C;IACD,gBAAgB,CAAC,GAAY,EAAyB;QACpD,OAAO,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAAA,CACvC;IACD,gBAAgB,CAAC,GAAY,EAAyB;QACpD,OAAO,OAAO,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAAA,CACvC;CACF"}
|
package/msg-types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { JWKPublic } from "@fireproof/core-types-base";
|
|
1
2
|
import { ReadWrite, Role, TenantLedger } from "@fireproof/core-types-protocols-cloud";
|
|
3
|
+
import type { DeviceIdCA } from "@fireproof/core-device-id";
|
|
2
4
|
export type AuthProvider = "github" | "google" | "fp" | "invite-per-email";
|
|
3
5
|
export interface Queryable {
|
|
4
6
|
readonly userId?: string;
|
|
@@ -57,12 +59,12 @@ export interface InviteTicket {
|
|
|
57
59
|
readonly updatedAt: Date;
|
|
58
60
|
}
|
|
59
61
|
export type UserStatus = "active" | "inactive" | "banned" | "invited";
|
|
60
|
-
export interface
|
|
61
|
-
readonly type: "ucan" | "clerk" | "better";
|
|
62
|
+
export interface DashAuthType {
|
|
63
|
+
readonly type: "ucan" | "clerk" | "better" | "device-id";
|
|
62
64
|
readonly token: string;
|
|
63
65
|
}
|
|
64
66
|
export interface VerifiedAuth {
|
|
65
|
-
readonly type: "clerk" | "better";
|
|
67
|
+
readonly type: "clerk" | "better" | "device-id";
|
|
66
68
|
readonly token: string;
|
|
67
69
|
readonly userId: string;
|
|
68
70
|
readonly provider: string;
|
|
@@ -103,16 +105,24 @@ export interface ResCreateTenant {
|
|
|
103
105
|
readonly type: "resCreateTenant";
|
|
104
106
|
readonly tenant: OutTenantParams;
|
|
105
107
|
}
|
|
108
|
+
export interface FPApiParameters {
|
|
109
|
+
readonly cloudPublicKeys: JWKPublic[];
|
|
110
|
+
readonly clerkPublishableKey: string;
|
|
111
|
+
readonly maxTenants: number;
|
|
112
|
+
readonly maxAdminUsers: number;
|
|
113
|
+
readonly maxMemberUsers: number;
|
|
114
|
+
readonly maxInvites: number;
|
|
115
|
+
readonly maxLedgers: number;
|
|
116
|
+
readonly deviceCA: DeviceIdCA;
|
|
117
|
+
}
|
|
106
118
|
export interface InCreateTenantParams {
|
|
107
119
|
readonly name?: string;
|
|
108
120
|
readonly ownerUserId: string;
|
|
109
|
-
readonly
|
|
110
|
-
readonly maxMemberUsers?: number;
|
|
111
|
-
readonly maxInvites?: number;
|
|
121
|
+
readonly defaultTenant?: boolean;
|
|
112
122
|
}
|
|
113
123
|
export interface ReqCreateTenant {
|
|
114
124
|
readonly type: "reqCreateTenant";
|
|
115
|
-
readonly auth:
|
|
125
|
+
readonly auth: DashAuthType;
|
|
116
126
|
readonly tenant: Omit<InCreateTenantParams, "ownerUserId">;
|
|
117
127
|
}
|
|
118
128
|
export interface InUpdateTenantParams {
|
|
@@ -128,7 +138,7 @@ export interface ResUpdateTenant {
|
|
|
128
138
|
}
|
|
129
139
|
export interface ReqUpdateTenant {
|
|
130
140
|
readonly type: "reqUpdateTenant";
|
|
131
|
-
readonly auth:
|
|
141
|
+
readonly auth: DashAuthType;
|
|
132
142
|
readonly tenant: InUpdateTenantParams;
|
|
133
143
|
}
|
|
134
144
|
export interface ResEnsureTenant {
|
|
@@ -137,7 +147,7 @@ export interface ResEnsureTenant {
|
|
|
137
147
|
}
|
|
138
148
|
export interface ReqRedeemInvite {
|
|
139
149
|
readonly type: "reqRedeemInvite";
|
|
140
|
-
readonly auth:
|
|
150
|
+
readonly auth: DashAuthType;
|
|
141
151
|
}
|
|
142
152
|
export interface ResRedeemInvite {
|
|
143
153
|
readonly type: "resRedeemInvite";
|
|
@@ -145,7 +155,7 @@ export interface ResRedeemInvite {
|
|
|
145
155
|
}
|
|
146
156
|
export interface ReqListLedgersByUser {
|
|
147
157
|
readonly type: "reqListLedgersByUser";
|
|
148
|
-
readonly auth:
|
|
158
|
+
readonly auth: DashAuthType;
|
|
149
159
|
readonly tenantIds?: string[];
|
|
150
160
|
}
|
|
151
161
|
interface LedgerUserRight {
|
|
@@ -174,7 +184,7 @@ export interface ResListLedgersByUser {
|
|
|
174
184
|
}
|
|
175
185
|
export interface ReqListTenantsByUser {
|
|
176
186
|
readonly type: "reqListTenantsByUser";
|
|
177
|
-
readonly auth:
|
|
187
|
+
readonly auth: DashAuthType;
|
|
178
188
|
}
|
|
179
189
|
export interface UserTenantCommon {
|
|
180
190
|
readonly name?: string;
|
|
@@ -183,12 +193,24 @@ export interface UserTenantCommon {
|
|
|
183
193
|
readonly createdAt: Date;
|
|
184
194
|
readonly updatedAt: Date;
|
|
185
195
|
}
|
|
196
|
+
export interface TenantLimits {
|
|
197
|
+
readonly maxAdminUsers: number;
|
|
198
|
+
readonly maxMemberUsers: number;
|
|
199
|
+
readonly maxInvites: number;
|
|
200
|
+
readonly maxLedgers: number;
|
|
201
|
+
}
|
|
186
202
|
export interface UserTenant {
|
|
187
203
|
readonly tenantId: string;
|
|
188
204
|
readonly role: Role;
|
|
189
205
|
readonly default: boolean;
|
|
190
|
-
readonly user: UserTenantCommon
|
|
191
|
-
|
|
206
|
+
readonly user: UserTenantCommon & {
|
|
207
|
+
readonly limits: {
|
|
208
|
+
readonly maxTenants: number;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
readonly tenant: UserTenantCommon & {
|
|
212
|
+
readonly limits: TenantLimits;
|
|
213
|
+
};
|
|
192
214
|
}
|
|
193
215
|
export declare function isAdmin(ut: UserTenant): boolean;
|
|
194
216
|
export interface AdminTenant extends UserTenant {
|
|
@@ -202,11 +224,11 @@ export interface ResListTenantsByUser {
|
|
|
202
224
|
readonly type: "resListTenantsByUser";
|
|
203
225
|
readonly userId: string;
|
|
204
226
|
readonly authUserId: string;
|
|
205
|
-
readonly tenants: UserTenant[];
|
|
227
|
+
readonly tenants: (AdminTenant | UserTenant)[];
|
|
206
228
|
}
|
|
207
229
|
export interface ReqFindUser {
|
|
208
230
|
readonly type: "reqFindUser";
|
|
209
|
-
readonly auth:
|
|
231
|
+
readonly auth: DashAuthType;
|
|
210
232
|
readonly query: QueryUser;
|
|
211
233
|
}
|
|
212
234
|
export interface ResFindUser {
|
|
@@ -222,7 +244,7 @@ export interface QueryInviteTicket {
|
|
|
222
244
|
}
|
|
223
245
|
export interface ReqInviteUser {
|
|
224
246
|
readonly type: "reqInviteUser";
|
|
225
|
-
readonly auth:
|
|
247
|
+
readonly auth: DashAuthType;
|
|
226
248
|
readonly ticket: QueryInviteTicket;
|
|
227
249
|
}
|
|
228
250
|
export interface ResInviteUser {
|
|
@@ -231,7 +253,7 @@ export interface ResInviteUser {
|
|
|
231
253
|
}
|
|
232
254
|
export interface ReqDeleteInvite {
|
|
233
255
|
readonly type: "reqDeleteInvite";
|
|
234
|
-
readonly auth:
|
|
256
|
+
readonly auth: DashAuthType;
|
|
235
257
|
readonly inviteId: string;
|
|
236
258
|
}
|
|
237
259
|
export interface ResDeleteInvite {
|
|
@@ -240,7 +262,7 @@ export interface ResDeleteInvite {
|
|
|
240
262
|
}
|
|
241
263
|
export interface ReqListInvites {
|
|
242
264
|
readonly type: "reqListInvites";
|
|
243
|
-
readonly auth:
|
|
265
|
+
readonly auth: DashAuthType;
|
|
244
266
|
readonly tenantIds?: string[];
|
|
245
267
|
readonly ledgerIds?: string[];
|
|
246
268
|
}
|
|
@@ -250,7 +272,7 @@ export interface ResListInvites {
|
|
|
250
272
|
}
|
|
251
273
|
export interface ReqUpdateUserTenant {
|
|
252
274
|
readonly type: "reqUpdateUserTenant";
|
|
253
|
-
readonly auth:
|
|
275
|
+
readonly auth: DashAuthType;
|
|
254
276
|
readonly tenantId: string;
|
|
255
277
|
readonly userId?: string;
|
|
256
278
|
readonly role: Role;
|
|
@@ -271,7 +293,7 @@ export interface CreateLedger {
|
|
|
271
293
|
}
|
|
272
294
|
export interface ReqCreateLedger {
|
|
273
295
|
readonly type: "reqCreateLedger";
|
|
274
|
-
readonly auth:
|
|
296
|
+
readonly auth: DashAuthType;
|
|
275
297
|
readonly ledger: CreateLedger;
|
|
276
298
|
}
|
|
277
299
|
export interface ResCreateLedger {
|
|
@@ -288,7 +310,7 @@ export interface UpdateLedger {
|
|
|
288
310
|
}
|
|
289
311
|
export interface ReqUpdateLedger {
|
|
290
312
|
readonly type: "reqUpdateLedger";
|
|
291
|
-
readonly auth:
|
|
313
|
+
readonly auth: DashAuthType;
|
|
292
314
|
readonly ledger: UpdateLedger;
|
|
293
315
|
}
|
|
294
316
|
export interface ResUpdateLedger {
|
|
@@ -301,7 +323,7 @@ export interface DeleteLedger {
|
|
|
301
323
|
}
|
|
302
324
|
export interface ReqDeleteLedger {
|
|
303
325
|
readonly type: "reqDeleteLedger";
|
|
304
|
-
readonly auth:
|
|
326
|
+
readonly auth: DashAuthType;
|
|
305
327
|
readonly ledger: DeleteLedger;
|
|
306
328
|
}
|
|
307
329
|
export interface ResDeleteLedger {
|
|
@@ -309,7 +331,7 @@ export interface ResDeleteLedger {
|
|
|
309
331
|
}
|
|
310
332
|
export interface ReqCloudSessionToken {
|
|
311
333
|
readonly type: "reqCloudSessionToken";
|
|
312
|
-
readonly auth:
|
|
334
|
+
readonly auth: DashAuthType;
|
|
313
335
|
readonly selected?: Partial<TenantLedger>;
|
|
314
336
|
readonly resultId?: string;
|
|
315
337
|
}
|
|
@@ -333,7 +355,7 @@ export interface ResDeleteTenant {
|
|
|
333
355
|
}
|
|
334
356
|
export interface ReqDeleteTenant {
|
|
335
357
|
readonly type: "reqDeleteTenant";
|
|
336
|
-
readonly auth:
|
|
358
|
+
readonly auth: DashAuthType;
|
|
337
359
|
readonly tenantId: string;
|
|
338
360
|
}
|
|
339
361
|
export interface OutTenantParams {
|
|
@@ -356,7 +378,7 @@ export interface ResEnsureUser {
|
|
|
356
378
|
}
|
|
357
379
|
export interface ReqEnsureUser {
|
|
358
380
|
readonly type: "reqEnsureUser";
|
|
359
|
-
readonly auth:
|
|
381
|
+
readonly auth: DashAuthType;
|
|
360
382
|
}
|
|
361
383
|
interface RoleBase {
|
|
362
384
|
readonly tenantId?: string;
|
|
@@ -393,4 +415,13 @@ export interface ResExtendToken {
|
|
|
393
415
|
readonly type: "resExtendToken";
|
|
394
416
|
readonly token: string;
|
|
395
417
|
}
|
|
418
|
+
export interface ReqCertFromCsr {
|
|
419
|
+
readonly type: "reqCertFromCsr";
|
|
420
|
+
readonly auth: DashAuthType;
|
|
421
|
+
readonly csr: string;
|
|
422
|
+
}
|
|
423
|
+
export interface ResCertFromCsr {
|
|
424
|
+
readonly type: "resCertFromCsr";
|
|
425
|
+
readonly certificate: string;
|
|
426
|
+
}
|
|
396
427
|
export {};
|
package/msg-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msg-types.js","sourceRoot":"","sources":["../jsr/msg-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"msg-types.js","sourceRoot":"","sources":["../jsr/msg-types.ts"],"names":[],"mappings":"AAuPA,MAAM,UAAU,OAAO,CAAC,EAAc,EAAE;IACtC,OAAO,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC;AAAA,CAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fireproof/core-protocols-dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.2-dev-cloud-api",
|
|
4
4
|
"description": "Live ledger for the web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
"url": "https://github.com/fireproof-storage/fireproof/issues"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@adviser/cement": "^0.4.
|
|
35
|
-
"@fireproof/core-
|
|
36
|
-
"@fireproof/core-
|
|
37
|
-
"@fireproof/core-types-
|
|
38
|
-
"@fireproof/
|
|
34
|
+
"@adviser/cement": "^0.4.72",
|
|
35
|
+
"@fireproof/core-device-id": "0.24.2-dev-cloud-api",
|
|
36
|
+
"@fireproof/core-runtime": "0.24.2-dev-cloud-api",
|
|
37
|
+
"@fireproof/core-types-base": "0.24.2-dev-cloud-api",
|
|
38
|
+
"@fireproof/core-types-protocols-cloud": "0.24.2-dev-cloud-api",
|
|
39
|
+
"@fireproof/vendor": "0.24.2-dev-cloud-api",
|
|
40
|
+
"zod": "^4.1.12"
|
|
39
41
|
},
|
|
40
42
|
"scripts": {
|
|
41
43
|
"build": "core-cli tsc"
|