@boldvideo/bold-js 0.7.0 → 0.7.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @boldvideo/bold-js
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix: Add thoughts directory to .npmignore to prevent publishing internal planning files
8
+
3
9
  ## 0.7.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@boldvideo/bold-js",
3
3
  "license": "MIT",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,272 +0,0 @@
1
- # Add portal.color_scheme to Settings Type Implementation Plan
2
-
3
- ## Overview
4
-
5
- Add the `color_scheme` field to the `Portal` type in the bold-js SDK to support the Next.js starter's theme configuration feature. The API already returns this field in production; we need to update the TypeScript types to reflect this.
6
-
7
- ## Current State Analysis
8
-
9
- **What exists:**
10
- - Portal type defined at `src/lib/types.ts:133-138` with four nested objects (display, layout, navigation, theme)
11
- - Portal type properly exported through `src/index.ts:12`
12
- - Settings type at `src/lib/types.ts:210` includes the Portal object
13
- - API already returning `portal.color_scheme` field (live in production)
14
- - Next.js starter consuming this field but TypeScript doesn't know about it
15
-
16
- **What's missing:**
17
- - `color_scheme` field in the Portal type definition
18
- - Type definition doesn't match the API response
19
- - Consumers can't benefit from TypeScript autocomplete/validation for this field
20
-
21
- **Key constraints:**
22
- - Must maintain backward compatibility (field should be optional)
23
- - Must follow existing optional field pattern (using `?` suffix)
24
- - This will be the first string literal union type in Portal/Settings types
25
- - Project uses changesets for version management
26
- - No existing test suite to update
27
-
28
- ## Desired End State
29
-
30
- After implementation:
31
- 1. Portal type includes `color_scheme?: 'toggle' | 'light' | 'dark'` field
32
- 2. TypeScript consumers get autocomplete for the three valid values
33
- 3. Type declarations are rebuilt and available in `dist/index.d.ts`
34
- 4. Version bumped to 0.7.0 with appropriate changelog entry
35
- 5. Changes published to npm
36
-
37
- **Verification:**
38
- - Portal type includes the new field with correct union type
39
- - Build succeeds without errors: `pnpm run build`
40
- - Type checking passes: `pnpm run lint`
41
- - Compiled type declarations in `dist/index.d.ts` include the field
42
- - Changeset created for version 0.7.0
43
-
44
- ## What We're NOT Doing
45
-
46
- - Not adding runtime validation for the color_scheme values
47
- - Not adding tests (no test framework exists in this project)
48
- - Not modifying the API or fetcher functions (they already work correctly)
49
- - Not changing any other types or fields
50
- - Not adding documentation beyond the changelog entry
51
- - Not updating example code or README (out of scope for this ticket)
52
-
53
- ## Implementation Approach
54
-
55
- This is a single-phase implementation because:
56
- 1. It's a one-line type change
57
- 2. No runtime code changes required
58
- 3. No migration needed (field is optional)
59
- 4. Build and publish can happen together
60
-
61
- The approach:
62
- 1. Add the `color_scheme` field to Portal type
63
- 2. Create changeset for version bump
64
- 3. Build to verify TypeScript compilation
65
- 4. Commit changes following git conventions
66
-
67
- ## Phase 1: Add color_scheme Field
68
-
69
- ### Overview
70
-
71
- Add the `color_scheme` field to the Portal type definition following the SDK's established patterns for optional fields.
72
-
73
- ### Changes Required
74
-
75
- #### 1. Update Portal Type Definition
76
-
77
- **File**: `src/lib/types.ts`
78
- **Line**: 133-138
79
- **Changes**: Add `color_scheme` as the first field in the Portal type
80
-
81
- ```typescript
82
- export type Portal = {
83
- color_scheme?: 'toggle' | 'light' | 'dark';
84
- display: PortalDisplay;
85
- layout: PortalLayout;
86
- navigation: PortalNavigation;
87
- theme: PortalTheme;
88
- };
89
- ```
90
-
91
- **Rationale:**
92
- - Optional field (`?`) maintains backward compatibility
93
- - String literal union type provides type safety and autocomplete
94
- - Positioned first in the type as it's a top-level configuration (similar to how top-level fields appear before nested objects in Settings)
95
- - Follows TypeScript best practices for union types
96
-
97
- #### 2. Create Changeset
98
-
99
- **Command**: `pnpm changeset`
100
-
101
- **Changeset content:**
102
- ```markdown
103
- ---
104
- "@boldvideo/bold-js": minor
105
- ---
106
-
107
- Add `color_scheme` field to Portal type (BOLD-759)
108
-
109
- Added optional `color_scheme` field to the Portal type to support theme configuration:
110
- - `'toggle'`: Show theme toggle, allow user to switch between light/dark
111
- - `'light'`: Force light mode, hide theme toggle
112
- - `'dark'`: Force dark mode, hide theme toggle
113
-
114
- This field is already returned by the API and consumed by the Next.js starter. The type definition now matches the API response.
115
- ```
116
-
117
- **Why minor version:**
118
- - Adds new functionality (new field) to the public API
119
- - Follows semantic versioning: backward compatible API addition
120
- - Matches pattern from CHANGELOG.md (v0.5.0 added `ai_greeting`, v0.6.0 added portal object)
121
-
122
- ### Success Criteria
123
-
124
- #### Automated Verification:
125
-
126
- - [x] Portal type includes `color_scheme?: 'toggle' | 'light' | 'dark'` field in correct position
127
- - [x] Build completes successfully: `pnpm run build`
128
- - [x] Type checking passes: `pnpm run lint` (runs `tsc`)
129
- - [x] Compiled declarations in `dist/index.d.ts` include the new field
130
- - [x] Git status shows only expected changes: `src/lib/types.ts` and changeset file
131
-
132
- #### Manual Verification:
133
-
134
- - [x] Type change makes semantic sense (three valid theme modes)
135
- - [x] Field placement is logical within the Portal type structure
136
- - [x] Changeset message accurately describes the change
137
- - [x] No unintended changes to other types
138
-
139
- ## Phase 2: Version and Publish
140
-
141
- ### Overview
142
-
143
- Use changesets to version the package and publish to npm.
144
-
145
- ### Changes Required
146
-
147
- #### 1. Version the Package
148
-
149
- **Command**: `pnpm changeset version`
150
-
151
- **Expected changes:**
152
- - `package.json` version bumped from `0.6.1` to `0.7.0`
153
- - `CHANGELOG.md` updated with changeset content under `## 0.7.0`
154
- - Changeset file consumed and removed
155
-
156
- #### 2. Build for Distribution
157
-
158
- **Command**: `pnpm run build`
159
-
160
- **Expected output:**
161
- - `dist/index.js` (ESM)
162
- - `dist/index.cjs` (CommonJS)
163
- - `dist/index.d.ts` (TypeScript declarations)
164
-
165
- The build must succeed and include the new `color_scheme` field in type declarations.
166
-
167
- #### 3. Publish to npm
168
-
169
- **Command**: `pnpm changeset publish`
170
-
171
- **Expected behavior:**
172
- - Package tagged as `v0.7.0`
173
- - Published to npm registry with public access
174
- - Git tag created for the release
175
-
176
- ### Success Criteria
177
-
178
- #### Automated Verification:
179
-
180
- - [x] `package.json` shows version `0.7.0`
181
- - [x] `CHANGELOG.md` includes entry for version `0.7.0` with BOLD-759 reference
182
- - [x] Build completes without errors: `pnpm run build`
183
- - [x] Type declarations in `dist/index.d.ts` include `color_scheme` field
184
- - [ ] Package published successfully to npm (requires manual 2FA)
185
- - [ ] Git tag `v0.7.0` created (created by publish command)
186
-
187
- #### Manual Verification:
188
-
189
- - [ ] Published package on npm shows correct version (pending publish)
190
- - [ ] Type declarations are available to consumers (pending publish)
191
- - [x] CHANGELOG.md entry is accurate and well-formatted
192
- - [x] All files committed with appropriate git message (following project conventions)
193
-
194
- ## Testing Strategy
195
-
196
- ### Unit Tests
197
-
198
- Not applicable - this project has no test suite.
199
-
200
- ### Integration Tests
201
-
202
- Not applicable - no test framework configured.
203
-
204
- ### Manual Testing Steps
205
-
206
- Since this is a type-only change, manual testing focuses on verification that TypeScript types work correctly:
207
-
208
- 1. **Verify type compilation:**
209
- ```bash
210
- pnpm run lint # Runs tsc to check types
211
- ```
212
-
213
- 2. **Verify build output:**
214
- ```bash
215
- pnpm run build
216
- # Check that dist/index.d.ts contains the new field
217
- cat dist/index.d.ts | grep -A 5 "type Portal"
218
- ```
219
-
220
- 3. **Verify in a consumer project (optional):**
221
- - Link the package locally: `pnpm link @boldvideo/bold-js`
222
- - In a TypeScript project, import and use the type:
223
- ```typescript
224
- import { createClient } from '@boldvideo/bold-js';
225
-
226
- const bold = createClient('api-key');
227
- const settings = await bold.settings();
228
-
229
- // TypeScript should autocomplete 'toggle' | 'light' | 'dark'
230
- const colorScheme = settings.data.portal.color_scheme;
231
- ```
232
-
233
- ## Performance Considerations
234
-
235
- None - this is a compile-time only change. No runtime performance impact.
236
-
237
- ## Migration Notes
238
-
239
- No migration required. The field is optional and backward compatible:
240
-
241
- **For existing consumers:**
242
- - Upgrading to 0.7.0 requires no code changes
243
- - The `color_scheme` field will be `undefined` if not returned by the API
244
- - Type checking will help consumers handle the field correctly if they choose to use it
245
-
246
- **API compatibility:**
247
- - API already returns this field (in production since commits b31396f, b42c9fe, b9d8ee8)
248
- - Older SDK versions will ignore the field (no breaking changes)
249
- - Newer SDK versions provide type safety for the field
250
-
251
- ## References
252
-
253
- - Original ticket: [BOLD-759](https://linear.app/boldvideo/issue/BOLD-759/add-portalcolor-scheme-to-settings-type-in-bold-js-sdk)
254
- - Research document: `thoughts/shared/research/2025-10-22-BOLD-759-portal-color-scheme-settings.md`
255
- - Portal type definition: `src/lib/types.ts:133-138`
256
- - Settings type definition: `src/lib/types.ts:179-217`
257
- - Type exports: `src/index.ts:12`
258
-
259
- ## Implementation Notes
260
-
261
- **Field positioning rationale:**
262
- The `color_scheme` field should be placed first in the Portal type because:
263
- 1. It's a direct configuration value (not a nested object like display/layout/navigation/theme)
264
- 2. Follows the pattern in Settings type where direct values come before nested objects
265
- 3. Makes the type more readable - simple values first, complex nested types after
266
-
267
- **Union type introduction:**
268
- This is the first string literal union type in Portal/Settings types. While the existing types use simple primitives (`string`, `boolean`, `number`), using a union type here provides:
269
- 1. Type safety - prevents invalid values
270
- 2. Better developer experience - autocomplete in IDEs
271
- 3. Self-documenting code - valid values are in the type definition
272
- 4. Follows TypeScript best practices for known string values
@@ -1,215 +0,0 @@
1
- ---
2
- date: 2025-10-22T03:51:01+0000
3
- researcher: Claude Code
4
- git_commit: b74faa4e21936838e3aca23828c579b7d1da7a82
5
- branch: main
6
- repository: bold-js
7
- topic: "Adding portal.color_scheme to Settings Type in bold-js SDK"
8
- tags: [research, codebase, bold-js, settings, types, portal, BOLD-759]
9
- status: complete
10
- last_updated: 2025-10-22
11
- last_updated_by: Claude Code
12
- ---
13
-
14
- # Research: Adding portal.color_scheme to Settings Type in bold-js SDK
15
-
16
- **Date**: 2025-10-22T03:51:01+0000
17
- **Researcher**: Claude Code
18
- **Git Commit**: b74faa4e21936838e3aca23828c579b7d1da7a82
19
- **Branch**: main
20
- **Repository**: bold-js
21
- **Linear Ticket**: [BOLD-759](https://linear.app/boldvideo/issue/BOLD-759/add-portalcolor-scheme-to-settings-type-in-bold-js-sdk)
22
-
23
- ## Research Question
24
-
25
- Where and how should the `color_scheme` field be added to the Settings type in the bold-js SDK to support the Next.js starter's theme configuration?
26
-
27
- ## Summary
28
-
29
- The `color_scheme` field needs to be added to the `Portal` type definition in `/Users/marcelfahle/code/BOLD/code/_oss/bold-js/src/lib/types.ts` at line 133. The Portal type is already part of the Settings type (line 210), so adding the field to Portal will automatically make it available in Settings. The SDK already has established patterns for optional fields and will automatically export the updated type through the main index file.
30
-
31
- ## Detailed Findings
32
-
33
- ### Current Settings Type Structure
34
-
35
- The Settings type is defined in `src/lib/types.ts:179-217` with the following key components:
36
-
37
- **Portal Object Location**: `src/lib/types.ts:210`
38
- ```typescript
39
- portal: Portal
40
- ```
41
-
42
- The Portal type itself is defined at `src/lib/types.ts:133-138`:
43
- ```typescript
44
- export type Portal = {
45
- display: PortalDisplay;
46
- layout: PortalLayout;
47
- navigation: PortalNavigation;
48
- theme: PortalTheme;
49
- };
50
- ```
51
-
52
- ### Where to Add color_scheme
53
-
54
- The `color_scheme` field should be added directly to the `Portal` type definition at `src/lib/types.ts:133-138`. Based on the ticket requirements, it should be:
55
-
56
- **Type**: `'toggle' | 'light' | 'dark'`
57
- **Optional**: Yes (using the `?` suffix)
58
- **Location**: Portal type definition
59
-
60
- The field would be added as a new property alongside the existing nested objects (display, layout, navigation, theme).
61
-
62
- ### Existing Portal Structure
63
-
64
- The Portal type currently contains four nested configuration objects:
65
-
66
- 1. **display: PortalDisplay** (`src/lib/types.ts:98-101`)
67
- - `show_chapters: boolean`
68
- - `show_transcripts: boolean`
69
-
70
- 2. **layout: PortalLayout** (`src/lib/types.ts:109-114`)
71
- - `assistant_config: AssistantConfig | null`
72
- - `show_playlists: boolean`
73
- - `type: string`
74
- - `videos_limit: number`
75
-
76
- 3. **navigation: PortalNavigation** (`src/lib/types.ts:116-120`)
77
- - `show_ai_search: boolean`
78
- - `show_header: boolean`
79
- - `show_search: boolean`
80
-
81
- 4. **theme: PortalTheme** (`src/lib/types.ts:122-131`)
82
- - `background: string`
83
- - `font_body: string`
84
- - `font_header: string`
85
- - `foreground: string`
86
- - `logo_height: number`
87
- - `logo_url: string`
88
- - `logo_width: number`
89
- - `primary: string`
90
-
91
- ### Optional Field Pattern in Settings
92
-
93
- The SDK has a consistent pattern for optional fields using the TypeScript `?:` syntax:
94
-
95
- **Examples from Settings type** (`src/lib/types.ts:179-217`):
96
- - `ai_greeting?: string` (line 187)
97
- - `favicon_url?: string` (line 194)
98
- - `logo_dark_url?: string` (line 195)
99
- - `logo_url?: string` (line 196)
100
- - `social_graph_image_url?: string` (line 204, nested in meta_data)
101
-
102
- **Examples from Video type** (`src/lib/types.ts:33-80`):
103
- - `chapters?: string`
104
- - `attachments?: VideoAttachment[]`
105
- - `internal_id?: string`
106
- - `playback_speed?: number`
107
- - `tags?: string[]`
108
- - `transcript?: VideoTranscript`
109
-
110
- ### Union Type Pattern
111
-
112
- Currently, the Settings type and its nested types don't extensively use string literal union types. The closest patterns are:
113
-
114
- **Null unions**:
115
- - `assistant_config: AssistantConfig | null` (`src/lib/types.ts:110`)
116
- - `image: string | null` (`src/lib/types.ts:202`)
117
-
118
- The proposed `'toggle' | 'light' | 'dark'` union type would be a new pattern for the Settings type, though it's a standard TypeScript pattern.
119
-
120
- ### Type Export Chain
121
-
122
- The Portal type follows this export chain:
123
-
124
- 1. **Definition**: `src/lib/types.ts:133-138` - Portal type is exported
125
- 2. **Re-export**: `src/index.ts:12` - Portal is re-exported from main entry
126
- 3. **Compilation**: `dist/index.d.ts` - Type declarations are generated by tsup
127
- 4. **Consumption**: Available to consumers via `import type { Portal } from '@boldvideo/bold-js'`
128
-
129
- Any changes to the Portal type will automatically flow through this chain when the project is rebuilt.
130
-
131
- ### Settings API Usage
132
-
133
- The Settings type is fetched via the `fetchSettings` function in `src/lib/fetchers.ts:26-38`:
134
-
135
- ```typescript
136
- export function fetchSettings(client: ApiClient) {
137
- return async (videoLimit = 12) => {
138
- try {
139
- return await get<Response<Settings>>(
140
- client,
141
- `settings?limit=${videoLimit}`
142
- );
143
- } catch (error) {
144
- console.error(`Error fetching settings with limit: ${videoLimit}`, error);
145
- throw error;
146
- }
147
- };
148
- }
149
- ```
150
-
151
- The function returns a `Response<Settings>` wrapper type where Settings includes the portal object. The API endpoint is `settings?limit=${videoLimit}`.
152
-
153
- ## Code References
154
-
155
- - `src/lib/types.ts:133-138` - Portal type definition (where color_scheme should be added)
156
- - `src/lib/types.ts:179-217` - Settings type definition
157
- - `src/lib/types.ts:210` - Portal field in Settings type
158
- - `src/index.ts:12` - Portal type re-export
159
- - `src/lib/fetchers.ts:26-38` - fetchSettings API implementation
160
-
161
- ## Architecture Documentation
162
-
163
- ### Type Definition Pattern
164
-
165
- The SDK uses a modular type system where:
166
-
167
- 1. Small, focused types are defined for specific concepts (PortalDisplay, PortalLayout, etc.)
168
- 2. These types are composed into larger structures (Portal contains display, layout, navigation, theme)
169
- 3. The Settings type brings everything together at the top level
170
- 4. All types are exported individually, allowing consumers to use them independently
171
-
172
- ### Build and Type Generation
173
-
174
- - **Build tool**: tsup
175
- - **Source**: TypeScript files in `src/`
176
- - **Output**: ESM and CommonJS in `dist/` with type declarations
177
- - **Type declarations**: Generated automatically in `dist/index.d.ts`
178
-
179
- ### Backward Compatibility
180
-
181
- The Settings type maintains backward compatibility by:
182
-
183
- - Keeping legacy flat AI fields (`ai_avatar`, `ai_name`, `has_ai`) while adding new nested `account` structure
184
- - Using optional fields for new additions to prevent breaking changes
185
- - Defaulting to sensible values (as specified in the ticket: default to "toggle" if not specified)
186
-
187
- ## Related Research
188
-
189
- This research is specific to BOLD-759. No previous research documents were found in the thoughts directory related to Settings type modifications.
190
-
191
- ## Implementation Context
192
-
193
- According to the Linear ticket:
194
-
195
- **Purpose**: The Next.js starter now reads `portal.color_scheme` from the settings API to control theme behavior, but this field is not yet defined in the bold-js SDK Settings type.
196
-
197
- **Expected behavior**:
198
- - `"toggle"`: Show theme toggle, allow user to switch between light/dark
199
- - `"light"`: Force light mode, hide theme toggle
200
- - `"dark"`: Force dark mode, hide theme toggle
201
- - Default to `"toggle"` if not specified
202
-
203
- **Already implemented**: The implementation is live in production in these commits:
204
- - main: b31396f
205
- - demo/founderwell: b42c9fe
206
- - custom/yo: b9d8ee8
207
-
208
- The API is already returning this field; the SDK types just need to be updated to reflect it.
209
-
210
- ## Notes
211
-
212
- - No string literal union types currently exist in the Settings/Portal types, so this would introduce that pattern
213
- - The field should be optional to maintain backward compatibility
214
- - The type will automatically be available to consumers after the SDK is rebuilt and published
215
- - No changes needed to the API fetcher code - it already returns the full Settings object