@opengeni/documents 0.2.66 → 0.2.69

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/src/index.ts CHANGED
@@ -789,10 +789,10 @@ export async function getDocumentBase(
789
789
  }
790
790
 
791
791
  /**
792
- * Find-or-create the workspace's Default base — where knowledge drops land
793
- * before configured curation files them elsewhere. Matched by name
794
- * (case-insensitive) so a user-created "Default" is adopted rather than
795
- * duplicated.
792
+ * Find-or-create the workspace's internal Default collection — where ordinary
793
+ * uploads can start and knowledge drops land before configured curation files
794
+ * them elsewhere. Matched by name (case-insensitive) so a user-created
795
+ * "Default" is adopted rather than duplicated.
796
796
  */
797
797
  export async function ensureDefaultBase(
798
798
  db: Database,
@@ -812,7 +812,7 @@ export async function ensureDefaultBase(
812
812
  if (existing) return mapDocumentBase(existing);
813
813
 
814
814
  // The partial unique index is the serialization point for concurrent
815
- // first drops. A losing insert re-reads the winner instead of
815
+ // first uploads. A losing insert re-reads the winner instead of
816
816
  // surfacing a duplicate-base error.
817
817
  const [inserted] = await tx
818
818
  .insert(schema.documentBases)
@@ -837,6 +837,21 @@ export async function ensureDefaultBase(
837
837
  );
838
838
  }
839
839
 
840
+ /**
841
+ * List a workspace's optional document collections after restoring the
842
+ * internal Default collection when it is missing. Keeping the ensure and list
843
+ * in the service layer gives every caller the same migration-free recovery
844
+ * behavior after an old writer, manual repair, or future collection-management
845
+ * path renames or removes Default.
846
+ */
847
+ export async function listDocumentBasesEnsuringDefault(
848
+ db: Database,
849
+ input: { accountId: string; workspaceId: string },
850
+ ): Promise<DocumentBase[]> {
851
+ await ensureDefaultBase(db, input);
852
+ return await listDocumentBases(db, input.workspaceId);
853
+ }
854
+
840
855
  export async function addDocumentToBase(
841
856
  db: Database,
842
857
  input: AddDocumentRequest & {