@pikku/kysely 0.6.3 → 0.6.5
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/CHANGELOG.md +16 -0
- package/dist/src/kysely-channel-store.d.ts +4 -1
- package/dist/src/kysely-channel-store.js +2 -2
- package/dist/src/pikku-kysely.js +0 -1
- package/package.json +2 -2
- package/sql/serverless-tables.sql +16 -0
- package/src/kysely-channel-store.ts +4 -3
- package/src/pikku-kysely.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pikku/pino
|
|
2
2
|
|
|
3
|
+
## 0.6.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9541f42: fix: deleting ssl invalidation
|
|
8
|
+
|
|
9
|
+
## 0.6.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 8a14f3a: refactor: removing user session from channel object
|
|
14
|
+
- Updated dependencies [ebc04eb]
|
|
15
|
+
- Updated dependencies [8a14f3a]
|
|
16
|
+
- Updated dependencies [2c47386]
|
|
17
|
+
- @pikku/core@0.6.17
|
|
18
|
+
|
|
3
19
|
## 0.6.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CoreUserSession } from '@pikku/core';
|
|
1
2
|
import { Channel, ChannelStore } from '@pikku/core/channel';
|
|
2
3
|
import { Kysely } from 'kysely';
|
|
3
4
|
export declare class KyselyChannelStore extends ChannelStore {
|
|
@@ -6,5 +7,7 @@ export declare class KyselyChannelStore extends ChannelStore {
|
|
|
6
7
|
addChannel({ channelId, channelName, openingData, }: Channel): Promise<void>;
|
|
7
8
|
removeChannels(channelIds: string[]): Promise<void>;
|
|
8
9
|
setUserSession(channelId: string, session: any): Promise<void>;
|
|
9
|
-
|
|
10
|
+
getChannelAndSession(channelId: string): Promise<Channel & {
|
|
11
|
+
session: CoreUserSession;
|
|
12
|
+
}>;
|
|
10
13
|
}
|
|
@@ -28,7 +28,7 @@ export class KyselyChannelStore extends ChannelStore {
|
|
|
28
28
|
.set('userSession', session)
|
|
29
29
|
.executeTakeFirstOrThrow();
|
|
30
30
|
}
|
|
31
|
-
async
|
|
31
|
+
async getChannelAndSession(channelId) {
|
|
32
32
|
const result = await this.database
|
|
33
33
|
.selectFrom('serverless.lambdaChannels')
|
|
34
34
|
.selectAll()
|
|
@@ -36,7 +36,7 @@ export class KyselyChannelStore extends ChannelStore {
|
|
|
36
36
|
.executeTakeFirstOrThrow();
|
|
37
37
|
return {
|
|
38
38
|
openingData: result.openingData,
|
|
39
|
-
|
|
39
|
+
session: result.userSession,
|
|
40
40
|
channelName: result.channelName,
|
|
41
41
|
};
|
|
42
42
|
}
|
package/dist/src/pikku-kysely.js
CHANGED
|
@@ -9,7 +9,6 @@ export class PikkuKysely {
|
|
|
9
9
|
constructor(logger, poolConfig, defaultSchemaName) {
|
|
10
10
|
this.logger = logger;
|
|
11
11
|
this.poolConfig = poolConfig;
|
|
12
|
-
delete poolConfig.ssl;
|
|
13
12
|
this.postgres = postgres(poolConfig);
|
|
14
13
|
this.kysely = new Kysely({
|
|
15
14
|
dialect: new PostgresJSDialect({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/kysely",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"release": "npm run build && npm test"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@pikku/core": "^0.6.
|
|
20
|
+
"@pikku/core": "^0.6.17"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"kysely": "^0.27.6",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
CREATE SCHEMA serverless;
|
|
2
|
+
|
|
3
|
+
CREATE TABLE serverless.lambda_channels (
|
|
4
|
+
channel_id TEXT PRIMARY KEY,
|
|
5
|
+
channel_name TEXT NOT NULL,
|
|
6
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
7
|
+
opening_data JSONB NOT NULL DEFAULT '{}',
|
|
8
|
+
user_session JSONB,
|
|
9
|
+
last_interaction TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
CREATE TABLE serverless.lambda_channel_subscriptions (
|
|
13
|
+
channel_id TEXT NOT NULL REFERENCES serverless.lambda_channels(channel_id) ON DELETE CASCADE,
|
|
14
|
+
topic TEXT NOT NULL,
|
|
15
|
+
PRIMARY KEY (channel_id, topic)
|
|
16
|
+
);
|
|
@@ -37,16 +37,17 @@ export class KyselyChannelStore extends ChannelStore {
|
|
|
37
37
|
.executeTakeFirstOrThrow()
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
public async
|
|
40
|
+
public async getChannelAndSession(channelId: string) {
|
|
41
41
|
const result = await this.database
|
|
42
42
|
.selectFrom('serverless.lambdaChannels')
|
|
43
43
|
.selectAll()
|
|
44
44
|
.where('channelId', '=', channelId)
|
|
45
45
|
.executeTakeFirstOrThrow()
|
|
46
|
+
|
|
46
47
|
return {
|
|
47
48
|
openingData: result.openingData as any,
|
|
48
|
-
|
|
49
|
+
session: result.userSession as CoreUserSession,
|
|
49
50
|
channelName: result.channelName,
|
|
50
|
-
} as Channel
|
|
51
|
+
} as Channel & { session: CoreUserSession }
|
|
51
52
|
}
|
|
52
53
|
}
|
package/src/pikku-kysely.ts
CHANGED