@kosha-ai/server 0.0.6 → 1.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/dist/auth/api-key.guard.d.ts +7 -2
- package/dist/auth/api-key.guard.d.ts.map +1 -1
- package/dist/auth/api-key.guard.js +28 -8
- package/dist/auth/auth.factory.d.ts +15 -1
- package/dist/auth/auth.factory.d.ts.map +1 -1
- package/dist/auth/auth.factory.js +48 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +24 -6
- package/dist/config/kosha-config.d.ts +21 -0
- package/dist/config/kosha-config.d.ts.map +1 -1
- package/dist/config/kosha-config.js +31 -2
- package/dist/configurations/configurations.controller.d.ts +11 -136
- package/dist/configurations/configurations.controller.d.ts.map +1 -1
- package/dist/configurations/configurations.controller.js +58 -25
- package/dist/configurations/configurations.module.d.ts.map +1 -1
- package/dist/configurations/configurations.module.js +4 -1
- package/dist/configurations/configurations.repository.d.ts +43 -0
- package/dist/configurations/configurations.repository.d.ts.map +1 -0
- package/dist/configurations/configurations.repository.js +76 -0
- package/dist/configurations/configurations.service.d.ts +38 -194
- package/dist/configurations/configurations.service.d.ts.map +1 -1
- package/dist/configurations/configurations.service.js +118 -110
- package/dist/configurations/dto/create-configuration.dto.d.ts +8 -0
- package/dist/configurations/dto/create-configuration.dto.d.ts.map +1 -0
- package/dist/configurations/dto/create-configuration.dto.js +54 -0
- package/dist/configurations/dto/update-configuration.dto.d.ts +7 -0
- package/dist/configurations/dto/update-configuration.dto.d.ts.map +1 -0
- package/dist/configurations/dto/update-configuration.dto.js +39 -0
- package/dist/connect/connect.controller.d.ts +6 -8
- package/dist/connect/connect.controller.d.ts.map +1 -1
- package/dist/connect/connect.controller.js +45 -15
- package/dist/connect/connect.module.d.ts.map +1 -1
- package/dist/connect/connect.module.js +4 -2
- package/dist/connect/connect.repository.d.ts +78 -0
- package/dist/connect/connect.repository.d.ts.map +1 -0
- package/dist/connect/connect.repository.js +146 -0
- package/dist/connect/connect.service.d.ts +28 -19
- package/dist/connect/connect.service.d.ts.map +1 -1
- package/dist/connect/connect.service.js +149 -163
- package/dist/connect/dto/create-connect-session.dto.d.ts +8 -0
- package/dist/connect/dto/create-connect-session.dto.d.ts.map +1 -0
- package/dist/connect/dto/create-connect-session.dto.js +55 -0
- package/dist/connect/dto/create-test-session.dto.d.ts +10 -0
- package/dist/connect/dto/create-test-session.dto.d.ts.map +1 -0
- package/dist/connect/dto/create-test-session.dto.js +34 -0
- package/dist/connections/connections.controller.d.ts +8 -61
- package/dist/connections/connections.controller.d.ts.map +1 -1
- package/dist/connections/connections.controller.js +31 -9
- package/dist/connections/connections.module.d.ts.map +1 -1
- package/dist/connections/connections.module.js +4 -1
- package/dist/connections/connections.repository.d.ts +24 -0
- package/dist/connections/connections.repository.d.ts.map +1 -0
- package/dist/connections/connections.repository.js +66 -0
- package/dist/connections/connections.service.d.ts +24 -69
- package/dist/connections/connections.service.d.ts.map +1 -1
- package/dist/connections/connections.service.js +59 -56
- package/dist/connections/dto/list-connections.dto.d.ts +5 -0
- package/dist/connections/dto/list-connections.dto.d.ts.map +1 -0
- package/dist/connections/dto/list-connections.dto.js +25 -0
- package/dist/connections/environment-connections.controller.d.ts +26 -0
- package/dist/connections/environment-connections.controller.d.ts.map +1 -0
- package/dist/connections/environment-connections.controller.js +81 -0
- package/dist/connections/environment-connections.module.d.ts +11 -0
- package/dist/connections/environment-connections.module.d.ts.map +1 -0
- package/dist/connections/environment-connections.module.js +21 -0
- package/dist/credentials/credentials.module.d.ts +3 -0
- package/dist/credentials/credentials.module.d.ts.map +1 -0
- package/dist/credentials/credentials.module.js +15 -0
- package/dist/credentials/credentials.repository.d.ts +8 -0
- package/dist/credentials/credentials.repository.d.ts.map +1 -0
- package/dist/credentials/credentials.repository.js +21 -0
- package/dist/credentials/credentials.service.d.ts +45 -0
- package/dist/credentials/credentials.service.d.ts.map +1 -0
- package/dist/credentials/credentials.service.js +135 -0
- package/dist/crypto/credential-envelope.d.ts +56 -0
- package/dist/crypto/credential-envelope.d.ts.map +1 -0
- package/dist/crypto/credential-envelope.js +70 -0
- package/dist/crypto/crypto.service.d.ts +8 -0
- package/dist/crypto/crypto.service.d.ts.map +1 -1
- package/dist/crypto/crypto.service.js +12 -0
- package/dist/egress/ca.service.d.ts +36 -0
- package/dist/egress/ca.service.d.ts.map +1 -0
- package/dist/egress/ca.service.js +117 -0
- package/dist/egress/dto/mint-grant.dto.d.ts +7 -0
- package/dist/egress/dto/mint-grant.dto.d.ts.map +1 -0
- package/dist/egress/dto/mint-grant.dto.js +44 -0
- package/dist/egress/egress.controller.d.ts +18 -0
- package/dist/egress/egress.controller.d.ts.map +1 -0
- package/dist/egress/egress.controller.js +80 -0
- package/dist/egress/egress.listener.d.ts +39 -0
- package/dist/egress/egress.listener.d.ts.map +1 -0
- package/dist/egress/egress.listener.js +328 -0
- package/dist/egress/egress.module.d.ts +7 -0
- package/dist/egress/egress.module.d.ts.map +1 -0
- package/dist/egress/egress.module.js +31 -0
- package/dist/egress/egress.repository.d.ts +58 -0
- package/dist/egress/egress.repository.d.ts.map +1 -0
- package/dist/egress/egress.repository.js +116 -0
- package/dist/egress/grants.service.d.ts +77 -0
- package/dist/egress/grants.service.d.ts.map +1 -0
- package/dist/egress/grants.service.js +159 -0
- package/dist/egress/host-rules.service.d.ts +35 -0
- package/dist/egress/host-rules.service.d.ts.map +1 -0
- package/dist/egress/host-rules.service.js +48 -0
- package/dist/environments/dto/create-environment.dto.d.ts +6 -0
- package/dist/environments/dto/create-environment.dto.d.ts.map +1 -0
- package/dist/environments/dto/create-environment.dto.js +34 -0
- package/dist/environments/dto/update-environment.dto.d.ts +5 -0
- package/dist/environments/dto/update-environment.dto.d.ts.map +1 -0
- package/dist/environments/dto/update-environment.dto.js +24 -0
- package/dist/environments/environments.controller.d.ts +53 -0
- package/dist/environments/environments.controller.d.ts.map +1 -0
- package/dist/environments/environments.controller.js +101 -0
- package/dist/environments/environments.module.d.ts +3 -0
- package/dist/environments/environments.module.d.ts.map +1 -0
- package/dist/environments/environments.module.js +15 -0
- package/dist/environments/environments.repository.d.ts +37 -0
- package/dist/environments/environments.repository.d.ts.map +1 -0
- package/dist/environments/environments.repository.js +82 -0
- package/dist/environments/environments.service.d.ts +43 -0
- package/dist/environments/environments.service.d.ts.map +1 -0
- package/dist/environments/environments.service.js +124 -0
- package/dist/generated/prisma/browser.d.ts +17 -35
- package/dist/generated/prisma/browser.d.ts.map +1 -1
- package/dist/generated/prisma/client.d.ts +17 -35
- package/dist/generated/prisma/client.d.ts.map +1 -1
- package/dist/generated/prisma/commonInputTypes.d.ts +104 -145
- package/dist/generated/prisma/commonInputTypes.d.ts.map +1 -1
- package/dist/generated/prisma/enums.d.ts +1 -21
- package/dist/generated/prisma/enums.d.ts.map +1 -1
- package/dist/generated/prisma/enums.js +1 -18
- package/dist/generated/prisma/internal/class.d.ts +24 -46
- package/dist/generated/prisma/internal/class.d.ts.map +1 -1
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +258 -472
- package/dist/generated/prisma/internal/prismaNamespace.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +45 -83
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +45 -85
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +45 -83
- package/dist/generated/prisma/models/Account.d.ts +344 -26
- package/dist/generated/prisma/models/Account.d.ts.map +1 -1
- package/dist/generated/prisma/models/Configuration.d.ts +218 -851
- package/dist/generated/prisma/models/Configuration.d.ts.map +1 -1
- package/dist/generated/prisma/models/EgressGrant.d.ts +1535 -0
- package/dist/generated/prisma/models/EgressGrant.d.ts.map +1 -0
- package/dist/generated/prisma/models/Environment.d.ts +1644 -0
- package/dist/generated/prisma/models/Environment.d.ts.map +1 -0
- package/dist/generated/prisma/models/Invitation.d.ts +42 -1
- package/dist/generated/prisma/models/Invitation.d.ts.map +1 -1
- package/dist/generated/prisma/models/Organization.d.ts +183 -322
- package/dist/generated/prisma/models/Organization.d.ts.map +1 -1
- package/dist/generated/prisma/models/Session.d.ts +36 -1
- package/dist/generated/prisma/models/Session.d.ts.map +1 -1
- package/dist/generated/prisma/models/Team.d.ts +1498 -0
- package/dist/generated/prisma/models/Team.d.ts.map +1 -0
- package/dist/generated/prisma/models/TeamMember.d.ts +1281 -0
- package/dist/generated/prisma/models/TeamMember.d.ts.map +1 -0
- package/dist/generated/prisma/models/User.d.ts +338 -2
- package/dist/generated/prisma/models/User.d.ts.map +1 -1
- package/dist/generated/prisma/models.d.ts +4 -6
- package/dist/generated/prisma/models.d.ts.map +1 -1
- package/dist/index.d.ts +20 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -3
- package/dist/integrations/integrations.controller.d.ts +2 -1
- package/dist/integrations/integrations.controller.d.ts.map +1 -1
- package/dist/integrations/integrations.module.d.ts.map +1 -1
- package/dist/integrations/integrations.module.js +0 -2
- package/dist/kosha.module.d.ts.map +1 -1
- package/dist/kosha.module.js +13 -3
- package/dist/proxy/proxy.controller.d.ts +8 -3
- package/dist/proxy/proxy.controller.d.ts.map +1 -1
- package/dist/proxy/proxy.controller.js +26 -10
- package/dist/proxy/proxy.module.d.ts.map +1 -1
- package/dist/proxy/proxy.module.js +5 -3
- package/dist/proxy/proxy.repository.d.ts +24 -0
- package/dist/proxy/proxy.repository.d.ts.map +1 -0
- package/dist/proxy/proxy.repository.js +47 -0
- package/dist/proxy/proxy.service.d.ts +17 -21
- package/dist/proxy/proxy.service.d.ts.map +1 -1
- package/dist/proxy/proxy.service.js +61 -110
- package/package.json +9 -4
- package/prisma/migrations/20260929101936_init/migration.sql +345 -0
- package/prisma/migrations/20260930102529_connection_config/migration.sql +2 -0
- package/prisma/schema.prisma +103 -178
- package/dist/generated/prisma/models/ConnectSession.d.ts +0 -1606
- package/dist/generated/prisma/models/ConnectSession.d.ts.map +0 -1
- package/dist/generated/prisma/models/Connection.d.ts +0 -1949
- package/dist/generated/prisma/models/Connection.d.ts.map +0 -1
- package/dist/generated/prisma/models/ConnectionCredential.d.ts +0 -1293
- package/dist/generated/prisma/models/ConnectionCredential.d.ts.map +0 -1
- package/dist/generated/prisma/models/EndUser.d.ts +0 -1539
- package/dist/generated/prisma/models/EndUser.d.ts.map +0 -1
- package/dist/generated/prisma/models/OAuthState.d.ts +0 -1404
- package/dist/generated/prisma/models/OAuthState.d.ts.map +0 -1
- package/dist/generated/prisma/models/OAuthState.js +0 -1
- package/dist/generated/prisma/models/Provider.d.ts +0 -1462
- package/dist/generated/prisma/models/Provider.d.ts.map +0 -1
- package/dist/generated/prisma/models/Provider.js +0 -1
- package/dist/integrations/provider-sync.service.d.ts +0 -24
- package/dist/integrations/provider-sync.service.d.ts.map +0 -1
- package/dist/integrations/provider-sync.service.js +0 -74
- package/prisma/migrations/20260908000000_init/migration.sql +0 -209
- package/prisma/migrations/20260908161813_add_connect_domain/migration.sql +0 -173
- package/prisma/migrations/20260916000000_add_configuration_slug/migration.sql +0 -15
- /package/dist/generated/prisma/models/{ConnectSession.js → EgressGrant.js} +0 -0
- /package/dist/generated/prisma/models/{Connection.js → Environment.js} +0 -0
- /package/dist/generated/prisma/models/{ConnectionCredential.js → Team.js} +0 -0
- /package/dist/generated/prisma/models/{EndUser.js → TeamMember.js} +0 -0
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import { BadRequestException, Inject, Injectable, NotFoundException, } from '@nestjs/common';
|
|
2
|
+
import { BadRequestException, ConflictException, Inject, Injectable, NotFoundException, } from '@nestjs/common';
|
|
3
3
|
import { KOSHA_CONFIG } from '../config/tokens.js';
|
|
4
4
|
import { CryptoService } from '../crypto/crypto.service.js';
|
|
5
|
+
import { EnvironmentsService } from '../environments/environments.service.js';
|
|
5
6
|
import { IntegrationRegistry } from '../integrations/integration.registry.js';
|
|
6
|
-
import {
|
|
7
|
-
/** Never selected over the REST API. */
|
|
8
|
-
const PUBLIC_OMIT = { encryptedClientSecret: true };
|
|
7
|
+
import { ConfigurationsRepository } from './configurations.repository.js';
|
|
9
8
|
let ConfigurationsService = class ConfigurationsService {
|
|
10
|
-
|
|
9
|
+
configurations;
|
|
10
|
+
environments;
|
|
11
11
|
crypto;
|
|
12
12
|
registry;
|
|
13
13
|
config;
|
|
14
|
-
constructor(
|
|
15
|
-
this.
|
|
14
|
+
constructor(configurations, environments, crypto, registry, config) {
|
|
15
|
+
this.configurations = configurations;
|
|
16
|
+
this.environments = environments;
|
|
16
17
|
this.crypto = crypto;
|
|
17
18
|
this.registry = registry;
|
|
18
19
|
this.config = config;
|
|
@@ -22,138 +23,133 @@ let ConfigurationsService = class ConfigurationsService {
|
|
|
22
23
|
* `server.publicUrl` so it is stable and inspectable in the admin, rather
|
|
23
24
|
* than being reconstructed per request.
|
|
24
25
|
*/
|
|
25
|
-
callbackUrlFor(
|
|
26
|
+
callbackUrlFor(integrationKey) {
|
|
26
27
|
const { publicUrl, globalPrefix } = this.config.server;
|
|
27
|
-
return `${publicUrl}/${globalPrefix}/connect/callback/${
|
|
28
|
+
return `${publicUrl}/${globalPrefix}/connect/callback/${integrationKey}`;
|
|
28
29
|
}
|
|
29
|
-
list(organizationId) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
include: { provider: true },
|
|
33
|
-
omit: PUBLIC_OMIT,
|
|
34
|
-
orderBy: { createdAt: 'desc' },
|
|
35
|
-
});
|
|
30
|
+
async list(organizationId, userId, environmentId) {
|
|
31
|
+
await this.environments.getForMember(organizationId, userId, environmentId);
|
|
32
|
+
return this.configurations.findManyByEnvironment(environmentId);
|
|
36
33
|
}
|
|
37
|
-
async get(organizationId, id) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
omit: PUBLIC_OMIT,
|
|
42
|
-
});
|
|
43
|
-
if (!configuration) {
|
|
34
|
+
async get(organizationId, userId, environmentId, id) {
|
|
35
|
+
await this.environments.getForMember(organizationId, userId, environmentId);
|
|
36
|
+
const configuration = await this.configurations.findById(environmentId, id);
|
|
37
|
+
if (!configuration)
|
|
44
38
|
throw new NotFoundException('Configuration not found');
|
|
45
|
-
}
|
|
46
39
|
return configuration;
|
|
47
40
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
throw new BadRequestException(`Provider "${input.provider}" has not been synced yet. Restart the server.`);
|
|
63
|
-
}
|
|
64
|
-
const scopes = this.validateScopes(input.provider, input.scopes ?? []);
|
|
65
|
-
const settings = this.validateSettings(input.provider, input.settings);
|
|
66
|
-
const slug = slugify(input.slug ?? input.name);
|
|
41
|
+
/** How a caller's slug resolves, once a key has named the environment. */
|
|
42
|
+
async getBySlug(environmentId, slug) {
|
|
43
|
+
const configuration = await this.configurations.findBySlug(environmentId, slug);
|
|
44
|
+
if (!configuration)
|
|
45
|
+
throw new NotFoundException('Configuration not found');
|
|
46
|
+
return configuration;
|
|
47
|
+
}
|
|
48
|
+
async create(organizationId, userId, environmentId, input) {
|
|
49
|
+
await this.environments.getForMember(organizationId, userId, environmentId);
|
|
50
|
+
// The registry is the authority on what Kosha can talk to, and on which
|
|
51
|
+
// auth type this integration uses. There is no provider table to consult.
|
|
52
|
+
const integration = this.registry.get(input.integrationKey);
|
|
53
|
+
const name = input.name.trim();
|
|
54
|
+
const slug = slugify(input.slug ?? name);
|
|
67
55
|
if (!slug) {
|
|
68
56
|
throw new BadRequestException('slug must contain at least one letter or digit');
|
|
69
57
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
metadata: toJsonInput(settings),
|
|
83
|
-
},
|
|
84
|
-
include: { provider: true },
|
|
85
|
-
omit: PUBLIC_OMIT,
|
|
58
|
+
if (await this.configurations.findBySlug(environmentId, slug)) {
|
|
59
|
+
throw new ConflictException(`A configuration with slug "${slug}" already exists in this environment`);
|
|
60
|
+
}
|
|
61
|
+
const settings = this.validateSettings(input.integrationKey, input.settings);
|
|
62
|
+
return this.configurations.create({
|
|
63
|
+
environmentId,
|
|
64
|
+
integrationKey: integration.key,
|
|
65
|
+
authType: integration.auth.type,
|
|
66
|
+
name,
|
|
67
|
+
slug,
|
|
68
|
+
credentials: this.sealCredentials(input.integrationKey, input.credentials),
|
|
69
|
+
settings: toJsonInput(settings),
|
|
86
70
|
});
|
|
87
71
|
}
|
|
88
|
-
async update(organizationId, id, input) {
|
|
89
|
-
const existing = await this.get(organizationId, id);
|
|
90
|
-
return this.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
? this.crypto.encrypt(input.clientSecret)
|
|
100
|
-
: undefined,
|
|
101
|
-
isEnabled: input.isEnabled,
|
|
102
|
-
metadata: input.settings
|
|
103
|
-
? toJsonInput(this.validateSettings(existing.provider.key, input.settings))
|
|
104
|
-
: undefined,
|
|
105
|
-
},
|
|
106
|
-
include: { provider: true },
|
|
107
|
-
omit: PUBLIC_OMIT,
|
|
72
|
+
async update(organizationId, userId, environmentId, id, input) {
|
|
73
|
+
const existing = await this.get(organizationId, userId, environmentId, id);
|
|
74
|
+
return this.configurations.update(id, {
|
|
75
|
+
name: input.name?.trim(),
|
|
76
|
+
credentials: input.credentials
|
|
77
|
+
? this.sealCredentials(existing.integrationKey, input.credentials)
|
|
78
|
+
: undefined,
|
|
79
|
+
settings: input.settings
|
|
80
|
+
? toJsonInput(this.validateSettings(existing.integrationKey, input.settings))
|
|
81
|
+
: undefined,
|
|
82
|
+
isEnabled: input.isEnabled,
|
|
108
83
|
});
|
|
109
84
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Refused while credentials still point at this row. `account.providerId` is
|
|
87
|
+
* a plain string, so nothing in the database would stop the delete from
|
|
88
|
+
* orphaning them.
|
|
89
|
+
*/
|
|
90
|
+
async remove(organizationId, userId, environmentId, id) {
|
|
91
|
+
await this.get(organizationId, userId, environmentId, id);
|
|
92
|
+
const credentials = await this.configurations.countCredentials(id);
|
|
93
|
+
if (credentials > 0) {
|
|
94
|
+
throw new ConflictException(`${credentials} connection(s) still use this configuration. Disconnect them first.`);
|
|
95
|
+
}
|
|
96
|
+
await this.configurations.delete(id);
|
|
113
97
|
}
|
|
114
98
|
/**
|
|
115
|
-
*
|
|
99
|
+
* Opens the secret half, for the connect and proxy paths only. Never
|
|
116
100
|
* reachable from a controller.
|
|
117
101
|
*/
|
|
118
|
-
async
|
|
119
|
-
const configuration = await this.
|
|
120
|
-
|
|
121
|
-
include: { provider: true },
|
|
122
|
-
});
|
|
123
|
-
if (!configuration) {
|
|
102
|
+
async getWithCredentials(configurationId) {
|
|
103
|
+
const configuration = await this.configurations.findAnyById(configurationId);
|
|
104
|
+
if (!configuration)
|
|
124
105
|
throw new NotFoundException('Configuration not found');
|
|
125
|
-
}
|
|
126
|
-
if (!configuration.encryptedClientSecret) {
|
|
127
|
-
throw new BadRequestException(`Configuration "${configuration.name}" has no client secret stored`);
|
|
128
|
-
}
|
|
129
106
|
return {
|
|
130
|
-
|
|
131
|
-
|
|
107
|
+
configuration,
|
|
108
|
+
credentials: configuration.credentials
|
|
109
|
+
? JSON.parse(this.crypto.decrypt(configuration.credentials))
|
|
110
|
+
: {},
|
|
132
111
|
};
|
|
133
112
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
113
|
+
/**
|
|
114
|
+
* What the auth type needs, encrypted as one blob rather than a column per
|
|
115
|
+
* field — a GitHub App configuration holds an appId and a private key where
|
|
116
|
+
* an OAuth2 one holds a client id and secret, and neither should force a
|
|
117
|
+
* migration on the other.
|
|
118
|
+
*/
|
|
119
|
+
sealCredentials(integrationKey, credentials) {
|
|
120
|
+
const integration = this.registry.get(integrationKey);
|
|
121
|
+
const provided = credentials ?? {};
|
|
122
|
+
if (integration.auth.type === 'OAUTH2') {
|
|
123
|
+
const missing = ['clientId', 'clientSecret'].filter((field) => typeof provided[field] !== 'string' || !provided[field]);
|
|
124
|
+
if (missing.length > 0) {
|
|
125
|
+
throw new BadRequestException(`${integrationKey} is an OAuth2 integration and needs ${missing.join(' and ')}`);
|
|
126
|
+
}
|
|
139
127
|
}
|
|
140
|
-
|
|
128
|
+
if (Object.keys(provided).length === 0)
|
|
129
|
+
return null;
|
|
130
|
+
return this.crypto.encrypt(JSON.stringify(provided));
|
|
141
131
|
}
|
|
142
132
|
/**
|
|
143
133
|
* Checks per-organization settings against the integration's declared
|
|
144
|
-
* `configFields
|
|
145
|
-
*
|
|
134
|
+
* `configFields`, and any scopes against what the provider actually offers.
|
|
135
|
+
* Integrations describe their settings as data so the admin can render a
|
|
136
|
+
* form; the same description is what validates here.
|
|
146
137
|
*/
|
|
147
|
-
validateSettings(
|
|
148
|
-
const
|
|
138
|
+
validateSettings(integrationKey, settings) {
|
|
139
|
+
const integration = this.registry.get(integrationKey);
|
|
140
|
+
const fields = integration.configFields ?? [];
|
|
149
141
|
if (!settings && fields.length === 0)
|
|
150
142
|
return undefined;
|
|
151
|
-
const provided = settings ?? {};
|
|
143
|
+
const provided = { ...(settings ?? {}) };
|
|
152
144
|
const problems = [];
|
|
145
|
+
if ('scopes' in provided) {
|
|
146
|
+
provided['scopes'] = this.validateScopes(integrationKey, provided['scopes']);
|
|
147
|
+
}
|
|
153
148
|
const known = new Map(fields.map((field) => [field.key, field]));
|
|
154
149
|
for (const key of Object.keys(provided)) {
|
|
155
|
-
if (!known.has(key))
|
|
150
|
+
if (key !== 'scopes' && !known.has(key)) {
|
|
156
151
|
problems.push(`unknown setting "${key}"`);
|
|
152
|
+
}
|
|
157
153
|
}
|
|
158
154
|
for (const field of fields) {
|
|
159
155
|
const value = provided[field.key];
|
|
@@ -165,15 +161,27 @@ let ConfigurationsService = class ConfigurationsService {
|
|
|
165
161
|
problems.push(...describeTypeMismatch(field, value));
|
|
166
162
|
}
|
|
167
163
|
if (problems.length > 0) {
|
|
168
|
-
throw new BadRequestException(`Invalid settings for ${
|
|
164
|
+
throw new BadRequestException(`Invalid settings for ${integrationKey}: ${problems.join('; ')}`);
|
|
169
165
|
}
|
|
170
166
|
return provided;
|
|
171
167
|
}
|
|
168
|
+
validateScopes(integrationKey, scopes) {
|
|
169
|
+
if (!Array.isArray(scopes) || scopes.some((s) => typeof s !== 'string')) {
|
|
170
|
+
throw new BadRequestException('scopes must be an array of strings');
|
|
171
|
+
}
|
|
172
|
+
const available = new Set(this.registry.get(integrationKey).auth.scopesAvailable);
|
|
173
|
+
const unknown = scopes.filter((scope) => !available.has(scope));
|
|
174
|
+
if (unknown.length > 0) {
|
|
175
|
+
throw new BadRequestException(`Unknown scope(s) for ${integrationKey}: ${unknown.join(', ')}. Available: ${[...available].join(', ')}`);
|
|
176
|
+
}
|
|
177
|
+
return [...new Set(scopes)];
|
|
178
|
+
}
|
|
172
179
|
};
|
|
173
180
|
ConfigurationsService = __decorate([
|
|
174
181
|
Injectable(),
|
|
175
|
-
__param(
|
|
176
|
-
__metadata("design:paramtypes", [
|
|
182
|
+
__param(4, Inject(KOSHA_CONFIG)),
|
|
183
|
+
__metadata("design:paramtypes", [ConfigurationsRepository,
|
|
184
|
+
EnvironmentsService,
|
|
177
185
|
CryptoService,
|
|
178
186
|
IntegrationRegistry, Object])
|
|
179
187
|
], ConfigurationsService);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-configuration.dto.d.ts","sourceRoot":"","sources":["../../../src/configurations/dto/create-configuration.dto.ts"],"names":[],"mappings":"AASA,qBAAa,sBAAsB;IAQjC,cAAc,EAAG,MAAM,CAAC;IAMxB,IAAI,EAAG,MAAM,CAAC;IAUd,IAAI,CAAC,EAAE,MAAM,CAAC;IASd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAStC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
3
|
+
import { IsObject, IsOptional, IsString, MaxLength, MinLength, } from 'class-validator';
|
|
4
|
+
export class CreateConfigurationDto {
|
|
5
|
+
integrationKey;
|
|
6
|
+
name;
|
|
7
|
+
slug;
|
|
8
|
+
credentials;
|
|
9
|
+
settings;
|
|
10
|
+
}
|
|
11
|
+
__decorate([
|
|
12
|
+
ApiProperty({
|
|
13
|
+
example: 'github',
|
|
14
|
+
description: 'Key of an installed integration package. Validated against the registry.',
|
|
15
|
+
}),
|
|
16
|
+
IsString(),
|
|
17
|
+
MinLength(1),
|
|
18
|
+
__metadata("design:type", String)
|
|
19
|
+
], CreateConfigurationDto.prototype, "integrationKey", void 0);
|
|
20
|
+
__decorate([
|
|
21
|
+
ApiProperty({ example: 'GitHub' }),
|
|
22
|
+
IsString(),
|
|
23
|
+
MinLength(1),
|
|
24
|
+
MaxLength(64),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], CreateConfigurationDto.prototype, "name", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
ApiPropertyOptional({
|
|
29
|
+
example: 'github',
|
|
30
|
+
description: 'Caller-facing handle, quoted on proxy calls. Derived from the name when omitted.',
|
|
31
|
+
}),
|
|
32
|
+
IsOptional(),
|
|
33
|
+
IsString(),
|
|
34
|
+
MaxLength(64),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], CreateConfigurationDto.prototype, "slug", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
ApiPropertyOptional({
|
|
39
|
+
description: 'Secret half, encrypted at rest. Shape is the auth type’s: an OAuth2 integration needs clientId and clientSecret.',
|
|
40
|
+
example: { clientId: 'Iv1.abc', clientSecret: '…' },
|
|
41
|
+
}),
|
|
42
|
+
IsOptional(),
|
|
43
|
+
IsObject(),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], CreateConfigurationDto.prototype, "credentials", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
ApiPropertyOptional({
|
|
48
|
+
description: 'Non-secret half: scopes, and whatever the integration declares as configFields.',
|
|
49
|
+
example: { scopes: ['repo', 'read:user'] },
|
|
50
|
+
}),
|
|
51
|
+
IsOptional(),
|
|
52
|
+
IsObject(),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], CreateConfigurationDto.prototype, "settings", void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-configuration.dto.d.ts","sourceRoot":"","sources":["../../../src/configurations/dto/update-configuration.dto.ts"],"names":[],"mappings":"AAUA,qBAAa,sBAAsB;IAMjC,IAAI,CAAC,EAAE,MAAM,CAAC;IAOd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAKtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAOnC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
3
|
+
import { IsBoolean, IsObject, IsOptional, IsString, MaxLength, MinLength, } from 'class-validator';
|
|
4
|
+
export class UpdateConfigurationDto {
|
|
5
|
+
name;
|
|
6
|
+
credentials;
|
|
7
|
+
settings;
|
|
8
|
+
isEnabled;
|
|
9
|
+
}
|
|
10
|
+
__decorate([
|
|
11
|
+
ApiPropertyOptional({ example: 'GitHub' }),
|
|
12
|
+
IsOptional(),
|
|
13
|
+
IsString(),
|
|
14
|
+
MinLength(1),
|
|
15
|
+
MaxLength(64),
|
|
16
|
+
__metadata("design:type", String)
|
|
17
|
+
], UpdateConfigurationDto.prototype, "name", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
ApiPropertyOptional({
|
|
20
|
+
description: 'Replaces the stored secrets. Omit to leave them alone.',
|
|
21
|
+
}),
|
|
22
|
+
IsOptional(),
|
|
23
|
+
IsObject(),
|
|
24
|
+
__metadata("design:type", Object)
|
|
25
|
+
], UpdateConfigurationDto.prototype, "credentials", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
ApiPropertyOptional({ example: { scopes: ['repo'] } }),
|
|
28
|
+
IsOptional(),
|
|
29
|
+
IsObject(),
|
|
30
|
+
__metadata("design:type", Object)
|
|
31
|
+
], UpdateConfigurationDto.prototype, "settings", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
ApiPropertyOptional({
|
|
34
|
+
description: 'Disable without deleting; stored credentials stay put.',
|
|
35
|
+
}),
|
|
36
|
+
IsOptional(),
|
|
37
|
+
IsBoolean(),
|
|
38
|
+
__metadata("design:type", Boolean)
|
|
39
|
+
], UpdateConfigurationDto.prototype, "isEnabled", void 0);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type UserSession } from '@thallesp/nestjs-better-auth';
|
|
2
2
|
import type { Response } from 'express';
|
|
3
3
|
import { type ApiKeyRequest } from '../auth/api-key.guard.js';
|
|
4
|
-
import { ConnectService
|
|
4
|
+
import { ConnectService } from './connect.service.js';
|
|
5
|
+
import { CreateConnectSessionDto } from './dto/create-connect-session.dto.js';
|
|
6
|
+
import { CreateTestSessionDto } from './dto/create-test-session.dto.js';
|
|
5
7
|
export declare class ConnectController {
|
|
6
8
|
private readonly connect;
|
|
7
9
|
private readonly logger;
|
|
@@ -12,20 +14,16 @@ export declare class ConnectController {
|
|
|
12
14
|
* session. `AllowAnonymous` disables the session guard so `OrgAuthGuard`
|
|
13
15
|
* can authenticate either way.
|
|
14
16
|
*/
|
|
15
|
-
createSession(request: ApiKeyRequest, body:
|
|
17
|
+
createSession(request: ApiKeyRequest, body: CreateConnectSessionDto): Promise<import("./connect.service.js").ConnectSessionResult>;
|
|
16
18
|
/**
|
|
17
19
|
* Admin-only: runs the same flow with the signed-in admin standing in for an
|
|
18
20
|
* end user, so an operator can verify a configuration without wiring up
|
|
19
21
|
* their backend first.
|
|
20
22
|
*/
|
|
21
|
-
createTestSession(session: UserSession, body:
|
|
22
|
-
configurationId?: string;
|
|
23
|
-
slug?: string;
|
|
24
|
-
redirectUrl?: string;
|
|
25
|
-
}): Promise<import("./connect.service.js").ConnectSessionResult>;
|
|
23
|
+
createTestSession(session: UserSession, environmentId: string, body: CreateTestSessionDto): Promise<import("./connect.service.js").ConnectSessionResult>;
|
|
26
24
|
/** The URL the end user's browser opens. Redirects to the provider. */
|
|
27
25
|
start(token: string, res: Response): Promise<void>;
|
|
28
26
|
/** Where the provider sends the end user back. */
|
|
29
|
-
callback(
|
|
27
|
+
callback(integrationKey: string, code: string | undefined, state: string | undefined, providerError: string | undefined, providerErrorDescription: string | undefined, res: Response): Promise<void>;
|
|
30
28
|
}
|
|
31
29
|
//# sourceMappingURL=connect.controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.controller.d.ts","sourceRoot":"","sources":["../../src/connect/connect.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.controller.d.ts","sourceRoot":"","sources":["../../src/connect/connect.controller.ts"],"names":[],"mappings":"AAsBA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,qBAEa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAEhC,OAAO,EAAE,cAAc;IAEpD;;;;;OAKG;IAcH,aAAa,CACJ,OAAO,EAAE,aAAa,EACrB,IAAI,EAAE,uBAAuB;IAevC;;;;OAIG;IAOH,iBAAiB,CACJ,OAAO,EAAE,WAAW,EACP,aAAa,EAAE,MAAM,EACrC,IAAI,EAAE,oBAAoB;IAcpC,uEAAuE;IAIjE,KAAK,CAAiB,KAAK,EAAE,MAAM,EAAS,GAAG,EAAE,QAAQ;IAY/D,kDAAkD;IAI5C,QAAQ,CACa,cAAc,EAAE,MAAM,EAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACvB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,aAAa,EAAE,MAAM,GAAG,SAAS,EACrB,wBAAwB,EAAE,MAAM,GAAG,SAAS,EACjE,GAAG,EAAE,QAAQ;CAuDvB"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
var ConnectController_1;
|
|
2
2
|
import { __decorate, __metadata, __param } from "tslib";
|
|
3
|
-
import { BadRequestException, Body, Controller, Get, Logger, Param, Post, Query, Req, Res, UseGuards, } from '@nestjs/common';
|
|
3
|
+
import { BadRequestException, ConflictException, Body, Controller, Get, Logger, Param, Post, Query, Req, Res, UseGuards, } from '@nestjs/common';
|
|
4
|
+
import { ApiBadRequestResponse, ApiCreatedResponse, ApiExcludeEndpoint, ApiOperation, ApiSecurity, ApiTags, } from '@nestjs/swagger';
|
|
4
5
|
import { AllowAnonymous, Session, } from '@thallesp/nestjs-better-auth';
|
|
5
6
|
import { OrgAuthGuard } from '../auth/api-key.guard.js';
|
|
6
7
|
import { getActiveOrganizationId } from '../common/active-organization.js';
|
|
7
|
-
import { ConnectService
|
|
8
|
+
import { ConnectService } from './connect.service.js';
|
|
9
|
+
import { CreateConnectSessionDto } from './dto/create-connect-session.dto.js';
|
|
10
|
+
import { CreateTestSessionDto } from './dto/create-test-session.dto.js';
|
|
8
11
|
let ConnectController = ConnectController_1 = class ConnectController {
|
|
9
12
|
connect;
|
|
10
13
|
logger = new Logger(ConnectController_1.name);
|
|
@@ -18,16 +21,19 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
18
21
|
* can authenticate either way.
|
|
19
22
|
*/
|
|
20
23
|
createSession(request, body) {
|
|
21
|
-
|
|
24
|
+
if (!request.environmentId) {
|
|
25
|
+
throw new BadRequestException('This route needs an API key, which is what names the environment');
|
|
26
|
+
}
|
|
27
|
+
return this.connect.createSession(request.organizationId, request.environmentId, body);
|
|
22
28
|
}
|
|
23
29
|
/**
|
|
24
30
|
* Admin-only: runs the same flow with the signed-in admin standing in for an
|
|
25
31
|
* end user, so an operator can verify a configuration without wiring up
|
|
26
32
|
* their backend first.
|
|
27
33
|
*/
|
|
28
|
-
createTestSession(session, body) {
|
|
29
|
-
return this.connect.createSession(getActiveOrganizationId(session), {
|
|
30
|
-
|
|
34
|
+
createTestSession(session, environmentId, body) {
|
|
35
|
+
return this.connect.createSession(getActiveOrganizationId(session), environmentId, {
|
|
36
|
+
externalUserId: `kosha-admin:${session.user.id}`,
|
|
31
37
|
configurationId: body?.configurationId,
|
|
32
38
|
configurationSlug: body?.slug,
|
|
33
39
|
redirectUrl: body?.redirectUrl,
|
|
@@ -45,7 +51,7 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
53
|
/** Where the provider sends the end user back. */
|
|
48
|
-
async callback(
|
|
54
|
+
async callback(integrationKey, code, state, providerError, providerErrorDescription, res) {
|
|
49
55
|
if (providerError || providerErrorDescription) {
|
|
50
56
|
res
|
|
51
57
|
.status(400)
|
|
@@ -59,7 +65,7 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
59
65
|
return;
|
|
60
66
|
}
|
|
61
67
|
try {
|
|
62
|
-
const { redirectUrl } = await this.connect.handleCallback(
|
|
68
|
+
const { redirectUrl } = await this.connect.handleCallback(integrationKey, code, state);
|
|
63
69
|
if (redirectUrl) {
|
|
64
70
|
const url = new URL(redirectUrl);
|
|
65
71
|
url.searchParams.set('kosha_status', 'success');
|
|
@@ -69,7 +75,14 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
69
75
|
res.send('Connected. You can close this window.');
|
|
70
76
|
}
|
|
71
77
|
catch (error) {
|
|
72
|
-
this.logger.warn(`Connect callback failed for "${
|
|
78
|
+
this.logger.warn(`Connect callback failed for "${integrationKey}": ${error instanceof Error ? error.message : error}`);
|
|
79
|
+
// A conflict is worth saying out loud: somebody is already connected,
|
|
80
|
+
// and the end user can do something about it. Everything else stays
|
|
81
|
+
// vague, since this URL is reached by a browser we do not trust.
|
|
82
|
+
if (error instanceof ConflictException) {
|
|
83
|
+
res.status(409).send(error.message);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
73
86
|
res
|
|
74
87
|
.status(400)
|
|
75
88
|
.send(error instanceof BadRequestException
|
|
@@ -82,23 +95,38 @@ __decorate([
|
|
|
82
95
|
Post('sessions'),
|
|
83
96
|
AllowAnonymous(),
|
|
84
97
|
UseGuards(OrgAuthGuard),
|
|
98
|
+
ApiSecurity('x-api-key'),
|
|
99
|
+
ApiOperation({
|
|
100
|
+
summary: 'Start a connect flow for one of the app’s users',
|
|
101
|
+
description: 'The environment comes from the API key. Set organizationExternalId when the credential belongs to a tenant rather than to the person.',
|
|
102
|
+
}),
|
|
103
|
+
ApiCreatedResponse({ description: 'A connect URL and when it expires.' }),
|
|
104
|
+
ApiBadRequestResponse({
|
|
105
|
+
description: 'Unknown configuration, or no environment on the key.',
|
|
106
|
+
}),
|
|
85
107
|
__param(0, Req()),
|
|
86
108
|
__param(1, Body()),
|
|
87
109
|
__metadata("design:type", Function),
|
|
88
|
-
__metadata("design:paramtypes", [Object,
|
|
110
|
+
__metadata("design:paramtypes", [Object, CreateConnectSessionDto]),
|
|
89
111
|
__metadata("design:returntype", void 0)
|
|
90
112
|
], ConnectController.prototype, "createSession", null);
|
|
91
113
|
__decorate([
|
|
92
|
-
Post('sessions/test'),
|
|
114
|
+
Post('sessions/test/:environmentId'),
|
|
115
|
+
ApiOperation({
|
|
116
|
+
summary: 'Run the same flow as the signed-in admin',
|
|
117
|
+
description: 'For verifying a configuration before the consuming app is wired up.',
|
|
118
|
+
}),
|
|
93
119
|
__param(0, Session()),
|
|
94
|
-
__param(1,
|
|
120
|
+
__param(1, Param('environmentId')),
|
|
121
|
+
__param(2, Body()),
|
|
95
122
|
__metadata("design:type", Function),
|
|
96
|
-
__metadata("design:paramtypes", [Object,
|
|
123
|
+
__metadata("design:paramtypes", [Object, String, CreateTestSessionDto]),
|
|
97
124
|
__metadata("design:returntype", void 0)
|
|
98
125
|
], ConnectController.prototype, "createTestSession", null);
|
|
99
126
|
__decorate([
|
|
100
127
|
Get(':token/start'),
|
|
101
128
|
AllowAnonymous(),
|
|
129
|
+
ApiExcludeEndpoint(),
|
|
102
130
|
__param(0, Param('token')),
|
|
103
131
|
__param(1, Res()),
|
|
104
132
|
__metadata("design:type", Function),
|
|
@@ -106,9 +134,10 @@ __decorate([
|
|
|
106
134
|
__metadata("design:returntype", Promise)
|
|
107
135
|
], ConnectController.prototype, "start", null);
|
|
108
136
|
__decorate([
|
|
109
|
-
Get('callback/:
|
|
137
|
+
Get('callback/:integrationKey'),
|
|
110
138
|
AllowAnonymous(),
|
|
111
|
-
|
|
139
|
+
ApiExcludeEndpoint(),
|
|
140
|
+
__param(0, Param('integrationKey')),
|
|
112
141
|
__param(1, Query('code')),
|
|
113
142
|
__param(2, Query('state')),
|
|
114
143
|
__param(3, Query('error')),
|
|
@@ -119,6 +148,7 @@ __decorate([
|
|
|
119
148
|
__metadata("design:returntype", Promise)
|
|
120
149
|
], ConnectController.prototype, "callback", null);
|
|
121
150
|
ConnectController = ConnectController_1 = __decorate([
|
|
151
|
+
ApiTags('connect'),
|
|
122
152
|
Controller('connect'),
|
|
123
153
|
__metadata("design:paramtypes", [ConnectService])
|
|
124
154
|
], ConnectController);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.module.d.ts","sourceRoot":"","sources":["../../src/connect/connect.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.module.d.ts","sourceRoot":"","sources":["../../src/connect/connect.module.ts"],"names":[],"mappings":"AAOA,qBAMa,aAAa;CAAG"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Module } from '@nestjs/common';
|
|
3
3
|
import { ConfigurationsModule } from '../configurations/configurations.module.js';
|
|
4
|
+
import { EnvironmentsModule } from '../environments/environments.module.js';
|
|
4
5
|
import { ConnectController } from './connect.controller.js';
|
|
6
|
+
import { ConnectRepository } from './connect.repository.js';
|
|
5
7
|
import { ConnectService } from './connect.service.js';
|
|
6
8
|
let ConnectModule = class ConnectModule {
|
|
7
9
|
};
|
|
8
10
|
ConnectModule = __decorate([
|
|
9
11
|
Module({
|
|
10
|
-
imports: [ConfigurationsModule],
|
|
12
|
+
imports: [ConfigurationsModule, EnvironmentsModule],
|
|
11
13
|
controllers: [ConnectController],
|
|
12
|
-
providers: [ConnectService],
|
|
14
|
+
providers: [ConnectService, ConnectRepository],
|
|
13
15
|
exports: [ConnectService],
|
|
14
16
|
})
|
|
15
17
|
], ConnectModule);
|