@koloseum/types 0.3.6 → 0.3.7

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.
@@ -2955,6 +2955,7 @@ export type Database = {
2955
2955
  id: string;
2956
2956
  lounge_branch_id: string | null;
2957
2957
  lounge_id: string;
2958
+ metadata: Json;
2958
2959
  player_id: string;
2959
2960
  role: string;
2960
2961
  user_id: string;
@@ -2964,6 +2965,7 @@ export type Database = {
2964
2965
  id?: string;
2965
2966
  lounge_branch_id?: string | null;
2966
2967
  lounge_id: string;
2968
+ metadata?: Json;
2967
2969
  player_id: string;
2968
2970
  role: string;
2969
2971
  user_id: string;
@@ -2973,6 +2975,7 @@ export type Database = {
2973
2975
  id?: string;
2974
2976
  lounge_branch_id?: string | null;
2975
2977
  lounge_id?: string;
2978
+ metadata?: Json;
2976
2979
  player_id?: string;
2977
2980
  role?: string;
2978
2981
  user_id?: string;
@@ -3071,6 +3074,86 @@ export type Database = {
3071
3074
  };
3072
3075
  Relationships: [];
3073
3076
  };
3077
+ notification_events: {
3078
+ Row: {
3079
+ created_at: string;
3080
+ idempotency_key: string | null;
3081
+ request_id: number | null;
3082
+ response_data: Json | null;
3083
+ system_event_id: string;
3084
+ workflow_event_key: string;
3085
+ };
3086
+ Insert: {
3087
+ created_at?: string;
3088
+ idempotency_key?: string | null;
3089
+ request_id?: number | null;
3090
+ response_data?: Json | null;
3091
+ system_event_id: string;
3092
+ workflow_event_key: string;
3093
+ };
3094
+ Update: {
3095
+ created_at?: string;
3096
+ idempotency_key?: string | null;
3097
+ request_id?: number | null;
3098
+ response_data?: Json | null;
3099
+ system_event_id?: string;
3100
+ workflow_event_key?: string;
3101
+ };
3102
+ Relationships: [
3103
+ {
3104
+ foreignKeyName: "notification_events_system_event_id_fkey";
3105
+ columns: ["system_event_id"];
3106
+ isOneToOne: false;
3107
+ referencedRelation: "system_events";
3108
+ referencedColumns: ["id"];
3109
+ },
3110
+ {
3111
+ foreignKeyName: "notification_events_workflow_event_key_fkey";
3112
+ columns: ["workflow_event_key"];
3113
+ isOneToOne: false;
3114
+ referencedRelation: "notification_workflows";
3115
+ referencedColumns: ["event_key"];
3116
+ }
3117
+ ];
3118
+ };
3119
+ notification_workflows: {
3120
+ Row: {
3121
+ created_at: string;
3122
+ description: string | null;
3123
+ enabled: boolean;
3124
+ event_key: string;
3125
+ metadata: Json;
3126
+ system_event_type: string;
3127
+ updated_at: string | null;
3128
+ };
3129
+ Insert: {
3130
+ created_at?: string;
3131
+ description?: string | null;
3132
+ enabled?: boolean;
3133
+ event_key: string;
3134
+ metadata?: Json;
3135
+ system_event_type: string;
3136
+ updated_at?: string | null;
3137
+ };
3138
+ Update: {
3139
+ created_at?: string;
3140
+ description?: string | null;
3141
+ enabled?: boolean;
3142
+ event_key?: string;
3143
+ metadata?: Json;
3144
+ system_event_type?: string;
3145
+ updated_at?: string | null;
3146
+ };
3147
+ Relationships: [
3148
+ {
3149
+ foreignKeyName: "notification_workflows_system_event_type_fkey";
3150
+ columns: ["system_event_type"];
3151
+ isOneToOne: false;
3152
+ referencedRelation: "system_event_types";
3153
+ referencedColumns: ["event_type"];
3154
+ }
3155
+ ];
3156
+ };
3074
3157
  phone_verification_attempts: {
3075
3158
  Row: {
3076
3159
  created_at: string;
@@ -3692,6 +3775,7 @@ export type Database = {
3692
3775
  gender_identity: Database["compliance"]["Enums"]["gender_identity"] | null;
3693
3776
  id: string;
3694
3777
  last_name: string;
3778
+ metadata: Json;
3695
3779
  middle_names: string | null;
3696
3780
  nationality: string;
3697
3781
  phone: string;
@@ -3711,6 +3795,7 @@ export type Database = {
3711
3795
  gender_identity?: Database["compliance"]["Enums"]["gender_identity"] | null;
3712
3796
  id?: string;
3713
3797
  last_name: string;
3798
+ metadata?: Json;
3714
3799
  middle_names?: string | null;
3715
3800
  nationality: string;
3716
3801
  phone?: string;
@@ -3730,6 +3815,7 @@ export type Database = {
3730
3815
  gender_identity?: Database["compliance"]["Enums"]["gender_identity"] | null;
3731
3816
  id?: string;
3732
3817
  last_name?: string;
3818
+ metadata?: Json;
3733
3819
  middle_names?: string | null;
3734
3820
  nationality?: string;
3735
3821
  phone?: string;
@@ -4045,6 +4131,10 @@ export type Database = {
4045
4131
  };
4046
4132
  Returns: boolean;
4047
4133
  };
4134
+ backfill_notification_response_data: {
4135
+ Args: never;
4136
+ Returns: number;
4137
+ };
4048
4138
  check_annual_update_limit: {
4049
4139
  Args: {
4050
4140
  p_account_type: Database["compliance"]["Enums"]["account_type"];
@@ -4250,6 +4340,12 @@ export type Database = {
4250
4340
  institution_name: string;
4251
4341
  }[];
4252
4342
  };
4343
+ get_suprsend_response: {
4344
+ Args: {
4345
+ p_search: string;
4346
+ };
4347
+ Returns: Json;
4348
+ };
4253
4349
  get_user_phone: {
4254
4350
  Args: {
4255
4351
  search?: string;
@@ -4371,6 +4467,15 @@ export type Database = {
4371
4467
  user_id: string;
4372
4468
  }[];
4373
4469
  };
4470
+ send_suprsend_notification: {
4471
+ Args: {
4472
+ p_idempotency_key?: string;
4473
+ p_system_event_id?: string;
4474
+ p_workflow_body: Json;
4475
+ p_workflow_event_key?: string;
4476
+ };
4477
+ Returns: undefined;
4478
+ };
4374
4479
  submit_gaming_and_socials_data: {
4375
4480
  Args: {
4376
4481
  p_consoles: Json[];
@@ -4396,6 +4501,13 @@ export type Database = {
4396
4501
  };
4397
4502
  Returns: boolean;
4398
4503
  };
4504
+ validate_suprsend_subscriber: {
4505
+ Args: {
4506
+ p_person_data: Json;
4507
+ p_user_id: string;
4508
+ };
4509
+ Returns: undefined;
4510
+ };
4399
4511
  };
4400
4512
  Enums: {
4401
4513
  account_type: "player" | "lounge";
@@ -4703,6 +4815,28 @@ export type Database = {
4703
4815
  pronouns: Database["compliance"]["Enums"]["pronouns"][] | null;
4704
4816
  pseudonym: string | null;
4705
4817
  };
4818
+ Insert: {
4819
+ birth_date?: never;
4820
+ created_at?: string | null;
4821
+ first_name?: string | null;
4822
+ id?: string | null;
4823
+ last_name?: string | null;
4824
+ middle_names?: string | null;
4825
+ nationality?: string | null;
4826
+ pronouns?: never;
4827
+ pseudonym?: string | null;
4828
+ };
4829
+ Update: {
4830
+ birth_date?: never;
4831
+ created_at?: string | null;
4832
+ first_name?: string | null;
4833
+ id?: string | null;
4834
+ last_name?: string | null;
4835
+ middle_names?: string | null;
4836
+ nationality?: string | null;
4837
+ pronouns?: never;
4838
+ pseudonym?: string | null;
4839
+ };
4706
4840
  Relationships: [
4707
4841
  {
4708
4842
  foreignKeyName: "players_nationality_fkey";
@@ -5862,7 +5996,13 @@ export type Database = {
5862
5996
  };
5863
5997
  };
5864
5998
  Views: {
5865
- [_ in never]: never;
5999
+ lounge_average_ratings: {
6000
+ Row: {
6001
+ average_rating: number | null;
6002
+ lounge_id: string | null;
6003
+ };
6004
+ Relationships: [];
6005
+ };
5866
6006
  };
5867
6007
  Functions: {
5868
6008
  accept_session_invite: {
@@ -1,15 +1,11 @@
1
1
  /**
2
- * Notification body for SuprSend workflow. Points to note:
2
+ * Notification body for SuprSend workflow.
3
3
  * - `delay` is the time delay after which the first notification will be sent
4
4
  * - `trigger_at` is the date string in ISO 8601 to trigger scheduled notifications
5
- * - `users` is the array of users to send the notification to
6
- * - `users[i].distinct_id` is the unique identifier of the user
7
- * - `users[i].$channels` is the array of channels to send the notification to
8
- * - `users[i].$email` is the email address to send the notification to
9
- * - `users[i].$whatsapp` is the WhatsApp number to send the notification to
10
- * - `delivery` is the delivery instruction for the notification, dictating how should notifications be sent and the success metric
11
- * - `delivery.time_to_live` and `delivery.mandatory_channels` will only be applicable if `delivery.smart` is true
12
- * - `data` is the data for the notification, can be any JSON
5
+ * - `users` is the array of users to send the notification to (legacy shape; API uses `recipients`)
6
+ * - `users[i]` / recipients: use WorkflowRecipient for type-safe construction
7
+ * - `delivery` is the delivery instruction for the notification
8
+ * - `data` is the variable data for the notification template
13
9
  * @see https://docs.suprsend.com/docs/node-trigger-workflow-from-api#dynamic-workflow-trigger
14
10
  */
15
11
  export interface WorkflowBody {
@@ -18,52 +14,96 @@ export interface WorkflowBody {
18
14
  notification_category: "transactional" | "promotional" | "system";
19
15
  delay?: string;
20
16
  trigger_at?: string;
21
- users: {
22
- distinct_id: string;
23
- $channels?: string[];
24
- $email?: string[];
25
- $whatsapp?: string[];
26
- $sms?: string[];
27
- $androidpush?: {
28
- token: string;
29
- provider: string;
30
- device_id: string;
31
- }[];
32
- $iospush?: {
33
- token: string;
34
- provider: string;
35
- device_id: string;
36
- }[];
37
- $slack?: {
38
- email?: string;
39
- access_token: string;
40
- } | {
41
- user_id?: string;
42
- access_token: string;
43
- } | {
44
- channel?: string;
45
- access_token: string;
46
- } | {
47
- incoming_webhook: {
48
- url: string;
49
- };
50
- };
51
- $ms_teams?: {
52
- tenant_id: string;
53
- service_url: string;
54
- conversation_id?: string;
55
- user_id?: string;
56
- } | {
57
- incoming_webhook: {
58
- url: string;
59
- };
60
- };
61
- }[];
17
+ users: WorkflowRecipient[];
62
18
  delivery?: {
63
19
  smart: boolean;
64
20
  success: string;
65
21
  time_to_live?: string;
66
22
  mandatory_channels?: string[];
67
23
  };
68
- data?: Record<string, any>;
24
+ data?: Record<string, unknown>;
25
+ }
26
+ /**
27
+ * One recipient in a SuprSend workflow trigger.
28
+ * - each item is either a user recipient (WorkflowUserRecipient) or an object recipient (WorkflowObjectRecipient)
29
+ * - used in the `recipients` array of the workflow trigger body (SuprSend API uses `recipients`; this codebase may alias as `users`)
30
+ * - custom properties on the recipient are available in templates as `$recipient.<property>`
31
+ * @see https://docs.suprsend.com/docs/node-trigger-workflow-from-api#identifying-recipients-inline
32
+ */
33
+ export type WorkflowRecipient = WorkflowUserRecipient | WorkflowObjectRecipient;
34
+ /**
35
+ * User recipient in a SuprSend workflow trigger.
36
+ * - `distinct_id` is the unique identifier of the user (e.g. platform user id)
37
+ * - `$channels` is the array of channels to send the notification to (email, sms, inbox, androidpush, iospush, slack, ms_teams, webpush, whatsapp)
38
+ * - `$email` is the array of email addresses to send the notification to
39
+ * - `$sms` is the array of phone numbers for SMS
40
+ * - `$whatsapp` is the array of WhatsApp numbers
41
+ * - `$preferred_language` is the recipient language (ISO 639-1 2-letter) for localisation
42
+ * - `$timezone` is the recipient timezone (IANA TZ identifier) for local-time delivery
43
+ * - `$skip_create` when true, do not auto-create the user in SuprSend (use when the user is already synced, e.g. from DB triggers)
44
+ * - additional keys are custom properties and are available in templates as `$recipient.<key>`
45
+ * @see https://docs.suprsend.com/docs/node-trigger-workflow-from-api#identifying-recipients-inline
46
+ */
47
+ export interface WorkflowUserRecipient {
48
+ distinct_id: string;
49
+ $channels?: string[];
50
+ $email?: string[];
51
+ $sms?: string[];
52
+ $whatsapp?: string[];
53
+ $preferred_language?: string;
54
+ $timezone?: string;
55
+ $skip_create?: boolean;
56
+ $androidpush?: {
57
+ token: string;
58
+ provider: string;
59
+ device_id: string;
60
+ }[];
61
+ $iospush?: {
62
+ token: string;
63
+ provider: string;
64
+ device_id: string;
65
+ }[];
66
+ $slack?: {
67
+ email?: string;
68
+ access_token: string;
69
+ } | {
70
+ user_id?: string;
71
+ access_token: string;
72
+ } | {
73
+ channel?: string;
74
+ access_token: string;
75
+ } | {
76
+ incoming_webhook: {
77
+ url: string;
78
+ };
79
+ };
80
+ $ms_teams?: {
81
+ tenant_id: string;
82
+ service_url: string;
83
+ conversation_id?: string;
84
+ user_id?: string;
85
+ } | {
86
+ incoming_webhook: {
87
+ url: string;
88
+ };
89
+ };
90
+ [key: string]: string | string[] | boolean | number | object | undefined;
91
+ }
92
+ /**
93
+ * Object recipient in a SuprSend workflow trigger (non-user entity, e.g. team, channel, shared inbox). Points to note:
94
+ * - `object_type` is the type of the object (e.g. teams, departments)
95
+ * - `id` is the unique identifier of the object within that type
96
+ * - `$skip_create` when true, do not auto-create the object in SuprSend
97
+ * - `$email` is the array of email addresses for the object (e.g. shared inbox)
98
+ * - `$channels` is the array of channels to send the notification to
99
+ * - additional keys are custom properties and are available in templates as `$recipient.<key>`
100
+ * @see https://docs.suprsend.com/docs/node-trigger-workflow-from-api#identifying-recipients-inline
101
+ */
102
+ export interface WorkflowObjectRecipient {
103
+ object_type: string;
104
+ id: string;
105
+ $skip_create?: boolean;
106
+ $email?: string[];
107
+ $channels?: string[];
108
+ [key: string]: string | string[] | boolean | number | object | undefined;
69
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koloseum/types",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "author": "Koloseum Technologies Limited",
5
5
  "type": "module",
6
6
  "description": "Type definitions for use across web apps (TypeScript)",