@howells/stow-server 0.5.0 → 0.6.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.
package/dist/index.d.mts CHANGED
@@ -48,6 +48,11 @@ interface UploadResult {
48
48
  size: number;
49
49
  url: string | null;
50
50
  }
51
+ /** Response returned when an upload is queued for async processing. */
52
+ interface QueuedResult {
53
+ jobId: string;
54
+ status: "queued";
55
+ }
51
56
  /** Bucket metadata returned by bucket APIs. */
52
57
  interface BucketResult {
53
58
  allowedTypes?: string[] | null;
@@ -173,6 +178,7 @@ interface FileColorProfile {
173
178
  interface ListFilesItem {
174
179
  colorProfile?: FileColorProfile | null;
175
180
  colors?: FileColor[];
181
+ contentType?: string;
176
182
  duration?: number | null;
177
183
  embeddingStatus?: string | null;
178
184
  height?: number | null;
@@ -667,6 +673,25 @@ declare class StowServer {
667
673
  /** Request AI-generated alt text for images */
668
674
  altText?: boolean;
669
675
  }): Promise<UploadResult>;
676
+ /**
677
+ * Queue a URL upload for async processing via BullMQ.
678
+ *
679
+ * Unlike `uploadFromUrl()`, this returns immediately with a job ID.
680
+ * The actual fetch, validation, and upload happen in a background worker.
681
+ * Use this for bulk imports where you don't need immediate confirmation.
682
+ */
683
+ queueUploadFromUrl(url: string, filename: string, options?: {
684
+ bucket?: string;
685
+ metadata?: Record<string, string>;
686
+ /** Headers to forward when fetching the URL (e.g. User-Agent, Referer) */
687
+ headers?: Record<string, string>;
688
+ /** Request AI-generated title for images */
689
+ title?: boolean;
690
+ /** Request AI-generated description for images */
691
+ describe?: boolean;
692
+ /** Request AI-generated alt text for images */
693
+ altText?: boolean;
694
+ }): Promise<QueuedResult>;
670
695
  /**
671
696
  * Get a presigned URL for direct client-side upload.
672
697
  *
@@ -741,6 +766,27 @@ declare class StowServer {
741
766
  embed(key: string, options?: {
742
767
  bucket?: string;
743
768
  }): Promise<TaskTriggerResult>;
769
+ /**
770
+ * Generate a title for an image file using AI vision.
771
+ * Requires a searchable bucket.
772
+ */
773
+ generateTitle(key: string, options?: {
774
+ bucket?: string;
775
+ }): Promise<TaskTriggerResult>;
776
+ /**
777
+ * Generate a description for an image file using AI vision.
778
+ * Requires a searchable bucket.
779
+ */
780
+ generateDescription(key: string, options?: {
781
+ bucket?: string;
782
+ }): Promise<TaskTriggerResult>;
783
+ /**
784
+ * Generate alt text for an image file using AI vision.
785
+ * Requires a searchable bucket.
786
+ */
787
+ generateAltText(key: string, options?: {
788
+ bucket?: string;
789
+ }): Promise<TaskTriggerResult>;
744
790
  /**
745
791
  * Replace a file's content by fetching from a new URL.
746
792
  *
@@ -872,4 +918,4 @@ declare class StowServer {
872
918
  private renameProfileCluster;
873
919
  }
874
920
 
875
- export { type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateBucketRequest, type DeleteProfileSignalsResult, type DiverseSearchRequest, type Drop, type DropResult, type FileColor, type FileColorProfile, type FileIncludeField, type FileResult, type FileTag, type FileTaxonomy, type FilteredMetadata, type ListBucketsResult, type ListDropsResult, type ListFilesItem, type ListFilesResult, type PresignDedupeResult, type PresignNewResult, type PresignRequest, type PresignResult, type ProfileClusterResult, type ProfileCreateRequest, type ProfileFilesResult, type ProfileResult, type ProfileSignalInput, type ProfileSignalResult, type ProfileSignalType, type ProfileSignalsResponse, type ReclusterRequest, type ReclusterResult, type RenameClusterRequest, type ReplaceResult, type SearchFilters, type SearchIncludeField, type SearchResultItem, type SimilarSearchRequest, type SimilarSearchResult, StowError, StowServer, type StowServerConfig, type TaskTriggerResult, type TextSearchRequest, type TransformOptions, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
921
+ export { type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateBucketRequest, type DeleteProfileSignalsResult, type DiverseSearchRequest, type Drop, type DropResult, type FileColor, type FileColorProfile, type FileIncludeField, type FileResult, type FileTag, type FileTaxonomy, type FilteredMetadata, type ListBucketsResult, type ListDropsResult, type ListFilesItem, type ListFilesResult, type PresignDedupeResult, type PresignNewResult, type PresignRequest, type PresignResult, type ProfileClusterResult, type ProfileCreateRequest, type ProfileFilesResult, type ProfileResult, type ProfileSignalInput, type ProfileSignalResult, type ProfileSignalType, type ProfileSignalsResponse, type QueuedResult, type ReclusterRequest, type ReclusterResult, type RenameClusterRequest, type ReplaceResult, type SearchFilters, type SearchIncludeField, type SearchResultItem, type SimilarSearchRequest, type SimilarSearchResult, StowError, StowServer, type StowServerConfig, type TaskTriggerResult, type TextSearchRequest, type TransformOptions, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
package/dist/index.d.ts CHANGED
@@ -48,6 +48,11 @@ interface UploadResult {
48
48
  size: number;
49
49
  url: string | null;
50
50
  }
51
+ /** Response returned when an upload is queued for async processing. */
52
+ interface QueuedResult {
53
+ jobId: string;
54
+ status: "queued";
55
+ }
51
56
  /** Bucket metadata returned by bucket APIs. */
52
57
  interface BucketResult {
53
58
  allowedTypes?: string[] | null;
@@ -173,6 +178,7 @@ interface FileColorProfile {
173
178
  interface ListFilesItem {
174
179
  colorProfile?: FileColorProfile | null;
175
180
  colors?: FileColor[];
181
+ contentType?: string;
176
182
  duration?: number | null;
177
183
  embeddingStatus?: string | null;
178
184
  height?: number | null;
@@ -667,6 +673,25 @@ declare class StowServer {
667
673
  /** Request AI-generated alt text for images */
668
674
  altText?: boolean;
669
675
  }): Promise<UploadResult>;
676
+ /**
677
+ * Queue a URL upload for async processing via BullMQ.
678
+ *
679
+ * Unlike `uploadFromUrl()`, this returns immediately with a job ID.
680
+ * The actual fetch, validation, and upload happen in a background worker.
681
+ * Use this for bulk imports where you don't need immediate confirmation.
682
+ */
683
+ queueUploadFromUrl(url: string, filename: string, options?: {
684
+ bucket?: string;
685
+ metadata?: Record<string, string>;
686
+ /** Headers to forward when fetching the URL (e.g. User-Agent, Referer) */
687
+ headers?: Record<string, string>;
688
+ /** Request AI-generated title for images */
689
+ title?: boolean;
690
+ /** Request AI-generated description for images */
691
+ describe?: boolean;
692
+ /** Request AI-generated alt text for images */
693
+ altText?: boolean;
694
+ }): Promise<QueuedResult>;
670
695
  /**
671
696
  * Get a presigned URL for direct client-side upload.
672
697
  *
@@ -741,6 +766,27 @@ declare class StowServer {
741
766
  embed(key: string, options?: {
742
767
  bucket?: string;
743
768
  }): Promise<TaskTriggerResult>;
769
+ /**
770
+ * Generate a title for an image file using AI vision.
771
+ * Requires a searchable bucket.
772
+ */
773
+ generateTitle(key: string, options?: {
774
+ bucket?: string;
775
+ }): Promise<TaskTriggerResult>;
776
+ /**
777
+ * Generate a description for an image file using AI vision.
778
+ * Requires a searchable bucket.
779
+ */
780
+ generateDescription(key: string, options?: {
781
+ bucket?: string;
782
+ }): Promise<TaskTriggerResult>;
783
+ /**
784
+ * Generate alt text for an image file using AI vision.
785
+ * Requires a searchable bucket.
786
+ */
787
+ generateAltText(key: string, options?: {
788
+ bucket?: string;
789
+ }): Promise<TaskTriggerResult>;
744
790
  /**
745
791
  * Replace a file's content by fetching from a new URL.
746
792
  *
@@ -872,4 +918,4 @@ declare class StowServer {
872
918
  private renameProfileCluster;
873
919
  }
874
920
 
875
- export { type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateBucketRequest, type DeleteProfileSignalsResult, type DiverseSearchRequest, type Drop, type DropResult, type FileColor, type FileColorProfile, type FileIncludeField, type FileResult, type FileTag, type FileTaxonomy, type FilteredMetadata, type ListBucketsResult, type ListDropsResult, type ListFilesItem, type ListFilesResult, type PresignDedupeResult, type PresignNewResult, type PresignRequest, type PresignResult, type ProfileClusterResult, type ProfileCreateRequest, type ProfileFilesResult, type ProfileResult, type ProfileSignalInput, type ProfileSignalResult, type ProfileSignalType, type ProfileSignalsResponse, type ReclusterRequest, type ReclusterResult, type RenameClusterRequest, type ReplaceResult, type SearchFilters, type SearchIncludeField, type SearchResultItem, type SimilarSearchRequest, type SimilarSearchResult, StowError, StowServer, type StowServerConfig, type TaskTriggerResult, type TextSearchRequest, type TransformOptions, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
921
+ export { type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateBucketRequest, type DeleteProfileSignalsResult, type DiverseSearchRequest, type Drop, type DropResult, type FileColor, type FileColorProfile, type FileIncludeField, type FileResult, type FileTag, type FileTaxonomy, type FilteredMetadata, type ListBucketsResult, type ListDropsResult, type ListFilesItem, type ListFilesResult, type PresignDedupeResult, type PresignNewResult, type PresignRequest, type PresignResult, type ProfileClusterResult, type ProfileCreateRequest, type ProfileFilesResult, type ProfileResult, type ProfileSignalInput, type ProfileSignalResult, type ProfileSignalType, type ProfileSignalsResponse, type QueuedResult, type ReclusterRequest, type ReclusterResult, type RenameClusterRequest, type ReplaceResult, type SearchFilters, type SearchIncludeField, type SearchResultItem, type SimilarSearchRequest, type SimilarSearchResult, StowError, StowServer, type StowServerConfig, type TaskTriggerResult, type TextSearchRequest, type TransformOptions, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
package/dist/index.js CHANGED
@@ -72,6 +72,10 @@ var uploadResultSchema = import_zod.z.object({
72
72
  metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional(),
73
73
  deduped: import_zod.z.boolean().optional()
74
74
  });
75
+ var queuedResultSchema = import_zod.z.object({
76
+ status: import_zod.z.literal("queued"),
77
+ jobId: import_zod.z.string()
78
+ });
75
79
  var bucketSchema = import_zod.z.object({
76
80
  id: import_zod.z.string(),
77
81
  name: import_zod.z.string(),
@@ -129,6 +133,7 @@ var listFilesSchema = import_zod.z.object({
129
133
  size: import_zod.z.number(),
130
134
  lastModified: import_zod.z.string(),
131
135
  url: import_zod.z.string().nullable(),
136
+ contentType: import_zod.z.string().optional(),
132
137
  width: import_zod.z.number().nullable().optional(),
133
138
  height: import_zod.z.number().nullable().optional(),
134
139
  duration: import_zod.z.number().nullable().optional(),
@@ -562,6 +567,33 @@ var StowServer = class {
562
567
  ...result.metadata ? { metadata: result.metadata } : {}
563
568
  };
564
569
  }
570
+ /**
571
+ * Queue a URL upload for async processing via BullMQ.
572
+ *
573
+ * Unlike `uploadFromUrl()`, this returns immediately with a job ID.
574
+ * The actual fetch, validation, and upload happen in a background worker.
575
+ * Use this for bulk imports where you don't need immediate confirmation.
576
+ */
577
+ async queueUploadFromUrl(url, filename, options) {
578
+ return this.request(
579
+ this.withBucket("/api/upload", options?.bucket),
580
+ {
581
+ method: "POST",
582
+ headers: { "Content-Type": "application/json" },
583
+ body: JSON.stringify({
584
+ url,
585
+ filename,
586
+ async: true,
587
+ ...options?.metadata ? { metadata: options.metadata } : {},
588
+ ...options?.headers ? { headers: options.headers } : {},
589
+ ...options?.title ? { title: true } : {},
590
+ ...options?.describe ? { describe: true } : {},
591
+ ...options?.altText ? { altText: true } : {}
592
+ })
593
+ },
594
+ queuedResultSchema
595
+ );
596
+ }
565
597
  /**
566
598
  * Get a presigned URL for direct client-side upload.
567
599
  *
@@ -737,6 +769,42 @@ var StowServer = class {
737
769
  taskTriggerResultSchema
738
770
  );
739
771
  }
772
+ /**
773
+ * Generate a title for an image file using AI vision.
774
+ * Requires a searchable bucket.
775
+ */
776
+ generateTitle(key, options) {
777
+ const path = `/api/files/${encodeURIComponent(key)}/title`;
778
+ return this.request(
779
+ this.withBucket(path, options?.bucket),
780
+ { method: "POST" },
781
+ taskTriggerResultSchema
782
+ );
783
+ }
784
+ /**
785
+ * Generate a description for an image file using AI vision.
786
+ * Requires a searchable bucket.
787
+ */
788
+ generateDescription(key, options) {
789
+ const path = `/api/files/${encodeURIComponent(key)}/description`;
790
+ return this.request(
791
+ this.withBucket(path, options?.bucket),
792
+ { method: "POST" },
793
+ taskTriggerResultSchema
794
+ );
795
+ }
796
+ /**
797
+ * Generate alt text for an image file using AI vision.
798
+ * Requires a searchable bucket.
799
+ */
800
+ generateAltText(key, options) {
801
+ const path = `/api/files/${encodeURIComponent(key)}/alt-text`;
802
+ return this.request(
803
+ this.withBucket(path, options?.bucket),
804
+ { method: "POST" },
805
+ taskTriggerResultSchema
806
+ );
807
+ }
740
808
  /**
741
809
  * Replace a file's content by fetching from a new URL.
742
810
  *
package/dist/index.mjs CHANGED
@@ -47,6 +47,10 @@ var uploadResultSchema = z.object({
47
47
  metadata: z.record(z.string(), z.string()).optional(),
48
48
  deduped: z.boolean().optional()
49
49
  });
50
+ var queuedResultSchema = z.object({
51
+ status: z.literal("queued"),
52
+ jobId: z.string()
53
+ });
50
54
  var bucketSchema = z.object({
51
55
  id: z.string(),
52
56
  name: z.string(),
@@ -104,6 +108,7 @@ var listFilesSchema = z.object({
104
108
  size: z.number(),
105
109
  lastModified: z.string(),
106
110
  url: z.string().nullable(),
111
+ contentType: z.string().optional(),
107
112
  width: z.number().nullable().optional(),
108
113
  height: z.number().nullable().optional(),
109
114
  duration: z.number().nullable().optional(),
@@ -537,6 +542,33 @@ var StowServer = class {
537
542
  ...result.metadata ? { metadata: result.metadata } : {}
538
543
  };
539
544
  }
545
+ /**
546
+ * Queue a URL upload for async processing via BullMQ.
547
+ *
548
+ * Unlike `uploadFromUrl()`, this returns immediately with a job ID.
549
+ * The actual fetch, validation, and upload happen in a background worker.
550
+ * Use this for bulk imports where you don't need immediate confirmation.
551
+ */
552
+ async queueUploadFromUrl(url, filename, options) {
553
+ return this.request(
554
+ this.withBucket("/api/upload", options?.bucket),
555
+ {
556
+ method: "POST",
557
+ headers: { "Content-Type": "application/json" },
558
+ body: JSON.stringify({
559
+ url,
560
+ filename,
561
+ async: true,
562
+ ...options?.metadata ? { metadata: options.metadata } : {},
563
+ ...options?.headers ? { headers: options.headers } : {},
564
+ ...options?.title ? { title: true } : {},
565
+ ...options?.describe ? { describe: true } : {},
566
+ ...options?.altText ? { altText: true } : {}
567
+ })
568
+ },
569
+ queuedResultSchema
570
+ );
571
+ }
540
572
  /**
541
573
  * Get a presigned URL for direct client-side upload.
542
574
  *
@@ -712,6 +744,42 @@ var StowServer = class {
712
744
  taskTriggerResultSchema
713
745
  );
714
746
  }
747
+ /**
748
+ * Generate a title for an image file using AI vision.
749
+ * Requires a searchable bucket.
750
+ */
751
+ generateTitle(key, options) {
752
+ const path = `/api/files/${encodeURIComponent(key)}/title`;
753
+ return this.request(
754
+ this.withBucket(path, options?.bucket),
755
+ { method: "POST" },
756
+ taskTriggerResultSchema
757
+ );
758
+ }
759
+ /**
760
+ * Generate a description for an image file using AI vision.
761
+ * Requires a searchable bucket.
762
+ */
763
+ generateDescription(key, options) {
764
+ const path = `/api/files/${encodeURIComponent(key)}/description`;
765
+ return this.request(
766
+ this.withBucket(path, options?.bucket),
767
+ { method: "POST" },
768
+ taskTriggerResultSchema
769
+ );
770
+ }
771
+ /**
772
+ * Generate alt text for an image file using AI vision.
773
+ * Requires a searchable bucket.
774
+ */
775
+ generateAltText(key, options) {
776
+ const path = `/api/files/${encodeURIComponent(key)}/alt-text`;
777
+ return this.request(
778
+ this.withBucket(path, options?.bucket),
779
+ { method: "POST" },
780
+ taskTriggerResultSchema
781
+ );
782
+ }
715
783
  /**
716
784
  * Replace a file's content by fetching from a new URL.
717
785
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/stow-server",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Server-side SDK for Stow file storage",
5
5
  "license": "MIT",
6
6
  "repository": {