@howells/stow-server 0.5.0 → 0.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.
- package/dist/index.d.mts +95 -3
- package/dist/index.d.ts +95 -3
- package/dist/index.js +92 -0
- package/dist/index.mjs +92 -0
- package/package.json +10 -10
- package/LICENSE +0 -21
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;
|
|
@@ -383,6 +389,8 @@ type FileIncludeField = "tags" | "taxonomies";
|
|
|
383
389
|
/** Input payload for text-based semantic search. */
|
|
384
390
|
interface TextSearchRequest {
|
|
385
391
|
bucket?: string;
|
|
392
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
393
|
+
excludeKeys?: string[];
|
|
386
394
|
filters?: SearchFilters;
|
|
387
395
|
include?: SearchIncludeField[];
|
|
388
396
|
limit?: number;
|
|
@@ -451,7 +459,7 @@ interface SimilarSearchRequest {
|
|
|
451
459
|
clusterId?: string;
|
|
452
460
|
/** Blend multiple cluster centroids as query vector. Requires profileId. */
|
|
453
461
|
clusterIds?: string[];
|
|
454
|
-
/** File keys to exclude from results (e.g. already-seen items). Max
|
|
462
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
455
463
|
excludeKeys?: string[];
|
|
456
464
|
/** Find files similar to this file key */
|
|
457
465
|
fileKey?: string;
|
|
@@ -474,7 +482,7 @@ interface DiverseSearchRequest {
|
|
|
474
482
|
clusterId?: string;
|
|
475
483
|
/** Blend multiple cluster centroids as query vector. Requires profileId. */
|
|
476
484
|
clusterIds?: string[];
|
|
477
|
-
/** File keys to exclude from results (e.g. already-seen items). Max
|
|
485
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
478
486
|
excludeKeys?: string[];
|
|
479
487
|
/** Find diverse files seeded by this file key */
|
|
480
488
|
fileKey?: string;
|
|
@@ -519,8 +527,18 @@ interface SearchResultItem {
|
|
|
519
527
|
}>;
|
|
520
528
|
width?: number | null;
|
|
521
529
|
}
|
|
530
|
+
/** Which filter categories were active in the request. */
|
|
531
|
+
interface AppliedFilters {
|
|
532
|
+
color?: string[];
|
|
533
|
+
contentType?: string[];
|
|
534
|
+
metadata?: string[];
|
|
535
|
+
tags?: string[];
|
|
536
|
+
taxonomies?: string[];
|
|
537
|
+
taxonomyGroups?: string[];
|
|
538
|
+
}
|
|
522
539
|
/** Metadata describing server-side filter pruning. */
|
|
523
540
|
interface FilteredMetadata {
|
|
541
|
+
appliedFilters: AppliedFilters;
|
|
524
542
|
candidatesScanned: number;
|
|
525
543
|
requested: number;
|
|
526
544
|
returned: number;
|
|
@@ -536,6 +554,8 @@ interface ColorSearchRequest {
|
|
|
536
554
|
bucket?: string;
|
|
537
555
|
/** Only search the dominant (first) color per file */
|
|
538
556
|
dominantOnly?: boolean;
|
|
557
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
558
|
+
excludeKeys?: string[];
|
|
539
559
|
/** Target color as hex (e.g. "#FF0000") */
|
|
540
560
|
hex?: string;
|
|
541
561
|
/** Max results (default 10, max 50) */
|
|
@@ -555,6 +575,7 @@ interface ColorSearchResultItem {
|
|
|
555
575
|
colorDistance: number;
|
|
556
576
|
contentType: string;
|
|
557
577
|
createdAt: string;
|
|
578
|
+
height: number | null;
|
|
558
579
|
id: string;
|
|
559
580
|
key: string;
|
|
560
581
|
matchedColor: {
|
|
@@ -567,11 +588,27 @@ interface ColorSearchResultItem {
|
|
|
567
588
|
position: number;
|
|
568
589
|
proportion: number;
|
|
569
590
|
};
|
|
591
|
+
width: number | null;
|
|
570
592
|
}
|
|
571
593
|
/** Result payload for color similarity search. */
|
|
572
594
|
interface ColorSearchResult {
|
|
573
595
|
results: ColorSearchResultItem[];
|
|
574
596
|
}
|
|
597
|
+
/** A taxonomy term within a group. */
|
|
598
|
+
interface TaxonomyTerm {
|
|
599
|
+
name: string;
|
|
600
|
+
slug: string;
|
|
601
|
+
}
|
|
602
|
+
/** A taxonomy group with its terms. */
|
|
603
|
+
interface TaxonomyGroup {
|
|
604
|
+
name: string;
|
|
605
|
+
slug: string;
|
|
606
|
+
taxonomies: TaxonomyTerm[];
|
|
607
|
+
}
|
|
608
|
+
/** Result payload for taxonomy listing. */
|
|
609
|
+
interface TaxonomyListResult {
|
|
610
|
+
groups: TaxonomyGroup[];
|
|
611
|
+
}
|
|
575
612
|
/** Server-side SDK client for Stow's API. */
|
|
576
613
|
declare class StowServer {
|
|
577
614
|
private readonly apiKey;
|
|
@@ -667,6 +704,25 @@ declare class StowServer {
|
|
|
667
704
|
/** Request AI-generated alt text for images */
|
|
668
705
|
altText?: boolean;
|
|
669
706
|
}): Promise<UploadResult>;
|
|
707
|
+
/**
|
|
708
|
+
* Queue a URL upload for async processing via BullMQ.
|
|
709
|
+
*
|
|
710
|
+
* Unlike `uploadFromUrl()`, this returns immediately with a job ID.
|
|
711
|
+
* The actual fetch, validation, and upload happen in a background worker.
|
|
712
|
+
* Use this for bulk imports where you don't need immediate confirmation.
|
|
713
|
+
*/
|
|
714
|
+
queueUploadFromUrl(url: string, filename: string, options?: {
|
|
715
|
+
bucket?: string;
|
|
716
|
+
metadata?: Record<string, string>;
|
|
717
|
+
/** Headers to forward when fetching the URL (e.g. User-Agent, Referer) */
|
|
718
|
+
headers?: Record<string, string>;
|
|
719
|
+
/** Request AI-generated title for images */
|
|
720
|
+
title?: boolean;
|
|
721
|
+
/** Request AI-generated description for images */
|
|
722
|
+
describe?: boolean;
|
|
723
|
+
/** Request AI-generated alt text for images */
|
|
724
|
+
altText?: boolean;
|
|
725
|
+
}): Promise<QueuedResult>;
|
|
670
726
|
/**
|
|
671
727
|
* Get a presigned URL for direct client-side upload.
|
|
672
728
|
*
|
|
@@ -741,6 +797,27 @@ declare class StowServer {
|
|
|
741
797
|
embed(key: string, options?: {
|
|
742
798
|
bucket?: string;
|
|
743
799
|
}): Promise<TaskTriggerResult>;
|
|
800
|
+
/**
|
|
801
|
+
* Generate a title for an image file using AI vision.
|
|
802
|
+
* Requires a searchable bucket.
|
|
803
|
+
*/
|
|
804
|
+
generateTitle(key: string, options?: {
|
|
805
|
+
bucket?: string;
|
|
806
|
+
}): Promise<TaskTriggerResult>;
|
|
807
|
+
/**
|
|
808
|
+
* Generate a description for an image file using AI vision.
|
|
809
|
+
* Requires a searchable bucket.
|
|
810
|
+
*/
|
|
811
|
+
generateDescription(key: string, options?: {
|
|
812
|
+
bucket?: string;
|
|
813
|
+
}): Promise<TaskTriggerResult>;
|
|
814
|
+
/**
|
|
815
|
+
* Generate alt text for an image file using AI vision.
|
|
816
|
+
* Requires a searchable bucket.
|
|
817
|
+
*/
|
|
818
|
+
generateAltText(key: string, options?: {
|
|
819
|
+
bucket?: string;
|
|
820
|
+
}): Promise<TaskTriggerResult>;
|
|
744
821
|
/**
|
|
745
822
|
* Replace a file's content by fetching from a new URL.
|
|
746
823
|
*
|
|
@@ -804,6 +881,21 @@ declare class StowServer {
|
|
|
804
881
|
removeTag(key: string, tagId: string, options?: {
|
|
805
882
|
bucket?: string;
|
|
806
883
|
}): Promise<void>;
|
|
884
|
+
/**
|
|
885
|
+
* Taxonomies namespace for discovering available taxonomy terms.
|
|
886
|
+
*
|
|
887
|
+
* @example
|
|
888
|
+
* ```typescript
|
|
889
|
+
* const { groups } = await stow.taxonomies.list();
|
|
890
|
+
* for (const group of groups) {
|
|
891
|
+
* console.log(group.slug, group.taxonomies.map(t => t.slug));
|
|
892
|
+
* }
|
|
893
|
+
* ```
|
|
894
|
+
*/
|
|
895
|
+
get taxonomies(): {
|
|
896
|
+
list: () => Promise<TaxonomyListResult>;
|
|
897
|
+
};
|
|
898
|
+
private listTaxonomies;
|
|
807
899
|
/**
|
|
808
900
|
* Search namespace for vector similarity search
|
|
809
901
|
*/
|
|
@@ -872,4 +964,4 @@ declare class StowServer {
|
|
|
872
964
|
private renameProfileCluster;
|
|
873
965
|
}
|
|
874
966
|
|
|
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 };
|
|
967
|
+
export { type AppliedFilters, 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 TaxonomyGroup, type TaxonomyListResult, type TaxonomyTerm, 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;
|
|
@@ -383,6 +389,8 @@ type FileIncludeField = "tags" | "taxonomies";
|
|
|
383
389
|
/** Input payload for text-based semantic search. */
|
|
384
390
|
interface TextSearchRequest {
|
|
385
391
|
bucket?: string;
|
|
392
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
393
|
+
excludeKeys?: string[];
|
|
386
394
|
filters?: SearchFilters;
|
|
387
395
|
include?: SearchIncludeField[];
|
|
388
396
|
limit?: number;
|
|
@@ -451,7 +459,7 @@ interface SimilarSearchRequest {
|
|
|
451
459
|
clusterId?: string;
|
|
452
460
|
/** Blend multiple cluster centroids as query vector. Requires profileId. */
|
|
453
461
|
clusterIds?: string[];
|
|
454
|
-
/** File keys to exclude from results (e.g. already-seen items). Max
|
|
462
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
455
463
|
excludeKeys?: string[];
|
|
456
464
|
/** Find files similar to this file key */
|
|
457
465
|
fileKey?: string;
|
|
@@ -474,7 +482,7 @@ interface DiverseSearchRequest {
|
|
|
474
482
|
clusterId?: string;
|
|
475
483
|
/** Blend multiple cluster centroids as query vector. Requires profileId. */
|
|
476
484
|
clusterIds?: string[];
|
|
477
|
-
/** File keys to exclude from results (e.g. already-seen items). Max
|
|
485
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
478
486
|
excludeKeys?: string[];
|
|
479
487
|
/** Find diverse files seeded by this file key */
|
|
480
488
|
fileKey?: string;
|
|
@@ -519,8 +527,18 @@ interface SearchResultItem {
|
|
|
519
527
|
}>;
|
|
520
528
|
width?: number | null;
|
|
521
529
|
}
|
|
530
|
+
/** Which filter categories were active in the request. */
|
|
531
|
+
interface AppliedFilters {
|
|
532
|
+
color?: string[];
|
|
533
|
+
contentType?: string[];
|
|
534
|
+
metadata?: string[];
|
|
535
|
+
tags?: string[];
|
|
536
|
+
taxonomies?: string[];
|
|
537
|
+
taxonomyGroups?: string[];
|
|
538
|
+
}
|
|
522
539
|
/** Metadata describing server-side filter pruning. */
|
|
523
540
|
interface FilteredMetadata {
|
|
541
|
+
appliedFilters: AppliedFilters;
|
|
524
542
|
candidatesScanned: number;
|
|
525
543
|
requested: number;
|
|
526
544
|
returned: number;
|
|
@@ -536,6 +554,8 @@ interface ColorSearchRequest {
|
|
|
536
554
|
bucket?: string;
|
|
537
555
|
/** Only search the dominant (first) color per file */
|
|
538
556
|
dominantOnly?: boolean;
|
|
557
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
558
|
+
excludeKeys?: string[];
|
|
539
559
|
/** Target color as hex (e.g. "#FF0000") */
|
|
540
560
|
hex?: string;
|
|
541
561
|
/** Max results (default 10, max 50) */
|
|
@@ -555,6 +575,7 @@ interface ColorSearchResultItem {
|
|
|
555
575
|
colorDistance: number;
|
|
556
576
|
contentType: string;
|
|
557
577
|
createdAt: string;
|
|
578
|
+
height: number | null;
|
|
558
579
|
id: string;
|
|
559
580
|
key: string;
|
|
560
581
|
matchedColor: {
|
|
@@ -567,11 +588,27 @@ interface ColorSearchResultItem {
|
|
|
567
588
|
position: number;
|
|
568
589
|
proportion: number;
|
|
569
590
|
};
|
|
591
|
+
width: number | null;
|
|
570
592
|
}
|
|
571
593
|
/** Result payload for color similarity search. */
|
|
572
594
|
interface ColorSearchResult {
|
|
573
595
|
results: ColorSearchResultItem[];
|
|
574
596
|
}
|
|
597
|
+
/** A taxonomy term within a group. */
|
|
598
|
+
interface TaxonomyTerm {
|
|
599
|
+
name: string;
|
|
600
|
+
slug: string;
|
|
601
|
+
}
|
|
602
|
+
/** A taxonomy group with its terms. */
|
|
603
|
+
interface TaxonomyGroup {
|
|
604
|
+
name: string;
|
|
605
|
+
slug: string;
|
|
606
|
+
taxonomies: TaxonomyTerm[];
|
|
607
|
+
}
|
|
608
|
+
/** Result payload for taxonomy listing. */
|
|
609
|
+
interface TaxonomyListResult {
|
|
610
|
+
groups: TaxonomyGroup[];
|
|
611
|
+
}
|
|
575
612
|
/** Server-side SDK client for Stow's API. */
|
|
576
613
|
declare class StowServer {
|
|
577
614
|
private readonly apiKey;
|
|
@@ -667,6 +704,25 @@ declare class StowServer {
|
|
|
667
704
|
/** Request AI-generated alt text for images */
|
|
668
705
|
altText?: boolean;
|
|
669
706
|
}): Promise<UploadResult>;
|
|
707
|
+
/**
|
|
708
|
+
* Queue a URL upload for async processing via BullMQ.
|
|
709
|
+
*
|
|
710
|
+
* Unlike `uploadFromUrl()`, this returns immediately with a job ID.
|
|
711
|
+
* The actual fetch, validation, and upload happen in a background worker.
|
|
712
|
+
* Use this for bulk imports where you don't need immediate confirmation.
|
|
713
|
+
*/
|
|
714
|
+
queueUploadFromUrl(url: string, filename: string, options?: {
|
|
715
|
+
bucket?: string;
|
|
716
|
+
metadata?: Record<string, string>;
|
|
717
|
+
/** Headers to forward when fetching the URL (e.g. User-Agent, Referer) */
|
|
718
|
+
headers?: Record<string, string>;
|
|
719
|
+
/** Request AI-generated title for images */
|
|
720
|
+
title?: boolean;
|
|
721
|
+
/** Request AI-generated description for images */
|
|
722
|
+
describe?: boolean;
|
|
723
|
+
/** Request AI-generated alt text for images */
|
|
724
|
+
altText?: boolean;
|
|
725
|
+
}): Promise<QueuedResult>;
|
|
670
726
|
/**
|
|
671
727
|
* Get a presigned URL for direct client-side upload.
|
|
672
728
|
*
|
|
@@ -741,6 +797,27 @@ declare class StowServer {
|
|
|
741
797
|
embed(key: string, options?: {
|
|
742
798
|
bucket?: string;
|
|
743
799
|
}): Promise<TaskTriggerResult>;
|
|
800
|
+
/**
|
|
801
|
+
* Generate a title for an image file using AI vision.
|
|
802
|
+
* Requires a searchable bucket.
|
|
803
|
+
*/
|
|
804
|
+
generateTitle(key: string, options?: {
|
|
805
|
+
bucket?: string;
|
|
806
|
+
}): Promise<TaskTriggerResult>;
|
|
807
|
+
/**
|
|
808
|
+
* Generate a description for an image file using AI vision.
|
|
809
|
+
* Requires a searchable bucket.
|
|
810
|
+
*/
|
|
811
|
+
generateDescription(key: string, options?: {
|
|
812
|
+
bucket?: string;
|
|
813
|
+
}): Promise<TaskTriggerResult>;
|
|
814
|
+
/**
|
|
815
|
+
* Generate alt text for an image file using AI vision.
|
|
816
|
+
* Requires a searchable bucket.
|
|
817
|
+
*/
|
|
818
|
+
generateAltText(key: string, options?: {
|
|
819
|
+
bucket?: string;
|
|
820
|
+
}): Promise<TaskTriggerResult>;
|
|
744
821
|
/**
|
|
745
822
|
* Replace a file's content by fetching from a new URL.
|
|
746
823
|
*
|
|
@@ -804,6 +881,21 @@ declare class StowServer {
|
|
|
804
881
|
removeTag(key: string, tagId: string, options?: {
|
|
805
882
|
bucket?: string;
|
|
806
883
|
}): Promise<void>;
|
|
884
|
+
/**
|
|
885
|
+
* Taxonomies namespace for discovering available taxonomy terms.
|
|
886
|
+
*
|
|
887
|
+
* @example
|
|
888
|
+
* ```typescript
|
|
889
|
+
* const { groups } = await stow.taxonomies.list();
|
|
890
|
+
* for (const group of groups) {
|
|
891
|
+
* console.log(group.slug, group.taxonomies.map(t => t.slug));
|
|
892
|
+
* }
|
|
893
|
+
* ```
|
|
894
|
+
*/
|
|
895
|
+
get taxonomies(): {
|
|
896
|
+
list: () => Promise<TaxonomyListResult>;
|
|
897
|
+
};
|
|
898
|
+
private listTaxonomies;
|
|
807
899
|
/**
|
|
808
900
|
* Search namespace for vector similarity search
|
|
809
901
|
*/
|
|
@@ -872,4 +964,4 @@ declare class StowServer {
|
|
|
872
964
|
private renameProfileCluster;
|
|
873
965
|
}
|
|
874
966
|
|
|
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 };
|
|
967
|
+
export { type AppliedFilters, 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 TaxonomyGroup, type TaxonomyListResult, type TaxonomyTerm, 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
|
*
|
|
@@ -840,6 +908,28 @@ var StowServer = class {
|
|
|
840
908
|
});
|
|
841
909
|
}
|
|
842
910
|
// ============================================================
|
|
911
|
+
// TAXONOMIES - Discover taxonomy groups and terms
|
|
912
|
+
// ============================================================
|
|
913
|
+
/**
|
|
914
|
+
* Taxonomies namespace for discovering available taxonomy terms.
|
|
915
|
+
*
|
|
916
|
+
* @example
|
|
917
|
+
* ```typescript
|
|
918
|
+
* const { groups } = await stow.taxonomies.list();
|
|
919
|
+
* for (const group of groups) {
|
|
920
|
+
* console.log(group.slug, group.taxonomies.map(t => t.slug));
|
|
921
|
+
* }
|
|
922
|
+
* ```
|
|
923
|
+
*/
|
|
924
|
+
get taxonomies() {
|
|
925
|
+
return {
|
|
926
|
+
list: () => this.listTaxonomies()
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
listTaxonomies() {
|
|
930
|
+
return this.request("/api/taxonomies", { method: "GET" });
|
|
931
|
+
}
|
|
932
|
+
// ============================================================
|
|
843
933
|
// SEARCH - Vector similarity search
|
|
844
934
|
// ============================================================
|
|
845
935
|
/**
|
|
@@ -901,6 +991,7 @@ var StowServer = class {
|
|
|
901
991
|
query: params.query,
|
|
902
992
|
...bucket ? { bucket } : {},
|
|
903
993
|
...params.limit ? { limit: params.limit } : {},
|
|
994
|
+
...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {},
|
|
904
995
|
...params.filters ? { filters: params.filters } : {},
|
|
905
996
|
...params.include?.length ? { include: params.include } : {}
|
|
906
997
|
})
|
|
@@ -916,6 +1007,7 @@ var StowServer = class {
|
|
|
916
1007
|
...params.oklab ? { oklab: params.oklab } : {},
|
|
917
1008
|
...bucket ? { bucket } : {},
|
|
918
1009
|
...params.limit ? { limit: params.limit } : {},
|
|
1010
|
+
...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {},
|
|
919
1011
|
...params.minProportion !== void 0 ? { minProportion: params.minProportion } : {},
|
|
920
1012
|
...params.dominantOnly ? { dominantOnly: params.dominantOnly } : {}
|
|
921
1013
|
})
|
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
|
*
|
|
@@ -815,6 +883,28 @@ var StowServer = class {
|
|
|
815
883
|
});
|
|
816
884
|
}
|
|
817
885
|
// ============================================================
|
|
886
|
+
// TAXONOMIES - Discover taxonomy groups and terms
|
|
887
|
+
// ============================================================
|
|
888
|
+
/**
|
|
889
|
+
* Taxonomies namespace for discovering available taxonomy terms.
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```typescript
|
|
893
|
+
* const { groups } = await stow.taxonomies.list();
|
|
894
|
+
* for (const group of groups) {
|
|
895
|
+
* console.log(group.slug, group.taxonomies.map(t => t.slug));
|
|
896
|
+
* }
|
|
897
|
+
* ```
|
|
898
|
+
*/
|
|
899
|
+
get taxonomies() {
|
|
900
|
+
return {
|
|
901
|
+
list: () => this.listTaxonomies()
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
listTaxonomies() {
|
|
905
|
+
return this.request("/api/taxonomies", { method: "GET" });
|
|
906
|
+
}
|
|
907
|
+
// ============================================================
|
|
818
908
|
// SEARCH - Vector similarity search
|
|
819
909
|
// ============================================================
|
|
820
910
|
/**
|
|
@@ -876,6 +966,7 @@ var StowServer = class {
|
|
|
876
966
|
query: params.query,
|
|
877
967
|
...bucket ? { bucket } : {},
|
|
878
968
|
...params.limit ? { limit: params.limit } : {},
|
|
969
|
+
...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {},
|
|
879
970
|
...params.filters ? { filters: params.filters } : {},
|
|
880
971
|
...params.include?.length ? { include: params.include } : {}
|
|
881
972
|
})
|
|
@@ -891,6 +982,7 @@ var StowServer = class {
|
|
|
891
982
|
...params.oklab ? { oklab: params.oklab } : {},
|
|
892
983
|
...bucket ? { bucket } : {},
|
|
893
984
|
...params.limit ? { limit: params.limit } : {},
|
|
985
|
+
...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {},
|
|
894
986
|
...params.minProportion !== void 0 ? { minProportion: params.minProportion } : {},
|
|
895
987
|
...params.dominantOnly ? { dominantOnly: params.dominantOnly } : {}
|
|
896
988
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howells/stow-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Server-side SDK for Stow file storage",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,21 +29,21 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
34
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"test:watch": "vitest"
|
|
37
|
+
},
|
|
32
38
|
"peerDependencies": {
|
|
33
39
|
"zod": "^3.0.0 || ^4.0.0"
|
|
34
40
|
},
|
|
35
41
|
"devDependencies": {
|
|
42
|
+
"@stow/typescript-config": "workspace:*",
|
|
36
43
|
"@types/node": "^25.3.0",
|
|
37
44
|
"tsup": "^8.5.1",
|
|
38
45
|
"typescript": "^5.9.3",
|
|
39
46
|
"vitest": "^4.0.18",
|
|
40
|
-
"zod": "^4.3.6"
|
|
41
|
-
"@stow/typescript-config": "0.0.0"
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
45
|
-
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
46
|
-
"test": "vitest run",
|
|
47
|
-
"test:watch": "vitest"
|
|
47
|
+
"zod": "^4.3.6"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Stow
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|