@pindownai/client-js 1.3.2 → 1.3.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.
package/dist/index.d.ts CHANGED
@@ -1,650 +1,17 @@
1
- /**
2
- * Pin types for the v1 Pins API.
3
- * Aligned with backend-api/src/lib/pin-types.ts + pin-config-schemas.ts.
4
- * Import per-type *PinConfig interfaces for typed CRUD payloads.
5
- */
6
- declare const PRODUCT_PIN_TYPES: readonly ["markdown", "image", "gallery", "table", "charts", "mermaid", "code", "embed", "pdf-viewer", "excel-viewer", "stat-cards", "timeline", "json-viewer", "json-list", "links", "qr-code", "social-handles", "steps", "trace", "plan", "notes", "csv-viewer", "user-story", "chat", "intro", "mastra", "text-media", "business-card", "video", "audio", "file-upload", "kanban-board", "checklist", "comparison", "calendar", "roadmap", "realtime-canvas"];
7
- declare const ALL_PIN_TYPES: readonly ["markdown", "image", "gallery", "table", "charts", "mermaid", "code", "embed", "pdf-viewer", "excel-viewer", "stat-cards", "timeline", "json-viewer", "json-list", "links", "qr-code", "social-handles", "steps", "trace", "plan", "notes", "csv-viewer", "user-story", "chat", "intro", "mastra", "text-media", "business-card", "video", "audio", "file-upload", "kanban-board", "checklist", "comparison", "calendar", "roadmap", "realtime-canvas"];
8
- type ProductPinTypeId = (typeof PRODUCT_PIN_TYPES)[number];
9
- type PinTypeId = (typeof ALL_PIN_TYPES)[number];
10
- type PinLayout = '1x1' | '1x2' | '2x1' | '2x2' | '3x1' | '3x2' | '3x3' | '4x4';
11
- type PinDataType = 'markdown' | 'json' | 'text' | 'pin-card';
12
- /** @deprecated Use PinTypeId */
13
- type PinCardType = PinTypeId;
14
- interface StatCardItem {
15
- title: string;
16
- value: string | number;
17
- change?: string;
18
- trend?: 'up' | 'down' | 'neutral' | string;
19
- icon?: string;
20
- [key: string]: unknown;
21
- }
22
- interface TableColumn {
23
- id: string;
24
- name: string;
25
- type?: string;
26
- [key: string]: unknown;
27
- }
28
- interface TableRow {
29
- id: string;
30
- cells: Record<string, unknown>;
31
- [key: string]: unknown;
32
- }
33
- interface KanbanColumn {
34
- id: string;
35
- title: string;
36
- cards?: Array<Record<string, unknown>>;
37
- [key: string]: unknown;
38
- }
39
- interface ChecklistItem {
40
- id: string;
41
- name: string;
42
- checked?: boolean;
43
- [key: string]: unknown;
44
- }
45
- interface GalleryImage {
46
- url: string;
47
- alt?: string;
48
- [key: string]: unknown;
49
- }
50
- interface LinkItem {
51
- title: string;
52
- url: string;
53
- [key: string]: unknown;
54
- }
55
- interface StepItem {
56
- title: string;
57
- description?: string;
58
- [key: string]: unknown;
59
- }
60
- interface MarkdownPinConfig {
61
- content?: string;
62
- collaboration?: {
63
- enabled?: boolean;
64
- };
65
- [key: string]: unknown;
66
- }
67
- interface ImagePinConfig {
68
- url?: string;
69
- altText?: string;
70
- fit?: 'cover' | 'contain' | string;
71
- [key: string]: unknown;
72
- }
73
- interface GalleryPinConfig {
74
- images?: GalleryImage[];
75
- [key: string]: unknown;
76
- }
77
- interface TablePinConfig {
78
- columns: TableColumn[];
79
- rows?: TableRow[];
80
- [key: string]: unknown;
81
- }
82
- interface ChartsPinConfig {
83
- chartType?: string;
84
- data?: Array<Record<string, unknown>>;
85
- xAxis?: string;
86
- yAxis?: string;
87
- [key: string]: unknown;
88
- }
89
- interface MermaidPinConfig {
90
- diagram?: string;
91
- code?: string;
92
- title?: string;
93
- [key: string]: unknown;
94
- }
95
- interface CodePinConfig {
96
- code: string;
97
- language?: string;
98
- filename?: string;
99
- title?: string;
100
- [key: string]: unknown;
101
- }
102
- interface EmbedPinConfig {
103
- url?: string;
104
- type?: string;
105
- [key: string]: unknown;
106
- }
107
- interface PdfViewerPinConfig {
108
- pdf: {
109
- url: string;
110
- fileName?: string;
111
- title?: string;
112
- [key: string]: unknown;
113
- };
114
- [key: string]: unknown;
115
- }
116
- interface ExcelViewerPinConfig {
117
- excel: {
118
- url: string;
119
- fileName?: string;
120
- title?: string;
121
- [key: string]: unknown;
122
- };
123
- [key: string]: unknown;
124
- }
125
- interface StatCardsPinConfig {
126
- cards: StatCardItem[];
127
- [key: string]: unknown;
128
- }
129
- interface TimelinePinConfig {
130
- mode?: string;
131
- items?: Array<Record<string, unknown>>;
132
- [key: string]: unknown;
133
- }
134
- interface JsonViewerPinConfig {
135
- json?: unknown;
136
- jsonString?: string;
137
- title?: string;
138
- [key: string]: unknown;
139
- }
140
- interface JsonListPinConfig {
141
- json?: unknown[];
142
- jsonString?: string;
143
- [key: string]: unknown;
144
- }
145
- interface LinksPinConfig {
146
- links?: LinkItem[];
147
- [key: string]: unknown;
148
- }
149
- interface QrCodePinConfig {
150
- url?: string;
151
- label?: string;
152
- [key: string]: unknown;
153
- }
154
- interface SocialHandleItem {
155
- id?: string;
156
- platform: string;
157
- url: string;
158
- label?: string;
159
- [key: string]: unknown;
160
- }
161
- interface SocialHandlesPinConfig {
162
- title?: string;
163
- showLabels?: boolean;
164
- iconSize?: number;
165
- handles?: SocialHandleItem[];
166
- [key: string]: unknown;
167
- }
168
- interface StepsPinConfig {
169
- steps: StepItem[];
170
- [key: string]: unknown;
171
- }
172
- type TraceSpanStatus = 'completed' | 'running' | 'pending' | 'failed';
173
- type TraceSpanType = 'system' | 'agent' | 'tool';
174
- interface TraceSpanItem {
175
- id?: string;
176
- type?: TraceSpanType;
177
- name: string;
178
- status: TraceSpanStatus;
179
- timestamp?: string;
180
- duration?: string;
181
- details?: string;
182
- }
183
- interface TracePinConfig {
184
- title?: string;
185
- live?: boolean;
186
- spans: TraceSpanItem[];
187
- [key: string]: unknown;
188
- }
189
- type PlanContentBlock = {
190
- type: 'details';
191
- title?: string;
192
- items: string[];
193
- } | {
194
- type: 'command';
195
- command: string;
196
- label?: string;
197
- } | {
198
- type: 'code';
199
- code: string;
200
- language?: string;
201
- filename?: string;
202
- } | {
203
- type: 'text';
204
- content: string;
205
- } | {
206
- type: 'link';
207
- url: string;
208
- label?: string;
209
- } | {
210
- type: 'mermaid';
211
- diagram: string;
212
- title?: string;
213
- } | {
214
- type: 'summary';
215
- content: string;
216
- title?: string;
1
+ import { P as PinTypeId, C as CreatePinHelperInput, a as Pin, U as UpdatePinHelperInput, b as PinConfigByType, c as UpdatePinRequest, d as CreatePinRequest } from './PindownClient-Blc0tgqw.js';
2
+ export { h as ALL_PIN_TYPES, A as ApiResponse, a3 as AudioPinConfig, a4 as AudioPinTrack, a0 as BusinessCardField, a1 as BusinessCardPinConfig, a8 as CalendarPinConfig, z as ChartsPinConfig, Y as ChatPinConfig, u as ChecklistItem, a7 as ChecklistPinConfig, af as CreateEmbedPinInput, ab as CreateMarkdownPinInput, q as CreateNestedPinRequest, r as CreatePinOptions, ac as CreateStatCardsPinInput, ad as CreateTablePinInput, p as CreateTypedPinRequest, W as CsvViewerPinConfig, E as EmbedPinConfig, F as ExcelViewerPinConfig, a5 as FileUploadPinConfig, G as GalleryImage, x as GalleryPinConfig, I as ImagePinConfig, Z as IntroPinConfig, O as JsonListPinConfig, N as JsonViewerPinConfig, a6 as KanbanBoardPinConfig, K as KanbanColumn, v as LinkItem, Q as LinksPinConfig, L as ListPinsOptions, M as MarkdownPinConfig, _ as MastraPinConfig, B as MermaidPinConfig, i as PRODUCT_PIN_TYPES, g as PaginatedResponse, D as PdfViewerPinConfig, m as PinCardType, l as PinDataType, k as PinLayout, o as PinMetadata, n as PinMetadataBase, e as PindownClient, f as PindownConfig, j as ProductPinTypeId, R as QrCodePinConfig, aa as RealtimeCanvasPinConfig, a9 as RoadmapPinConfig, S as SharePinRequest, s as StatCardItem, H as StatCardsPinConfig, w as StepItem, V as StepsPinConfig, T as TableColumn, y as TablePinConfig, t as TableRow, $ as TextMediaPinConfig, J as TimelinePinConfig, ae as UpdateTablePinInput, X as UserStoryPinConfig, a2 as VideoPinConfig } from './PindownClient-Blc0tgqw.js';
3
+
4
+ type CapitalizeWord<S extends string> = S extends `${infer C}${infer R}` ? `${Uppercase<C>}${R}` : S;
5
+ type PascalFromKebab<S extends string> = S extends `${infer Head}-${infer Tail}` ? `${CapitalizeWord<Head>}${PascalFromKebab<Tail>}` : CapitalizeWord<S>;
6
+ /** `createMarkdown`, `createTable`, one per {@link PinTypeId}. */
7
+ type PinCreateMethods = {
8
+ [T in PinTypeId as `create${PascalFromKebab<T>}`]: (input: CreatePinHelperInput<T>) => Promise<Pin<T>>;
217
9
  };
218
- interface PlanTaskItem {
219
- id?: string;
220
- number?: string;
221
- title: string;
222
- label?: string;
223
- description?: string;
224
- blocks?: PlanContentBlock[];
225
- [key: string]: unknown;
226
- }
227
- interface PlanPhaseItem {
228
- id?: string;
229
- title: string;
230
- status?: 'pending' | 'in-progress' | 'completed';
231
- tasks: PlanTaskItem[];
232
- [key: string]: unknown;
233
- }
234
- interface PlanPinConfig {
235
- title?: string;
236
- status?: 'draft' | 'in-progress' | 'completed';
237
- breadcrumbs?: Array<{
238
- label: string;
239
- }>;
240
- phases: PlanPhaseItem[];
241
- [key: string]: unknown;
242
- }
243
- interface NoteItem {
244
- id?: string;
245
- title: string;
246
- content?: string;
247
- order?: number;
248
- createdAt?: number;
249
- updatedAt?: number;
250
- }
251
- interface NotesPinConfig {
252
- notes?: NoteItem[];
253
- [key: string]: unknown;
254
- }
255
- interface CsvViewerPinConfig {
256
- csvText?: string;
257
- csvData?: Array<Record<string, unknown>>;
258
- fileName?: string;
259
- [key: string]: unknown;
260
- }
261
- interface UserStoryPinConfig {
262
- title?: string;
263
- userStory: string;
264
- acceptanceCriteria?: string;
265
- [key: string]: unknown;
266
- }
267
- interface ChatPinConfig {
268
- title?: string;
269
- placeholder?: string;
270
- /** Pin this discussion thread is about (commentary / feedback). */
271
- linked_pin_id?: string;
272
- /** Cached title for display without fetching the linked pin. */
273
- linked_pin_title?: string;
274
- [key: string]: unknown;
275
- }
276
- interface IntroPinConfig {
277
- heading: string;
278
- subheading?: string;
279
- [key: string]: unknown;
280
- }
281
- interface MastraPinConfig {
282
- mode?: 'workflow' | 'agent' | string;
283
- agentId?: string;
284
- workflowId?: string;
285
- [key: string]: unknown;
286
- }
287
- interface BusinessCardField {
288
- id: string;
289
- key: string;
290
- value: string;
291
- }
292
- interface BusinessCardPinConfig {
293
- sectionTitle?: string;
294
- fields?: BusinessCardField[];
295
- imageConfig?: {
296
- url?: string;
297
- alt?: string;
298
- fileId?: string;
299
- [key: string]: unknown;
300
- };
301
- imagePosition?: 'left' | 'right' | string;
302
- [key: string]: unknown;
303
- }
304
- interface VideoPinConfig {
305
- url?: string;
306
- fileId?: string;
307
- fileName?: string;
308
- mimeType?: 'video/mp4' | string;
309
- caption?: string;
310
- size?: number;
311
- [key: string]: unknown;
312
- }
313
- interface AudioPinTrack {
314
- url: string;
315
- fileId?: string;
316
- fileName?: string;
317
- mimeType?: 'audio/mpeg' | 'audio/wav' | 'audio/x-wav' | string;
318
- size?: number;
319
- [key: string]: unknown;
320
- }
321
- interface AudioPinConfig {
322
- url?: string;
323
- fileId?: string;
324
- fileName?: string;
325
- mimeType?: 'audio/mpeg' | 'audio/wav' | 'audio/x-wav' | string;
326
- caption?: string;
327
- size?: number;
328
- tracks?: AudioPinTrack[];
329
- [key: string]: unknown;
330
- }
331
- interface TextMediaPinConfig {
332
- title?: string;
333
- text?: string;
334
- subtext?: string;
335
- textPosition?: 'left' | 'right' | string;
336
- mediaType?: 'embed' | 'image' | string;
337
- embedConfig?: {
338
- type?: string;
339
- url?: string;
340
- aspectRatio?: string;
341
- autoplay?: boolean;
342
- [key: string]: unknown;
343
- };
344
- imageConfig?: {
345
- url?: string;
346
- alt?: string;
347
- fileId?: string;
348
- [key: string]: unknown;
349
- };
350
- [key: string]: unknown;
351
- }
352
- interface FileUploadPinConfig {
353
- files?: Array<Record<string, unknown>>;
354
- displayMode?: string;
355
- [key: string]: unknown;
356
- }
357
- interface KanbanBoardPinConfig {
358
- columns: KanbanColumn[];
359
- [key: string]: unknown;
360
- }
361
- interface ChecklistPinConfig {
362
- title?: string;
363
- items: ChecklistItem[];
364
- [key: string]: unknown;
365
- }
366
- interface ComparisonSideConfig {
367
- label: string;
368
- body: string;
369
- }
370
- interface ComparisonMatchPair {
371
- left: number;
372
- right: number;
373
- }
374
- interface ComparisonPinConfig {
375
- title?: string;
376
- left: ComparisonSideConfig;
377
- right: ComparisonSideConfig;
378
- highlightedLines?: {
379
- left?: number[];
380
- right?: number[];
381
- };
382
- matches?: ComparisonMatchPair[];
383
- showVsBadge?: boolean;
384
- [key: string]: unknown;
385
- }
386
- interface CalendarPinConfig {
387
- weekStartsOn?: number;
388
- events?: Array<Record<string, unknown>>;
389
- [key: string]: unknown;
390
- }
391
- interface RoadmapPinConfig {
392
- title?: string;
393
- months?: Array<Record<string, unknown>>;
394
- [key: string]: unknown;
395
- }
396
- interface RealtimeCanvasPinConfig {
397
- title?: string;
398
- description?: string;
399
- roomId?: string;
400
- [key: string]: unknown;
401
- }
402
- interface PinConfigByType {
403
- markdown: MarkdownPinConfig;
404
- image: ImagePinConfig;
405
- gallery: GalleryPinConfig;
406
- table: TablePinConfig;
407
- charts: ChartsPinConfig;
408
- mermaid: MermaidPinConfig;
409
- code: CodePinConfig;
410
- embed: EmbedPinConfig;
411
- 'pdf-viewer': PdfViewerPinConfig;
412
- 'excel-viewer': ExcelViewerPinConfig;
413
- 'stat-cards': StatCardsPinConfig;
414
- timeline: TimelinePinConfig;
415
- 'json-viewer': JsonViewerPinConfig;
416
- 'json-list': JsonListPinConfig;
417
- links: LinksPinConfig;
418
- 'qr-code': QrCodePinConfig;
419
- 'social-handles': SocialHandlesPinConfig;
420
- steps: StepsPinConfig;
421
- trace: TracePinConfig;
422
- plan: PlanPinConfig;
423
- notes: NotesPinConfig;
424
- 'csv-viewer': CsvViewerPinConfig;
425
- 'user-story': UserStoryPinConfig;
426
- chat: ChatPinConfig;
427
- intro: IntroPinConfig;
428
- mastra: MastraPinConfig;
429
- 'text-media': TextMediaPinConfig;
430
- 'business-card': BusinessCardPinConfig;
431
- video: VideoPinConfig;
432
- audio: AudioPinConfig;
433
- 'file-upload': FileUploadPinConfig;
434
- 'kanban-board': KanbanBoardPinConfig;
435
- checklist: ChecklistPinConfig;
436
- comparison: ComparisonPinConfig;
437
- calendar: CalendarPinConfig;
438
- roadmap: RoadmapPinConfig;
439
- 'realtime-canvas': RealtimeCanvasPinConfig;
440
- }
441
- interface PinMetadataBase {
442
- title: string;
443
- tags?: string[];
444
- description?: string;
445
- allow_edit?: boolean;
446
- require_sign_in?: boolean;
447
- allow_comments?: boolean;
448
- }
449
- type PinMetadata<T extends PinTypeId = PinTypeId> = PinMetadataBase & {
450
- pin_type?: T;
451
- pin_config?: PinConfigByType[T];
452
- pin_layout?: PinLayout;
10
+ /** `updateMarkdown`, `updateTable`, … — one per {@link PinTypeId}. */
11
+ type PinUpdateMethods = {
12
+ [T in PinTypeId as `update${PascalFromKebab<T>}`]: (pinId: string, input: UpdatePinHelperInput<T>) => Promise<Pin<T>>;
453
13
  };
454
- interface CreateTypedPinRequest<T extends PinTypeId> {
455
- pin_type: T;
456
- pin_config: PinConfigByType[T];
457
- pin_layout?: PinLayout;
458
- is_public?: boolean;
459
- allow_edit?: boolean;
460
- require_sign_in?: boolean;
461
- allow_comments?: boolean;
462
- metadata: PinMetadataBase;
463
- pending_invites?: Record<string, 'editor' | 'viewer'>;
464
- /** @deprecated Inferred from pin_type */
465
- data_type?: PinDataType;
466
- }
467
- interface CreateNestedPinRequest<T extends PinTypeId> {
468
- pin_layout?: PinLayout;
469
- is_public?: boolean;
470
- allow_edit?: boolean;
471
- require_sign_in?: boolean;
472
- allow_comments?: boolean;
473
- metadata: PinMetadata<T> & PinMetadataBase;
474
- pending_invites?: Record<string, 'editor' | 'viewer'>;
475
- data_type?: PinDataType;
476
- }
477
- type CreatePinRequest<T extends PinTypeId = PinTypeId> = CreateTypedPinRequest<T> | CreateNestedPinRequest<T>;
478
- interface UpdatePinRequest<T extends PinTypeId = PinTypeId> {
479
- pin_type?: T;
480
- pin_config?: PinConfigByType[T];
481
- pin_layout?: PinLayout;
482
- is_public?: boolean;
483
- metadata?: Partial<PinMetadata<T>>;
484
- }
485
- interface Pin<T extends PinTypeId = PinTypeId> {
486
- id: string;
487
- owner_id: string;
488
- user_id?: string;
489
- title?: string;
490
- description?: string;
491
- data_type: PinDataType;
492
- is_public: boolean;
493
- allow_edit: boolean;
494
- require_sign_in: boolean;
495
- allow_comments: boolean;
496
- metadata?: PinMetadata<T>;
497
- created_at: string | number;
498
- updated_at: string | number;
499
- }
500
- interface SharePinRequest {
501
- is_public?: boolean;
502
- allow_edit?: boolean;
503
- require_sign_in?: boolean;
504
- allow_comments?: boolean;
505
- }
506
- interface ListPinsOptions {
507
- limit?: number;
508
- offset?: number;
509
- }
510
- interface CreateMarkdownPinInput extends PinMetadataBase {
511
- content: string;
512
- pin_layout?: PinLayout;
513
- is_public?: boolean;
514
- allow_edit?: boolean;
515
- require_sign_in?: boolean;
516
- allow_comments?: boolean;
517
- pending_invites?: Record<string, 'editor' | 'viewer'>;
518
- }
519
- interface CreateStatCardsPinInput extends PinMetadataBase {
520
- cards: StatCardItem[];
521
- pin_layout?: PinLayout;
522
- is_public?: boolean;
523
- }
524
- interface CreateTablePinInput extends PinMetadataBase {
525
- columns: TableColumn[];
526
- rows?: TableRow[];
527
- pin_layout?: PinLayout;
528
- is_public?: boolean;
529
- }
530
- interface UpdateTablePinInput {
531
- columns?: TableColumn[];
532
- rows?: TableRow[];
533
- title?: string;
534
- tags?: string[];
535
- description?: string;
536
- }
537
- interface CreateEmbedPinInput extends PinMetadataBase {
538
- url: string;
539
- type?: string;
540
- pin_layout?: PinLayout;
541
- is_public?: boolean;
542
- }
543
-
544
- /**
545
- * API types shared by the v1 Pins client
546
- */
547
- interface ApiResponse<T = unknown> {
548
- success: boolean;
549
- data: T;
550
- error?: {
551
- code: string;
552
- message: string;
553
- details?: unknown;
554
- };
555
- }
556
- interface PaginatedResponse<T> {
557
- items: T[];
558
- total: number;
559
- limit: number;
560
- offset: number;
561
- }
562
-
563
- /**
564
- * Pins API Methods
565
- */
566
-
567
- declare class PinsMethods {
568
- private client;
569
- constructor(client: PindownClient);
570
- /** Create a pin (typed via CreatePinRequest&lt;T&gt;) */
571
- create<T extends PinTypeId>(request: CreatePinRequest<T>): Promise<Pin<T>>;
572
- get<T extends PinTypeId = PinTypeId>(pinId: string): Promise<Pin<T>>;
573
- list(options?: ListPinsOptions): Promise<PaginatedResponse<Pin>>;
574
- update<T extends PinTypeId = PinTypeId>(pinId: string, request: UpdatePinRequest<T>): Promise<Pin<T>>;
575
- delete(pinId: string): Promise<void>;
576
- share(pinId: string, request: SharePinRequest): Promise<Pin>;
577
- batchGet(pinIds: string[]): Promise<{
578
- found: Pin[];
579
- not_found: string[];
580
- permission_denied: string[];
581
- }>;
582
- batchCreate(pins: CreatePinRequest[]): Promise<{
583
- created: Array<{
584
- id: string;
585
- index: number;
586
- created_at: number;
587
- }>;
588
- failed: Array<{
589
- index: number;
590
- error: string;
591
- }>;
592
- }>;
593
- batchUpdate(updates: Array<{
594
- id: string;
595
- } & UpdatePinRequest>): Promise<{
596
- updated: string[];
597
- failed: Array<{
598
- id: string;
599
- error: string;
600
- }>;
601
- updated_at: number;
602
- }>;
603
- batchDelete(pinIds: string[]): Promise<{
604
- deleted: string[];
605
- failed: Array<{
606
- id: string;
607
- error: string;
608
- }>;
609
- }>;
610
- /** Create a markdown pin with pin_config.content (seeds Yjs on the server). */
611
- createMarkdown(input: CreateMarkdownPinInput): Promise<Pin<'markdown'>>;
612
- createStatCards(input: CreateStatCardsPinInput): Promise<Pin<'stat-cards'>>;
613
- createTable(input: CreateTablePinInput): Promise<Pin<'table'>>;
614
- /** Partial table pin_config update with typed columns/rows. */
615
- updateTable(pinId: string, input: UpdateTablePinInput): Promise<Pin<'table'>>;
616
- createEmbed(input: CreateEmbedPinInput): Promise<Pin<'embed'>>;
617
- /**
618
- * @deprecated Use createMarkdown({ title, content, ... }) — old signature ignored content in title
619
- */
620
- createMarkdownLegacy(title: string, additionalMetadata?: Record<string, unknown>): Promise<Pin<'markdown'>>;
621
- }
622
-
623
- /**
624
- * Configuration for the v1 Pins API client
625
- */
626
- interface PindownConfig {
627
- /** Workspace-plan API key from https://pindown.ai/api-keys */
628
- apiKey: string;
629
- /** @default 'https://api.pindown.ai/v1' */
630
- baseURL?: string;
631
- /** @default 3 */
632
- maxRetries?: number;
633
- /** @default 30000 */
634
- timeout?: number;
635
- }
636
-
637
- /**
638
- * Pindown API Client — v1 Pins API only
639
- */
640
-
641
- declare class PindownClient {
642
- private config;
643
- readonly pins: PinsMethods;
644
- constructor(config: PindownConfig);
645
- request<T = unknown>(method: string, endpoint: string, data?: unknown): Promise<T>;
646
- private handleErrorResponse;
647
- }
14
+ type PinTypedHelperMethods = PinCreateMethods & PinUpdateMethods;
648
15
 
649
16
  /**
650
17
  * Runtime hints + minimal examples per pin type.
@@ -674,6 +41,26 @@ declare function getPinConfigHint<T extends PinTypeId>(pinType: T): PinConfigHin
674
41
  /** Pretty-print field hints for CLI / logging. */
675
42
  declare function formatPinConfigHint(pinType: PinTypeId): string;
676
43
 
44
+ interface PinConfigValidationIssue {
45
+ pinType: PinTypeId;
46
+ message: string;
47
+ details?: unknown;
48
+ }
49
+ type PinConfigValidationResult = {
50
+ valid: true;
51
+ data: unknown;
52
+ } | ({
53
+ valid: false;
54
+ } & PinConfigValidationIssue);
55
+ /** Validate (and canonicalize) pin_config for any product pin type. */
56
+ declare function validatePinConfig<T extends PinTypeId>(pinType: T, pinConfig: unknown): PinConfigValidationResult;
57
+ /** Throws {@link ValidationError} when pin_config is invalid. Returns canonical validated config. */
58
+ declare function assertValidPinConfig<T extends PinTypeId>(pinType: T, pinConfig: unknown): PinConfigByType[T];
59
+ /** Validate + canonicalize a create payload before POST /pins. */
60
+ declare function prepareCreatePinRequest<T extends PinTypeId>(request: CreatePinRequest<T>): CreatePinRequest<T>;
61
+ /** Validate + canonicalize an update payload before PUT /pins/:id. */
62
+ declare function prepareUpdatePinRequest<T extends PinTypeId>(request: UpdatePinRequest<T>, pinTypeHint?: T): UpdatePinRequest<T>;
63
+
677
64
  /**
678
65
  * Error classes for the v1 Pins API client
679
66
  */
@@ -704,4 +91,4 @@ declare class NetworkError extends PindownError {
704
91
  constructor(message?: string);
705
92
  }
706
93
 
707
- export { ALL_PIN_TYPES, type ApiResponse, type AudioPinConfig, type AudioPinTrack, AuthenticationError, type BusinessCardField, type BusinessCardPinConfig, type CalendarPinConfig, type ChartsPinConfig, type ChatPinConfig, type ChecklistItem, type ChecklistPinConfig, type CreateEmbedPinInput, type CreateMarkdownPinInput, type CreateNestedPinRequest, type CreatePinRequest, type CreateStatCardsPinInput, type CreateTablePinInput, type CreateTypedPinRequest, type CsvViewerPinConfig, type EmbedPinConfig, type ExcelViewerPinConfig, type FileUploadPinConfig, ForbiddenError, type GalleryImage, type GalleryPinConfig, type ImagePinConfig, type IntroPinConfig, type JsonListPinConfig, type JsonViewerPinConfig, type KanbanBoardPinConfig, type KanbanColumn, type LinkItem, type LinksPinConfig, type ListPinsOptions, type MarkdownPinConfig, type MastraPinConfig, type MermaidPinConfig, NetworkError, NotFoundError, PIN_CONFIG_HINTS, PRODUCT_PIN_TYPES, type PaginatedResponse, type PdfViewerPinConfig, type Pin, type PinCardType, type PinConfigByType, type PinConfigFieldHint, type PinConfigHint, type PinDataType, type PinLayout, type PinMetadata, type PinMetadataBase, type PinTypeId, PindownClient, type PindownConfig, PindownError, type ProductPinTypeId, type QrCodePinConfig, RateLimitError, type RealtimeCanvasPinConfig, type RoadmapPinConfig, ServerError, type SharePinRequest, type StatCardItem, type StatCardsPinConfig, type StepItem, type StepsPinConfig, type TableColumn, type TablePinConfig, type TableRow, type TextMediaPinConfig, type TimelinePinConfig, type UpdatePinRequest, type UpdateTablePinInput, type UserStoryPinConfig, ValidationError, type VideoPinConfig, formatPinConfigHint, getPinConfigHint };
94
+ export { AuthenticationError, CreatePinHelperInput, CreatePinRequest, ForbiddenError, NetworkError, NotFoundError, PIN_CONFIG_HINTS, Pin, PinConfigByType, type PinConfigFieldHint, type PinConfigHint, type PinConfigValidationIssue, type PinConfigValidationResult, type PinCreateMethods, PinTypeId, type PinTypedHelperMethods, type PinUpdateMethods, PindownError, RateLimitError, ServerError, UpdatePinHelperInput, UpdatePinRequest, ValidationError, assertValidPinConfig, formatPinConfigHint, getPinConfigHint, prepareCreatePinRequest, prepareUpdatePinRequest, validatePinConfig };