triangle-types 1.0.16 → 1.0.17

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.
@@ -6,6 +6,7 @@ export declare class Scout {
6
6
  readonly scout_type_id: ScoutTypeID;
7
7
  readonly number: number;
8
8
  readonly name: string;
9
+ readonly s3_id_jpeg?: string;
9
10
  readonly [x: string]: any;
10
11
  constructor(scout: any);
11
12
  static is(scout: any): scout is Scout;
@@ -7,6 +7,7 @@ export class Scout {
7
7
  scout_type_id;
8
8
  number;
9
9
  name;
10
+ s3_id_jpeg;
10
11
  constructor(scout) {
11
12
  if (!Scout.is(scout)) {
12
13
  throw Error("Invalid input.");
@@ -15,12 +16,30 @@ export class Scout {
15
16
  this.scout_type_id = scout.scout_type_id;
16
17
  this.number = scout.number;
17
18
  this.name = scout.name;
19
+ this.s3_id_jpeg = scout.s3_id_jpeg;
18
20
  }
19
21
  static is(scout) {
20
22
  return (scout !== undefined &&
21
23
  typeof scout.scout_id === "string" &&
22
24
  is_scout_type_id(scout.scout_type_id) &&
23
25
  typeof scout.number === "number" &&
24
- typeof scout.name === "string");
26
+ typeof scout.name === "string" &&
27
+ (scout.s3_id_jpeg === undefined || typeof scout.s3_id_jpeg === "string"));
25
28
  }
26
29
  }
30
+ // export class ScoutAux extends Scout {
31
+ // readonly photo_url? : string
32
+ // constructor(scout : any) {
33
+ // if (!ScoutAux.is(scout)) {
34
+ // throw Error("Invalid input.")
35
+ // }
36
+ // super(scout)
37
+ // this.photo_url = scout.photo_url
38
+ // }
39
+ // static is(scout : any) : scout is ScoutAux {
40
+ // return (
41
+ // Scout.is(scout) &&
42
+ // (scout.photo_url === undefined || typeof scout.photo_url === "string")
43
+ // )
44
+ // }
45
+ // }
@@ -1,3 +1,6 @@
1
+ declare const role_ids: readonly ["USER", "SCOUT"];
2
+ export type RoleID = typeof role_ids[number];
3
+ export declare function is_role_id(role_id: any): role_id is RoleID;
1
4
  export declare class UserScoutConversationMessage {
2
5
  readonly user_scout_conversation_message_id: string;
3
6
  readonly user_id: string;
@@ -6,10 +9,10 @@ export declare class UserScoutConversationMessage {
6
9
  readonly message_id: string;
7
10
  readonly user_scout_id: string;
8
11
  readonly user_scout_conversation_id: string;
9
- readonly time: string;
10
- readonly role: "USER" | "SCOUT";
12
+ readonly role_id: RoleID;
11
13
  readonly system_prompt?: string;
12
14
  readonly text: string;
13
15
  constructor(user_scout_conversation_message: any);
14
16
  static is(user_scout_conversation_message: any): user_scout_conversation_message is UserScoutConversationMessage;
15
17
  }
18
+ export {};
@@ -1,3 +1,7 @@
1
+ const role_ids = ["USER", "SCOUT"];
2
+ export function is_role_id(role_id) {
3
+ return role_ids.includes(role_id);
4
+ }
1
5
  export class UserScoutConversationMessage {
2
6
  user_scout_conversation_message_id;
3
7
  user_id;
@@ -6,8 +10,7 @@ export class UserScoutConversationMessage {
6
10
  message_id;
7
11
  user_scout_id;
8
12
  user_scout_conversation_id;
9
- time;
10
- role;
13
+ role_id;
11
14
  system_prompt;
12
15
  text;
13
16
  constructor(user_scout_conversation_message) {
@@ -21,8 +24,7 @@ export class UserScoutConversationMessage {
21
24
  this.message_id = user_scout_conversation_message.message_id;
22
25
  this.user_scout_id = user_scout_conversation_message.user_scout_id;
23
26
  this.user_scout_conversation_id = user_scout_conversation_message.user_scout_conversation_id;
24
- this.time = user_scout_conversation_message.time;
25
- this.role = user_scout_conversation_message.role;
27
+ this.role_id = user_scout_conversation_message.role_id;
26
28
  this.system_prompt = user_scout_conversation_message.system_prompt;
27
29
  this.text = user_scout_conversation_message.text;
28
30
  }
@@ -35,8 +37,7 @@ export class UserScoutConversationMessage {
35
37
  typeof user_scout_conversation_message.message_id === "string" &&
36
38
  typeof user_scout_conversation_message.user_scout_id === "string" &&
37
39
  typeof user_scout_conversation_message.user_scout_conversation_id === "string" &&
38
- typeof user_scout_conversation_message.time === "string" &&
39
- ["USER", "SCOUT"].includes(user_scout_conversation_message.role) &&
40
+ is_role_id(user_scout_conversation_message.role_id) &&
40
41
  (user_scout_conversation_message.system_prompt === undefined || typeof user_scout_conversation_message.system_prompt === "string") &&
41
42
  typeof user_scout_conversation_message.text === "string");
42
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -11,6 +11,7 @@ export class Scout {
11
11
  readonly scout_type_id : ScoutTypeID
12
12
  readonly number : number
13
13
  readonly name : string
14
+ readonly s3_id_jpeg? : string
14
15
  readonly [x : string] : any
15
16
 
16
17
  constructor(scout : any) {
@@ -21,6 +22,7 @@ export class Scout {
21
22
  this.scout_type_id = scout.scout_type_id
22
23
  this.number = scout.number
23
24
  this.name = scout.name
25
+ this.s3_id_jpeg = scout.s3_id_jpeg
24
26
  }
25
27
 
26
28
  static is(scout : any) : scout is Scout {
@@ -29,7 +31,27 @@ export class Scout {
29
31
  typeof scout.scout_id === "string" &&
30
32
  is_scout_type_id(scout.scout_type_id) &&
31
33
  typeof scout.number === "number" &&
32
- typeof scout.name === "string"
34
+ typeof scout.name === "string" &&
35
+ (scout.s3_id_jpeg === undefined || typeof scout.s3_id_jpeg === "string")
33
36
  )
34
37
  }
35
- }
38
+ }
39
+
40
+ // export class ScoutAux extends Scout {
41
+ // readonly photo_url? : string
42
+
43
+ // constructor(scout : any) {
44
+ // if (!ScoutAux.is(scout)) {
45
+ // throw Error("Invalid input.")
46
+ // }
47
+ // super(scout)
48
+ // this.photo_url = scout.photo_url
49
+ // }
50
+
51
+ // static is(scout : any) : scout is ScoutAux {
52
+ // return (
53
+ // Scout.is(scout) &&
54
+ // (scout.photo_url === undefined || typeof scout.photo_url === "string")
55
+ // )
56
+ // }
57
+ // }
@@ -1,3 +1,11 @@
1
+ const role_ids = ["USER", "SCOUT"] as const
2
+
3
+ export type RoleID = typeof role_ids[number]
4
+
5
+ export function is_role_id(role_id : any) : role_id is RoleID {
6
+ return role_ids.includes(role_id)
7
+ }
8
+
1
9
  export class UserScoutConversationMessage {
2
10
  readonly user_scout_conversation_message_id : string
3
11
  readonly user_id : string
@@ -6,8 +14,7 @@ export class UserScoutConversationMessage {
6
14
  readonly message_id : string
7
15
  readonly user_scout_id : string
8
16
  readonly user_scout_conversation_id : string
9
- readonly time : string
10
- readonly role : "USER" | "SCOUT"
17
+ readonly role_id : RoleID
11
18
  readonly system_prompt? : string
12
19
  readonly text : string
13
20
 
@@ -22,8 +29,7 @@ export class UserScoutConversationMessage {
22
29
  this.message_id = user_scout_conversation_message.message_id
23
30
  this.user_scout_id = user_scout_conversation_message.user_scout_id
24
31
  this.user_scout_conversation_id = user_scout_conversation_message.user_scout_conversation_id
25
- this.time = user_scout_conversation_message.time
26
- this.role = user_scout_conversation_message.role
32
+ this.role_id = user_scout_conversation_message.role_id
27
33
  this.system_prompt = user_scout_conversation_message.system_prompt
28
34
  this.text = user_scout_conversation_message.text
29
35
  }
@@ -38,8 +44,7 @@ export class UserScoutConversationMessage {
38
44
  typeof user_scout_conversation_message.message_id === "string" &&
39
45
  typeof user_scout_conversation_message.user_scout_id === "string" &&
40
46
  typeof user_scout_conversation_message.user_scout_conversation_id === "string" &&
41
- typeof user_scout_conversation_message.time === "string" &&
42
- ["USER", "SCOUT"].includes(user_scout_conversation_message.role) &&
47
+ is_role_id(user_scout_conversation_message.role_id) &&
43
48
  (user_scout_conversation_message.system_prompt === undefined || typeof user_scout_conversation_message.system_prompt === "string") &&
44
49
  typeof user_scout_conversation_message.text === "string"
45
50
  )