@howells/stow-server 2.1.0 → 2.2.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 +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +20 -1
- package/dist/index.mjs +20 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -627,6 +627,47 @@ interface ColorSearchResultItem {
|
|
|
627
627
|
interface ColorSearchResult {
|
|
628
628
|
results: ColorSearchResultItem[];
|
|
629
629
|
}
|
|
630
|
+
/** Input specifying the image source for search-by-image. Exactly one of url or fileKey. */
|
|
631
|
+
interface SearchByImageInput {
|
|
632
|
+
/** Key of an existing file to use as the image source */
|
|
633
|
+
fileKey?: string;
|
|
634
|
+
/** URL of an external image to download, persist, and embed */
|
|
635
|
+
url?: string;
|
|
636
|
+
}
|
|
637
|
+
/** Options for search-by-image. */
|
|
638
|
+
interface SearchByImageOptions {
|
|
639
|
+
/** Bucket name or ID to scope search */
|
|
640
|
+
bucket?: string;
|
|
641
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
642
|
+
excludeKeys?: string[];
|
|
643
|
+
/** Structured post-filters (taxonomy, tag, color, content type, metadata) */
|
|
644
|
+
filters?: SearchFilters;
|
|
645
|
+
/** Opt-in enrichment fields to include in results */
|
|
646
|
+
include?: SearchIncludeField[];
|
|
647
|
+
/** Max results (default 10, max 50) */
|
|
648
|
+
limit?: number;
|
|
649
|
+
/** Custom metadata to attach when persisting a URL-sourced image */
|
|
650
|
+
metadata?: Record<string, string>;
|
|
651
|
+
/** Minimum similarity threshold (0–1, default 0.25) */
|
|
652
|
+
threshold?: number;
|
|
653
|
+
}
|
|
654
|
+
/** Source image metadata returned by search-by-image. */
|
|
655
|
+
interface SearchByImageSource {
|
|
656
|
+
embedding: {
|
|
657
|
+
dimensions: number;
|
|
658
|
+
durationMs: number;
|
|
659
|
+
model: string;
|
|
660
|
+
};
|
|
661
|
+
fileKey: string;
|
|
662
|
+
vector: number[];
|
|
663
|
+
}
|
|
664
|
+
/** Result payload returned by search-by-image. */
|
|
665
|
+
interface SearchByImageResult {
|
|
666
|
+
anchors?: AnchorSearchResult[];
|
|
667
|
+
filtered?: FilteredMetadata;
|
|
668
|
+
results: SearchResultItem[];
|
|
669
|
+
source: SearchByImageSource;
|
|
670
|
+
}
|
|
630
671
|
/** A taxonomy term within a group. */
|
|
631
672
|
interface TaxonomyTerm {
|
|
632
673
|
name: string;
|
|
@@ -937,11 +978,13 @@ declare class StowServer {
|
|
|
937
978
|
diverse: (params?: DiverseSearchRequest) => Promise<SimilarSearchResult>;
|
|
938
979
|
text: (params: TextSearchRequest) => Promise<SimilarSearchResult>;
|
|
939
980
|
color: (params: ColorSearchRequest) => Promise<ColorSearchResult>;
|
|
981
|
+
image: (input: SearchByImageInput, options?: SearchByImageOptions) => Promise<SearchByImageResult>;
|
|
940
982
|
};
|
|
941
983
|
private searchSimilar;
|
|
942
984
|
private searchDiverse;
|
|
943
985
|
private searchText;
|
|
944
986
|
private searchColor;
|
|
987
|
+
private searchImage;
|
|
945
988
|
/**
|
|
946
989
|
* Upload a file as a drop (quick share)
|
|
947
990
|
*
|
|
@@ -1026,4 +1069,4 @@ declare class StowServer {
|
|
|
1026
1069
|
private deleteAnchor;
|
|
1027
1070
|
}
|
|
1028
1071
|
|
|
1029
|
-
export { type Anchor, type AnchorSearchResult, type AppliedFilters, type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateAnchorRequest, 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 UpdateAnchorRequest, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
|
|
1072
|
+
export { type Anchor, type AnchorSearchResult, type AppliedFilters, type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateAnchorRequest, 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 SearchByImageInput, type SearchByImageOptions, type SearchByImageResult, type SearchByImageSource, 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 UpdateAnchorRequest, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -627,6 +627,47 @@ interface ColorSearchResultItem {
|
|
|
627
627
|
interface ColorSearchResult {
|
|
628
628
|
results: ColorSearchResultItem[];
|
|
629
629
|
}
|
|
630
|
+
/** Input specifying the image source for search-by-image. Exactly one of url or fileKey. */
|
|
631
|
+
interface SearchByImageInput {
|
|
632
|
+
/** Key of an existing file to use as the image source */
|
|
633
|
+
fileKey?: string;
|
|
634
|
+
/** URL of an external image to download, persist, and embed */
|
|
635
|
+
url?: string;
|
|
636
|
+
}
|
|
637
|
+
/** Options for search-by-image. */
|
|
638
|
+
interface SearchByImageOptions {
|
|
639
|
+
/** Bucket name or ID to scope search */
|
|
640
|
+
bucket?: string;
|
|
641
|
+
/** File keys to exclude from results (e.g. already-seen items). Max 500. */
|
|
642
|
+
excludeKeys?: string[];
|
|
643
|
+
/** Structured post-filters (taxonomy, tag, color, content type, metadata) */
|
|
644
|
+
filters?: SearchFilters;
|
|
645
|
+
/** Opt-in enrichment fields to include in results */
|
|
646
|
+
include?: SearchIncludeField[];
|
|
647
|
+
/** Max results (default 10, max 50) */
|
|
648
|
+
limit?: number;
|
|
649
|
+
/** Custom metadata to attach when persisting a URL-sourced image */
|
|
650
|
+
metadata?: Record<string, string>;
|
|
651
|
+
/** Minimum similarity threshold (0–1, default 0.25) */
|
|
652
|
+
threshold?: number;
|
|
653
|
+
}
|
|
654
|
+
/** Source image metadata returned by search-by-image. */
|
|
655
|
+
interface SearchByImageSource {
|
|
656
|
+
embedding: {
|
|
657
|
+
dimensions: number;
|
|
658
|
+
durationMs: number;
|
|
659
|
+
model: string;
|
|
660
|
+
};
|
|
661
|
+
fileKey: string;
|
|
662
|
+
vector: number[];
|
|
663
|
+
}
|
|
664
|
+
/** Result payload returned by search-by-image. */
|
|
665
|
+
interface SearchByImageResult {
|
|
666
|
+
anchors?: AnchorSearchResult[];
|
|
667
|
+
filtered?: FilteredMetadata;
|
|
668
|
+
results: SearchResultItem[];
|
|
669
|
+
source: SearchByImageSource;
|
|
670
|
+
}
|
|
630
671
|
/** A taxonomy term within a group. */
|
|
631
672
|
interface TaxonomyTerm {
|
|
632
673
|
name: string;
|
|
@@ -937,11 +978,13 @@ declare class StowServer {
|
|
|
937
978
|
diverse: (params?: DiverseSearchRequest) => Promise<SimilarSearchResult>;
|
|
938
979
|
text: (params: TextSearchRequest) => Promise<SimilarSearchResult>;
|
|
939
980
|
color: (params: ColorSearchRequest) => Promise<ColorSearchResult>;
|
|
981
|
+
image: (input: SearchByImageInput, options?: SearchByImageOptions) => Promise<SearchByImageResult>;
|
|
940
982
|
};
|
|
941
983
|
private searchSimilar;
|
|
942
984
|
private searchDiverse;
|
|
943
985
|
private searchText;
|
|
944
986
|
private searchColor;
|
|
987
|
+
private searchImage;
|
|
945
988
|
/**
|
|
946
989
|
* Upload a file as a drop (quick share)
|
|
947
990
|
*
|
|
@@ -1026,4 +1069,4 @@ declare class StowServer {
|
|
|
1026
1069
|
private deleteAnchor;
|
|
1027
1070
|
}
|
|
1028
1071
|
|
|
1029
|
-
export { type Anchor, type AnchorSearchResult, type AppliedFilters, type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateAnchorRequest, 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 UpdateAnchorRequest, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
|
|
1072
|
+
export { type Anchor, type AnchorSearchResult, type AppliedFilters, type BucketResult, type ColorSearchRequest, type ColorSearchResult, type ColorSearchResultItem, type ConfirmUploadRequest, type CreateAnchorRequest, 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 SearchByImageInput, type SearchByImageOptions, type SearchByImageResult, type SearchByImageSource, 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 UpdateAnchorRequest, type UpdateBucketRequest, type UploadResult, type WhoamiResult };
|
package/dist/index.js
CHANGED
|
@@ -951,7 +951,8 @@ var StowServer = class {
|
|
|
951
951
|
similar: (params) => this.searchSimilar(params),
|
|
952
952
|
diverse: (params) => this.searchDiverse(params ?? {}),
|
|
953
953
|
text: (params) => this.searchText(params),
|
|
954
|
-
color: (params) => this.searchColor(params)
|
|
954
|
+
color: (params) => this.searchColor(params),
|
|
955
|
+
image: (input, options) => this.searchImage(input, options)
|
|
955
956
|
};
|
|
956
957
|
}
|
|
957
958
|
searchSimilar(params) {
|
|
@@ -1026,6 +1027,24 @@ var StowServer = class {
|
|
|
1026
1027
|
})
|
|
1027
1028
|
});
|
|
1028
1029
|
}
|
|
1030
|
+
searchImage(input, options) {
|
|
1031
|
+
const bucket = this.resolveBucket(options?.bucket);
|
|
1032
|
+
return this.request("/search/image", {
|
|
1033
|
+
method: "POST",
|
|
1034
|
+
headers: { "Content-Type": "application/json" },
|
|
1035
|
+
body: JSON.stringify({
|
|
1036
|
+
...input.url ? { url: input.url } : {},
|
|
1037
|
+
...input.fileKey ? { fileKey: input.fileKey } : {},
|
|
1038
|
+
...bucket ? { bucket } : {},
|
|
1039
|
+
...options?.limit ? { limit: options.limit } : {},
|
|
1040
|
+
...options?.threshold === void 0 ? {} : { threshold: options.threshold },
|
|
1041
|
+
...options?.excludeKeys?.length ? { excludeKeys: options.excludeKeys } : {},
|
|
1042
|
+
...options?.filters ? { filters: options.filters } : {},
|
|
1043
|
+
...options?.include?.length ? { include: options.include } : {},
|
|
1044
|
+
...options?.metadata ? { metadata: options.metadata } : {}
|
|
1045
|
+
})
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1029
1048
|
// ============================================================
|
|
1030
1049
|
// DROPS - Quick share without buckets
|
|
1031
1050
|
// ============================================================
|
package/dist/index.mjs
CHANGED
|
@@ -926,7 +926,8 @@ var StowServer = class {
|
|
|
926
926
|
similar: (params) => this.searchSimilar(params),
|
|
927
927
|
diverse: (params) => this.searchDiverse(params ?? {}),
|
|
928
928
|
text: (params) => this.searchText(params),
|
|
929
|
-
color: (params) => this.searchColor(params)
|
|
929
|
+
color: (params) => this.searchColor(params),
|
|
930
|
+
image: (input, options) => this.searchImage(input, options)
|
|
930
931
|
};
|
|
931
932
|
}
|
|
932
933
|
searchSimilar(params) {
|
|
@@ -1001,6 +1002,24 @@ var StowServer = class {
|
|
|
1001
1002
|
})
|
|
1002
1003
|
});
|
|
1003
1004
|
}
|
|
1005
|
+
searchImage(input, options) {
|
|
1006
|
+
const bucket = this.resolveBucket(options?.bucket);
|
|
1007
|
+
return this.request("/search/image", {
|
|
1008
|
+
method: "POST",
|
|
1009
|
+
headers: { "Content-Type": "application/json" },
|
|
1010
|
+
body: JSON.stringify({
|
|
1011
|
+
...input.url ? { url: input.url } : {},
|
|
1012
|
+
...input.fileKey ? { fileKey: input.fileKey } : {},
|
|
1013
|
+
...bucket ? { bucket } : {},
|
|
1014
|
+
...options?.limit ? { limit: options.limit } : {},
|
|
1015
|
+
...options?.threshold === void 0 ? {} : { threshold: options.threshold },
|
|
1016
|
+
...options?.excludeKeys?.length ? { excludeKeys: options.excludeKeys } : {},
|
|
1017
|
+
...options?.filters ? { filters: options.filters } : {},
|
|
1018
|
+
...options?.include?.length ? { include: options.include } : {},
|
|
1019
|
+
...options?.metadata ? { metadata: options.metadata } : {}
|
|
1020
|
+
})
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1004
1023
|
// ============================================================
|
|
1005
1024
|
// DROPS - Quick share without buckets
|
|
1006
1025
|
// ============================================================
|