Document Creator 0.2.7: Files in subfolders and folders past 100 files
Document Creator 0.2.7 fixes the sync with Google Drive for larger setups: files in subfolders are found, and folders with more than 100 files are listed in full.
Listing a Drive folder silently stopped after the first 100 files, so anything past that never appeared in the admin. Listings now page through the whole folder. The sync also walks every subfolder of the templates and documents folders, records each file’s real folder and path, and treats files anywhere under a managed folder as published instead of flagging them as outside the module’s folders. Fewer Drive calls are needed to do it.
For host apps, documents can now be created in a chosen subfolder, and files the app created in Drive itself can be registered with the module.
Full release notes: Document Creator 0.2.7
0.2.7 · 22 April 2026
Added
GoogleDocsClient.DriveWalkermodule — paginatedlist_files/1/list_folders/1and recursivewalk_tree/2(BFS,pageSize: 1000,nextPageTokenlooping, batched'a' in parents or …queries chunked at 40 IDs per request). Both folder discovery and file listing now costO(ceil(N / 40))Drive calls per BFS level instead ofO(N)sequential list calls.Documents.register_existing_document/2andregister_existing_template/2— DB-only upsert for Drive files the caller has already created (e.g. consumers that organise files intodocuments/order-N/sub-M/). Validatesgoogle_doc_idviavalidate_file_id/1, validatestemplate_uuidviaforeign_key_constraint, usesmaybe_put/3so re-registration without optional fields preserves existing values. Opts::actor_uuid(activity log),:emit_pubsub(defaulttrue).Documents.pubsub_topic/0andDocuments.broadcast_files_changed/0— single source of truth for the"document_creator:files"topic; bulk callers can passemit_pubsub: falseand broadcast once at the end.create_document_from_template/3: new:parent_folder_idand:pathoptions for placing documents in consumer-managed subfolders.foreign_key_constraint(:template_uuid)onDocumentchangeset — invalid template UUIDs now return a changeset error instead of raising.- Catch-all
handle_info/2inGoogleOAuthSettingsLiveto prevent crashes on unexpected messages (Task supervisor signals, stray PubSub traffic).
Changed
sync_from_drive/0recursively walks both managed trees and upserts every Google Doc found (including those nested in subfolders) with its actual parentfolder_idand resolvedpath.classify_by_location/5accepts aMapSetof enumerated folder IDs so files in descendant subfolders stay:publishedinstead of being reclassified as:unfiled.- Reconcile drops the implicit “file must be in managed root” rule — any descendant of a managed folder is treated as
:published. list_folder_files/1andlist_subfolders/1onGoogleDocsClientnow delegate toDriveWalker— full pagination instead of the previous silent 100-item cap.- Narrowed
Documents.default_managed/2rescue from bare_to a targeted set (ArgumentError,KeyError,MatchError,BadMapError,DBConnection.ConnectionError,Postgrex.Error) so futureFunctionClauseError/RuntimeErrorbugs propagate instead of being silently swallowed.
Fixed
- Silent data loss past 100 items in
list_folder_files/1/list_subfolders/1— both now fully paginate. test_helper.exsno longer crashes on module load whenpsqlis missing fromPATH(sandboxes / minimal CI images); degrades to the connect-attempt branch instead.test_helper.exsPubSub supervisor bootstrap now raises on unexpected errors instead of silently ignoring them.
Document Creator 0.2.7. Install or update: {:phoenix_kit_document_creator, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.