V- Modal AI: Visual Video / Image Search - Flutter Video SDK
Dart android-sdkflutterflutter-appflutter-packageflutter-sdkflutter-videoflutter-video-editingflutter-video-playerflutter-video-sdkflutter-videosflutter-videosdkmobile-videomobile-video-editor-sdkmobile-video-sdkvideo-editingvideo-sdkvideo-searchvideo-search-enginevideo-streaming
Release Flutter SDK from 27ce7d0580e7c09839649cd256a2f8a74458531e
vmodal-release-app8b5fef747ba6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6ee528f..e0b0c6d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,3 +1,15 @@+## 1.2.0++- Added CCTV uploads with caller-selected public filenames, searchable metadata+ text, repeated tags, offset-aware footage origins, and canonical timestamp+ response fields across signed, multipart, resumed, bulk, and transcoded paths.+- Added the same additive CCTV fields to direct multipart uploads and fixed the+ transport so every iterable form value is emitted as an independent text+ part on the wire.+- Added absolute-time CCTV search with string metadata queries, paired+ timezone-aware `[start, end)` bounds, scoped propagation, compatibility for+ the legacy metadata map, and an explicit opt-in live contract gate.+## 1.1.0- Added ordered asynchronous batch search with mini-batch ownership, boundeddiff --git a/README.md b/README.mdindex 4a67254..10ba2db 100644--- a/README.md+++ b/README.md@@ -166,6 +166,56 @@ await progress.cancel();print('Ready: ${uploaded.fileName}');```+For CCTV footage, provide the public filename and offset-aware recording+origin in `VideoUploadOptions`. The backend—not the SDK—normalizes the datetime+and returns the canonical UTC epoch milliseconds. Metadata tags are repeated+independently on the wire.++```dart+final task = favorites.upload(+ UploadSource.fromFile(File(cameraClipPath)),+ options: const ScopedUploadOptions(+ uploadOptions: VideoUploadOptions(+ videoFilename: 'entrance-camera.mp4',+ metadataText: 'north entrance delivery lane',+ metadataTags: ['entrance', 'delivery', 'camera-3'],+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ ),+ ),+);+final uploaded = await task.result;+print(uploaded.startTsUnixUserMs); // canonical backend value+```++Search the same footage using a metadata string and an absolute range. Start is+inclusive and end is exclusive. Datetime values must include `Z` or an explicit+UTC offset; the SDK preserves the caller text without timezone conversion.++```dart+final moments = await favorites.search(+ 'vehicle',+ options: const ScopedSearchOptions(+ queryMetadataText: 'delivery',+ startDate: '2026-07-30T09:15:00.000+09:00',+ endDate: '2026-07-30T09:16:00.000+09:00',+ searchSources: ['image'],+ ),+);+```++The low-level direct multipart endpoint accepts the same contract additively:++```dart+await client.collections.uploadFile(+ filePart('file', File(cameraClipPath), contentType: 'video/mp4'),+ groupName: 'camera_archive',+ videoFilename: 'entrance-camera.mp4',+ metadataText: '',+ metadataTags: ['entrance', 'camera-3'],+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+);+```+Signed single upload is the production default for every file size. Multipart upload is experimental and must be enabled explicitly with `VideoUploadOptions(multipart: true)`; it fails with `FeatureDisabled` when the complete backend route family is unavailable.Uploads use exact file ranges, awaited socket streaming, coalesced progress, anddiff --git a/RELEASE_METADATA b/RELEASE_METADATAindex 040271f..2d117ca 100644--- a/RELEASE_METADATA+++ b/RELEASE_METADATA@@ -1 +1 @@-Source-vmx-api: c3426840f3c0c5245b0028fa9bca2a29c336b77e+Source-vmx-api: 27ce7d0580e7c09839649cd256a2f8a74458531ediff --git a/SOURCE_MANIFEST.sha256 b/SOURCE_MANIFEST.sha256index c4d91de..0e973c1 100644--- a/SOURCE_MANIFEST.sha256+++ b/SOURCE_MANIFEST.sha256@@ -2,18 +2,18 @@ e789cd4d1bed8a78ec8014c5c5913e300f81b63ea56a56aacb0dfec3b5e7ce2b ./.flutter-verfbbda2e7e29bbd860539a9ca18c478f3b02de140f25a872c19a6dbecd11bc94b ./.github/workflows/publish.ymla98f72526420d47e76b9b4e67ac86acd06b7088ad1f4c35617b11b09e59346ea ./.gitleaks.toml5115d06bd9913f466d50fcbf8ad8890372349060c54a4581f3481ea084cfdec6 ./.pubignore-8087660c63935bd64fedee0cbf615a7aa706dea9649b945d7404903df03332af ./CHANGELOG.md+0745f674359a58ea64d2d520f9bae88a57839b0aa812345ba6e49deff9f0d259 ./CHANGELOG.md37b7148216ac6090e36adfb699d642b8dd1e1b8ba99870e65e88733947a59fa6 ./LICENSE-d63378f391ef251ea0afb8841c6886841cab25352d845630c1a117f83e281723 ./README.md-58968890f9f778e6301b09005e9a9cbf60f9714c696e5e371ac9bab3fda8553c ./RELEASE_METADATA+c375e0f050a27469f4a9885e117f7f9351837d7141d9b6fe6cb15a3e3c2caead ./README.md+557d70f4aca0defa2f2658b9bca1aabc374e9de2f5577d738865799b663de565 ./RELEASE_METADATAdef7e4f643adff5b01b877b6a7fa5b2381612b693c0bf06bd232ee0f7197d342 ./analysis_options.yaml8c2d096dc399d9bea2fcc5ae19d987e7458c8503cf2a7edf1f1497ae00d681aa ./build.sh4f18642680fb433554a5523d00bd99e0d650af340bcaebe628f59f63ac84e458 ./dartdoc_options.yaml75461620cf3a062f4dad10e034952b82cca461b483788de1f46c539aca8b0f0f ./doc/manage_api_key.mda66d39da0983a994474fa516f81fd41bbb131efbd69c955891a41781a76daf24 ./doc/performance.md-cae6114908952cf81a908b7fcc8c0ba4ce3f866e9dbaf974303273f334e0e3f6 ./doc/release.md-79ef7a2c5e695699a5d784af5ec72a515401bf7d21f632a2ccc1e973db230e10 ./doc/sdk_contract.md-2c07c5319044416d722732f731cc709fc6f6f3e375861bb6b5326a8768258de5 ./doc/sdk_doc.md+8907513a40851118be2a896478d19ab3f25a69994a67d3af539636f8f9494949 ./doc/release.md+616b3b20c5166ed48e1d6d8ba48bf34f1cad7c11dcd88ad8276c416faf30200b ./doc/sdk_contract.md+797404fa5975951d5ddb0ee4fde4db16d6ece935c530adcd4ad5591a2fd7ef06 ./doc/sdk_doc.mdc0f878afdfd9f8b9914d60ce1c7bc15a54d2c8631826a3a6d17907d4c2ada846 ./doc/search_app.md7b0acfc01cfa4c8bf3af8aeb19741e65b8e9406935d9ab8e0f4cb84547483e55 ./doc/transcode_360.mde246ed229511a24a1ee7e98529c203ef90d1d352290ce8486caebe05683db3a0 ./env.sh@@ -79,7 +79,7 @@ fd367b6c43006d61b730f674970dd48b9f662c8f2264e52ffc1558102a2c9f2d ./example/01_fadd68b905971dedfcc0d0b5b7118030de5925ba8c081ad9815463699e3a444ad ./example/01_full_app/ios/Runner/SceneDelegate.swift5e8f4908dacea6f29b2a790e4d38bf5fded69096063f9a27a2f21584d62b30c0 ./example/01_full_app/ios/RunnerTests/RunnerTests.swiftf008f1671accf86a236929d5163da59f7e53015a53ef1578a5e8c31699077311 ./example/01_full_app/lib/main.dart-be95ef4175d5612d170388c188fffecacb136f56d9d77ffc97eecd6bc611d409 ./example/01_full_app/pubspec.lock+525b42257a8cdcaf2e03852955d4f0989fd812c52b7bf8feeae539469071017c ./example/01_full_app/pubspec.lock875af508f7c6d9654985b402c26364d4ca6b1c06b3846a71a77997b905e2ad6e ./example/01_full_app/pubspec.yaml90a79c18d158515dab7616e273e9effd9cc0726c56fe6ce3cc123b5a8a8337cc ./example/01_full_app/test/widget_test.dart3c54909945bc3d6fe78d70a0f673377b6ab6b0c6c4b86c02291f5fbefdc9736f ./example/02_users/README.md@@ -90,37 +90,38 @@ a15f6dfd128db08dff98caa715b2c5041812f794fbfe283098bb98b94b345841 ./example/02_ub373342c889d099d99a3209cb01cea188b53eb5b43ae26cad952abf5fda833bd ./example/02_users/lib/src/example_session.dart94fc4c3cfb6774eee9f39c1d97447abab52105ce6be85457d8f9d25bff3014ab ./example/02_users/lib/user_examples.dart4d7075d4d50457aa65b2a91d4bcdf9778ae95e86c6c276a91172dcc5cd60017c ./example/02_users/lib/user_streams.dart-8b94cce29d65df6bee41121595fb8181ffca9d54ef018036fe76fab96166c828 ./example/02_users/pubspec.lock+ba3e6fe312940da56de324b044529900a0bfb5f94065d730f5b6ca5a8e61b83b ./example/02_users/pubspec.lockfa541e11cb4b9b791630b658c6856743ec4c31d957deb285ed031e7d4c2d48c6 ./example/02_users/pubspec.yaml31f28ca22dfb931fe963d2f766d8b5cba3c2722bca839787a506f1a692393a8c ./example/02_users/test/user_examples_test.dart23756b83470b1f25f6a7e6b5a6270f123a5224e49fd8e2eda36001358951b688 ./install.sh7becacd31a8d134fa435b39cd819798d5fbf58f89b9f30c50362e2dcf757aaed ./lib/src/adaptive_upload.dart9464fff0c519a1ce70cddefb3e3eaa95d07b97ccdaf5b8381c01d7c88767ae83 ./lib/src/api_key_provider.dart-cffedb3aa8d7b94d0afbe946cf6af41ec4d9b588a6fdbb6d224c2a31e103da3b ./lib/src/client.dart-e253b7c657eac4f7598d196e3943a05ab3a4da8568d5f45da41112bfb8e0c532 ./lib/src/collection_uploads.dart+adf2d1db83503aba601b0fa8efac73b04a31d970eea580257910a8048f256404 ./lib/src/client.dart+56854450130793060945446c9d4f812dab1ef80de83c51db5f9f4fdc13851c9d ./lib/src/collection_uploads.dart3591a3bfd33164aadcd65b5d5b02bafc5f36b577a304a0e87bec8fb7ac34bb8b ./lib/src/config.dartd3e03d9a72a499659c70f2296115d1d3138b9370a017e027d8255f85f7fb1c5c ./lib/src/content_scope.dart873d969cfed5c725d34df0fd0c8769462b56992cf523710fcf741a81fa1bbcad ./lib/src/errors.dart027174edd680e69e067453695f62680fd90b16c78f74a6999ab926cd2fd257dc ./lib/src/http.dart-7670598bf28a23808d0e0bd3e3ea1ec7270fbc450caef2ecc1c0ab0921d17538 ./lib/src/models.dart-92d2769b42db1062f91c49573af5537793ec98de07c0cf71de074a288816aabd ./lib/src/resources.dart+3c026d1046fd2380d25b82f252fd3e75967a773adff4c1aed749a7d6cf139432 ./lib/src/models.dart+1612baa4be9d9f1489673ea1368698209fbca9199e9f927a114d696a413deb09 ./lib/src/resources.dart43770c621bffccf69eacebd1e3b297503ca288093c848f0e8ccbd118d7f0d88a ./lib/src/routes.dart27056230065682f3ea3aa747c39c08950dcdca87387f4733adfad18f4b345b06 ./lib/src/routes.g.dart42331852249c8f99874a5e3889c752fd344ad8a5301ede246d5a4fbccb4191f2 ./lib/src/transcode.dart-b2ccf933ff5406ecd0bdbe9ad695ccf790926ceb8bbfcd4068490d2d7683fcc9 ./lib/src/transport.dart+362f472ea7ed5ec09dc0272239865ac12100a8c2fa3f73f45ccfeaedebe77395 ./lib/src/transport.dart8a9ab7a18da892c10f4004d0188f71cf60c31d3207b08617d70f0a7e4fde4d0e ./lib/src/upload.dart-785e261474d92bc6aa5da8a4dcc9429577b590dbeda2098da2c581d862e3f6a8 ./lib/src/utils.dart-b226ddcc0b8cb58b4753545752c2df1c6301bdf76842730e7f6ecf2d06d29892 ./lib/src/vmodal.dart+6c80bc04d98a46141c0066655b95d89c26fbfa155fe07cdbd2b6062a6dd2ac71 ./lib/src/utils.dart+e4413678ceb7bdfc1f6aaa241c53d8ba2033fc5171dd0a30030b62946d14008e ./lib/src/vmodal.dart14f02410389d19abb09ca40ff69c6267f3ad0b8b40ab115aa6e2c76bf43bfeef ./lib/vmodal_sdk_flutter.dart72fff91181fd3e25fd9afd766930a67025205b61096fd35c55cbdd9a3178ecf0 ./pubspec.lock-d419b05ec4674460d54f1143107138b11027ac6a842ae13b95b1509f1bea6235 ./pubspec.yaml+99aef519729868a9134d5783788eca035446858911b2be3a1a4c3c8efbe4eb97 ./pubspec.yamla80b38547f5d9ca1874f60e71c648e3fc12ab5f7cb88d1bead6d5b863d3c0245 ./readme_assets/dev_homepage.jpgc56419d129059b64551e06f074e88ef62676f25938dc2a1fe28a6ab3f2ba8547 ./readme_assets/logo_vmodal_owl.jpeg3198051c448338c5331baef7e17ff32bfbaf1265b59543a8aca2baf57513feed ./run.shd2dfce0e68717f8626ecaadb4552f7471ced1dbdfe6a51182e0d62c24a1b718b ./security_check.sh-ae6bda64ca6d1bd107e60a60dfb5732b284402f0de3fe6b9a83c4ea5a9a97c70 ./test.sh+75d9810c9d50fd1224462aba8d2d1669cbfa094bd9cc0e5275f3a6a9f1364cb5 ./test.shbe59599b9ba77d031e9b4bad7f8d5c59efd2687888c5b73be4fbea115902106b ./test/adaptive_upload_test.dart002abcc5d95c0cf20375adefe4ee2472581a615e64f5726bf361dd5c679cdea7 ./test/auth_http_test.dart+51001c445940a527271418f3eded8af669dd1eb6c450504e9dd1f12ec16d66a0 ./test/cctv_contract_test.dart3cb772c473b1657f2aaeebd8281e4d9cfee1aaa10b70badb70a1df8d5d7bc389 ./test/client_test.dart56eb465d0c149368f68dce9d54e48ad8f61476b912525d5783fac7de7b7c2943 ./test/config_routes_test.dart4b9358bc8c8eb76b84dffc1c85d699169d890b4878af967f490bcddfcd6bd869 ./test/docs_reference_test.dart@@ -128,17 +129,18 @@ b45470d8e7674bcb87828a8dcf231ac29afb4418774972c66e60cea9788270db ./test/errors_d132b6dceb89804a47418245845547a25fcf8f89f56b292ee70a404d63364865 ./test/fakes.dart0a1394c90829b91541aa01e9786e3195aae04fc49a7b92775dbf404bf2802107 ./test/fakes_test.dart14368b598ece0ce9b2e249148a10a92f2c80e38427c077013a1515826f4365bd ./test/fixtures/routes_contract.json-959b19196513005ffd19bded8e4a2867a0fa84c8e85eae84aeebcc7fc70f8f88 ./test/multipart_upload_test.dart+593b356ac3431de80e03e7a0e2f1df0d29589140f44746468213c1cac1c35bbe ./test/multipart_upload_test.dart348b9581f6262acaaf96012a3d57685b0b45c3663c1497f14135663de7a60954 ./test/new_api_surface_test.dart58222c7f00e8aa8070df89d59278ce0d18842f53a7544261aa4a63ae4b1dd608 ./test/regression_manifest_test.dart8c87a4645a2e329477d070277f64b617da14ac90163bb734fbb5326c1a97a5c3 ./test/resources_models_test.dart8619ce113bb8669612f9a2a16b1b334ac68435c5972e84828a789511467fcb77 ./test/shell_scripts_test.dart-deacf67ef61894d8fd7d3cdd7648bace527917fe2097c65140286d324ec8b1aa ./test/transcode_upload_test.dart-7f62ef6965a51fee7123689003432dd013936b4189504222333cedb55c82dcc2 ./test/transport_test.dart+efe4f1158e7d4b9ca8e57f3538ce296279817292a4356c1399cf5f2cbae4c52d ./test/transcode_upload_test.dart+b94c0fef25560e387c4de5de0e4032fce73aa22b23a4bf38594ea6ff241d914c ./test/transport_test.dartc4aa3c091992668ee531412a7fc783106769df7d75147eb06271492027b0c100 ./test/upload_test.dartaf4a5b0eaca0bc1b2ef86cb88900fb67185b619cd90e6b5598ff9276a147d0b5 ./test/workflow_layout_test.dart406de1350b79662fcaf007cb0cacd7a6b71b83815dc7cd3c7b561fcfba5600a3 ./tool/check_route_sync.dartd5f5f9246656a5c275c5ab5863dbf3945d8ef6b1c9042c9d1912cfafce93646f ./tool/flutter_checksums.txt+fdfa4afc514f240ced579da3b9fb7637e701fbda33dea8f2fd4c97debf7dfbb4 ./tool/live_cctv_test.dartd09e2ee68e0e238b86e54a8248a0da92db81c953ce691628708bffd63fa3e737 ./tool/live_test.dartd0eb57dd08a93b8afe4dc8f078db8b7ba7bdfc926292c2cff183c6489104c776 ./tool/perf_benchmark.dart-659036b205fa10868d9b1b5861f5ac18931d41740b8145d50914a6b555ff9071 ./tool/release_manifest.dart+98c97292e3feb880f6412a1635364ddc09d0711e424db35e0d053c006d5476ec ./tool/release_manifest.dartdiff --git a/doc/release.md b/doc/release.mdindex 733cb81..54d0eae 100644--- a/doc/release.md+++ b/doc/release.md@@ -5,6 +5,12 @@ archive checksum and installs only into a user-owned cache. Run `bash test.sh alfor the offline gate and `bash test.sh live` only after explicitly loading theexisting repository test credential variables.+The CCTV contract has a separate opt-in gate, `bash test.sh cctv_live`. It+uploads its own fixture and collection, verifies canonical timestamp fields,+metadata filters, and absolute JST/UTC ranges, then deletes only that temporary+collection. It remains outside `test.sh all` and runs explicitly in the Flutter+release workflow.+The release workflow is manually dispatched during development. Exact-candidate`RELEASE_SHA` checkout and `git rev-parse` verification lines are retained ascomments so they can be restored later, but they do not gate the fast releasediff --git a/doc/sdk_contract.md b/doc/sdk_contract.mdindex 4dcca63..ee80c0f 100644--- a/doc/sdk_contract.md+++ b/doc/sdk_contract.md@@ -48,6 +48,29 @@ or API-key-provider contract. `VmodalClient` remains public and compatible.`VModal.fromClient` transfers lifecycle ownership, so the project is the objectthat must be closed.+## CCTV timestamp and metadata contract++`VideoUploadOptions` carries `videoFilename`, `metadataText`, repeated+`metadataTags`, `startDatetimeUser`, and `reProcess` through signed single,+multipart, completed-resume, bulk, and transcoded uploads. A timestamp without+an explicit public filename derives the original source filename; a generated+transcode filename never becomes the public CCTV name. Multiple bulk sources+cannot share one explicit public filename.++`startDatetimeUser` must include `Z` or an explicit UTC offset. Flutter sends+the value unchanged and never calculates `start_ts_unix_user_ms`; the backend+returns that canonical integer together with the normalized datetime and+`timestamp_source`. Null optional values are omitted, `metadataText: ''` is an+explicit empty value, and each metadata tag is a separate query or multipart+field. `re_process` is always sent on signed finalization.++Direct `uploadFile` supports the same additive fields while retaining legacy+`description` and repeated `tag`. Search uses `queryMetadataText` as the string+`query_metadata` value. The legacy `queryMetadata` map remains temporarily+available but cannot be combined with the string form. For `vid_file`, date+bounds must be paired; start is inclusive, end is exclusive, date-only values+are allowed, and datetime values require `Z` or an explicit offset.+Android regression groups map to Flutter suites as follows: configuration/routesand credentials (`config_routes_test`, `auth_http_test`), transport/bounds andcancellation (`transport_test`), resources/models (`resources_models_test`),diff --git a/doc/sdk_doc.md b/doc/sdk_doc.mdindex 3e480e1..84593c3 100644--- a/doc/sdk_doc.md+++ b/doc/sdk_doc.md@@ -73,6 +73,21 @@ Uploads use reopenable `UploadSource` streams. Signed single upload is alwaysthe default. `UploadTask` exposes a result future, broadcast progress stream,and per-task cancellation. Multipart requires explicit opt-in and is experimental.+CCTV signed uploads use `VideoUploadOptions(videoFilename, metadataText,+metadataTags, startDatetimeUser, reProcess)`. The timestamp input must contain+`Z` or an explicit UTC offset and is sent unchanged; the backend owns+normalization and the canonical `startTsUnixUserMs` response. Tags remain+ordered repeated wire values, including after multipart resume, bulk upload,+or transcoding. A timestamp with no public name derives the original source+filename.++`CollectionsResource.uploadFile` accepts the same CCTV fields for direct+multipart compatibility. Use `SearchRequest.queryMetadataText` or+`ScopedSearchOptions.queryMetadataText` for the backend string metadata+contract. In `vid_file` mode, `startDate` and `endDate` are a required pair,+with inclusive start and exclusive end; datetime values require `Z` or an+explicit UTC offset and are never converted by the SDK.+Flutter Web, login UI, key persistence, file picking, widget state management,and background scheduling are outside the package. The first release supportsFlutter applications on Android and iOS.diff --git a/lib/src/client.dart b/lib/src/client.dartindex ee5d245..bdbe9bd 100644--- a/lib/src/client.dart+++ b/lib/src/client.dart@@ -7,7 +7,7 @@ import 'transport.dart';import 'upload.dart';/// Version of the Dart SDK contract represented by this package.-const String vmodalSdkVersion = '1.1.0';+const String vmodalSdkVersion = '1.2.0';/// Owns configuration, transports, and feature resources for one app session.///diff --git a/lib/src/collection_uploads.dart b/lib/src/collection_uploads.dartindex 8a49ee5..9510eee 100644--- a/lib/src/collection_uploads.dart+++ b/lib/src/collection_uploads.dart@@ -31,6 +31,11 @@ class VideoUploadOptions {this.sessionStore,this.adaptiveConditions,this.transcoder = const PassthroughVideoTranscoder(),+ this.videoFilename,+ this.metadataText,+ this.metadataTags,+ this.startDatetimeUser,+ this.reProcess = false,});/// Enables experimental multipart upload behavior.@@ -67,14 +72,37 @@ class VideoUploadOptions {/// [VideoUploadResponse] mirroring the Python `video_upload(reduce_size=...)`.final VideoTranscoder transcoder;+ /// Public CCTV filename used by metadata, frame paths, and search joins.+ final String? videoFilename;++ /// Searchable CCTV metadata text. An explicit empty string is preserved.+ final String? metadataText;++ /// Repeated CCTV metadata tags, snapshotted when an upload starts.+ final List<String>? metadataTags;++ /// Caller footage origin. Must include `Z` or an explicit UTC offset.+ final String? startDatetimeUser;++ /// Allows replacement of an existing CCTV timestamp during finalization.+ final bool reProcess;+/// Effective checkpoint store.UploadSessionStore get store => sessionStore ?? UploadSessionStores.memory;/// Returns options resolved for [size] using [adaptiveConditions].VideoUploadOptions resolvedFor(int size) {- if (!multipart || adaptiveConditions == null) return this;- final preset = AdaptiveUploadPolicy.select(size, adaptiveConditions!);- return copyWith(+ final current = metadataTags == null+ ? this+ : copyWith(metadataTags: List<String>.unmodifiable(metadataTags!));+ if (!current.multipart || current.adaptiveConditions == null) {+ return current;+ }+ final preset = AdaptiveUploadPolicy.select(+ size,+ current.adaptiveConditions!,+ );+ return current.copyWith(partSizeBytes: preset.partSizeBytes,maxConcurrency: preset.maxConcurrency,maxPartAttempts: preset.maxPartAttempts,@@ -94,6 +122,11 @@ class VideoUploadOptions {UploadSessionStore? sessionStore,UploadConditions? adaptiveConditions,VideoTranscoder? transcoder,+ String? videoFilename,+ String? metadataText,+ List<String>? metadataTags,+ String? startDatetimeUser,+ bool? reProcess,}) => VideoUploadOptions(multipart: multipart ?? this.multipart,multipartThresholdBytes:@@ -106,13 +139,28 @@ class VideoUploadOptions {sessionStore: sessionStore ?? this.sessionStore,adaptiveConditions: adaptiveConditions ?? this.adaptiveConditions,transcoder: transcoder ?? this.transcoder,+ videoFilename: videoFilename ?? this.videoFilename,+ metadataText: metadataText ?? this.metadataText,+ metadataTags: metadataTags ?? this.metadataTags,+ startDatetimeUser: startDatetimeUser ?? this.startDatetimeUser,+ reProcess: reProcess ?? this.reProcess,);/// Max size for a single video upload (100 MB). Larger files are rejected.static const int maxVideoUploadBytes = 100 * 1024 * 1024;/// Validates the source [size] and multipart constraints.- void validate(int size) {+ void validate(+ int size, {+ String mode = 'vid_file',+ String sourceFileName = '',+ }) {+ validateCctvUpload(+ mode: mode,+ sourceFileName: sourceFileName,+ videoFilename: videoFilename,+ startDatetimeUser: startDatetimeUser,+ );if (size > maxVideoUploadBytes) {throw ValidationException('video file too large: $size bytes exceeds the '@@ -159,7 +207,11 @@ extension CollectionUploads on CollectionsResource {VideoUploadOptions options = const VideoUploadOptions(),}) {final resolved = options.resolvedFor(source.contentLength);- resolved.validate(source.contentLength);+ resolved.validate(+ source.contentLength,+ mode: mode,+ sourceFileName: source.fileName,+ );return UploadTask<VideoUploadResponse>.start((CancellationToken cancellation,void Function(UploadProgress) emit,@@ -193,11 +245,20 @@ extension CollectionUploads on CollectionsResource {int ttl = 12600,VideoUploadOptions options = const VideoUploadOptions(),}) {+ if (sources.length > 1 && options.videoFilename != null) {+ throw const ValidationException(+ 'bulk upload cannot share one video_filename across multiple sources',+ );+ }final resolved = sources.map((UploadSource source) => options.resolvedFor(source.contentLength)).toList();for (var i = 0; i < sources.length; i++) {- resolved[i].validate(sources[i].contentLength);+ resolved[i].validate(+ sources[i].contentLength,+ mode: mode,+ sourceFileName: sources[i].fileName,+ );}final sessionKeys = <String>{};for (var i = 0; i < sources.length; i++) {@@ -340,6 +401,7 @@ extension CollectionUploads on CollectionsResource {mode,modality,ttl,+ options,cancellation,emit,permits,@@ -388,6 +450,11 @@ extension CollectionUploads on CollectionsResource {);}final sourceSize = source.contentLength;+ final publicName = strCctvVideoFilename(+ source.fileName,+ options.videoFilename,+ options.startDatetimeUser,+ );final result = await options.transcoder.reduce(input);final produced = result.output.absolute.path != input.absolute.path;final temp = UploadSource.fromFile(@@ -398,9 +465,16 @@ extension CollectionUploads on CollectionsResource {throw const ValidationException('transcoder produced an empty file');}final pass = options- .copyWith(transcoder: const PassthroughVideoTranscoder())+ .copyWith(+ transcoder: const PassthroughVideoTranscoder(),+ videoFilename: publicName,+ ).resolvedFor(temp.contentLength);- pass.validate(temp.contentLength);+ pass.validate(+ temp.contentLength,+ mode: mode,+ sourceFileName: temp.fileName,+ );final res = await _videoUploadRun(temp,collection,@@ -439,6 +513,7 @@ extension CollectionUploads on CollectionsResource {String mode,String modality,int ttl,+ VideoUploadOptions options,CancellationToken cancellation,void Function(UploadProgress) emit,_UploadPermitPool permits,@@ -470,6 +545,7 @@ extension CollectionUploads on CollectionsResource {stream,mode,modality,+ options,cancellation,);return VideoUploadResponse(<String, Object?>{@@ -485,6 +561,7 @@ extension CollectionUploads on CollectionsResource {'attempt_count': 1,'upload_done': done,'dest_path': '${done['dest_path'] ?? ''}',+ ..._cctvResponseFields(done),});}@@ -550,6 +627,7 @@ extension CollectionUploads on CollectionsResource {stream,mode,modality,+ options,cancellation,);await options.store.remove(sessionKey);@@ -713,6 +791,7 @@ extension CollectionUploads on CollectionsResource {stream,mode,modality,+ options,cancellation,);await options.store.remove(sessionKey);@@ -979,20 +1058,34 @@ extension CollectionUploads on CollectionsResource {String stream,String mode,String modality,+ VideoUploadOptions options,CancellationToken cancellation,- ) => http.request(- 'POST',- Routes.full(Routes.externalUploadDone),- params: <String, Object?>{- 'key': key,- 'mode': mode,- 'group_name': collection,- 'stream_name': stream,- 'modality': modality,- 'filename': source.fileName,- },- cancellation: cancellation,- );+ ) {+ final publicName = strCctvVideoFilename(+ source.fileName,+ options.videoFilename,+ options.startDatetimeUser,+ );+ return http.request(+ 'POST',+ Routes.full(Routes.externalUploadDone),+ params: <String, Object?>{+ 'key': key,+ 'mode': mode,+ 'group_name': collection,+ 'stream_name': stream,+ 'modality': modality,+ 'filename': source.fileName,+ if (publicName != null) 'video_filename': publicName,+ if (options.metadataText != null) 'metadata_text': options.metadataText,+ if (options.metadataTags != null) 'metadata_tags': options.metadataTags,+ if (options.startDatetimeUser != null)+ 'start_datetime_user': options.startDatetimeUser,+ 're_process': options.reProcess,+ },+ cancellation: cancellation,+ );+ }}class _UploadContract {@@ -1205,8 +1298,17 @@ VideoUploadResponse _multipartResponse('attempt_count': attempts,'upload_done': done,'dest_path': '${done['dest_path'] ?? ''}',+ ..._cctvResponseFields(done),});+Map<String, Object?> _cctvResponseFields(Map<String, Object?> done) =>+ <String, Object?>{+ 'video_filename': done['video_filename'],+ 'start_datetime_user': done['start_datetime_user'],+ 'start_ts_unix_user_ms': done['start_ts_unix_user_ms'],+ 'timestamp_source': done['timestamp_source'],+ };+Uri _signedUri(String value) {final uri = Uri.tryParse(value);if (uri == null || !uri.hasScheme || uri.host.isEmpty) {diff --git a/lib/src/models.dart b/lib/src/models.dartindex f21c55f..d5ffc92 100644--- a/lib/src/models.dart+++ b/lib/src/models.dart@@ -73,13 +73,15 @@ class AdminUserStatItem extends JsonBackedResponse {/// Parameters for a multimodal media search.///-/// At least one of [queryText] or [imageQuery] must be nonblank. Defaults-/// search common speech, visible-text, and image sources with union semantics.+/// At least one of [queryText], [imageQuery], or [queryMetadataText] must be+/// nonblank. Defaults search common speech, visible-text, and image sources+/// with union semantics.class SearchRequest {/// Creates a search request with mobile-oriented defaults.const SearchRequest({this.queryText = '',this.queryMetadata,+ this.queryMetadataText,this.imageQuery,this.mode = 'vid_file',this.groupName = 'agroup',@@ -96,7 +98,13 @@ class SearchRequest {});final String queryText;++ /// Legacy structured metadata query kept for source compatibility.+ @Deprecated('Use queryMetadataText for the current CCTV string contract.')final Map<String, Object?>? queryMetadata;++ /// CCTV metadata text serialized as the `query_metadata` string.+ final String? queryMetadataText;final String? imageQuery;final String mode;final String groupName;@@ -113,15 +121,33 @@ class SearchRequest {/// Validates the required query input.void validate() {- if (queryText.trim().isEmpty && (imageQuery?.trim().isEmpty ?? true)) {- throw const ValidationException('query_text or image_query is required');+ if (queryMetadata != null && queryMetadataText != null) {+ throw const ValidationException(+ 'query_metadata map and query_metadata_text cannot both be set',+ );+ }+ if (queryText.trim().isEmpty &&+ (imageQuery?.trim().isEmpty ?? true) &&+ (queryMetadataText?.trim().isEmpty ?? true)) {+ throw const ValidationException(+ 'query_text, image_query, or query_metadata_text is required',+ );+ }+ if (mode == 'vid_file' && (startDate == null) != (endDate == null)) {+ throw const ValidationException(+ 'vid_file absolute time filtering requires both start_date and end_date',+ );+ }+ if (mode == 'vid_file') {+ _validateVidFileDate(startDate, 'start_date');+ _validateVidFileDate(endDate, 'end_date');}}/// Converts this request to its structured transport representation.Map<String, Object?> toJson() => _withoutNull(<String, Object?>{'query_text': queryText,- 'query_metadata': queryMetadata,+ 'query_metadata': queryMetadataText ?? queryMetadata,'image_query': imageQuery,'mode': mode,'group_name': groupName,@@ -138,6 +164,20 @@ class SearchRequest {});}+void _validateVidFileDate(String? value, String name) {+ if (value == null) return;+ final clean = value.trim();+ if (clean.isEmpty || DateTime.tryParse(clean) == null) {+ throw ValidationException('$name must be a valid ISO-8601 value');+ }+ if (RegExp(r'^\d{4}-\d{2}-\d{2}$').hasMatch(clean)) return;+ if (!RegExp(r'(?:[zZ]|[+-]\d{2}:\d{2})$').hasMatch(clean)) {+ throw ValidationException(+ '$name must include Z or an explicit UTC offset for vid_file',+ );+ }+}+/// Parameters for previewing or confirming collection deletion.class DeleteCollectionRequest {/// Creates a deletion request. [dryRun] and [confirm] default to `false`.@@ -550,6 +590,10 @@ class VideoUploadResponse extends JsonBackedResponse {resumed = raw['resumed'] == true,attemptCount = intValue(raw['attempt_count']),destPath = '${raw['dest_path'] ?? ''}',+ videoFilename = '${raw['video_filename'] ?? ''}',+ startDatetimeUser = '${raw['start_datetime_user'] ?? ''}',+ startTsUnixUserMs = intValue(raw['start_ts_unix_user_ms']),+ timestampSource = '${raw['timestamp_source'] ?? ''}',reduceSize = raw['reduce_size'] == true,filePath = '${raw['filepath_local'] ?? ''}',sourceFilePath = '${raw['source_filepath_local'] ?? ''}',@@ -575,6 +619,18 @@ class VideoUploadResponse extends JsonBackedResponse {final int attemptCount;final String destPath;+ /// Canonical public CCTV filename returned by finalization.+ final String videoFilename;++ /// Backend-normalized footage origin text.+ final String startDatetimeUser;++ /// Canonical UTC footage origin in epoch milliseconds.+ final int startTsUnixUserMs;++ /// Source of the canonical timestamp, normally `user` for CCTV uploads.+ final String timestampSource;+/// Whether the file was transcoded to a smaller temp before upload.final bool reduceSize;diff --git a/lib/src/resources.dart b/lib/src/resources.dartindex 7ae2406..21c6eb7 100644--- a/lib/src/resources.dart+++ b/lib/src/resources.dart@@ -197,22 +197,46 @@ class CollectionsResource {String streamName = 'astream',String description = '',List<String> tag = const <String>[],+ String? videoFilename,+ String? metadataText,+ List<String>? metadataTags,+ String? startDatetimeUser,+ bool reProcess = false,CancellationToken? cancellation,- }) async => UploadResponse(- await http.request(- 'POST',- Routes.full(Routes.upload),- data: <String, Object?>{- 'mode': mode,- 'group_name': groupName,- 'stream_name': streamName,- 'description': description,- if (tag.isNotEmpty) 'tag': tag,- },- files: <VmodalFilePart>[part],- cancellation: cancellation,- ),- );+ }) async {+ validateCctvUpload(+ mode: mode,+ sourceFileName: part.fileName,+ videoFilename: videoFilename,+ startDatetimeUser: startDatetimeUser,+ );+ final publicName = strCctvVideoFilename(+ part.fileName,+ videoFilename,+ startDatetimeUser,+ );+ return UploadResponse(+ await http.request(+ 'POST',+ Routes.full(Routes.upload),+ data: <String, Object?>{+ 'mode': mode,+ 'group_name': groupName,+ 'stream_name': streamName,+ 'description': description,+ if (tag.isNotEmpty) 'tag': tag,+ if (publicName != null) 'video_filename': publicName,+ if (metadataText != null) 'metadata_text': metadataText,+ if (metadataTags != null) 'metadata_tags': metadataTags,+ if (startDatetimeUser != null)+ 'start_datetime_user': startDatetimeUser,+ 're_process': reProcess,+ },+ files: <VmodalFilePart>[part],+ cancellation: cancellation,+ ),+ );+ }/// Always throws [FeatureDisabled] before any transport call.Never uploadFolder() => throw const FeatureDisabled(diff --git a/lib/src/transport.dart b/lib/src/transport.dartindex a8e8bd7..2d1880a 100644--- a/lib/src/transport.dart+++ b/lib/src/transport.dart@@ -294,7 +294,9 @@ class HttpVmodalTransport implements VmodalTransport {if (value == null) return;if (value is Iterable) {for (final item in value) {- if (item != null) wire.fields[key] = '$item';+ if (item != null) {+ wire.files.add(http.MultipartFile.fromString(key, '$item'));+ }}} else {wire.fields[key] = '$value';diff --git a/lib/src/utils.dart b/lib/src/utils.dartindex 1988062..e0e3929 100644--- a/lib/src/utils.dart+++ b/lib/src/utils.dart@@ -69,6 +69,60 @@ String strMultipartValue(String name, String value, int maxLength) {return value;}+/// Validates the additive CCTV upload fields shared by direct and signed paths.+void validateCctvUpload({+ required String mode,+ required String sourceFileName,+ String? videoFilename,+ String? startDatetimeUser,+}) {+ if ((videoFilename != null || startDatetimeUser != null) &&+ mode != 'vid_file') {+ throw const ValidationException(+ 'video_filename and start_datetime_user require mode vid_file',+ );+ }+ if (videoFilename != null) {+ final name = videoFilename.trim();+ if (name.isEmpty || name.contains('/') || name.contains(r'\')) {+ throw const ValidationException(+ 'video_filename must be a nonblank bare filename',+ );+ }+ final sourceExt = _fileExtension(sourceFileName);+ final publicExt = _fileExtension(name);+ if (sourceExt.isNotEmpty &&+ publicExt.isNotEmpty &&+ sourceExt.toLowerCase() != publicExt.toLowerCase()) {+ throw const ValidationException(+ 'video_filename extension must match the uploaded file extension',+ );+ }+ }+ if (startDatetimeUser != null) {+ final value = startDatetimeUser.trim();+ if (value.isEmpty ||+ !RegExp(r'(?:[zZ]|[+-]\d{2}:\d{2})$').hasMatch(value)) {+ throw const ValidationException(+ 'start_datetime_user must be nonblank and include Z or an explicit UTC offset',+ );+ }+ }+}++/// Resolves the canonical public CCTV filename without changing timestamps.+String? strCctvVideoFilename(+ String sourceFileName,+ String? videoFilename,+ String? startDatetimeUser,+) => videoFilename ?? (startDatetimeUser == null ? null : sourceFileName);++String _fileExtension(String value) {+ final name = value.split(RegExp(r'[/\\]')).last;+ final index = name.lastIndexOf('.');+ return index <= 0 || index == name.length - 1 ? '' : name.substring(index);+}+bool _isControl(int value) => value < 32 || value == 127;int intValue(Object? value) {diff --git a/lib/src/vmodal.dart b/lib/src/vmodal.dartindex 0128b2b..63a6c7e 100644--- a/lib/src/vmodal.dart+++ b/lib/src/vmodal.dart@@ -142,6 +142,7 @@ final class VModalScope {SearchRequest(queryText: query,queryMetadata: options.queryMetadata,+ queryMetadataText: options.queryMetadataText,imageQuery: options.imageQuery,mode: options.mode,groupName: _scope.backendCollectionName,@@ -298,6 +299,7 @@ final class ScopedMetadataOptions {final class ScopedSearchOptions {const ScopedSearchOptions({this.queryMetadata,+ this.queryMetadataText,this.imageQuery,this.mode = 'vid_file',this.searchSources = const <String>['ocr', 'asr', 'image'],@@ -311,7 +313,12 @@ final class ScopedSearchOptions {this.versionLancedb,});+ /// Legacy structured metadata query kept for source compatibility.+ @Deprecated('Use queryMetadataText for the current CCTV string contract.')final Map<String, Object?>? queryMetadata;++ /// CCTV metadata text serialized as the `query_metadata` string.+ final String? queryMetadataText;final String? imageQuery;final String mode;final List<String> searchSources;diff --git a/pubspec.yaml b/pubspec.yamlindex 3ad9582..2c4d3b8 100644--- a/pubspec.yaml+++ b/pubspec.yaml@@ -1,6 +1,6 @@name: vmodal_sdk_flutterdescription: Typed VModal API client for Flutter applications on Android and iOS.-version: 1.1.0+version: 1.2.0license: MITrepository: https://github.com/v-modal/vmodal_sdk_flutterissue_tracker: https://github.com/v-modal/vmodal_sdk_flutter/issuesdiff --git a/test.sh b/test.shindex a8e46ae..6515533 100755--- a/test.sh+++ b/test.sh@@ -7,6 +7,7 @@ help='bash test.sh regression S16bash test.sh allbash test.sh live+ bash test.sh cctv_live'set -euo pipefailcd "$(dirname "$0")"@@ -113,6 +114,20 @@ sdk_live() {sdk_live_lancedb_version}+sdk_cctv_live() {+ local help='+ ## Usage:+ source ../../ztmp/env_gitignore.sh+ bash test.sh cctv_live++ Runs the opt-in CCTV timestamp, metadata, and absolute-time search gate.+ '+ source env.sh+ sdk_env_live+ [[ -n "${VMODAL_API_KEY:-}" ]] || { echo 'Live API credential is required.' >&2; return 2; }+ "$(bash install.sh dart_bin)" run tool/live_cctv_test.dart+}+sdk_all() {local help='## Usage:@@ -147,6 +162,7 @@ case "${1:-test}" insecurity) sdk_security ;;package) sdk_package ;;live) sdk_live ;;+ cctv_live) sdk_cctv_live ;;all) sdk_all ;;clean) sdk_clean ;;help|-h|--help) sdk_help ;;diff --git a/test/cctv_contract_test.dart b/test/cctv_contract_test.dartnew file mode 100644index 0000000..dc84738--- /dev/null+++ b/test/cctv_contract_test.dart@@ -0,0 +1,394 @@+import 'dart:async';++import 'package:flutter_test/flutter_test.dart';+import 'package:vmodal_sdk_flutter/vmodal_sdk_flutter.dart';++import 'fakes.dart';++UploadSource _source(String name) => UploadSource(+ fileName: name,+ contentLength: 2,+ sourceId: name,+ opener: () => Stream<List<int>>.value(<int>[1, 2]),+);++void main() {+ test('CCTV options are immutable in flight and survive adaptive copies', () {+ final tags = <String>['tag1', 'tag2'];+ final options = VideoUploadOptions(+ multipart: true,+ adaptiveConditions: const UploadConditions(),+ videoFilename: 'public.MP4',+ metadataText: '',+ metadataTags: tags,+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ reProcess: true,+ );+ final resolved = options.resolvedFor(10 * 1024 * 1024);+ tags.add('mutated');+ expect(resolved.videoFilename, 'public.MP4');+ expect(resolved.metadataText, '');+ expect(resolved.metadataTags, <String>['tag1', 'tag2']);+ expect(() => resolved.metadataTags!.add('blocked'), throwsUnsupportedError);+ expect(resolved.startDatetimeUser, '2026-07-30T09:15:00+09:00');+ expect(resolved.reProcess, isTrue);+ });++ test('CCTV upload validation fails before transport', () {+ final api = FakeTransport();+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ signedUploadTransport: FakeSignedUploadTransport(),+ );+ final cases = <VideoUploadOptions>[+ const VideoUploadOptions(videoFilename: ' '),+ const VideoUploadOptions(videoFilename: 'folder/camera.mp4'),+ const VideoUploadOptions(videoFilename: r'folder\camera.mp4'),+ const VideoUploadOptions(videoFilename: 'camera.webm'),+ const VideoUploadOptions(startDatetimeUser: '2026-07-30T09:15:00'),+ const VideoUploadOptions(startDatetimeUser: ' '),+ ];+ for (final options in cases) {+ expect(+ () => client.collections.videoUpload(+ _source('camera.mp4'),+ collectionName: 'group',+ subCollectionName: 'stream',+ options: options,+ ),+ throwsA(isA<ValidationException>()),+ );+ }+ expect(+ () => client.collections.videoUpload(+ _source('camera.mp4'),+ collectionName: 'group',+ subCollectionName: 'stream',+ mode: 'img_file',+ options: const VideoUploadOptions(videoFilename: 'camera.mp4'),+ ),+ throwsA(isA<ValidationException>()),+ );+ expect(api.requests, isEmpty);+ });++ test('bulk upload rejects a shared public filename before transport', () {+ final api = FakeTransport();+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ signedUploadTransport: FakeSignedUploadTransport(),+ );+ expect(+ () => client.collections.videoUploadBulk(+ <UploadSource>[_source('a.mp4'), _source('b.mp4')],+ collectionName: 'group',+ subCollectionName: 'stream',+ options: const VideoUploadOptions(videoFilename: 'shared.mp4'),+ ),+ throwsA(isA<ValidationException>()),+ );+ expect(api.requests, isEmpty);+ });++ test(+ 'signed finalize preserves every CCTV value and canonical response',+ () async {+ final tags = <String>['tag1', 'tag2', 'tag3'];+ final api = FakeTransport()+ ..addJson(<String, Object?>{+ 'url': 'https://objects.test/upload',+ 'method': 'PUT',+ 'key': 'key-camera',+ })+ ..addJson(<String, Object?>{+ 'dest_path': 'done/public.mp4',+ 'video_filename': 'public.mp4',+ 'start_datetime_user': '2026-07-30T09:15:00+09:00',+ 'start_ts_unix_user_ms': 1785370500000,+ 'timestamp_source': 'user',+ });+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ signedUploadTransport: FakeSignedUploadTransport(),+ );+ final task = client.collections.videoUpload(+ _source('camera.mp4'),+ collectionName: 'group',+ subCollectionName: 'stream',+ options: VideoUploadOptions(+ videoFilename: 'public.mp4',+ metadataText: '',+ metadataTags: tags,+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ reProcess: true,+ ),+ );+ tags.add('late-mutation');+ final result = await task.result;+ final done = api.requests.last.uri.queryParametersAll;+ expect(done['key'], <String>['key-camera']);+ expect(done['mode'], <String>['vid_file']);+ expect(done['group_name'], <String>['group']);+ expect(done['stream_name'], <String>['stream']);+ expect(done['modality'], <String>['vid_raw']);+ expect(done['filename'], <String>['camera.mp4']);+ expect(done['video_filename'], <String>['public.mp4']);+ expect(done['metadata_text'], <String>['']);+ expect(done['metadata_tags'], <String>['tag1', 'tag2', 'tag3']);+ expect(done['start_datetime_user'], <String>[+ '2026-07-30T09:15:00+09:00',+ ]);+ expect(done['re_process'], <String>['true']);+ expect(result.videoFilename, 'public.mp4');+ expect(result.startDatetimeUser, '2026-07-30T09:15:00+09:00');+ expect(result.startTsUnixUserMs, 1785370500000);+ expect(result.timestampSource, 'user');+ expect(result.raw['upload_done'], isA<Map<String, Object?>>());+ },+ );++ test('non-CCTV signed finalize omits optional fields', () async {+ final api = FakeTransport()+ ..addJson(<String, Object?>{+ 'url': 'https://objects.test/upload',+ 'key': 'key-plain',+ })+ ..addJson(<String, Object?>{'dest_path': 'done/plain.mp4'});+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ signedUploadTransport: FakeSignedUploadTransport(),+ );+ await client.collections+ .videoUpload(+ _source('plain.mp4'),+ collectionName: 'group',+ subCollectionName: 'stream',+ )+ .result;+ final done = api.requests.last.uri.queryParametersAll;+ expect(done, isNot(contains('video_filename')));+ expect(done, isNot(contains('metadata_text')));+ expect(done, isNot(contains('metadata_tags')));+ expect(done, isNot(contains('start_datetime_user')));+ expect(done['re_process'], <String>['false']);+ });++ test('direct multipart upload carries additive CCTV form fields', () async {+ final api = FakeTransport()+ ..addJson(<String, Object?>{+ 'status': 'ok',+ 'video_filename': 'public.mp4',+ 'start_ts_unix_user_ms': 1785370500000,+ });+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ );+ final result = await client.collections.uploadFile(+ VmodalFilePart.bytes(+ fieldName: 'file',+ fileName: 'source.mp4',+ bytes: <int>[1, 2],+ contentType: 'video/mp4',+ ),+ groupName: 'group',+ streamName: 'stream',+ description: 'legacy',+ tag: <String>['old1', 'old2'],+ videoFilename: 'public.mp4',+ metadataText: '',+ metadataTags: <String>['tag1', 'tag2', 'tag3'],+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ reProcess: true,+ );+ final form = api.requests.single.formFields;+ expect(form['description'], 'legacy');+ expect(form['tag'], <String>['old1', 'old2']);+ expect(form['video_filename'], 'public.mp4');+ expect(form['metadata_text'], '');+ expect(form['metadata_tags'], <String>['tag1', 'tag2', 'tag3']);+ expect(form['start_datetime_user'], '2026-07-30T09:15:00+09:00');+ expect(form['re_process'], isTrue);+ expect(result.raw['start_ts_unix_user_ms'], 1785370500000);+ });++ test(+ 'direct timestamp upload derives the original public filename',+ () async {+ final api = FakeTransport()..addJson(<String, Object?>{'status': 'ok'});+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ );+ await client.collections.uploadFile(+ VmodalFilePart.bytes(+ fieldName: 'file',+ fileName: 'camera-source.mp4',+ bytes: <int>[1, 2],+ contentType: 'video/mp4',+ ),+ groupName: 'group',+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ );+ expect(+ api.requests.single.formFields['video_filename'],+ 'camera-source.mp4',+ );+ },+ );++ test(+ 'CCTV search preserves metadata text and absolute timezone ranges',+ () async {+ final api = FakeTransport()+ ..addJson(<String, Object?>{+ 'data': <Object?>[+ <String, Object?>{+ 'ts_unix': '1785370500000',+ 'item_id': 'astream-some_video-1785370500000',+ 'description': 'some text',+ 'text_agg_tok': 'tag1 tag2 tag3',+ 'metadata_join_matched': false,+ },+ ],+ 'cnt_actual': 1,+ 'cnt_total': 1,+ });+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ );+ final response = await client.searches.searchVideo(+ const SearchRequest(+ queryMetadataText: 'tag2',+ groupName: 'group',+ streamName: 'astream',+ startDate: '2026-07-30T09:15:00.000+09:00',+ endDate: '2026-07-30T09:15:00.001+09:00',+ ),+ );+ final body = api.requests.single.jsonBody! as Map<String, Object?>;+ expect(body['query_metadata'], 'tag2');+ expect(body['start_date'], '2026-07-30T09:15:00.000+09:00');+ expect(body['end_date'], '2026-07-30T09:15:00.001+09:00');+ expect(body['query_metadata'], isNot(isA<Map<Object?, Object?>>()));+ final item = SearchResultItem(+ response.data.single! as Map<String, Object?>,+ );+ expect(item.raw['ts_unix'], '1785370500000');+ expect(item.raw['item_id'], contains('some_video'));+ expect(item.raw['description'], 'some text');+ expect(item.raw['text_agg_tok'], contains('tag3'));+ expect(item.raw['metadata_join_matched'], isFalse);+ },+ );++ test('CCTV search rejects conflicting metadata and unsafe date bounds', () {+ final bad = <SearchRequest>[+ const SearchRequest(+ queryMetadata: <String, Object?>{'tag': 'tag1'},+ queryMetadataText: 'tag1',+ ),+ const SearchRequest(queryMetadataText: 'tag1', startDate: '2026-07-30'),+ const SearchRequest(+ queryMetadataText: 'tag1',+ startDate: '2026-07-30T09:15:00',+ endDate: '2026-07-30T09:16:00',+ ),+ const SearchRequest(queryMetadataText: ' '),+ ];+ for (final request in bad) {+ expect(request.validate, throwsA(isA<ValidationException>()));+ }+ expect(+ const SearchRequest(+ queryMetadataText: 'tag1',+ startDate: '2026-07-30T00:15:00.000Z',+ endDate: '2026-07-30T00:15:00.001Z',+ ).validate,+ returnsNormally,+ );+ expect(+ const SearchRequest(+ queryMetadataText: 'tag1',+ startDate: '2026-07-30',+ endDate: '2026-07-31',+ ).validate,+ returnsNormally,+ );+ });++ test(+ 'scoped metadata-only search retains collection and stream mapping',+ () async {+ final api = FakeTransport()+ ..addJson(<String, Object?>{+ 'data': <Object?>[],+ 'cnt_actual': 0,+ 'cnt_total': 0,+ });+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ );+ final project = VModal.fromClient(projectId: 'cctv_app', client: client);+ await project+ .scope(collectionName: 'cameras', streamName: 'entrance')+ .search(+ '',+ options: const ScopedSearchOptions(queryMetadataText: 'tag1'),+ );+ final body = api.requests.single.jsonBody! as Map<String, Object?>;+ expect(body['query_metadata'], 'tag1');+ expect(body['group_name'], 'cctv_app__cameras');+ expect(body['stream_name'], 'entrance');+ },+ );++ test(+ 'bulk timestamp upload derives one public filename per source',+ () async {+ final publicNames = <String>[];+ final api = HandlerTransport((VmodalRequest request) async {+ if (request.uri.path.endsWith(Routes.externalUploadGetSignedUrl)) {+ final name = request.uri.queryParameters['filename'];+ return jsonResponse(+ '{"url":"https://objects.test/$name","key":"key-$name"}',+ );+ }+ if (request.uri.path.endsWith(Routes.externalUploadDone)) {+ final name = request.uri.queryParameters['video_filename']!;+ publicNames.add(name);+ return jsonResponse('{"video_filename":"$name"}');+ }+ throw StateError('unexpected route: ${request.uri.path}');+ });+ final client = VmodalClient(+ config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ transport: api,+ signedUploadTransport: FakeSignedUploadTransport(),+ );+ final result = await client.collections+ .videoUploadBulk(+ <UploadSource>[_source('camera-a.mp4'), _source('camera-b.mp4')],+ collectionName: 'group',+ subCollectionName: 'stream',+ options: const VideoUploadOptions(+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ ),+ )+ .result;+ expect(publicNames.toSet(), <String>{'camera-a.mp4', 'camera-b.mp4'});+ expect(+ result.data+ .map((VideoUploadResponse item) => item.videoFilename)+ .toSet(),+ <String>{'camera-a.mp4', 'camera-b.mp4'},+ );+ },+ );+}diff --git a/test/multipart_upload_test.dart b/test/multipart_upload_test.dartindex ff23bed..b829565 100644--- a/test/multipart_upload_test.dart+++ b/test/multipart_upload_test.dart@@ -107,7 +107,18 @@ void main() {return jsonResponse('{"etag":"complete-etag"}');}if (path.endsWith(Routes.externalUploadDone)) {- return jsonResponse('{"dest_path":"done/a.mp4"}');+ expect(request.uri.queryParametersAll['metadata_tags'], <String>[+ 'tag1',+ 'tag2',+ ]);+ expect(request.uri.queryParameters['video_filename'], 'public.mp4');+ return jsonResponse(+ '{"dest_path":"done/public.mp4",'+ '"video_filename":"public.mp4",'+ '"start_datetime_user":"2026-07-30T09:15:00+09:00",'+ '"start_ts_unix_user_ms":1785370500000,'+ '"timestamp_source":"user"}',+ );}throw StateError('unexpected route: $path');});@@ -120,7 +131,11 @@ void main() {..add(SignedUploadResult(statusCode: 200, etag: md5a, localMd5: md5a))..add(SignedUploadResult(statusCode: 200, etag: md5b, localMd5: md5b));final client = VmodalClient(- config: SdkConfig(baseUrl: 'https://gateway.test', token: 'key'),+ config: SdkConfig(+ baseUrl: 'https://gateway.test',+ token: 'key',+ maxRetries: 0,+ ),transport: api,signedUploadTransport: signed,);@@ -134,15 +149,110 @@ void main() {partSizeBytes: 5 * mib,maxConcurrency: 2,sessionStore: MemoryUploadSessionStore(),+ videoFilename: 'public.mp4',+ metadataText: '',+ metadataTags: const <String>['tag1', 'tag2'],+ startDatetimeUser: '2026-07-30T09:15:00+09:00',),).result;expect(result.uploadStrategy, 'multipart');expect(result.partCount, 2);- expect(result.destPath, 'done/a.mp4');+ expect(result.destPath, 'done/public.mp4');+ expect(result.videoFilename, 'public.mp4');+ expect(result.startTsUnixUserMs, 1785370500000);expect(statusCalls, 2);});+ test(+ 'completed multipart resume finalizes with the same CCTV fields',+ () async {+ const mib = 1024 * 1024;+ final source = UploadSource(+ fileName: 'camera.mp4',+ contentLength: 6 * mib,+ sourceId: 'resume-cctv',+ versionTag: 'v1',+ opener: () => _bytes(6 * mib, 8),+ );+ final store = MemoryUploadSessionStore();+ var statusCalls = 0;+ final api = HandlerTransport((VmodalRequest request) async {+ final path = request.uri.path;+ if (path.endsWith(Routes.externalUploadMultipartCreate)) {+ return jsonResponse(+ '{"request_id":"r","upload_id":"u","key":"k",'+ '"part_count":2,"part_size_bytes":${5 * mib}}',+ );+ }+ if (path.endsWith(Routes.externalUploadMultipartStatus)) {+ statusCalls++;+ if (statusCalls == 1) {+ return jsonResponse('{"detail":"temporary"}', status: 500);+ }+ return jsonResponse(+ '{"status":"completed","etag":"done-etag",'+ '"size_bytes":${6 * mib}}',+ );+ }+ if (path.endsWith(Routes.externalUploadDone)) {+ expect(request.uri.queryParameters['video_filename'], 'camera.mp4');+ expect(request.uri.queryParametersAll['metadata_tags'], <String>[+ 'tag1',+ 'tag2',+ 'tag3',+ ]);+ return jsonResponse(+ '{"video_filename":"camera.mp4",'+ '"start_datetime_user":"2026-07-30T09:15:00+09:00",'+ '"start_ts_unix_user_ms":1785370500000,'+ '"timestamp_source":"user"}',+ );+ }+ throw StateError('unexpected route: $path');+ });+ final client = VmodalClient(+ config: SdkConfig(+ baseUrl: 'https://gateway.test',+ token: 'key',+ maxRetries: 0,+ ),+ transport: api,+ signedUploadTransport: FakeSignedUploadTransport(),+ );+ final options = VideoUploadOptions(+ multipart: true,+ partSizeBytes: 5 * mib,+ sessionStore: store,+ metadataTags: const <String>['tag1', 'tag2', 'tag3'],+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ );+ await expectLater(+ client.collections+ .videoUpload(+ source,+ collectionName: 'group',+ subCollectionName: 'stream',+ options: options,+ )+ .result,+ throwsA(isA<ApiException>()),+ );+ final result = await client.collections+ .videoUpload(+ source,+ collectionName: 'group',+ subCollectionName: 'stream',+ options: options,+ )+ .result;+ expect(result.resumed, isTrue);+ expect(result.videoFilename, 'camera.mp4');+ expect(result.startTsUnixUserMs, 1785370500000);+ expect(statusCalls, 2);+ },+ );+test('adaptive bulk multipart shares its conservative signed budget',() async {diff --git a/test/transcode_upload_test.dart b/test/transcode_upload_test.dartindex 91ad66f..3c71be6 100644--- a/test/transcode_upload_test.dart+++ b/test/transcode_upload_test.dart@@ -83,7 +83,10 @@ void main() {UploadSource.fromFile(original),collectionName: 'g',subCollectionName: 's',- options: VideoUploadOptions(transcoder: FakeReduceTranscoder(temp)),+ options: VideoUploadOptions(+ transcoder: FakeReduceTranscoder(temp),+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ ),).result;expect(result.reduceSize, isTrue);@@ -96,6 +99,14 @@ void main() {expect(signed.calls.single.length, 3);expect(original.existsSync(), isTrue);expect(temp.existsSync(), isFalse);+ expect(+ api.requests.last.uri.queryParameters['video_filename'],+ 'big.mp4',+ );+ expect(+ api.requests.last.uri.queryParameters['filename'],+ 'big.reduced.mp4',+ );},);diff --git a/test/transport_test.dart b/test/transport_test.dartindex d14fb42..7bb7f8c 100644--- a/test/transport_test.dart+++ b/test/transport_test.dart@@ -1,5 +1,6 @@import 'dart:async';import 'dart:convert';+import 'dart:io';import 'dart:typed_data';import 'package:flutter_test/flutter_test.dart';@@ -11,6 +12,59 @@ import 'package:vmodal_sdk_flutter/vmodal_sdk_flutter.dart';import 'fakes.dart';void main() {+ test(+ 'multipart iterable fields are repeated text parts on the wire',+ () async {+ final server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);+ addTearDown(() => server.close(force: true));+ final received = Completer<String>();+ server.listen((HttpRequest request) async {+ final bytes = await request.fold<List<int>>(+ <int>[],+ (List<int> out, List<int> chunk) => out..addAll(chunk),+ );+ received.complete(utf8.decode(bytes));+ request.response.headers.contentType = ContentType.json;+ request.response.write('{}');+ await request.response.close();+ });+ final client = VmodalClient(+ config: SdkConfig(+ baseUrl: 'http://127.0.0.1:${server.port}',+ token: 'key',+ ),+ );+ addTearDown(client.close);+ await client.collections.uploadFile(+ VmodalFilePart.bytes(+ fieldName: 'file',+ fileName: 'source.mp4',+ bytes: <int>[1, 2],+ contentType: 'video/mp4',+ ),+ groupName: 'group',+ tag: <String>['old1', 'old2'],+ metadataText: '',+ metadataTags: <String>['tag1', 'tag2', 'tag3'],+ );+ final body = await received.future;+ expect(RegExp(r'name="metadata_tags"').allMatches(body), hasLength(3));+ expect(+ RegExp(r'name="metadata_tags";\s*filename=').hasMatch(body),+ isFalse,+ );+ expect(RegExp(r'name="tag"').allMatches(body), hasLength(2));+ expect(RegExp(r'name="metadata_text"').allMatches(body), hasLength(1));+ expect(+ RegExp(+ r'name="metadata_text"[^\r\n]*\r\n(?:[^\r\n]*\r\n)*\r\n\r\n--',+ caseSensitive: false,+ ).hasMatch(body),+ isTrue,+ );+ },+ );+test('bounded reader accepts exact limit and rejects limit plus one',() async {diff --git a/tool/live_cctv_test.dart b/tool/live_cctv_test.dartnew file mode 100644index 0000000..8ec7219--- /dev/null+++ b/tool/live_cctv_test.dart@@ -0,0 +1,164 @@+import 'dart:async';+import 'dart:io';++import 'package:vmodal_sdk_flutter/vmodal_sdk_flutter.dart';++Future<void> main() async {+ final env = Map<String, String>.from(Platform.environment);+ final client = await VmodalClient.fromEnvironment(+ env,+ resolveIdentity: false,+ );+ final stamp = DateTime.now().toUtc().millisecondsSinceEpoch;+ final group = 'sdk_flutter_cctv_$stamp';+ final videoName = 'camera_$stamp.mp4';+ final fixture = File(+ env['VMODAL_CCTV_FIXTURE'] ??+ 'example/01_full_app/asset/video_10frames.mp4',+ );+ if (!fixture.existsSync()) {+ throw StateError('CCTV fixture does not exist: ${fixture.path}');+ }+ Object? primary;+ StackTrace? primaryStack;+ try {+ final upload = client.collections.videoUpload(+ UploadSource.fromFile(fixture),+ collectionName: group,+ subCollectionName: 'astream',+ options: VideoUploadOptions(+ videoFilename: videoName,+ metadataText: 'flutter cctv entrance',+ metadataTags: const <String>['flutter-cctv', 'entrance', 'tag3'],+ startDatetimeUser: '2026-07-30T09:15:00+09:00',+ ),+ );+ final uploaded = await upload.result.timeout(const Duration(minutes: 10));+ _expect(uploaded.videoFilename == videoName, 'video_filename mismatch');+ _expect(+ uploaded.startDatetimeUser == '2026-07-30T09:15:00+09:00',+ 'start_datetime_user mismatch',+ );+ _expect(+ uploaded.startTsUnixUserMs == 1785370500000,+ 'start_ts_unix_user_ms mismatch',+ );+ _expect(uploaded.timestampSource == 'user', 'timestamp_source mismatch');++ const startJst = '2026-07-30T09:15:00.000+09:00';+ const endJst = '2026-07-30T09:16:00.000+09:00';+ SearchResponse? ready;+ final deadline = DateTime.now().add(const Duration(minutes: 10));+ while (DateTime.now().isBefore(deadline)) {+ ready = await _search(client, group, 'flutter-cctv', startJst, endJst);+ if (ready.cntActual > 0) break;+ await Future<void>.delayed(const Duration(seconds: 5));+ }+ _expect(ready != null && ready.cntActual > 0, 'CCTV index was not ready');++ for (final query in <String>[+ 'flutter cctv entrance',+ 'flutter-cctv',+ 'entrance',+ 'tag3',+ ]) {+ final found = await _search(client, group, query, startJst, endJst);+ _expect(found.cntActual > 0, 'metadata query returned no hits: $query');+ for (final value in found.data) {+ final item = value! as Map<String, Object?>;+ _expect(+ '${item['item_id'] ?? ''}'.contains(videoName.split('.').first),+ 'metadata query included a distractor item',+ );+ }+ }++ final narrow = await _search(+ client,+ group,+ 'entrance',+ startJst,+ '2026-07-30T09:15:01.000+09:00',+ );+ _expect(narrow.cntActual > 0, 'narrow [start, end) range returned no hits');+ final before = await _search(+ client,+ group,+ 'entrance',+ '2026-07-30T09:14:59.000+09:00',+ startJst,+ );+ _expect(before.cntActual == 0, 'pre-start range returned CCTV hits');+ final utc = await _search(+ client,+ group,+ 'tag3',+ '2026-07-30T00:15:00.000Z',+ '2026-07-30T00:16:00.000Z',+ );+ _expect(+ utc.cntActual == ready!.cntActual,+ 'UTC-equivalent range returned different results',+ );+ final missing = await _search(+ client,+ group,+ 'metadata-that-does-not-exist',+ startJst,+ endJst,+ );+ _expect(missing.cntActual == 0, 'missing metadata returned hits');+ final wrongStream = await _search(+ client,+ group,+ 'entrance',+ startJst,+ endJst,+ stream: 'wrong_stream',+ );+ _expect(wrongStream.cntActual == 0, 'wrong stream returned hits');+ stdout.writeln('live CCTV upload and absolute-time search OK');+ } on Object catch (error, stack) {+ primary = error;+ primaryStack = stack;+ } finally {+ try {+ await client.collections.delete(+ groupName: group,+ mode: 'vid_file',+ scope: 'all',+ confirm: true,+ );+ } on Object catch (error) {+ stderr.writeln('CCTV live cleanup failed: ${error.runtimeType}');+ primary ??= error;+ primaryStack ??= StackTrace.current;+ }+ await client.close();+ }+ if (primary != null) Error.throwWithStackTrace(primary, primaryStack!);+}++Future<SearchResponse> _search(+ VmodalClient client,+ String group,+ String metadata,+ String start,+ String end, {+ String stream = 'astream',+}) => client.searches.searchVideo(+ SearchRequest(+ queryText: 'visual',+ queryMetadataText: metadata,+ groupName: group,+ streamName: stream,+ searchSources: const <String>['image'],+ startDate: start,+ endDate: end,+ limit: 1000,+ ),+);++void _expect(bool value, String message) {+ if (!value) throw StateError(message);+}diff --git a/tool/release_manifest.dart b/tool/release_manifest.dartindex 64a041e..dc1de73 100644--- a/tool/release_manifest.dart+++ b/tool/release_manifest.dart@@ -102,6 +102,7 @@ Future<void> _export(Directory root, Directory destination) async {'tool/flutter_checksums.txt','tool/check_route_sync.dart','tool/live_test.dart',+ 'tool/live_cctv_test.dart','tool/perf_benchmark.dart','tool/release_manifest.dart',];