@howells/stow-server 2.1.0 → 2.2.1
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 +23 -4
- package/dist/index.mjs +23 -4
- package/package.json +10 -10
- package/LICENSE +0 -21
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
|
@@ -881,17 +881,17 @@ var StowServer = class {
|
|
|
881
881
|
};
|
|
882
882
|
}
|
|
883
883
|
listTags() {
|
|
884
|
-
return this.request("/tags", { method: "GET" });
|
|
884
|
+
return this.request(this.withBucket("/tags"), { method: "GET" });
|
|
885
885
|
}
|
|
886
886
|
createTag(params) {
|
|
887
|
-
return this.request("/tags", {
|
|
887
|
+
return this.request(this.withBucket("/tags"), {
|
|
888
888
|
method: "POST",
|
|
889
889
|
headers: { "Content-Type": "application/json" },
|
|
890
890
|
body: JSON.stringify(params)
|
|
891
891
|
});
|
|
892
892
|
}
|
|
893
893
|
async deleteTag(id) {
|
|
894
|
-
await this.request(`/tags/${encodeURIComponent(id)}
|
|
894
|
+
await this.request(this.withBucket(`/tags/${encodeURIComponent(id)}`), {
|
|
895
895
|
method: "DELETE"
|
|
896
896
|
});
|
|
897
897
|
}
|
|
@@ -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
|
@@ -856,17 +856,17 @@ var StowServer = class {
|
|
|
856
856
|
};
|
|
857
857
|
}
|
|
858
858
|
listTags() {
|
|
859
|
-
return this.request("/tags", { method: "GET" });
|
|
859
|
+
return this.request(this.withBucket("/tags"), { method: "GET" });
|
|
860
860
|
}
|
|
861
861
|
createTag(params) {
|
|
862
|
-
return this.request("/tags", {
|
|
862
|
+
return this.request(this.withBucket("/tags"), {
|
|
863
863
|
method: "POST",
|
|
864
864
|
headers: { "Content-Type": "application/json" },
|
|
865
865
|
body: JSON.stringify(params)
|
|
866
866
|
});
|
|
867
867
|
}
|
|
868
868
|
async deleteTag(id) {
|
|
869
|
-
await this.request(`/tags/${encodeURIComponent(id)}
|
|
869
|
+
await this.request(this.withBucket(`/tags/${encodeURIComponent(id)}`), {
|
|
870
870
|
method: "DELETE"
|
|
871
871
|
});
|
|
872
872
|
}
|
|
@@ -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
|
// ============================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howells/stow-server",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
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.5.0",
|
|
37
44
|
"tsup": "^8.5.1",
|
|
38
45
|
"typescript": "^5.9.3",
|
|
39
46
|
"vitest": "^4.1.0",
|
|
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.
|