triangle-types 1.0.23 → 1.0.25
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/src/types/scout/UserScoutConversation.d.ts +6 -0
- package/dist/src/types/scout/UserScoutConversation.js +15 -0
- package/dist/src/types/scout/UserScoutConversationMessage.d.ts +4 -4
- package/dist/src/types/scout/UserScoutConversationMessage.js +4 -4
- package/package.json +1 -1
- package/src/types/scout/UserScoutConversation.ts +21 -0
- package/src/types/scout/UserScoutConversationMessage.ts +6 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserScoutConversationMessage } from "./UserScoutConversationMessage.js";
|
|
1
2
|
export declare class UserScoutConversation {
|
|
2
3
|
readonly user_scout_conversation_id: string;
|
|
3
4
|
readonly user_id: string;
|
|
@@ -8,3 +9,8 @@ export declare class UserScoutConversation {
|
|
|
8
9
|
constructor(user_scout_conversation: any);
|
|
9
10
|
static is(user_scout_conversation: any): user_scout_conversation is UserScoutConversation;
|
|
10
11
|
}
|
|
12
|
+
export declare class UserScoutConversationAux extends UserScoutConversation {
|
|
13
|
+
readonly messages: UserScoutConversationMessage[];
|
|
14
|
+
constructor(user_scout_conversation: any);
|
|
15
|
+
static is(user_scout_conversation: any): user_scout_conversation is UserScoutConversationAux;
|
|
16
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserScoutConversationMessage } from "./UserScoutConversationMessage.js";
|
|
1
2
|
export class UserScoutConversation {
|
|
2
3
|
user_scout_conversation_id;
|
|
3
4
|
user_id;
|
|
@@ -23,3 +24,17 @@ export class UserScoutConversation {
|
|
|
23
24
|
typeof user_scout_conversation.user_scout_id === "string");
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
export class UserScoutConversationAux extends UserScoutConversation {
|
|
28
|
+
messages;
|
|
29
|
+
constructor(user_scout_conversation) {
|
|
30
|
+
if (!UserScoutConversationAux.is(user_scout_conversation)) {
|
|
31
|
+
throw Error("Invalid input.");
|
|
32
|
+
}
|
|
33
|
+
super(user_scout_conversation);
|
|
34
|
+
this.messages = user_scout_conversation.messages;
|
|
35
|
+
}
|
|
36
|
+
static is(user_scout_conversation) {
|
|
37
|
+
return (UserScoutConversation.is(user_scout_conversation) &&
|
|
38
|
+
Array.isArray(user_scout_conversation.messages) && user_scout_conversation.messages.every(UserScoutConversationMessage.is));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
export type
|
|
3
|
-
export declare function
|
|
1
|
+
declare const user_scout_conversation_role_ids: readonly ["USER", "SCOUT"];
|
|
2
|
+
export type UserScoutConversationRoleID = typeof user_scout_conversation_role_ids[number];
|
|
3
|
+
export declare function is_user_scout_conversation_role_id(user_scout_conversation_role_id: any): user_scout_conversation_role_id is UserScoutConversationRoleID;
|
|
4
4
|
export declare class UserScoutConversationMessage {
|
|
5
5
|
readonly user_scout_conversation_message_id: string;
|
|
6
6
|
readonly user_id: string;
|
|
@@ -9,7 +9,7 @@ export declare class UserScoutConversationMessage {
|
|
|
9
9
|
readonly message_id: string;
|
|
10
10
|
readonly user_scout_id: string;
|
|
11
11
|
readonly user_scout_conversation_id: string;
|
|
12
|
-
readonly role_id:
|
|
12
|
+
readonly role_id: UserScoutConversationRoleID;
|
|
13
13
|
readonly system_prompt?: string;
|
|
14
14
|
readonly text: string;
|
|
15
15
|
constructor(user_scout_conversation_message: any);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
export function
|
|
3
|
-
return
|
|
1
|
+
const user_scout_conversation_role_ids = ["USER", "SCOUT"];
|
|
2
|
+
export function is_user_scout_conversation_role_id(user_scout_conversation_role_id) {
|
|
3
|
+
return user_scout_conversation_role_ids.includes(user_scout_conversation_role_id);
|
|
4
4
|
}
|
|
5
5
|
export class UserScoutConversationMessage {
|
|
6
6
|
user_scout_conversation_message_id;
|
|
@@ -37,7 +37,7 @@ export class UserScoutConversationMessage {
|
|
|
37
37
|
typeof user_scout_conversation_message.message_id === "string" &&
|
|
38
38
|
typeof user_scout_conversation_message.user_scout_id === "string" &&
|
|
39
39
|
typeof user_scout_conversation_message.user_scout_conversation_id === "string" &&
|
|
40
|
-
|
|
40
|
+
is_user_scout_conversation_role_id(user_scout_conversation_message.role_id) &&
|
|
41
41
|
(user_scout_conversation_message.system_prompt === undefined || typeof user_scout_conversation_message.system_prompt === "string") &&
|
|
42
42
|
typeof user_scout_conversation_message.text === "string");
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UserScoutConversationMessage } from "./UserScoutConversationMessage"
|
|
2
|
+
|
|
1
3
|
export class UserScoutConversation {
|
|
2
4
|
readonly user_scout_conversation_id : string
|
|
3
5
|
readonly user_id : string
|
|
@@ -27,4 +29,23 @@ export class UserScoutConversation {
|
|
|
27
29
|
typeof user_scout_conversation.user_scout_id === "string"
|
|
28
30
|
)
|
|
29
31
|
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class UserScoutConversationAux extends UserScoutConversation {
|
|
35
|
+
readonly messages : UserScoutConversationMessage[]
|
|
36
|
+
|
|
37
|
+
constructor(user_scout_conversation : any) {
|
|
38
|
+
if (!UserScoutConversationAux.is(user_scout_conversation)) {
|
|
39
|
+
throw Error("Invalid input.")
|
|
40
|
+
}
|
|
41
|
+
super(user_scout_conversation)
|
|
42
|
+
this.messages = user_scout_conversation.messages
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static is(user_scout_conversation : any) : user_scout_conversation is UserScoutConversationAux {
|
|
46
|
+
return (
|
|
47
|
+
UserScoutConversation.is(user_scout_conversation) &&
|
|
48
|
+
Array.isArray(user_scout_conversation.messages) && user_scout_conversation.messages.every(UserScoutConversationMessage.is)
|
|
49
|
+
)
|
|
50
|
+
}
|
|
30
51
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const user_scout_conversation_role_ids = ["USER", "SCOUT"] as const
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type UserScoutConversationRoleID = typeof user_scout_conversation_role_ids[number]
|
|
4
4
|
|
|
5
|
-
export function
|
|
6
|
-
return
|
|
5
|
+
export function is_user_scout_conversation_role_id(user_scout_conversation_role_id : any) : user_scout_conversation_role_id is UserScoutConversationRoleID {
|
|
6
|
+
return user_scout_conversation_role_ids.includes(user_scout_conversation_role_id)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export class UserScoutConversationMessage {
|
|
@@ -14,7 +14,7 @@ export class UserScoutConversationMessage {
|
|
|
14
14
|
readonly message_id : string
|
|
15
15
|
readonly user_scout_id : string
|
|
16
16
|
readonly user_scout_conversation_id : string
|
|
17
|
-
readonly role_id :
|
|
17
|
+
readonly role_id : UserScoutConversationRoleID
|
|
18
18
|
readonly system_prompt? : string
|
|
19
19
|
readonly text : string
|
|
20
20
|
|
|
@@ -44,7 +44,7 @@ export class UserScoutConversationMessage {
|
|
|
44
44
|
typeof user_scout_conversation_message.message_id === "string" &&
|
|
45
45
|
typeof user_scout_conversation_message.user_scout_id === "string" &&
|
|
46
46
|
typeof user_scout_conversation_message.user_scout_conversation_id === "string" &&
|
|
47
|
-
|
|
47
|
+
is_user_scout_conversation_role_id(user_scout_conversation_message.role_id) &&
|
|
48
48
|
(user_scout_conversation_message.system_prompt === undefined || typeof user_scout_conversation_message.system_prompt === "string") &&
|
|
49
49
|
typeof user_scout_conversation_message.text === "string"
|
|
50
50
|
)
|