@kosha-ai/server 0.1.0 → 0.2.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/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.js +3 -3
- 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 +19 -29
- package/dist/credentials/credentials.service.d.ts.map +1 -1
- package/dist/credentials/credentials.service.js +84 -57
- 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/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 +2 -8
- package/dist/egress/egress.controller.d.ts.map +1 -1
- package/dist/egress/egress.controller.js +27 -6
- package/dist/egress/egress.listener.d.ts +3 -1
- package/dist/egress/egress.listener.d.ts.map +1 -1
- package/dist/egress/egress.listener.js +12 -8
- package/dist/egress/egress.module.d.ts.map +1 -1
- package/dist/egress/egress.module.js +10 -2
- 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 +23 -78
- package/dist/egress/grants.service.d.ts.map +1 -1
- package/dist/egress/grants.service.js +44 -104
- 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 +14 -37
- package/dist/generated/prisma/browser.d.ts.map +1 -1
- package/dist/generated/prisma/client.d.ts +14 -37
- 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 +20 -53
- 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 +215 -519
- package/dist/generated/prisma/internal/prismaNamespace.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +38 -90
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +37 -92
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +38 -90
- 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 +131 -134
- package/dist/generated/prisma/models/EgressGrant.d.ts.map +1 -1
- 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 +122 -408
- 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 +3 -6
- package/dist/generated/prisma/models.d.ts.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- 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 +9 -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 -2
- 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 -5
- package/dist/proxy/proxy.service.d.ts.map +1 -1
- package/dist/proxy/proxy.service.js +58 -27
- package/package.json +7 -4
- package/prisma/migrations/20260929101936_init/migration.sql +345 -0
- package/prisma/migrations/20260930102529_connection_config/migration.sql +2 -0
- package/prisma/schema.prisma +93 -198
- 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 -1666
- package/dist/generated/prisma/models/EndUser.d.ts.map +0 -1
- package/dist/generated/prisma/models/EndUser.js +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/prisma/migrations/20260921000000_add_egress_grant/migration.sql +0 -31
- /package/dist/generated/prisma/models/{ConnectSession.js → Environment.js} +0 -0
- /package/dist/generated/prisma/models/{Connection.js → Team.js} +0 -0
- /package/dist/generated/prisma/models/{ConnectionCredential.js → TeamMember.js} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Configuration, Prisma } from '../generated/prisma/client.js';
|
|
2
|
+
import { PrismaService } from '../prisma/prisma.service.js';
|
|
3
|
+
export interface ConfigurationRow {
|
|
4
|
+
environmentId: string;
|
|
5
|
+
integrationKey: string;
|
|
6
|
+
authType: string;
|
|
7
|
+
name: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
credentials: string | null;
|
|
10
|
+
settings: Prisma.InputJsonValue | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** A configuration as a client may see it: everything but the secrets. */
|
|
13
|
+
export type PublicConfiguration = Omit<Configuration, 'credentials'>;
|
|
14
|
+
export interface ConfigurationChanges {
|
|
15
|
+
name?: string;
|
|
16
|
+
/** Null clears the stored secrets; undefined leaves them alone. */
|
|
17
|
+
credentials?: string | null;
|
|
18
|
+
settings?: Prisma.InputJsonValue;
|
|
19
|
+
isEnabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare class ConfigurationsRepository {
|
|
22
|
+
private readonly prisma;
|
|
23
|
+
constructor(prisma: PrismaService);
|
|
24
|
+
findManyByEnvironment(environmentId: string): Promise<PublicConfiguration[]>;
|
|
25
|
+
findById(environmentId: string, id: string): Promise<PublicConfiguration | null>;
|
|
26
|
+
/** How a caller's slug becomes the row the proxy and connect flows use. */
|
|
27
|
+
findBySlug(environmentId: string, slug: string): Promise<PublicConfiguration | null>;
|
|
28
|
+
/**
|
|
29
|
+
* The one read that keeps the secrets, for the connect and proxy paths.
|
|
30
|
+
* Never reachable from a controller.
|
|
31
|
+
*/
|
|
32
|
+
findAnyById(id: string): Promise<Configuration | null>;
|
|
33
|
+
create(row: ConfigurationRow): Promise<PublicConfiguration>;
|
|
34
|
+
update(id: string, changes: ConfigurationChanges): Promise<PublicConfiguration>;
|
|
35
|
+
delete(id: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Credentials pointing at this configuration. `account.providerId` holds the
|
|
38
|
+
* id as a plain string, so this count is what stands in for the foreign key
|
|
39
|
+
* the design gave up.
|
|
40
|
+
*/
|
|
41
|
+
countCredentials(configurationId: string): Promise<number>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=configurations.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurations.repository.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.repository.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC,cAAc,GAAG,SAAS,CAAC;CAC7C;AAED,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;AAErE,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAWD,qBACa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAElD,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAQ5E,QAAQ,CACN,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAOtC,2EAA2E;IAC3E,UAAU,CACR,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAOtC;;;OAGG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAItD,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO3D,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC;IAQzB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC;;;;OAIG;IACH,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAK3D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
3
|
+
import { PrismaService } from '../prisma/prisma.service.js';
|
|
4
|
+
/**
|
|
5
|
+
* `credentials` is ciphertext by the time it reaches here, and stays ciphertext
|
|
6
|
+
* on the way out. Nothing in this file can read a secret.
|
|
7
|
+
*
|
|
8
|
+
* Every read that can reach a client leaves the column out entirely. Ciphertext
|
|
9
|
+
* is not plaintext, but there is no reason for a browser to hold it, and the
|
|
10
|
+
* one path that needs the secrets asks for them by name.
|
|
11
|
+
*/
|
|
12
|
+
const WITHOUT_SECRETS = { credentials: true };
|
|
13
|
+
let ConfigurationsRepository = class ConfigurationsRepository {
|
|
14
|
+
prisma;
|
|
15
|
+
constructor(prisma) {
|
|
16
|
+
this.prisma = prisma;
|
|
17
|
+
}
|
|
18
|
+
findManyByEnvironment(environmentId) {
|
|
19
|
+
return this.prisma.configuration.findMany({
|
|
20
|
+
where: { environmentId },
|
|
21
|
+
omit: WITHOUT_SECRETS,
|
|
22
|
+
orderBy: { createdAt: 'desc' },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
findById(environmentId, id) {
|
|
26
|
+
return this.prisma.configuration.findFirst({
|
|
27
|
+
where: { id, environmentId },
|
|
28
|
+
omit: WITHOUT_SECRETS,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** How a caller's slug becomes the row the proxy and connect flows use. */
|
|
32
|
+
findBySlug(environmentId, slug) {
|
|
33
|
+
return this.prisma.configuration.findFirst({
|
|
34
|
+
where: { environmentId, slug },
|
|
35
|
+
omit: WITHOUT_SECRETS,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The one read that keeps the secrets, for the connect and proxy paths.
|
|
40
|
+
* Never reachable from a controller.
|
|
41
|
+
*/
|
|
42
|
+
findAnyById(id) {
|
|
43
|
+
return this.prisma.configuration.findUnique({ where: { id } });
|
|
44
|
+
}
|
|
45
|
+
create(row) {
|
|
46
|
+
return this.prisma.configuration.create({
|
|
47
|
+
data: row,
|
|
48
|
+
omit: WITHOUT_SECRETS,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
update(id, changes) {
|
|
52
|
+
return this.prisma.configuration.update({
|
|
53
|
+
where: { id },
|
|
54
|
+
data: changes,
|
|
55
|
+
omit: WITHOUT_SECRETS,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async delete(id) {
|
|
59
|
+
await this.prisma.configuration.delete({ where: { id } });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Credentials pointing at this configuration. `account.providerId` holds the
|
|
63
|
+
* id as a plain string, so this count is what stands in for the foreign key
|
|
64
|
+
* the design gave up.
|
|
65
|
+
*/
|
|
66
|
+
countCredentials(configurationId) {
|
|
67
|
+
return this.prisma.account.count({
|
|
68
|
+
where: { providerId: configurationId },
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
ConfigurationsRepository = __decorate([
|
|
73
|
+
Injectable(),
|
|
74
|
+
__metadata("design:paramtypes", [PrismaService])
|
|
75
|
+
], ConfigurationsRepository);
|
|
76
|
+
export { ConfigurationsRepository };
|
|
@@ -1,216 +1,60 @@
|
|
|
1
1
|
import type { ResolvedKoshaConfig } from '../config/kosha-config.js';
|
|
2
2
|
import { CryptoService } from '../crypto/crypto.service.js';
|
|
3
|
-
import
|
|
3
|
+
import { EnvironmentsService } from '../environments/environments.service.js';
|
|
4
|
+
import type { Configuration } from '../generated/prisma/client.js';
|
|
4
5
|
import { IntegrationRegistry } from '../integrations/integration.registry.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
clientSecret: string;
|
|
13
|
-
scopes?: string[];
|
|
14
|
-
environment?: 'SANDBOX' | 'LIVE';
|
|
15
|
-
settings?: Record<string, unknown>;
|
|
16
|
-
}
|
|
17
|
-
export interface UpdateConfigurationInput {
|
|
18
|
-
name?: string;
|
|
19
|
-
scopes?: string[];
|
|
20
|
-
clientId?: string;
|
|
21
|
-
clientSecret?: string;
|
|
22
|
-
isEnabled?: boolean;
|
|
23
|
-
settings?: Record<string, unknown>;
|
|
6
|
+
import { ConfigurationsRepository } from './configurations.repository.js';
|
|
7
|
+
import type { CreateConfigurationDto } from './dto/create-configuration.dto.js';
|
|
8
|
+
import type { UpdateConfigurationDto } from './dto/update-configuration.dto.js';
|
|
9
|
+
/** A configuration with its secrets opened. Never leaves the server. */
|
|
10
|
+
export interface ConfigurationWithCredentials {
|
|
11
|
+
configuration: Configuration;
|
|
12
|
+
credentials: Record<string, unknown>;
|
|
24
13
|
}
|
|
25
14
|
export declare class ConfigurationsService {
|
|
26
|
-
private readonly
|
|
15
|
+
private readonly configurations;
|
|
16
|
+
private readonly environments;
|
|
27
17
|
private readonly crypto;
|
|
28
18
|
private readonly registry;
|
|
29
19
|
private readonly config;
|
|
30
|
-
constructor(
|
|
20
|
+
constructor(configurations: ConfigurationsRepository, environments: EnvironmentsService, crypto: CryptoService, registry: IntegrationRegistry, config: ResolvedKoshaConfig);
|
|
31
21
|
/**
|
|
32
22
|
* The redirect URI the provider must be told about. Derived from
|
|
33
23
|
* `server.publicUrl` so it is stable and inspectable in the admin, rather
|
|
34
24
|
* than being reconstructed per request.
|
|
35
25
|
*/
|
|
36
|
-
callbackUrlFor(
|
|
37
|
-
list(organizationId: string):
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
scopesAvailable: string[];
|
|
50
|
-
docsUrl: string | null;
|
|
51
|
-
logoUrl: string | null;
|
|
52
|
-
isActive: boolean;
|
|
53
|
-
};
|
|
54
|
-
} & {
|
|
55
|
-
name: string;
|
|
56
|
-
id: string;
|
|
57
|
-
createdAt: Date;
|
|
58
|
-
updatedAt: Date;
|
|
59
|
-
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
60
|
-
scopes: string[];
|
|
61
|
-
slug: string;
|
|
62
|
-
organizationId: string;
|
|
63
|
-
providerId: string;
|
|
64
|
-
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
65
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
66
|
-
clientId: string | null;
|
|
67
|
-
redirectUri: string | null;
|
|
68
|
-
isEnabled: boolean;
|
|
69
|
-
})[]>;
|
|
70
|
-
get(organizationId: string, id: string): Promise<{
|
|
71
|
-
provider: {
|
|
72
|
-
name: string;
|
|
73
|
-
key: string;
|
|
74
|
-
id: string;
|
|
75
|
-
createdAt: Date;
|
|
76
|
-
updatedAt: Date;
|
|
77
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
78
|
-
authorizationUrl: string | null;
|
|
79
|
-
tokenUrl: string | null;
|
|
80
|
-
revokeUrl: string | null;
|
|
81
|
-
apiBaseUrl: string | null;
|
|
82
|
-
scopesAvailable: string[];
|
|
83
|
-
docsUrl: string | null;
|
|
84
|
-
logoUrl: string | null;
|
|
85
|
-
isActive: boolean;
|
|
86
|
-
};
|
|
87
|
-
} & {
|
|
88
|
-
name: string;
|
|
89
|
-
id: string;
|
|
90
|
-
createdAt: Date;
|
|
91
|
-
updatedAt: Date;
|
|
92
|
-
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
93
|
-
scopes: string[];
|
|
94
|
-
slug: string;
|
|
95
|
-
organizationId: string;
|
|
96
|
-
providerId: string;
|
|
97
|
-
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
98
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
99
|
-
clientId: string | null;
|
|
100
|
-
redirectUri: string | null;
|
|
101
|
-
isEnabled: boolean;
|
|
102
|
-
}>;
|
|
103
|
-
create(organizationId: string, input: CreateConfigurationInput): Promise<{
|
|
104
|
-
provider: {
|
|
105
|
-
name: string;
|
|
106
|
-
key: string;
|
|
107
|
-
id: string;
|
|
108
|
-
createdAt: Date;
|
|
109
|
-
updatedAt: Date;
|
|
110
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
111
|
-
authorizationUrl: string | null;
|
|
112
|
-
tokenUrl: string | null;
|
|
113
|
-
revokeUrl: string | null;
|
|
114
|
-
apiBaseUrl: string | null;
|
|
115
|
-
scopesAvailable: string[];
|
|
116
|
-
docsUrl: string | null;
|
|
117
|
-
logoUrl: string | null;
|
|
118
|
-
isActive: boolean;
|
|
119
|
-
};
|
|
120
|
-
} & {
|
|
121
|
-
name: string;
|
|
122
|
-
id: string;
|
|
123
|
-
createdAt: Date;
|
|
124
|
-
updatedAt: Date;
|
|
125
|
-
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
126
|
-
scopes: string[];
|
|
127
|
-
slug: string;
|
|
128
|
-
organizationId: string;
|
|
129
|
-
providerId: string;
|
|
130
|
-
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
131
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
132
|
-
clientId: string | null;
|
|
133
|
-
redirectUri: string | null;
|
|
134
|
-
isEnabled: boolean;
|
|
135
|
-
}>;
|
|
136
|
-
update(organizationId: string, id: string, input: UpdateConfigurationInput): Promise<{
|
|
137
|
-
provider: {
|
|
138
|
-
name: string;
|
|
139
|
-
key: string;
|
|
140
|
-
id: string;
|
|
141
|
-
createdAt: Date;
|
|
142
|
-
updatedAt: Date;
|
|
143
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
144
|
-
authorizationUrl: string | null;
|
|
145
|
-
tokenUrl: string | null;
|
|
146
|
-
revokeUrl: string | null;
|
|
147
|
-
apiBaseUrl: string | null;
|
|
148
|
-
scopesAvailable: string[];
|
|
149
|
-
docsUrl: string | null;
|
|
150
|
-
logoUrl: string | null;
|
|
151
|
-
isActive: boolean;
|
|
152
|
-
};
|
|
153
|
-
} & {
|
|
154
|
-
name: string;
|
|
155
|
-
id: string;
|
|
156
|
-
createdAt: Date;
|
|
157
|
-
updatedAt: Date;
|
|
158
|
-
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
159
|
-
scopes: string[];
|
|
160
|
-
slug: string;
|
|
161
|
-
organizationId: string;
|
|
162
|
-
providerId: string;
|
|
163
|
-
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
164
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
165
|
-
clientId: string | null;
|
|
166
|
-
redirectUri: string | null;
|
|
167
|
-
isEnabled: boolean;
|
|
168
|
-
}>;
|
|
169
|
-
remove(organizationId: string, id: string): Promise<void>;
|
|
26
|
+
callbackUrlFor(integrationKey: string): string;
|
|
27
|
+
list(organizationId: string, userId: string, environmentId: string): Promise<import("./configurations.repository.js").PublicConfiguration[]>;
|
|
28
|
+
get(organizationId: string, userId: string, environmentId: string, id: string): Promise<import("./configurations.repository.js").PublicConfiguration>;
|
|
29
|
+
/** How a caller's slug resolves, once a key has named the environment. */
|
|
30
|
+
getBySlug(environmentId: string, slug: string): Promise<import("./configurations.repository.js").PublicConfiguration>;
|
|
31
|
+
create(organizationId: string, userId: string, environmentId: string, input: CreateConfigurationDto): Promise<import("./configurations.repository.js").PublicConfiguration>;
|
|
32
|
+
update(organizationId: string, userId: string, environmentId: string, id: string, input: UpdateConfigurationDto): Promise<import("./configurations.repository.js").PublicConfiguration>;
|
|
33
|
+
/**
|
|
34
|
+
* Refused while credentials still point at this row. `account.providerId` is
|
|
35
|
+
* a plain string, so nothing in the database would stop the delete from
|
|
36
|
+
* orphaning them.
|
|
37
|
+
*/
|
|
38
|
+
remove(organizationId: string, userId: string, environmentId: string, id: string): Promise<void>;
|
|
170
39
|
/**
|
|
171
|
-
*
|
|
40
|
+
* Opens the secret half, for the connect and proxy paths only. Never
|
|
172
41
|
* reachable from a controller.
|
|
173
42
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
183
|
-
authorizationUrl: string | null;
|
|
184
|
-
tokenUrl: string | null;
|
|
185
|
-
revokeUrl: string | null;
|
|
186
|
-
apiBaseUrl: string | null;
|
|
187
|
-
scopesAvailable: string[];
|
|
188
|
-
docsUrl: string | null;
|
|
189
|
-
logoUrl: string | null;
|
|
190
|
-
isActive: boolean;
|
|
191
|
-
};
|
|
192
|
-
name: string;
|
|
193
|
-
id: string;
|
|
194
|
-
createdAt: Date;
|
|
195
|
-
updatedAt: Date;
|
|
196
|
-
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
197
|
-
scopes: string[];
|
|
198
|
-
slug: string;
|
|
199
|
-
organizationId: string;
|
|
200
|
-
providerId: string;
|
|
201
|
-
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
202
|
-
authType: import("../generated/prisma/enums.js").AuthType;
|
|
203
|
-
clientId: string | null;
|
|
204
|
-
encryptedClientSecret: string | null;
|
|
205
|
-
redirectUri: string | null;
|
|
206
|
-
isEnabled: boolean;
|
|
207
|
-
}>;
|
|
208
|
-
private validateScopes;
|
|
43
|
+
getWithCredentials(configurationId: string): Promise<ConfigurationWithCredentials>;
|
|
44
|
+
/**
|
|
45
|
+
* What the auth type needs, encrypted as one blob rather than a column per
|
|
46
|
+
* field — a GitHub App configuration holds an appId and a private key where
|
|
47
|
+
* an OAuth2 one holds a client id and secret, and neither should force a
|
|
48
|
+
* migration on the other.
|
|
49
|
+
*/
|
|
50
|
+
private sealCredentials;
|
|
209
51
|
/**
|
|
210
52
|
* Checks per-organization settings against the integration's declared
|
|
211
|
-
* `configFields
|
|
212
|
-
*
|
|
53
|
+
* `configFields`, and any scopes against what the provider actually offers.
|
|
54
|
+
* Integrations describe their settings as data so the admin can render a
|
|
55
|
+
* form; the same description is what validates here.
|
|
213
56
|
*/
|
|
214
57
|
private validateSettings;
|
|
58
|
+
private validateScopes;
|
|
215
59
|
}
|
|
216
60
|
//# sourceMappingURL=configurations.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurations.service.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configurations.service.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,wEAAwE;AACxE,MAAM,WAAW,4BAA4B;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,qBACa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJ5B,cAAc,EAAE,wBAAwB,EACxC,YAAY,EAAE,mBAAmB,EACjC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,mBAAmB,EACP,MAAM,EAAE,mBAAmB;IAGpE;;;;OAIG;IACH,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAKxC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAKlE,GAAG,CACP,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,MAAM;IASZ,0EAA0E;IACpE,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAS7C,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,sBAAsB;IAyCzB,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,sBAAsB;IAkB/B;;;;OAIG;IACG,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,MAAM;IAcZ;;;OAGG;IACG,kBAAkB,CACtB,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,4BAA4B,CAAC;IAgBxC;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IA4CxB,OAAO,CAAC,cAAc;CAkBvB"}
|