@x12i/catalox 2.6.0 → 3.0.0
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/README.md +48 -28
- package/dist/src/catalox/backup-data.d.ts +37 -0
- package/dist/src/catalox/backup-data.d.ts.map +1 -1
- package/dist/src/catalox/backup-data.js +95 -2
- package/dist/src/catalox/backup-data.js.map +1 -1
- package/dist/src/catalox/catalox-bound.d.ts +119 -0
- package/dist/src/catalox/catalox-bound.d.ts.map +1 -0
- package/dist/src/catalox/catalox-bound.js +166 -0
- package/dist/src/catalox/catalox-bound.js.map +1 -0
- package/dist/src/catalox/catalox-gcs-backup-export-manifest.d.ts +13 -0
- package/dist/src/catalox/catalox-gcs-backup-export-manifest.d.ts.map +1 -0
- package/dist/src/catalox/catalox-gcs-backup-export-manifest.js +82 -0
- package/dist/src/catalox/catalox-gcs-backup-export-manifest.js.map +1 -0
- package/dist/src/catalox/catalox.d.ts +27 -3
- package/dist/src/catalox/catalox.d.ts.map +1 -1
- package/dist/src/catalox/catalox.js +59 -9
- package/dist/src/catalox/catalox.js.map +1 -1
- package/dist/src/catalox/create-catalox.d.ts +22 -0
- package/dist/src/catalox/create-catalox.d.ts.map +1 -0
- package/dist/src/catalox/create-catalox.js +65 -0
- package/dist/src/catalox/create-catalox.js.map +1 -0
- package/dist/src/catalox/firestore-gcs-transfer.d.ts +4 -0
- package/dist/src/catalox/firestore-gcs-transfer.d.ts.map +1 -1
- package/dist/src/catalox/firestore-gcs-transfer.js +4 -3
- package/dist/src/catalox/firestore-gcs-transfer.js.map +1 -1
- package/dist/src/catalox/index.d.ts +7 -3
- package/dist/src/catalox/index.d.ts.map +1 -1
- package/dist/src/catalox/index.js +7 -3
- package/dist/src/catalox/index.js.map +1 -1
- package/dist/src/catalox/restore-firestore-backup-from-gcs.d.ts +21 -0
- package/dist/src/catalox/restore-firestore-backup-from-gcs.d.ts.map +1 -0
- package/dist/src/catalox/restore-firestore-backup-from-gcs.js +310 -0
- package/dist/src/catalox/restore-firestore-backup-from-gcs.js.map +1 -0
- package/dist/src/catalox/restore-firestore-backup.d.ts +17 -1
- package/dist/src/catalox/restore-firestore-backup.d.ts.map +1 -1
- package/dist/src/catalox/restore-firestore-backup.js +2 -1
- package/dist/src/catalox/restore-firestore-backup.js.map +1 -1
- package/dist/src/cli/index.js +97 -42
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/contracts/catalogs.d.ts +17 -0
- package/dist/src/contracts/catalogs.d.ts.map +1 -1
- package/dist/src/contracts/catalogs.js.map +1 -1
- package/dist/src/contracts/gcs-firestore-transfer.d.ts +14 -0
- package/dist/src/contracts/gcs-firestore-transfer.d.ts.map +1 -1
- package/dist/src/contracts/index.d.ts +3 -3
- package/dist/src/contracts/index.d.ts.map +1 -1
- package/dist/src/contracts/index.js.map +1 -1
- package/dist/src/contracts/restore.d.ts +57 -2
- package/dist/src/contracts/restore.d.ts.map +1 -1
- package/dist/src/embedder.d.ts +17 -0
- package/dist/src/embedder.d.ts.map +1 -0
- package/dist/src/embedder.js +17 -0
- package/dist/src/embedder.js.map +1 -0
- package/dist/src/index.d.ts +2 -15
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -15
- package/dist/src/index.js.map +1 -1
- package/dist/src/operator.d.ts +24 -0
- package/dist/src/operator.d.ts.map +1 -0
- package/dist/src/operator.js +25 -0
- package/dist/src/operator.js.map +1 -0
- package/dist/test/integration/firestore.emulator.test.js +9 -28
- package/dist/test/integration/firestore.emulator.test.js.map +1 -1
- package/dist/test/unit/catalox-gcs-backup-export-manifest.test.d.ts +2 -0
- package/dist/test/unit/catalox-gcs-backup-export-manifest.test.d.ts.map +1 -0
- package/dist/test/unit/catalox-gcs-backup-export-manifest.test.js +20 -0
- package/dist/test/unit/catalox-gcs-backup-export-manifest.test.js.map +1 -0
- package/package.json +21 -5
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {@link Catalox} with a fixed {@link CataloxContext}: every method omits the first `context` argument.
|
|
3
|
+
* Use {@link Catalox.withContext} or {@link bindCataloxContext}.
|
|
4
|
+
*/
|
|
5
|
+
export class CataloxBound {
|
|
6
|
+
catalox;
|
|
7
|
+
context;
|
|
8
|
+
constructor(catalox, context) {
|
|
9
|
+
this.catalox = catalox;
|
|
10
|
+
this.context = context;
|
|
11
|
+
}
|
|
12
|
+
async buildCatalogListRenderMap(catalogId, options) {
|
|
13
|
+
return this.catalox.buildCatalogListRenderMap(this.context, catalogId, options);
|
|
14
|
+
}
|
|
15
|
+
async buildCatalogItemRenderMap(catalogId, itemId, options) {
|
|
16
|
+
return this.catalox.buildCatalogItemRenderMap(this.context, catalogId, itemId, options);
|
|
17
|
+
}
|
|
18
|
+
async listAppCatalogs(input) {
|
|
19
|
+
return this.catalox.listAppCatalogs(this.context, input);
|
|
20
|
+
}
|
|
21
|
+
async getCatalogDescriptor(catalogId) {
|
|
22
|
+
return this.catalox.getCatalogDescriptor(this.context, catalogId);
|
|
23
|
+
}
|
|
24
|
+
async getCatalogRendererSnippet(catalogId, role, mode) {
|
|
25
|
+
return this.catalox.getCatalogRendererSnippet(this.context, catalogId, role, mode);
|
|
26
|
+
}
|
|
27
|
+
async getAppCatalogBootstrap(appId) {
|
|
28
|
+
return this.catalox.getAppCatalogBootstrap(this.context, appId);
|
|
29
|
+
}
|
|
30
|
+
async listCatalogItems(catalogId, options) {
|
|
31
|
+
return this.catalox.listCatalogItems(this.context, catalogId, options);
|
|
32
|
+
}
|
|
33
|
+
async getCatalogItem(catalogId, itemId) {
|
|
34
|
+
return this.catalox.getCatalogItem(this.context, catalogId, itemId);
|
|
35
|
+
}
|
|
36
|
+
async validateCatalog(catalogId) {
|
|
37
|
+
return this.catalox.validateCatalog(this.context, catalogId);
|
|
38
|
+
}
|
|
39
|
+
async validateCatalogItem(catalogId, itemId) {
|
|
40
|
+
return this.catalox.validateCatalogItem(this.context, catalogId, itemId);
|
|
41
|
+
}
|
|
42
|
+
async getCatalogItemReferences(catalogId, itemId) {
|
|
43
|
+
return this.catalox.getCatalogItemReferences(this.context, catalogId, itemId);
|
|
44
|
+
}
|
|
45
|
+
async listCatalogReferences(catalogId) {
|
|
46
|
+
return this.catalox.listCatalogReferences(this.context, catalogId);
|
|
47
|
+
}
|
|
48
|
+
async getApp(appId) {
|
|
49
|
+
return this.catalox.getApp(this.context, appId);
|
|
50
|
+
}
|
|
51
|
+
async createCatalog(input) {
|
|
52
|
+
return this.catalox.createCatalog(this.context, input);
|
|
53
|
+
}
|
|
54
|
+
async updateCatalog(catalogId, patch) {
|
|
55
|
+
return this.catalox.updateCatalog(this.context, catalogId, patch);
|
|
56
|
+
}
|
|
57
|
+
async getCatalog(catalogId) {
|
|
58
|
+
return this.catalox.getCatalog(this.context, catalogId);
|
|
59
|
+
}
|
|
60
|
+
async listCatalogs(options) {
|
|
61
|
+
return this.catalox.listCatalogs(this.context, options);
|
|
62
|
+
}
|
|
63
|
+
async bindCatalogToApp(input) {
|
|
64
|
+
return this.catalox.bindCatalogToApp(this.context, input);
|
|
65
|
+
}
|
|
66
|
+
async unbindCatalogFromApp(appId, catalogId) {
|
|
67
|
+
return this.catalox.unbindCatalogFromApp(this.context, appId, catalogId);
|
|
68
|
+
}
|
|
69
|
+
async bindAppToStore(input) {
|
|
70
|
+
return this.catalox.bindAppToStore(this.context, input);
|
|
71
|
+
}
|
|
72
|
+
async unbindAppFromStore(storeId, appId) {
|
|
73
|
+
return this.catalox.unbindAppFromStore(this.context, storeId, appId);
|
|
74
|
+
}
|
|
75
|
+
async listAppsForStore(storeId) {
|
|
76
|
+
return this.catalox.listAppsForStore(this.context, storeId);
|
|
77
|
+
}
|
|
78
|
+
async ensureCatalog(catalog) {
|
|
79
|
+
return this.catalox.ensureCatalog(this.context, catalog);
|
|
80
|
+
}
|
|
81
|
+
async ensureBinding(input) {
|
|
82
|
+
return this.catalox.ensureBinding(this.context, input);
|
|
83
|
+
}
|
|
84
|
+
async createNativeCatalogItem(catalogId, input) {
|
|
85
|
+
return this.catalox.createNativeCatalogItem(this.context, catalogId, input);
|
|
86
|
+
}
|
|
87
|
+
async updateNativeCatalogItem(catalogId, itemId, patch) {
|
|
88
|
+
return this.catalox.updateNativeCatalogItem(this.context, catalogId, itemId, patch);
|
|
89
|
+
}
|
|
90
|
+
async deleteNativeCatalogItem(catalogId, itemId) {
|
|
91
|
+
return this.catalox.deleteNativeCatalogItem(this.context, catalogId, itemId);
|
|
92
|
+
}
|
|
93
|
+
async upsertNativeCatalogItem(catalogId, input) {
|
|
94
|
+
return this.catalox.upsertNativeCatalogItem(this.context, catalogId, input);
|
|
95
|
+
}
|
|
96
|
+
async batchUpsertNativeCatalogItems(catalogId, items) {
|
|
97
|
+
return this.catalox.batchUpsertNativeCatalogItems(this.context, catalogId, items);
|
|
98
|
+
}
|
|
99
|
+
importCatalogItemsFromJson(json) {
|
|
100
|
+
return this.catalox.importCatalogItemsFromJson(json);
|
|
101
|
+
}
|
|
102
|
+
exportCatalogItemsToJson(value, pretty = true) {
|
|
103
|
+
return this.catalox.exportCatalogItemsToJson(value, pretty);
|
|
104
|
+
}
|
|
105
|
+
async exportInventory(input = {}) {
|
|
106
|
+
return this.catalox.exportInventory(this.context, input);
|
|
107
|
+
}
|
|
108
|
+
async exportInventoryToJson(input = {}, pretty = true) {
|
|
109
|
+
return this.catalox.exportInventoryToJson(this.context, input, pretty);
|
|
110
|
+
}
|
|
111
|
+
async generateInventoryReport(input = {}) {
|
|
112
|
+
return this.catalox.generateInventoryReport(this.context, input);
|
|
113
|
+
}
|
|
114
|
+
async syncMappedCatalog(catalogId) {
|
|
115
|
+
return this.catalox.syncMappedCatalog(this.context, catalogId);
|
|
116
|
+
}
|
|
117
|
+
async backupData(input) {
|
|
118
|
+
return this.catalox.backupData(this.context, input);
|
|
119
|
+
}
|
|
120
|
+
async restoreFirestoreBackup(input) {
|
|
121
|
+
return this.catalox.restoreFirestoreBackup(this.context, input);
|
|
122
|
+
}
|
|
123
|
+
async undoFirestoreRestore(input) {
|
|
124
|
+
return this.catalox.undoFirestoreRestore(this.context, input);
|
|
125
|
+
}
|
|
126
|
+
async restoreFirestoreBackupFromGcs(input) {
|
|
127
|
+
return this.catalox.restoreFirestoreBackupFromGcs(this.context, input);
|
|
128
|
+
}
|
|
129
|
+
async pruneGcsBackupRuns(input) {
|
|
130
|
+
return this.catalox.pruneGcsBackupRuns(this.context, input);
|
|
131
|
+
}
|
|
132
|
+
async deleteCataloxGcsBackupRun(input) {
|
|
133
|
+
return this.catalox.deleteCataloxGcsBackupRun(this.context, input);
|
|
134
|
+
}
|
|
135
|
+
cataloxGcsBackupManifestToExportManifest(manifest, gcsRunFolder) {
|
|
136
|
+
return this.catalox.cataloxGcsBackupManifestToExportManifest(manifest, gcsRunFolder);
|
|
137
|
+
}
|
|
138
|
+
async reportNativeCatalogLayoutDiagnostics(input) {
|
|
139
|
+
return this.catalox.reportNativeCatalogLayoutDiagnostics(this.context, input);
|
|
140
|
+
}
|
|
141
|
+
async migrateNativeCatalogLayout(input) {
|
|
142
|
+
return this.catalox.migrateNativeCatalogLayout(this.context, input);
|
|
143
|
+
}
|
|
144
|
+
async exportFirestoreCollectionToGcs(input) {
|
|
145
|
+
return this.catalox.exportFirestoreCollectionToGcs(this.context, input);
|
|
146
|
+
}
|
|
147
|
+
async exportAllFirestoreCollectionsToGcs(input) {
|
|
148
|
+
return this.catalox.exportAllFirestoreCollectionsToGcs(this.context, input);
|
|
149
|
+
}
|
|
150
|
+
async restoreFirestoreCollectionFromGcs(input) {
|
|
151
|
+
return this.catalox.restoreFirestoreCollectionFromGcs(this.context, input);
|
|
152
|
+
}
|
|
153
|
+
async restoreAllFirestoreCollectionsFromGcsManifest(input) {
|
|
154
|
+
return this.catalox.restoreAllFirestoreCollectionsFromGcsManifest(this.context, input);
|
|
155
|
+
}
|
|
156
|
+
async compareFirestoreCollectionWithGcsNdjson(input) {
|
|
157
|
+
return this.catalox.compareFirestoreCollectionWithGcsNdjson(this.context, input);
|
|
158
|
+
}
|
|
159
|
+
async compareAllFirestoreCollectionsWithGcsManifest(input) {
|
|
160
|
+
return this.catalox.compareAllFirestoreCollectionsWithGcsManifest(this.context, input);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export function bindCataloxContext(catalox, context) {
|
|
164
|
+
return new CataloxBound(catalox, context);
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=catalox-bound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalox-bound.js","sourceRoot":"","sources":["../../../src/catalox/catalox-bound.ts"],"names":[],"mappings":"AA8DA;;;GAGG;AACH,MAAM,OAAO,YAAY;IAEJ;IACR;IAFX,YACmB,OAAgB,EACxB,OAAuB;QADf,YAAO,GAAP,OAAO,CAAS;QACxB,YAAO,GAAP,OAAO,CAAgB;IAC/B,CAAC;IAEJ,KAAK,CAAC,yBAAyB,CAC7B,SAAoB,EACpB,OAA6H;QAE7H,OAAO,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAED,KAAK,CAAC,yBAAyB,CAC7B,SAAoB,EACpB,MAAc,EACd,OAKC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1F,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,KAA4B;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,SAAoB;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,yBAAyB,CAC7B,SAAoB,EACpB,IAAgE,EAChE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,CAAC;IAED,KAAK,CAAC,kCAAkC,CAAC,KAAiE;QACxG,OAAO,IAAI,CAAC,OAAO,CAAC,kCAAkC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,iCAAiC,CAAC,KAAgE;QACtG,OAAO,IAAI,CAAC,OAAO,CAAC,iCAAiC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7E,CAAC;IAED,KAAK,CAAC,6CAA6C,CACjD,KAAoE;QAEpE,OAAO,IAAI,CAAC,OAAO,CAAC,6CAA6C,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzF,CAAC;IAED,KAAK,CAAC,uCAAuC,CAC3C,KAAgE;QAEhE,OAAO,IAAI,CAAC,OAAO,CAAC,uCAAuC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,CAAC,6CAA6C,CACjD,KAA4E;QAE5E,OAAO,IAAI,CAAC,OAAO,CAAC,6CAA6C,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzF,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,OAAuB;IAC1E,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CataloxGcsBackupManifestV1, FirestoreGcsExportManifestV1 } from "../contracts/gcs-firestore-transfer.js";
|
|
2
|
+
/**
|
|
3
|
+
* Build a **`catalox-firestore-export-manifest.json`**-compatible manifest that points at NDJSON objects
|
|
4
|
+
* produced by **`backupData` mode `gcs`**, so `restoreAllFirestoreCollectionsFromGcsManifest` (or CLI `import-gcs --restore-all`)
|
|
5
|
+
* can restore the same logical data without a dedicated code path.
|
|
6
|
+
*
|
|
7
|
+
* `gcsRunFolder` must match the backup run folder (e.g. `catalox-firestore-backups/2026_04_18T12_00_00Z`).
|
|
8
|
+
* Object paths in the result are **`{gcsRunFolder}/{relative}`** with slashes normalized.
|
|
9
|
+
*/
|
|
10
|
+
export declare function cataloxGcsBackupManifestToFirestoreExportManifest(manifest: CataloxGcsBackupManifestV1, gcsRunFolder: string): FirestoreGcsExportManifestV1;
|
|
11
|
+
/** Object key for a synthetic export manifest next to a GCS Catalox backup run. */
|
|
12
|
+
export declare const CATALOX_GCS_BACKUP_AS_EXPORT_MANIFEST_OBJECT = "catalox-firestore-export-manifest.json";
|
|
13
|
+
//# sourceMappingURL=catalox-gcs-backup-export-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalox-gcs-backup-export-manifest.d.ts","sourceRoot":"","sources":["../../../src/catalox/catalox-gcs-backup-export-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AAIvH;;;;;;;GAOG;AACH,wBAAgB,iDAAiD,CAC/D,QAAQ,EAAE,0BAA0B,EACpC,YAAY,EAAE,MAAM,GACnB,4BAA4B,CAqE9B;AAED,mFAAmF;AACnF,eAAO,MAAM,4CAA4C,2CAAiC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { BACKUP_METADATA_SOURCE_NAMES, firebaseNativeLogical } from "./backup-data.js";
|
|
2
|
+
import { CATALOX_FIRESTORE_GCS_MANIFEST } from "./firestore-gcs-transfer.js";
|
|
3
|
+
/**
|
|
4
|
+
* Build a **`catalox-firestore-export-manifest.json`**-compatible manifest that points at NDJSON objects
|
|
5
|
+
* produced by **`backupData` mode `gcs`**, so `restoreAllFirestoreCollectionsFromGcsManifest` (or CLI `import-gcs --restore-all`)
|
|
6
|
+
* can restore the same logical data without a dedicated code path.
|
|
7
|
+
*
|
|
8
|
+
* `gcsRunFolder` must match the backup run folder (e.g. `catalox-firestore-backups/2026_04_18T12_00_00Z`).
|
|
9
|
+
* Object paths in the result are **`{gcsRunFolder}/{relative}`** with slashes normalized.
|
|
10
|
+
*/
|
|
11
|
+
export function cataloxGcsBackupManifestToFirestoreExportManifest(manifest, gcsRunFolder) {
|
|
12
|
+
const folder = gcsRunFolder.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
13
|
+
const prefix = folder ? `${folder}/` : "";
|
|
14
|
+
const cw = manifest.collectionsWritten ?? [];
|
|
15
|
+
const counts = manifest.counts ?? {};
|
|
16
|
+
const entries = [];
|
|
17
|
+
for (const name of BACKUP_METADATA_SOURCE_NAMES) {
|
|
18
|
+
const rel = `metadata/${name}.ndjson`;
|
|
19
|
+
if (!cw.includes(rel))
|
|
20
|
+
continue;
|
|
21
|
+
entries.push({
|
|
22
|
+
firestorePath: name,
|
|
23
|
+
objectPath: `${prefix}${rel}`,
|
|
24
|
+
documentCount: Number(counts[`gcs:meta:${name}`] ?? 0),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const layouts = manifest.nativeItemSourceLayoutByCatalogId ?? {};
|
|
28
|
+
for (const catalogId of Object.keys(layouts)) {
|
|
29
|
+
const rel = `native/${firebaseNativeLogical(catalogId)}.ndjson`;
|
|
30
|
+
if (!cw.includes(rel))
|
|
31
|
+
continue;
|
|
32
|
+
const layout = layouts[catalogId];
|
|
33
|
+
const firestorePath = layout === "legacy" ? `catalogData/${catalogId}/items` : `catalogData-${catalogId}-items`;
|
|
34
|
+
entries.push({
|
|
35
|
+
firestorePath,
|
|
36
|
+
objectPath: `${prefix}${rel}`,
|
|
37
|
+
documentCount: Number(counts[`gcs:native:${firebaseNativeLogical(catalogId)}`] ?? 0),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
for (const rel of cw) {
|
|
41
|
+
if (!rel.startsWith("snapshots/") || !rel.endsWith(".ndjson"))
|
|
42
|
+
continue;
|
|
43
|
+
const base = rel.slice("snapshots/".length, -".ndjson".length);
|
|
44
|
+
const snapPrefix = "catalogSnapshots--";
|
|
45
|
+
const runPrefix = "catalogSnapshotsRun--";
|
|
46
|
+
if (base.startsWith(snapPrefix) && !base.startsWith(runPrefix)) {
|
|
47
|
+
const catalogId = base.slice(snapPrefix.length);
|
|
48
|
+
const firestorePath = `catalogSnapshots/${catalogId}/items`;
|
|
49
|
+
entries.push({
|
|
50
|
+
firestorePath,
|
|
51
|
+
objectPath: `${prefix}${rel}`,
|
|
52
|
+
documentCount: Number(counts[`gcs:snapshot:catalogSnapshots--${catalogId}`] ?? 0),
|
|
53
|
+
});
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (base.startsWith(runPrefix)) {
|
|
57
|
+
const rest = base.slice(runPrefix.length);
|
|
58
|
+
const delim = rest.lastIndexOf("--");
|
|
59
|
+
if (delim === -1)
|
|
60
|
+
continue;
|
|
61
|
+
const catalogId = rest.slice(0, delim);
|
|
62
|
+
const runId = rest.slice(delim + 2);
|
|
63
|
+
const firestorePath = `catalogSnapshots/${catalogId}/runs/${runId}/items`;
|
|
64
|
+
entries.push({
|
|
65
|
+
firestorePath,
|
|
66
|
+
objectPath: `${prefix}${rel}`,
|
|
67
|
+
documentCount: Number(counts[`gcs:snapshotRun:catalogSnapshotsRun--${catalogId}--${runId}`] ?? 0),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
catalog: "catalox-firestore-gcs-export",
|
|
73
|
+
version: 1,
|
|
74
|
+
exportedAt: new Date().toISOString(),
|
|
75
|
+
gcsPrefix: prefix,
|
|
76
|
+
objectNamePostfix: "",
|
|
77
|
+
entries,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** Object key for a synthetic export manifest next to a GCS Catalox backup run. */
|
|
81
|
+
export const CATALOX_GCS_BACKUP_AS_EXPORT_MANIFEST_OBJECT = CATALOX_FIRESTORE_GCS_MANIFEST;
|
|
82
|
+
//# sourceMappingURL=catalox-gcs-backup-export-manifest.js.map
|
|
@@ -0,0 +1 @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AC,MAAM,CAAC,kCAAkC,SAAS,EAAE,CAAC,IAAI,CAAC,CAAC;aAClF,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,KAAK,KAAK,CAAC,CAAC;gBAAE,SAAS;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;YACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YACpC,MAAM,aAAa,GAAG,oBAAoB,SAAS,SAAS,KAAK,QAAQ,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC;gBACX,aAAa;gBACb,UAAU,EAAE,GAAG,MAAM,GAAG,GAAG,EAAE;gBAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,wCAAwC,SAAS,KAAK,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC;aAClG,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,8BAA8B;QACvC,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,SAAS,EAAE,MAAM;QACjB,iBAAiB,EAAE,EAAE;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,4CAA4C,GAAG,8BAA8B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppCatalogBootstrap, AppCatalogEntry, CatalogDescriptor, CatalogItemReference, CatalogItemValidationReport, CatalogListResult, CatalogQueryOptions, CatalogValidationReport, CreateCatalogInput, ExportInventoryData, ExportInventoryInput, InventoryReportData, InventoryReportInput, ItemId, StoreId, StoreAppBindingRecord, ListAppCatalogsInput, UnifiedCatalogItem, UpdateCatalogInput } from "../contracts/index.js";
|
|
1
|
+
import type { AppCatalogBootstrap, AppCatalogEntry, CatalogDescriptor, CatalogItemReference, CatalogItemValidationReport, CatalogGetItemResult, CatalogListResult, CatalogQueryOptions, CatalogValidationReport, CreateCatalogInput, ExportInventoryData, ExportInventoryInput, InventoryReportData, InventoryReportInput, ItemId, StoreId, StoreAppBindingRecord, ListAppCatalogsInput, UnifiedCatalogItem, UpdateCatalogInput } from "../contracts/index.js";
|
|
2
2
|
import type { AppId, CatalogId } from "../contracts/ids.js";
|
|
3
3
|
import { ApiCatalogAdapter } from "../adapters/api/api-adapter.js";
|
|
4
4
|
import { MongoCatalogAdapter } from "../adapters/mongo/mongo-adapter.js";
|
|
@@ -22,9 +22,12 @@ import { StoreAppBindingStore } from "../firebase/store-app-binding-store.js";
|
|
|
22
22
|
import type { BackupDataInput, BackupDataResult } from "../contracts/backup.js";
|
|
23
23
|
import type { ExportAllFirestoreCollectionsToGcsInput, ExportAllFirestoreCollectionsToGcsResult, ExportFirestoreCollectionToGcsInput, ExportFirestoreCollectionToGcsResult, RestoreAllFirestoreCollectionsFromGcsInput, RestoreAllFirestoreCollectionsFromGcsResult, RestoreFirestoreCollectionFromGcsInput, RestoreFirestoreCollectionFromGcsResult } from "../contracts/gcs-firestore-transfer.js";
|
|
24
24
|
import type { CompareAllFirestoreCollectionsWithGcsManifestInput, CompareAllFirestoreCollectionsWithGcsResult, CompareFirestoreCollectionWithGcsInput, CompareFirestoreCollectionWithGcsResult } from "../contracts/gcs-firestore-compare.js";
|
|
25
|
-
import type { RestoreFirestoreBackupInput, RestoreFirestoreBackupResult, UndoFirestoreRestoreInput, UndoFirestoreRestoreResult } from "../contracts/restore.js";
|
|
25
|
+
import type { RestoreFirestoreBackupInput, RestoreFirestoreBackupResult, RestoreFirestoreBackupFromGcsInput, RestoreFirestoreBackupFromGcsResult, PruneGcsBackupRunsInput, PruneGcsBackupRunsResult, UndoFirestoreRestoreInput, UndoFirestoreRestoreResult } from "../contracts/restore.js";
|
|
26
|
+
import type { CataloxGcsBackupManifestV1, FirestoreGcsExportManifestV1 } from "../contracts/gcs-firestore-transfer.js";
|
|
27
|
+
import { runDeleteCataloxGcsBackupRun } from "./restore-firestore-backup-from-gcs.js";
|
|
26
28
|
import { type MigrateNativeCatalogLayoutInput, type MigrateNativeCatalogLayoutResult } from "../migrations/migrate-native-catalog-layout.js";
|
|
27
29
|
import { type NativeCatalogLayoutDiagnosticRow } from "./native-catalog-layout-diagnostics.js";
|
|
30
|
+
import { CataloxBound } from "./catalox-bound.js";
|
|
28
31
|
export type CataloxDependencies = {
|
|
29
32
|
apps: AppStore;
|
|
30
33
|
catalogs: CatalogStore;
|
|
@@ -74,7 +77,7 @@ export declare class Catalox {
|
|
|
74
77
|
getCatalogRendererSnippet(context: CataloxContext, catalogId: CatalogId, role: "core" | "list" | "grid" | "item" | "report" | "dashboard", mode?: "readonly" | "editable"): Promise<import("../contracts/renderer-snippets.js").CatalogRendererSnippetRecord | null>;
|
|
75
78
|
getAppCatalogBootstrap(context: CataloxContext, appId?: AppId): Promise<AppCatalogBootstrap>;
|
|
76
79
|
listCatalogItems(context: CataloxContext, catalogId: CatalogId, options?: CatalogQueryOptions): Promise<CatalogListResult>;
|
|
77
|
-
getCatalogItem(context: CataloxContext, catalogId: CatalogId, itemId: ItemId): Promise<
|
|
80
|
+
getCatalogItem(context: CataloxContext, catalogId: CatalogId, itemId: ItemId): Promise<CatalogGetItemResult>;
|
|
78
81
|
validateCatalog(_context: CataloxContext, _catalogId: CatalogId): Promise<CatalogValidationReport>;
|
|
79
82
|
validateCatalogItem(_context: CataloxContext, _catalogId: CatalogId, _itemId: ItemId): Promise<CatalogItemValidationReport>;
|
|
80
83
|
getCatalogItemReferences(context: CataloxContext, catalogId: CatalogId, itemId: ItemId): Promise<CatalogItemReference[]>;
|
|
@@ -135,6 +138,23 @@ export declare class Catalox {
|
|
|
135
138
|
restoreFirestoreBackup(_context: CataloxContext, input: RestoreFirestoreBackupInput): Promise<RestoreFirestoreBackupResult>;
|
|
136
139
|
/** Revert a prior `restoreFirestoreBackup` using the manifest and `restoreSessionId__preRestore-*` collections. */
|
|
137
140
|
undoFirestoreRestore(_context: CataloxContext, input: UndoFirestoreRestoreInput): Promise<UndoFirestoreRestoreResult>;
|
|
141
|
+
/**
|
|
142
|
+
* Restore live Firestore from one **`backupData` GCS** run (`metadata/`, `native/`, optional `snapshots/` NDJSON).
|
|
143
|
+
* Captures pre-restore copies to `{session}__preRestore-*` first; **`undoFirestoreRestore`** works the same as for `restoreFirestoreBackup`.
|
|
144
|
+
*/
|
|
145
|
+
restoreFirestoreBackupFromGcs(_context: CataloxContext, input: RestoreFirestoreBackupFromGcsInput): Promise<RestoreFirestoreBackupFromGcsResult>;
|
|
146
|
+
/** Delete oldest GCS Catalox backup **run folders** (children of the base prefix) until `keepLast` newest remain. */
|
|
147
|
+
pruneGcsBackupRuns(_context: CataloxContext, input: PruneGcsBackupRunsInput): Promise<PruneGcsBackupRunsResult>;
|
|
148
|
+
/** Delete every object under one GCS backup run folder (operator cleanup). */
|
|
149
|
+
deleteCataloxGcsBackupRun(_context: CataloxContext, input: {
|
|
150
|
+
gcsBucket: string;
|
|
151
|
+
gcsRunFolder: string;
|
|
152
|
+
}): Promise<Awaited<ReturnType<typeof runDeleteCataloxGcsBackupRun>>>;
|
|
153
|
+
/**
|
|
154
|
+
* Map a **`catalox-backup-manifest.json`** payload into the **`catalox-firestore-export-manifest.json`** shape
|
|
155
|
+
* so `restoreAllFirestoreCollectionsFromGcsManifest` / CLI `import-gcs --restore-all` can consume the same NDJSON objects.
|
|
156
|
+
*/
|
|
157
|
+
cataloxGcsBackupManifestToExportManifest(manifest: CataloxGcsBackupManifestV1, gcsRunFolder: string): FirestoreGcsExportManifestV1;
|
|
138
158
|
/**
|
|
139
159
|
* For each discovered native catalog: counts in legacy `catalogData/{id}/items` vs flat `catalogData-{id}-items`,
|
|
140
160
|
* and the resolver layout. Use when the console still shows the **legacy** subcollection `items` under `catalogData/{catalogId}`.
|
|
@@ -159,5 +179,9 @@ export declare class Catalox {
|
|
|
159
179
|
compareFirestoreCollectionWithGcsNdjson(_context: CataloxContext, input: Omit<CompareFirestoreCollectionWithGcsInput, "firestore">): Promise<CompareFirestoreCollectionWithGcsResult>;
|
|
160
180
|
/** Run `compareFirestoreCollectionWithGcsNdjson` for every entry in an export manifest. */
|
|
161
181
|
compareAllFirestoreCollectionsWithGcsManifest(_context: CataloxContext, input: Omit<CompareAllFirestoreCollectionsWithGcsManifestInput, "firestore">): Promise<CompareAllFirestoreCollectionsWithGcsResult>;
|
|
182
|
+
/**
|
|
183
|
+
* Fix {@link CataloxContext} for subsequent calls so embedders omit it on each method (no globals).
|
|
184
|
+
*/
|
|
185
|
+
withContext(context: CataloxContext): CataloxBound;
|
|
162
186
|
}
|
|
163
187
|
//# sourceMappingURL=catalox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalox.d.ts","sourceRoot":"","sources":["../../../src/catalox/catalox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EAEjB,oBAAoB,EACpB,2BAA2B,EAC3B,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,MAAM,EACN,OAAO,EACP,qBAAqB,EACrB,oBAAoB,EAEpB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAM5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,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uC,CAAC;IAOnD,2FAA2F;IACrF,6CAA6C,CACjD,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,IAAI,CAAC,kDAAkD,EAAE,WAAW,CAAC,GAC3E,OAAO,CAAC,2CAA2C,CAAC;IAOvD;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,YAAY;CAGnD"}
|
|
@@ -25,12 +25,15 @@ import { RendererSnippetStore } from "../firebase/renderer-snippet-store.js";
|
|
|
25
25
|
import { SnapshotStore } from "../firebase/snapshot-store.js";
|
|
26
26
|
import { StoreAppBindingStore } from "../firebase/store-app-binding-store.js";
|
|
27
27
|
import { nativeItemsCollectionId } from "../firebase/catalog-data-paths.js";
|
|
28
|
-
import { runBackupData } from "./backup-data.js";
|
|
28
|
+
import { runBackupData, pruneGcsBackupRuns } from "./backup-data.js";
|
|
29
29
|
import { runRestoreFirestoreBackup, runUndoFirestoreRestore } from "./restore-firestore-backup.js";
|
|
30
|
+
import { runRestoreFirestoreBackupFromGcs, runDeleteCataloxGcsBackupRun } from "./restore-firestore-backup-from-gcs.js";
|
|
31
|
+
import { cataloxGcsBackupManifestToFirestoreExportManifest } from "./catalox-gcs-backup-export-manifest.js";
|
|
30
32
|
import { migrateNativeCatalogLayout as runMigrateNativeCatalogLayout, } from "../migrations/migrate-native-catalog-layout.js";
|
|
31
33
|
import { reportNativeCatalogLayoutDiagnostics as runReportNativeCatalogLayoutDiagnostics, } from "./native-catalog-layout-diagnostics.js";
|
|
32
34
|
import { exportAllFirestoreCollectionsToGcs, exportFirestoreCollectionToGcs, restoreAllFirestoreCollectionsFromGcsManifest, restoreFirestoreCollectionFromGcs, } from "./firestore-gcs-transfer.js";
|
|
33
35
|
import { compareAllFirestoreCollectionsWithGcsManifest, compareFirestoreCollectionWithGcsNdjson, } from "./firestore-gcs-compare.js";
|
|
36
|
+
import { CataloxBound } from "./catalox-bound.js";
|
|
34
37
|
export class Catalox {
|
|
35
38
|
deps;
|
|
36
39
|
constructor(deps) {
|
|
@@ -192,9 +195,13 @@ export class Catalox {
|
|
|
192
195
|
}
|
|
193
196
|
async buildCatalogItemRenderMap(context, catalogId, itemId, options) {
|
|
194
197
|
const descriptor = await this.getCatalogDescriptor(context, catalogId);
|
|
195
|
-
const
|
|
196
|
-
if (
|
|
198
|
+
const got = await this.getCatalogItem(context, catalogId, itemId);
|
|
199
|
+
if (got.outcome === "mapping_blocked") {
|
|
200
|
+
throw new CatalogAdapterError({ catalogId, reason: "mapping_validation_failed", issues: got.issues });
|
|
201
|
+
}
|
|
202
|
+
if (got.outcome === "not_found")
|
|
197
203
|
throw new CatalogNotFoundError({ catalogId, itemId });
|
|
204
|
+
const item = got.item;
|
|
198
205
|
const sources = this.gatherDescriptorSources(descriptor);
|
|
199
206
|
const resolvedSources = {};
|
|
200
207
|
if (options?.resolveSources !== false) {
|
|
@@ -373,7 +380,7 @@ export class Catalox {
|
|
|
373
380
|
createdAt: r.createdAt,
|
|
374
381
|
updatedAt: r.updatedAt,
|
|
375
382
|
}));
|
|
376
|
-
return { items };
|
|
383
|
+
return { listOutcome: "ok", items };
|
|
377
384
|
}
|
|
378
385
|
const def = await this.deps.definitions.get(catalogId);
|
|
379
386
|
if (!def || def.type !== "mapped")
|
|
@@ -383,7 +390,7 @@ export class Catalox {
|
|
|
383
390
|
throw new CatalogAdapterError({ catalogId, reason: "missing_mapping" });
|
|
384
391
|
const mappingIssues = validateMappingSpec(mapping.mapping);
|
|
385
392
|
if (mappingIssues.some((i) => i.severity === "error")) {
|
|
386
|
-
return { items: [], issues: mappingIssues };
|
|
393
|
+
return { listOutcome: "mapping_blocked", items: [], issues: mappingIssues };
|
|
387
394
|
}
|
|
388
395
|
if (def.adapterType === "mongo") {
|
|
389
396
|
if (!this.deps.mongoAdapter)
|
|
@@ -392,7 +399,9 @@ export class Catalox {
|
|
|
392
399
|
if (!adapterConfig)
|
|
393
400
|
throw new CatalogAdapterError({ catalogId, reason: "missing_adapter" });
|
|
394
401
|
const result = await this.deps.mongoAdapter.listItems(context, catalogId, adapterConfig, { mapping: mapping.mapping, ...(mapping.options ? { options: mapping.options } : {}) }, listQueryOptions);
|
|
395
|
-
return result.issues
|
|
402
|
+
return result.issues?.length
|
|
403
|
+
? { listOutcome: "ok", items: result.items, issues: result.issues }
|
|
404
|
+
: { listOutcome: "ok", items: result.items };
|
|
396
405
|
}
|
|
397
406
|
if (def.adapterType === "api") {
|
|
398
407
|
if (!this.deps.apiAdapter)
|
|
@@ -402,6 +411,7 @@ export class Catalox {
|
|
|
402
411
|
throw new CatalogAdapterError({ catalogId, reason: "missing_adapter" });
|
|
403
412
|
const result = await this.deps.apiAdapter.listItems(context, catalogId, adapterConfig, { responseMapping: mapping.mapping, ...(mapping.options ? { options: mapping.options } : {}) }, listQueryOptions);
|
|
404
413
|
return {
|
|
414
|
+
listOutcome: "ok",
|
|
405
415
|
items: result.items,
|
|
406
416
|
...(result.nextCursor ? { nextCursor: result.nextCursor } : {}),
|
|
407
417
|
...(result.issues ? { issues: result.issues } : {}),
|
|
@@ -417,7 +427,7 @@ export class Catalox {
|
|
|
417
427
|
if (catalog.sourceMode === "native") {
|
|
418
428
|
const rec = await this.deps.nativeItems.get(catalogId, itemId);
|
|
419
429
|
if (!rec)
|
|
420
|
-
return
|
|
430
|
+
return { outcome: "not_found" };
|
|
421
431
|
const base = {
|
|
422
432
|
itemId: rec.itemId,
|
|
423
433
|
catalogId: rec.catalogId,
|
|
@@ -429,15 +439,20 @@ export class Catalox {
|
|
|
429
439
|
createdAt: rec.createdAt,
|
|
430
440
|
updatedAt: rec.updatedAt,
|
|
431
441
|
};
|
|
432
|
-
return this.decorateItem(catalogId, base);
|
|
442
|
+
return { outcome: "found", item: await this.decorateItem(catalogId, base) };
|
|
433
443
|
}
|
|
434
444
|
// For mapped catalogs, use list path with filter if adapter supports.
|
|
435
445
|
const result = await this.listCatalogItems(context, catalogId, {
|
|
436
446
|
limit: 1,
|
|
437
447
|
filter: { itemId },
|
|
438
448
|
});
|
|
449
|
+
if (result.listOutcome === "mapping_blocked") {
|
|
450
|
+
return { outcome: "mapping_blocked", issues: result.issues ?? [] };
|
|
451
|
+
}
|
|
439
452
|
const first = result.items[0];
|
|
440
|
-
|
|
453
|
+
if (!first)
|
|
454
|
+
return { outcome: "not_found" };
|
|
455
|
+
return { outcome: "found", item: await this.decorateItem(catalogId, first) };
|
|
441
456
|
}
|
|
442
457
|
async validateCatalog(_context, _catalogId) {
|
|
443
458
|
return { isValid: true, issues: [] };
|
|
@@ -1056,6 +1071,35 @@ export class Catalox {
|
|
|
1056
1071
|
catalogDataIndex: this.deps.catalogDataIndex,
|
|
1057
1072
|
}, input);
|
|
1058
1073
|
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Restore live Firestore from one **`backupData` GCS** run (`metadata/`, `native/`, optional `snapshots/` NDJSON).
|
|
1076
|
+
* Captures pre-restore copies to `{session}__preRestore-*` first; **`undoFirestoreRestore`** works the same as for `restoreFirestoreBackup`.
|
|
1077
|
+
*/
|
|
1078
|
+
async restoreFirestoreBackupFromGcs(_context, input) {
|
|
1079
|
+
return runRestoreFirestoreBackupFromGcs({
|
|
1080
|
+
firestoreStore: this.deps.firestoreStore,
|
|
1081
|
+
catalogs: this.deps.catalogs,
|
|
1082
|
+
bindings: this.deps.bindings,
|
|
1083
|
+
nativeItems: this.deps.nativeItems,
|
|
1084
|
+
definitions: this.deps.definitions,
|
|
1085
|
+
catalogDataIndex: this.deps.catalogDataIndex,
|
|
1086
|
+
}, input);
|
|
1087
|
+
}
|
|
1088
|
+
/** Delete oldest GCS Catalox backup **run folders** (children of the base prefix) until `keepLast` newest remain. */
|
|
1089
|
+
async pruneGcsBackupRuns(_context, input) {
|
|
1090
|
+
return pruneGcsBackupRuns(input);
|
|
1091
|
+
}
|
|
1092
|
+
/** Delete every object under one GCS backup run folder (operator cleanup). */
|
|
1093
|
+
async deleteCataloxGcsBackupRun(_context, input) {
|
|
1094
|
+
return runDeleteCataloxGcsBackupRun(input);
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Map a **`catalox-backup-manifest.json`** payload into the **`catalox-firestore-export-manifest.json`** shape
|
|
1098
|
+
* so `restoreAllFirestoreCollectionsFromGcsManifest` / CLI `import-gcs --restore-all` can consume the same NDJSON objects.
|
|
1099
|
+
*/
|
|
1100
|
+
cataloxGcsBackupManifestToExportManifest(manifest, gcsRunFolder) {
|
|
1101
|
+
return cataloxGcsBackupManifestToFirestoreExportManifest(manifest, gcsRunFolder);
|
|
1102
|
+
}
|
|
1059
1103
|
/**
|
|
1060
1104
|
* For each discovered native catalog: counts in legacy `catalogData/{id}/items` vs flat `catalogData-{id}-items`,
|
|
1061
1105
|
* and the resolver layout. Use when the console still shows the **legacy** subcollection `items` under `catalogData/{catalogId}`.
|
|
@@ -1122,6 +1166,12 @@ export class Catalox {
|
|
|
1122
1166
|
firestore: this.deps.firestoreStore.firestore,
|
|
1123
1167
|
});
|
|
1124
1168
|
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Fix {@link CataloxContext} for subsequent calls so embedders omit it on each method (no globals).
|
|
1171
|
+
*/
|
|
1172
|
+
withContext(context) {
|
|
1173
|
+
return new CataloxBound(this, context);
|
|
1174
|
+
}
|
|
1125
1175
|
}
|
|
1126
1176
|
// (moved to `src/contracts/bootstrap.ts`)
|
|
1127
1177
|
//# sourceMappingURL=catalox.js.map
|