@howells/stow-server 0.3.2 → 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 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,9 +714,12 @@ 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.
@@ -835,4 +872,4 @@ declare class StowServer {
835
872
  private renameProfileCluster;
836
873
  }
837
874
 
838
- 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,9 +714,12 @@ 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.
@@ -835,4 +872,4 @@ declare class StowServer {
835
872
  private renameProfileCluster;
836
873
  }
837
874
 
838
- 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 path = `/api/files/${encodeURIComponent(key)}`;
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" },
@@ -673,7 +707,7 @@ var StowServer = class {
673
707
  * Requires a searchable bucket.
674
708
  */
675
709
  extractColors(key, options) {
676
- const path = `/api/files/${encodeURIComponent(key)}/extract-colors`;
710
+ const path = `/api/files/${encodeURIComponent(key)}/colors`;
677
711
  return this.request(
678
712
  this.withBucket(path, options?.bucket),
679
713
  { method: "POST" },
@@ -684,7 +718,7 @@ var StowServer = class {
684
718
  * Extract dimensions (width/height) from an image or video file.
685
719
  */
686
720
  extractDimensions(key, options) {
687
- const path = `/api/files/${encodeURIComponent(key)}/extract-dimensions`;
721
+ const path = `/api/files/${encodeURIComponent(key)}/dimensions`;
688
722
  return this.request(
689
723
  this.withBucket(path, options?.bucket),
690
724
  { method: "POST" },
@@ -696,7 +730,7 @@ var StowServer = class {
696
730
  * Requires a searchable bucket.
697
731
  */
698
732
  embed(key, options) {
699
- const path = `/api/files/${encodeURIComponent(key)}/embed`;
733
+ const path = `/api/files/${encodeURIComponent(key)}/embedding`;
700
734
  return this.request(
701
735
  this.withBucket(path, options?.bucket),
702
736
  { method: "POST" },
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 path = `/api/files/${encodeURIComponent(key)}`;
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" },
@@ -648,7 +682,7 @@ var StowServer = class {
648
682
  * Requires a searchable bucket.
649
683
  */
650
684
  extractColors(key, options) {
651
- const path = `/api/files/${encodeURIComponent(key)}/extract-colors`;
685
+ const path = `/api/files/${encodeURIComponent(key)}/colors`;
652
686
  return this.request(
653
687
  this.withBucket(path, options?.bucket),
654
688
  { method: "POST" },
@@ -659,7 +693,7 @@ var StowServer = class {
659
693
  * Extract dimensions (width/height) from an image or video file.
660
694
  */
661
695
  extractDimensions(key, options) {
662
- const path = `/api/files/${encodeURIComponent(key)}/extract-dimensions`;
696
+ const path = `/api/files/${encodeURIComponent(key)}/dimensions`;
663
697
  return this.request(
664
698
  this.withBucket(path, options?.bucket),
665
699
  { method: "POST" },
@@ -671,7 +705,7 @@ var StowServer = class {
671
705
  * Requires a searchable bucket.
672
706
  */
673
707
  embed(key, options) {
674
- const path = `/api/files/${encodeURIComponent(key)}/embed`;
708
+ const path = `/api/files/${encodeURIComponent(key)}/embedding`;
675
709
  return this.request(
676
710
  this.withBucket(path, options?.bucket),
677
711
  { method: "POST" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/stow-server",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "Server-side SDK for Stow file storage",
5
5
  "license": "MIT",
6
6
  "repository": {