@x12i/catalox 2.4.0 → 2.6.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.
Files changed (66) hide show
  1. package/README.md +43 -4
  2. package/dist/src/catalox/backup-data.d.ts +2 -4
  3. package/dist/src/catalox/backup-data.d.ts.map +1 -1
  4. package/dist/src/catalox/backup-data.js +206 -1
  5. package/dist/src/catalox/backup-data.js.map +1 -1
  6. package/dist/src/catalox/catalox.d.ts +17 -0
  7. package/dist/src/catalox/catalox.d.ts.map +1 -1
  8. package/dist/src/catalox/catalox.js +64 -6
  9. package/dist/src/catalox/catalox.js.map +1 -1
  10. package/dist/src/catalox/firestore-gcs-compare.d.ts +15 -0
  11. package/dist/src/catalox/firestore-gcs-compare.d.ts.map +1 -0
  12. package/dist/src/catalox/firestore-gcs-compare.js +221 -0
  13. package/dist/src/catalox/firestore-gcs-compare.js.map +1 -0
  14. package/dist/src/catalox/firestore-gcs-transfer.d.ts +24 -0
  15. package/dist/src/catalox/firestore-gcs-transfer.d.ts.map +1 -0
  16. package/dist/src/catalox/firestore-gcs-transfer.js +329 -0
  17. package/dist/src/catalox/firestore-gcs-transfer.js.map +1 -0
  18. package/dist/src/catalox/index.d.ts +3 -1
  19. package/dist/src/catalox/index.d.ts.map +1 -1
  20. package/dist/src/catalox/index.js +3 -1
  21. package/dist/src/catalox/index.js.map +1 -1
  22. package/dist/src/cli/index.js +188 -4
  23. package/dist/src/cli/index.js.map +1 -1
  24. package/dist/src/contracts/backup.d.ts +11 -1
  25. package/dist/src/contracts/backup.d.ts.map +1 -1
  26. package/dist/src/contracts/catalogs.d.ts +6 -0
  27. package/dist/src/contracts/catalogs.d.ts.map +1 -1
  28. package/dist/src/contracts/catalogs.js +18 -1
  29. package/dist/src/contracts/catalogs.js.map +1 -1
  30. package/dist/src/contracts/gcs-firestore-compare.d.ts +64 -0
  31. package/dist/src/contracts/gcs-firestore-compare.d.ts.map +1 -0
  32. package/dist/src/contracts/gcs-firestore-compare.js +2 -0
  33. package/dist/src/contracts/gcs-firestore-compare.js.map +1 -0
  34. package/dist/src/contracts/gcs-firestore-transfer.d.ts +94 -0
  35. package/dist/src/contracts/gcs-firestore-transfer.d.ts.map +1 -0
  36. package/dist/src/contracts/gcs-firestore-transfer.js +2 -0
  37. package/dist/src/contracts/gcs-firestore-transfer.js.map +1 -0
  38. package/dist/src/contracts/index.d.ts +3 -0
  39. package/dist/src/contracts/index.d.ts.map +1 -1
  40. package/dist/src/contracts/index.js +1 -0
  41. package/dist/src/contracts/index.js.map +1 -1
  42. package/dist/src/firebase/firestore-collection-path.d.ts +7 -0
  43. package/dist/src/firebase/firestore-collection-path.d.ts.map +1 -0
  44. package/dist/src/firebase/firestore-collection-path.js +24 -0
  45. package/dist/src/firebase/firestore-collection-path.js.map +1 -0
  46. package/dist/src/firebase/native-item-store.d.ts +6 -0
  47. package/dist/src/firebase/native-item-store.d.ts.map +1 -1
  48. package/dist/src/firebase/native-item-store.js +18 -1
  49. package/dist/src/firebase/native-item-store.js.map +1 -1
  50. package/dist/test/unit/compact-catalog-filter.test.d.ts +2 -0
  51. package/dist/test/unit/compact-catalog-filter.test.d.ts.map +1 -0
  52. package/dist/test/unit/compact-catalog-filter.test.js +18 -0
  53. package/dist/test/unit/compact-catalog-filter.test.js.map +1 -0
  54. package/dist/test/unit/gcs-backup-run-folder.test.d.ts +2 -0
  55. package/dist/test/unit/gcs-backup-run-folder.test.d.ts.map +1 -0
  56. package/dist/test/unit/gcs-backup-run-folder.test.js +10 -0
  57. package/dist/test/unit/gcs-backup-run-folder.test.js.map +1 -0
  58. package/dist/test/unit/gcs-firestore-compare.test.d.ts +2 -0
  59. package/dist/test/unit/gcs-firestore-compare.test.d.ts.map +1 -0
  60. package/dist/test/unit/gcs-firestore-compare.test.js +14 -0
  61. package/dist/test/unit/gcs-firestore-compare.test.js.map +1 -0
  62. package/dist/test/unit/gcs-firestore-paths.test.d.ts +2 -0
  63. package/dist/test/unit/gcs-firestore-paths.test.d.ts.map +1 -0
  64. package/dist/test/unit/gcs-firestore-paths.test.js +16 -0
  65. package/dist/test/unit/gcs-firestore-paths.test.js.map +1 -0
  66. package/package.json +5 -3
