@opengeni/documents 0.2.64 → 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/dist/google-drive.d.ts +160 -0
- package/dist/google-drive.js +588 -0
- package/dist/google-drive.js.map +1 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -5
- package/src/google-drive.ts +887 -0
- package/src/index.ts +20 -5
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
|
|
793
|
-
*
|
|
794
|
-
* (case-insensitive) so a user-created
|
|
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
|
|
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 & {
|