@howells/stow-server 0.3.1 → 0.5.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 +47 -4
- package/dist/index.d.ts +47 -4
- package/dist/index.js +46 -9
- package/dist/index.mjs +46 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -174,11 +174,16 @@ interface ListFilesItem {
|
|
|
174
174
|
colorProfile?: FileColorProfile | null;
|
|
175
175
|
colors?: FileColor[];
|
|
176
176
|
duration?: number | null;
|
|
177
|
+
embeddingStatus?: string | null;
|
|
177
178
|
height?: number | null;
|
|
178
179
|
key: string;
|
|
179
180
|
lastModified: string;
|
|
180
181
|
metadata?: Record<string, string>;
|
|
181
182
|
size: number;
|
|
183
|
+
/** Tags attached to this file. Present when `include: ["tags"]` is requested. */
|
|
184
|
+
tags?: FileTag[];
|
|
185
|
+
/** Taxonomy classifications. Present when `include: ["taxonomies"]` is requested. */
|
|
186
|
+
taxonomies?: FileTaxonomy[];
|
|
182
187
|
url: string | null;
|
|
183
188
|
width?: number | null;
|
|
184
189
|
}
|
|
@@ -208,6 +213,25 @@ interface ListDropsResult {
|
|
|
208
213
|
limit: number;
|
|
209
214
|
};
|
|
210
215
|
}
|
|
216
|
+
/** A tag attached to a file, returned when `include: ["tags"]` is requested. */
|
|
217
|
+
interface FileTag {
|
|
218
|
+
color: string | null;
|
|
219
|
+
id: string;
|
|
220
|
+
name: string;
|
|
221
|
+
slug: string;
|
|
222
|
+
}
|
|
223
|
+
/** A taxonomy classification for a file, returned when `include: ["taxonomies"]` is requested. */
|
|
224
|
+
interface FileTaxonomy {
|
|
225
|
+
group: {
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
slug: string;
|
|
229
|
+
};
|
|
230
|
+
id: string;
|
|
231
|
+
name: string;
|
|
232
|
+
similarity: number;
|
|
233
|
+
slug: string;
|
|
234
|
+
}
|
|
211
235
|
/** Full file detail payload returned by `getFile()`. */
|
|
212
236
|
interface FileResult {
|
|
213
237
|
colorProfile: FileColorProfile | null;
|
|
@@ -220,6 +244,10 @@ interface FileResult {
|
|
|
220
244
|
key: string;
|
|
221
245
|
metadata: Record<string, string> | null;
|
|
222
246
|
size: number;
|
|
247
|
+
/** Tags attached to this file. Present when `include: ["tags"]` is requested. */
|
|
248
|
+
tags?: FileTag[];
|
|
249
|
+
/** Taxonomy classifications. Present when `include: ["taxonomies"]` is requested. */
|
|
250
|
+
taxonomies?: FileTaxonomy[];
|
|
223
251
|
url: string | null;
|
|
224
252
|
width: number | null;
|
|
225
253
|
}
|
|
@@ -350,6 +378,8 @@ interface SearchFilters {
|
|
|
350
378
|
}
|
|
351
379
|
/** Optional enrichment blocks that can be included in search responses. */
|
|
352
380
|
type SearchIncludeField = "tags" | "taxonomies" | "colors" | "colorProfile";
|
|
381
|
+
/** Optional enrichment blocks that can be included in file get/list responses. */
|
|
382
|
+
type FileIncludeField = "tags" | "taxonomies";
|
|
353
383
|
/** Input payload for text-based semantic search. */
|
|
354
384
|
interface TextSearchRequest {
|
|
355
385
|
bucket?: string;
|
|
@@ -654,6 +684,8 @@ declare class StowServer {
|
|
|
654
684
|
confirmUpload(request: ConfirmUploadRequest): Promise<UploadResult>;
|
|
655
685
|
/**
|
|
656
686
|
* List files in the bucket
|
|
687
|
+
*
|
|
688
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
657
689
|
*/
|
|
658
690
|
listFiles(options?: {
|
|
659
691
|
prefix?: string;
|
|
@@ -662,6 +694,8 @@ declare class StowServer {
|
|
|
662
694
|
bucket?: string;
|
|
663
695
|
/** Filter by tag slug */
|
|
664
696
|
tag?: string;
|
|
697
|
+
/** Enrichment fields to include in each file item */
|
|
698
|
+
include?: FileIncludeField[];
|
|
665
699
|
}): Promise<ListFilesResult>;
|
|
666
700
|
/**
|
|
667
701
|
* Delete a file by key
|
|
@@ -680,24 +714,33 @@ declare class StowServer {
|
|
|
680
714
|
}>;
|
|
681
715
|
/**
|
|
682
716
|
* Get a single file by key
|
|
717
|
+
*
|
|
718
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
683
719
|
*/
|
|
684
720
|
getFile(key: string, options?: {
|
|
685
721
|
bucket?: string;
|
|
722
|
+
include?: FileIncludeField[];
|
|
686
723
|
}): Promise<FileResult>;
|
|
687
724
|
/**
|
|
688
725
|
* Extract color palette from an image file.
|
|
689
726
|
* Requires a searchable bucket.
|
|
690
727
|
*/
|
|
691
|
-
extractColors(key: string
|
|
728
|
+
extractColors(key: string, options?: {
|
|
729
|
+
bucket?: string;
|
|
730
|
+
}): Promise<TaskTriggerResult>;
|
|
692
731
|
/**
|
|
693
732
|
* Extract dimensions (width/height) from an image or video file.
|
|
694
733
|
*/
|
|
695
|
-
extractDimensions(key: string
|
|
734
|
+
extractDimensions(key: string, options?: {
|
|
735
|
+
bucket?: string;
|
|
736
|
+
}): Promise<TaskTriggerResult>;
|
|
696
737
|
/**
|
|
697
738
|
* Generate a vector embedding for an image file.
|
|
698
739
|
* Requires a searchable bucket.
|
|
699
740
|
*/
|
|
700
|
-
embed(key: string
|
|
741
|
+
embed(key: string, options?: {
|
|
742
|
+
bucket?: string;
|
|
743
|
+
}): Promise<TaskTriggerResult>;
|
|
701
744
|
/**
|
|
702
745
|
* Replace a file's content by fetching from a new URL.
|
|
703
746
|
*
|
|
@@ -829,4 +872,4 @@ declare class StowServer {
|
|
|
829
872
|
private renameProfileCluster;
|
|
830
873
|
}
|
|
831
874
|
|
|
832
|
-
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 FileResult, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -174,11 +174,16 @@ interface ListFilesItem {
|
|
|
174
174
|
colorProfile?: FileColorProfile | null;
|
|
175
175
|
colors?: FileColor[];
|
|
176
176
|
duration?: number | null;
|
|
177
|
+
embeddingStatus?: string | null;
|
|
177
178
|
height?: number | null;
|
|
178
179
|
key: string;
|
|
179
180
|
lastModified: string;
|
|
180
181
|
metadata?: Record<string, string>;
|
|
181
182
|
size: number;
|
|
183
|
+
/** Tags attached to this file. Present when `include: ["tags"]` is requested. */
|
|
184
|
+
tags?: FileTag[];
|
|
185
|
+
/** Taxonomy classifications. Present when `include: ["taxonomies"]` is requested. */
|
|
186
|
+
taxonomies?: FileTaxonomy[];
|
|
182
187
|
url: string | null;
|
|
183
188
|
width?: number | null;
|
|
184
189
|
}
|
|
@@ -208,6 +213,25 @@ interface ListDropsResult {
|
|
|
208
213
|
limit: number;
|
|
209
214
|
};
|
|
210
215
|
}
|
|
216
|
+
/** A tag attached to a file, returned when `include: ["tags"]` is requested. */
|
|
217
|
+
interface FileTag {
|
|
218
|
+
color: string | null;
|
|
219
|
+
id: string;
|
|
220
|
+
name: string;
|
|
221
|
+
slug: string;
|
|
222
|
+
}
|
|
223
|
+
/** A taxonomy classification for a file, returned when `include: ["taxonomies"]` is requested. */
|
|
224
|
+
interface FileTaxonomy {
|
|
225
|
+
group: {
|
|
226
|
+
id: string;
|
|
227
|
+
name: string;
|
|
228
|
+
slug: string;
|
|
229
|
+
};
|
|
230
|
+
id: string;
|
|
231
|
+
name: string;
|
|
232
|
+
similarity: number;
|
|
233
|
+
slug: string;
|
|
234
|
+
}
|
|
211
235
|
/** Full file detail payload returned by `getFile()`. */
|
|
212
236
|
interface FileResult {
|
|
213
237
|
colorProfile: FileColorProfile | null;
|
|
@@ -220,6 +244,10 @@ interface FileResult {
|
|
|
220
244
|
key: string;
|
|
221
245
|
metadata: Record<string, string> | null;
|
|
222
246
|
size: number;
|
|
247
|
+
/** Tags attached to this file. Present when `include: ["tags"]` is requested. */
|
|
248
|
+
tags?: FileTag[];
|
|
249
|
+
/** Taxonomy classifications. Present when `include: ["taxonomies"]` is requested. */
|
|
250
|
+
taxonomies?: FileTaxonomy[];
|
|
223
251
|
url: string | null;
|
|
224
252
|
width: number | null;
|
|
225
253
|
}
|
|
@@ -350,6 +378,8 @@ interface SearchFilters {
|
|
|
350
378
|
}
|
|
351
379
|
/** Optional enrichment blocks that can be included in search responses. */
|
|
352
380
|
type SearchIncludeField = "tags" | "taxonomies" | "colors" | "colorProfile";
|
|
381
|
+
/** Optional enrichment blocks that can be included in file get/list responses. */
|
|
382
|
+
type FileIncludeField = "tags" | "taxonomies";
|
|
353
383
|
/** Input payload for text-based semantic search. */
|
|
354
384
|
interface TextSearchRequest {
|
|
355
385
|
bucket?: string;
|
|
@@ -654,6 +684,8 @@ declare class StowServer {
|
|
|
654
684
|
confirmUpload(request: ConfirmUploadRequest): Promise<UploadResult>;
|
|
655
685
|
/**
|
|
656
686
|
* List files in the bucket
|
|
687
|
+
*
|
|
688
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
657
689
|
*/
|
|
658
690
|
listFiles(options?: {
|
|
659
691
|
prefix?: string;
|
|
@@ -662,6 +694,8 @@ declare class StowServer {
|
|
|
662
694
|
bucket?: string;
|
|
663
695
|
/** Filter by tag slug */
|
|
664
696
|
tag?: string;
|
|
697
|
+
/** Enrichment fields to include in each file item */
|
|
698
|
+
include?: FileIncludeField[];
|
|
665
699
|
}): Promise<ListFilesResult>;
|
|
666
700
|
/**
|
|
667
701
|
* Delete a file by key
|
|
@@ -680,24 +714,33 @@ declare class StowServer {
|
|
|
680
714
|
}>;
|
|
681
715
|
/**
|
|
682
716
|
* Get a single file by key
|
|
717
|
+
*
|
|
718
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
683
719
|
*/
|
|
684
720
|
getFile(key: string, options?: {
|
|
685
721
|
bucket?: string;
|
|
722
|
+
include?: FileIncludeField[];
|
|
686
723
|
}): Promise<FileResult>;
|
|
687
724
|
/**
|
|
688
725
|
* Extract color palette from an image file.
|
|
689
726
|
* Requires a searchable bucket.
|
|
690
727
|
*/
|
|
691
|
-
extractColors(key: string
|
|
728
|
+
extractColors(key: string, options?: {
|
|
729
|
+
bucket?: string;
|
|
730
|
+
}): Promise<TaskTriggerResult>;
|
|
692
731
|
/**
|
|
693
732
|
* Extract dimensions (width/height) from an image or video file.
|
|
694
733
|
*/
|
|
695
|
-
extractDimensions(key: string
|
|
734
|
+
extractDimensions(key: string, options?: {
|
|
735
|
+
bucket?: string;
|
|
736
|
+
}): Promise<TaskTriggerResult>;
|
|
696
737
|
/**
|
|
697
738
|
* Generate a vector embedding for an image file.
|
|
698
739
|
* Requires a searchable bucket.
|
|
699
740
|
*/
|
|
700
|
-
embed(key: string
|
|
741
|
+
embed(key: string, options?: {
|
|
742
|
+
bucket?: string;
|
|
743
|
+
}): Promise<TaskTriggerResult>;
|
|
701
744
|
/**
|
|
702
745
|
* Replace a file's content by fetching from a new URL.
|
|
703
746
|
*
|
|
@@ -829,4 +872,4 @@ declare class StowServer {
|
|
|
829
872
|
private renameProfileCluster;
|
|
830
873
|
}
|
|
831
874
|
|
|
832
|
-
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 FileResult, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,23 @@ var whoamiSchema = import_zod.z.object({
|
|
|
105
105
|
permissions: import_zod.z.record(import_zod.z.string(), import_zod.z.boolean())
|
|
106
106
|
}).optional()
|
|
107
107
|
});
|
|
108
|
+
var fileTagSchema = import_zod.z.object({
|
|
109
|
+
id: import_zod.z.string(),
|
|
110
|
+
name: import_zod.z.string(),
|
|
111
|
+
slug: import_zod.z.string(),
|
|
112
|
+
color: import_zod.z.string().nullable()
|
|
113
|
+
});
|
|
114
|
+
var fileTaxonomySchema = import_zod.z.object({
|
|
115
|
+
id: import_zod.z.string(),
|
|
116
|
+
name: import_zod.z.string(),
|
|
117
|
+
slug: import_zod.z.string(),
|
|
118
|
+
similarity: import_zod.z.number(),
|
|
119
|
+
group: import_zod.z.object({
|
|
120
|
+
id: import_zod.z.string(),
|
|
121
|
+
name: import_zod.z.string(),
|
|
122
|
+
slug: import_zod.z.string()
|
|
123
|
+
})
|
|
124
|
+
});
|
|
108
125
|
var listFilesSchema = import_zod.z.object({
|
|
109
126
|
files: import_zod.z.array(
|
|
110
127
|
import_zod.z.object({
|
|
@@ -115,9 +132,12 @@ var listFilesSchema = import_zod.z.object({
|
|
|
115
132
|
width: import_zod.z.number().nullable().optional(),
|
|
116
133
|
height: import_zod.z.number().nullable().optional(),
|
|
117
134
|
duration: import_zod.z.number().nullable().optional(),
|
|
135
|
+
embeddingStatus: import_zod.z.string().nullable().optional(),
|
|
118
136
|
metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional(),
|
|
119
137
|
colorProfile: fileColorProfileSchema.nullable().optional(),
|
|
120
|
-
colors: import_zod.z.array(fileColorSchema).optional()
|
|
138
|
+
colors: import_zod.z.array(fileColorSchema).optional(),
|
|
139
|
+
tags: import_zod.z.array(fileTagSchema).optional(),
|
|
140
|
+
taxonomies: import_zod.z.array(fileTaxonomySchema).optional()
|
|
121
141
|
})
|
|
122
142
|
),
|
|
123
143
|
nextCursor: import_zod.z.string().nullable()
|
|
@@ -192,7 +212,9 @@ var fileResultSchema = import_zod.z.object({
|
|
|
192
212
|
colorProfile: fileColorProfileSchema.nullable(),
|
|
193
213
|
colors: import_zod.z.array(fileColorSchema),
|
|
194
214
|
embeddingStatus: import_zod.z.string().nullable(),
|
|
195
|
-
createdAt: import_zod.z.string()
|
|
215
|
+
createdAt: import_zod.z.string(),
|
|
216
|
+
tags: import_zod.z.array(fileTagSchema).optional(),
|
|
217
|
+
taxonomies: import_zod.z.array(fileTaxonomySchema).optional()
|
|
196
218
|
});
|
|
197
219
|
var profileClusterResultSchema = import_zod.z.object({
|
|
198
220
|
id: import_zod.z.string(),
|
|
@@ -615,6 +637,8 @@ var StowServer = class {
|
|
|
615
637
|
}
|
|
616
638
|
/**
|
|
617
639
|
* List files in the bucket
|
|
640
|
+
*
|
|
641
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
618
642
|
*/
|
|
619
643
|
listFiles(options) {
|
|
620
644
|
const params = new URLSearchParams();
|
|
@@ -630,6 +654,9 @@ var StowServer = class {
|
|
|
630
654
|
if (options?.tag) {
|
|
631
655
|
params.set("tag", options.tag);
|
|
632
656
|
}
|
|
657
|
+
if (options?.include?.length) {
|
|
658
|
+
params.set("include", options.include.join(","));
|
|
659
|
+
}
|
|
633
660
|
const path = `/api/files?${params}`;
|
|
634
661
|
return this.request(
|
|
635
662
|
this.withBucket(path, options?.bucket),
|
|
@@ -659,9 +686,16 @@ var StowServer = class {
|
|
|
659
686
|
}
|
|
660
687
|
/**
|
|
661
688
|
* Get a single file by key
|
|
689
|
+
*
|
|
690
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
662
691
|
*/
|
|
663
692
|
getFile(key, options) {
|
|
664
|
-
const
|
|
693
|
+
const params = new URLSearchParams();
|
|
694
|
+
if (options?.include?.length) {
|
|
695
|
+
params.set("include", options.include.join(","));
|
|
696
|
+
}
|
|
697
|
+
const qs = params.toString();
|
|
698
|
+
const path = `/api/files/${encodeURIComponent(key)}${qs ? `?${qs}` : ""}`;
|
|
665
699
|
return this.request(
|
|
666
700
|
this.withBucket(path, options?.bucket),
|
|
667
701
|
{ method: "GET" },
|
|
@@ -672,9 +706,10 @@ var StowServer = class {
|
|
|
672
706
|
* Extract color palette from an image file.
|
|
673
707
|
* Requires a searchable bucket.
|
|
674
708
|
*/
|
|
675
|
-
extractColors(key) {
|
|
709
|
+
extractColors(key, options) {
|
|
710
|
+
const path = `/api/files/${encodeURIComponent(key)}/colors`;
|
|
676
711
|
return this.request(
|
|
677
|
-
|
|
712
|
+
this.withBucket(path, options?.bucket),
|
|
678
713
|
{ method: "POST" },
|
|
679
714
|
taskTriggerResultSchema
|
|
680
715
|
);
|
|
@@ -682,9 +717,10 @@ var StowServer = class {
|
|
|
682
717
|
/**
|
|
683
718
|
* Extract dimensions (width/height) from an image or video file.
|
|
684
719
|
*/
|
|
685
|
-
extractDimensions(key) {
|
|
720
|
+
extractDimensions(key, options) {
|
|
721
|
+
const path = `/api/files/${encodeURIComponent(key)}/dimensions`;
|
|
686
722
|
return this.request(
|
|
687
|
-
|
|
723
|
+
this.withBucket(path, options?.bucket),
|
|
688
724
|
{ method: "POST" },
|
|
689
725
|
taskTriggerResultSchema
|
|
690
726
|
);
|
|
@@ -693,9 +729,10 @@ var StowServer = class {
|
|
|
693
729
|
* Generate a vector embedding for an image file.
|
|
694
730
|
* Requires a searchable bucket.
|
|
695
731
|
*/
|
|
696
|
-
embed(key) {
|
|
732
|
+
embed(key, options) {
|
|
733
|
+
const path = `/api/files/${encodeURIComponent(key)}/embedding`;
|
|
697
734
|
return this.request(
|
|
698
|
-
|
|
735
|
+
this.withBucket(path, options?.bucket),
|
|
699
736
|
{ method: "POST" },
|
|
700
737
|
taskTriggerResultSchema
|
|
701
738
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -80,6 +80,23 @@ var whoamiSchema = z.object({
|
|
|
80
80
|
permissions: z.record(z.string(), z.boolean())
|
|
81
81
|
}).optional()
|
|
82
82
|
});
|
|
83
|
+
var fileTagSchema = z.object({
|
|
84
|
+
id: z.string(),
|
|
85
|
+
name: z.string(),
|
|
86
|
+
slug: z.string(),
|
|
87
|
+
color: z.string().nullable()
|
|
88
|
+
});
|
|
89
|
+
var fileTaxonomySchema = z.object({
|
|
90
|
+
id: z.string(),
|
|
91
|
+
name: z.string(),
|
|
92
|
+
slug: z.string(),
|
|
93
|
+
similarity: z.number(),
|
|
94
|
+
group: z.object({
|
|
95
|
+
id: z.string(),
|
|
96
|
+
name: z.string(),
|
|
97
|
+
slug: z.string()
|
|
98
|
+
})
|
|
99
|
+
});
|
|
83
100
|
var listFilesSchema = z.object({
|
|
84
101
|
files: z.array(
|
|
85
102
|
z.object({
|
|
@@ -90,9 +107,12 @@ var listFilesSchema = z.object({
|
|
|
90
107
|
width: z.number().nullable().optional(),
|
|
91
108
|
height: z.number().nullable().optional(),
|
|
92
109
|
duration: z.number().nullable().optional(),
|
|
110
|
+
embeddingStatus: z.string().nullable().optional(),
|
|
93
111
|
metadata: z.record(z.string(), z.string()).optional(),
|
|
94
112
|
colorProfile: fileColorProfileSchema.nullable().optional(),
|
|
95
|
-
colors: z.array(fileColorSchema).optional()
|
|
113
|
+
colors: z.array(fileColorSchema).optional(),
|
|
114
|
+
tags: z.array(fileTagSchema).optional(),
|
|
115
|
+
taxonomies: z.array(fileTaxonomySchema).optional()
|
|
96
116
|
})
|
|
97
117
|
),
|
|
98
118
|
nextCursor: z.string().nullable()
|
|
@@ -167,7 +187,9 @@ var fileResultSchema = z.object({
|
|
|
167
187
|
colorProfile: fileColorProfileSchema.nullable(),
|
|
168
188
|
colors: z.array(fileColorSchema),
|
|
169
189
|
embeddingStatus: z.string().nullable(),
|
|
170
|
-
createdAt: z.string()
|
|
190
|
+
createdAt: z.string(),
|
|
191
|
+
tags: z.array(fileTagSchema).optional(),
|
|
192
|
+
taxonomies: z.array(fileTaxonomySchema).optional()
|
|
171
193
|
});
|
|
172
194
|
var profileClusterResultSchema = z.object({
|
|
173
195
|
id: z.string(),
|
|
@@ -590,6 +612,8 @@ var StowServer = class {
|
|
|
590
612
|
}
|
|
591
613
|
/**
|
|
592
614
|
* List files in the bucket
|
|
615
|
+
*
|
|
616
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
593
617
|
*/
|
|
594
618
|
listFiles(options) {
|
|
595
619
|
const params = new URLSearchParams();
|
|
@@ -605,6 +629,9 @@ var StowServer = class {
|
|
|
605
629
|
if (options?.tag) {
|
|
606
630
|
params.set("tag", options.tag);
|
|
607
631
|
}
|
|
632
|
+
if (options?.include?.length) {
|
|
633
|
+
params.set("include", options.include.join(","));
|
|
634
|
+
}
|
|
608
635
|
const path = `/api/files?${params}`;
|
|
609
636
|
return this.request(
|
|
610
637
|
this.withBucket(path, options?.bucket),
|
|
@@ -634,9 +661,16 @@ var StowServer = class {
|
|
|
634
661
|
}
|
|
635
662
|
/**
|
|
636
663
|
* Get a single file by key
|
|
664
|
+
*
|
|
665
|
+
* @param options.include - Optional enrichment fields: `"tags"`, `"taxonomies"`
|
|
637
666
|
*/
|
|
638
667
|
getFile(key, options) {
|
|
639
|
-
const
|
|
668
|
+
const params = new URLSearchParams();
|
|
669
|
+
if (options?.include?.length) {
|
|
670
|
+
params.set("include", options.include.join(","));
|
|
671
|
+
}
|
|
672
|
+
const qs = params.toString();
|
|
673
|
+
const path = `/api/files/${encodeURIComponent(key)}${qs ? `?${qs}` : ""}`;
|
|
640
674
|
return this.request(
|
|
641
675
|
this.withBucket(path, options?.bucket),
|
|
642
676
|
{ method: "GET" },
|
|
@@ -647,9 +681,10 @@ var StowServer = class {
|
|
|
647
681
|
* Extract color palette from an image file.
|
|
648
682
|
* Requires a searchable bucket.
|
|
649
683
|
*/
|
|
650
|
-
extractColors(key) {
|
|
684
|
+
extractColors(key, options) {
|
|
685
|
+
const path = `/api/files/${encodeURIComponent(key)}/colors`;
|
|
651
686
|
return this.request(
|
|
652
|
-
|
|
687
|
+
this.withBucket(path, options?.bucket),
|
|
653
688
|
{ method: "POST" },
|
|
654
689
|
taskTriggerResultSchema
|
|
655
690
|
);
|
|
@@ -657,9 +692,10 @@ var StowServer = class {
|
|
|
657
692
|
/**
|
|
658
693
|
* Extract dimensions (width/height) from an image or video file.
|
|
659
694
|
*/
|
|
660
|
-
extractDimensions(key) {
|
|
695
|
+
extractDimensions(key, options) {
|
|
696
|
+
const path = `/api/files/${encodeURIComponent(key)}/dimensions`;
|
|
661
697
|
return this.request(
|
|
662
|
-
|
|
698
|
+
this.withBucket(path, options?.bucket),
|
|
663
699
|
{ method: "POST" },
|
|
664
700
|
taskTriggerResultSchema
|
|
665
701
|
);
|
|
@@ -668,9 +704,10 @@ var StowServer = class {
|
|
|
668
704
|
* Generate a vector embedding for an image file.
|
|
669
705
|
* Requires a searchable bucket.
|
|
670
706
|
*/
|
|
671
|
-
embed(key) {
|
|
707
|
+
embed(key, options) {
|
|
708
|
+
const path = `/api/files/${encodeURIComponent(key)}/embedding`;
|
|
672
709
|
return this.request(
|
|
673
|
-
|
|
710
|
+
this.withBucket(path, options?.bucket),
|
|
674
711
|
{ method: "POST" },
|
|
675
712
|
taskTriggerResultSchema
|
|
676
713
|
);
|