@teardown/schemas 0.1.23 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teardown/schemas",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -85,6 +85,7 @@
85
85
  }
86
86
  },
87
87
  "scripts": {
88
+ "dev": "bun run typecheck --watch",
88
89
  "typecheck": "tsc --noEmit --project ./tsconfig.json",
89
90
  "lint": "bun x biome lint .",
90
91
  "fmt": "bun x biome format --write .",
@@ -92,7 +93,7 @@
92
93
  },
93
94
  "dependencies": {
94
95
  "@sinclair/typebox": "^0.34.41",
95
- "@teardown/types": "0.1.23"
96
+ "@teardown/types": "0.1.25"
96
97
  },
97
98
  "devDependencies": {
98
99
  "@biomejs/biome": "2.3.7",
@@ -1,4 +1,5 @@
1
1
  import { type Static, Type } from "@sinclair/typebox";
2
+ import { VersionBuildStatusSchema } from "../versions/schemas";
2
3
 
3
4
  /**
4
5
  * Version adoption schema
@@ -107,6 +108,7 @@ export const ActiveBuildStatsSchema = Type.Object({
107
108
  platform: Type.Union([Type.Literal("IOS"), Type.Literal("ANDROID")]),
108
109
  session_count: Type.Integer({ minimum: 0 }),
109
110
  device_count: Type.Integer({ minimum: 0 }),
111
+ status: Type.Optional(VersionBuildStatusSchema),
110
112
  });
111
113
  export type ActiveBuildStats = Static<typeof ActiveBuildStatsSchema>;
112
114
 
@@ -117,6 +119,7 @@ export const ActiveVersionStatsSchema = Type.Object({
117
119
  device_count: Type.Integer({ minimum: 0 }),
118
120
  ios_count: Type.Integer({ minimum: 0 }),
119
121
  android_count: Type.Integer({ minimum: 0 }),
122
+ version_status: Type.Optional(VersionBuildStatusSchema),
120
123
  builds: Type.Array(ActiveBuildStatsSchema),
121
124
  });
122
125
  export type ActiveVersionStats = Static<typeof ActiveVersionStatsSchema>;
@@ -9,7 +9,7 @@ export { DevicePlatformEnum };
9
9
  */
10
10
  export const ApplicationInfoSchema = Type.Object({
11
11
  version: Type.String({ error: "version is required" }),
12
- build_number: Type.String({ error: "build_number is required" }),
12
+ build_number: Type.Number({ error: "build_number is required" }),
13
13
  });
14
14
  export type ApplicationInfo = Static<typeof ApplicationInfoSchema>;
15
15
 
@@ -147,6 +147,10 @@ export enum IdentifyVersionStatusEnum {
147
147
  * A new version is available
148
148
  */
149
149
  UPDATE_AVAILABLE = "UPDATE_AVAILABLE",
150
+ /**
151
+ * An update is recommended
152
+ */
153
+ UPDATE_RECOMMENDED = "UPDATE_RECOMMENDED",
150
154
  /**
151
155
  * An update is required
152
156
  */
@@ -187,12 +191,18 @@ export const UpdateAvailableInfoSchema = Type.Object({
187
191
  });
188
192
  export type UpdateAvailableInfo = Static<typeof UpdateAvailableInfoSchema>;
189
193
 
194
+ export const UpdateRecommendedInfoSchema = Type.Object({
195
+ status: Type.Literal(IdentifyVersionStatusEnum.UPDATE_RECOMMENDED),
196
+ update: UpdateInfoSchema,
197
+ });
198
+ export type UpdateRecommendedInfo = Static<typeof UpdateRecommendedInfoSchema>;
199
+
190
200
  export const VersionInfoSchema = Type.Object({
191
201
  /**
192
202
  * The status of the version
193
203
  */
194
204
  status: Type.Enum(IdentifyVersionStatusEnum, { error: "status is required" }),
195
- update: Type.Optional(Type.Union([UpdateAvailableInfoSchema, Type.Null()])),
205
+ update: Type.Union([UpdateAvailableInfoSchema, UpdateRecommendedInfoSchema, Type.Null()]),
196
206
  });
197
207
  export type VersionInfo = Static<typeof VersionInfoSchema>;
198
208
 
@@ -22,6 +22,7 @@ export function parseVersionStatusEnum(value: unknown): VersionBuildStatusEnum {
22
22
  case VersionBuildStatusEnum.UPDATE_AVAILABLE:
23
23
  return VersionBuildStatusEnum.UPDATE_AVAILABLE;
24
24
  case VersionBuildStatusEnum.UPDATE_RECOMMENDED:
25
+ return VersionBuildStatusEnum.UPDATE_RECOMMENDED;
25
26
  case VersionBuildStatusEnum.UPDATE_REQUIRED:
26
27
  return VersionBuildStatusEnum.UPDATE_REQUIRED;
27
28
  default: