@teardown/types 0.0.2 → 0.1.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.
@@ -37,11 +37,25 @@ export declare enum ProjectApiKeyKindEnum {
37
37
  publishable = "publishable",
38
38
  secret = "secret"
39
39
  }
40
+ export declare enum ProjectStatusEnum {
41
+ PENDING_SETUP = "PENDING_SETUP",
42
+ ACTIVE = "ACTIVE",
43
+ PAUSED = "PAUSED",
44
+ ARCHIVED = "ARCHIVED"
45
+ }
40
46
  export declare enum ProjectTypeEnum {
41
47
  REACT_NATIVE = "REACT_NATIVE",
42
48
  EXPO = "EXPO"
43
49
  }
44
- export declare enum VersionStatusEnum {
45
- LIVE = "LIVE",
46
- DISABLED = "DISABLED"
50
+ export declare enum ProjectVersionStatusEnum {
51
+ SUPPORTED = "SUPPORTED",
52
+ UPDATE_AVAILABLE = "UPDATE_AVAILABLE",
53
+ UPDATE_RECOMMENDED = "UPDATE_RECOMMENDED",
54
+ UPDATE_REQUIRED = "UPDATE_REQUIRED"
55
+ }
56
+ export declare enum VersionBuildStatusEnum {
57
+ SUPPORTED = "SUPPORTED",
58
+ UPDATE_AVAILABLE = "UPDATE_AVAILABLE",
59
+ UPDATE_RECOMMENDED = "UPDATE_RECOMMENDED",
60
+ UPDATE_REQUIRED = "UPDATE_REQUIRED"
47
61
  }
@@ -42,13 +42,29 @@ export var ProjectApiKeyKindEnum;
42
42
  ProjectApiKeyKindEnum["publishable"] = "publishable";
43
43
  ProjectApiKeyKindEnum["secret"] = "secret";
44
44
  })(ProjectApiKeyKindEnum || (ProjectApiKeyKindEnum = {}));
45
+ export var ProjectStatusEnum;
46
+ (function (ProjectStatusEnum) {
47
+ ProjectStatusEnum["PENDING_SETUP"] = "PENDING_SETUP";
48
+ ProjectStatusEnum["ACTIVE"] = "ACTIVE";
49
+ ProjectStatusEnum["PAUSED"] = "PAUSED";
50
+ ProjectStatusEnum["ARCHIVED"] = "ARCHIVED";
51
+ })(ProjectStatusEnum || (ProjectStatusEnum = {}));
45
52
  export var ProjectTypeEnum;
46
53
  (function (ProjectTypeEnum) {
47
54
  ProjectTypeEnum["REACT_NATIVE"] = "REACT_NATIVE";
48
55
  ProjectTypeEnum["EXPO"] = "EXPO";
49
56
  })(ProjectTypeEnum || (ProjectTypeEnum = {}));
