@infosel-sdk/users 0.0.6
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/README.md +238 -0
- package/package.json +48 -0
- package/src/data/datasources/users_datasource_impl.d.ts +17 -0
- package/src/data/datasources/users_datasource_impl.js +105 -0
- package/src/data/datasources/users_datasource_impl.js.map +1 -0
- package/src/data/di/infosel_users_component.d.ts +22 -0
- package/src/data/di/infosel_users_component.js +64 -0
- package/src/data/di/infosel_users_component.js.map +1 -0
- package/src/data/di/infosel_users_module.d.ts +17 -0
- package/src/data/di/infosel_users_module.js +34 -0
- package/src/data/di/infosel_users_module.js.map +1 -0
- package/src/data/models/create_user_response.d.ts +12 -0
- package/src/data/models/create_user_response.js +3 -0
- package/src/data/models/create_user_response.js.map +1 -0
- package/src/data/models/get_all_users_response.d.ts +11 -0
- package/src/data/models/get_all_users_response.js +3 -0
- package/src/data/models/get_all_users_response.js.map +1 -0
- package/src/data/models/user_by_connection_id_response.d.ts +12 -0
- package/src/data/models/user_by_connection_id_response.js +3 -0
- package/src/data/models/user_by_connection_id_response.js.map +1 -0
- package/src/data/repositories/users_repository_impl.d.ts +15 -0
- package/src/data/repositories/users_repository_impl.js +21 -0
- package/src/data/repositories/users_repository_impl.js.map +1 -0
- package/src/domain/datasources/users_datasource.d.ts +11 -0
- package/src/domain/datasources/users_datasource.js +3 -0
- package/src/domain/datasources/users_datasource.js.map +1 -0
- package/src/domain/di/users_component.d.ts +11 -0
- package/src/domain/di/users_component.js +3 -0
- package/src/domain/di/users_component.js.map +1 -0
- package/src/domain/di/users_module.d.ts +8 -0
- package/src/domain/di/users_module.js +3 -0
- package/src/domain/di/users_module.js.map +1 -0
- package/src/domain/entities/create_user_request.d.ts +4 -0
- package/src/domain/entities/create_user_request.js +3 -0
- package/src/domain/entities/create_user_request.js.map +1 -0
- package/src/domain/entities/user.d.ts +8 -0
- package/src/domain/entities/user.js +3 -0
- package/src/domain/entities/user.js.map +1 -0
- package/src/domain/repositories/users_repository.d.ts +11 -0
- package/src/domain/repositories/users_repository.js +3 -0
- package/src/domain/repositories/users_repository.js.map +1 -0
- package/src/domain/use_cases/create_user_use_case.d.ts +9 -0
- package/src/domain/use_cases/create_user_use_case.js +25 -0
- package/src/domain/use_cases/create_user_use_case.js.map +1 -0
- package/src/domain/use_cases/get_all_users_use_case.d.ts +9 -0
- package/src/domain/use_cases/get_all_users_use_case.js +15 -0
- package/src/domain/use_cases/get_all_users_use_case.js.map +1 -0
- package/src/domain/use_cases/get_user_by_connection_id_use_case.d.ts +12 -0
- package/src/domain/use_cases/get_user_by_connection_id_use_case.js +19 -0
- package/src/domain/use_cases/get_user_by_connection_id_use_case.js.map +1 -0
- package/src/domain/use_cases/get_user_use_case.d.ts +6 -0
- package/src/domain/use_cases/get_user_use_case.js +15 -0
- package/src/domain/use_cases/get_user_use_case.js.map +1 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +6 -0
- package/src/index.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# @infosel-sdk/users
|
|
2
|
+
|
|
3
|
+
SDK de Usuarios para la plataforma de servicios financieros Infosel. Proporciona funcionalidades para la gesti贸n de usuarios, incluyendo creaci贸n de usuarios y consulta por ID de conexi贸n.
|
|
4
|
+
|
|
5
|
+
## 馃殌 Caracter铆sticas
|
|
6
|
+
|
|
7
|
+
- **Gesti贸n de Usuarios**: Creaci贸n y consulta de usuarios
|
|
8
|
+
- **Integraci贸n con Markets**: Acceso a workspaces, widgets e instrumentos del usuario
|
|
9
|
+
- **Configuraci贸n Autom谩tica**: Soporte para entornos QA y producci贸n
|
|
10
|
+
- **Inyecci贸n de Dependencias**: Arquitectura modular y extensible
|
|
11
|
+
- **Manejo de Errores**: Integraci贸n con el sistema de errores del SDK Core
|
|
12
|
+
|
|
13
|
+
## 馃摝 Instalaci贸n
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @infosel-sdk/users
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Dependencias
|
|
20
|
+
|
|
21
|
+
**Peer Dependencies (requeridas):**
|
|
22
|
+
|
|
23
|
+
- `@infosel-sdk/core`: ^0.0.3
|
|
24
|
+
- `@infosel-sdk/markets`: ^1.0.0
|
|
25
|
+
|
|
26
|
+
**Dependencias Internas:**
|
|
27
|
+
|
|
28
|
+
- `tslib`: ^2.8.1
|
|
29
|
+
|
|
30
|
+
### Nota sobre Peer Dependencies
|
|
31
|
+
|
|
32
|
+
Este paquete utiliza peer dependencies para evitar conflictos de versiones y dependencias circulares en el monorepo. Aseg煤rate de tener instaladas las versiones correctas de `@infosel-sdk/core` y `@infosel-sdk/markets` en tu proyecto.
|
|
33
|
+
|
|
34
|
+
## 馃敡 Configuraci贸n
|
|
35
|
+
|
|
36
|
+
### Inicializaci贸n B谩sica
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { InfoselSdkManager } from '@infosel-sdk/core';
|
|
40
|
+
import InfoselUsers from '@infosel-sdk/users';
|
|
41
|
+
|
|
42
|
+
// Inicializar el SDK Manager
|
|
43
|
+
const sdkManager = new InfoselSdkManager({
|
|
44
|
+
baseUrl: 'https://api.infosel.com',
|
|
45
|
+
mode: 'prod', // o 'qa'
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await sdkManager.initialize();
|
|
49
|
+
|
|
50
|
+
// Inicializar el m贸dulo de usuarios
|
|
51
|
+
const usersModule = InfoselUsers.init({ sdkManager });
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Configuraci贸n por Entorno
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Entorno de Producci贸n
|
|
58
|
+
const sdkManager = new InfoselSdkManager({
|
|
59
|
+
baseUrl: 'https://api.infosel.com',
|
|
60
|
+
mode: 'prod',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Entorno de QA
|
|
64
|
+
const sdkManager = new InfoselSdkManager({
|
|
65
|
+
baseUrl: 'https://api-qa.infosel.com',
|
|
66
|
+
mode: 'qa',
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 馃懁 Gesti贸n de Usuarios
|
|
71
|
+
|
|
72
|
+
### Crear Usuario
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { CreateUserRequest } from '@infosel-sdk/users';
|
|
76
|
+
|
|
77
|
+
const createUserRequest: CreateUserRequest = {
|
|
78
|
+
projectId: 'your-project-id',
|
|
79
|
+
connectionId: 'user-connection-id',
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const user = await usersModule.createUser(createUserRequest);
|
|
84
|
+
console.log('Usuario creado:', user);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('Error al crear usuario:', error);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Obtener Usuario por Connection ID
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
try {
|
|
94
|
+
const user = await usersModule.getUserByConnectionId('user-connection-id');
|
|
95
|
+
console.log('Usuario encontrado:', user);
|
|
96
|
+
|
|
97
|
+
// Acceder a los workspaces del usuario
|
|
98
|
+
console.log('Workspaces:', user.workspaces);
|
|
99
|
+
|
|
100
|
+
// Acceder a los widgets del usuario
|
|
101
|
+
console.log('Widgets:', user.widgets);
|
|
102
|
+
|
|
103
|
+
// Acceder a los instrumentos del usuario
|
|
104
|
+
console.log('Instrumentos:', user.instruments);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error('Error al obtener usuario:', error);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 馃搳 Estructura de Datos
|
|
111
|
+
|
|
112
|
+
### User Entity
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
interface User {
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly connectionId: string;
|
|
118
|
+
readonly workspaces: Workspace[];
|
|
119
|
+
readonly widgets: WidgetsContainer;
|
|
120
|
+
readonly instruments: InstrumentsContainer;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### CreateUserRequest
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
interface CreateUserRequest {
|
|
128
|
+
readonly projectId: string;
|
|
129
|
+
readonly connectionId: string;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 馃毃 Manejo de Errores
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { SdkError, SdkErrorType } from '@infosel-sdk/core';
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const user = await usersModule.createUser(request);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
if (error instanceof SdkError) {
|
|
142
|
+
switch (error.type) {
|
|
143
|
+
case SdkErrorType.REQUEST_OBJECT_IS_REQUIRED:
|
|
144
|
+
console.error('Se requiere un objeto de solicitud');
|
|
145
|
+
break;
|
|
146
|
+
case SdkErrorType.INVALID_PROJECT_ID:
|
|
147
|
+
console.error('ID de proyecto inv谩lido');
|
|
148
|
+
break;
|
|
149
|
+
case SdkErrorType.INVALID_CONNECTION_ID:
|
|
150
|
+
console.error('ID de conexi贸n inv谩lido');
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
console.error('Error del SDK:', error.message);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## 馃摎 API Reference
|
|
160
|
+
|
|
161
|
+
### Clases Principales
|
|
162
|
+
|
|
163
|
+
- `InfoselUsers`: Componente principal para gesti贸n de usuarios
|
|
164
|
+
- `CreateUserUseCase`: Caso de uso para crear usuarios
|
|
165
|
+
- `GetUserByConnectionIdUseCase`: Caso de uso para obtener usuarios por connection ID
|
|
166
|
+
|
|
167
|
+
### M茅todos Disponibles
|
|
168
|
+
|
|
169
|
+
#### `createUser(request: CreateUserRequest): Promise<User>`
|
|
170
|
+
|
|
171
|
+
Crea un nuevo usuario en el sistema.
|
|
172
|
+
|
|
173
|
+
**Par谩metros:**
|
|
174
|
+
|
|
175
|
+
- `request`: Objeto con `projectId` y `connectionId`
|
|
176
|
+
|
|
177
|
+
**Retorna:** Promise con el usuario creado
|
|
178
|
+
|
|
179
|
+
#### `getUserByConnectionId(connectionId: string): Promise<User>`
|
|
180
|
+
|
|
181
|
+
Obtiene un usuario existente por su ID de conexi贸n.
|
|
182
|
+
|
|
183
|
+
**Par谩metros:**
|
|
184
|
+
|
|
185
|
+
- `connectionId`: ID de conexi贸n del usuario
|
|
186
|
+
|
|
187
|
+
**Retorna:** Promise con el usuario encontrado
|
|
188
|
+
|
|
189
|
+
### Tipos de Error
|
|
190
|
+
|
|
191
|
+
- `SdkErrorType.REQUEST_OBJECT_IS_REQUIRED`: Objeto de solicitud requerido
|
|
192
|
+
- `SdkErrorType.INVALID_PROJECT_ID`: ID de proyecto inv谩lido
|
|
193
|
+
- `SdkErrorType.INVALID_CONNECTION_ID`: ID de conexi贸n inv谩lido
|
|
194
|
+
|
|
195
|
+
## 馃敆 Integraci贸n con Markets
|
|
196
|
+
|
|
197
|
+
El m贸dulo de usuarios est谩 integrado con el m贸dulo de markets, proporcionando acceso a:
|
|
198
|
+
|
|
199
|
+
- **Workspaces**: Espacios de trabajo del usuario
|
|
200
|
+
- **Widgets**: Widgets configurados por el usuario
|
|
201
|
+
- **Instruments**: Instrumentos financieros del usuario
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
const user = await usersModule.getUserByConnectionId('connection-id');
|
|
205
|
+
|
|
206
|
+
// Acceder a workspaces
|
|
207
|
+
user.workspaces.forEach(workspace => {
|
|
208
|
+
console.log('Workspace:', workspace.name);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// Acceder a widgets
|
|
212
|
+
console.log('Widgets disponibles:', user.widgets);
|
|
213
|
+
|
|
214
|
+
// Acceder a instrumentos
|
|
215
|
+
console.log('Instrumentos:', user.instruments);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## 馃И Testing
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Ejecutar tests unitarios
|
|
222
|
+
npm test
|
|
223
|
+
|
|
224
|
+
# Ejecutar tests con cobertura
|
|
225
|
+
npm run test:coverage
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## 馃 Contribuci贸n
|
|
229
|
+
|
|
230
|
+
1. Fork el proyecto
|
|
231
|
+
2. Crea una rama para tu feature (`git checkout -b feature/AmazingFeature`)
|
|
232
|
+
3. Commit tus cambios (`git commit -m 'Add some AmazingFeature'`)
|
|
233
|
+
4. Push a la rama (`git push origin feature/AmazingFeature`)
|
|
234
|
+
5. Abre un Pull Request
|
|
235
|
+
|
|
236
|
+
## 馃搫 Licencia
|
|
237
|
+
|
|
238
|
+
Este proyecto est谩 bajo la Licencia MIT. Ver el archivo `LICENSE` para m谩s detalles.
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@infosel-sdk/users",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "Users SDK for Infosel financial services platform. Provides user management functionality including user creation and retrieval by connection ID.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"infosel",
|
|
7
|
+
"sdk",
|
|
8
|
+
"financial",
|
|
9
|
+
"trading",
|
|
10
|
+
"users",
|
|
11
|
+
"user-management",
|
|
12
|
+
"workspaces",
|
|
13
|
+
"widgets",
|
|
14
|
+
"instruments",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"author": "Infosel Team",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:coverage": "jest --coverage"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"tslib": "^2.8.1"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@infosel-sdk/core": "^0.0.5",
|
|
28
|
+
"@infosel-sdk/widgets": "^1.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/jest": "^29.4.0",
|
|
32
|
+
"jest": "^29.4.1",
|
|
33
|
+
"ts-jest": "^29.1.0"
|
|
34
|
+
},
|
|
35
|
+
"type": "commonjs",
|
|
36
|
+
"main": "./src/index.js",
|
|
37
|
+
"types": "./src/index.d.ts",
|
|
38
|
+
"files": [
|
|
39
|
+
"src/**/*",
|
|
40
|
+
"README.md"
|
|
41
|
+
],
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=16.0.0"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GraphQlClient } from '@infosel-sdk/core';
|
|
2
|
+
import { WidgetsMapper } from '@infosel-sdk/widgets';
|
|
3
|
+
import UsersDatasource from '../../domain/datasources/users_datasource';
|
|
4
|
+
import { CreateUserRequest } from '../../domain/entities/create_user_request';
|
|
5
|
+
import { User } from '../../domain/entities/user';
|
|
6
|
+
export default class UsersDatasourceImpl implements UsersDatasource {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly mapper;
|
|
9
|
+
constructor(client: GraphQlClient, mapper: WidgetsMapper);
|
|
10
|
+
createUser(request: CreateUserRequest): Promise<User>;
|
|
11
|
+
getUserByConnectionId(connectionId: string, projectId: string): Promise<User>;
|
|
12
|
+
getUser(connectionId: string): Promise<string>;
|
|
13
|
+
getAllUsers(projectId: string): Promise<{
|
|
14
|
+
id: string;
|
|
15
|
+
connectionId: string;
|
|
16
|
+
}[]>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@infosel-sdk/core");
|
|
5
|
+
class UsersDatasourceImpl {
|
|
6
|
+
constructor(client, mapper) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
this.mapper = mapper;
|
|
9
|
+
}
|
|
10
|
+
createUser(request) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const MUTATION = `
|
|
14
|
+
mutation($input: CreateUserInput!) {
|
|
15
|
+
createUser(createUserInput: $input) {
|
|
16
|
+
id
|
|
17
|
+
connectionId
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const response = yield this.client.mutate(MUTATION, {
|
|
22
|
+
input: request,
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
id: ((_a = response.createUser) === null || _a === void 0 ? void 0 : _a.id) || '-',
|
|
26
|
+
connectionId: ((_b = response.createUser) === null || _b === void 0 ? void 0 : _b.connectionId) || '-',
|
|
27
|
+
workspaces: [],
|
|
28
|
+
widgets: {},
|
|
29
|
+
instruments: {},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getUserByConnectionId(connectionId, projectId) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const QUERY = `
|
|
36
|
+
query($connectionId: String!, $projectId: String!) {
|
|
37
|
+
userByConnectionId(connectionId: $connectionId, projectId: $projectId) {
|
|
38
|
+
id
|
|
39
|
+
connectionId
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
const response = yield this.client.query(QUERY, { connectionId: connectionId, projectId: projectId });
|
|
44
|
+
const userModel = response.userByConnectionId;
|
|
45
|
+
if (userModel === undefined || userModel === null) {
|
|
46
|
+
throw new core_1.SdkError(core_1.SdkErrorType.USER_NOT_EXIST);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
id: userModel.id || '-',
|
|
50
|
+
connectionId: userModel.connectionId || '-',
|
|
51
|
+
workspaces: [],
|
|
52
|
+
widgets: {},
|
|
53
|
+
instruments: {},
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
getUser(connectionId) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const QUERY = `
|
|
60
|
+
query($connectionId: String!) {
|
|
61
|
+
userByConnectionId(connectionId: $connectionId) {
|
|
62
|
+
id
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
const response = yield this.client.query(QUERY, { connectionId });
|
|
67
|
+
const userModel = response.userByConnectionId;
|
|
68
|
+
if (userModel === undefined || userModel === null) {
|
|
69
|
+
throw new core_1.SdkError(core_1.SdkErrorType.USER_NOT_EXIST);
|
|
70
|
+
}
|
|
71
|
+
return userModel.id || '-';
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
getAllUsers(projectId) {
|
|
75
|
+
var _a;
|
|
76
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const QUERY = `
|
|
78
|
+
query project($id: String!) {
|
|
79
|
+
project(id: $id) {
|
|
80
|
+
id
|
|
81
|
+
name
|
|
82
|
+
client
|
|
83
|
+
users {
|
|
84
|
+
id
|
|
85
|
+
connectionId
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
const response = yield this.client.query(QUERY, {
|
|
91
|
+
id: projectId,
|
|
92
|
+
});
|
|
93
|
+
const project = response.project;
|
|
94
|
+
if (project === undefined || project === null) {
|
|
95
|
+
throw new core_1.SdkError(core_1.SdkErrorType.USER_NOT_EXIST);
|
|
96
|
+
}
|
|
97
|
+
return (((_a = project.users) === null || _a === void 0 ? void 0 : _a.map(user => ({
|
|
98
|
+
id: user.id || '-',
|
|
99
|
+
connectionId: user.connectionId || '-',
|
|
100
|
+
}))) || []);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.default = UsersDatasourceImpl;
|
|
105
|
+
//# sourceMappingURL=users_datasource_impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users_datasource_impl.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/datasources/users_datasource_impl.ts"],"names":[],"mappings":";;;AAAA,4CAA0E;AAU1E,MAAqB,mBAAmB;IACtC,YACmB,MAAqB,EACrB,MAAqB;QADrB,WAAM,GAAN,MAAM,CAAe;QACrB,WAAM,GAAN,MAAM,CAAe;IACrC,CAAC;IAEE,UAAU,CAAC,OAA0B;;;YACzC,MAAM,QAAQ,GAAG;;;;;;;KAOhB,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAqB,QAAQ,EAAE;gBACtE,KAAK,EAAE,OAAO;aACf,CAAC,CAAC;YAEH,OAAO;gBACL,EAAE,EAAE,CAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,EAAE,KAAI,GAAG;gBAClC,YAAY,EAAE,CAAA,MAAA,QAAQ,CAAC,UAAU,0CAAE,YAAY,KAAI,GAAG;gBACtD,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,EAAE;aAChB,CAAC;;KACH;IAEK,qBAAqB,CACzB,YAAoB,EACpB,SAAiB;;YAEjB,MAAM,KAAK,GAAG;;;;;;;KAOb,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtC,KAAK,EACL,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,CACrD,CAAC;YAEF,MAAM,SAAS,GAAG,QAAQ,CAAC,kBAAkB,CAAC;YAE9C,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE;gBACjD,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,cAAc,CAAC,CAAC;aACjD;YAED,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG;gBACvB,YAAY,EAAE,SAAS,CAAC,YAAY,IAAI,GAAG;gBAC3C,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,EAAE;aAChB,CAAC;QACJ,CAAC;KAAA;IAEK,OAAO,CAAC,YAAoB;;YAChC,MAAM,KAAK,GAAG;;;;;;KAMb,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAErC,KAAK,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;YAE5B,MAAM,SAAS,GAAG,QAAQ,CAAC,kBAAkB,CAAC;YAE9C,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE;gBACjD,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,cAAc,CAAC,CAAC;aACjD;YAED,OAAO,SAAS,CAAC,EAAE,IAAI,GAAG,CAAC;QAC7B,CAAC;KAAA;IAEK,WAAW,CACf,SAAiB;;;YAEjB,MAAM,KAAK,GAAG;;;;;;;;;;;;KAYb,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAsB,KAAK,EAAE;gBACnE,EAAE,EAAE,SAAS;aACd,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;YAEjC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE;gBAC7C,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,cAAc,CAAC,CAAC;aACjD;YAED,OAAO,CACL,CAAA,MAAA,OAAO,CAAC,KAAK,0CAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC1B,EAAE,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;gBAClB,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,GAAG;aACvC,CAAC,CAAC,KAAI,EAAE,CACV,CAAC;;KACH;CACF;AAtHD,sCAsHC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InfoselSdkManager } from '@infosel-sdk/core';
|
|
2
|
+
import UsersComponent from '../../domain/di/users_component';
|
|
3
|
+
import { CreateUserRequest } from '../../domain/entities/create_user_request';
|
|
4
|
+
import { User } from '../../domain/entities/user';
|
|
5
|
+
export default class InfoselUsers implements UsersComponent {
|
|
6
|
+
private readonly module;
|
|
7
|
+
private _createUser?;
|
|
8
|
+
private _getUserByConnectionId?;
|
|
9
|
+
private _getUser?;
|
|
10
|
+
private _getAllUsers?;
|
|
11
|
+
private constructor();
|
|
12
|
+
static init({ sdkManager, }: {
|
|
13
|
+
readonly sdkManager: InfoselSdkManager;
|
|
14
|
+
}): InfoselUsers;
|
|
15
|
+
createUser(request: CreateUserRequest): Promise<User>;
|
|
16
|
+
getUserByConnectionId(connectionId: string, projectId: string): Promise<User>;
|
|
17
|
+
getUser(connectionId: string): Promise<string>;
|
|
18
|
+
getAllUsers(projectId: string): Promise<{
|
|
19
|
+
id: string;
|
|
20
|
+
connectionId: string;
|
|
21
|
+
}[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const infosel_users_module_1 = tslib_1.__importDefault(require("./infosel_users_module"));
|
|
5
|
+
const create_user_use_case_1 = tslib_1.__importDefault(require("../../domain/use_cases/create_user_use_case"));
|
|
6
|
+
const get_all_users_use_case_1 = tslib_1.__importDefault(require("../../domain/use_cases/get_all_users_use_case"));
|
|
7
|
+
const get_user_by_connection_id_use_case_1 = tslib_1.__importDefault(require("../../domain/use_cases/get_user_by_connection_id_use_case"));
|
|
8
|
+
const get_user_use_case_1 = tslib_1.__importDefault(require("../../domain/use_cases/get_user_use_case"));
|
|
9
|
+
class InfoselUsers {
|
|
10
|
+
constructor(module) {
|
|
11
|
+
this.module = module;
|
|
12
|
+
}
|
|
13
|
+
static init({ sdkManager, }) {
|
|
14
|
+
switch (sdkManager.mode) {
|
|
15
|
+
case 'qa': {
|
|
16
|
+
const markets = new infosel_users_module_1.default({
|
|
17
|
+
widgetsUrl: 'https://api-qa.infosel.com/widgets/graphql',
|
|
18
|
+
}, sdkManager);
|
|
19
|
+
return new InfoselUsers(markets);
|
|
20
|
+
}
|
|
21
|
+
case 'preprod': {
|
|
22
|
+
const markets = new infosel_users_module_1.default({
|
|
23
|
+
widgetsUrl: 'https://api-pre.infosel.com/widgets/graphql',
|
|
24
|
+
}, sdkManager);
|
|
25
|
+
return new InfoselUsers(markets);
|
|
26
|
+
}
|
|
27
|
+
case 'prod': {
|
|
28
|
+
const markets = new infosel_users_module_1.default({
|
|
29
|
+
widgetsUrl: 'https://api.infosel.com/widgets/graphql',
|
|
30
|
+
}, sdkManager);
|
|
31
|
+
return new InfoselUsers(markets);
|
|
32
|
+
}
|
|
33
|
+
default: {
|
|
34
|
+
throw new Error(`Unsupported SDK mode: ${sdkManager.mode}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
createUser(request) {
|
|
39
|
+
if (!this._createUser) {
|
|
40
|
+
this._createUser = new create_user_use_case_1.default(this.module.repository);
|
|
41
|
+
}
|
|
42
|
+
return this._createUser.execute(request);
|
|
43
|
+
}
|
|
44
|
+
getUserByConnectionId(connectionId, projectId) {
|
|
45
|
+
if (!this._getUserByConnectionId) {
|
|
46
|
+
this._getUserByConnectionId = new get_user_by_connection_id_use_case_1.default(this.module.repository);
|
|
47
|
+
}
|
|
48
|
+
return this._getUserByConnectionId.execute({ connectionId, projectId });
|
|
49
|
+
}
|
|
50
|
+
getUser(connectionId) {
|
|
51
|
+
if (!this._getUser) {
|
|
52
|
+
this._getUser = new get_user_use_case_1.default(this.module.repository);
|
|
53
|
+
}
|
|
54
|
+
return this._getUser.execute(connectionId);
|
|
55
|
+
}
|
|
56
|
+
getAllUsers(projectId) {
|
|
57
|
+
if (!this._getAllUsers) {
|
|
58
|
+
this._getAllUsers = new get_all_users_use_case_1.default(this.module.repository);
|
|
59
|
+
}
|
|
60
|
+
return this._getAllUsers.execute(projectId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.default = InfoselUsers;
|
|
64
|
+
//# sourceMappingURL=infosel_users_component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infosel_users_component.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/di/infosel_users_component.ts"],"names":[],"mappings":";;;AAEA,0FAAwD;AAKxD,+GAA4E;AAC5E,mHAA+E;AAC/E,2IAAqG;AACrG,yGAAsE;AAEtE,MAAqB,YAAY;IAM/B,YAAqC,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAErD,MAAM,CAAC,IAAI,CAAC,EACjB,UAAU,GAGX;QACC,QAAQ,UAAU,CAAC,IAAI,EAAE;YACvB,KAAK,IAAI,CAAC,CAAC;gBACT,MAAM,OAAO,GAAG,IAAI,8BAAkB,CACpC;oBACE,UAAU,EAAE,4CAA4C;iBACzD,EACD,UAAU,CACX,CAAC;gBACF,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;aAClC;YACD,KAAK,SAAS,CAAC,CAAC;gBACd,MAAM,OAAO,GAAG,IAAI,8BAAkB,CACpC;oBACE,UAAU,EAAE,6CAA6C;iBAC1D,EACD,UAAU,CACX,CAAC;gBACF,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;aAClC;YACD,KAAK,MAAM,CAAC,CAAC;gBACX,MAAM,OAAO,GAAG,IAAI,8BAAkB,CACpC;oBACE,UAAU,EAAE,yCAAyC;iBACtD,EACD,UAAU,CACX,CAAC;gBACF,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;aAClC;YACD,OAAO,CAAC,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,yBAAyB,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;aAC7D;SACF;IACH,CAAC;IAED,UAAU,CAAC,OAA0B;QACnC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,IAAI,8BAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SAClE;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,qBAAqB,CACnB,YAAoB,EACpB,SAAiB;QAEjB,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE;YAChC,IAAI,CAAC,sBAAsB,GAAG,IAAI,4CAA4B,CAC5D,IAAI,CAAC,MAAM,CAAC,UAAU,CACvB,CAAC;SACH;QACD,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CAAC,YAAoB;QAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SAC5D;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;IAED,WAAW,CACT,SAAiB;QAEjB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,gCAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;SACpE;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF;AAjFD,+BAiFC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GraphQlClient, InfoselSdkManager } from '@infosel-sdk/core';
|
|
2
|
+
import UsersDatasource from '../../domain/datasources/users_datasource';
|
|
3
|
+
import UsersModule from '../../domain/di/users_module';
|
|
4
|
+
import UsersRepository from '../../domain/repositories/users_repository';
|
|
5
|
+
export default class InfoselUsersModule implements UsersModule {
|
|
6
|
+
private readonly config;
|
|
7
|
+
private readonly sdkManager;
|
|
8
|
+
private _graphQlClient?;
|
|
9
|
+
private _datasource?;
|
|
10
|
+
private _repository?;
|
|
11
|
+
constructor(config: {
|
|
12
|
+
readonly widgetsUrl: string;
|
|
13
|
+
}, sdkManager: InfoselSdkManager);
|
|
14
|
+
get graphQlClient(): GraphQlClient;
|
|
15
|
+
get datasource(): UsersDatasource;
|
|
16
|
+
get repository(): UsersRepository;
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@infosel-sdk/core");
|
|
5
|
+
const widgets_1 = require("@infosel-sdk/widgets");
|
|
6
|
+
const users_datasource_impl_1 = tslib_1.__importDefault(require("../datasources/users_datasource_impl"));
|
|
7
|
+
const users_repository_impl_1 = tslib_1.__importDefault(require("../repositories/users_repository_impl"));
|
|
8
|
+
class InfoselUsersModule {
|
|
9
|
+
constructor(config, sdkManager) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.sdkManager = sdkManager;
|
|
12
|
+
}
|
|
13
|
+
get graphQlClient() {
|
|
14
|
+
if (!this._graphQlClient) {
|
|
15
|
+
this._graphQlClient = core_1.InfoselGraphQlClient.newInstance(this.config.widgetsUrl, this.sdkManager);
|
|
16
|
+
}
|
|
17
|
+
return this._graphQlClient;
|
|
18
|
+
}
|
|
19
|
+
get datasource() {
|
|
20
|
+
if (!this._datasource) {
|
|
21
|
+
const mapper = new widgets_1.WidgetsMapperImpl();
|
|
22
|
+
this._datasource = new users_datasource_impl_1.default(this.graphQlClient, mapper);
|
|
23
|
+
}
|
|
24
|
+
return this._datasource;
|
|
25
|
+
}
|
|
26
|
+
get repository() {
|
|
27
|
+
if (!this._repository) {
|
|
28
|
+
this._repository = new users_repository_impl_1.default(this.datasource);
|
|
29
|
+
}
|
|
30
|
+
return this._repository;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = InfoselUsersModule;
|
|
34
|
+
//# sourceMappingURL=infosel_users_module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infosel_users_module.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/di/infosel_users_module.ts"],"names":[],"mappings":";;;AAAA,4CAI2B;AAC3B,kDAAwE;AAKxE,yGAAuE;AACvE,0GAAwE;AAExE,MAAqB,kBAAkB;IAOrC,YACmB,MAEhB,EACgB,UAA6B;QAH7B,WAAM,GAAN,MAAM,CAEtB;QACgB,eAAU,GAAV,UAAU,CAAmB;IAC7C,CAAC;IAEJ,IAAI,aAAa;QACf,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,IAAI,CAAC,cAAc,GAAG,2BAAoB,CAAC,WAAW,CACpD,IAAI,CAAC,MAAM,CAAC,UAAU,EACtB,IAAI,CAAC,UAAU,CAChB,CAAC;SACH;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,MAAM,GAAkB,IAAI,2BAAiB,EAAE,CAAC;YACtD,IAAI,CAAC,WAAW,GAAG,IAAI,+BAAmB,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;SACxE;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,UAAU;QACZ,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,IAAI,+BAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AAtCD,qCAsCC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WidgetModel } from '@infosel-sdk/widgets';
|
|
2
|
+
export default interface CreateUserResponse {
|
|
3
|
+
readonly createUser?: {
|
|
4
|
+
readonly id?: string;
|
|
5
|
+
readonly connectionId?: string;
|
|
6
|
+
readonly workspaces?: {
|
|
7
|
+
readonly id?: null | string;
|
|
8
|
+
readonly name?: null | string;
|
|
9
|
+
readonly widgets?: null | WidgetModel[];
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_user_response.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/models/create_user_response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_all_users_response.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/models/get_all_users_response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WidgetModel } from '@infosel-sdk/widgets';
|
|
2
|
+
export default interface UserByConnectionIdResponse {
|
|
3
|
+
readonly userByConnectionId?: {
|
|
4
|
+
readonly id?: string;
|
|
5
|
+
readonly connectionId?: string;
|
|
6
|
+
readonly workspaces?: {
|
|
7
|
+
readonly id?: null | string;
|
|
8
|
+
readonly name?: null | string;
|
|
9
|
+
readonly widgets?: null | WidgetModel[];
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user_by_connection_id_response.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/models/user_by_connection_id_response.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import UsersDatasource from '../../domain/datasources/users_datasource';
|
|
2
|
+
import { CreateUserRequest } from '../../domain/entities/create_user_request';
|
|
3
|
+
import { User } from '../../domain/entities/user';
|
|
4
|
+
import UsersRepository from '../../domain/repositories/users_repository';
|
|
5
|
+
export default class UsersRepositoryImpl implements UsersRepository {
|
|
6
|
+
private readonly datasource;
|
|
7
|
+
constructor(datasource: UsersDatasource);
|
|
8
|
+
createUser(request: CreateUserRequest): Promise<User>;
|
|
9
|
+
getUserByConnectionId(connectionId: string, projectId: string): Promise<User>;
|
|
10
|
+
getUser(connectionId: string): Promise<string>;
|
|
11
|
+
getAllUsers(projectId: string): Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
connectionId: string;
|
|
14
|
+
}[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class UsersRepositoryImpl {
|
|
4
|
+
constructor(datasource) {
|
|
5
|
+
this.datasource = datasource;
|
|
6
|
+
}
|
|
7
|
+
createUser(request) {
|
|
8
|
+
return this.datasource.createUser(request);
|
|
9
|
+
}
|
|
10
|
+
getUserByConnectionId(connectionId, projectId) {
|
|
11
|
+
return this.datasource.getUserByConnectionId(connectionId, projectId);
|
|
12
|
+
}
|
|
13
|
+
getUser(connectionId) {
|
|
14
|
+
return this.datasource.getUser(connectionId);
|
|
15
|
+
}
|
|
16
|
+
getAllUsers(projectId) {
|
|
17
|
+
return this.datasource.getAllUsers(projectId);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = UsersRepositoryImpl;
|
|
21
|
+
//# sourceMappingURL=users_repository_impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users_repository_impl.js","sourceRoot":"","sources":["../../../../../../packages/users/src/data/repositories/users_repository_impl.ts"],"names":[],"mappings":";;AAKA,MAAqB,mBAAmB;IACtC,YAA6B,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAE5D,UAAU,CAAC,OAA0B;QACnC,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,qBAAqB,CACnB,YAAoB,EACpB,SAAiB;QAEjB,OAAO,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,CAAC,YAAoB;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,WAAW,CACT,SAAiB;QAEjB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;CACF;AAvBD,sCAuBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CreateUserRequest } from '../entities/create_user_request';
|
|
2
|
+
import { User } from '../entities/user';
|
|
3
|
+
export default interface UsersDatasource {
|
|
4
|
+
createUser(request: CreateUserRequest): Promise<User>;
|
|
5
|
+
getUserByConnectionId(connectionId: string, projectId: string): Promise<User>;
|
|
6
|
+
getUser(connectionId: string): Promise<string>;
|
|
7
|
+
getAllUsers(projectId: string): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
connectionId: string;
|
|
10
|
+
}[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users_datasource.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/datasources/users_datasource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CreateUserRequest } from '../entities/create_user_request';
|
|
2
|
+
import { User } from '../entities/user';
|
|
3
|
+
export default interface UsersComponent {
|
|
4
|
+
createUser(request: CreateUserRequest): Promise<User>;
|
|
5
|
+
getUserByConnectionId(connectionId: string, projectId: string): Promise<User>;
|
|
6
|
+
getUser(connectionId: string): Promise<string>;
|
|
7
|
+
getAllUsers(projectId: string): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
connectionId: string;
|
|
10
|
+
}[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users_component.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/di/users_component.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphQlClient } from '@infosel-sdk/core';
|
|
2
|
+
import UsersDatasource from '../datasources/users_datasource';
|
|
3
|
+
import UsersRepository from '../repositories/users_repository';
|
|
4
|
+
export default interface UsersModule {
|
|
5
|
+
readonly graphQlClient: GraphQlClient;
|
|
6
|
+
readonly datasource: UsersDatasource;
|
|
7
|
+
readonly repository: UsersRepository;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users_module.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/di/users_module.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_user_request.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/entities/create_user_request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InstrumentsContainer, WidgetsContainer, Workspace } from '@infosel-sdk/widgets';
|
|
2
|
+
export interface User {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly connectionId: string;
|
|
5
|
+
readonly workspaces: Workspace[];
|
|
6
|
+
readonly widgets: WidgetsContainer;
|
|
7
|
+
readonly instruments: InstrumentsContainer;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/entities/user.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CreateUserRequest } from '../entities/create_user_request';
|
|
2
|
+
import { User } from '../entities/user';
|
|
3
|
+
export default interface UsersRepository {
|
|
4
|
+
createUser(request: CreateUserRequest): Promise<User>;
|
|
5
|
+
getUserByConnectionId(connectionId: string, projectId: string): Promise<User>;
|
|
6
|
+
getUser(connectionId: string): Promise<string>;
|
|
7
|
+
getAllUsers(projectId: string): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
connectionId: string;
|
|
10
|
+
}[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users_repository.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/repositories/users_repository.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseUseCase } from '@infosel-sdk/core';
|
|
2
|
+
import { CreateUserRequest } from '../entities/create_user_request';
|
|
3
|
+
import { User } from '../entities/user';
|
|
4
|
+
import UsersRepository from '../repositories/users_repository';
|
|
5
|
+
export default class CreateUserUseCase implements BaseUseCase<CreateUserRequest, User> {
|
|
6
|
+
private readonly repository;
|
|
7
|
+
constructor(repository: UsersRepository);
|
|
8
|
+
execute(request?: CreateUserRequest): Promise<User>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@infosel-sdk/core");
|
|
5
|
+
class CreateUserUseCase {
|
|
6
|
+
constructor(repository) {
|
|
7
|
+
this.repository = repository;
|
|
8
|
+
}
|
|
9
|
+
execute(request) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
if (!request) {
|
|
12
|
+
throw new core_1.SdkError(core_1.SdkErrorType.REQUEST_OBJECT_IS_REQUIRED);
|
|
13
|
+
}
|
|
14
|
+
if (!request.projectId) {
|
|
15
|
+
throw new core_1.SdkError(core_1.SdkErrorType.INVALID_PROJECT_ID);
|
|
16
|
+
}
|
|
17
|
+
if (!request.connectionId) {
|
|
18
|
+
throw new core_1.SdkError(core_1.SdkErrorType.INVALID_CONNECTION_ID);
|
|
19
|
+
}
|
|
20
|
+
return yield this.repository.createUser(request);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = CreateUserUseCase;
|
|
25
|
+
//# sourceMappingURL=create_user_use_case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_user_use_case.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/use_cases/create_user_use_case.ts"],"names":[],"mappings":";;;AAAA,4CAAwE;AAMxE,MAAqB,iBAAiB;IAGpC,YAA6B,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAEtD,OAAO,CAAC,OAA2B;;YACvC,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,0BAA0B,CAAC,CAAC;aAC7D;YAED,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;gBACtB,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,kBAAkB,CAAC,CAAC;aACrD;YAED,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE;gBACzB,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,qBAAqB,CAAC,CAAC;aACxD;YAED,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC;KAAA;CACF;AApBD,oCAoBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import UsersRepository from '../repositories/users_repository';
|
|
2
|
+
export default class GetAllUsersUseCase {
|
|
3
|
+
private readonly repository;
|
|
4
|
+
constructor(repository: UsersRepository);
|
|
5
|
+
execute(projectId: string): Promise<{
|
|
6
|
+
id: string;
|
|
7
|
+
connectionId: string;
|
|
8
|
+
}[]>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
class GetAllUsersUseCase {
|
|
5
|
+
constructor(repository) {
|
|
6
|
+
this.repository = repository;
|
|
7
|
+
}
|
|
8
|
+
execute(projectId) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
return this.repository.getAllUsers(projectId);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = GetAllUsersUseCase;
|
|
15
|
+
//# sourceMappingURL=get_all_users_use_case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_all_users_use_case.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/use_cases/get_all_users_use_case.ts"],"names":[],"mappings":";;;AAEA,MAAqB,kBAAkB;IACrC,YAA6B,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAEtD,OAAO,CACX,SAAiB;;YAEjB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAChD,CAAC;KAAA;CACF;AARD,qCAQC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseUseCase } from '@infosel-sdk/core';
|
|
2
|
+
import { User } from '../entities/user';
|
|
3
|
+
import UsersRepository from '../repositories/users_repository';
|
|
4
|
+
export interface GetUserByConnectionIdRequest {
|
|
5
|
+
connectionId: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
}
|
|
8
|
+
export default class GetUserByConnectionIdUseCase implements BaseUseCase<GetUserByConnectionIdRequest, User> {
|
|
9
|
+
private readonly repository;
|
|
10
|
+
constructor(repository: UsersRepository);
|
|
11
|
+
execute(request?: GetUserByConnectionIdRequest): Promise<User>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@infosel-sdk/core");
|
|
5
|
+
class GetUserByConnectionIdUseCase {
|
|
6
|
+
constructor(repository) {
|
|
7
|
+
this.repository = repository;
|
|
8
|
+
}
|
|
9
|
+
execute(request) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
if (!request || !request.connectionId || !request.projectId) {
|
|
12
|
+
throw new core_1.SdkError(core_1.SdkErrorType.INVALID_CONNECTION_ID);
|
|
13
|
+
}
|
|
14
|
+
return yield this.repository.getUserByConnectionId(request.connectionId, request.projectId);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = GetUserByConnectionIdUseCase;
|
|
19
|
+
//# sourceMappingURL=get_user_by_connection_id_use_case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_user_by_connection_id_use_case.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/use_cases/get_user_by_connection_id_use_case.ts"],"names":[],"mappings":";;;AAAA,4CAAwE;AAUxE,MAAqB,4BAA4B;IAG/C,YAA6B,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAEtD,OAAO,CAAC,OAAsC;;YAClD,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;gBAC3D,MAAM,IAAI,eAAQ,CAAC,mBAAY,CAAC,qBAAqB,CAAC,CAAC;aACxD;YACD,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAChD,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,SAAS,CAClB,CAAC;QACJ,CAAC;KAAA;CACF;AAdD,+CAcC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
class GetUserUseCase {
|
|
5
|
+
constructor(repository) {
|
|
6
|
+
this.repository = repository;
|
|
7
|
+
}
|
|
8
|
+
execute(connectionId) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
return this.repository.getUser(connectionId);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = GetUserUseCase;
|
|
15
|
+
//# sourceMappingURL=get_user_use_case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_user_use_case.js","sourceRoot":"","sources":["../../../../../../packages/users/src/domain/use_cases/get_user_use_case.ts"],"names":[],"mappings":";;;AAEA,MAAqB,cAAc;IACjC,YAA6B,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAEtD,OAAO,CAAC,YAAoB;;YAChC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC;KAAA;CACF;AAND,iCAMC"}
|
package/src/index.d.ts
ADDED
package/src/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const infosel_users_component_1 = tslib_1.__importDefault(require("./data/di/infosel_users_component"));
|
|
5
|
+
exports.default = infosel_users_component_1.default;
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/users/src/index.ts"],"names":[],"mappings":";;;AAAA,wGAA6D;AAK7D,kBAAe,iCAAY,CAAC"}
|