@kosha-ai/server 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAI/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,gBAAgB,CAAC,CA0B3B;AAED,gCAAgC;AAChC,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,gBAAgB,CAAC,CAkB3B"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Logger } from '@nestjs/common';
|
|
2
2
|
import { NestFactory } from '@nestjs/core';
|
|
3
|
+
import express from 'express';
|
|
3
4
|
import { createAdminProxy } from './admin-proxy.js';
|
|
4
5
|
import { resolveConfig } from './config/kosha-config.js';
|
|
5
6
|
import { KoshaModule } from './kosha.module.js';
|
|
@@ -15,6 +16,12 @@ export async function createKoshaServer(config) {
|
|
|
15
16
|
const app = await NestFactory.create(KoshaModule.forRoot(resolved), {
|
|
16
17
|
bodyParser: false,
|
|
17
18
|
});
|
|
19
|
+
const expressApp = app.getHttpAdapter().getInstance();
|
|
20
|
+
for (const integration of resolved.integrations) {
|
|
21
|
+
if (integration.docsPath) {
|
|
22
|
+
expressApp.use(`/${resolved.server.globalPrefix}/integrations/${integration.key}/docs`, express.static(integration.docsPath));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
const cors = resolved.server.cors;
|
|
19
26
|
app.enableCors({
|
|
20
27
|
origin: cors?.origin ?? resolved.auth.trustedOrigins ?? [],
|
|
@@ -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,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,OAA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AAE,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;IAsB5E,sEAAsE;YACxD,OAAO;CActB"}
|
|
@@ -218,18 +218,18 @@ let ConnectService = ConnectService_1 = class ConnectService {
|
|
|
218
218
|
const expiresAt = tokens.expiresInSeconds
|
|
219
219
|
? new Date(Date.now() + tokens.expiresInSeconds * 1000)
|
|
220
220
|
: null;
|
|
221
|
+
const refreshToken = tokens.refreshToken
|
|
222
|
+
? this.crypto.encrypt(tokens.refreshToken)
|
|
223
|
+
: null;
|
|
221
224
|
const data = {
|
|
222
225
|
accessToken: this.crypto.encrypt(tokens.accessToken),
|
|
223
|
-
refreshToken: tokens.refreshToken
|
|
224
|
-
? this.crypto.encrypt(tokens.refreshToken)
|
|
225
|
-
: null,
|
|
226
226
|
tokenType: tokens.tokenType,
|
|
227
227
|
expiresAt,
|
|
228
228
|
};
|
|
229
229
|
await this.prisma.connectionCredential.upsert({
|
|
230
230
|
where: { connectionId },
|
|
231
|
-
create: { connectionId, ...data },
|
|
232
|
-
update: data,
|
|
231
|
+
create: { connectionId, ...data, refreshToken },
|
|
232
|
+
update: refreshToken ? { ...data, refreshToken } : data,
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
/** An integration's hook must never take the request down with it. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosha-ai/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Kosha server: OAuth handshake, encrypted credential storage, token refresh, and an authenticated request proxy for third-party integrations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kosha",
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
"rxjs": "^7.8.0",
|
|
106
106
|
"tslib": "^2.3.0",
|
|
107
107
|
"zod": "4.5.4",
|
|
108
|
-
"@kosha-ai/integration-sdk": "0.0.
|
|
108
|
+
"@kosha-ai/integration-sdk": "0.0.6"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@nestjs/testing": "^11.0.0",
|
|
112
112
|
"@types/express": "^5.0.6",
|
|
113
113
|
"@types/pg": "^8.23.1",
|
|
114
114
|
"prisma": "^7.10.0",
|
|
115
|
-
"@kosha-ai/integration-github": "0.0.
|
|
116
|
-
"@kosha-ai/integration-slack": "0.0.
|
|
115
|
+
"@kosha-ai/integration-github": "0.0.6",
|
|
116
|
+
"@kosha-ai/integration-slack": "0.0.6"
|
|
117
117
|
}
|
|
118
118
|
}
|