@camstack/types 1.2.571 → 1.2.573

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/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.573] - 2026-11-15
11
+
12
+ ### Changed
13
+
14
+ - plate-gallery and face-gallery: sample mediaId / key frame + box, PlateInfo.cropMissReason, moveVehicleSample and moveIdentitySample
15
+
16
+ ## [1.2.572] - 2026-11-15
17
+
18
+ ### Added
19
+
20
+ - The device picker and the admin search share one matcher: an exact name ranks above a typo.
21
+
10
22
  ## [1.2.571] - 2026-11-15
11
23
 
12
24
  ### Added
@@ -17,6 +17,14 @@ declare const IdentitySampleInfoSchema: z.ZodObject<{
17
17
  addedAt: z.ZodNumber;
18
18
  deviceId: z.ZodOptional<z.ZodNumber>;
19
19
  base64: z.ZodOptional<z.ZodString>;
20
+ mediaId: z.ZodOptional<z.ZodNumber>;
21
+ keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
22
+ faceBbox: z.ZodOptional<z.ZodObject<{
23
+ x: z.ZodNumber;
24
+ y: z.ZodNumber;
25
+ w: z.ZodNumber;
26
+ h: z.ZodNumber;
27
+ }, z.core.$strip>>;
20
28
  }, z.core.$strip>;
21
29
  export type IdentitySampleInfo = z.infer<typeof IdentitySampleInfoSchema>;