50
- export var VersionStatusEnum;
51
- (function (VersionStatusEnum) {
52
- VersionStatusEnum["LIVE"] = "LIVE";
53
- VersionStatusEnum["DISABLED"] = "DISABLED";
54
- })(VersionStatusEnum || (VersionStatusEnum = {}));
57
+ export var ProjectVersionStatusEnum;
58
+ (function (ProjectVersionStatusEnum) {
59
+ ProjectVersionStatusEnum["SUPPORTED"] = "SUPPORTED";
60
+ ProjectVersionStatusEnum["UPDATE_AVAILABLE"] = "UPDATE_AVAILABLE";
61
+ ProjectVersionStatusEnum["UPDATE_RECOMMENDED"] = "UPDATE_RECOMMENDED";
62
+ ProjectVersionStatusEnum["UPDATE_REQUIRED"] = "UPDATE_REQUIRED";
63
+ })(ProjectVersionStatusEnum || (ProjectVersionStatusEnum = {}));
64
+ export var VersionBuildStatusEnum;
65
+ (function (VersionBuildStatusEnum) {
66
+ VersionBuildStatusEnum["SUPPORTED"] = "SUPPORTED";
67
+ VersionBuildStatusEnum["UPDATE_AVAILABLE"] = "UPDATE_AVAILABLE";
68
+ VersionBuildStatusEnum["UPDATE_RECOMMENDED"] = "UPDATE_RECOMMENDED";
69
+ VersionBuildStatusEnum["UPDATE_REQUIRED"] = "UPDATE_REQUIRED";
70
+ })(VersionBuildStatusEnum || (VersionBuildStatusEnum = {}));
@@ -12,6 +12,7 @@ export type Database = {
12
12
  created_at: string;
13
13
  device_id: string;
14
14
  emergency_launch_reason: string | null;
15
+ environment_id: string | null;
15
16
  id: string;
16
17
  is_embedded_launch: boolean | null;
17
18
  is_emergency_launch: boolean | null;
@@ -32,6 +33,7 @@ export type Database = {
32
33
  created_at?: string;
33
34
  device_id: string;
34
35
  emergency_launch_reason?: string | null;
36
+ environment_id?: string | null;
35
37
  id?: string;
36
38
  is_embedded_launch?: boolean | null;
37
39
  is_emergency_launch?: boolean | null;
@@ -52,6 +54,7 @@ export type Database = {
52
54
  created_at?: string;
53
55
  device_id?: string;
54
56
  emergency_launch_reason?: string | null;
57
+ environment_id?: string | null;
55
58
  id?: string;
56
59
  is_embedded_launch?: boolean | null;
57
60
  is_emergency_launch?: boolean | null;
@@ -76,6 +79,13 @@ export type Database = {
76
79
  referencedRelation: "devices";
77
80
  referencedColumns: ["id"];
78
81
  },
82
+ {
83
+ foreignKeyName: "device_sessions_environment_id_fkey";
84
+ columns: ["environment_id"];
85
+ isOneToOne: false;
86
+ referencedRelation: "environments";
87
+ referencedColumns: ["id"];
88
+ },
79
89
  {
80
90
  foreignKeyName: "device_sessions_ota_update_id_fkey";
81
91
  columns: ["ota_update_id"];
@@ -105,6 +115,7 @@ export type Database = {
105
115
  device_brand: string | null;
106
116
  device_id: string;
107
117
  device_name: string | null;
118
+ environment_id: string | null;
108
119
  id: string;
109
120
  metadata: Json | null;
110
121
  os_name: string | null;
@@ -118,6 +129,7 @@ export type Database = {
118
129
  device_brand?: string | null;
119
130
  device_id: string;
120
131
  device_name?: string | null;
132
+ environment_id?: string | null;
121
133
  id?: string;
122
134
  metadata?: Json | null;
123
135
  os_name?: string | null;
@@ -131,6 +143,7 @@ export type Database = {
131
143
  device_brand?: string | null;
132
144
  device_id?: string;
133
145
  device_name?: string | null;
146
+ environment_id?: string | null;
134
147
  id?: string;
135
148
  metadata?: Json | null;
136
149
  os_name?: string | null;
@@ -140,12 +153,26 @@ export type Database = {
140
153
  updated_at?: string;
141
154
  };
142
155
  Relationships: [
156
+ {
157
+ foreignKeyName: "devices_environment_id_fkey";
158
+ columns: ["environment_id"];
159
+ isOneToOne: false;
160
+ referencedRelation: "environments";
161
+ referencedColumns: ["id"];
162
+ },
143
163
  {
144
164
  foreignKeyName: "devices_persona_id_fkey";
145
165
  columns: ["persona_id"];
146
166
  isOneToOne: false;
147
167
  referencedRelation: "personas";
148
168
  referencedColumns: ["id"];
169
+ },
170
+ {
171
+ foreignKeyName: "devices_persona_id_fkey";
172
+ columns: ["persona_id"];
173
+ isOneToOne: false;
174
+ referencedRelation: "view_device_session_persona";
175
+ referencedColumns: ["persona_id"];
149
176
  }
150
177
  ];
151
178
  };
@@ -187,6 +214,71 @@ export type Database = {
187
214
  }
188
215
  ];
189
216
  };
217
+ events: {
218
+ Row: {
219
+ created_at: string;
220
+ device_id: string | null;
221
+ environment_id: string;
222
+ event_name: string;
223
+ event_type: string;
224
+ id: string;
225
+ properties: Json | null;
226
+ session_id: string | null;
227
+ timestamp: string;
228
+ };
229
+ Insert: {
230
+ created_at?: string;
231
+ device_id?: string | null;
232
+ environment_id: string;
233
+ event_name: string;
234
+ event_type?: string;
235
+ id?: string;
236
+ properties?: Json | null;
237
+ session_id?: string | null;
238
+ timestamp: string;
239
+ };
240
+ Update: {
241
+ created_at?: string;
242
+ device_id?: string | null;
243
+ environment_id?: string;
244
+ event_name?: string;
245
+ event_type?: string;
246
+ id?: string;
247
+ properties?: Json | null;
248
+ session_id?: string | null;
249
+ timestamp?: string;
250
+ };
251
+ Relationships: [
252
+ {
253
+ foreignKeyName: "events_device_id_fkey";
254
+ columns: ["device_id"];
255
+ isOneToOne: false;
256
+ referencedRelation: "devices";
257
+ referencedColumns: ["id"];
258
+ },
259
+ {
260
+ foreignKeyName: "events_environment_id_fkey";
261
+ columns: ["environment_id"];
262
+ isOneToOne: false;
263
+ referencedRelation: "environments";
264
+ referencedColumns: ["id"];
265
+ },
266
+ {
267
+ foreignKeyName: "events_session_id_fkey";
268
+ columns: ["session_id"];
269
+ isOneToOne: false;
270
+ referencedRelation: "device_sessions";
271
+ referencedColumns: ["id"];
272
+ },
273
+ {
274
+ foreignKeyName: "events_session_id_fkey";
275
+ columns: ["session_id"];
276
+ isOneToOne: false;
277
+ referencedRelation: "view_device_session_persona";
278
+ referencedColumns: ["session_id"];
279
+ }
280
+ ];
281
+ };
190
282
  github_installations: {
191
283
  Row: {
192
284
  account_id: number;
@@ -616,7 +708,8 @@ export type Database = {
616
708
  name: string;
617
709
  patch: number;
618
710
  project_id: string;
619
- status: Database["public"]["Enums"]["version_status"];
711
+ release_at: string;
712
+ status: Database["public"]["Enums"]["project_version_status"];
620
713
  updated_at: string;
621
714
  };
622
715
  Insert: {
@@ -627,7 +720,8 @@ export type Database = {
627
720
  name: string;
628
721
  patch?: number;
629
722
  project_id: string;
630
- status?: Database["public"]["Enums"]["version_status"];
723
+ release_at?: string;
724
+ status?: Database["public"]["Enums"]["project_version_status"];
631
725
  updated_at?: string;
632
726
  };
633
727
  Update: {
@@ -638,7 +732,8 @@ export type Database = {
638
732
  name?: string;
639
733
  patch?: number;
640
734
  project_id?: string;
641
- status?: Database["public"]["Enums"]["version_status"];
735
+ release_at?: string;
736
+ status?: Database["public"]["Enums"]["project_version_status"];
642
737
  updated_at?: string;
643
738
  };
644
739
  Relationships: [
@@ -658,6 +753,7 @@ export type Database = {
658
753
  name: string;
659
754
  org_id: string;
660
755
  slug: string;
756
+ status: Database["public"]["Enums"]["project_status"];
661
757
  type: Database["public"]["Enums"]["project_type"];
662
758
  updated_at: string;
663
759
  };
@@ -667,6 +763,7 @@ export type Database = {
667
763
  name: string;
668
764
  org_id: string;
669
765
  slug: string;
766
+ status?: Database["public"]["Enums"]["project_status"];
670
767
  type: Database["public"]["Enums"]["project_type"];
671
768
  updated_at?: string;
672
769
  };
@@ -676,6 +773,7 @@ export type Database = {
676
773
  name?: string;
677
774
  org_id?: string;
678
775
  slug?: string;
776
+ status?: Database["public"]["Enums"]["project_status"];
679
777
  type?: Database["public"]["Enums"]["project_type"];
680
778
  updated_at?: string;
681
779
  };
@@ -725,6 +823,7 @@ export type Database = {
725
823
  id: string;
726
824
  name: string | null;
727
825
  platform: Database["public"]["Enums"]["device_platform"];
826
+ status: Database["public"]["Enums"]["version_build_status"];
728
827
  summary: string | null;
729
828
  updated_at: string;
730
829
  version_id: string;
@@ -737,6 +836,7 @@ export type Database = {
737
836
  id?: string;
738
837
  name?: string | null;
739
838
  platform: Database["public"]["Enums"]["device_platform"];
839
+ status?: Database["public"]["Enums"]["version_build_status"];
740
840
  summary?: string | null;
741
841
  updated_at?: string;
742
842
  version_id: string;
@@ -749,6 +849,7 @@ export type Database = {
749
849
  id?: string;
750
850
  name?: string | null;
751
851
  platform?: Database["public"]["Enums"]["device_platform"];
852
+ status?: Database["public"]["Enums"]["version_build_status"];
752
853
  summary?: string | null;
753
854
  updated_at?: string;
754
855
  version_id?: string;
@@ -765,7 +866,54 @@ export type Database = {
765
866
  };
766
867
  };
767
868
  Views: {
768
- [_ in never]: never;
869
+ view_device_session_persona: {
870
+ Row: {
871
+ device_brand: string | null;
872
+ device_id: string | null;
873
+ device_name: string | null;
874
+ device_platform: Database["public"]["Enums"]["device_platform"] | null;
875
+ environment_id: string | null;
876
+ os_version: string | null;
877
+ persona_email: string | null;
878
+ persona_id: string | null;
879
+ persona_name: string | null;
880
+ persona_user_id: string | null;
881
+ session_id: string | null;
882
+ started_at: string | null;
883
+ version_build_id: string | null;
884
+ version_id: string | null;
885
+ };
886
+ Relationships: [
887
+ {
888
+ foreignKeyName: "device_sessions_device_id_fkey";
889
+ columns: ["device_id"];
890
+ isOneToOne: false;
891
+ referencedRelation: "devices";
892
+ referencedColumns: ["id"];
893
+ },
894
+ {
895
+ foreignKeyName: "device_sessions_environment_id_fkey";
896
+ columns: ["environment_id"];
897
+ isOneToOne: false;
898
+ referencedRelation: "environments";
899
+ referencedColumns: ["id"];
900
+ },
901
+ {
902
+ foreignKeyName: "device_sessions_version_build_id_fkey";
903
+ columns: ["version_build_id"];
904
+ isOneToOne: false;
905
+ referencedRelation: "version_builds";
906
+ referencedColumns: ["id"];
907
+ },
908
+ {
909
+ foreignKeyName: "device_sessions_version_id_fkey";
910
+ columns: ["version_id"];
911
+ isOneToOne: false;
912
+ referencedRelation: "project_versions";
913
+ referencedColumns: ["id"];
914
+ }
915
+ ];
916
+ };
769
917
  };
770
918
  Functions: {
771
919
  fn_create_org_api_key: {
@@ -808,6 +956,52 @@ export type Database = {
808
956
  isSetofReturn: false;
809
957
  };
810
958
  };
959
+ fn_ensure_default_environments: {
960
+ Args: {
961
+ p_project_id: string;
962
+ };
963
+ Returns: undefined;
964
+ };
965
+ search_active_sessions: {
966
+ Args: {
967
+ p_end_date: string;
968
+ p_environment_ids: string[];
969
+ p_search?: string;
970
+ p_start_date: string;
971
+ };
972
+ Returns: {
973
+ build_number: number;
974
+ build_platform: string;
975
+ device_id: string;
976
+ device_platform: string;
977
+ session_id: string;
978
+ version_build_id: string;
979
+ version_id: string;
980
+ version_name: string;
981
+ }[];
982
+ };
983
+ search_build_sessions: {
984
+ Args: {
985
+ p_build_id: string;
986
+ p_end_date: string;
987
+ p_limit?: number;
988
+ p_offset?: number;
989
+ p_search?: string;
990
+ p_start_date: string;
991
+ };
992
+ Returns: {
993
+ device_brand: string;
994
+ device_id: string;
995
+ device_name: string;
996
+ os_version: string;
997
+ persona_email: string;
998
+ persona_id: string;
999
+ persona_name: string;
1000
+ persona_user_id: string;
1001
+ session_id: string;
1002
+ started_at: string;
1003
+ }[];
1004
+ };
811
1005
  };
812
1006
  Enums: {
813
1007
  device_platform: "IOS" | "ANDROID" | "WEB" | "WINDOWS" | "MACOS" | "LINUX" | "PHONE" | "TABLET" | "DESKTOP" | "CONSOLE" | "TV" | "WEARABLE" | "GAME_CONSOLE" | "VR" | "UNKNOWN" | "OTHER";
@@ -815,8 +1009,10 @@ export type Database = {
815
1009
  org_role_type: "OWNER" | "ADMIN" | "ENGINEER";
816
1010
  org_type: "PERSONAL" | "START_UP" | "SCALE_UP" | "AGENCY" | "ENTERPRISE";
817
1011
  project_api_key_kind: "publishable" | "secret";
1012
+ project_status: "PENDING_SETUP" | "ACTIVE" | "PAUSED" | "ARCHIVED";
818
1013
  project_type: "REACT_NATIVE" | "EXPO";
819
- version_status: "LIVE" | "DISABLED";
1014
+ project_version_status: "SUPPORTED" | "UPDATE_AVAILABLE" | "UPDATE_RECOMMENDED" | "UPDATE_REQUIRED";
1015
+ version_build_status: "SUPPORTED" | "UPDATE_AVAILABLE" | "UPDATE_RECOMMENDED" | "UPDATE_REQUIRED";
820
1016
  };
821
1017
  CompositeTypes: {
822
1018
  [_ in never]: never;
@@ -880,8 +1076,10 @@ export declare const Constants: {
880
1076
  readonly org_role_type: readonly ["OWNER", "ADMIN", "ENGINEER"];
881
1077
  readonly org_type: readonly ["PERSONAL", "START_UP", "SCALE_UP", "AGENCY", "ENTERPRISE"];
882
1078
  readonly project_api_key_kind: readonly ["publishable", "secret"];
1079
+ readonly project_status: readonly ["PENDING_SETUP", "ACTIVE", "PAUSED", "ARCHIVED"];
883
1080
  readonly project_type: readonly ["REACT_NATIVE", "EXPO"];
884
- readonly version_status: readonly ["LIVE", "DISABLED"];
1081
+ readonly project_version_status: readonly ["SUPPORTED", "UPDATE_AVAILABLE", "UPDATE_RECOMMENDED", "UPDATE_REQUIRED"];
1082
+ readonly version_build_status: readonly ["SUPPORTED", "UPDATE_AVAILABLE", "UPDATE_RECOMMENDED", "UPDATE_REQUIRED"];
885
1083
  };
886
1084
  };
887
1085
  };
@@ -23,8 +23,20 @@ export const Constants = {
23
23
  org_role_type: ["OWNER", "ADMIN", "ENGINEER"],
24
24
  org_type: ["PERSONAL", "START_UP", "SCALE_UP", "AGENCY", "ENTERPRISE"],
25
25
  project_api_key_kind: ["publishable", "secret"],
26
+ project_status: ["PENDING_SETUP", "ACTIVE", "PAUSED", "ARCHIVED"],
26
27
  project_type: ["REACT_NATIVE", "EXPO"],
27
- version_status: ["LIVE", "DISABLED"],
28
+ project_version_status: [
29
+ "SUPPORTED",
30
+ "UPDATE_AVAILABLE",
31
+ "UPDATE_RECOMMENDED",
32
+ "UPDATE_REQUIRED",
33
+ ],
34
+ version_build_status: [
35
+ "SUPPORTED",
36
+ "UPDATE_AVAILABLE",
37
+ "UPDATE_RECOMMENDED",
38
+ "UPDATE_REQUIRED",
39
+ ],
28
40
  },
29
41
  },
30
42
  };
package/dist/index.d.ts CHANGED
@@ -6,14 +6,36 @@ export type TableKeys = keyof Tables;
6
6
  export type Table<T extends TableKeys> = Tables[T]["Row"];
7
7
  export type Insert<T extends TableKeys> = TablesInsert<T>;
8
8
  export type Update<T extends TableKeys> = TablesUpdate<T>;
9
+ /**
10
+ * A result of a successful operation
11
+ * @param Success - The success type
12
+ * @returns A {@link Success}
13
+ */
9
14
  export type SuccessResult<Success> = {
10
15
  success: true;
11
16
  data: Success;
12
17
  };
18
+ /**
19
+ * A result of a failed operation
20
+ * @param Error - The error type
21
+ * @returns A {@link ErrorResult}
22
+ */
13
23
  export type ErrorResult<Error = string> = {
14
24
  success: false;
15
25
  error: Error;
16
26
  };
27
+ /**
28
+ * A result of a successful or failed operation
29
+ * @param Success - The success type
30
+ * @param Error - The error type
31
+ * @returns A {@link SuccessResult} or {@link ErrorResult}
32
+ */
17
33
  export type Result<Success, Error = string> = SuccessResult<Success> | ErrorResult<Error>;
34
+ /**
35
+ * A promise that resolves to a {@link Result}
36
+ * @param Success - The success type
37
+ * @param Error - The error type
38
+ * @returns A promise that resolves to a {@link Result}
39
+ */
18
40
  export type AsyncResult<Success, Error = string> = Promise<Result<Success, Error>>;
19
41
  export { type LoggingContext, Service } from "./interfaces/service.interface";