@kosha-ai/server 0.2.0 → 0.4.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/auth.factory.d.ts.map +1 -1
- package/dist/auth/auth.factory.js +0 -5
- package/dist/configurations/configurations.controller.d.ts +6 -5
- package/dist/configurations/configurations.controller.d.ts.map +1 -1
- package/dist/configurations/configurations.controller.js +22 -18
- package/dist/configurations/configurations.module.d.ts.map +1 -1
- package/dist/configurations/configurations.module.js +1 -2
- package/dist/configurations/configurations.service.d.ts +29 -35
- package/dist/configurations/configurations.service.d.ts.map +1 -1
- package/dist/configurations/configurations.service.js +126 -149
- package/dist/configurations/dto/create-configuration.dto.d.ts +2 -2
- package/dist/configurations/dto/create-configuration.dto.d.ts.map +1 -1
- package/dist/configurations/dto/create-configuration.dto.js +6 -6
- package/dist/configurations/dto/update-configuration.dto.d.ts +1 -2
- package/dist/configurations/dto/update-configuration.dto.d.ts.map +1 -1
- package/dist/configurations/dto/update-configuration.dto.js +7 -13
- package/dist/connect/connect.controller.d.ts +12 -2
- package/dist/connect/connect.controller.d.ts.map +1 -1
- package/dist/connect/connect.controller.js +108 -18
- package/dist/connect/connect.module.d.ts.map +1 -1
- package/dist/connect/connect.module.js +1 -2
- package/dist/connect/connect.repository.d.ts +34 -25
- package/dist/connect/connect.repository.d.ts.map +1 -1
- package/dist/connect/connect.repository.js +45 -52
- package/dist/connect/connect.service.d.ts +54 -8
- package/dist/connect/connect.service.d.ts.map +1 -1
- package/dist/connect/connect.service.js +312 -68
- package/dist/connect/dto/connect-credential.dto.d.ts +8 -0
- package/dist/connect/dto/connect-credential.dto.d.ts.map +1 -0
- package/dist/connect/dto/connect-credential.dto.js +54 -0
- package/dist/connect/dto/create-connect-session.dto.d.ts +1 -1
- package/dist/connect/dto/create-connect-session.dto.d.ts.map +1 -1
- package/dist/connect/dto/create-connect-session.dto.js +7 -8
- package/dist/connect/dto/create-test-session.dto.d.ts +8 -0
- package/dist/connect/dto/create-test-session.dto.d.ts.map +1 -1
- package/dist/connect/dto/create-test-session.dto.js +45 -3
- package/dist/connections/connections.controller.d.ts +4 -3
- package/dist/connections/connections.controller.d.ts.map +1 -1
- package/dist/connections/connections.controller.js +13 -11
- package/dist/connections/connections.repository.d.ts +24 -17
- package/dist/connections/connections.repository.d.ts.map +1 -1
- package/dist/connections/connections.repository.js +21 -43
- package/dist/connections/connections.service.d.ts +48 -13
- package/dist/connections/connections.service.d.ts.map +1 -1
- package/dist/connections/connections.service.js +111 -32
- package/dist/connections/dto/list-connections.dto.d.ts +3 -1
- package/dist/connections/dto/list-connections.dto.d.ts.map +1 -1
- package/dist/connections/dto/list-connections.dto.js +26 -4
- package/dist/connections/environment-connections.controller.d.ts +4 -3
- package/dist/connections/environment-connections.controller.d.ts.map +1 -1
- package/dist/connections/environment-connections.controller.js +14 -12
- package/dist/credentials/credentials.module.d.ts.map +1 -1
- package/dist/credentials/credentials.module.js +0 -2
- package/dist/credentials/credentials.repository.d.ts +5 -2
- package/dist/credentials/credentials.repository.d.ts.map +1 -1
- package/dist/credentials/credentials.repository.js +10 -3
- package/dist/credentials/credentials.service.d.ts +14 -4
- package/dist/credentials/credentials.service.d.ts.map +1 -1
- package/dist/credentials/credentials.service.js +106 -30
- package/dist/crypto/credential-envelope.d.ts +27 -1
- package/dist/crypto/credential-envelope.d.ts.map +1 -1
- package/dist/crypto/credential-envelope.js +43 -0
- package/dist/egress/egress.listener.d.ts +1 -3
- package/dist/egress/egress.listener.d.ts.map +1 -1
- package/dist/egress/egress.listener.js +3 -7
- package/dist/egress/egress.repository.d.ts +13 -6
- package/dist/egress/egress.repository.d.ts.map +1 -1
- package/dist/egress/egress.repository.js +31 -44
- package/dist/generated/prisma/browser.d.ts +0 -5
- package/dist/generated/prisma/browser.d.ts.map +1 -1
- package/dist/generated/prisma/client.d.ts +0 -5
- package/dist/generated/prisma/client.d.ts.map +1 -1
- package/dist/generated/prisma/commonInputTypes.d.ts +0 -55
- package/dist/generated/prisma/commonInputTypes.d.ts.map +1 -1
- package/dist/generated/prisma/internal/class.d.ts +0 -11
- 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 +1 -114
- package/dist/generated/prisma/internal/prismaNamespace.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +2 -29
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +0 -30
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +2 -29
- package/dist/generated/prisma/models/Account.d.ts +26 -344
- package/dist/generated/prisma/models/Account.d.ts.map +1 -1
- package/dist/generated/prisma/models/Environment.d.ts +0 -258
- package/dist/generated/prisma/models/Environment.d.ts.map +1 -1
- package/dist/generated/prisma/models/User.d.ts +2 -60
- package/dist/generated/prisma/models/User.d.ts.map +1 -1
- package/dist/generated/prisma/models.d.ts +0 -1
- package/dist/generated/prisma/models.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/integrations/client-context.d.ts +20 -0
- package/dist/integrations/client-context.d.ts.map +1 -0
- package/dist/integrations/client-context.js +23 -0
- package/dist/integrations/integrations.controller.d.ts +6 -0
- package/dist/integrations/integrations.controller.d.ts.map +1 -1
- package/dist/integrations/integrations.controller.js +3 -0
- package/dist/integrations/integrations.module.d.ts.map +1 -1
- package/dist/integrations/integrations.module.js +3 -1
- package/dist/integrations/provider-store.d.ts +110 -0
- package/dist/integrations/provider-store.d.ts.map +1 -0
- package/dist/integrations/provider-store.js +302 -0
- package/dist/proxy/proxy.controller.d.ts +17 -5
- package/dist/proxy/proxy.controller.d.ts.map +1 -1
- package/dist/proxy/proxy.controller.js +46 -17
- package/dist/proxy/proxy.module.d.ts.map +1 -1
- package/dist/proxy/proxy.module.js +1 -2
- package/dist/proxy/proxy.repository.d.ts +11 -14
- package/dist/proxy/proxy.repository.d.ts.map +1 -1
- package/dist/proxy/proxy.repository.js +17 -27
- package/dist/proxy/proxy.service.d.ts +6 -8
- package/dist/proxy/proxy.service.d.ts.map +1 -1
- package/dist/proxy/proxy.service.js +72 -31
- package/package.json +4 -4
- package/prisma/migrations/{20260929101936_init → 20261008090000_init}/migration.sql +5 -58
- package/prisma/schema.prisma +2 -43
- package/dist/configurations/configurations.repository.d.ts +0 -43
- package/dist/configurations/configurations.repository.d.ts.map +0 -1
- package/dist/configurations/configurations.repository.js +0 -76
- package/dist/generated/prisma/models/Configuration.d.ts +0 -1385
- package/dist/generated/prisma/models/Configuration.d.ts.map +0 -1
- package/dist/generated/prisma/models/Configuration.js +0 -1
- package/prisma/migrations/20260930102529_connection_config/migration.sql +0 -2
|
@@ -5,9 +5,10 @@ import { ApiBadRequestResponse, ApiCreatedResponse, ApiExcludeEndpoint, ApiOpera
|
|
|
5
5
|
import { AllowAnonymous, Session, } from '@thallesp/nestjs-better-auth';
|
|
6
6
|
import { OrgAuthGuard } from '../auth/api-key.guard.js';
|
|
7
7
|
import { getActiveOrganizationId } from '../common/active-organization.js';
|
|
8
|
-
import { ConnectService } from './connect.service.js';
|
|
8
|
+
import { ConnectFlowEnded, ConnectService, MAX_LOGGED, } from './connect.service.js';
|
|
9
|
+
import { ConnectWithCredentialDto } from './dto/connect-credential.dto.js';
|
|
9
10
|
import { CreateConnectSessionDto } from './dto/create-connect-session.dto.js';
|
|
10
|
-
import { CreateTestSessionDto } from './dto/create-test-session.dto.js';
|
|
11
|
+
import { CreateTestSessionDto, TestCredentialDto, } from './dto/create-test-session.dto.js';
|
|
11
12
|
let ConnectController = ConnectController_1 = class ConnectController {
|
|
12
13
|
connect;
|
|
13
14
|
logger = new Logger(ConnectController_1.name);
|
|
@@ -26,6 +27,16 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
26
27
|
}
|
|
27
28
|
return this.connect.createSession(request.organizationId, request.environmentId, body);
|
|
28
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The counterpart for a provider whose end user already holds the key:
|
|
32
|
+
* the app collects it and posts it here, and a connection exists at once.
|
|
33
|
+
*/
|
|
34
|
+
connectWithCredential(request, body) {
|
|
35
|
+
if (!request.environmentId) {
|
|
36
|
+
throw new BadRequestException('This route needs an API key, which is what names the environment');
|
|
37
|
+
}
|
|
38
|
+
return this.connect.connectWithCredential(request.organizationId, request.environmentId, body);
|
|
39
|
+
}
|
|
29
40
|
/**
|
|
30
41
|
* Admin-only: runs the same flow with the signed-in admin standing in for an
|
|
31
42
|
* end user, so an operator can verify a configuration without wiring up
|
|
@@ -34,11 +45,22 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
34
45
|
createTestSession(session, environmentId, body) {
|
|
35
46
|
return this.connect.createSession(getActiveOrganizationId(session), environmentId, {
|
|
36
47
|
externalUserId: `kosha-admin:${session.user.id}`,
|
|
48
|
+
provider: body.provider,
|
|
37
49
|
configurationId: body?.configurationId,
|
|
38
50
|
configurationSlug: body?.slug,
|
|
39
51
|
redirectUrl: body?.redirectUrl,
|
|
40
52
|
});
|
|
41
53
|
}
|
|
54
|
+
/** The same, for a provider whose credential the operator pastes in. */
|
|
55
|
+
testCredential(session, environmentId, body) {
|
|
56
|
+
return this.connect.connectWithCredential(getActiveOrganizationId(session), environmentId, {
|
|
57
|
+
externalUserId: `kosha-admin:${session.user.id}`,
|
|
58
|
+
provider: body.provider,
|
|
59
|
+
configurationId: body?.configurationId,
|
|
60
|
+
configurationSlug: body?.slug,
|
|
61
|
+
credential: body.credential,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
42
64
|
/** The URL the end user's browser opens. Redirects to the provider. */
|
|
43
65
|
async start(token, res) {
|
|
44
66
|
try {
|
|
@@ -46,18 +68,36 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
46
68
|
}
|
|
47
69
|
catch (error) {
|
|
48
70
|
this.logger.warn(`Connect start rejected: ${error instanceof Error ? error.message : error}`);
|
|
71
|
+
if (error instanceof ConnectFlowEnded &&
|
|
72
|
+
redirectBack(res, error.redirectUrl, error.status)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
49
75
|
// Deliberately vague to the browser: this URL is handed to end users.
|
|
50
76
|
res.status(400).send('This connect link is invalid or has expired.');
|
|
51
77
|
}
|
|
52
78
|
}
|
|
79
|
+
/** A decline at the provider; never fails the response it is answering. */
|
|
80
|
+
async denied(provider, state, reason) {
|
|
81
|
+
try {
|
|
82
|
+
return await this.connect.deny(provider, state, reason);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
this.logger.warn(`Connect denial for ${JSON.stringify(provider.slice(0, MAX_LOGGED))} not recorded: ${error instanceof Error ? error.message : error}`);
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
53
89
|
/** Where the provider sends the end user back. */
|
|
54
|
-
async callback(
|
|
90
|
+
async callback(provider, code, state, providerError, providerErrorDescription, res) {
|
|
55
91
|
if (providerError || providerErrorDescription) {
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
92
|
+
const reason = [providerError, providerErrorDescription]
|
|
93
|
+
.filter(Boolean)
|
|
94
|
+
.join(': ');
|
|
95
|
+
const ended = await this.denied(provider, state, reason);
|
|
96
|
+
if (ended && redirectBack(res, ended.redirectUrl, ended.status))
|
|
97
|
+
return;
|
|
98
|
+
// A fixed message: the provider's own text arrives in the query string,
|
|
99
|
+
// and echoing it would let anyone put markup on Kosha's origin.
|
|
100
|
+
res.status(400).send('The provider did not grant access.');
|
|
61
101
|
return;
|
|
62
102
|
}
|
|
63
103
|
if (!code || !state) {
|
|
@@ -65,17 +105,17 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
65
105
|
return;
|
|
66
106
|
}
|
|
67
107
|
try {
|
|
68
|
-
const { redirectUrl } = await this.connect.handleCallback(
|
|
69
|
-
if (redirectUrl)
|
|
70
|
-
const url = new URL(redirectUrl);
|
|
71
|
-
url.searchParams.set('kosha_status', 'success');
|
|
72
|
-
res.redirect(url.toString());
|
|
108
|
+
const { redirectUrl } = await this.connect.handleCallback(provider, code, state);
|
|
109
|
+
if (redirectBack(res, redirectUrl, 'success'))
|
|
73
110
|
return;
|
|
74
|
-
}
|
|
75
111
|
res.send('Connected. You can close this window.');
|
|
76
112
|
}
|
|
77
113
|
catch (error) {
|
|
78
|
-
this.logger.warn(`Connect callback failed for
|
|
114
|
+
this.logger.warn(`Connect callback failed for ${JSON.stringify(provider.slice(0, MAX_LOGGED))}: ${error instanceof Error ? error.message : error}`);
|
|
115
|
+
if (error instanceof ConnectFlowEnded &&
|
|
116
|
+
redirectBack(res, error.redirectUrl, error.status)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
79
119
|
// A conflict is worth saying out loud: somebody is already connected,
|
|
80
120
|
// and the end user can do something about it. Everything else stays
|
|
81
121
|
// vague, since this URL is reached by a browser we do not trust.
|
|
@@ -98,7 +138,7 @@ __decorate([
|
|
|
98
138
|
ApiSecurity('x-api-key'),
|
|
99
139
|
ApiOperation({
|
|
100
140
|
summary: 'Start a connect flow for one of the app’s users',
|
|
101
|
-
description: 'The environment comes from the API key.
|
|
141
|
+
description: 'The environment comes from the API key. Name the provider and the configuration slug it was set up under.',
|
|
102
142
|
}),
|
|
103
143
|
ApiCreatedResponse({ description: 'A connect URL and when it expires.' }),
|
|
104
144
|
ApiBadRequestResponse({
|
|
@@ -110,6 +150,25 @@ __decorate([
|
|
|
110
150
|
__metadata("design:paramtypes", [Object, CreateConnectSessionDto]),
|
|
111
151
|
__metadata("design:returntype", void 0)
|
|
112
152
|
], ConnectController.prototype, "createSession", null);
|
|
153
|
+
__decorate([
|
|
154
|
+
Post('credential'),
|
|
155
|
+
AllowAnonymous(),
|
|
156
|
+
UseGuards(OrgAuthGuard),
|
|
157
|
+
ApiSecurity('x-api-key'),
|
|
158
|
+
ApiOperation({
|
|
159
|
+
summary: 'Connect one of the app’s users with a credential they hold',
|
|
160
|
+
description: 'For a provider with no redirect. The credential is checked against the provider before anything is stored.',
|
|
161
|
+
}),
|
|
162
|
+
ApiCreatedResponse({ description: 'The connection that was created.' }),
|
|
163
|
+
ApiBadRequestResponse({
|
|
164
|
+
description: 'The provider rejected the credential, or it was incomplete.',
|
|
165
|
+
}),
|
|
166
|
+
__param(0, Req()),
|
|
167
|
+
__param(1, Body()),
|
|
168
|
+
__metadata("design:type", Function),
|
|
169
|
+
__metadata("design:paramtypes", [Object, ConnectWithCredentialDto]),
|
|
170
|
+
__metadata("design:returntype", void 0)
|
|
171
|
+
], ConnectController.prototype, "connectWithCredential", null);
|
|
113
172
|
__decorate([
|
|
114
173
|
Post('sessions/test/:environmentId'),
|
|
115
174
|
ApiOperation({
|
|
@@ -123,6 +182,19 @@ __decorate([
|
|
|
123
182
|
__metadata("design:paramtypes", [Object, String, CreateTestSessionDto]),
|
|
124
183
|
__metadata("design:returntype", void 0)
|
|
125
184
|
], ConnectController.prototype, "createTestSession", null);
|
|
185
|
+
__decorate([
|
|
186
|
+
Post('credential/test/:environmentId'),
|
|
187
|
+
ApiOperation({
|
|
188
|
+
summary: 'Connect as the signed-in admin with a pasted credential',
|
|
189
|
+
description: 'For verifying a configuration before the consuming app is wired up.',
|
|
190
|
+
}),
|
|
191
|
+
__param(0, Session()),
|
|
192
|
+
__param(1, Param('environmentId')),
|
|
193
|
+
__param(2, Body()),
|
|
194
|
+
__metadata("design:type", Function),
|
|
195
|
+
__metadata("design:paramtypes", [Object, String, TestCredentialDto]),
|
|
196
|
+
__metadata("design:returntype", void 0)
|
|
197
|
+
], ConnectController.prototype, "testCredential", null);
|
|
126
198
|
__decorate([
|
|
127
199
|
Get(':token/start'),
|
|
128
200
|
AllowAnonymous(),
|
|
@@ -134,10 +206,10 @@ __decorate([
|
|
|
134
206
|
__metadata("design:returntype", Promise)
|
|
135
207
|
], ConnectController.prototype, "start", null);
|
|
136
208
|
__decorate([
|
|
137
|
-
Get('callback/:
|
|
209
|
+
Get('callback/:provider'),
|
|
138
210
|
AllowAnonymous(),
|
|
139
211
|
ApiExcludeEndpoint(),
|
|
140
|
-
__param(0, Param('
|
|
212
|
+
__param(0, Param('provider')),
|
|
141
213
|
__param(1, Query('code')),
|
|
142
214
|
__param(2, Query('state')),
|
|
143
215
|
__param(3, Query('error')),
|
|
@@ -153,3 +225,21 @@ ConnectController = ConnectController_1 = __decorate([
|
|
|
153
225
|
__metadata("design:paramtypes", [ConnectService])
|
|
154
226
|
], ConnectController);
|
|
155
227
|
export { ConnectController };
|
|
228
|
+
/**
|
|
229
|
+
* Sends the person back to the app with how the connect flow ended. False when
|
|
230
|
+
* there is nowhere valid to send them, so the caller answers itself.
|
|
231
|
+
*/
|
|
232
|
+
function redirectBack(res, redirectUrl, status) {
|
|
233
|
+
if (!redirectUrl)
|
|
234
|
+
return false;
|
|
235
|
+
let url;
|
|
236
|
+
try {
|
|
237
|
+
url = new URL(redirectUrl);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
url.searchParams.set('kosha_status', status);
|
|
243
|
+
res.redirect(url.toString());
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
@@ -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":"AAMA,qBAMa,aAAa;CAAG"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Module } from '@nestjs/common';
|
|
3
|
-
import { ConfigurationsModule } from '../configurations/configurations.module.js';
|
|
4
3
|
import { EnvironmentsModule } from '../environments/environments.module.js';
|
|
5
4
|
import { ConnectController } from './connect.controller.js';
|
|
6
5
|
import { ConnectRepository } from './connect.repository.js';
|
|
@@ -9,7 +8,7 @@ let ConnectModule = class ConnectModule {
|
|
|
9
8
|
};
|
|
10
9
|
ConnectModule = __decorate([
|
|
11
10
|
Module({
|
|
12
|
-
imports: [
|
|
11
|
+
imports: [EnvironmentsModule],
|
|
13
12
|
controllers: [ConnectController],
|
|
14
13
|
providers: [ConnectService, ConnectRepository],
|
|
15
14
|
exports: [ConnectService],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Account, User } from '../generated/prisma/client.js';
|
|
1
|
+
import type { Account, Prisma, User } from '../generated/prisma/client.js';
|
|
2
2
|
import { PrismaService } from '../prisma/prisma.service.js';
|
|
3
3
|
/**
|
|
4
4
|
* What a connect flow remembers between the link being handed out and the
|
|
@@ -9,38 +9,38 @@ export interface ConnectState {
|
|
|
9
9
|
organizationId: string;
|
|
10
10
|
environmentId: string;
|
|
11
11
|
environmentSlug: string;
|
|
12
|
+
/** Which provider's tables this flow writes to. */
|
|
13
|
+
provider: string;
|
|
12
14
|
configurationId: string;
|
|
13
15
|
externalUserId: string;
|
|
14
|
-
/** Set when the connection belongs to a tenant rather than to the person. */
|
|
15
|
-
organizationExternalId?: string | null;
|
|
16
16
|
redirectUrl?: string | null;
|
|
17
17
|
/** PKCE, present only once the authorization URL has been built. */
|
|
18
18
|
codeVerifier?: string;
|
|
19
19
|
}
|
|
20
|
+
/** A single-use row, and whether it had outlived its window when taken. */
|
|
21
|
+
export interface TakenFlow {
|
|
22
|
+
flow: ConnectState;
|
|
23
|
+
expired: boolean;
|
|
24
|
+
}
|
|
20
25
|
export interface StoreCredentialInput {
|
|
21
26
|
userId: string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/** The configuration id. `account.providerId` holds it as a plain string. */
|
|
25
|
-
providerId: string;
|
|
27
|
+
/** The provider, which is what Better Auth means by `providerId`. */
|
|
28
|
+
provider: string;
|
|
26
29
|
/** The provider's own id for the account. */
|
|
27
30
|
accountId: string;
|
|
28
31
|
/** Already an encrypted envelope by the time it arrives here. */
|
|
29
32
|
accessToken: string;
|
|
30
33
|
accessTokenExpiresAt: Date | null;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
* site, say. Non-secret, so it is stored in the clear.
|
|
34
|
-
*/
|
|
35
|
-
connectionConfig?: Record<string, unknown>;
|
|
34
|
+
/** What the provider granted, which can be less than was asked for. */
|
|
35
|
+
scope: string | null;
|
|
36
36
|
}
|
|
37
37
|
export declare class ConnectRepository {
|
|
38
38
|
private readonly prisma;
|
|
39
39
|
constructor(prisma: PrismaService);
|
|
40
40
|
putSession(token: string, state: ConnectState, expiresAt: Date): Promise<void>;
|
|
41
|
-
takeSession(token: string): Promise<
|
|
41
|
+
takeSession(token: string): Promise<TakenFlow | null>;
|
|
42
42
|
putState(state: string, payload: ConnectState, expiresAt: Date): Promise<void>;
|
|
43
|
-
takeState(state: string): Promise<
|
|
43
|
+
takeState(state: string): Promise<TakenFlow | null>;
|
|
44
44
|
/** Nothing else sweeps these, so the connect flow has to. */
|
|
45
45
|
deleteExpired(now?: Date): Promise<number>;
|
|
46
46
|
/**
|
|
@@ -50,29 +50,38 @@ export declare class ConnectRepository {
|
|
|
50
50
|
*/
|
|
51
51
|
upsertEndUser(environmentSlug: string, externalUserId: string): Promise<User>;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* Found first rather than upserted, because Prisma cannot upsert on an index
|
|
56
|
-
* whose columns are nullable.
|
|
53
|
+
* Writes the credential and lets the provider record its own connection in
|
|
54
|
+
* the same transaction, so a credential nothing points at cannot exist.
|
|
57
55
|
*/
|
|
58
|
-
|
|
59
|
-
userId: string;
|
|
60
|
-
organizationExternalId: string | null;
|
|
61
|
-
}): Promise<Account | null>;
|
|
62
|
-
storeCredential(input: StoreCredentialInput): Promise<Account>;
|
|
56
|
+
storeCredential(input: StoreCredentialInput, link: (tx: Prisma.TransactionClient, accountId: string) => Promise<unknown>): Promise<Account>;
|
|
63
57
|
updateCredential(id: string, changes: {
|
|
64
58
|
accountId?: string;
|
|
65
59
|
accessToken: string;
|
|
66
60
|
accessTokenExpiresAt: Date | null;
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
/** Rewritten on refresh: a provider may report a different grant. */
|
|
62
|
+
scope?: string | null;
|
|
69
63
|
}): Promise<Account>;
|
|
64
|
+
/**
|
|
65
|
+
* An expired row is still handed back, flagged, so the person can be sent
|
|
66
|
+
* back to the app rather than left on a Kosha error page.
|
|
67
|
+
*/
|
|
70
68
|
private take;
|
|
71
69
|
}
|
|
72
70
|
/**
|
|
73
71
|
* Better Auth requires `user.email` to be present and unique, while an end
|
|
74
72
|
* user exists per environment. The derived form encodes both, so the same
|
|
75
73
|
* person in sandbox and production is two rows rather than a unique violation.
|
|
74
|
+
*
|
|
75
|
+
* `.internal` is reserved for private use, so the address can never resolve or
|
|
76
|
+
* receive mail — an end user has none to store.
|
|
76
77
|
*/
|
|
77
78
|
export declare function derivedEmail(environmentSlug: string, externalUserId: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Gets the app's user id back out of a stored email, the reverse of
|
|
81
|
+
* {@link derivedEmail}: `production.user_9@kosha.internal` → `user_9`.
|
|
82
|
+
*
|
|
83
|
+
* Uses `derivedEmail` to know what comes before and after the id, so a change
|
|
84
|
+
* to the email format cannot break it.
|
|
85
|
+
*/
|
|
86
|
+
export declare function externalUserIdOf(environmentSlug: string, email: string): string;
|
|
78
87
|
//# sourceMappingURL=connect.repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.repository.d.ts","sourceRoot":"","sources":["../../src/connect/connect.repository.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"connect.repository.d.ts","sourceRoot":"","sources":["../../src/connect/connect.repository.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,M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AInD,6DAA6D;IACvD,aAAa,CAAC,GAAG,OAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAatD;;;;OAIG;IACG,aAAa,CACjB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;IAYhB;;;OAGG;IACH,eAAe,CACb,KAAK,EAAE,oBAAoB,EAC3B,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAC1E,OAAO,CAAC,OAAO,CAAC;IAmBnB,gBAAgB,CACd,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,oBAAoB,EAAE,IAAI,GAAG,IAAI,CAAC;QAClC,qEAAqE;QACrE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,GACA,OAAO,CAAC,OAAO,CAAC;IAInB;;;OAGG;YACW,IAAI;CAenB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM,GACrB,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,MAAM,GACZ,MAAM,CAGR"}
|
|
@@ -2,15 +2,6 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { Injectable } from '@nestjs/common';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { PrismaService } from '../prisma/prisma.service.js';
|
|
5
|
-
/**
|
|
6
|
-
* Prisma distinguishes "leave this column alone" from "write JSON null", and a
|
|
7
|
-
* plain index signature is not assignable to its Json input type. Undefined
|
|
8
|
-
* stays undefined, so an update that says nothing about the config keeps what
|
|
9
|
-
* is already stored.
|
|
10
|
-
*/
|
|
11
|
-
function asJson(value) {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
5
|
/**
|
|
15
6
|
* Namespaced, because `verification` is shared with email verification and
|
|
16
7
|
* password reset.
|
|
@@ -70,53 +61,40 @@ let ConnectRepository = class ConnectRepository {
|
|
|
70
61
|
const email = derivedEmail(environmentSlug, externalUserId);
|
|
71
62
|
return this.prisma.user.upsert({
|
|
72
63
|
where: { email },
|
|
73
|
-
create: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
emailVerified: false,
|
|
78
|
-
},
|
|
79
|
-
update: { externalId: externalUserId },
|
|
64
|
+
create: { email, name: externalUserId, emailVerified: false },
|
|
65
|
+
// Nothing of ours lives on this row, so a second connect by the same
|
|
66
|
+
// person has nothing to write.
|
|
67
|
+
update: {},
|
|
80
68
|
});
|
|
81
69
|
}
|
|
82
70
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* Found first rather than upserted, because Prisma cannot upsert on an index
|
|
86
|
-
* whose columns are nullable.
|
|
71
|
+
* Writes the credential and lets the provider record its own connection in
|
|
72
|
+
* the same transaction, so a credential nothing points at cannot exist.
|
|
87
73
|
*/
|
|
88
|
-
|
|
89
|
-
return this.prisma
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
userId: input.userId,
|
|
104
|
-
environmentId: input.environmentId,
|
|
105
|
-
organizationExternalId: input.organizationExternalId,
|
|
106
|
-
providerId: input.providerId,
|
|
107
|
-
accountId: input.accountId,
|
|
108
|
-
accessToken: input.accessToken,
|
|
109
|
-
accessTokenExpiresAt: input.accessTokenExpiresAt,
|
|
110
|
-
connectionConfig: asJson(input.connectionConfig),
|
|
111
|
-
},
|
|
74
|
+
storeCredential(input, link) {
|
|
75
|
+
return this.prisma.$transaction(async (tx) => {
|
|
76
|
+
const account = await tx.account.create({
|
|
77
|
+
data: {
|
|
78
|
+
id: randomUUID(),
|
|
79
|
+
userId: input.userId,
|
|
80
|
+
providerId: input.provider,
|
|
81
|
+
accountId: input.accountId,
|
|
82
|
+
accessToken: input.accessToken,
|
|
83
|
+
accessTokenExpiresAt: input.accessTokenExpiresAt,
|
|
84
|
+
scope: input.scope,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
await link(tx, account.id);
|
|
88
|
+
return account;
|
|
112
89
|
});
|
|
113
90
|
}
|
|
114
91
|
updateCredential(id, changes) {
|
|
115
|
-
return this.prisma.account.update({
|
|
116
|
-
where: { id },
|
|
117
|
-
data: { ...changes, connectionConfig: asJson(changes.connectionConfig) },
|
|
118
|
-
});
|
|
92
|
+
return this.prisma.account.update({ where: { id }, data: changes });
|
|
119
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* An expired row is still handed back, flagged, so the person can be sent
|
|
96
|
+
* back to the app rather than left on a Kosha error page.
|
|
97
|
+
*/
|
|
120
98
|
async take(identifier) {
|
|
121
99
|
const row = await this.prisma.verification.findFirst({
|
|
122
100
|
where: { identifier },
|
|
@@ -126,9 +104,10 @@ let ConnectRepository = class ConnectRepository {
|
|
|
126
104
|
// Burnt before any network work, so a replayed callback cannot mint a
|
|
127
105
|
// second credential.
|
|
128
106
|
await this.prisma.verification.delete({ where: { id: row.id } });
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
107
|
+
return {
|
|
108
|
+
flow: JSON.parse(row.value),
|
|
109
|
+
expired: row.expiresAt < new Date(),
|
|
110
|
+
};
|
|
132
111
|
}
|
|
133
112
|
};
|
|
134
113
|
ConnectRepository = __decorate([
|
|
@@ -140,7 +119,21 @@ export { ConnectRepository };
|
|
|
140
119
|
* Better Auth requires `user.email` to be present and unique, while an end
|
|
141
120
|
* user exists per environment. The derived form encodes both, so the same
|
|
142
121
|
* person in sandbox and production is two rows rather than a unique violation.
|
|
122
|
+
*
|
|
123
|
+
* `.internal` is reserved for private use, so the address can never resolve or
|
|
124
|
+
* receive mail — an end user has none to store.
|
|
143
125
|
*/
|
|
144
126
|
export function derivedEmail(environmentSlug, externalUserId) {
|
|
145
|
-
return `${environmentSlug}.${externalUserId}@
|
|
127
|
+
return `${environmentSlug}.${externalUserId}@kosha.internal`;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Gets the app's user id back out of a stored email, the reverse of
|
|
131
|
+
* {@link derivedEmail}: `production.user_9@kosha.internal` → `user_9`.
|
|
132
|
+
*
|
|
133
|
+
* Uses `derivedEmail` to know what comes before and after the id, so a change
|
|
134
|
+
* to the email format cannot break it.
|
|
135
|
+
*/
|
|
136
|
+
export function externalUserIdOf(environmentSlug, email) {
|
|
137
|
+
const [prefix, suffix] = derivedEmail(environmentSlug, '\0').split('\0');
|
|
138
|
+
return email.slice(prefix.length, email.length - suffix.length);
|
|
146
139
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { TokenSet } from '@kosha-ai/integration-sdk';
|
|
2
2
|
import type { ResolvedKoshaConfig } from '../config/kosha-config.js';
|
|
3
|
-
import { ConfigurationsService } from '../configurations/configurations.service.js';
|
|
4
3
|
import { CryptoService } from '../crypto/crypto.service.js';
|
|
5
4
|
import { EnvironmentsService } from '../environments/environments.service.js';
|
|
6
5
|
import { IntegrationRegistry } from '../integrations/integration.registry.js';
|
|
6
|
+
import { ProviderStore } from '../integrations/provider-store.js';
|
|
7
7
|
import { ConnectRepository } from './connect.repository.js';
|
|
8
|
+
import type { ConnectWithCredentialDto } from './dto/connect-credential.dto.js';
|
|
8
9
|
import type { CreateConnectSessionDto } from './dto/create-connect-session.dto.js';
|
|
10
|
+
export declare const MAX_LOGGED = 500;
|
|
9
11
|
export interface ConnectSessionResult {
|
|
10
12
|
token: string;
|
|
11
13
|
connectUrl: string;
|
|
@@ -15,6 +17,15 @@ export interface CallbackResult {
|
|
|
15
17
|
connectionId: string;
|
|
16
18
|
redirectUrl: string | null;
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A connect flow that ended without a credential, carrying where the person
|
|
22
|
+
* should be sent back to and why.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ConnectFlowEnded extends Error {
|
|
25
|
+
readonly status: 'denied' | 'expired';
|
|
26
|
+
readonly redirectUrl: string | null;
|
|
27
|
+
constructor(status: 'denied' | 'expired', redirectUrl: string | null);
|
|
28
|
+
}
|
|
18
29
|
/**
|
|
19
30
|
* Drives the OAuth handshake that turns an end user's consent into a stored,
|
|
20
31
|
* encrypted credential.
|
|
@@ -25,12 +36,12 @@ export interface CallbackResult {
|
|
|
25
36
|
export declare class ConnectService {
|
|
26
37
|
private readonly connect;
|
|
27
38
|
private readonly crypto;
|
|
28
|
-
private readonly
|
|
39
|
+
private readonly store;
|
|
29
40
|
private readonly environments;
|
|
30
41
|
private readonly registry;
|
|
31
42
|
private readonly config;
|
|
32
43
|
private readonly logger;
|
|
33
|
-
constructor(connect: ConnectRepository, crypto: CryptoService,
|
|
44
|
+
constructor(connect: ConnectRepository, crypto: CryptoService, store: ProviderStore, environments: EnvironmentsService, registry: IntegrationRegistry, config: ResolvedKoshaConfig);
|
|
34
45
|
/**
|
|
35
46
|
* Called by the consuming app's backend to start a connect flow for one of
|
|
36
47
|
* its users. The environment comes from the API key, never from the body.
|
|
@@ -42,15 +53,50 @@ export declare class ConnectService {
|
|
|
42
53
|
* across the redirect.
|
|
43
54
|
*/
|
|
44
55
|
buildAuthorizationRedirect(token: string): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Gives a provider whose endpoints and client are not known until an
|
|
58
|
+
* operator supplies a URL a chance to discover and register them, once per
|
|
59
|
+
* configuration. Persisted onto the configuration so refresh — which has no
|
|
60
|
+
* redirect to carry fresh discovery across — reads the same thing back.
|
|
61
|
+
*/
|
|
62
|
+
private prepareClient;
|
|
63
|
+
/**
|
|
64
|
+
* The person declined at the provider. Burns the state, so the flow cannot
|
|
65
|
+
* be completed afterwards, and says where to send them. A state from another
|
|
66
|
+
* provider's flow has nowhere to send them; one past its window is expired.
|
|
67
|
+
*
|
|
68
|
+
* The provider's reason is logged, never sent back: it is the only trace of
|
|
69
|
+
* a misconfigured provider, and the flow names where it happened. Both it
|
|
70
|
+
* and the provider come from the request, so they are logged quoted.
|
|
71
|
+
*/
|
|
72
|
+
deny(provider: string, state: string | undefined, reason: string): Promise<ConnectFlowEnded>;
|
|
45
73
|
/** Handles the provider's redirect back to Kosha. */
|
|
46
|
-
handleCallback(
|
|
74
|
+
handleCallback(provider: string, code: string, state: string): Promise<CallbackResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Creates a connection from a credential the end user already holds.
|
|
77
|
+
*
|
|
78
|
+
* The counterpart to the redirect flow: no connect session, no state to
|
|
79
|
+
* burn, no callback. The consuming app collects the key from its own user
|
|
80
|
+
* and posts it here, so that person needs no Kosha login and Kosha still
|
|
81
|
+
* owns the secret.
|
|
82
|
+
*
|
|
83
|
+
* The key is proved before anything is written, because a key that cannot
|
|
84
|
+
* name its own account is not one this connection can use.
|
|
85
|
+
*/
|
|
86
|
+
connectWithCredential(organizationId: string, environmentId: string, input: ConnectWithCredentialDto): Promise<CallbackResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Asks the provider who the key belongs to, which is the only check
|
|
89
|
+
* available and the right one.
|
|
90
|
+
*
|
|
91
|
+
* The provider's own message is withheld, because it can echo the key back.
|
|
92
|
+
*/
|
|
93
|
+
private proveCredential;
|
|
47
94
|
/**
|
|
48
95
|
* Writes the credential, refusing when one is already there.
|
|
49
96
|
*
|
|
50
|
-
* Replacing silently would let
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* are replacing.
|
|
97
|
+
* Replacing silently would let somebody take over a credential a colleague
|
|
98
|
+
* connected, with no trace. Reconnecting means revoking first, which is a
|
|
99
|
+
* deliberate act by someone who can see what they are replacing.
|
|
54
100
|
*/
|
|
55
101
|
private writeCredential;
|
|
56
102
|
/** Persists a refreshed token set. Shared with the refresh path. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.service.d.ts","sourceRoot":"","sources":["../../src/connect/connect.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.service.d.ts","sourceRoot":"","sources":["../../src/connect/connect.service.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAKV,QAAQ,EACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AASrE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EACL,aAAa,EAEd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAInF,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAEvC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;gBAD1B,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,WAAW,EAAE,MAAM,GAAG,IAAI;CAStC;AAgBD;;;;;;GAMG;AACH,qBACa,cAA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