@howells/stow-server
Advanced tools
+61
-1
@@ -456,2 +456,4 @@ /** | ||
| interface SimilarSearchRequest { | ||
| /** Use an anchor's embedding as the query vector */ | ||
| anchorId?: string; | ||
| /** Bucket name or ID to scope search */ | ||
@@ -480,2 +482,4 @@ bucket?: string; | ||
| interface DiverseSearchRequest { | ||
| /** Use an anchor's embedding as the query vector */ | ||
| anchorId?: string; | ||
| /** Bucket name or ID to scope search */ | ||
@@ -534,2 +538,28 @@ bucket?: string; | ||
| } | ||
| /** A text anchor — a named semantic reference point in a bucket's vector space. */ | ||
| interface Anchor { | ||
| bucketId: string; | ||
| createdAt: string; | ||
| id: string; | ||
| label: string | null; | ||
| text: string; | ||
| updatedAt: string; | ||
| } | ||
| /** Input for creating an anchor. */ | ||
| interface CreateAnchorRequest { | ||
| label?: string; | ||
| text: string; | ||
| } | ||
| /** Input for updating an anchor. */ | ||
| interface UpdateAnchorRequest { | ||
| label?: string | null; | ||
| text?: string; | ||
| } | ||
| /** An anchor result returned in search responses. */ | ||
| interface AnchorSearchResult { | ||
| id: string; | ||
| label: string | null; | ||
| similarity: number; | ||
| text: string; | ||
| } | ||
| /** Which filter categories were active in the request. */ | ||
@@ -553,2 +583,3 @@ interface AppliedFilters { | ||
| interface SimilarSearchResult { | ||
| anchors?: AnchorSearchResult[]; | ||
| filtered?: FilteredMetadata; | ||
@@ -971,4 +1002,33 @@ results: SearchResultItem[]; | ||
| private renameProfileCluster; | ||
| /** | ||
| * Anchors namespace for creating, listing, updating, and deleting text anchors. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const anchor = await stow.anchors.create({ text: "minimalist architecture", label: "minimal" }); | ||
| * const results = await stow.search.similar({ anchorId: anchor.id }); | ||
| * ``` | ||
| */ | ||
| get anchors(): { | ||
| create: (params: CreateAnchorRequest) => Promise<Anchor>; | ||
| list: (options?: { | ||
| bucket?: string; | ||
| }) => Promise<{ | ||
| anchors: Anchor[]; | ||
| }>; | ||
| get: (id: string, options?: { | ||
| bucket?: string; | ||
| }) => Promise<Anchor>; | ||
| update: (id: string, params: UpdateAnchorRequest) => Promise<Anchor>; | ||
| delete: (id: string, options?: { | ||
| bucket?: string; | ||
| }) => Promise<void>; | ||
| }; | ||
| private createAnchor; | ||
| private listAnchors; | ||
| private getAnchor; | ||
| private updateAnchor; | ||
| private deleteAnchor; | ||
| } | ||
| 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 }; | ||
| 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 }; |
+61
-1
@@ -456,2 +456,4 @@ /** | ||
| interface SimilarSearchRequest { | ||
| /** Use an anchor's embedding as the query vector */ | ||
| anchorId?: string; | ||
| /** Bucket name or ID to scope search */ | ||
@@ -480,2 +482,4 @@ bucket?: string; | ||
| interface DiverseSearchRequest { | ||
| /** Use an anchor's embedding as the query vector */ | ||
| anchorId?: string; | ||
| /** Bucket name or ID to scope search */ | ||
@@ -534,2 +538,28 @@ bucket?: string; | ||
| } | ||
| /** A text anchor — a named semantic reference point in a bucket's vector space. */ | ||
| interface Anchor { | ||
| bucketId: string; | ||
| createdAt: string; | ||
| id: string; | ||
| label: string | null; | ||
| text: string; | ||
| updatedAt: string; | ||
| } | ||
| /** Input for creating an anchor. */ | ||
| interface CreateAnchorRequest { | ||
| label?: string; | ||
| text: string; | ||
| } | ||
| /** Input for updating an anchor. */ | ||
| interface UpdateAnchorRequest { | ||
| label?: string | null; | ||
| text?: string; | ||
| } | ||
| /** An anchor result returned in search responses. */ | ||
| interface AnchorSearchResult { | ||
| id: string; | ||
| label: string | null; | ||
| similarity: number; | ||
| text: string; | ||
| } | ||
| /** Which filter categories were active in the request. */ | ||
@@ -553,2 +583,3 @@ interface AppliedFilters { | ||
| interface SimilarSearchResult { | ||
| anchors?: AnchorSearchResult[]; | ||
| filtered?: FilteredMetadata; | ||
@@ -971,4 +1002,33 @@ results: SearchResultItem[]; | ||
| private renameProfileCluster; | ||
| /** | ||
| * Anchors namespace for creating, listing, updating, and deleting text anchors. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const anchor = await stow.anchors.create({ text: "minimalist architecture", label: "minimal" }); | ||
| * const results = await stow.search.similar({ anchorId: anchor.id }); | ||
| * ``` | ||
| */ | ||
| get anchors(): { | ||
| create: (params: CreateAnchorRequest) => Promise<Anchor>; | ||
| list: (options?: { | ||
| bucket?: string; | ||
| }) => Promise<{ | ||
| anchors: Anchor[]; | ||
| }>; | ||
| get: (id: string, options?: { | ||
| bucket?: string; | ||
| }) => Promise<Anchor>; | ||
| update: (id: string, params: UpdateAnchorRequest) => Promise<Anchor>; | ||
| delete: (id: string, options?: { | ||
| bucket?: string; | ||
| }) => Promise<void>; | ||
| }; | ||
| private createAnchor; | ||
| private listAnchors; | ||
| private getAnchor; | ||
| private updateAnchor; | ||
| private deleteAnchor; | ||
| } | ||
| 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 }; | ||
| 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 }; |
+82
-3
@@ -288,2 +288,13 @@ "use strict"; | ||
| }); | ||
| var anchorResponseSchema = import_zod.z.object({ | ||
| id: import_zod.z.string(), | ||
| bucketId: import_zod.z.string(), | ||
| label: import_zod.z.string().nullable(), | ||
| text: import_zod.z.string(), | ||
| createdAt: import_zod.z.string(), | ||
| updatedAt: import_zod.z.string() | ||
| }); | ||
| var anchorListResponseSchema = import_zod.z.object({ | ||
| anchors: import_zod.z.array(anchorResponseSchema) | ||
| }); | ||
| var StowServer = class { | ||
@@ -953,2 +964,3 @@ apiKey; | ||
| body: JSON.stringify({ | ||
| ...params.anchorId ? { anchorId: params.anchorId } : {}, | ||
| ...params.fileKey ? { fileKey: params.fileKey } : {}, | ||
@@ -973,2 +985,3 @@ ...params.vector ? { vector: params.vector } : {}, | ||
| body: JSON.stringify({ | ||
| ...params.anchorId ? { anchorId: params.anchorId } : {}, | ||
| ...params.fileKey ? { fileKey: params.fileKey } : {}, | ||
@@ -981,3 +994,3 @@ ...params.vector ? { vector: params.vector } : {}, | ||
| ...params.limit ? { limit: params.limit } : {}, | ||
| ...params.lambda !== void 0 ? { lambda: params.lambda } : {}, | ||
| ...params.lambda === void 0 ? {} : { lambda: params.lambda }, | ||
| ...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {}, | ||
@@ -1015,3 +1028,3 @@ ...params.filters ? { filters: params.filters } : {}, | ||
| ...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {}, | ||
| ...params.minProportion !== void 0 ? { minProportion: params.minProportion } : {}, | ||
| ...params.minProportion === void 0 ? {} : { minProportion: params.minProportion }, | ||
| ...params.dominantOnly ? { dominantOnly: params.dominantOnly } : {} | ||
@@ -1192,3 +1205,3 @@ }) | ||
| body: JSON.stringify({ | ||
| ...params?.clusterCount !== void 0 ? { clusterCount: params.clusterCount } : {} | ||
| ...params?.clusterCount === void 0 ? {} : { clusterCount: params.clusterCount } | ||
| }) | ||
@@ -1211,2 +1224,68 @@ } | ||
| } | ||
| // ============================================================ | ||
| // ANCHORS - Named semantic reference points in vector space | ||
| // ============================================================ | ||
| /** | ||
| * Anchors namespace for creating, listing, updating, and deleting text anchors. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const anchor = await stow.anchors.create({ text: "minimalist architecture", label: "minimal" }); | ||
| * const results = await stow.search.similar({ anchorId: anchor.id }); | ||
| * ``` | ||
| */ | ||
| get anchors() { | ||
| return { | ||
| create: (params) => this.createAnchor(params), | ||
| list: (options) => this.listAnchors(options), | ||
| get: (id, options) => this.getAnchor(id, options), | ||
| update: (id, params) => this.updateAnchor(id, params), | ||
| delete: (id, options) => this.deleteAnchor(id, options) | ||
| }; | ||
| } | ||
| createAnchor(params) { | ||
| return this.request( | ||
| this.withBucket("/anchors"), | ||
| { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify({ | ||
| text: params.text, | ||
| ...params.label ? { label: params.label } : {} | ||
| }) | ||
| }, | ||
| anchorResponseSchema | ||
| ); | ||
| } | ||
| listAnchors(options) { | ||
| return this.request( | ||
| this.withBucket("/anchors", options?.bucket), | ||
| { method: "GET" }, | ||
| anchorListResponseSchema | ||
| ); | ||
| } | ||
| getAnchor(id, options) { | ||
| return this.request( | ||
| this.withBucket(`/anchors/${encodeURIComponent(id)}`, options?.bucket), | ||
| { method: "GET" }, | ||
| anchorResponseSchema | ||
| ); | ||
| } | ||
| updateAnchor(id, params) { | ||
| return this.request( | ||
| this.withBucket(`/anchors/${encodeURIComponent(id)}`), | ||
| { | ||
| method: "PATCH", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify(params) | ||
| }, | ||
| anchorResponseSchema | ||
| ); | ||
| } | ||
| async deleteAnchor(id, options) { | ||
| await this.request( | ||
| this.withBucket(`/anchors/${encodeURIComponent(id)}`, options?.bucket), | ||
| { method: "DELETE" } | ||
| ); | ||
| } | ||
| }; | ||
@@ -1213,0 +1292,0 @@ // Annotate the CommonJS export names for ESM import in node: |
+82
-3
@@ -263,2 +263,13 @@ // src/index.ts | ||
| }); | ||
| var anchorResponseSchema = z.object({ | ||
| id: z.string(), | ||
| bucketId: z.string(), | ||
| label: z.string().nullable(), | ||
| text: z.string(), | ||
| createdAt: z.string(), | ||
| updatedAt: z.string() | ||
| }); | ||
| var anchorListResponseSchema = z.object({ | ||
| anchors: z.array(anchorResponseSchema) | ||
| }); | ||
| var StowServer = class { | ||
@@ -928,2 +939,3 @@ apiKey; | ||
| body: JSON.stringify({ | ||
| ...params.anchorId ? { anchorId: params.anchorId } : {}, | ||
| ...params.fileKey ? { fileKey: params.fileKey } : {}, | ||
@@ -948,2 +960,3 @@ ...params.vector ? { vector: params.vector } : {}, | ||
| body: JSON.stringify({ | ||
| ...params.anchorId ? { anchorId: params.anchorId } : {}, | ||
| ...params.fileKey ? { fileKey: params.fileKey } : {}, | ||
@@ -956,3 +969,3 @@ ...params.vector ? { vector: params.vector } : {}, | ||
| ...params.limit ? { limit: params.limit } : {}, | ||
| ...params.lambda !== void 0 ? { lambda: params.lambda } : {}, | ||
| ...params.lambda === void 0 ? {} : { lambda: params.lambda }, | ||
| ...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {}, | ||
@@ -990,3 +1003,3 @@ ...params.filters ? { filters: params.filters } : {}, | ||
| ...params.excludeKeys?.length ? { excludeKeys: params.excludeKeys } : {}, | ||
| ...params.minProportion !== void 0 ? { minProportion: params.minProportion } : {}, | ||
| ...params.minProportion === void 0 ? {} : { minProportion: params.minProportion }, | ||
| ...params.dominantOnly ? { dominantOnly: params.dominantOnly } : {} | ||
@@ -1167,3 +1180,3 @@ }) | ||
| body: JSON.stringify({ | ||
| ...params?.clusterCount !== void 0 ? { clusterCount: params.clusterCount } : {} | ||
| ...params?.clusterCount === void 0 ? {} : { clusterCount: params.clusterCount } | ||
| }) | ||
@@ -1186,2 +1199,68 @@ } | ||
| } | ||
| // ============================================================ | ||
| // ANCHORS - Named semantic reference points in vector space | ||
| // ============================================================ | ||
| /** | ||
| * Anchors namespace for creating, listing, updating, and deleting text anchors. | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * const anchor = await stow.anchors.create({ text: "minimalist architecture", label: "minimal" }); | ||
| * const results = await stow.search.similar({ anchorId: anchor.id }); | ||
| * ``` | ||
| */ | ||
| get anchors() { | ||
| return { | ||
| create: (params) => this.createAnchor(params), | ||
| list: (options) => this.listAnchors(options), | ||
| get: (id, options) => this.getAnchor(id, options), | ||
| update: (id, params) => this.updateAnchor(id, params), | ||
| delete: (id, options) => this.deleteAnchor(id, options) | ||
| }; | ||
| } | ||
| createAnchor(params) { | ||
| return this.request( | ||
| this.withBucket("/anchors"), | ||
| { | ||
| method: "POST", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify({ | ||
| text: params.text, | ||
| ...params.label ? { label: params.label } : {} | ||
| }) | ||
| }, | ||
| anchorResponseSchema | ||
| ); | ||
| } | ||
| listAnchors(options) { | ||
| return this.request( | ||
| this.withBucket("/anchors", options?.bucket), | ||
| { method: "GET" }, | ||
| anchorListResponseSchema | ||
| ); | ||
| } | ||
| getAnchor(id, options) { | ||
| return this.request( | ||
| this.withBucket(`/anchors/${encodeURIComponent(id)}`, options?.bucket), | ||
| { method: "GET" }, | ||
| anchorResponseSchema | ||
| ); | ||
| } | ||
| updateAnchor(id, params) { | ||
| return this.request( | ||
| this.withBucket(`/anchors/${encodeURIComponent(id)}`), | ||
| { | ||
| method: "PATCH", | ||
| headers: { "Content-Type": "application/json" }, | ||
| body: JSON.stringify(params) | ||
| }, | ||
| anchorResponseSchema | ||
| ); | ||
| } | ||
| async deleteAnchor(id, options) { | ||
| await this.request( | ||
| this.withBucket(`/anchors/${encodeURIComponent(id)}`, options?.bucket), | ||
| { method: "DELETE" } | ||
| ); | ||
| } | ||
| }; | ||
@@ -1188,0 +1267,0 @@ export { |
+1
-1
| { | ||
| "name": "@howells/stow-server", | ||
| "version": "2.0.1", | ||
| "version": "2.1.0", | ||
| "description": "Server-side SDK for Stow file storage", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
152923
6.01%3583
6.48%