@kosha-ai/server 0.0.3 → 0.0.4
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 +10 -0
- package/dist/auth/api-key.guard.d.ts.map +1 -1
- package/dist/auth/api-key.guard.js +36 -5
- package/dist/auth/auth.factory.d.ts.map +1 -1
- package/dist/auth/auth.factory.js +5 -1
- package/dist/configurations/configurations.controller.d.ts +4 -0
- package/dist/configurations/configurations.controller.d.ts.map +1 -1
- package/dist/configurations/configurations.service.d.ts +6 -0
- package/dist/configurations/configurations.service.d.ts.map +1 -1
- package/dist/configurations/configurations.service.js +12 -0
- package/dist/connect/connect.controller.d.ts +8 -10
- package/dist/connect/connect.controller.d.ts.map +1 -1
- package/dist/connect/connect.controller.js +8 -6
- package/dist/connect/connect.service.d.ts +2 -1
- package/dist/connect/connect.service.d.ts.map +1 -1
- package/dist/connect/connect.service.js +8 -3
- package/dist/connections/connections.controller.d.ts +4 -4
- package/dist/connections/connections.controller.d.ts.map +1 -1
- package/dist/connections/connections.controller.js +14 -12
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +1 -0
- package/dist/generated/prisma/internal/prismaNamespace.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +1 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +1 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts.map +1 -1
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +1 -0
- package/dist/generated/prisma/models/Configuration.d.ts +56 -2
- package/dist/generated/prisma/models/Configuration.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/prisma/migrations/20260916000000_add_configuration_slug/migration.sql +15 -0
- package/prisma/schema.prisma +2 -0
|
@@ -4,6 +4,11 @@ import type { Request } from 'express';
|
|
|
4
4
|
import type { KoshaAuth } from './auth.factory.js';
|
|
5
5
|
export interface ApiKeyRequest extends Request {
|
|
6
6
|
organizationId: string;
|
|
7
|
+
session?: {
|
|
8
|
+
session?: {
|
|
9
|
+
activeOrganizationId?: string | null;
|
|
10
|
+
};
|
|
11
|
+
} | null;
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* Authenticates machine-to-machine calls with `x-api-key` and puts the owning
|
|
@@ -15,4 +20,9 @@ export declare class ApiKeyGuard implements CanActivate {
|
|
|
15
20
|
constructor(authService: AuthService<KoshaAuth>);
|
|
16
21
|
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
17
22
|
}
|
|
23
|
+
export declare class OrgAuthGuard implements CanActivate {
|
|
24
|
+
private readonly authService;
|
|
25
|
+
constructor(authService: AuthService<KoshaAuth>);
|
|
26
|
+
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
27
|
+
}
|
|
18
28
|
//# sourceMappingURL=api-key.guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key.guard.d.ts","sourceRoot":"","sources":["../../src/auth/api-key.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,cAAc,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"api-key.guard.d.ts","sourceRoot":"","sources":["../../src/auth/api-key.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE;YAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CACzE;AAiBD;;;;GAIG;AACH,qBACa,WAAY,YAAW,WAAW;IAG3C,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC;IAGhD,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAc/D;AAED,qBACa,YAAa,YAAW,WAAW;IAG5C,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC;IAGhD,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAsB/D"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { Inject, Injectable, UnauthorizedException, } from '@nestjs/common';
|
|
3
3
|
import { AuthService } from '@thallesp/nestjs-better-auth';
|
|
4
|
+
/** Verifies an org-scoped API key. Throws rather than returning false. */
|
|
5
|
+
async function organizationIdForApiKey(authService, key) {
|
|
6
|
+
const result = await authService.api.verifyApiKey({ body: { key } });
|
|
7
|
+
if (!result.valid || !result.key?.referenceId) {
|
|
8
|
+
const code = result.error?.code;
|
|
9
|
+
throw new UnauthorizedException(code ? `API key rejected: ${code}` : 'Invalid API key');
|
|
10
|
+
}
|
|
11
|
+
return result.key.referenceId;
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
14
|
* Authenticates machine-to-machine calls with `x-api-key` and puts the owning
|
|
6
15
|
* organization on the request. Keys are org-scoped: Better Auth's API-key
|
|
@@ -17,11 +26,7 @@ let ApiKeyGuard = class ApiKeyGuard {
|
|
|
17
26
|
if (!key || typeof key !== 'string') {
|
|
18
27
|
throw new UnauthorizedException('Missing x-api-key header');
|
|
19
28
|
}
|
|
20
|
-
|
|
21
|
-
if (!result.valid || !result.key?.referenceId) {
|
|
22
|
-
throw new UnauthorizedException('Invalid API key');
|
|
23
|
-
}
|
|
24
|
-
request.organizationId = result.key.referenceId;
|
|
29
|
+
request.organizationId = await organizationIdForApiKey(this.authService, key);
|
|
25
30
|
return true;
|
|
26
31
|
}
|
|
27
32
|
};
|
|
@@ -31,3 +36,29 @@ ApiKeyGuard = __decorate([
|
|
|
31
36
|
__metadata("design:paramtypes", [AuthService])
|
|
32
37
|
], ApiKeyGuard);
|
|
33
38
|
export { ApiKeyGuard };
|
|
39
|
+
let OrgAuthGuard = class OrgAuthGuard {
|
|
40
|
+
authService;
|
|
41
|
+
constructor(authService) {
|
|
42
|
+
this.authService = authService;
|
|
43
|
+
}
|
|
44
|
+
async canActivate(context) {
|
|
45
|
+
const request = context.switchToHttp().getRequest();
|
|
46
|
+
const key = request.headers['x-api-key'];
|
|
47
|
+
if (typeof key === 'string' && key.length > 0) {
|
|
48
|
+
request.organizationId = await organizationIdForApiKey(this.authService, key);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
const organizationId = request.session?.session?.activeOrganizationId;
|
|
52
|
+
if (!organizationId) {
|
|
53
|
+
throw new UnauthorizedException('Send an x-api-key header, or sign in and select an organization');
|
|
54
|
+
}
|
|
55
|
+
request.organizationId = organizationId;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
OrgAuthGuard = __decorate([
|
|
60
|
+
Injectable(),
|
|
61
|
+
__param(0, Inject(AuthService)),
|
|
62
|
+
__metadata("design:paramtypes", [AuthService])
|
|
63
|
+
], OrgAuthGuard);
|
|
64
|
+
export { OrgAuthGuard };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.factory.d.ts","sourceRoot":"","sources":["../../src/auth/auth.factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAAG,OAAO,CAAC;QACtD,KAAK,EAAE,OAAO,CAAC;QACf,GAAG,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;QAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG;IAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,YAAY,CAAA;CAAE,CAAC;AAEnE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAEtE;AAUD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,mBAAmB,GAC1B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CAYhD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,YAAY,GACnB,SAAS,
|
|
1
|
+
{"version":3,"file":"auth.factory.d.ts","sourceRoot":"","sources":["../../src/auth/auth.factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAc,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,gFAAgF;AAChF,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,GAAG,OAAO,CAAC;QACtD,KAAK,EAAE,OAAO,CAAC;QACf,GAAG,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;QAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG;IAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,YAAY,CAAA;CAAE,CAAC;AAEnE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAEtE;AAUD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,mBAAmB,GAC1B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,SAAS,CAYhD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,YAAY,GACnB,SAAS,CAyBX"}
|
|
@@ -44,7 +44,11 @@ export function createAuth(config, prisma) {
|
|
|
44
44
|
advanced: { defaultCookieAttributes: crossSiteCookieAttributes(config) },
|
|
45
45
|
plugins: [
|
|
46
46
|
organization(),
|
|
47
|
-
apiKey({
|
|
47
|
+
apiKey({
|
|
48
|
+
references: 'organization',
|
|
49
|
+
requireName: true,
|
|
50
|
+
rateLimit: { enabled: true, maxRequests: 600, timeWindow: 60_000 },
|
|
51
|
+
}),
|
|
48
52
|
],
|
|
49
53
|
});
|
|
50
54
|
// Better Auth's instance type is parameterised by the exact options object,
|
|
@@ -31,6 +31,7 @@ export declare class ConfigurationsController {
|
|
|
31
31
|
updatedAt: Date;
|
|
32
32
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
33
33
|
scopes: string[];
|
|
34
|
+
slug: string;
|
|
34
35
|
organizationId: string;
|
|
35
36
|
providerId: string;
|
|
36
37
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -63,6 +64,7 @@ export declare class ConfigurationsController {
|
|
|
63
64
|
updatedAt: Date;
|
|
64
65
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
65
66
|
scopes: string[];
|
|
67
|
+
slug: string;
|
|
66
68
|
organizationId: string;
|
|
67
69
|
providerId: string;
|
|
68
70
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -95,6 +97,7 @@ export declare class ConfigurationsController {
|
|
|
95
97
|
updatedAt: Date;
|
|
96
98
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
97
99
|
scopes: string[];
|
|
100
|
+
slug: string;
|
|
98
101
|
organizationId: string;
|
|
99
102
|
providerId: string;
|
|
100
103
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -127,6 +130,7 @@ export declare class ConfigurationsController {
|
|
|
127
130
|
updatedAt: Date;
|
|
128
131
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
129
132
|
scopes: string[];
|
|
133
|
+
slug: string;
|
|
130
134
|
organizationId: string;
|
|
131
135
|
providerId: string;
|
|
132
136
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurations.controller.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EACL,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,qBACa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,qBAAqB;IAGlE,IAAI,CAAY,OAAO,EAAE,WAAW
|
|
1
|
+
{"version":3,"file":"configurations.controller.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.controller.ts"],"names":[],"mappings":"AASA,OAAO,EAAW,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,EACL,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC9B,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,qBACa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,qBAAqB;IAGlE,IAAI,CAAY,OAAO,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKpC,GAAG,CAAY,OAAO,EAAE,WAAW,EAAe,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK5D,MAAM,CACO,OAAO,EAAE,WAAW,EACvB,IAAI,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMxC,MAAM,CACO,OAAO,EAAE,WAAW,EAClB,EAAE,EAAE,MAAM,EACf,IAAI,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUlC,MAAM,CAAY,OAAO,EAAE,WAAW,EAAe,EAAE,EAAE,MAAM;;;;CAItE"}
|
|
@@ -7,6 +7,7 @@ export interface CreateConfigurationInput {
|
|
|
7
7
|
/** Provider key, e.g. "github". */
|
|
8
8
|
provider: string;
|
|
9
9
|
name: string;
|
|
10
|
+
slug?: string;
|
|
10
11
|
clientId: string;
|
|
11
12
|
clientSecret: string;
|
|
12
13
|
scopes?: string[];
|
|
@@ -57,6 +58,7 @@ export declare class ConfigurationsService {
|
|
|
57
58
|
updatedAt: Date;
|
|
58
59
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
59
60
|
scopes: string[];
|
|
61
|
+
slug: string;
|
|
60
62
|
organizationId: string;
|
|
61
63
|
providerId: string;
|
|
62
64
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -89,6 +91,7 @@ export declare class ConfigurationsService {
|
|
|
89
91
|
updatedAt: Date;
|
|
90
92
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
91
93
|
scopes: string[];
|
|
94
|
+
slug: string;
|
|
92
95
|
organizationId: string;
|
|
93
96
|
providerId: string;
|
|
94
97
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -121,6 +124,7 @@ export declare class ConfigurationsService {
|
|
|
121
124
|
updatedAt: Date;
|
|
122
125
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
123
126
|
scopes: string[];
|
|
127
|
+
slug: string;
|
|
124
128
|
organizationId: string;
|
|
125
129
|
providerId: string;
|
|
126
130
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -153,6 +157,7 @@ export declare class ConfigurationsService {
|
|
|
153
157
|
updatedAt: Date;
|
|
154
158
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
155
159
|
scopes: string[];
|
|
160
|
+
slug: string;
|
|
156
161
|
organizationId: string;
|
|
157
162
|
providerId: string;
|
|
158
163
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -190,6 +195,7 @@ export declare class ConfigurationsService {
|
|
|
190
195
|
updatedAt: Date;
|
|
191
196
|
metadata: import("@prisma/client/runtime/client").JsonValue | null;
|
|
192
197
|
scopes: string[];
|
|
198
|
+
slug: string;
|
|
193
199
|
organizationId: string;
|
|
194
200
|
providerId: string;
|
|
195
201
|
environment: import("../generated/prisma/enums.js").ConnectionEnvironment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurations.service.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.service.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAKD,qBACa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAH5B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,mBAAmB,EACP,MAAM,EAAE,mBAAmB;IAGpE;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAK3C,IAAI,CAAC,cAAc,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"configurations.service.d.ts","sourceRoot":"","sources":["../../src/configurations/configurations.service.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAKD,qBACa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAH5B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,mBAAmB,EACP,MAAM,EAAE,mBAAmB;IAGpE;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAK3C,IAAI,CAAC,cAAc,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASrB,GAAG,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYtC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiD9D,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2B3B,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAK/C;;;OAGG;IACG,sBAAsB,CAAC,eAAe,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoBpD,OAAO,CAAC,cAAc;IAetB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;CAiCzB"}
|
|
@@ -63,11 +63,16 @@ let ConfigurationsService = class ConfigurationsService {
|
|
|
63
63
|
}
|
|
64
64
|
const scopes = this.validateScopes(input.provider, input.scopes ?? []);
|
|
65
65
|
const settings = this.validateSettings(input.provider, input.settings);
|
|
66
|
+
const slug = slugify(input.slug ?? input.name);
|
|
67
|
+
if (!slug) {
|
|
68
|
+
throw new BadRequestException('slug must contain at least one letter or digit');
|
|
69
|
+
}
|
|
66
70
|
return this.prisma.configuration.create({
|
|
67
71
|
data: {
|
|
68
72
|
organizationId,
|
|
69
73
|
providerId: provider.id,
|
|
70
74
|
name: input.name.trim(),
|
|
75
|
+
slug,
|
|
71
76
|
authType: provider.authType,
|
|
72
77
|
environment: input.environment ?? 'LIVE',
|
|
73
78
|
clientId: input.clientId,
|
|
@@ -173,6 +178,13 @@ ConfigurationsService = __decorate([
|
|
|
173
178
|
IntegrationRegistry, Object])
|
|
174
179
|
], ConfigurationsService);
|
|
175
180
|
export { ConfigurationsService };
|
|
181
|
+
/** Lowercase, digits and single dashes. Empty if the input has no word chars. */
|
|
182
|
+
function slugify(value) {
|
|
183
|
+
return value
|
|
184
|
+
.toLowerCase()
|
|
185
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
186
|
+
.replace(/^-+|-+$/g, '');
|
|
187
|
+
}
|
|
176
188
|
function describeTypeMismatch(field, value) {
|
|
177
189
|
switch (field.type) {
|
|
178
190
|
case 'number':
|
|
@@ -1,28 +1,26 @@
|
|
|
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 } from './connect.service.js';
|
|
4
|
+
import { ConnectService, type CreateConnectSessionInput } from './connect.service.js';
|
|
5
5
|
export declare class ConnectController {
|
|
6
6
|
private readonly connect;
|
|
7
7
|
private readonly logger;
|
|
8
8
|
constructor(connect: ConnectService);
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* The organization's backend asks for a connect link for one of its own
|
|
11
|
+
* users, over `x-api-key`; the admin UI may do the same over its cookie
|
|
12
|
+
* session. `AllowAnonymous` disables the session guard so `OrgAuthGuard`
|
|
13
|
+
* can authenticate either way.
|
|
13
14
|
*/
|
|
14
|
-
createSession(request: ApiKeyRequest, body:
|
|
15
|
-
endUserExternalId: string;
|
|
16
|
-
configurationId: string;
|
|
17
|
-
redirectUrl?: string;
|
|
18
|
-
}): Promise<import("./connect.service.js").ConnectSessionResult>;
|
|
15
|
+
createSession(request: ApiKeyRequest, body: CreateConnectSessionInput): Promise<import("./connect.service.js").ConnectSessionResult>;
|
|
19
16
|
/**
|
|
20
17
|
* Admin-only: runs the same flow with the signed-in admin standing in for an
|
|
21
18
|
* end user, so an operator can verify a configuration without wiring up
|
|
22
19
|
* their backend first.
|
|
23
20
|
*/
|
|
24
21
|
createTestSession(session: UserSession, body: {
|
|
25
|
-
configurationId
|
|
22
|
+
configurationId?: string;
|
|
23
|
+
slug?: string;
|
|
26
24
|
redirectUrl?: string;
|
|
27
25
|
}): Promise<import("./connect.service.js").ConnectSessionResult>;
|
|
28
26
|
/** The URL the end user's browser opens. Redirects to the provider. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.controller.d.ts","sourceRoot":"","sources":["../../src/connect/connect.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"connect.controller.d.ts","sourceRoot":"","sources":["../../src/connect/connect.controller.ts"],"names":[],"mappings":"AAaA,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,EACL,cAAc,EACd,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,qBACa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAEhC,OAAO,EAAE,cAAc;IAEpD;;;;;OAKG;IAIH,aAAa,CACJ,OAAO,EAAE,aAAa,EACrB,IAAI,EAAE,yBAAyB;IAKzC;;;;OAIG;IAEH,iBAAiB,CACJ,OAAO,EAAE,WAAW,EAE/B,IAAI,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAUzE,uEAAuE;IAGjE,KAAK,CAAiB,KAAK,EAAE,MAAM,EAAS,GAAG,EAAE,QAAQ;IAY/D,kDAAkD;IAG5C,QAAQ,CACU,WAAW,EAAE,MAAM,EAC1B,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;CA+CvB"}
|
|
@@ -2,9 +2,9 @@ var ConnectController_1;
|
|
|
2
2
|
import { __decorate, __metadata, __param } from "tslib";
|
|
3
3
|
import { BadRequestException, Body, Controller, Get, Logger, Param, Post, Query, Req, Res, UseGuards, } from '@nestjs/common';
|
|
4
4
|
import { AllowAnonymous, Session, } from '@thallesp/nestjs-better-auth';
|
|
5
|
-
import {
|
|
5
|
+
import { OrgAuthGuard } from '../auth/api-key.guard.js';
|
|
6
6
|
import { getActiveOrganizationId } from '../common/active-organization.js';
|
|
7
|
-
import { ConnectService } from './connect.service.js';
|
|
7
|
+
import { ConnectService, } from './connect.service.js';
|
|
8
8
|
let ConnectController = ConnectController_1 = class ConnectController {
|
|
9
9
|
connect;
|
|
10
10
|
logger = new Logger(ConnectController_1.name);
|
|
@@ -12,9 +12,10 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
12
12
|
this.connect = connect;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The organization's backend asks for a connect link for one of its own
|
|
16
|
+
* users, over `x-api-key`; the admin UI may do the same over its cookie
|
|
17
|
+
* session. `AllowAnonymous` disables the session guard so `OrgAuthGuard`
|
|
18
|
+
* can authenticate either way.
|
|
18
19
|
*/
|
|
19
20
|
createSession(request, body) {
|
|
20
21
|
return this.connect.createSession(request.organizationId, body);
|
|
@@ -28,6 +29,7 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
28
29
|
return this.connect.createSession(getActiveOrganizationId(session), {
|
|
29
30
|
endUserExternalId: `kosha-admin:${session.user.id}`,
|
|
30
31
|
configurationId: body?.configurationId,
|
|
32
|
+
configurationSlug: body?.slug,
|
|
31
33
|
redirectUrl: body?.redirectUrl,
|
|
32
34
|
});
|
|
33
35
|
}
|
|
@@ -79,7 +81,7 @@ let ConnectController = ConnectController_1 = class ConnectController {
|
|
|
79
81
|
__decorate([
|
|
80
82
|
Post('sessions'),
|
|
81
83
|
AllowAnonymous(),
|
|
82
|
-
UseGuards(
|
|
84
|
+
UseGuards(OrgAuthGuard),
|
|
83
85
|
__param(0, Req()),
|
|
84
86
|
__param(1, Body()),
|
|
85
87
|
__metadata("design:type", Function),
|
|
@@ -6,7 +6,8 @@ import { IntegrationRegistry } from '../integrations/integration.registry.js';
|
|
|
6
6
|
import { PrismaService } from '../prisma/prisma.service.js';
|
|
7
7
|
export interface CreateConnectSessionInput {
|
|
8
8
|
endUserExternalId: string;
|
|
9
|
-
configurationId
|
|
9
|
+
configurationId?: string;
|
|
10
|
+
configurationSlug?: string;
|
|
10
11
|
redirectUrl?: string;
|
|
11
12
|
}
|
|
12
13
|
export interface ConnectSessionResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.service.d.ts","sourceRoot":"","sources":["../../src/connect/connect.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAoB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"connect.service.d.ts","sourceRoot":"","sources":["../../src/connect/connect.service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAoB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,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;AAMD;;;;;;GAMG;AACH,qBACa,cAAc;IAIvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACH,OAAO,CAAC,QAAQ,CAAC,MAAM;IAP/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;gBAGvC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,qBAAqB,EACrC,QAAQ,EAAE,mBAAmB,EACP,MAAM,EAAE,mBAAmB;IAGpE;;;OAGG;IACG,aAAa,CACjB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,oBAAoB,CAAC;IAyDhC;;;;OAIG;IACG,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoDhE,qDAAqD;IAC/C,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,CAAC;IAkG1B,8EAA8E;IACxE,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB5E,sEAAsE;YACxD,OAAO;CActB"}
|
|
@@ -43,12 +43,16 @@ let ConnectService = ConnectService_1 = class ConnectService {
|
|
|
43
43
|
if (!input?.endUserExternalId?.trim()) {
|
|
44
44
|
throw new BadRequestException('endUserExternalId is required');
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const configurationId = input.configurationId?.trim();
|
|
47
|
+
const configurationSlug = input.configurationSlug?.trim();
|
|
48
|
+
if (!configurationId && !configurationSlug) {
|
|
49
|
+
throw new BadRequestException('configurationId or configurationSlug is required');
|
|
48
50
|
}
|
|
49
51
|
const configuration = await this.prisma.configuration.findFirst({
|
|
50
52
|
where: {
|
|
51
|
-
|
|
53
|
+
...(configurationId
|
|
54
|
+
? { id: configurationId }
|
|
55
|
+
: { slug: configurationSlug }),
|
|
52
56
|
organizationId,
|
|
53
57
|
isEnabled: true,
|
|
54
58
|
},
|
|
@@ -188,6 +192,7 @@ let ConnectService = ConnectService_1 = class ConnectService {
|
|
|
188
192
|
lastUsedAt: new Date(),
|
|
189
193
|
},
|
|
190
194
|
update: {
|
|
195
|
+
endUserId,
|
|
191
196
|
status: 'ACTIVE',
|
|
192
197
|
label: identity.label,
|
|
193
198
|
errorMessage: null,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ApiKeyRequest } from '../auth/api-key.guard.js';
|
|
2
2
|
import { ConnectionsService } from './connections.service.js';
|
|
3
3
|
export declare class ConnectionsController {
|
|
4
4
|
private readonly connections;
|
|
5
5
|
constructor(connections: ConnectionsService);
|
|
6
|
-
list(
|
|
6
|
+
list(request: ApiKeyRequest, endUserExternalId?: string): import("../generated/prisma/internal/prismaNamespace.js").PrismaPromise<({
|
|
7
7
|
configuration: {
|
|
8
8
|
name: string;
|
|
9
9
|
id: string;
|
|
@@ -33,7 +33,7 @@ export declare class ConnectionsController {
|
|
|
33
33
|
lastUsedAt: Date | null;
|
|
34
34
|
errorMessage: string | null;
|
|
35
35
|
})[]>;
|
|
36
|
-
get(
|
|
36
|
+
get(request: ApiKeyRequest, id: string): Promise<{
|
|
37
37
|
configuration: {
|
|
38
38
|
name: string;
|
|
39
39
|
id: string;
|
|
@@ -63,7 +63,7 @@ export declare class ConnectionsController {
|
|
|
63
63
|
lastUsedAt: Date | null;
|
|
64
64
|
errorMessage: string | null;
|
|
65
65
|
}>;
|
|
66
|
-
revoke(
|
|
66
|
+
revoke(request: ApiKeyRequest, id: string): Promise<{
|
|
67
67
|
id: string;
|
|
68
68
|
status: "REVOKED";
|
|
69
69
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.controller.d.ts","sourceRoot":"","sources":["../../src/connections/connections.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connections.controller.d.ts","sourceRoot":"","sources":["../../src/connections/connections.controller.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,aAAa,EAAgB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,qBAGa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAG5D,IAAI,CACK,OAAO,EAAE,aAAa,EACD,iBAAiB,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQxD,GAAG,CAAQ,OAAO,EAAE,aAAa,EAAe,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK1D,MAAM,CAAQ,OAAO,EAAE,aAAa,EAAe,EAAE,EAAE,MAAM;;;;CAG9D"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import { Controller, Delete, Get, Param, Query } from '@nestjs/common';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Controller, Delete, Get, Param, Query, Req, UseGuards, } from '@nestjs/common';
|
|
3
|
+
import { AllowAnonymous } from '@thallesp/nestjs-better-auth';
|
|
4
|
+
import { OrgAuthGuard } from '../auth/api-key.guard.js';
|
|
5
5
|
import { ConnectionsService } from './connections.service.js';
|
|
6
6
|
let ConnectionsController = class ConnectionsController {
|
|
7
7
|
connections;
|
|
8
8
|
constructor(connections) {
|
|
9
9
|
this.connections = connections;
|
|
10
10
|
}
|
|
11
|
-
list(
|
|
12
|
-
return this.connections.list(
|
|
11
|
+
list(request, endUserExternalId) {
|
|
12
|
+
return this.connections.list(request.organizationId, {
|
|
13
13
|
endUserExternalId,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
get(
|
|
17
|
-
return this.connections.get(
|
|
16
|
+
get(request, id) {
|
|
17
|
+
return this.connections.get(request.organizationId, id);
|
|
18
18
|
}
|
|
19
|
-
revoke(
|
|
20
|
-
return this.connections.revoke(
|
|
19
|
+
revoke(request, id) {
|
|
20
|
+
return this.connections.revoke(request.organizationId, id);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
__decorate([
|
|
24
24
|
Get(),
|
|
25
|
-
__param(0,
|
|
25
|
+
__param(0, Req()),
|
|
26
26
|
__param(1, Query('endUserExternalId')),
|
|
27
27
|
__metadata("design:type", Function),
|
|
28
28
|
__metadata("design:paramtypes", [Object, String]),
|
|
@@ -30,7 +30,7 @@ __decorate([
|
|
|
30
30
|
], ConnectionsController.prototype, "list", null);
|
|
31
31
|
__decorate([
|
|
32
32
|
Get(':id'),
|
|
33
|
-
__param(0,
|
|
33
|
+
__param(0, Req()),
|
|
34
34
|
__param(1, Param('id')),
|
|
35
35
|
__metadata("design:type", Function),
|
|
36
36
|
__metadata("design:paramtypes", [Object, String]),
|
|
@@ -38,7 +38,7 @@ __decorate([
|
|
|
38
38
|
], ConnectionsController.prototype, "get", null);
|
|
39
39
|
__decorate([
|
|
40
40
|
Delete(':id'),
|
|
41
|
-
__param(0,
|
|
41
|
+
__param(0, Req()),
|
|
42
42
|
__param(1, Param('id')),
|
|
43
43
|
__metadata("design:type", Function),
|
|
44
44
|
__metadata("design:paramtypes", [Object, String]),
|
|
@@ -46,6 +46,8 @@ __decorate([
|
|
|
46
46
|
], ConnectionsController.prototype, "revoke", null);
|
|
47
47
|
ConnectionsController = __decorate([
|
|
48
48
|
Controller('connections'),
|
|
49
|
+
AllowAnonymous(),
|
|
50
|
+
UseGuards(OrgAuthGuard),
|
|
49
51
|
__metadata("design:paramtypes", [ConnectionsService])
|
|
50
52
|
], ConnectionsController);
|
|
51
53
|
export { ConnectionsController };
|