Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

Commit f78d748

Browse files
authored
chore(deps)!: upgrade @kittycad/lib to v3, v2 was a Morty (#248)
* chore(deps)!: upgrade @kittycad/lib to v3, v2 was a Morty - Migrate to v3 API, replace Models map with named types (User, TextToCad, etc), update endpoints and tests, and use a proper isErr guard in billing - Hardening: handle missing outputs in DownloadButton, safe prompt trim, drop the "no models" placeholder; lockfile updated with new deps BREAKING CHANGE: @kittycad/lib v3 removes the Models type map, use named exports from @kittycad/lib instead and adjust related types accordingly Signed-off-by: Jessie Frazelle <github@jessfraz.com> * refactor(ui): migrate to TextToCad; mark generations with type, duh - Migrate TextToCadResponse to TextToCad; store gens as type text_to_cad - Drop unused PromptResponse import Signed-off-by: Jessie Frazelle <github@jessfraz.com> * feat(app): migrate to KittyCAD SDK, add toasts; less fetch, more purr - Replace ad-hoc fetch calls with @kittycad/lib + createZooClient across app and server, standardize responses - Add toast system and ApiError parsing; handle missing user in UI Signed-off-by: Jessie Frazelle <github@jessfraz.com> * updates Signed-off-by: Jessie Frazelle <github@jessfraz.com> * refactor(GenerationList): Morty, stop juggling tokens, use pager API - Drive infinite scroll with SDK pager (hasNext, next), fewer dupes - Simplify token state, updateFetchedGenerations now takes an array Signed-off-by: Jessie Frazelle <github@jessfraz.com> * refactor(pagination): stop token hoarding, use local hasNext - Remove nextPageTokens store and its localStorage persistence - Use local hasNext in GenerationList; simpler scroll, clearer end check Signed-off-by: Jessie Frazelle <github@jessfraz.com> * refactor(endpoints)!: yeet remote API calls, keep local convert - Prune dead endpoints and reexports, drop env usage - Use TextToCad directly in submit-prompt to avoid indirection BREAKING CHANGE: removed endpoints.convert, prompt, feedback, list, view, viewNoModels, localFeedback Signed-off-by: Jessie Frazelle <github@jessfraz.com> * refactor(download): cut the middleman, call KittyCAD directly - Remove /api/convert, call @kittycad/lib from client using Zoo token - Simplify errors and toasts; clean imports, reindent with tabs Signed-off-by: Jessie Frazelle <github@jessfraz.com> * fix(app): kill lazy imports, use $page token, prune dead endpoints - Static import @kittycad/lib and zoo client, use $page token - Drop submit-feedback API and endpoints; calls go through @kittycad/lib Signed-off-by: Jessie Frazelle <github@jessfraz.com> * fix(types): any is dead, long live Uuid for conversation_id - Align conversation_id to Uuid to satisfy @kittycad/lib - Drop unused TextToCadResponseResultsPage import Signed-off-by: Jessie Frazelle <github@jessfraz.com> * refactor(generation-list): drop Uuid hack, type pager options, no BS - Remove Uuid import and bogus conversation_id, align with pager API - Type options as function param type, cleaner checks, no runtime change Signed-off-by: Jessie Frazelle <github@jessfraz.com> * chore(deps): refresh package-lock.json after updates (npm did a thing) - Update @playwright/test 1.54.2, esbuild 0.25.x, rollup 4.46.x - No application code changes Signed-off-by: Jessie Frazelle <github@jessfraz.com> * style(package): tabs over spaces, reindent package.json - Whitespace only; no behavior or dependency changes Signed-off-by: Jessie Frazelle <github@jessfraz.com> --------- Signed-off-by: Jessie Frazelle <github@jessfraz.com>
1 parent ab93182 commit f78d748

31 files changed

+420
-380
lines changed

package-lock.json

Lines changed: 103 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"type": "module",
5252
"dependencies": {
53-
"@kittycad/lib": "2.0.40",
53+
"@kittycad/lib": "^3.0.2",
5454
"@kittycad/react-shared": "^0.1.4",
5555
"@threlte/core": "^6.1.0",
5656
"@threlte/extras": "^7.3.0",

src/app.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { Models } from '@kittycad/lib'
1+
import type { User, ApiErrorBody } from '@kittycad/lib'
22
// See https://kit.svelte.dev/docs/types#app
33
// for information about these interfaces
44
declare global {
55
namespace App {
66
// interface Error {}
77
interface Locals {
8-
user?: Models['User_type'] | Models['Error_type']
8+
user?: User | ApiErrorBody
99
}
1010
// interface PageData {}
1111
// interface Platform {}

src/components/AccountMenu.svelte

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<script lang="ts">
2-
import type { Models } from '@kittycad/lib/types'
2+
import type { User } from '@kittycad/lib'
33
import { paths } from '$lib/paths'
44
import Person from './Icons/Person.svelte'
55
import CaretDown from './Icons/CaretDown.svelte'
66
import Link from './Icons/Link.svelte'
77
8-
export let user: Models['User_type']
8+
export let user: User | undefined
99
let open = false
1010
let shouldDisplayImage = Boolean(user?.image && user.image !== '')
1111
let shouldDisplayInitial =
@@ -49,12 +49,21 @@
4949
referrerpolicy="no-referrer"
5050
/>
5151
{#if shouldDisplayInitial}
52-
<span
53-
class="uppercase w-5 h-5 font-bold text-xl leading-[1] pt-0.5 text-center text-chalkboard-10 dark:text-chalkboard-110"
54-
data-testid="initial"
55-
>
56-
{user.name?.[0] || user.first_name?.[0] || user.email?.[0]}
57-
</span>
52+
{#if user}
53+
<span
54+
class="uppercase w-5 h-5 font-bold text-xl leading-[1] pt-0.5 text-center text-chalkboard-10 dark:text-chalkboard-110"
55+
data-testid="initial"
56+
>
57+
{user.name?.[0] || user.first_name?.[0] || user.email?.[0]}
58+
</span>
59+
{:else}
60+
<span
61+
class="uppercase w-5 h-5 font-bold text-xl leading-[1] pt-0.5 text-center text-chalkboard-10 dark:text-chalkboard-110"
62+
data-testid="initial"
63+
>
64+
?
65+
</span>
66+
{/if}
5867
{:else if !shouldDisplayImage}
5968
<Person
6069
data-testid="person-icon"

src/components/AccountMenu.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { render } from '@testing-library/svelte'
22
import AccountMenu from './AccountMenu.svelte'
3-
import type { Models } from '@kittycad/lib/types'
3+
import type { User } from '@kittycad/lib'
44

5-
const FULL_USER: Models['User_type'] = {
5+
const FULL_USER: User = {
66
id: 'some_id',
77
name: 'Frank Noirot',
88
email: 'zoo_employee@zoo.dev',
@@ -21,19 +21,19 @@ const FULL_USER: Models['User_type'] = {
2121
is_onboarded: true,
2222
is_service_account: false
2323
}
24-
const NAME_USER: Models['User_type'] = {
24+
const NAME_USER: User = {
2525
...FULL_USER,
2626
image: ''
2727
}
28-
const FIRST_NAME_USER: Models['User_type'] = {
28+
const FIRST_NAME_USER: User = {
2929
...NAME_USER,
3030
name: ''
3131
}
32-
const EMAIL_USER: Models['User_type'] = {
32+
const EMAIL_USER: User = {
3333
...FIRST_NAME_USER,
3434
first_name: ''
3535
}
36-
const FAILED_USER: Models['User_type'] = {
36+
const FAILED_USER: User = {
3737
...EMAIL_USER,
3838
email: ''
3939
}
@@ -59,7 +59,7 @@ describe('AccountMenu', async () => {
5959
expect(component.getByAltText('Avatar')).not.toBeVisible()
6060
const initial = await component.getByTestId('initial')
6161
expect(initial).toBeVisible()
62-
expect(initial.textContent).toBe(NAME_USER.name[0])
62+
expect(initial.textContent).toBe(NAME_USER.name![0])
6363
})
6464

6565
it('fallback initial appears if first_name is available', async () => {
@@ -72,7 +72,7 @@ describe('AccountMenu', async () => {
7272
expect(component.getByAltText('Avatar')).not.toBeVisible()
7373
const initial = await component.getByTestId('initial')
7474
expect(initial).toBeVisible()
75-
expect(initial.textContent).toBe(FIRST_NAME_USER.first_name[0])
75+
expect(initial.textContent).toBe(FIRST_NAME_USER.first_name![0])
7676
})
7777

7878
it('fallback initial appears if email is available', async () => {
@@ -85,7 +85,7 @@ describe('AccountMenu', async () => {
8585
expect(component.getByAltText('Avatar')).not.toBeVisible()
8686
const initial = await component.getByTestId('initial')
8787
expect(initial).toBeVisible()
88-
expect(initial.textContent).toBe(FIRST_NAME_USER.email[0])
88+
expect(initial.textContent).toBe(FIRST_NAME_USER.email![0])
8989
})
9090

9191
it('user outline appears if all other options fail', async () => {

src/components/AppHeader.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script lang="ts" type="module">
2-
import type { Models } from '@kittycad/lib/types'
2+
import type { User } from '@kittycad/lib'
33
import AccountMenu from 'components/AccountMenu.svelte'
44
import { APP_NAME } from '$lib/consts'
55
import { paths } from '$lib/paths'
66
import AppLogo from 'components/AppLogo.svelte'
77
import Plus from 'components/Icons/Plus.svelte'
88
import { page } from '$app/stores'
99
10-
export let user: Models['User_type']
10+
export let user: User | undefined
1111
</script>
1212

1313
<header id="app-header" data-testid="app-header">

src/components/BlockedMessage.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts">
22
import { paths } from '$lib/paths'
3-
import type { Models } from '@kittycad/lib/types'
3+
import type { BlockReason } from '@kittycad/lib'
44
5-
export let blockedReason: Models['User_type']['block']
5+
export let blockedReason: BlockReason
66
</script>
77

88
<div class="p-4 text-xl text-blue border border-blue bg-blue/10 rounded">

0 commit comments

Comments
 (0)