22
30
  /**
@@ -181,6 +189,14 @@ export declare const faceGalleryCapability: {
181
189
  addedAt: z.ZodNumber;
182
190
  deviceId: z.ZodOptional<z.ZodNumber>;
183
191
  base64: z.ZodOptional<z.ZodString>;
192
+ mediaId: z.ZodOptional<z.ZodNumber>;
193
+ keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
194
+ faceBbox: z.ZodOptional<z.ZodObject<{
195
+ x: z.ZodNumber;
196
+ y: z.ZodNumber;
197
+ w: z.ZodNumber;
198
+ h: z.ZodNumber;
199
+ }, z.core.$strip>>;
184
200
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
185
201
  /**
186
202
  * Re-analyse ONE person's enrolled samples against the whole gallery.
@@ -227,6 +243,15 @@ export declare const faceGalleryCapability: {
227
243
  identityId: z.ZodString;
228
244
  sampleId: z.ZodString;
229
245
  }, z.core.$strip>, z.ZodVoid, "mutation">;
246
+ /**
247
+ * Move an enrolled sample onto another person. The crop is re-owned, the
248
+ * source face keeps its link and follows (`recognizedIdentityId`), and an
249
+ * unknown person is refused.
250
+ */
251
+ readonly moveIdentitySample: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
252
+ sampleId: z.ZodString;
253
+ toIdentityId: z.ZodString;
254
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
230
255
  readonly listRecentFaces: import("./capability-definition.js").CapabilityMethodSchema<z.ZodOptional<z.ZodObject<{
231
256
  deviceId: z.ZodOptional<z.ZodNumber>;
232
257
  deviceIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
@@ -15,6 +15,14 @@ declare const VehicleSampleInfoSchema: z.ZodObject<{
15
15
  addedAt: z.ZodNumber;
16
16
  deviceId: z.ZodOptional<z.ZodNumber>;
17
17
  base64: z.ZodOptional<z.ZodString>;
18
+ mediaId: z.ZodOptional<z.ZodNumber>;
19
+ keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
20
+ plateBbox: z.ZodOptional<z.ZodObject<{
21
+ x: z.ZodNumber;
22
+ y: z.ZodNumber;
23
+ w: z.ZodNumber;
24
+ h: z.ZodNumber;
25
+ }, z.core.$strip>>;
18
26
  }, z.core.$strip>;
19
27
  export type VehicleSampleInfo = z.infer<typeof VehicleSampleInfoSchema>;
20
28
  declare const PlateInfoSchema: z.ZodObject<{
@@ -37,6 +45,7 @@ declare const PlateInfoSchema: z.ZodObject<{
37
45
  keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
38
46
  base64: z.ZodOptional<z.ZodString>;
39
47
  cropUrl: z.ZodOptional<z.ZodString>;
48
+ cropMissReason: z.ZodOptional<z.ZodString>;
40
49
  }, z.core.$strip>;
41
50
  export type PlateInfo = z.infer<typeof PlateInfoSchema>;
42
51
  /**
@@ -79,6 +88,7 @@ export declare const plateGalleryCapability: {
79
88
  keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
80
89
  base64: z.ZodOptional<z.ZodString>;
81
90
  cropUrl: z.ZodOptional<z.ZodString>;
91
+ cropMissReason: z.ZodOptional<z.ZodString>;
82
92
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
83
93
  readonly getPlateByTrack: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
84
94
  deviceId: z.ZodNumber;
@@ -103,6 +113,7 @@ export declare const plateGalleryCapability: {
103
113
  keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
104
114
  base64: z.ZodOptional<z.ZodString>;
105
115
  cropUrl: z.ZodOptional<z.ZodString>;
116
+ cropMissReason: z.ZodOptional<z.ZodString>;
106
117
  }, z.core.$strip>>, import("./capability-definition.js").CapabilityMethodKind>;
107
118
  readonly getPlateMedia: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
108
119
  plateId: z.ZodString;
@@ -139,6 +150,7 @@ export declare const plateGalleryCapability: {
139
150
  keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
140
151
  base64: z.ZodOptional<z.ZodString>;
141
152
  cropUrl: z.ZodOptional<z.ZodString>;
153
+ cropMissReason: z.ZodOptional<z.ZodString>;
142
154
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
143
155
  /** Suggest groups of near-identical reads (same physical plate) for review/merge. */
144
156
  readonly suggestPlateClusters: import("./capability-definition.js").CapabilityMethodSchema<z.ZodOptional<z.ZodObject<{
@@ -194,11 +206,28 @@ export declare const plateGalleryCapability: {
194
206
  addedAt: z.ZodNumber;
195
207
  deviceId: z.ZodOptional<z.ZodNumber>;
196
208
  base64: z.ZodOptional<z.ZodString>;
209
+ mediaId: z.ZodOptional<z.ZodNumber>;
210
+ keyFrameMediaId: z.ZodOptional<z.ZodNumber>;
211
+ plateBbox: z.ZodOptional<z.ZodObject<{
212
+ x: z.ZodNumber;
213
+ y: z.ZodNumber;
214
+ w: z.ZodNumber;
215
+ h: z.ZodNumber;
216
+ }, z.core.$strip>>;
197
217
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
198
218
  readonly removeVehicleSample: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
199
219
  vehicleId: z.ZodString;
200
220
  sampleId: z.ZodString;
201
221
  }, z.core.$strip>, z.ZodVoid, "mutation">;
222
+ /**
223
+ * Move an enrolled sample onto another vehicle. The crop is re-owned, the
224
+ * source plate keeps its link and follows (`recognizedVehicleId`), and an
225
+ * unknown vehicle is refused.
226
+ */
227
+ readonly moveVehicleSample: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
228
+ sampleId: z.ZodString;
229
+ toVehicleId: z.ZodString;
230
+ }, z.core.$strip>, z.ZodVoid, "mutation">;
202
231
  readonly assignPlate: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
203
232
  plateId: z.ZodString;
204
233
  vehicleId: z.ZodString;
package/dist/client.js CHANGED
@@ -29495,6 +29495,7 @@ function createSystemProxy(api) {
29495
29495
  listIdentitySamples: (input) => dispatch("faceGallery", "listIdentitySamples", "query", input),
29496
29496
  auditIdentitySamples: (input) => dispatch("faceGallery", "auditIdentitySamples", "query", input),
29497
29497
  removeSample: (input) => dispatch("faceGallery", "removeSample", "mutation", input),
29498
+ moveIdentitySample: (input) => dispatch("faceGallery", "moveIdentitySample", "mutation", input),
29498
29499
  getFaceMedia: (input) => dispatch("faceGallery", "getFaceMedia", "query", input),
29499
29500
  assignFace: (input) => dispatch("faceGallery", "assignFace", "mutation", input),
29500
29501
  unassignFace: (input) => dispatch("faceGallery", "unassignFace", "mutation", input),
@@ -29788,6 +29789,7 @@ function createSystemProxy(api) {
29788
29789
  deleteVehicle: (input) => dispatch("plateGallery", "deleteVehicle", "mutation", input),
29789
29790
  listVehicleSamples: (input) => dispatch("plateGallery", "listVehicleSamples", "query", input),
29790
29791
  removeVehicleSample: (input) => dispatch("plateGallery", "removeVehicleSample", "mutation", input),
29792
+ moveVehicleSample: (input) => dispatch("plateGallery", "moveVehicleSample", "mutation", input),
29791
29793
  assignPlate: (input) => dispatch("plateGallery", "assignPlate", "mutation", input),
29792
29794
  unassignPlate: (input) => dispatch("plateGallery", "unassignPlate", "mutation", input),
29793
29795
  assignPlates: (input) => dispatch("plateGallery", "assignPlates", "mutation", input),
package/dist/client.mjs CHANGED
@@ -29494,6 +29494,7 @@ function createSystemProxy(api) {
29494
29494
  listIdentitySamples: (input) => dispatch("faceGallery", "listIdentitySamples", "query", input),
29495
29495
  auditIdentitySamples: (input) => dispatch("faceGallery", "auditIdentitySamples", "query", input),
29496
29496
  removeSample: (input) => dispatch("faceGallery", "removeSample", "mutation", input),
29497
+ moveIdentitySample: (input) => dispatch("faceGallery", "moveIdentitySample", "mutation", input),
29497
29498
  getFaceMedia: (input) => dispatch("faceGallery", "getFaceMedia", "query", input),
29498
29499
  assignFace: (input) => dispatch("faceGallery", "assignFace", "mutation", input),
29499
29500
  unassignFace: (input) => dispatch("faceGallery", "unassignFace", "mutation", input),
@@ -29787,6 +29788,7 @@ function createSystemProxy(api) {
29787
29788
  deleteVehicle: (input) => dispatch("plateGallery", "deleteVehicle", "mutation", input),
29788
29789
  listVehicleSamples: (input) => dispatch("plateGallery", "listVehicleSamples", "query", input),
29789
29790
  removeVehicleSample: (input) => dispatch("plateGallery", "removeVehicleSample", "mutation", input),
29791
+ moveVehicleSample: (input) => dispatch("plateGallery", "moveVehicleSample", "mutation", input),
29790
29792
  assignPlate: (input) => dispatch("plateGallery", "assignPlate", "mutation", input),
29791
29793
  unassignPlate: (input) => dispatch("plateGallery", "unassignPlate", "mutation", input),
29792
29794
  assignPlates: (input) => dispatch("plateGallery", "assignPlates", "mutation", input),
@@ -4009,6 +4009,13 @@ export type AppRouter = TrpcCoreRouter<{
4009
4009
  output: z.infer<typeof faceGalleryCapability.methods.removeSample.output>;
4010
4010
  meta: object;
4011
4011
  }>;
4012
+ moveIdentitySample: TRPCMutationProcedure<{
4013
+ input: {
4014
+ [x: string]: unknown;
4015
+ } & z.input<typeof faceGalleryCapability.methods.moveIdentitySample.input>;
4016
+ output: z.infer<typeof faceGalleryCapability.methods.moveIdentitySample.output>;
4017
+ meta: object;
4018
+ }>;
4012
4019
  listRecentFaces: TRPCQueryProcedure<{
4013
4020
  input: z.input<typeof faceGalleryCapability.methods.listRecentFaces.input>;
4014
4021
  output: z.infer<typeof faceGalleryCapability.methods.listRecentFaces.output>;
@@ -8410,6 +8417,13 @@ export type AppRouter = TrpcCoreRouter<{
8410
8417
  output: z.infer<typeof plateGalleryCapability.methods.removeVehicleSample.output>;
8411
8418
  meta: object;
8412
8419
  }>;
8420
+ moveVehicleSample: TRPCMutationProcedure<{
8421
+ input: {
8422
+ [x: string]: unknown;
8423
+ } & z.input<typeof plateGalleryCapability.methods.moveVehicleSample.input>;
8424
+ output: z.infer<typeof plateGalleryCapability.methods.moveVehicleSample.output>;
8425
+ meta: object;
8426
+ }>;
8413
8427
  assignPlate: TRPCMutationProcedure<{
8414
8428
  input: {
8415
8429
  [x: string]: unknown;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 1494 method paths across 208 capabilities.
9
+ * Coverage: 1496 method paths across 208 capabilities.
10
10
  */
11
11
  import type { MethodRole } from '../auth/viewer-access.js';
12
12
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
@@ -97,7 +97,7 @@ export interface SystemProxy {
97
97
  readonly deviceProvider: Pick<InferProvider<typeof deviceProviderCapability>, 'start' | 'stop' | 'getStatus' | 'getDevices' | 'reloadDevice' | 'supportsDiscovery' | 'discoverDevices' | 'getDiscoveryModes' | 'classifyDiscoveryHits' | 'getDiscoveryParamsSchema' | 'getManualCreationType' | 'adoptDiscoveredDevice' | 'supportsManualCreation' | 'getChildCreationSchema' | 'createDevice' | 'testCreationField'>;
98
98
  readonly deviceState: Pick<InferProvider<typeof deviceStateCapability>, 'getAllSnapshots' | 'listClaims'>;
99
99
  readonly displayPalette: Pick<InferProvider<typeof displayPaletteCapability>, 'getPalette' | 'listPresets' | 'setPalette'>;
100
- readonly faceGallery: Pick<InferProvider<typeof faceGalleryCapability>, 'listIdentities' | 'createIdentity' | 'renameIdentity' | 'deleteIdentity' | 'listIdentitySamples' | 'auditIdentitySamples' | 'removeSample' | 'getFaceMedia' | 'assignFace' | 'unassignFace' | 'deleteFace' | 'assignFaces' | 'unassignFaces' | 'suggestFaceClusters'>;
100
+ readonly faceGallery: Pick<InferProvider<typeof faceGalleryCapability>, 'listIdentities' | 'createIdentity' | 'renameIdentity' | 'deleteIdentity' | 'listIdentitySamples' | 'auditIdentitySamples' | 'removeSample' | 'moveIdentitySample' | 'getFaceMedia' | 'assignFace' | 'unassignFace' | 'deleteFace' | 'assignFaces' | 'unassignFaces' | 'suggestFaceClusters'>;
101
101
  readonly fanPresets: Pick<InferProvider<typeof fanPresetsCapability>, 'getPresets' | 'setPresets' | 'applyPreset' | 'capturePreset'>;
102
102
  readonly heroLayout: Pick<InferProvider<typeof heroLayoutCapability>, 'getHeroModel' | 'getRowModels' | 'getLayout'>;
103
103
  readonly integrationInstances: Pick<InferProvider<typeof integrationInstancesCapability>, 'describe' | 'instanceFormSchema' | 'listInstances' | 'getInstance' | 'createInstance' | 'updateInstance' | 'setInstanceEnabled' | 'deleteInstance' | 'testInstance'>;
@@ -117,7 +117,7 @@ export interface SystemProxy {
117
117
  readonly pipelineExecutor: Pick<InferProvider<typeof pipelineExecutorCapability>, 'getAvailableEngines' | 'getSelectedEngine' | 'getEngineProvisioning' | 'getVideoPipelineSteps' | 'setVideoPipelineSteps' | 'getInferenceDeviceHealth' | 'rearmInferenceDevice' | 'getSchema' | 'getOrchestratorConfigSchema' | 'validatePipeline' | 'getCapabilities' | 'getAddonModels' | 'downloadModel' | 'deleteModel' | 'cacheFrameInPool' | 'inferCached' | 'uncacheFrame' | 'getEffectiveTuning' | 'listLoadedEngines' | 'spinEngine' | 'killEngine' | 'listReferenceImages' | 'getReferenceImage' | 'getReferenceAudioFiles' | 'getReferenceAudio' | 'getAudioCapabilities' | 'runAudioTest' | 'getDetectionConfigSchema'>;
118
118
  readonly pipelineOrchestrator: Pick<InferProvider<typeof pipelineOrchestratorCapability>, 'requestOccupancyLook' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'rebalance' | 'getPipelineAssignments' | 'getAgentLoad' | 'getClusterModelChoice' | 'getGlobalMetrics' | 'getCapabilityBindings' | 'setCapabilityBinding' | 'getIngestOwner' | 'getAudioNodeLoad' | 'getAudioAssignments' | 'getAgentSettings' | 'listAgentSettings' | 'removeAgentSettings' | 'setAgentMaxCameras' | 'setAgentCapabilities' | 'setAgentDecodeLimits' | 'setAgentReachableHost' | 'setAgentInferenceDevices' | 'setNodeStepSettings' | 'getNodeInferenceDevices' | 'forgetInferenceDevice' | 'resetNodePipelineDefaults' | 'planAutoTune' | 'applyAutoTune' | 'setLoadBalancingShares' | 'getPlacementStats' | 'suggestShares' | 'getEffectiveShares' | 'setShareSource' | 'getNodeBenchmarkPreflight' | 'startNodeBenchmark' | 'getNodeBenchmarkStatus' | 'abortNodeBenchmark' | 'getNodeBenchmarkCandidates' | 'listNodeBenchmarkResults' | 'deleteNodeBenchmarkResult' | 'getCameraStatuses' | 'setCameraSensors' | 'reconcileFromDisk' | 'getReconcileFromDiskStatus'>;
119
119
  readonly pipelineRunner: Pick<InferProvider<typeof pipelineRunnerCapability>, 'attachCamera' | 'reportMotion' | 'getLocalLoad' | 'getLocalMetrics' | 'getAllCameraMetrics' | 'getLocalCameras' | 'getNativeCrop' | 'runStatelessStep' | 'startNodeBench' | 'getNodeBenchStatus' | 'abortNodeBench'>;
120
- readonly plateGallery: Pick<InferProvider<typeof plateGalleryCapability>, 'getPlateMedia' | 'searchPlates' | 'suggestPlateClusters' | 'correctPlateText' | 'deletePlate' | 'listVehicles' | 'createVehicle' | 'renameVehicle' | 'deleteVehicle' | 'listVehicleSamples' | 'removeVehicleSample' | 'assignPlate' | 'unassignPlate' | 'assignPlates' | 'unassignPlates'>;
120
+ readonly plateGallery: Pick<InferProvider<typeof plateGalleryCapability>, 'getPlateMedia' | 'searchPlates' | 'suggestPlateClusters' | 'correctPlateText' | 'deletePlate' | 'listVehicles' | 'createVehicle' | 'renameVehicle' | 'deleteVehicle' | 'listVehicleSamples' | 'removeVehicleSample' | 'moveVehicleSample' | 'assignPlate' | 'unassignPlate' | 'assignPlates' | 'unassignPlates'>;
121
121
  readonly platformProbe: Pick<InferProvider<typeof platformProbeCapability>, 'getCapabilities' | 'getHardware' | 'resolveInferenceConfig' | 'resolveHwAccel' | 'rescanAccelerators'>;
122
122
  readonly recordEntries: Pick<InferProvider<typeof recordEntriesCapability>, 'listEntryKinds' | 'listEntries' | 'putEntry' | 'deleteEntry'>;
123
123
  readonly recordingArchive: Pick<InferProvider<typeof recordingArchiveCapability>, 'getAvailabilityBatch' | 'getDaysWithRecordingsBatch' | 'getStorageUsage' | 'listOpsLog' | 'pauseForStorageMigration' | 'resumeForStorageMigration' | 'refreshStorageLocationsForMigration' | 'startStorageMigrationMove' | 'getStorageMigrationMoveStatus' | 'cancelStorageMigrationMove' | 'relocateFootage' | 'listRelocateJobs' | 'getRelocateResidue' | 'reconcileLedgerAgainstDisk' | 'cancelRelocateJob' | 'planStorageRebalance' | 'startStorageRebalance' | 'getPlacement' | 'setDevicePlacement'>;
package/dist/index.d.ts CHANGED
@@ -473,3 +473,4 @@ export { brokerLinkPortsOver, moveBrokerLinksToConnections, } from './migrations
473
473
  export * from './migrations/api/migration-api.v1.js';
474
474
  export * from './migrations/api/migration-api.v1.schema.js';
475
475
  export * from './migrations/api/migration-api-ports.js';
476
+ export { normalizeSearchText, searchRank, type SearchRankFields } from './search/search-match.js';
package/dist/index.js CHANGED
@@ -30890,7 +30890,7 @@ function normalise$1(text) {
30890
30890
  return text.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().replace(/[_-]+/g, " ").trim();
30891
30891
  }
30892
30892
  /** Does `needle` appear in `haystack` in order, though not adjacently? */
30893
- function isSubsequence(needle, haystack) {
30893
+ function isSubsequence$1(needle, haystack) {
30894
30894
  let i = 0;
30895
30895
  for (const ch of haystack) {
30896
30896
  if (ch === needle[i]) i += 1;
@@ -30908,7 +30908,7 @@ function scoreWord(query, word, loose) {
30908
30908
  if (word.startsWith(query)) return 80;
30909
30909
  if (word.split(" ").some((w) => w.startsWith(query))) return 60;
30910
30910
  if (word.includes(query)) return 40;
30911
- if (loose && isSubsequence(query, word)) return 15;
30911
+ if (loose && isSubsequence$1(query, word)) return 15;
30912
30912
  return 0;
30913
30913
  }
30914
30914
  var WORDS_CACHE = /* @__PURE__ */ new Map();
@@ -60835,7 +60835,19 @@ var IdentitySampleInfoSchema = zod.z.object({
60835
60835
  source: zod.z.enum(["detected", "photo"]),
60836
60836
  addedAt: zod.z.number().int(),
60837
60837
  deviceId: zod.z.number().int().optional(),
60838
- base64: zod.z.string().optional()
60838
+ base64: zod.z.string().optional(),
60839
+ /**
60840
+ * The sample's own crop, when it has one. The bytes stay on the event-media
60841
+ * plane — this list does not inline them.
60842
+ */
60843
+ mediaId: zod.z.number().int().optional(),
60844
+ /**
60845
+ * The source face's key frame (or the photo the sample was cut from), when
60846
+ * the sample has no crop of its own. Draw {@link faceBbox} on it.
60847
+ */
60848
+ keyFrameMediaId: zod.z.number().int().optional(),
60849
+ /** The face box on {@link keyFrameMediaId}, pixel space. */
60850
+ faceBbox: BoundingBoxSchema.optional()
60839
60851
  });
60840
60852
  /**
60841
60853
  * One enrolled sample, judged against the gallery it lives in.
@@ -61075,6 +61087,18 @@ includeCrops: zod.z.boolean().optional() }).optional(), zod.z.array(IdentitySche
61075
61087
  kind: "mutation",
61076
61088
  auth: "admin"
61077
61089
  }),
61090
+ /**
61091
+ * Move an enrolled sample onto another person. The crop is re-owned, the
61092
+ * source face keeps its link and follows (`recognizedIdentityId`), and an
61093
+ * unknown person is refused.
61094
+ */
61095
+ moveIdentitySample: require_sleep.method(zod.z.object({
61096
+ sampleId: zod.z.string().min(1),
61097
+ toIdentityId: zod.z.string().min(1)
61098
+ }), zod.z.void(), {
61099
+ kind: "mutation",
61100
+ auth: "admin"
61101
+ }),
61078
61102
  listRecentFaces: require_sleep.method(zod.z.object({
61079
61103
  /**
61080
61104
  * Restrict to ONE camera. Absent keeps the cluster-wide gallery view.
@@ -86070,7 +86094,19 @@ var VehicleSampleInfoSchema = zod.z.object({
86070
86094
  score: zod.z.number(),
86071
86095
  addedAt: zod.z.number().int(),
86072
86096
  deviceId: zod.z.number().int().optional(),
86073
- base64: zod.z.string().optional()
86097
+ base64: zod.z.string().optional(),
86098
+ /**
86099
+ * The sample's own crop, when it has one. Prefer this over {@link base64}:
86100
+ * the bytes are on the event-media plane (`/m/<mediaId>`), never inlined.
86101
+ */
86102
+ mediaId: zod.z.number().int().optional(),
86103
+ /**
86104
+ * The source plate's key frame, when the sample has no crop of its own.
86105
+ * Draw {@link plateBbox} on it. Absent when {@link mediaId} is set.
86106
+ */
86107
+ keyFrameMediaId: zod.z.number().int().optional(),
86108
+ /** The plate box on {@link keyFrameMediaId}, pixel space. */
86109
+ plateBbox: BoundingBoxSchema.optional()
86074
86110
  });
86075
86111
  var PlateInfoSchema = zod.z.object({
86076
86112
  plateId: zod.z.string(),
@@ -86100,7 +86136,17 @@ var PlateInfoSchema = zod.z.object({
86100
86136
  * and `searchPlates` inline the crop only when their `includeCrops` input is
86101
86137
  * left at its `true` default.
86102
86138
  */
86103
- cropUrl: zod.z.string().optional()
86139
+ cropUrl: zod.z.string().optional(),
86140
+ /**
86141
+ * Why {@link cropUrl} is absent. One of `no-frame-handle`,
86142
+ * `live-capture-missed`, `live-capture-threw`, `no-key-frame`,
86143
+ * `derive-not-wired`, `subject-moved`, `temporal-skew`, `key-frame-absent`,
86144
+ * `bad-frame-size`, `decode-empty`, `derive-threw`, `derive-returned-null`,
86145
+ * `put-failed`. A crossing vehicle whose live capture missed is
86146
+ * `subject-moved`: the key frame is a different instant, and the crop is
86147
+ * legitimately absent.
86148
+ */
86149
+ cropMissReason: zod.z.string().optional()
86104
86150
  });
86105
86151
  /**
86106
86152
  * One gallery media row: what the crop is, how big it is, and WHERE its bytes
@@ -86230,6 +86276,18 @@ includeCrops: zod.z.boolean().optional() }).optional(), zod.z.array(VehicleSchem
86230
86276
  kind: "mutation",
86231
86277
  auth: "admin"
86232
86278
  }),
86279
+ /**
86280
+ * Move an enrolled sample onto another vehicle. The crop is re-owned, the
86281
+ * source plate keeps its link and follows (`recognizedVehicleId`), and an
86282
+ * unknown vehicle is refused.
86283
+ */
86284
+ moveVehicleSample: require_sleep.method(zod.z.object({
86285
+ sampleId: zod.z.string().min(1),
86286
+ toVehicleId: zod.z.string().min(1)
86287
+ }), zod.z.void(), {
86288
+ kind: "mutation",
86289
+ auth: "admin"
86290
+ }),
86233
86291
  assignPlate: require_sleep.method(zod.z.object({
86234
86292
  plateId: zod.z.string(),
86235
86293
  vehicleId: zod.z.string()
@@ -120108,6 +120166,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
120108
120166
  access: "view",
120109
120167
  role: "feature:face-assignment"
120110
120168
  },
120169
+ "faceGallery.moveIdentitySample": {
120170
+ capName: "face-gallery",
120171
+ capScope: "system",
120172
+ addonId: null,
120173
+ access: "create",
120174
+ role: "feature:face-assignment"
120175
+ },
120111
120176
  "faceGallery.removeSample": {
120112
120177
  capName: "face-gallery",
120113
120178
  capScope: "system",
@@ -124028,6 +124093,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
124028
124093
  access: "view",
124029
124094
  role: "feature:plate-assignment"
124030
124095
  },
124096
+ "plateGallery.moveVehicleSample": {
124097
+ capName: "plate-gallery",
124098
+ capScope: "system",
124099
+ addonId: null,
124100
+ access: "create",
124101
+ role: "feature:plate-assignment"
124102
+ },
124031
124103
  "plateGallery.removeVehicleSample": {
124032
124104
  capName: "plate-gallery",
124033
124105
  capScope: "system",
@@ -134285,6 +134357,7 @@ function createSystemProxy(api) {
134285
134357
  listIdentitySamples: (input) => dispatch("faceGallery", "listIdentitySamples", "query", input),
134286
134358
  auditIdentitySamples: (input) => dispatch("faceGallery", "auditIdentitySamples", "query", input),
134287
134359
  removeSample: (input) => dispatch("faceGallery", "removeSample", "mutation", input),
134360
+ moveIdentitySample: (input) => dispatch("faceGallery", "moveIdentitySample", "mutation", input),
134288
134361
  getFaceMedia: (input) => dispatch("faceGallery", "getFaceMedia", "query", input),
134289
134362
  assignFace: (input) => dispatch("faceGallery", "assignFace", "mutation", input),
134290
134363
  unassignFace: (input) => dispatch("faceGallery", "unassignFace", "mutation", input),
@@ -134578,6 +134651,7 @@ function createSystemProxy(api) {
134578
134651
  deleteVehicle: (input) => dispatch("plateGallery", "deleteVehicle", "mutation", input),
134579
134652
  listVehicleSamples: (input) => dispatch("plateGallery", "listVehicleSamples", "query", input),
134580
134653
  removeVehicleSample: (input) => dispatch("plateGallery", "removeVehicleSample", "mutation", input),
134654
+ moveVehicleSample: (input) => dispatch("plateGallery", "moveVehicleSample", "mutation", input),
134581
134655
  assignPlate: (input) => dispatch("plateGallery", "assignPlate", "mutation", input),
134582
134656
  unassignPlate: (input) => dispatch("plateGallery", "unassignPlate", "mutation", input),
134583
134657
  assignPlates: (input) => dispatch("plateGallery", "assignPlates", "mutation", input),
@@ -146926,6 +147000,155 @@ function brokerLinkPortsOver(deps) {
146926
147000
  };
146927
147001
  }
146928
147002
  //#endregion
147003
+ //#region src/search/search-match.ts
147004
+ /**
147005
+ * Shared text ranking for the admin global search and `deviceManager.search`.
147006
+ *
147007
+ * One ascending scale. Lower is better; `null` is no match. Exact levels
147008
+ * (0–5) are tried before either fuzzy level (6–7), so a fuzzy hit cannot
147009
+ * outrank an exact one. Identifiers match on equality only — a device id is
147010
+ * a fact, not a spelling, and "108" must never fuzzy-match device 102.
147011
+ *
147012
+ * Fuzzy runs on the label first. Keywords are fuzzied only when the label
147013
+ * itself did not match, so an item that already matched keeps its rank.
147014
+ */
147015
+ var COMBINING_MARKS = /\p{Mn}/gu;
147016
+ /** Case- and diacritic-insensitive. "Perche" and "Perché" compare equal. */
147017
+ function normalizeSearchText(value) {
147018
+ return value.normalize("NFD").replace(COMBINING_MARKS, "").toLowerCase().trim();
147019
+ }
147020
+ var RANK_EXACT_IDENTIFIER = 0;
147021
+ var RANK_EXACT_LABEL = 1;
147022
+ var RANK_LABEL_PREFIX = 2;
147023
+ var RANK_WORD_PREFIX = 3;
147024
+ var RANK_LABEL_SUBSTRING = 4;
147025
+ var RANK_KEYWORD_SUBSTRING = 5;
147026
+ var RANK_SUBSEQUENCE = 6;
147027
+ var RANK_FUZZY_WORD = 7;
147028
+ /**
147029
+ * Exact levels. `null` means no exact match; the caller falls through to fuzzy.
147030
+ * 0 — the query IS one of `identifiers`
147031
+ * 1 — exact label
147032
+ * 2 — label starts with the query
147033
+ * 3 — some whole word in the label starts with the query
147034
+ * 4 — query appears anywhere in the label
147035
+ * 5 — query appears in a keyword (stableId, parent name, path, …)
147036
+ *
147037
+ * Level 0 sits above the exact label: `102` is a device id, and a camera
147038
+ * named "Garage 102" must not bury it.
147039
+ */
147040
+ function matchRank(normalizedLabel, normalizedKeywords, normalizedIdentifiers, query) {
147041
+ if (normalizedIdentifiers.includes(query)) return RANK_EXACT_IDENTIFIER;
147042
+ if (normalizedLabel === query) return RANK_EXACT_LABEL;
147043
+ if (normalizedLabel.startsWith(query)) return RANK_LABEL_PREFIX;
147044
+ if (normalizedLabel.split(/\s+/).some((word) => word.startsWith(query))) return RANK_WORD_PREFIX;
147045
+ if (normalizedLabel.includes(query)) return RANK_LABEL_SUBSTRING;
147046
+ if (normalizedKeywords.some((keyword) => keyword.includes(query))) return RANK_KEYWORD_SUBSTRING;
147047
+ return null;
147048
+ }
147049
+ /** Every character of `query` appears in `label`, in order. Gaps allowed. */
147050
+ function isSubsequence(label, query) {
147051
+ let queryIndex = 0;
147052
+ for (let labelIndex = 0; labelIndex < label.length && queryIndex < query.length; labelIndex++) {
147053
+ const labelChar = label[labelIndex];
147054
+ const queryChar = query[queryIndex];
147055
+ if (labelChar !== void 0 && labelChar === queryChar) queryIndex++;
147056
+ }
147057
+ return queryIndex === query.length;
147058
+ }
147059
+ /**
147060
+ * Edit-distance budget, proportional to query length. A fixed budget would
147061
+ * let a 3-letter query match nearly any 3-letter word.
147062
+ */
147063
+ function fuzzyThreshold(queryLength) {
147064
+ if (queryLength < 4) return 0;
147065
+ if (queryLength <= 7) return 1;
147066
+ if (queryLength <= 12) return 2;
147067
+ return 3;
147068
+ }
147069
+ /**
147070
+ * Bounded Damerau-Levenshtein (optimal string alignment: one adjacent
147071
+ * transposition is one edit). `null` once the distance is provably over
147072
+ * `maxDistance`. Three rotating rows because the transposition term reads
147073
+ * the row two back.
147074
+ */
147075
+ function boundedOsaDistance(a, b, maxDistance) {
147076
+ if (a === b) return 0;
147077
+ if (maxDistance <= 0) return null;
147078
+ if (Math.abs(a.length - b.length) > maxDistance) return null;
147079
+ const bLen = b.length;
147080
+ let rowBefore = new Array(bLen + 1).fill(0);
147081
+ let rowPrev = Array.from({ length: bLen + 1 }, (_, j) => j);
147082
+ let rowCurr = new Array(bLen + 1).fill(0);
147083
+ for (let i = 1; i <= a.length; i++) {
147084
+ rowCurr[0] = i;
147085
+ let rowMin = i;
147086
+ const aChar = a[i - 1];
147087
+ if (aChar === void 0) return null;
147088
+ for (let j = 1; j <= bLen; j++) {
147089
+ const bChar = b[j - 1];
147090
+ const prevDelete = rowPrev[j];
147091
+ const prevDiag = rowPrev[j - 1];
147092
+ const currInsert = rowCurr[j - 1];
147093
+ if (bChar === void 0 || prevDelete === void 0 || prevDiag === void 0) return null;
147094
+ if (currInsert === void 0) return null;
147095
+ const substitutionCost = aChar === bChar ? 0 : 1;
147096
+ let value = Math.min(prevDelete + 1, currInsert + 1, prevDiag + substitutionCost);
147097
+ const prevA = a[i - 2];
147098
+ const prevB = b[j - 2];
147099
+ const transpose = rowBefore[j - 2];
147100
+ if (i > 1 && j > 1 && prevA !== void 0 && prevB !== void 0 && aChar === prevB && prevA === bChar) {
147101
+ if (transpose !== void 0) value = Math.min(value, transpose + 1);
147102
+ }
147103
+ rowCurr[j] = value;
147104
+ if (value < rowMin) rowMin = value;
147105
+ }
147106
+ if (rowMin > maxDistance) return null;
147107
+ const recycled = rowBefore;
147108
+ rowBefore = rowPrev;
147109
+ rowPrev = rowCurr;
147110
+ rowCurr = recycled;
147111
+ }
147112
+ const result = rowPrev[bLen] ?? Infinity;
147113
+ return result <= maxDistance ? result : null;
147114
+ }
147115
+ /**
147116
+ * Fuzzy levels, only after every exact level missed.
147117
+ * 6 — subsequence of the whole text
147118
+ * 7 — some WORD of the text is within a length-proportional OSA distance
147119
+ */
147120
+ function fuzzyMatchRank(normalizedText, query) {
147121
+ if (isSubsequence(normalizedText, query)) return RANK_SUBSEQUENCE;
147122
+ const threshold = fuzzyThreshold(query.length);
147123
+ if (threshold > 0) {
147124
+ for (const word of normalizedText.split(/\s+/)) if (boundedOsaDistance(word, query, threshold) !== null) return RANK_FUZZY_WORD;
147125
+ }
147126
+ return null;
147127
+ }
147128
+ /** Best fuzzy rank across `texts`, or `null`. Subsequence (6) is the best fuzzy can be. */
147129
+ function bestFuzzy(texts, query) {
147130
+ let best = null;
147131
+ for (const text of texts) {
147132
+ const rank = fuzzyMatchRank(text, query);
147133
+ if (rank === null) continue;
147134
+ if (best === null || rank < best) best = rank;
147135
+ if (best === RANK_SUBSEQUENCE) return best;
147136
+ }
147137
+ return best;
147138
+ }
147139
+ /**
147140
+ * Rank `rawQuery` against one record. `null` when nothing matches, including
147141
+ * a blank query. Keywords are fuzzied only when the label produced no rank,
147142
+ * so a label hit is never demoted or promoted by a keyword.
147143
+ */
147144
+ function searchRank(rawQuery, fields) {
147145
+ const query = normalizeSearchText(rawQuery);
147146
+ if (query.length === 0) return null;
147147
+ const label = normalizeSearchText(fields.label);
147148
+ const keywords = (fields.keywords ?? []).map(normalizeSearchText).filter((keyword) => keyword.length > 0);
147149
+ return matchRank(label, keywords, (fields.identifiers ?? []).map(normalizeSearchText).filter((identifier) => identifier.length > 0), query) ?? fuzzyMatchRank(label, query) ?? bestFuzzy(keywords, query);
147150
+ }
147151
+ //#endregion
146929
147152
  exports.ACCESSORY_LABEL = ACCESSORY_LABEL;
146930
147153
  exports.ACCESS_ROLES = ACCESS_ROLES;
146931
147154
  exports.ACTION_RUN_MAX_MS = ACTION_RUN_MAX_MS;
@@ -150440,6 +150663,7 @@ exports.normalizeNodeId = require_sleep.normalizeNodeId;
150440
150663
  exports.normalizeOffSeconds = normalizeOffSeconds;
150441
150664
  exports.normalizeOrigin = normalizeOrigin;
150442
150665
  exports.normalizeRecipeUnits = normalizeRecipeUnits;
150666
+ exports.normalizeSearchText = normalizeSearchText;
150443
150667
  exports.normalizeSecretOwner = require_sleep.normalizeSecretOwner;
150444
150668
  exports.normalizeTokenScopes = normalizeTokenScopes;
150445
150669
  exports.normalizeUnit = normalizeUnit;
@@ -150793,6 +151017,7 @@ exports.scoreRuntimes = scoreRuntimes;
150793
151017
  exports.scriptRunnerCapability = scriptRunnerCapability;
150794
151018
  exports.scrubKnownSecrets = require_sleep.scrubKnownSecrets;
150795
151019
  exports.searchIcons = searchIcons;
151020
+ exports.searchRank = searchRank;
150796
151021
  exports.secretArrayPrefixes = require_sleep.secretArrayPrefixes;
150797
151022
  exports.secretKeysOf = secretKeysOf;
150798
151023
  exports.secretTreeFromPaths = require_sleep.secretTreeFromPaths;