@neopress/cli 4.6.0 → 4.8.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 +31396 -41857
  2. package/dist/index.d.ts +845 -23
  3. package/dist/index.js +27331 -37224
  4. package/package.json +8 -6
package/dist/index.d.ts CHANGED
@@ -1,47 +1,869 @@
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
+ /** Gallery hover video. Pair it with the poster in `previewImgUrls[0]` — the
600
+ * card cross-fades from poster to video, so the poster must be the video's
601
+ * first frame. Omit to leave an existing value untouched; `null` clears it. */
602
+ previewVideoUrl?: string | null;
603
+ }
604
+ interface TemplateDeleteResult {
605
+ siteId: number;
606
+ deleted: true;
607
+ }
608
+ declare class TemplatesEndpoint {
609
+ private readonly client;
610
+ constructor(client: NeopressClient);
611
+ private get basePath();
612
+ get(): Promise<Template>;
613
+ mark(data: TemplateMarkParams): Promise<Template>;
614
+ delete(): Promise<TemplateDeleteResult>;
615
+ /**
616
+ * List templates across the sites the caller can access.
617
+ *
618
+ * Direct-DB: `templates` is public-read and `sites` RLS scopes the visible set
619
+ * (own active memberships, or all sites for the super admin), so no server
620
+ * route is needed — the two RLS-scoped queries reproduce the old handler.
621
+ */
622
+ list(params?: {
623
+ namePrefix?: string;
624
+ limit?: number;
625
+ order?: SortOrder;
626
+ }): Promise<TemplateListItem[]>;
627
+ }
628
+ //#endregion
629
+ //#region ../sdk/dist/endpoints/headshots.d.ts
630
+ type HeadshotAgeBand = 'young' | 'middle';
631
+ type HeadshotGender = 'male' | 'female';
632
+ type HeadshotEthnicity = 'asian' | 'white' | 'black' | 'latino';
633
+ type HeadshotAttire = 'formal' | 'casual';
634
+ interface HeadshotListParams {
635
+ page?: number;
636
+ limit?: number;
637
+ ageBand?: HeadshotAgeBand;
638
+ gender?: HeadshotGender;
639
+ ethnicity?: HeadshotEthnicity;
640
+ attire?: HeadshotAttire;
641
+ isActive?: boolean;
642
+ /** When set, sort by created_at instead of the demographic key order. */
643
+ order?: SortOrder;
644
+ }
645
+ interface HeadshotCreateParams {
646
+ imageUrl: string;
647
+ ageBand: HeadshotAgeBand;
648
+ gender: HeadshotGender;
649
+ ethnicity: HeadshotEthnicity;
650
+ variationIndex: number;
651
+ attire?: HeadshotAttire;
652
+ width?: number;
653
+ height?: number;
654
+ aspectRatio?: string;
655
+ mimeType?: string;
656
+ byteSize?: number | null;
657
+ gptPrompt?: string | null;
658
+ tags?: string[];
659
+ isActive?: boolean;
660
+ }
661
+ interface HeadshotUpdateParams {
662
+ imageUrl?: string;
663
+ ageBand?: HeadshotAgeBand;
664
+ gender?: HeadshotGender;
665
+ ethnicity?: HeadshotEthnicity;
666
+ attire?: HeadshotAttire;
667
+ variationIndex?: number;
668
+ width?: number;
669
+ height?: number;
670
+ aspectRatio?: string;
671
+ mimeType?: string;
672
+ byteSize?: number | null;
673
+ gptPrompt?: string | null;
674
+ tags?: string[];
675
+ isActive?: boolean;
676
+ }
677
+ interface HeadshotDeleteResult {
678
+ id: number;
679
+ deleted: true;
680
+ }
681
+ /**
682
+ * headshot_pool is a GLOBAL (not site-scoped) admin table. RLS exposes it only to
683
+ * the super-admin user, so these direct-DB calls return empty/forbidden for any
684
+ * other account. No site id is used.
685
+ */
686
+ declare class HeadshotsEndpoint {
687
+ private readonly client;
688
+ constructor(client: NeopressClient);
689
+ list(params?: HeadshotListParams): Promise<PaginatedResponse<Headshot>>;
690
+ get(id: number): Promise<Headshot>;
691
+ create(params: HeadshotCreateParams): Promise<Headshot>;
692
+ update(id: number, params: HeadshotUpdateParams): Promise<Headshot>;
693
+ delete(id: number): Promise<HeadshotDeleteResult>;
694
+ }
695
+ //#endregion
696
+ //#region ../sdk/dist/endpoints/logos.d.ts
697
+ type LogoType = 'wordmark' | 'lockup' | 'signature';
698
+ type LogoTone = 'playful' | 'neutral' | 'serious';
699
+ interface LogoListParams {
700
+ page?: number;
701
+ limit?: number;
702
+ type?: LogoType;
703
+ tone?: LogoTone;
704
+ font?: string;
705
+ hue?: number;
706
+ isActive?: boolean;
707
+ /** When set, sort by created_at instead of the diversity-axis key order. */
708
+ order?: SortOrder;
709
+ }
710
+ interface LogoCreateParams {
711
+ imageUrl: string;
712
+ type: LogoType;
713
+ font: string;
714
+ color: string;
715
+ hue: number;
716
+ tone: LogoTone;
717
+ name: string;
718
+ toneScore?: number | null;
719
+ variant?: string | null;
720
+ sha256?: string | null;
721
+ width?: number;
722
+ height?: number;
723
+ aspectRatio?: string;
724
+ mimeType?: string;
725
+ byteSize?: number | null;
726
+ tags?: string[];
727
+ isActive?: boolean;
728
+ }
729
+ interface LogoUpdateParams {
730
+ imageUrl?: string;
731
+ type?: LogoType;
732
+ font?: string;
733
+ color?: string;
734
+ hue?: number;
735
+ tone?: LogoTone;
736
+ name?: string;
737
+ toneScore?: number | null;
738
+ variant?: string | null;
739
+ sha256?: string | null;
740
+ width?: number;
741
+ height?: number;
742
+ aspectRatio?: string;
743
+ mimeType?: string;
744
+ byteSize?: number | null;
745
+ tags?: string[];
746
+ isActive?: boolean;
747
+ }
748
+ interface LogoDeleteResult {
749
+ id: number;
750
+ deleted: true;
751
+ }
752
+ /**
753
+ * logo_pool is a GLOBAL (not site-scoped) admin table. RLS exposes it only to the
754
+ * super-admin user, so these direct-DB calls return empty/forbidden for any other
755
+ * account. No site id is used.
756
+ */
757
+ declare class LogosEndpoint {
758
+ private readonly client;
759
+ constructor(client: NeopressClient);
760
+ list(params?: LogoListParams): Promise<PaginatedResponse<Logo>>;
761
+ get(id: number): Promise<Logo>;
762
+ create(params: LogoCreateParams): Promise<Logo>;
763
+ update(id: number, params: LogoUpdateParams): Promise<Logo>;
764
+ delete(id: number): Promise<LogoDeleteResult>;
765
+ }
766
+ //#endregion
767
+ //#region ../sdk/dist/client.d.ts
768
+ interface NeopressClientOptions {
769
+ /** OAuth access token */
770
+ accessToken?: string;
771
+ /** Site ID to operate on */
772
+ siteId: number | string;
773
+ /** Base URL (default: https://app.neopress.ai) — used by orchestration/analytics (HTTP) routes */
774
+ baseUrl?: string;
775
+ /** Request timeout in ms (default: 30000) */
776
+ timeout?: number;
777
+ /** Supabase project URL — enables direct-DB reads/CRUD (transparent routing). */
778
+ supabaseUrl?: string;
779
+ /** Supabase anon key (paired with the user accessToken so RLS applies). */
780
+ supabaseAnonKey?: string;
781
+ }
782
+ declare class NeopressClient {
783
+ private readonly baseUrl;
784
+ private readonly accessToken;
785
+ private readonly siteId;
786
+ private readonly timeout;
787
+ private readonly supabaseUrl?;
788
+ private readonly supabaseAnonKey?;
789
+ private _db;
790
+ readonly pages: PagesEndpoint;
791
+ readonly collections: CollectionsEndpoint;
792
+ readonly entries: EntriesEndpoint;
793
+ readonly forms: FormsEndpoint;
794
+ readonly assets: AssetsEndpoint;
795
+ readonly site: SiteEndpoint;
796
+ readonly redirects: RedirectsEndpoint;
797
+ readonly publish: PublishEndpoint;
798
+ readonly entryReferences: EntryReferencesEndpoint;
799
+ readonly analytics: AnalyticsEndpoint;
800
+ readonly templates: TemplatesEndpoint;
801
+ readonly headshots: HeadshotsEndpoint;
802
+ readonly logos: LogosEndpoint;
803
+ constructor(options: NeopressClientOptions);
804
+ get siteBasePath(): string;
805
+ /** Numeric site id for direct DB queries. */
806
+ get siteIdNumber(): number;
807
+ /**
808
+ * Authenticated user's profile id, decoded locally from the access token's
809
+ * JWT `sub` claim (no network round-trip). Returns null if there is no token
810
+ * or it cannot be parsed. Subsequent DB queries are RLS-protected, so a local
811
+ * decode is sufficient — no server-side validation is required here.
812
+ */
813
+ get authUserId(): string | null;
814
+ /** Mirror of v1 parsePagination(defaultLimit=20, maxLimit=100). */
815
+ resolvePagination(params?: {
816
+ page?: number;
817
+ limit?: number;
818
+ }): {
819
+ page: number;
820
+ limit: number;
821
+ offset: number;
822
+ };
823
+ /** Build the paginated envelope matching the v1 API. */
824
+ paginationMeta(page: number, limit: number, offset: number, totalCount: number): PaginationMeta;
825
+ request<T>(method: string, path: string, body?: unknown): Promise<T>;
826
+ get<T>(path: string): Promise<ApiResponse<T>>;
827
+ getList<T>(path: string): Promise<PaginatedResponse<T>>;
828
+ post<T>(path: string, body?: unknown): Promise<ApiResponse<T>>;
829
+ patch<T>(path: string, body: unknown): Promise<ApiResponse<T>>;
830
+ delete<T>(path: string): Promise<ApiResponse<T>>;
831
+ }
832
+ //#endregion
833
+ //#region src/utils/client.d.ts
11
834
  declare function getClient(siteIdOverride?: number | string): NeopressClient;
