triangle-types 1.0.236 → 1.0.237

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.
@@ -110,4 +110,5 @@ export * from "./types/user/TenantRole.js";
110
110
  export * from "./types/user/TenantRoleProvision.js";
111
111
  export * from "./types/user/User.js";
112
112
  export * from "./types/user/UserComment.js";
113
+ export * from "./types/user/UserTenant.js";
113
114
  export * from "./types/user/UserTenantRole.js";
package/dist/src/index.js CHANGED
@@ -110,4 +110,5 @@ export * from "./types/user/TenantRole.js";
110
110
  export * from "./types/user/TenantRoleProvision.js";
111
111
  export * from "./types/user/User.js";
112
112
  export * from "./types/user/UserComment.js";
113
+ export * from "./types/user/UserTenant.js";
113
114
  export * from "./types/user/UserTenantRole.js";
@@ -0,0 +1,7 @@
1
+ export declare class UserTenant {
2
+ readonly user_id: string;
3
+ readonly tenant_id: string;
4
+ readonly [x: string]: any;
5
+ constructor(user_tenant: UserTenant);
6
+ static is(user_tenant: any): user_tenant is UserTenant;
7
+ }
@@ -0,0 +1,16 @@
1
+ export class UserTenant {
2
+ user_id;
3
+ tenant_id;
4
+ constructor(user_tenant) {
5
+ if (!UserTenant.is(user_tenant)) {
6
+ throw Error("Invalid input.");
7
+ }
8
+ this.user_id = user_tenant.user_id;
9
+ this.tenant_id = user_tenant.tenant_id;
10
+ }
11
+ static is(user_tenant) {
12
+ return (user_tenant !== undefined &&
13
+ typeof user_tenant.user_id === "string" &&
14
+ typeof user_tenant.tenant_id === "string");
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.236",
3
+ "version": "1.0.237",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -134,4 +134,5 @@ export * from "./types/user/TenantRole"
134
134
  export * from "./types/user/TenantRoleProvision"
135
135
  export * from "./types/user/User"
136
136
  export * from "./types/user/UserComment"
137
+ export * from "./types/user/UserTenant"
137
138
  export * from "./types/user/UserTenantRole"
@@ -0,0 +1,21 @@
1
+ export class UserTenant {
2
+ readonly user_id : string
3
+ readonly tenant_id : string
4
+ readonly [x : string] : any
5
+
6
+ constructor(user_tenant : UserTenant) {
7
+ if (!UserTenant.is(user_tenant)) {
8
+ throw Error("Invalid input.")
9
+ }
10
+ this.user_id = user_tenant.user_id
11
+ this.tenant_id = user_tenant.tenant_id
12
+ }
13
+
14
+ static is(user_tenant : any) : user_tenant is UserTenant {
15
+ return (
16
+ user_tenant !== undefined &&
17
+ typeof user_tenant.user_id === "string" &&
18
+ typeof user_tenant.tenant_id === "string"
19
+ )
20
+ }
21
+ }