Skip to content

Commit

Permalink
fix: Add some missing resource properties (#134)
Browse files Browse the repository at this point in the history
* Add some missing resource properties

* ci: Generate code

* ci: Format code

---------

Co-authored-by: Seam Bot <devops@getseam.com>
  • Loading branch information
andrii-balitskyi and seambot authored Jan 5, 2024
1 parent 0993fb4 commit 5de7664
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/lib/database/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface DatabaseMethods {
created_at?: string
workspace_id?: string
is_sandbox?: boolean
connect_partner_name?: string
}) => Workspace
addApiKey: (params: {
name?: string
Expand Down
12 changes: 11 additions & 1 deletion src/lib/database/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const initializer = immer<Database>((set, get) => ({
params.publishable_key ?? `seam_${pk_id}_${simpleHash(pk_id)}`,
created_at: params.created_at ?? new Date().toISOString(),
is_sandbox: params.is_sandbox ?? false,
connect_partner_name: params.connect_partner_name ?? null,
}
set({
workspaces: [...get().workspaces, new_workspace],
Expand Down Expand Up @@ -96,7 +97,7 @@ const initializer = immer<Database>((set, get) => ({
connect_webview_ids: params.connect_webview_ids ?? [],
client_session_id: cst_id,
token: params.token ?? `seam_${cst_id}_${simpleHash(cst_id)}`,
user_identifier_key: params.user_identifier_key,
user_identifier_key: params.user_identifier_key ?? null,
created_at: params.created_at ?? new Date().toISOString(),
}

Expand Down Expand Up @@ -142,6 +143,7 @@ const initializer = immer<Database>((set, get) => ({
any_provider_allowed: params.any_provider_allowed ?? false,
login_successful: params.login_successful ?? false,
connected_account_id: params.connected_account_id ?? null,
custom_metadata: params.custom_metadata ?? {},
}
set({
connect_webviews: [...get().connect_webviews, new_connect_webview],
Expand All @@ -167,6 +169,11 @@ const initializer = immer<Database>((set, get) => ({
manufacturer_display_name:
params.properties?.model?.manufacturer_display_name ?? "Generic",
},
battery: {
level: 1,
status: "full",
...params.properties?.battery,
},
},
workspace_id: params.workspace_id,
errors: params.errors ?? [],
Expand Down Expand Up @@ -238,6 +245,7 @@ const initializer = immer<Database>((set, get) => ({
provider: params.provider,
workspace_id: params.workspace_id,
created_at: params.created_at ?? new Date().toISOString(),
user_identifier: params.user_identifier ?? { email: "jane@example.com" },
}

set({
Expand Down Expand Up @@ -299,6 +307,8 @@ const initializer = immer<Database>((set, get) => ({
is_one_time_use: false,
is_offline_access_code: false,
...params,
common_code_key:
"common_code_key" in params ? params?.common_code_key ?? null : null,
}

set({
Expand Down
3 changes: 3 additions & 0 deletions src/lib/zod/connect_webview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { z } from "zod"

import { custom_metadata } from "./custom-metadata.ts"

export const device_provider = z.enum([
"akuvox",
"august",
Expand Down Expand Up @@ -50,6 +52,7 @@ export const connect_webview = z.object({
any_provider_allowed: z.boolean(),
any_device_allowed: z.boolean().nullable(),
login_successful: z.boolean(),
custom_metadata,
})

export type ConnectWebview = z.infer<typeof connect_webview>
1 change: 1 addition & 0 deletions src/lib/zod/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const workspace = z.object({
publishable_key: z.string(),
created_at: z.string(),
is_sandbox: z.boolean(),
connect_partner_name: z.string().nullable(),
})

export type Workspace = z.infer<typeof workspace>
11 changes: 11 additions & 0 deletions src/route-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,9 @@ export type Routes = {
any_provider_allowed: boolean
any_device_allowed: boolean | null
login_successful: boolean
custom_metadata: {
[x: string]: string | number | null | boolean
}
}
ok: boolean
}
Expand Down Expand Up @@ -1286,6 +1289,9 @@ export type Routes = {
any_provider_allowed: boolean
any_device_allowed: boolean | null
login_successful: boolean
custom_metadata: {
[x: string]: string | number | null | boolean
}
}
ok: boolean
}
Expand Down Expand Up @@ -1346,6 +1352,9 @@ export type Routes = {
any_provider_allowed: boolean
any_device_allowed: boolean | null
login_successful: boolean
custom_metadata: {
[x: string]: string | number | null | boolean
}
}[]
ok: boolean
}
Expand Down Expand Up @@ -3903,6 +3912,7 @@ export type Routes = {
publishable_key: string
created_at: string
is_sandbox: boolean
connect_partner_name: string | null
}
ok: boolean
}
Expand All @@ -3921,6 +3931,7 @@ export type Routes = {
publishable_key: string
created_at: string
is_sandbox: boolean
connect_partner_name: string | null
}[]
ok: boolean
}
Expand Down

0 comments on commit 5de7664

Please sign in to comment.