triangle-types 1.0.16 → 1.0.18

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.
@@ -4,8 +4,8 @@ export declare function is_scout_type_id(scout_type_id: any): scout_type_id is S
4
4
  export declare class Scout {
5
5
  readonly scout_id: string;
6
6
  readonly scout_type_id: ScoutTypeID;
7
- readonly number: number;
8
7
  readonly name: string;
8
+ readonly s3_id_jpeg?: string;
9
9
  readonly [x: string]: any;
10
10
  constructor(scout: any);
11
11
  static is(scout: any): scout is Scout;
@@ -5,22 +5,38 @@ export function is_scout_type_id(scout_type_id) {
5
5
  export class Scout {
6
6
  scout_id;
7
7
  scout_type_id;
8
- number;
9
8
  name;
9
+ s3_id_jpeg;
10
10
  constructor(scout) {
11
11
  if (!Scout.is(scout)) {
12
12
  throw Error("Invalid input.");
13
13
  }
14
14
  this.scout_id = scout.scout_id;
15
15
  this.scout_type_id = scout.scout_type_id;
16
- this.number = scout.number;
17
16
  this.name = scout.name;
17
+ this.s3_id_jpeg = scout.s3_id_jpeg;
18
18
  }
19
19
  static is(scout) {
20
20
  return (scout !== undefined &&
21
21
  typeof scout.scout_id === "string" &&
22
22
  is_scout_type_id(scout.scout_type_id) &&
23
- typeof scout.number === "number" &&
24
- typeof scout.name === "string");
23
+ typeof scout.name === "string" &&
24
+ (scout.s3_id_jpeg === undefined || typeof scout.s3_id_jpeg === "string"));
25
25
  }
26
26
  }
27
+ // export class ScoutAux extends Scout {
28
+ // readonly photo_url? : string
29
+ // constructor(scout : any) {
30
+ // if (!ScoutAux.is(scout)) {
31
+ // throw Error("Invalid input.")
32
+ // }
33
+ // super(scout)
34
+ // this.photo_url = scout.photo_url
35
+ // }
36
+ // static is(scout : any) : scout is ScoutAux {
37
+ // return (
38
+ // Scout.is(scout) &&
39
+ // (scout.photo_url === undefined || typeof scout.photo_url === "string")
40
+ // )
41
+ // }
42
+ // }
@@ -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.18",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -9,8 +9,8 @@ export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTy
9
9
  export class Scout {
10
10
  readonly scout_id : string
11
11
  readonly scout_type_id : ScoutTypeID
12
- readonly number : number
13
12
  readonly name : string
13
+ readonly s3_id_jpeg? : string
14
14
  readonly [x : string] : any
15
15
 
16
16
  constructor(scout : any) {
@@ -19,8 +19,8 @@ export class Scout {
19
19
  }
20
20
  this.scout_id = scout.scout_id
21
21
  this.scout_type_id = scout.scout_type_id
22
- this.number = scout.number
23
22
  this.name = scout.name
23
+ this.s3_id_jpeg = scout.s3_id_jpeg
24
24
  }
25
25
 
26
26
  static is(scout : any) : scout is Scout {
@@ -28,8 +28,27 @@ export class Scout {
28
28
  scout !== undefined &&
29
29
  typeof scout.scout_id === "string" &&
30
30
  is_scout_type_id(scout.scout_type_id) &&
31
- typeof scout.number === "number" &&
32
- typeof scout.name === "string"
31
+ typeof scout.name === "string" &&
32
+ (scout.s3_id_jpeg === undefined || typeof scout.s3_id_jpeg === "string")
33
33
  )
34
34
  }
35
- }
35
+ }
36
+
37
+ // export class ScoutAux extends Scout {
38
+ // readonly photo_url? : string
39
+
40
+ // constructor(scout : any) {
41
+ // if (!ScoutAux.is(scout)) {
42
+ // throw Error("Invalid input.")
43
+ // }
44
+ // super(scout)
45
+ // this.photo_url = scout.photo_url
46
+ // }
47
+
48
+ // static is(scout : any) : scout is ScoutAux {
49
+ // return (
50
+ // Scout.is(scout) &&
51
+ // (scout.photo_url === undefined || typeof scout.photo_url === "string")
52
+ // )
53
+ // }
54
+ // }
@@ -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
  )