12
835
  /**
13
836
  * Get client with guaranteed fresh OAuth token.
14
837
  * Use this for commands that might run after the token expired.
15
838
  */
16
839
  declare function getClientAsync(siteIdOverride?: number | string): Promise<NeopressClient>;
17
-
840
+ //#endregion
841
+ //#region src/utils/config.d.ts
18
842
  declare function getAccessToken(): string | undefined;
19
843
  declare function getSiteId(): number | undefined;
20
844
  declare function getBaseUrl(): string;
21
845
  declare function setActiveSiteId(siteId: number): void;
22
-
846
+ //#endregion
847
+ //#region src/utils/token-store.d.ts
23
848
  interface StoredTokens {
24
- accessToken: string;
25
- refreshToken: string;
26
- expiresAt: number;
27
- userId: string;
849
+ accessToken: string;
850
+ refreshToken: string;
851
+ expiresAt: number;
852
+ userId: string;
28
853
  }
29
854
  interface StoredSession {
30
- tokens?: StoredTokens;
31
- activeSiteId?: number;
32
- baseUrl?: string;
855
+ tokens?: StoredTokens;
856
+ activeSiteId?: number;
857
+ baseUrl?: string;
33
858
  }
34
859
  declare function loadSession(): StoredSession;
35
860
  declare function saveSession(session: StoredSession): void;
36
861
  declare function clearSession(): void;
37
-
38
- /**
39
- * Token exchange and refresh for Supabase OAuth.
40
- */
41
-
862
+ //#endregion
863
+ //#region src/utils/token-refresh.d.ts
42
864
  /**
43
865
  * Get a valid access token, refreshing if needed.
44
866
  */
45
867
  declare function getValidAccessToken(): Promise<string | null>;
46
-
47
- export { clearSession, getAccessToken, getBaseUrl, getClient, getClientAsync, getSiteId, getValidAccessToken, loadSession, saveSession, setActiveSiteId };
868
+ //#endregion
869
+ export { clearSession, getAccessToken, getBaseUrl, getClient, getClientAsync, getSiteId, getValidAccessToken, loadSession, saveSession, setActiveSiteId };