@howells/stow-server 2.0.0 → 2.0.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 CHANGED
@@ -520,10 +520,12 @@ interface SearchResultItem {
520
520
  name: string;
521
521
  }>;
522
522
  taxonomies?: Array<{
523
- slug: string;
524
- name: string;
523
+ externalUri: string | null;
525
524
  group: string;
525
+ name: string;
526
526
  similarity: number;
527
+ slug: string;
528
+ source: string;
527
529
  }>;
528
530
  width?: number | null;
529
531
  }
@@ -938,19 +940,19 @@ declare class StowServer {
938
940
  */
939
941
  get profiles(): {
940
942
  create: (params?: ProfileCreateRequest) => Promise<ProfileResult>;
941
- get: (id: string) => Promise<ProfileResult>;
942
- delete: (id: string) => Promise<void>;
943
+ get: (id: string, bucket?: string) => Promise<ProfileResult>;
944
+ delete: (id: string, bucket?: string) => Promise<void>;
943
945
  addFiles: (id: string, fileKeys: string[], bucket?: string) => Promise<ProfileFilesResult>;
944
946
  removeFiles: (id: string, fileKeys: string[], bucket?: string) => Promise<ProfileFilesResult>;
945
947
  signal: (id: string, signals: ProfileSignalInput[], bucket?: string) => Promise<ProfileSignalsResponse>;
946
- deleteSignals: (id: string, signalIds: string[]) => Promise<DeleteProfileSignalsResult>;
947
- clusters: (id: string) => Promise<{
948
+ deleteSignals: (id: string, signalIds: string[], bucket?: string) => Promise<DeleteProfileSignalsResult>;
949
+ clusters: (id: string, bucket?: string) => Promise<{
948
950
  profileId: string;
949
951
  signalCount: number;
950
952
  clusters: ProfileClusterResult[];
951
953
  }>;
952
- recluster: (id: string, params?: ReclusterRequest) => Promise<ReclusterResult>;
953
- renameCluster: (profileId: string, clusterId: string, params: RenameClusterRequest) => Promise<ProfileClusterResult>;
954
+ recluster: (id: string, params?: ReclusterRequest, bucket?: string) => Promise<ReclusterResult>;
955
+ renameCluster: (profileId: string, clusterId: string, params: RenameClusterRequest, bucket?: string) => Promise<ProfileClusterResult>;
954
956
  };
955
957
  private createProfile;
956
958
  private getProfile;
package/dist/index.d.ts CHANGED
@@ -520,10 +520,12 @@ interface SearchResultItem {
520
520
  name: string;
521
521
  }>;
522
522
  taxonomies?: Array<{
523
- slug: string;
524
- name: string;
523
+ externalUri: string | null;
525
524
  group: string;
525
+ name: string;
526
526
  similarity: number;
527
+ slug: string;
528
+ source: string;
527
529
  }>;
528
530
  width?: number | null;
529
531
  }
@@ -938,19 +940,19 @@ declare class StowServer {
938
940
  */
939
941
  get profiles(): {
940
942
  create: (params?: ProfileCreateRequest) => Promise<ProfileResult>;
941
- get: (id: string) => Promise<ProfileResult>;
942
- delete: (id: string) => Promise<void>;
943
+ get: (id: string, bucket?: string) => Promise<ProfileResult>;
944
+ delete: (id: string, bucket?: string) => Promise<void>;
943
945
  addFiles: (id: string, fileKeys: string[], bucket?: string) => Promise<ProfileFilesResult>;
944
946
  removeFiles: (id: string, fileKeys: string[], bucket?: string) => Promise<ProfileFilesResult>;
945
947
  signal: (id: string, signals: ProfileSignalInput[], bucket?: string) => Promise<ProfileSignalsResponse>;
946
- deleteSignals: (id: string, signalIds: string[]) => Promise<DeleteProfileSignalsResult>;
947
- clusters: (id: string) => Promise<{
948
+ deleteSignals: (id: string, signalIds: string[], bucket?: string) => Promise<DeleteProfileSignalsResult>;
949
+ clusters: (id: string, bucket?: string) => Promise<{
948
950
  profileId: string;
949
951
  signalCount: number;
950
952
  clusters: ProfileClusterResult[];
951
953
  }>;
952
- recluster: (id: string, params?: ReclusterRequest) => Promise<ReclusterResult>;
953
- renameCluster: (profileId: string, clusterId: string, params: RenameClusterRequest) => Promise<ProfileClusterResult>;
954
+ recluster: (id: string, params?: ReclusterRequest, bucket?: string) => Promise<ReclusterResult>;
955
+ renameCluster: (profileId: string, clusterId: string, params: RenameClusterRequest, bucket?: string) => Promise<ProfileClusterResult>;
954
956
  };
955
957
  private createProfile;
956
958
  private getProfile;
package/dist/index.js CHANGED
@@ -1089,89 +1089,80 @@ var StowServer = class {
1089
1089
  get profiles() {
1090
1090
  return {
1091
1091
  create: (params) => this.createProfile(params),
1092
- get: (id) => this.getProfile(id),
1093
- delete: (id) => this.deleteProfile(id),
1092
+ get: (id, bucket) => this.getProfile(id, bucket),
1093
+ delete: (id, bucket) => this.deleteProfile(id, bucket),
1094
1094
  addFiles: (id, fileKeys, bucket) => this.addProfileFiles(id, fileKeys, bucket),
1095
1095
  removeFiles: (id, fileKeys, bucket) => this.removeProfileFiles(id, fileKeys, bucket),
1096
1096
  signal: (id, signals, bucket) => this.signalProfile(id, signals, bucket),
1097
- deleteSignals: (id, signalIds) => this.deleteProfileSignals(id, signalIds),
1098
- clusters: (id) => this.getProfileClusters(id),
1099
- recluster: (id, params) => this.reclusterProfile(id, params),
1100
- renameCluster: (profileId, clusterId, params) => this.renameProfileCluster(profileId, clusterId, params)
1097
+ deleteSignals: (id, signalIds, bucket) => this.deleteProfileSignals(id, signalIds, bucket),
1098
+ clusters: (id, bucket) => this.getProfileClusters(id, bucket),
1099
+ recluster: (id, params, bucket) => this.reclusterProfile(id, params, bucket),
1100
+ renameCluster: (profileId, clusterId, params, bucket) => this.renameProfileCluster(profileId, clusterId, params, bucket)
1101
1101
  };
1102
1102
  }
1103
1103
  createProfile(params) {
1104
1104
  return this.request(
1105
- "/profiles",
1105
+ this.withBucket("/profiles", params?.bucket),
1106
1106
  {
1107
1107
  method: "POST",
1108
1108
  headers: { "Content-Type": "application/json" },
1109
1109
  body: JSON.stringify({
1110
1110
  ...params?.name ? { name: params.name } : {},
1111
- ...params?.fileKeys ? { fileKeys: params.fileKeys } : {},
1112
- ...params?.bucket ? { bucket: params.bucket } : {}
1111
+ ...params?.fileKeys ? { fileKeys: params.fileKeys } : {}
1113
1112
  })
1114
1113
  },
1115
1114
  profileResultSchema
1116
1115
  );
1117
1116
  }
1118
- getProfile(id) {
1117
+ getProfile(id, bucket) {
1119
1118
  return this.request(
1120
- `/profiles/${encodeURIComponent(id)}`,
1119
+ this.withBucket(`/profiles/${encodeURIComponent(id)}`, bucket),
1121
1120
  { method: "GET" },
1122
1121
  profileResultSchema
1123
1122
  );
1124
1123
  }
1125
- async deleteProfile(id) {
1126
- await this.request(`/profiles/${encodeURIComponent(id)}`, {
1127
- method: "DELETE"
1128
- });
1124
+ async deleteProfile(id, bucket) {
1125
+ await this.request(
1126
+ this.withBucket(`/profiles/${encodeURIComponent(id)}`, bucket),
1127
+ { method: "DELETE" }
1128
+ );
1129
1129
  }
1130
1130
  addProfileFiles(id, fileKeys, bucket) {
1131
1131
  return this.request(
1132
- `/profiles/${encodeURIComponent(id)}/files`,
1132
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/files`, bucket),
1133
1133
  {
1134
1134
  method: "POST",
1135
1135
  headers: { "Content-Type": "application/json" },
1136
- body: JSON.stringify({
1137
- fileKeys,
1138
- ...bucket ? { bucket } : {}
1139
- })
1136
+ body: JSON.stringify({ fileKeys })
1140
1137
  },
1141
1138
  profileFilesResultSchema
1142
1139
  );
1143
1140
  }
1144
1141
  removeProfileFiles(id, fileKeys, bucket) {
1145
1142
  return this.request(
1146
- `/profiles/${encodeURIComponent(id)}/files`,
1143
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/files`, bucket),
1147
1144
  {
1148
1145
  method: "DELETE",
1149
1146
  headers: { "Content-Type": "application/json" },
1150
- body: JSON.stringify({
1151
- fileKeys,
1152
- ...bucket ? { bucket } : {}
1153
- })
1147
+ body: JSON.stringify({ fileKeys })
1154
1148
  },
1155
1149
  profileFilesResultSchema
1156
1150
  );
1157
1151
  }
1158
1152
  signalProfile(id, signals, bucket) {
1159
1153
  return this.request(
1160
- `/profiles/${encodeURIComponent(id)}/signals`,
1154
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/signals`, bucket),
1161
1155
  {
1162
1156
  method: "POST",
1163
1157
  headers: { "Content-Type": "application/json" },
1164
- body: JSON.stringify({
1165
- signals,
1166
- ...bucket ? { bucket } : {}
1167
- })
1158
+ body: JSON.stringify({ signals })
1168
1159
  },
1169
1160
  profileSignalsResponseSchema
1170
1161
  );
1171
1162
  }
1172
- deleteProfileSignals(id, signalIds) {
1163
+ deleteProfileSignals(id, signalIds, bucket) {
1173
1164
  return this.request(
1174
- `/profiles/${encodeURIComponent(id)}/signals`,
1165
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/signals`, bucket),
1175
1166
  {
1176
1167
  method: "DELETE",
1177
1168
  headers: { "Content-Type": "application/json" },
@@ -1180,23 +1171,30 @@ var StowServer = class {
1180
1171
  deleteProfileSignalsResponseSchema
1181
1172
  );
1182
1173
  }
1183
- getProfileClusters(id) {
1184
- return this.request(`/profiles/${encodeURIComponent(id)}/clusters`, {
1185
- method: "GET"
1186
- });
1174
+ getProfileClusters(id, bucket) {
1175
+ return this.request(
1176
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/clusters`, bucket),
1177
+ { method: "GET" }
1178
+ );
1187
1179
  }
1188
- reclusterProfile(id, params) {
1189
- return this.request(`/profiles/${encodeURIComponent(id)}/clusters`, {
1190
- method: "POST",
1191
- headers: { "Content-Type": "application/json" },
1192
- body: JSON.stringify({
1193
- ...params?.clusterCount !== void 0 ? { clusterCount: params.clusterCount } : {}
1194
- })
1195
- });
1180
+ reclusterProfile(id, params, bucket) {
1181
+ return this.request(
1182
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/clusters`, bucket),
1183
+ {
1184
+ method: "POST",
1185
+ headers: { "Content-Type": "application/json" },
1186
+ body: JSON.stringify({
1187
+ ...params?.clusterCount !== void 0 ? { clusterCount: params.clusterCount } : {}
1188
+ })
1189
+ }
1190
+ );
1196
1191
  }
1197
- renameProfileCluster(profileId, clusterId, params) {
1192
+ renameProfileCluster(profileId, clusterId, params, bucket) {
1198
1193
  return this.request(
1199
- `/profiles/${encodeURIComponent(profileId)}/clusters/${encodeURIComponent(clusterId)}`,
1194
+ this.withBucket(
1195
+ `/profiles/${encodeURIComponent(profileId)}/clusters/${encodeURIComponent(clusterId)}`,
1196
+ bucket
1197
+ ),
1200
1198
  {
1201
1199
  method: "PUT",
1202
1200
  headers: { "Content-Type": "application/json" },
package/dist/index.mjs CHANGED
@@ -1064,89 +1064,80 @@ var StowServer = class {
1064
1064
  get profiles() {
1065
1065
  return {
1066
1066
  create: (params) => this.createProfile(params),
1067
- get: (id) => this.getProfile(id),
1068
- delete: (id) => this.deleteProfile(id),
1067
+ get: (id, bucket) => this.getProfile(id, bucket),
1068
+ delete: (id, bucket) => this.deleteProfile(id, bucket),
1069
1069
  addFiles: (id, fileKeys, bucket) => this.addProfileFiles(id, fileKeys, bucket),
1070
1070
  removeFiles: (id, fileKeys, bucket) => this.removeProfileFiles(id, fileKeys, bucket),
1071
1071
  signal: (id, signals, bucket) => this.signalProfile(id, signals, bucket),
1072
- deleteSignals: (id, signalIds) => this.deleteProfileSignals(id, signalIds),
1073
- clusters: (id) => this.getProfileClusters(id),
1074
- recluster: (id, params) => this.reclusterProfile(id, params),
1075
- renameCluster: (profileId, clusterId, params) => this.renameProfileCluster(profileId, clusterId, params)
1072
+ deleteSignals: (id, signalIds, bucket) => this.deleteProfileSignals(id, signalIds, bucket),
1073
+ clusters: (id, bucket) => this.getProfileClusters(id, bucket),
1074
+ recluster: (id, params, bucket) => this.reclusterProfile(id, params, bucket),
1075
+ renameCluster: (profileId, clusterId, params, bucket) => this.renameProfileCluster(profileId, clusterId, params, bucket)
1076
1076
  };
1077
1077
  }
1078
1078
  createProfile(params) {
1079
1079
  return this.request(
1080
- "/profiles",
1080
+ this.withBucket("/profiles", params?.bucket),
1081
1081
  {
1082
1082
  method: "POST",
1083
1083
  headers: { "Content-Type": "application/json" },
1084
1084
  body: JSON.stringify({
1085
1085
  ...params?.name ? { name: params.name } : {},
1086
- ...params?.fileKeys ? { fileKeys: params.fileKeys } : {},
1087
- ...params?.bucket ? { bucket: params.bucket } : {}
1086
+ ...params?.fileKeys ? { fileKeys: params.fileKeys } : {}
1088
1087
  })
1089
1088
  },
1090
1089
  profileResultSchema
1091
1090
  );
1092
1091
  }
1093
- getProfile(id) {
1092
+ getProfile(id, bucket) {
1094
1093
  return this.request(
1095
- `/profiles/${encodeURIComponent(id)}`,
1094
+ this.withBucket(`/profiles/${encodeURIComponent(id)}`, bucket),
1096
1095
  { method: "GET" },
1097
1096
  profileResultSchema
1098
1097
  );
1099
1098
  }
1100
- async deleteProfile(id) {
1101
- await this.request(`/profiles/${encodeURIComponent(id)}`, {
1102
- method: "DELETE"
1103
- });
1099
+ async deleteProfile(id, bucket) {
1100
+ await this.request(
1101
+ this.withBucket(`/profiles/${encodeURIComponent(id)}`, bucket),
1102
+ { method: "DELETE" }
1103
+ );
1104
1104
  }
1105
1105
  addProfileFiles(id, fileKeys, bucket) {
1106
1106
  return this.request(
1107
- `/profiles/${encodeURIComponent(id)}/files`,
1107
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/files`, bucket),
1108
1108
  {
1109
1109
  method: "POST",
1110
1110
  headers: { "Content-Type": "application/json" },
1111
- body: JSON.stringify({
1112
- fileKeys,
1113
- ...bucket ? { bucket } : {}
1114
- })
1111
+ body: JSON.stringify({ fileKeys })
1115
1112
  },
1116
1113
  profileFilesResultSchema
1117
1114
  );
1118
1115
  }
1119
1116
  removeProfileFiles(id, fileKeys, bucket) {
1120
1117
  return this.request(
1121
- `/profiles/${encodeURIComponent(id)}/files`,
1118
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/files`, bucket),
1122
1119
  {
1123
1120
  method: "DELETE",
1124
1121
  headers: { "Content-Type": "application/json" },
1125
- body: JSON.stringify({
1126
- fileKeys,
1127
- ...bucket ? { bucket } : {}
1128
- })
1122
+ body: JSON.stringify({ fileKeys })
1129
1123
  },
1130
1124
  profileFilesResultSchema
1131
1125
  );
1132
1126
  }
1133
1127
  signalProfile(id, signals, bucket) {
1134
1128
  return this.request(
1135
- `/profiles/${encodeURIComponent(id)}/signals`,
1129
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/signals`, bucket),
1136
1130
  {
1137
1131
  method: "POST",
1138
1132
  headers: { "Content-Type": "application/json" },
1139
- body: JSON.stringify({
1140
- signals,
1141
- ...bucket ? { bucket } : {}
1142
- })
1133
+ body: JSON.stringify({ signals })
1143
1134
  },
1144
1135
  profileSignalsResponseSchema
1145
1136
  );
1146
1137
  }
1147
- deleteProfileSignals(id, signalIds) {
1138
+ deleteProfileSignals(id, signalIds, bucket) {
1148
1139
  return this.request(
1149
- `/profiles/${encodeURIComponent(id)}/signals`,
1140
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/signals`, bucket),
1150
1141
  {
1151
1142
  method: "DELETE",
1152
1143
  headers: { "Content-Type": "application/json" },
@@ -1155,23 +1146,30 @@ var StowServer = class {
1155
1146
  deleteProfileSignalsResponseSchema
1156
1147
  );
1157
1148
  }
1158
- getProfileClusters(id) {
1159
- return this.request(`/profiles/${encodeURIComponent(id)}/clusters`, {
1160
- method: "GET"
1161
- });
1149
+ getProfileClusters(id, bucket) {
1150
+ return this.request(
1151
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/clusters`, bucket),
1152
+ { method: "GET" }
1153
+ );
1162
1154
  }
1163
- reclusterProfile(id, params) {
1164
- return this.request(`/profiles/${encodeURIComponent(id)}/clusters`, {
1165
- method: "POST",
1166
- headers: { "Content-Type": "application/json" },
1167
- body: JSON.stringify({
1168
- ...params?.clusterCount !== void 0 ? { clusterCount: params.clusterCount } : {}
1169
- })
1170
- });
1155
+ reclusterProfile(id, params, bucket) {
1156
+ return this.request(
1157
+ this.withBucket(`/profiles/${encodeURIComponent(id)}/clusters`, bucket),
1158
+ {
1159
+ method: "POST",
1160
+ headers: { "Content-Type": "application/json" },
1161
+ body: JSON.stringify({
1162
+ ...params?.clusterCount !== void 0 ? { clusterCount: params.clusterCount } : {}
1163
+ })
1164
+ }
1165
+ );
1171
1166
  }
1172
- renameProfileCluster(profileId, clusterId, params) {
1167
+ renameProfileCluster(profileId, clusterId, params, bucket) {
1173
1168
  return this.request(
1174
- `/profiles/${encodeURIComponent(profileId)}/clusters/${encodeURIComponent(clusterId)}`,
1169
+ this.withBucket(
1170
+ `/profiles/${encodeURIComponent(profileId)}/clusters/${encodeURIComponent(clusterId)}`,
1171
+ bucket
1172
+ ),
1175
1173
  {
1176
1174
  method: "PUT",
1177
1175
  headers: { "Content-Type": "application/json" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/stow-server",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Server-side SDK for Stow file storage",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,10 +33,10 @@
33
33
  "zod": "^3.0.0 || ^4.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@types/node": "^25.3.0",
36
+ "@types/node": "^25.5.0",
37
37
  "tsup": "^8.5.1",
38
38
  "typescript": "^5.9.3",
39
- "vitest": "^4.0.18",
39
+ "vitest": "^4.1.0",
40
40
  "zod": "^4.3.6",
41
41
  "@stow/typescript-config": "0.0.0"
42
42
  },