@neopress/cli 4.5.0 → 4.7.0

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.
Files changed (4) hide show
  1. package/dist/bin.cjs +31400 -41838
  2. package/dist/index.d.ts +841 -23
  3. package/dist/index.js +27336 -37204
  4. package/package.json +12 -7
package/dist/index.d.ts CHANGED
@@ -1,47 +1,865 @@
1
- import { NeopressClient } from './client.js';
2
-
1
+ //#region ../sdk/dist/types.d.ts
3
2
  /**
4
- * Get a configured NeopressClient from CLI config/env.
3
+ * @neopress/sdk — First-party API types
5
4
  *
6
- * Auth resolution priority:
7
- * 1. NEOPRESS_ACCESS_TOKEN env var
8
- * 2. Stored OAuth access token (with auto-refresh in getClientAsync)
5
+ * These types mirror the API response format (camelCase).
6
+ * They are separate from the DB types used internally.
9
7
  */
10
-
8
+ interface PaginationMeta {
9
+ page: number;
10
+ limit: number;
11
+ totalCount: number;
12
+ hasMore: boolean;
13
+ }
14
+ interface ApiResponse<T> {
15
+ data: T;
16
+ }
17
+ interface PaginatedResponse<T> {
18
+ data: T[];
19
+ pagination: PaginationMeta;
20
+ }
21
+ /** Sort direction for list endpoints that support opt-in created_at ordering. */
22
+ type SortOrder = 'asc' | 'desc';
23
+ interface Site {
24
+ id: number;
25
+ name: string | null;
26
+ handle: string;
27
+ status: string | null;
28
+ customDomain: string | null;
29
+ customDomainVerified: boolean | null;
30
+ plan: string | null;
31
+ metadata: unknown;
32
+ localeConfig: {
33
+ defaultLocale: string;
34
+ locales: string[];
35
+ localePrefix?: 'as-needed';
36
+ } | null;
37
+ createdAt: string | null;
38
+ updatedAt: string | null;
39
+ }
40
+ interface Template {
41
+ id: number;
42
+ name: string;
43
+ description: string | null;
44
+ referenceUrl: string;
45
+ previewImgUrls: string[] | null;
46
+ previewVideoUrl: string | null;
47
+ createdAt: string | null;
48
+ }
49
+ interface TemplateListItem {
50
+ siteId: number;
51
+ handle: string | null;
52
+ siteName: string | null;
53
+ name: string;
54
+ referenceUrl: string;
55
+ previewImgUrls: string[] | null;
56
+ description: string | null;
57
+ createdAt: string;
58
+ }
59
+ interface Page {
60
+ id: number;
61
+ siteId: number;
62
+ path: string;
63
+ title: string | null;
64
+ type: string | null;
65
+ status: string;
66
+ visibility: string;
67
+ collectionId: number | null;
68
+ metadata: unknown;
69
+ draftTsx: string | null;
70
+ draftJs: string | null;
71
+ draftI18n: unknown;
72
+ draftPublicLocales: string[] | null;
73
+ draftMeta: unknown;
74
+ prodPath: string | null;
75
+ prodTsx: string | null;
76
+ prodJs: string | null;
77
+ prodI18n: unknown;
78
+ prodPublicLocales: string[] | null;
79
+ prodMeta: unknown;
80
+ publishedAt: string | null;
81
+ createdAt: string | null;
82
+ updatedAt: string | null;
83
+ }
84
+ interface Collection {
85
+ id: number;
86
+ siteId: number;
87
+ name: string;
88
+ presetType: string | null;
89
+ draftSchema: unknown;
90
+ prodSchema: unknown;
91
+ createdAt: string | null;
92
+ updatedAt: string | null;
93
+ }
94
+ interface Entry {
95
+ id: number;
96
+ siteId: number;
97
+ collectionId: number;
98
+ locale: string | null;
99
+ translationGroupId: string | null;
100
+ slug: string;
101
+ title: string | null;
102
+ data: unknown;
103
+ metadata: unknown;
104
+ status: string;
105
+ publishedAt: string | null;
106
+ publishedVersionId: number | null;
107
+ createdAt: string | null;
108
+ updatedAt: string | null;
109
+ }
110
+ interface EntryVersion {
111
+ id: number;
112
+ entryId: number | null;
113
+ locale: string | null;
114
+ translationGroupId: string | null;
115
+ slug: string | null;
116
+ title: string | null;
117
+ data: unknown;
118
+ status: string | null;
119
+ pinned: boolean;
120
+ source: string;
121
+ comment: string | null;
122
+ createdAt: string;
123
+ updatedAt: string | null;
124
+ }
125
+ interface Form {
126
+ id: number;
127
+ siteId: number;
128
+ name: string;
129
+ draftSchema: unknown;
130
+ draftLayout?: unknown;
131
+ draftStyle?: unknown;
132
+ draftI18n?: unknown;
133
+ prodSchema: unknown;
134
+ prodLayout?: unknown;
135
+ prodStyle?: unknown;
136
+ prodI18n?: unknown;
137
+ settings: unknown;
138
+ createdAt: string | null;
139
+ updatedAt: string | null;
140
+ }
141
+ interface FormResponse {
142
+ id: number;
143
+ formId: number;
144
+ data: unknown;
145
+ metadata: unknown;
146
+ readAt: string | null;
147
+ deletedAt: string | null;
148
+ createdAt: string | null;
149
+ }
150
+ interface Asset {
151
+ id: number;
152
+ siteId: number | null;
153
+ displayName: string | null;
154
+ assetUrl: string | null;
155
+ mimeType: string | null;
156
+ size: number | null;
157
+ altText: string | null;
158
+ description: string | null;
159
+ tags: string[] | null;
160
+ folderPath: string | null;
161
+ metadata: unknown;
162
+ createdAt: string;
163
+ }
164
+ interface RedirectRule {
165
+ id: number;
166
+ siteId: number;
167
+ source: string;
168
+ destination: string;
169
+ mode: 'redirect' | 'proxy';
170
+ redirectType: number;
171
+ includeChildren: boolean;
172
+ preservePath: boolean;
173
+ enabled: boolean;
174
+ priority: number;
175
+ createdAt: string;
176
+ updatedAt: string;
177
+ }
178
+ interface EntryReference {
179
+ id: number;
180
+ siteId: number;
181
+ fromEntryId: number;
182
+ toEntryId: number;
183
+ fieldKey: string;
184
+ createdAt: string;
185
+ }
186
+ interface SiteLayout {
187
+ siteId: number;
188
+ draftTsx: string | null;
189
+ draftGlobalCss: string | null;
190
+ draftNotFoundTsx: string | null;
191
+ prodTsx: string | null;
192
+ prodJs: string | null;
193
+ prodGlobalCss: string | null;
194
+ prodNotFoundTsx: string | null;
195
+ prodNotFoundJs: string | null;
196
+ }
197
+ interface Headshot {
198
+ id: number;
199
+ imageUrl: string;
200
+ width: number;
201
+ height: number;
202
+ aspectRatio: string;
203
+ mimeType: string;
204
+ byteSize: number | null;
205
+ ageBand: string;
206
+ gender: string;
207
+ ethnicity: string;
208
+ attire: string;
209
+ variationIndex: number;
210
+ gptPrompt: string | null;
211
+ tags: string[];
212
+ isActive: boolean;
213
+ createdAt: string | null;
214
+ updatedAt: string | null;
215
+ }
216
+ interface Logo {
217
+ id: number;
218
+ imageUrl: string;
219
+ width: number;
220
+ height: number;
221
+ aspectRatio: string;
222
+ mimeType: string;
223
+ byteSize: number | null;
224
+ type: string;
225
+ font: string;
226
+ color: string;
227
+ hue: number;
228
+ tone: string;
229
+ toneScore: number | null;
230
+ name: string;
231
+ variant: string | null;
232
+ sha256: string | null;
233
+ tags: string[];
234
+ isActive: boolean;
235
+ createdAt: string | null;
236
+ updatedAt: string | null;
237
+ }
238
+ type AnalyticsQueryValue = string | number | boolean;
239
+ interface AnalyticsQueryParams {
240
+ pipe: string;
241
+ dateFrom?: string;
242
+ dateTo?: string;
243
+ timezone?: string;
244
+ limit?: number;
245
+ params?: Record<string, AnalyticsQueryValue>;
246
+ }
247
+ type AnalyticsQueryResult = Record<string, unknown>;
248
+ interface AnalyticsDateRangeParams {
249
+ dateFrom?: string;
250
+ dateTo?: string;
251
+ timezone?: string;
252
+ limit?: number;
253
+ params?: Record<string, AnalyticsQueryValue>;
254
+ }
255
+ type SearchConsoleDimension = 'query' | 'page' | 'country' | 'device';
256
+ interface SearchConsoleQueryParams {
257
+ dateFrom: string;
258
+ dateTo: string;
259
+ dimensions?: SearchConsoleDimension[];
260
+ queryFilter?: string;
261
+ pageFilter?: string;
262
+ rowLimit?: number;
263
+ }
264
+ interface SearchConsoleRow {
265
+ keys: string[];
266
+ clicks: number;
267
+ impressions: number;
268
+ ctr: number;
269
+ position: number;
270
+ }
271
+ interface SearchConsoleQueryResult {
272
+ connected: boolean;
273
+ rows: SearchConsoleRow[];
274
+ totals: {
275
+ clicks: number;
276
+ impressions: number;
277
+ ctr: number;
278
+ position: number;
279
+ };
280
+ error?: string;
281
+ }
282
+ //#endregion
283
+ //#region ../sdk/dist/endpoints/pages.d.ts
284
+ interface PageListParams {
285
+ page?: number;
286
+ limit?: number;
287
+ status?: 'draft' | 'published';
288
+ fields?: string[];
289
+ /** When set, sort by created_at instead of path. */
290
+ order?: SortOrder;
291
+ }
292
+ interface PageCreateParams {
293
+ path: string;
294
+ title?: string;
295
+ type?: 'static' | 'dynamic';
296
+ status?: 'draft' | 'published';
297
+ visibility?: 'public' | 'hidden';
298
+ draftTsx?: string;
299
+ draftI18n?: unknown;
300
+ draftPublicLocales?: string[] | null;
301
+ draftMeta?: unknown;
302
+ collectionId?: number;
303
+ metadata?: unknown;
304
+ }
305
+ interface PageUpdateParams {
306
+ path?: string;
307
+ title?: string;
308
+ type?: string;
309
+ status?: string;
310
+ visibility?: 'public' | 'hidden';
311
+ draftTsx?: string;
312
+ draftI18n?: unknown;
313
+ draftPublicLocales?: string[] | null;
314
+ draftMeta?: unknown;
315
+ metadata?: unknown;
316
+ collectionId?: number;
317
+ }
318
+ declare class PagesEndpoint {
319
+ private readonly client;
320
+ constructor(client: NeopressClient);
321
+ private get basePath();
322
+ list(params?: PageListParams): Promise<PaginatedResponse<Page>>;
323
+ get(pageId: number): Promise<Page>;
324
+ create(data: PageCreateParams): Promise<Page>;
325
+ update(pageId: number, data: PageUpdateParams): Promise<Page>;
326
+ delete(pageId: number): Promise<void>;
327
+ compile(pageId: number): Promise<{
328
+ compiled: boolean;
329
+ jsLength: number;
330
+ }>;
331
+ }
332
+ //#endregion
333
+ //#region ../sdk/dist/endpoints/collections.d.ts
334
+ interface CollectionCreateParams {
335
+ name: string;
336
+ presetType?: string;
337
+ draftSchema?: unknown;
338
+ }
339
+ declare class CollectionsEndpoint {
340
+ private readonly client;
341
+ constructor(client: NeopressClient);
342
+ private get basePath();
343
+ list(params?: {
344
+ order?: SortOrder;
345
+ }): Promise<Collection[]>;
346
+ get(collectionId: number): Promise<Collection>;
347
+ create(data: CollectionCreateParams): Promise<Collection>;
348
+ update(collectionId: number, data: Partial<CollectionCreateParams>): Promise<Collection>;
349
+ delete(collectionId: number): Promise<void>;
350
+ getSchema(collectionId: number): Promise<{
351
+ collectionId: number;
352
+ draftSchema: unknown;
353
+ prodSchema: unknown;
354
+ }>;
355
+ /**
356
+ * Updates the collection's draft_schema directly in Supabase.
357
+ * validateApiCollectionSchema (app-local) is skipped — CLI/MCP callers are trusted.
358
+ */
359
+ updateSchema(collectionId: number, schema: unknown): Promise<{
360
+ collectionId: number;
361
+ draftSchema: unknown;
362
+ prodSchema: unknown;
363
+ }>;
364
+ }
365
+ //#endregion
366
+ //#region ../sdk/dist/endpoints/entries.d.ts
367
+ interface EntryListParams {
368
+ page?: number;
369
+ limit?: number;
370
+ status?: 'draft' | 'published' | 'archived';
371
+ locale?: string;
372
+ /** created_at sort direction. Defaults to 'desc' (newest first). */
373
+ order?: SortOrder;
374
+ }
375
+ interface EntryCreateParams {
376
+ slug?: string;
377
+ title?: string;
378
+ locale?: string;
379
+ data: unknown;
380
+ metadata?: unknown;
381
+ status?: string;
382
+ }
383
+ interface EntryUpdateParams {
384
+ slug?: string;
385
+ title?: string;
386
+ locale?: string;
387
+ data?: unknown;
388
+ metadata?: unknown;
389
+ status?: string;
390
+ }
391
+ declare class EntriesEndpoint {
392
+ private readonly client;
393
+ constructor(client: NeopressClient);
394
+ list(collectionId: number, params?: EntryListParams): Promise<PaginatedResponse<Entry>>;
395
+ get(entryId: number): Promise<Entry>;
396
+ create(collectionId: number, data: EntryCreateParams): Promise<Entry>;
397
+ update(entryId: number, data: EntryUpdateParams): Promise<Entry>;
398
+ delete(entryId: number): Promise<void>;
399
+ revalidateReaderCache(entryId: number): Promise<void>;
400
+ publish(entryId: number): Promise<{
401
+ id: number;
402
+ status: string;
403
+ publishedAt: string | null;
404
+ }>;
405
+ unpublish(entryId: number): Promise<{
406
+ id: number;
407
+ status: string;
408
+ }>;
409
+ listVersions(entryId: number): Promise<EntryVersion[]>;
410
+ pinVersion(entryId: number, versionId: number): Promise<{
411
+ id: number;
412
+ pinned: boolean;
413
+ }>;
414
+ }
415
+ //#endregion
416
+ //#region ../sdk/dist/endpoints/forms.d.ts
417
+ interface FormCreateParams {
418
+ name: string;
419
+ draftSchema?: unknown;
420
+ draftLayout?: unknown;
421
+ draftStyle?: unknown;
422
+ draftI18n?: unknown;
423
+ settings?: unknown;
424
+ }
425
+ interface FormUpdateParams {
426
+ name?: string;
427
+ draftSchema?: unknown;
428
+ draftLayout?: unknown;
429
+ draftStyle?: unknown;
430
+ draftI18n?: unknown;
431
+ settings?: unknown;
432
+ }
433
+ declare class FormsEndpoint {
434
+ private readonly client;
435
+ constructor(client: NeopressClient);
436
+ private get basePath();
437
+ list(params?: {
438
+ order?: SortOrder;
439
+ }): Promise<Form[]>;
440
+ get(formId: number): Promise<Form>;
441
+ create(data: FormCreateParams): Promise<Form>;
442
+ update(formId: number, data: FormUpdateParams): Promise<Form>;
443
+ delete(formId: number): Promise<void>;
444
+ publish(formId: number): Promise<{
445
+ id: number;
446
+ draftSchema: unknown;
447
+ prodSchema: unknown;
448
+ }>;
449
+ listResponses(formId: number, params?: {
450
+ page?: number;
451
+ limit?: number;
452
+ }): Promise<PaginatedResponse<FormResponse>>;
453
+ deleteResponse(formId: number, responseId: number): Promise<void>;
454
+ }
455
+ //#endregion
456
+ //#region ../sdk/dist/endpoints/assets.d.ts
457
+ interface AssetRegisterParams {
458
+ assetUrl: string;
459
+ displayName?: string;
460
+ mimeType?: string;
461
+ size?: number;
462
+ altText?: string;
463
+ description?: string;
464
+ tags?: string[];
465
+ folderPath?: string;
466
+ metadata?: unknown;
467
+ }
468
+ interface AssetPresignParams {
469
+ fileKey: string;
470
+ contentType: string;
471
+ contentLength: number;
472
+ }
473
+ declare class AssetsEndpoint {
474
+ private readonly client;
475
+ constructor(client: NeopressClient);
476
+ private get basePath();
477
+ list(params?: {
478
+ page?: number;
479
+ limit?: number;
480
+ order?: SortOrder;
481
+ }): Promise<PaginatedResponse<Asset>>;
482
+ get(assetId: number): Promise<Asset>;
483
+ register(data: AssetRegisterParams): Promise<Asset>;
484
+ update(assetId: number, data: Partial<Omit<AssetRegisterParams, 'assetUrl'>>): Promise<Asset>;
485
+ delete(assetId: number): Promise<void>;
486
+ presign(data: AssetPresignParams): Promise<{
487
+ presignedUrl: string;
488
+ publicUrl: string;
489
+ fileKey: string;
490
+ }>;
491
+ }
492
+ //#endregion
493
+ //#region ../sdk/dist/endpoints/site.d.ts
494
+ interface SiteWithRole extends Site {
495
+ role: string;
496
+ }
497
+ interface SiteCreateParams {
498
+ siteName?: string;
499
+ siteHandle?: string;
500
+ prompt?: string;
501
+ language?: string;
502
+ placeholder?: boolean;
503
+ }
504
+ declare class SiteEndpoint {
505
+ private readonly client;
506
+ constructor(client: NeopressClient);
507
+ list(params?: {
508
+ order?: SortOrder;
509
+ }): Promise<SiteWithRole[]>;
510
+ get(): Promise<Site>;
511
+ create(data: SiteCreateParams): Promise<Site>;
512
+ update(data: Partial<Pick<Site, 'name' | 'metadata' | 'localeConfig'>> & {
513
+ globalCss?: string;
514
+ instructions?: unknown;
515
+ }): Promise<Site>;
516
+ getLayout(): Promise<SiteLayout>;
517
+ updateLayout(data: {
518
+ draftTsx?: string;
519
+ draftNotFoundTsx?: string;
520
+ draftGlobalCss?: string;
521
+ }): Promise<SiteLayout>;
522
+ delete(): Promise<{
523
+ siteId: number;
524
+ deleted: true;
525
+ }>;
526
+ }
527
+ //#endregion
528
+ //#region ../sdk/dist/endpoints/redirects.d.ts
529
+ interface RedirectCreateParams {
530
+ source: string;
531
+ destination: string;
532
+ redirectType?: 307 | 308;
533
+ includeChildren?: boolean;
534
+ preservePath?: boolean;
535
+ enabled?: boolean;
536
+ priority?: number;
537
+ }
538
+ declare class RedirectsEndpoint {
539
+ private readonly client;
540
+ constructor(client: NeopressClient);
541
+ list(params?: {
542
+ order?: SortOrder;
543
+ }): Promise<RedirectRule[]>;
544
+ create(data: RedirectCreateParams): Promise<RedirectRule>;
545
+ private assertRedirectRuleWritable;
546
+ update(ruleId: number, data: Partial<RedirectCreateParams>): Promise<RedirectRule>;
547
+ delete(ruleId: number): Promise<void>;
548
+ }
549
+ //#endregion
550
+ //#region ../sdk/dist/endpoints/publish.d.ts
551
+ declare class PublishEndpoint {
552
+ private readonly client;
553
+ constructor(client: NeopressClient);
554
+ preview(): Promise<unknown>;
555
+ site(): Promise<unknown>;
556
+ }
557
+ //#endregion
558
+ //#region ../sdk/dist/endpoints/entry-references.d.ts
559
+ interface EntryReferenceListParams {
560
+ fromEntryId?: number;
561
+ toEntryId?: number;
562
+ /** created_at sort direction. Defaults to 'desc' (newest first). */
563
+ order?: SortOrder;
564
+ }
565
+ interface EntryReferenceCreateParams {
566
+ fromEntryId: number;
567
+ toEntryId: number;
568
+ fieldKey: string;
569
+ }
570
+ declare class EntryReferencesEndpoint {
571
+ private readonly client;
572
+ constructor(client: NeopressClient);
573
+ list(params?: EntryReferenceListParams): Promise<EntryReference[]>;
574
+ create(data: EntryReferenceCreateParams): Promise<EntryReference>;
575
+ delete(referenceId: number): Promise<void>;
576
+ }
577
+ //#endregion
578
+ //#region ../sdk/dist/endpoints/analytics.d.ts
579
+ declare class AnalyticsEndpoint {
580
+ private readonly client;
581
+ constructor(client: NeopressClient);
582
+ private get basePath();
583
+ query(params: AnalyticsQueryParams): Promise<AnalyticsQueryResult>;
584
+ pageviews(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
585
+ summary(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
586
+ topPages(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
587
+ trafficSources(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
588
+ formAnalytics(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
589
+ crawlerSummary(params?: AnalyticsDateRangeParams): Promise<AnalyticsQueryResult>;
590
+ searchConsole(params: SearchConsoleQueryParams): Promise<SearchConsoleQueryResult>;
591
+ }
592
+ //#endregion
593
+ //#region ../sdk/dist/endpoints/templates.d.ts
594
+ interface TemplateMarkParams {
595
+ name: string;
596
+ description?: string | null;
597
+ referenceUrl: string;
598
+ previewImgUrls?: string[] | null;
599
+ }
600
+ interface TemplateDeleteResult {
601
+ siteId: number;
602
+ deleted: true;
603
+ }
604
+ declare class TemplatesEndpoint {
605
+ private readonly client;
606
+ constructor(client: NeopressClient);
607
+ private get basePath();
608
+ get(): Promise<Template>;
609
+ mark(data: TemplateMarkParams): Promise<Template>;
610
+ delete(): Promise<TemplateDeleteResult>;
611
+ /**
612
+ * List templates across the sites the caller can access.
613
+ *
614
+ * Direct-DB: `templates` is public-read and `sites` RLS scopes the visible set
615
+ * (own active memberships, or all sites for the super admin), so no server
616
+ * route is needed — the two RLS-scoped queries reproduce the old handler.
617
+ */
618
+ list(params?: {
619
+ namePrefix?: string;
620
+ limit?: number;
621
+ order?: SortOrder;
622
+ }): Promise<TemplateListItem[]>;
623
+ }
624
+ //#endregion
625
+ //#region ../sdk/dist/endpoints/headshots.d.ts
626
+ type HeadshotAgeBand = 'young' | 'middle';
627
+ type HeadshotGender = 'male' | 'female';
628
+ type HeadshotEthnicity = 'asian' | 'white' | 'black' | 'latino';
629
+ type HeadshotAttire = 'formal' | 'casual';
630
+ interface HeadshotListParams {
631
+ page?: number;
632
+ limit?: number;
633
+ ageBand?: HeadshotAgeBand;
634
+ gender?: HeadshotGender;
635
+ ethnicity?: HeadshotEthnicity;
636
+ attire?: HeadshotAttire;
637
+ isActive?: boolean;
638
+ /** When set, sort by created_at instead of the demographic key order. */
639
+ order?: SortOrder;
640
+ }
641
+ interface HeadshotCreateParams {
642
+ imageUrl: string;
643
+ ageBand: HeadshotAgeBand;
644
+ gender: HeadshotGender;
645
+ ethnicity: HeadshotEthnicity;
646
+ variationIndex: number;
647
+ attire?: HeadshotAttire;
648
+ width?: number;
649
+ height?: number;
650
+ aspectRatio?: string;
651
+ mimeType?: string;
652
+ byteSize?: number | null;
653
+ gptPrompt?: string | null;
654
+ tags?: string[];
655
+ isActive?: boolean;
656
+ }
657
+ interface HeadshotUpdateParams {
658
+ imageUrl?: string;
659
+ ageBand?: HeadshotAgeBand;
660
+ gender?: HeadshotGender;
661
+ ethnicity?: HeadshotEthnicity;
662
+ attire?: HeadshotAttire;
663
+ variationIndex?: number;
664
+ width?: number;
665
+ height?: number;
666
+ aspectRatio?: string;
667
+ mimeType?: string;
668
+ byteSize?: number | null;
669
+ gptPrompt?: string | null;
670
+ tags?: string[];
671
+ isActive?: boolean;
672
+ }
673
+ interface HeadshotDeleteResult {
674
+ id: number;
675
+ deleted: true;
676
+ }
677
+ /**
678
+ * headshot_pool is a GLOBAL (not site-scoped) admin table. RLS exposes it only to
679
+ * the super-admin user, so these direct-DB calls return empty/forbidden for any
680
+ * other account. No site id is used.
681
+ */
682
+ declare class HeadshotsEndpoint {
683
+ private readonly client;
684
+ constructor(client: NeopressClient);
685
+ list(params?: HeadshotListParams): Promise<PaginatedResponse<Headshot>>;
686
+ get(id: number): Promise<Headshot>;
687
+ create(params: HeadshotCreateParams): Promise<Headshot>;
688
+ update(id: number, params: HeadshotUpdateParams): Promise<Headshot>;
689
+ delete(id: number): Promise<HeadshotDeleteResult>;
690
+ }
691
+ //#endregion
692
+ //#region ../sdk/dist/endpoints/logos.d.ts
693
+ type LogoType = 'wordmark' | 'lockup' | 'signature';
694
+ type LogoTone = 'playful' | 'neutral' | 'serious';
695
+ interface LogoListParams {
696
+ page?: number;
697
+ limit?: number;
698
+ type?: LogoType;
699
+ tone?: LogoTone;
700
+ font?: string;
701
+ hue?: number;
702
+ isActive?: boolean;
703
+ /** When set, sort by created_at instead of the diversity-axis key order. */
704
+ order?: SortOrder;
705
+ }
706
+ interface LogoCreateParams {
707
+ imageUrl: string;
708
+ type: LogoType;
709
+ font: string;
710
+ color: string;
711
+ hue: number;
712
+ tone: LogoTone;
713
+ name: string;
714
+ toneScore?: number | null;
715
+ variant?: string | null;
716
+ sha256?: string | null;
717
+ width?: number;
718
+ height?: number;
719
+ aspectRatio?: string;
720
+ mimeType?: string;
721
+ byteSize?: number | null;
722
+ tags?: string[];
723
+ isActive?: boolean;
724
+ }
725
+ interface LogoUpdateParams {
726
+ imageUrl?: string;
727
+ type?: LogoType;
728
+ font?: string;
729
+ color?: string;
730
+ hue?: number;
731
+ tone?: LogoTone;
732
+ name?: string;
733
+ toneScore?: number | null;
734
+ variant?: string | null;
735
+ sha256?: string | null;
736
+ width?: number;
737
+ height?: number;
738
+ aspectRatio?: string;
739
+ mimeType?: string;
740
+ byteSize?: number | null;
741
+ tags?: string[];
742
+ isActive?: boolean;
743
+ }
744
+ interface LogoDeleteResult {
745
+ id: number;
746
+ deleted: true;
747
+ }
748
+ /**
749
+ * logo_pool is a GLOBAL (not site-scoped) admin table. RLS exposes it only to the
750
+ * super-admin user, so these direct-DB calls return empty/forbidden for any other
751
+ * account. No site id is used.
752
+ */
753
+ declare class LogosEndpoint {
754
+ private readonly client;
755
+ constructor(client: NeopressClient);
756
+ list(params?: LogoListParams): Promise<PaginatedResponse<Logo>>;
757
+ get(id: number): Promise<Logo>;
758
+ create(params: LogoCreateParams): Promise<Logo>;
759
+ update(id: number, params: LogoUpdateParams): Promise<Logo>;
760
+ delete(id: number): Promise<LogoDeleteResult>;
761
+ }
762
+ //#endregion
763
+ //#region ../sdk/dist/client.d.ts
764
+ interface NeopressClientOptions {
765
+ /** OAuth access token */
766
+ accessToken?: string;
767
+ /** Site ID to operate on */
768
+ siteId: number | string;
769
+ /** Base URL (default: https://app.neopress.ai) — used by orchestration/analytics (HTTP) routes */
770
+ baseUrl?: string;
771
+ /** Request timeout in ms (default: 30000) */
772
+ timeout?: number;
773
+ /** Supabase project URL — enables direct-DB reads/CRUD (transparent routing). */
774
+ supabaseUrl?: string;
775
+ /** Supabase anon key (paired with the user accessToken so RLS applies). */
776
+ supabaseAnonKey?: string;
777
+ }
778
+ declare class NeopressClient {
779
+ private readonly baseUrl;
780
+ private readonly accessToken;
781
+ private readonly siteId;
782
+ private readonly timeout;
783
+ private readonly supabaseUrl?;
784
+ private readonly supabaseAnonKey?;
785
+ private _db;
786
+ readonly pages: PagesEndpoint;
787
+ readonly collections: CollectionsEndpoint;
788
+ readonly entries: EntriesEndpoint;
789
+ readonly forms: FormsEndpoint;
790
+ readonly assets: AssetsEndpoint;
791
+ readonly site: SiteEndpoint;
792
+ readonly redirects: RedirectsEndpoint;
793
+ readonly publish: PublishEndpoint;
794
+ readonly entryReferences: EntryReferencesEndpoint;
795
+ readonly analytics: AnalyticsEndpoint;
796
+ readonly templates: TemplatesEndpoint;
797
+ readonly headshots: HeadshotsEndpoint;
798
+ readonly logos: LogosEndpoint;
799
+ constructor(options: NeopressClientOptions);
800
+ get siteBasePath(): string;
801
+ /** Numeric site id for direct DB queries. */
802
+ get siteIdNumber(): number;
803
+ /**
804
+ * Authenticated user's profile id, decoded locally from the access token's
805
+ * JWT `sub` claim (no network round-trip). Returns null if there is no token
806
+ * or it cannot be parsed. Subsequent DB queries are RLS-protected, so a local
807
+ * decode is sufficient — no server-side validation is required here.
808
+ */
809
+ get authUserId(): string | null;
810
+ /** Mirror of v1 parsePagination(defaultLimit=20, maxLimit=100). */
811
+ resolvePagination(params?: {
812
+ page?: number;
813
+ limit?: number;
814
+ }): {
815
+ page: number;
816
+ limit: number;
817
+ offset: number;
818
+ };
819
+ /** Build the paginated envelope matching the v1 API. */
820
+ paginationMeta(page: number, limit: number, offset: number, totalCount: number): PaginationMeta;
821
+ request<T>(method: string, path: string, body?: unknown): Promise<T>;
822
+ get<T>(path: string): Promise<ApiResponse<T>>;
823
+ getList<T>(path: string): Promise<PaginatedResponse<T>>;
824
+ post<T>(path: string, body?: unknown): Promise<ApiResponse<T>>;
825
+ patch<T>(path: string, body: unknown): Promise<ApiResponse<T>>;
826
+ delete<T>(path: string): Promise<ApiResponse<T>>;
827
+ }
828
+ //#endregion
829
+ //#region src/utils/client.d.ts
11
830
  declare function getClient(siteIdOverride?: number | string): NeopressClient;
12
831
  /**
13
832
  * Get client with guaranteed fresh OAuth token.
14
833
  * Use this for commands that might run after the token expired.
15
834
  */
16
835
  declare function getClientAsync(siteIdOverride?: number | string): Promise<NeopressClient>;
17
-
836
+ //#endregion
837
+ //#region src/utils/config.d.ts
18
838
  declare function getAccessToken(): string | undefined;
19
839
  declare function getSiteId(): number | undefined;
20
840
  declare function getBaseUrl(): string;
21
841
  declare function setActiveSiteId(siteId: number): void;
22
-
842
+ //#endregion
843
+ //#region src/utils/token-store.d.ts
23
844
  interface StoredTokens {
24
- accessToken: string;
25
- refreshToken: string;
26
- expiresAt: number;
27
- userId: string;
845
+ accessToken: string;
846
+ refreshToken: string;
847
+ expiresAt: number;
848
+ userId: string;
28
849
  }
29
850
  interface StoredSession {
30
- tokens?: StoredTokens;
31
- activeSiteId?: number;
32
- baseUrl?: string;
851
+ tokens?: StoredTokens;
852
+ activeSiteId?: number;
853
+ baseUrl?: string;
33
854
  }
34
855
  declare function loadSession(): StoredSession;
35
856
  declare function saveSession(session: StoredSession): void;
36
857
  declare function clearSession(): void;
37
-
38
- /**
39
- * Token exchange and refresh for Supabase OAuth.
40
- */
41
-
858
+ //#endregion
859
+ //#region src/utils/token-refresh.d.ts
42
860
  /**
43
861
  * Get a valid access token, refreshing if needed.
44
862
  */
45
863
  declare function getValidAccessToken(): Promise<string | null>;
46
-
47
- export { clearSession, getAccessToken, getBaseUrl, getClient, getClientAsync, getSiteId, getValidAccessToken, loadSession, saveSession, setActiveSiteId };
864
+ //#endregion
865
+ export { clearSession, getAccessToken, getBaseUrl, getClient, getClientAsync, getSiteId, getValidAccessToken, loadSession, saveSession, setActiveSiteId };