@scalekit-sdk/node 1.0.13 → 2.0.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/buf.gen.yaml +2 -1
- package/lib/core.js +1 -1
- package/lib/core.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.d.ts +217 -0
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js +289 -1
- package/lib/pkg/grpc/scalekit/v1/commons/commons_pb.js.map +1 -1
- package/lib/pkg/grpc/scalekit/v1/users/users_connect.d.ts +117 -0
- package/lib/pkg/grpc/scalekit/v1/users/users_connect.js +125 -0
- package/lib/pkg/grpc/scalekit/v1/users/users_connect.js.map +1 -0
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.d.ts +806 -0
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js +1048 -0
- package/lib/pkg/grpc/scalekit/v1/users/users_pb.js.map +1 -0
- package/lib/scalekit.d.ts +31 -2
- package/lib/scalekit.js +71 -4
- package/lib/scalekit.js.map +1 -1
- package/lib/types/auth.d.ts +1 -0
- package/lib/types/scalekit.d.ts +11 -0
- package/lib/types/user.d.ts +20 -0
- package/lib/types/user.js +3 -0
- package/lib/types/user.js.map +1 -0
- package/lib/user.d.ts +95 -0
- package/lib/user.js +218 -0
- package/lib/user.js.map +1 -0
- package/package.json +8 -3
- package/src/core.ts +1 -1
- package/src/pkg/grpc/scalekit/v1/commons/commons_pb.ts +351 -1
- package/src/pkg/grpc/scalekit/v1/users/users_connect.ts +124 -0
- package/src/pkg/grpc/scalekit/v1/users/users_pb.ts +1440 -0
- package/src/scalekit.ts +87 -7
- package/src/types/auth.ts +1 -0
- package/src/types/scalekit.ts +13 -0
- package/src/types/user.ts +21 -0
- package/src/user.ts +291 -0
package/lib/user.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const users_connect_1 = require("./pkg/grpc/scalekit/v1/users/users_connect");
|
|
13
|
+
const users_pb_1 = require("./pkg/grpc/scalekit/v1/users/users_pb");
|
|
14
|
+
class UserClient {
|
|
15
|
+
constructor(grpcConnect, coreClient) {
|
|
16
|
+
this.grpcConnect = grpcConnect;
|
|
17
|
+
this.coreClient = coreClient;
|
|
18
|
+
this.client = this.grpcConnect.createClient(users_connect_1.UserService);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a new user and add them to an organization
|
|
22
|
+
* @param {string} organizationId The organization id
|
|
23
|
+
* @param {CreateUserRequest} options The user creation options
|
|
24
|
+
* @returns {Promise<CreateUserAndMembershipResponse>} The created user
|
|
25
|
+
*/
|
|
26
|
+
createUserAndMembership(organizationId, options) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
if (!organizationId) {
|
|
29
|
+
throw new Error('organizationId is required');
|
|
30
|
+
}
|
|
31
|
+
if (!options.email) {
|
|
32
|
+
throw new Error('email is required');
|
|
33
|
+
}
|
|
34
|
+
const user = new users_pb_1.CreateUser({
|
|
35
|
+
email: options.email,
|
|
36
|
+
userProfile: options.userProfile ? new users_pb_1.CreateUserProfile({
|
|
37
|
+
firstName: options.userProfile.firstName,
|
|
38
|
+
lastName: options.userProfile.lastName
|
|
39
|
+
}) : undefined,
|
|
40
|
+
metadata: options.metadata
|
|
41
|
+
});
|
|
42
|
+
const request = {
|
|
43
|
+
organizationId,
|
|
44
|
+
user
|
|
45
|
+
};
|
|
46
|
+
if (options.sendActivationEmail !== undefined) {
|
|
47
|
+
request.sendActivationEmail = options.sendActivationEmail;
|
|
48
|
+
}
|
|
49
|
+
const response = yield this.coreClient.connectExec(this.client.createUserAndMembership, request);
|
|
50
|
+
if (!response.user) {
|
|
51
|
+
throw new Error('Failed to create user');
|
|
52
|
+
}
|
|
53
|
+
return response;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get a user by id
|
|
58
|
+
* @param {string} userId The user id
|
|
59
|
+
* @returns {Promise<GetUserResponse>} The user
|
|
60
|
+
*/
|
|
61
|
+
getUser(userId) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return this.coreClient.connectExec(this.client.getUser, {
|
|
64
|
+
identities: {
|
|
65
|
+
case: 'id',
|
|
66
|
+
value: userId
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* List users with pagination
|
|
73
|
+
* @param {object} options The pagination options
|
|
74
|
+
* @param {number} options.pageSize The page size
|
|
75
|
+
* @param {string} options.pageToken The page token
|
|
76
|
+
* @returns {Promise<ListUsersResponse>} The list of users
|
|
77
|
+
*/
|
|
78
|
+
listUsers(options) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
return this.coreClient.connectExec(this.client.listUsers, {
|
|
81
|
+
pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
|
|
82
|
+
pageToken: options === null || options === void 0 ? void 0 : options.pageToken
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Update a user
|
|
88
|
+
* @param {string} userId The user id
|
|
89
|
+
* @param {UpdateUserRequestType} options The update options
|
|
90
|
+
* @returns {Promise<UpdateUserResponse>} The updated user
|
|
91
|
+
*/
|
|
92
|
+
updateUser(userId, options) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const updateUser = new users_pb_1.UpdateUser({
|
|
95
|
+
userProfile: options.userProfile ? {
|
|
96
|
+
firstName: options.userProfile.firstName,
|
|
97
|
+
lastName: options.userProfile.lastName
|
|
98
|
+
} : undefined,
|
|
99
|
+
metadata: options.metadata
|
|
100
|
+
});
|
|
101
|
+
return this.coreClient.connectExec(this.client.updateUser, {
|
|
102
|
+
identities: {
|
|
103
|
+
case: 'id',
|
|
104
|
+
value: userId
|
|
105
|
+
},
|
|
106
|
+
user: updateUser
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Delete a user
|
|
112
|
+
* @param {string} userId The user id
|
|
113
|
+
* @returns {Promise<Empty>} Empty response
|
|
114
|
+
*/
|
|
115
|
+
deleteUser(userId) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
return this.coreClient.connectExec(this.client.deleteUser, {
|
|
118
|
+
identities: {
|
|
119
|
+
case: 'id',
|
|
120
|
+
value: userId
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create a membership for a user in an organization
|
|
127
|
+
* @param {string} organizationId The organization id
|
|
128
|
+
* @param {string} userId The user id
|
|
129
|
+
* @param {object} options The membership options
|
|
130
|
+
* @param {string[]} options.roles The roles to assign
|
|
131
|
+
* @param {Record<string, string>} options.metadata Optional metadata
|
|
132
|
+
* @param {boolean} options.sendActivationEmail Whether to send activation email
|
|
133
|
+
* @returns {Promise<CreateMembershipResponse>} The response with updated user
|
|
134
|
+
*/
|
|
135
|
+
createMembership(organizationId_1, userId_1) {
|
|
136
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, options = {}) {
|
|
137
|
+
var _a;
|
|
138
|
+
const membership = new users_pb_1.CreateMembership({
|
|
139
|
+
roles: ((_a = options.roles) === null || _a === void 0 ? void 0 : _a.map(role => ({ name: role }))) || [],
|
|
140
|
+
metadata: options.metadata || {}
|
|
141
|
+
});
|
|
142
|
+
const request = {
|
|
143
|
+
organizationId,
|
|
144
|
+
identities: {
|
|
145
|
+
case: 'id',
|
|
146
|
+
value: userId
|
|
147
|
+
},
|
|
148
|
+
membership
|
|
149
|
+
};
|
|
150
|
+
if (options.sendActivationEmail !== undefined) {
|
|
151
|
+
request.sendActivationEmail = options.sendActivationEmail;
|
|
152
|
+
}
|
|
153
|
+
return this.coreClient.connectExec(this.client.createMembership, request);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Delete a user's membership from an organization
|
|
158
|
+
* @param {string} organizationId The organization id
|
|
159
|
+
* @param {string} userId The user id
|
|
160
|
+
* @returns {Promise<Empty>} Empty response
|
|
161
|
+
*/
|
|
162
|
+
deleteMembership(organizationId, userId) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
return this.coreClient.connectExec(this.client.deleteMembership, {
|
|
165
|
+
organizationId,
|
|
166
|
+
identities: {
|
|
167
|
+
case: 'id',
|
|
168
|
+
value: userId
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Update a user's membership in an organization
|
|
175
|
+
* @param {string} organizationId The organization id
|
|
176
|
+
* @param {string} userId The user id
|
|
177
|
+
* @param {object} options The update options
|
|
178
|
+
* @param {string[]} options.roles The roles to assign
|
|
179
|
+
* @param {Record<string, string>} options.metadata Optional metadata
|
|
180
|
+
* @returns {Promise<UpdateMembershipResponse>} The response with updated user
|
|
181
|
+
*/
|
|
182
|
+
updateMembership(organizationId_1, userId_1) {
|
|
183
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, options = {}) {
|
|
184
|
+
var _a;
|
|
185
|
+
const membership = new users_pb_1.UpdateMembership({
|
|
186
|
+
roles: ((_a = options.roles) === null || _a === void 0 ? void 0 : _a.map(role => ({ name: role }))) || [],
|
|
187
|
+
metadata: options.metadata || {}
|
|
188
|
+
});
|
|
189
|
+
return this.coreClient.connectExec(this.client.updateMembership, {
|
|
190
|
+
organizationId,
|
|
191
|
+
identities: {
|
|
192
|
+
case: 'id',
|
|
193
|
+
value: userId
|
|
194
|
+
},
|
|
195
|
+
membership
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* List users in an organization with pagination
|
|
201
|
+
* @param {string} organizationId The organization id
|
|
202
|
+
* @param {object} options The pagination options
|
|
203
|
+
* @param {number} options.pageSize The page size
|
|
204
|
+
* @param {string} options.pageToken The page token
|
|
205
|
+
* @returns {Promise<ListOrganizationUsersResponse>} The list of users in the organization
|
|
206
|
+
*/
|
|
207
|
+
listOrganizationUsers(organizationId, options) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
return this.coreClient.connectExec(this.client.listOrganizationUsers, {
|
|
210
|
+
organizationId,
|
|
211
|
+
pageSize: options === null || options === void 0 ? void 0 : options.pageSize,
|
|
212
|
+
pageToken: options === null || options === void 0 ? void 0 : options.pageToken
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.default = UserClient;
|
|
218
|
+
//# sourceMappingURL=user.js.map
|
package/lib/user.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,8EAAyE;AACzE,oEAuB+C;AAG/C,MAAqB,UAAU;IAG7B,YACmB,WAAwB,EACxB,UAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,eAAU,GAAV,UAAU,CAAY;QAEvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,YAA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,EAAE;gBACzD,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;aACjC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAC5B;gBACE,cAAc;gBACd,UAAU,EAAE;oBACV,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,MAAM;iBACd;gBACD,UAAU;aACX,CACF,CAAC;QACJ,CAAC;KAAA;IAED;;;;;;;OAOG;IACG,qBAAqB,CACzB,cAAsB,EACtB,OAGC;;YAED,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC,IAAI,CAAC,MAAM,CAAC,qBAAqB,EACjC;gBACE,cAAc;gBACd,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ;gBAC3B,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS;aAC9B,CACF,CAAC;QACJ,CAAC;KAAA;CACF;AAnQD,6BAmQC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "2.0.0",
|
|
3
3
|
"name": "@scalekit-sdk/node",
|
|
4
4
|
"description": "Official Scalekit Node SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
@@ -23,21 +23,26 @@
|
|
|
23
23
|
"author": "Team Scalekit",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@bufbuild/protobuf": "^1.10.0",
|
|
26
27
|
"@connectrpc/connect": "^1.4.0",
|
|
27
28
|
"@connectrpc/connect-node": "^1.4.0",
|
|
28
|
-
"axios": "^1.
|
|
29
|
+
"axios": "^1.10.0",
|
|
29
30
|
"jose": "^5.6.3",
|
|
30
31
|
"qs": "^6.13.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@bufbuild/buf": "^1.36.0",
|
|
34
|
-
"@bufbuild/protobuf": "^1.10.0",
|
|
35
35
|
"@bufbuild/protoc-gen-es": "^1.10.0",
|
|
36
36
|
"@connectrpc/protoc-gen-connect-es": "^1.4.0",
|
|
37
37
|
"@types/node": "^20.14.10",
|
|
38
38
|
"@types/qs": "^6.9.15",
|
|
39
|
+
"dotenv": "^16.4.7",
|
|
40
|
+
"ts-node": "^10.9.2",
|
|
39
41
|
"typescript": "^5.5.3"
|
|
40
42
|
},
|
|
43
|
+
"overrides": {
|
|
44
|
+
"undici": "^5.29.0"
|
|
45
|
+
},
|
|
41
46
|
"bugs": {
|
|
42
47
|
"url": "https://github.com/scalekit-inc/scalekit-sdk-node/issues"
|
|
43
48
|
},
|
package/src/core.ts
CHANGED
|
@@ -20,7 +20,7 @@ export default class CoreClient {
|
|
|
20
20
|
public keys: JWK[] = [];
|
|
21
21
|
public accessToken: string | null = null;
|
|
22
22
|
public axios: Axios;
|
|
23
|
-
public sdkVersion = `Scalekit-Node/
|
|
23
|
+
public sdkVersion = `Scalekit-Node/2.0.0`;
|
|
24
24
|
public apiVersion = "20240430";
|
|
25
25
|
public userAgent = `${this.sdkVersion} Node/${process.version} (${process.platform}; ${os.arch()})`;
|
|
26
26
|
constructor(
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
// @ts-nocheck
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
|
7
|
+
import { Message, proto3, Timestamp } from "@bufbuild/protobuf";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @generated from enum scalekit.v1.commons.RegionCode
|
|
@@ -34,3 +35,352 @@ proto3.util.setEnumType(RegionCode, "scalekit.v1.commons.RegionCode", [
|
|
|
34
35
|
{ no: 2, name: "EU" },
|
|
35
36
|
]);
|
|
36
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @generated from enum scalekit.v1.commons.UserStatus
|
|
40
|
+
*/
|
|
41
|
+
export enum UserStatus {
|
|
42
|
+
/**
|
|
43
|
+
* @generated from enum value: USER_STATUS_UNSPECIFIED = 0;
|
|
44
|
+
*/
|
|
45
|
+
USER_STATUS_UNSPECIFIED = 0,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @generated from enum value: ACTIVE = 1;
|
|
49
|
+
*/
|
|
50
|
+
ACTIVE = 1,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @generated from enum value: INACTIVE = 2;
|
|
54
|
+
*/
|
|
55
|
+
INACTIVE = 2,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @generated from enum value: INVITED = 3;
|
|
59
|
+
*/
|
|
60
|
+
INVITED = 3,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @generated from enum value: PENDING = 4;
|
|
64
|
+
*/
|
|
65
|
+
PENDING = 4,
|
|
66
|
+
}
|
|
67
|
+
// Retrieve enum metadata with: proto3.getEnumType(UserStatus)
|
|
68
|
+
proto3.util.setEnumType(UserStatus, "scalekit.v1.commons.UserStatus", [
|
|
69
|
+
{ no: 0, name: "USER_STATUS_UNSPECIFIED" },
|
|
70
|
+
{ no: 1, name: "ACTIVE" },
|
|
71
|
+
{ no: 2, name: "INACTIVE" },
|
|
72
|
+
{ no: 3, name: "INVITED" },
|
|
73
|
+
{ no: 4, name: "PENDING" },
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @generated from enum scalekit.v1.commons.IdentityProviderType
|
|
78
|
+
*/
|
|
79
|
+
export enum IdentityProviderType {
|
|
80
|
+
/**
|
|
81
|
+
* @generated from enum value: IDENTITY_PROVIDER_UNSPECIFIED = 0;
|
|
82
|
+
*/
|
|
83
|
+
IDENTITY_PROVIDER_UNSPECIFIED = 0,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @generated from enum value: OKTA = 1;
|
|
87
|
+
*/
|
|
88
|
+
OKTA = 1,
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @generated from enum value: GOOGLE = 2;
|
|
92
|
+
*/
|
|
93
|
+
GOOGLE = 2,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @generated from enum value: MICROSOFT_AD = 3;
|
|
97
|
+
*/
|
|
98
|
+
MICROSOFT_AD = 3,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @generated from enum value: AUTH0 = 4;
|
|
102
|
+
*/
|
|
103
|
+
AUTH0 = 4,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @generated from enum value: ONELOGIN = 5;
|
|
107
|
+
*/
|
|
108
|
+
ONELOGIN = 5,
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @generated from enum value: PING_IDENTITY = 6;
|
|
112
|
+
*/
|
|
113
|
+
PING_IDENTITY = 6,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @generated from enum value: JUMPCLOUD = 7;
|
|
117
|
+
*/
|
|
118
|
+
JUMPCLOUD = 7,
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @generated from enum value: CUSTOM = 8;
|
|
122
|
+
*/
|
|
123
|
+
CUSTOM = 8,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @generated from enum value: GITHUB = 9;
|
|
127
|
+
*/
|
|
128
|
+
GITHUB = 9,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @generated from enum value: GITLAB = 10;
|
|
132
|
+
*/
|
|
133
|
+
GITLAB = 10,
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @generated from enum value: LINKEDIN = 11;
|
|
137
|
+
*/
|
|
138
|
+
LINKEDIN = 11,
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @generated from enum value: SALESFORCE = 12;
|
|
142
|
+
*/
|
|
143
|
+
SALESFORCE = 12,
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @generated from enum value: MICROSOFT = 13;
|
|
147
|
+
*/
|
|
148
|
+
MICROSOFT = 13,
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @generated from enum value: IDP_SIMULATOR = 14;
|
|
152
|
+
*/
|
|
153
|
+
IDP_SIMULATOR = 14,
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @generated from enum value: SCALEKIT = 15;
|
|
157
|
+
*/
|
|
158
|
+
SCALEKIT = 15,
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @generated from enum value: ADFS = 16;
|
|
162
|
+
*/
|
|
163
|
+
ADFS = 16,
|
|
164
|
+
}
|
|
165
|
+
// Retrieve enum metadata with: proto3.getEnumType(IdentityProviderType)
|
|
166
|
+
proto3.util.setEnumType(IdentityProviderType, "scalekit.v1.commons.IdentityProviderType", [
|
|
167
|
+
{ no: 0, name: "IDENTITY_PROVIDER_UNSPECIFIED" },
|
|
168
|
+
{ no: 1, name: "OKTA" },
|
|
169
|
+
{ no: 2, name: "GOOGLE" },
|
|
170
|
+
{ no: 3, name: "MICROSOFT_AD" },
|
|
171
|
+
{ no: 4, name: "AUTH0" },
|
|
172
|
+
{ no: 5, name: "ONELOGIN" },
|
|
173
|
+
{ no: 6, name: "PING_IDENTITY" },
|
|
174
|
+
{ no: 7, name: "JUMPCLOUD" },
|
|
175
|
+
{ no: 8, name: "CUSTOM" },
|
|
176
|
+
{ no: 9, name: "GITHUB" },
|
|
177
|
+
{ no: 10, name: "GITLAB" },
|
|
178
|
+
{ no: 11, name: "LINKEDIN" },
|
|
179
|
+
{ no: 12, name: "SALESFORCE" },
|
|
180
|
+
{ no: 13, name: "MICROSOFT" },
|
|
181
|
+
{ no: 14, name: "IDP_SIMULATOR" },
|
|
182
|
+
{ no: 15, name: "SCALEKIT" },
|
|
183
|
+
{ no: 16, name: "ADFS" },
|
|
184
|
+
]);
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @generated from message scalekit.v1.commons.OrganizationMembership
|
|
188
|
+
*/
|
|
189
|
+
export class OrganizationMembership extends Message<OrganizationMembership> {
|
|
190
|
+
/**
|
|
191
|
+
* @generated from field: string organization_id = 1;
|
|
192
|
+
*/
|
|
193
|
+
organizationId = "";
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @generated from field: google.protobuf.Timestamp join_time = 2;
|
|
197
|
+
*/
|
|
198
|
+
joinTime?: Timestamp;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @generated from field: scalekit.v1.commons.UserStatus membership_status = 3;
|
|
202
|
+
*/
|
|
203
|
+
membershipStatus = UserStatus.USER_STATUS_UNSPECIFIED;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @generated from field: repeated scalekit.v1.commons.Role roles = 4;
|
|
207
|
+
*/
|
|
208
|
+
roles: Role[] = [];
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @generated from field: optional string name = 5;
|
|
212
|
+
*/
|
|
213
|
+
name?: string;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @generated from field: scalekit.v1.commons.IdentityProviderType primary_identity_provider = 6;
|
|
217
|
+
*/
|
|
218
|
+
primaryIdentityProvider = IdentityProviderType.IDENTITY_PROVIDER_UNSPECIFIED;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @generated from field: map<string, string> metadata = 7;
|
|
222
|
+
*/
|
|
223
|
+
metadata: { [key: string]: string } = {};
|
|
224
|
+
|
|
225
|
+
constructor(data?: PartialMessage<OrganizationMembership>) {
|
|
226
|
+
super();
|
|
227
|
+
proto3.util.initPartial(data, this);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
231
|
+
static readonly typeName = "scalekit.v1.commons.OrganizationMembership";
|
|
232
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
233
|
+
{ no: 1, name: "organization_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
234
|
+
{ no: 2, name: "join_time", kind: "message", T: Timestamp },
|
|
235
|
+
{ no: 3, name: "membership_status", kind: "enum", T: proto3.getEnumType(UserStatus) },
|
|
236
|
+
{ no: 4, name: "roles", kind: "message", T: Role, repeated: true },
|
|
237
|
+
{ no: 5, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
|
|
238
|
+
{ no: 6, name: "primary_identity_provider", kind: "enum", T: proto3.getEnumType(IdentityProviderType) },
|
|
239
|
+
{ no: 7, name: "metadata", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
240
|
+
]);
|
|
241
|
+
|
|
242
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): OrganizationMembership {
|
|
243
|
+
return new OrganizationMembership().fromBinary(bytes, options);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): OrganizationMembership {
|
|
247
|
+
return new OrganizationMembership().fromJson(jsonValue, options);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): OrganizationMembership {
|
|
251
|
+
return new OrganizationMembership().fromJsonString(jsonString, options);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
static equals(a: OrganizationMembership | PlainMessage<OrganizationMembership> | undefined, b: OrganizationMembership | PlainMessage<OrganizationMembership> | undefined): boolean {
|
|
255
|
+
return proto3.util.equals(OrganizationMembership, a, b);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @generated from message scalekit.v1.commons.Role
|
|
261
|
+
*/
|
|
262
|
+
export class Role extends Message<Role> {
|
|
263
|
+
/**
|
|
264
|
+
* @generated from field: string id = 1;
|
|
265
|
+
*/
|
|
266
|
+
id = "";
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @generated from field: string name = 2;
|
|
270
|
+
*/
|
|
271
|
+
name = "";
|
|
272
|
+
|
|
273
|
+
constructor(data?: PartialMessage<Role>) {
|
|
274
|
+
super();
|
|
275
|
+
proto3.util.initPartial(data, this);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
279
|
+
static readonly typeName = "scalekit.v1.commons.Role";
|
|
280
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
281
|
+
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
282
|
+
{ no: 2, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
283
|
+
]);
|
|
284
|
+
|
|
285
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Role {
|
|
286
|
+
return new Role().fromBinary(bytes, options);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Role {
|
|
290
|
+
return new Role().fromJson(jsonValue, options);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Role {
|
|
294
|
+
return new Role().fromJsonString(jsonString, options);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
static equals(a: Role | PlainMessage<Role> | undefined, b: Role | PlainMessage<Role> | undefined): boolean {
|
|
298
|
+
return proto3.util.equals(Role, a, b);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @generated from message scalekit.v1.commons.UserProfile
|
|
304
|
+
*/
|
|
305
|
+
export class UserProfile extends Message<UserProfile> {
|
|
306
|
+
/**
|
|
307
|
+
* @generated from field: string id = 1;
|
|
308
|
+
*/
|
|
309
|
+
id = "";
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @generated from field: string first_name = 2;
|
|
313
|
+
*/
|
|
314
|
+
firstName = "";
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @generated from field: string last_name = 3;
|
|
318
|
+
*/
|
|
319
|
+
lastName = "";
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @generated from field: string name = 4;
|
|
323
|
+
*/
|
|
324
|
+
name = "";
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @generated from field: string locale = 5;
|
|
328
|
+
*/
|
|
329
|
+
locale = "";
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* @generated from field: bool email_verified = 6;
|
|
333
|
+
*/
|
|
334
|
+
emailVerified = false;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @generated from field: string phone_number = 7;
|
|
338
|
+
*/
|
|
339
|
+
phoneNumber = "";
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @generated from field: map<string, string> metadata = 8;
|
|
343
|
+
*/
|
|
344
|
+
metadata: { [key: string]: string } = {};
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* @generated from field: map<string, string> custom_attributes = 9;
|
|
348
|
+
*/
|
|
349
|
+
customAttributes: { [key: string]: string } = {};
|
|
350
|
+
|
|
351
|
+
constructor(data?: PartialMessage<UserProfile>) {
|
|
352
|
+
super();
|
|
353
|
+
proto3.util.initPartial(data, this);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
static readonly runtime: typeof proto3 = proto3;
|
|
357
|
+
static readonly typeName = "scalekit.v1.commons.UserProfile";
|
|
358
|
+
static readonly fields: FieldList = proto3.util.newFieldList(() => [
|
|
359
|
+
{ no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
360
|
+
{ no: 2, name: "first_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
361
|
+
{ no: 3, name: "last_name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
362
|
+
{ no: 4, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
363
|
+
{ no: 5, name: "locale", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
364
|
+
{ no: 6, name: "email_verified", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
|
|
365
|
+
{ no: 7, name: "phone_number", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
366
|
+
{ no: 8, name: "metadata", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
367
|
+
{ no: 9, name: "custom_attributes", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "scalar", T: 9 /* ScalarType.STRING */} },
|
|
368
|
+
]);
|
|
369
|
+
|
|
370
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UserProfile {
|
|
371
|
+
return new UserProfile().fromBinary(bytes, options);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UserProfile {
|
|
375
|
+
return new UserProfile().fromJson(jsonValue, options);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UserProfile {
|
|
379
|
+
return new UserProfile().fromJsonString(jsonString, options);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
static equals(a: UserProfile | PlainMessage<UserProfile> | undefined, b: UserProfile | PlainMessage<UserProfile> | undefined): boolean {
|
|
383
|
+
return proto3.util.equals(UserProfile, a, b);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|