@@ -0,0 +1,14 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { Timestamp } from "firebase-admin/firestore";
4
+ import { dataFingerprint, normalizeForCompare } from "../../src/catalox/firestore-gcs-compare.js";
5
+ test("normalizeForCompare maps Timestamp and JSON seconds shape consistently", () => {
6
+ const ts = new Timestamp(1700000000, 123000000);
7
+ const fromJson = { _seconds: 1700000000, _nanoseconds: 123000000 };
8
+ assert.equal(JSON.stringify(normalizeForCompare(ts)), JSON.stringify(normalizeForCompare(fromJson)));
9
+ assert.equal(dataFingerprint(ts), dataFingerprint(fromJson));
10
+ });
11
+ test("dataFingerprint differs when data differs", () => {
12
+ assert.notEqual(dataFingerprint({ a: 1 }), dataFingerprint({ a: 2 }));
13
+ });
14
+ //# sourceMappingURL=gcs-firestore-compare.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcs-firestore-compare.test.js","sourceRoot":"","sources":["../../../test/unit/gcs-firestore-compare.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAElG,IAAI,CAAC,wEAAwE,EAAE,GAAG,EAAE;IAClF,MAAM,EAAE,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;IACnE,MAAM,CAAC,KAAK,CACV,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAC9C,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gcs-firestore-paths.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcs-firestore-paths.test.d.ts","sourceRoot":"","sources":["../../../test/unit/gcs-firestore-paths.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { firestoreCollectionPathToObjectBase, ndjsonObjectPath, normalizeGcsPrefix, } from "../../src/catalox/firestore-gcs-transfer.js";
4
+ test("normalizeGcsPrefix trims and adds trailing slash", () => {
5
+ assert.equal(normalizeGcsPrefix(""), "");
6
+ assert.equal(normalizeGcsPrefix(" a/b "), "a/b/");
7
+ });
8
+ test("firestoreCollectionPathToObjectBase flattens slashes", () => {
9
+ assert.equal(firestoreCollectionPathToObjectBase("apps"), "apps");
10
+ assert.equal(firestoreCollectionPathToObjectBase("catalogData/narratives/items"), "catalogData__narratives__items");
11
+ });
12
+ test("ndjsonObjectPath applies optional postfix", () => {
13
+ assert.equal(ndjsonObjectPath({ gcsPrefix: "p/", collectionPath: "apps" }), "p/apps.ndjson");
14
+ assert.equal(ndjsonObjectPath({ gcsPrefix: "", collectionPath: "apps", objectNamePostfix: "_v1" }), "apps_v1.ndjson");
15
+ });
16
+ //# sourceMappingURL=gcs-firestore-paths.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gcs-firestore-paths.test.js","sourceRoot":"","sources":["../../../test/unit/gcs-firestore-paths.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EACL,mCAAmC,EACnC,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AAErD,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC5D,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAChE,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAClE,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,8BAA8B,CAAC,EAAE,gCAAgC,CAAC,CAAC;AACtH,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,CAAC,KAAK,CACV,gBAAgB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,EAC7D,eAAe,CAChB,CAAC;IACF,MAAM,CAAC,KAAK,CACV,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,EACrF,gBAAgB,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x12i/catalox",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Catalox: Firebase-native catalog metadata + unification package.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -16,6 +16,8 @@
16
16
  "mapping",
17
17
  "mongo",
18
18
  "adapter",
19
+ "gcs",
20
+ "google-cloud-storage",
19
21
  "x12i"
20
22
  ],
21
23
  "exports": {
@@ -44,11 +46,11 @@
44
46
  "lint": "node -e \"console.log('no lint configured')\""
45
47
  },
46
48
  "dependencies": {
47
- "@x12i/helpers": "^1.2.4",
49
+ "@google-cloud/storage": "^7.19.0",
50
+ "@x12i/helpers": "^1.4.0",
48
51
  "ajv": "^8.18.0",
49
52
  "ajv-formats": "^3.0.1",
50
53
  "commander": "^14.0.0",
51
- "dotenv": "^17.0.0",
52
54
  "esbuild": "^0.25.0",
53
55
  "firebase-admin": "^13.0.0",
54
56
  "mongodb": "^6.0.0"